@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.
@@ -0,0 +1,130 @@
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]="cdddab8b-5b12-5f35-a398-dbfffb15a0fb")}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 de(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function h(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 fe(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const pe={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function me(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 de(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 he(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 de(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 ge(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 de(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(!se(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return de(e,te(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ee(this,`shape`,n),n}}))}function ve(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return de(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 ye(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 de(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 be(e,t,n){return de(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 xe(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 Se(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 Ce(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function we(e){return typeof e==`string`?e:e?.message}function g(e,t,n){let r=e.message?e.message:we(e.inst?._zod.def?.error?.(e))??we(t?.error?.(e))??we(n.customError?.(e))??we(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 Te(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ee(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const De=(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})},Oe=n(`$ZodError`,De),ke=n(`$ZodError`,De,{Parent:Error});function Ae(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 je(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 Me=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=>g(e,s,o())));throw ie(t,a?.callee),t}return c.value},Ne=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=>g(e,a,o())));throw ie(t,i?.callee),t}return s.value},Pe=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??Oe)(s.issues.map(e=>g(e,a,o())))}:{success:!0,data:s.value}},Fe=Pe(ke),Ie=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=>g(e,i,o())))}:{success:!0,data:a.value}},Le=Ie(ke),Re=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Me(e)(t,n,i)},ze=e=>(t,n,r)=>Me(e)(t,n,r),Be=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ne(e)(t,n,i)},Ve=e=>async(t,n,r)=>Ne(e)(t,n,r),He=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Pe(e)(t,n,i)},Ue=e=>(t,n,r)=>Pe(e)(t,n,r),We=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ie(e)(t,n,i)},Ge=e=>async(t,n,r)=>Ie(e)(t,n,r),Ke=/^[cC][0-9a-z]{6,}$/,qe=/^[0-9a-z]+$/,Je=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ye=/^[0-9a-vA-V]{20}$/,Xe=/^[A-Za-z0-9]{27}$/,Ze=/^[a-zA-Z0-9_-]{21}$/,Qe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,$e=/^([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})$/,et=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)$/,tt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function nt(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const rt=/^(?:(?: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])$/,it=/^(([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}|:))$/,at=/^((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])$/,ot=/^(([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])$/,st=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ct=/^[A-Za-z0-9_-]*$/,lt=/^https?$/,ut=/^\+[1-9]\d{6,14}$/,dt=`(?:(?:\\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])))`,ft=RegExp(`^${dt}$`);function pt(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 mt(e){return RegExp(`^${pt(e)}$`)}function ht(e){let t=pt({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(`^${dt}T(?:${r})$`)}const gt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},_t=/^-?\d+$/,vt=/^-?\d+(?:\.\d+)?$/,yt=/^(?:true|false)$/i,bt=/^null$/i,xt=/^[^A-Z]*$/,St=/^[^a-z]*$/,_=n(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ct={number:`number`,bigint:`bigint`,object:`date`},wt=n(`$ZodCheckLessThan`,(e,t)=>{_.init(e,t);let n=Ct[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})}}),Tt=n(`$ZodCheckGreaterThan`,(e,t)=>{_.init(e,t);let n=Ct[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})}}),Et=n(`$ZodCheckMultipleOf`,(e,t)=>{_.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})}}),Dt=n(`$ZodCheckNumberFormat`,(e,t)=>{_.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=pe[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=_t)}),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})}}),Ot=n(`$ZodCheckMaxLength`,(e,t)=>{var n;_.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=Te(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),kt=n(`$ZodCheckMinLength`,(e,t)=>{var n;_.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=Te(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),At=n(`$ZodCheckLengthEquals`,(e,t)=>{var n;_.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=Te(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})}}),jt=n(`$ZodCheckStringFormat`,(e,t)=>{var n,r;_.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=()=>{})}),Mt=n(`$ZodCheckRegex`,(e,t)=>{jt.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})}}),Nt=n(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=xt,jt.init(e,t)}),Pt=n(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=St,jt.init(e,t)}),Ft=n(`$ZodCheckIncludes`,(e,t)=>{_.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})}}),It=n(`$ZodCheckStartsWith`,(e,t)=>{_.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})}}),Lt=n(`$ZodCheckEndsWith`,(e,t)=>{_.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})}}),Rt=n(`$ZodCheckOverwrite`,(e,t)=>{_.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var zt=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 Bt={major:4,minor:4,patch:3},v=n(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Bt;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=xe(e),a;for(let o of t){if(o._zod.def.when){if(Se(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||=xe(e,t))});else{if(e.issues.length===t)continue;i||=xe(e,t)}}return a?a.then(()=>e):e},n=(n,a,o)=>{if(xe(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=Fe(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Le(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Vt=n(`$ZodString`,(e,t)=>{v.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??gt(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}}),y=n(`$ZodStringFormat`,(e,t)=>{jt.init(e,t),Vt.init(e,t)}),Ht=n(`$ZodGUID`,(e,t)=>{t.pattern??=$e,y.init(e,t)}),Ut=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??=et(e)}else t.pattern??=et();y.init(e,t)}),Wt=n(`$ZodEmail`,(e,t)=>{t.pattern??=tt,y.init(e,t)}),Gt=n(`$ZodURL`,(e,t)=>{y.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===lt.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})}}}),Kt=n(`$ZodEmoji`,(e,t)=>{t.pattern??=nt(),y.init(e,t)}),qt=n(`$ZodNanoID`,(e,t)=>{t.pattern??=Ze,y.init(e,t)}),Jt=n(`$ZodCUID`,(e,t)=>{t.pattern??=Ke,y.init(e,t)}),Yt=n(`$ZodCUID2`,(e,t)=>{t.pattern??=qe,y.init(e,t)}),Xt=n(`$ZodULID`,(e,t)=>{t.pattern??=Je,y.init(e,t)}),Zt=n(`$ZodXID`,(e,t)=>{t.pattern??=Ye,y.init(e,t)}),Qt=n(`$ZodKSUID`,(e,t)=>{t.pattern??=Xe,y.init(e,t)}),$t=n(`$ZodISODateTime`,(e,t)=>{t.pattern??=ht(t),y.init(e,t)}),en=n(`$ZodISODate`,(e,t)=>{t.pattern??=ft,y.init(e,t)}),tn=n(`$ZodISOTime`,(e,t)=>{t.pattern??=mt(t),y.init(e,t)}),nn=n(`$ZodISODuration`,(e,t)=>{t.pattern??=Qe,y.init(e,t)}),rn=n(`$ZodIPv4`,(e,t)=>{t.pattern??=rt,y.init(e,t),e._zod.bag.format=`ipv4`}),an=n(`$ZodIPv6`,(e,t)=>{t.pattern??=it,y.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})}}}),on=n(`$ZodCIDRv4`,(e,t)=>{t.pattern??=at,y.init(e,t)}),sn=n(`$ZodCIDRv6`,(e,t)=>{t.pattern??=ot,y.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 cn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const ln=n(`$ZodBase64`,(e,t)=>{t.pattern??=st,y.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{cn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function un(e){if(!ct.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return cn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const dn=n(`$ZodBase64URL`,(e,t)=>{t.pattern??=ct,y.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{un(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),fn=n(`$ZodE164`,(e,t)=>{t.pattern??=ut,y.init(e,t)});function pn(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 mn=n(`$ZodJWT`,(e,t)=>{y.init(e,t),e._zod.check=n=>{pn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),hn=n(`$ZodNumber`,(e,t)=>{v.init(e,t),e._zod.pattern=e._zod.bag.pattern??vt,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}}),gn=n(`$ZodNumberFormat`,(e,t)=>{Dt.init(e,t),hn.init(e,t)}),_n=n(`$ZodBoolean`,(e,t)=>{v.init(e,t),e._zod.pattern=yt,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}}),vn=n(`$ZodNull`,(e,t)=>{v.init(e,t),e._zod.pattern=bt,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}}),yn=n(`$ZodUnknown`,(e,t)=>{v.init(e,t),e._zod.parse=e=>e}),bn=n(`$ZodNever`,(e,t)=>{v.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function xn(e,t,n){e.issues.length&&t.issues.push(...Ce(n,e.issues)),t.value[n]=e.value}const Sn=n(`$ZodArray`,(e,t)=>{v.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=>xn(t,n,e))):xn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Cn(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Ce(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 wn(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=fe(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Tn(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=>Cn(e,n,i,t,u,d))):Cn(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 En=n(`$ZodObject`,(e,t)=>{if(v.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(()=>wn(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=>Cn(n,t,e,s,r,i))):Cn(a,t,e,s,r,i)}return i?Tn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Dn=n(`$ZodObjectJIT`,(e,t)=>{En.init(e,t);let n=e._zod.parse,r=l(()=>wn(t)),i=e=>{let t=new zt([`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?Tn([],p,a,l,f,e):a):n(a,l):(a.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),a)}});function On(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=>!xe(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=>g(e,r,o())))}),t)}const kn=n(`$ZodUnion`,(e,t)=>{v.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=>On(t,r,e,i)):On(o,r,e,i)}}),An=n(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,kn.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)}}),jn=n(`$ZodIntersection`,(e,t)=>{v.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])=>Nn(e,t,n)):Nn(e,i,a)}});function Mn(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=Mn(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=Mn(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 Nn(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}),xe(e))return e;let o=Mn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const Pn=n(`$ZodRecord`,(e,t)=>{v.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=>g(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(...Ce(l,e.issues)),n.value[u]=e.value})):(d.issues.length&&n.issues.push(...Ce(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`&&vt.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=>g(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(...Ce(s,e.issues)),n.value[c.value]=e.value})):(l.issues.length&&n.issues.push(...Ce(s,l.issues)),n.value[c.value]=l.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Fn=n(`$ZodEnum`,(e,t)=>{v.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}}),In=n(`$ZodLiteral`,(e,t)=>{if(v.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}}),Ln=n(`$ZodTransform`,(e,t)=>{v.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 Rn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const zn=n(`$ZodOptional`,(e,t)=>{v.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=>Rn(e,r)):Rn(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Bn=n(`$ZodExactOptional`,(e,t)=>{zn.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)}),Vn=n(`$ZodNullable`,(e,t)=>{v.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)}),Hn=n(`$ZodDefault`,(e,t)=>{v.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=>Un(e,t)):Un(r,t)}});function Un(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Wn=n(`$ZodPrefault`,(e,t)=>{v.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))}),Gn=n(`$ZodNonOptional`,(e,t)=>{v.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=>Kn(t,e)):Kn(i,e)}});function Kn(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 qn=n(`$ZodCatch`,(e,t)=>{v.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=>g(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=>g(e,n,o()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Jn=n(`$ZodPipe`,(e,t)=>{v.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=>Yn(e,t.in,n)):Yn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Yn(e,t.out,n)):Yn(r,t.out,n)}});function Yn(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 Xn=n(`$ZodReadonly`,(e,t)=>{v.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(Zn):Zn(r)}});function Zn(e){return e.value=Object.freeze(e.value),e}const Qn=n(`$ZodLazy`,(e,t)=>{v.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)}),$n=n(`$ZodCustom`,(e,t)=>{_.init(e,t),v.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=>er(t,n,r,e));er(i,n,r,e)}});function er(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(Ee(e))}}var tr,nr=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 rr(){return new nr}(tr=globalThis).__zod_globalRegistry??(tr.__zod_globalRegistry=rr());const ir=globalThis.__zod_globalRegistry;function ar(e,t){return new e({type:`string`,...h(t)})}function or(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...h(t)})}function sr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...h(t)})}function cr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...h(t)})}function lr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...h(t)})}function ur(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...h(t)})}function dr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...h(t)})}function fr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...h(t)})}function pr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...h(t)})}function mr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...h(t)})}function hr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...h(t)})}function gr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...h(t)})}function _r(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...h(t)})}function vr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...h(t)})}function yr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...h(t)})}function br(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...h(t)})}function xr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...h(t)})}function Sr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...h(t)})}function Cr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...h(t)})}function wr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...h(t)})}function Tr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...h(t)})}function Er(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...h(t)})}function Dr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...h(t)})}function Or(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...h(t)})}function kr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...h(t)})}function Ar(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...h(t)})}function jr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...h(t)})}function Mr(e,t){return new e({type:`number`,checks:[],...h(t)})}function Nr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...h(t)})}function Pr(e,t){return new e({type:`boolean`,...h(t)})}function Fr(e,t){return new e({type:`null`,...h(t)})}function Ir(e){return new e({type:`unknown`})}function Lr(e,t){return new e({type:`never`,...h(t)})}function Rr(e,t){return new wt({check:`less_than`,...h(t),value:e,inclusive:!1})}function zr(e,t){return new wt({check:`less_than`,...h(t),value:e,inclusive:!0})}function Br(e,t){return new Tt({check:`greater_than`,...h(t),value:e,inclusive:!1})}function Vr(e,t){return new Tt({check:`greater_than`,...h(t),value:e,inclusive:!0})}function Hr(e,t){return new Et({check:`multiple_of`,...h(t),value:e})}function Ur(e,t){return new Ot({check:`max_length`,...h(t),maximum:e})}function Wr(e,t){return new kt({check:`min_length`,...h(t),minimum:e})}function Gr(e,t){return new At({check:`length_equals`,...h(t),length:e})}function Kr(e,t){return new Mt({check:`string_format`,format:`regex`,...h(t),pattern:e})}function qr(e){return new Nt({check:`string_format`,format:`lowercase`,...h(e)})}function Jr(e){return new Pt({check:`string_format`,format:`uppercase`,...h(e)})}function Yr(e,t){return new Ft({check:`string_format`,format:`includes`,...h(t),includes:e})}function Xr(e,t){return new It({check:`string_format`,format:`starts_with`,...h(t),prefix:e})}function Zr(e,t){return new Lt({check:`string_format`,format:`ends_with`,...h(t),suffix:e})}function Qr(e){return new Rt({check:`overwrite`,tx:e})}function $r(e){return Qr(t=>t.normalize(e))}function ei(){return Qr(e=>e.trim())}function ti(){return Qr(e=>e.toLowerCase())}function ni(){return Qr(e=>e.toUpperCase())}function ri(){return Qr(e=>re(e))}function ii(e,t,n){return new e({type:`array`,element:t,...h(n)})}function ai(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...h(n)})}function oi(e,t){let n=si(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ee(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(Ee(r))}},e(t.value,t)),t);return n}function si(e,t){let n=new _({check:`custom`,...h(t)});return n._zod.check=e,n}function ci(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??ir,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 b(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,b(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`&&x(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 li(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 ui(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:fi(t,`input`,e.processors),output:fi(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function x(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 x(r.element,n);if(r.type===`set`)return x(r.valueType,n);if(r.type===`lazy`)return x(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 x(r.innerType,n);if(r.type===`intersection`)return x(r.left,n)||x(r.right,n);if(r.type===`record`||r.type===`map`)return x(r.keyType,n)||x(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:x(r.in,n)||x(r.out,n);if(r.type===`object`){for(let e in r.shape)if(x(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(x(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(x(e,n))return!0;return!!(r.rest&&x(r.rest,n))}return!1}const di=(e,t={})=>n=>{let r=ci({...n,processors:t});return b(e,r),li(r,e),ui(r,e)},fi=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ci({...i??{},target:a,io:t,processors:n});return b(e,o),li(o,e),ui(o,e)},pi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},mi=(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=pi[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}))])}},hi=(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)},gi=(e,t,n,r)=>{n.type=`boolean`},_i=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},vi=(e,t,n,r)=>{n.not={}},yi=(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},bi=(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},xi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Si=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ci=(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=b(a.element,t,{...r,path:[...r.path,`items`]})},wi=(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]=b(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=b(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ti=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>b(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ei=(e,t,n,r)=>{let i=e._zod.def,a=b(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=b(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]]},Di=(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=b(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=b(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=b(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)}},Oi=(e,t,n,r)=>{let i=e._zod.def,a=b(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`}]},ki=(e,t,n,r)=>{let i=e._zod.def;b(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ai=(e,t,n,r)=>{let i=e._zod.def;b(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ji=(e,t,n,r)=>{let i=e._zod.def;b(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)))},Mi=(e,t,n,r)=>{let i=e._zod.def;b(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},Ni=(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;b(o,t,r);let s=t.seen.get(e);s.ref=o},Pi=(e,t,n,r)=>{let i=e._zod.def;b(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Fi=(e,t,n,r)=>{let i=e._zod.def;b(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ii=(e,t,n,r)=>{let i=e._zod.innerType;b(i,t,r);let a=t.seen.get(e);a.ref=i},Li=n(`ZodISODateTime`,(e,t)=>{$t.init(e,t),T.init(e,t)});function Ri(e){return Or(Li,e)}const zi=n(`ZodISODate`,(e,t)=>{en.init(e,t),T.init(e,t)});function Bi(e){return kr(zi,e)}const Vi=n(`ZodISOTime`,(e,t)=>{tn.init(e,t),T.init(e,t)});function Hi(e){return Ar(Vi,e)}const Ui=n(`ZodISODuration`,(e,t)=>{nn.init(e,t),T.init(e,t)});function Wi(e){return jr(Ui,e)}const S=n(`ZodError`,(e,t)=>{Oe.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>je(e,t)},flatten:{value:t=>Ae(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}),Gi=Me(S),Ki=Ne(S),qi=Pe(S),Ji=Ie(S),Yi=Re(S),Xi=ze(S),Zi=Be(S),Qi=Ve(S),$i=He(S),ea=Ue(S),ta=We(S),na=Ge(S),ra=new WeakMap;function ia(e,t,n){let r=Object.getPrototypeOf(e),i=ra.get(r);if(i||(i=new Set,ra.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 C=n(`ZodType`,(e,t)=>(v.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:fi(e,`input`),output:fi(e,`output`)}}),e.toJSONSchema=di(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>Gi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>qi(e,t,n),e.parseAsync=async(t,n)=>Ki(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ji(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Yi(e,t,n),e.decode=(t,n)=>Xi(e,t,n),e.encodeAsync=async(t,n)=>Zi(e,t,n),e.decodeAsync=async(t,n)=>Qi(e,t,n),e.safeEncode=(t,n)=>$i(e,t,n),e.safeDecode=(t,n)=>ea(e,t,n),e.safeEncodeAsync=async(t,n)=>ta(e,t,n),e.safeDecodeAsync=async(t,n)=>na(e,t,n),ia(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 de(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(xo(e,t))},superRefine(e,t){return this.check(So(e,t))},overwrite(e){return this.check(Qr(e))},optional(){return eo(this)},exactOptional(){return no(this)},nullable(){return io(this)},nullish(){return eo(io(this))},nonoptional(e){return uo(this,e)},array(){return E(this)},or(e){return Va([this,e])},and(e){return Ga(this,e)},transform(e){return ho(this,Qa(e))},default(e){return oo(this,e)},prefault(e){return co(this,e)},catch(e){return po(this,e)},pipe(e){return ho(this,e)},readonly(){return _o(this)},describe(e){let t=this.clone();return ir.add(t,{description:e}),t},meta(...e){if(e.length===0)return ir.get(this);let t=this.clone();return ir.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 ir.get(e)?.description},configurable:!0}),e)),aa=n(`_ZodString`,(e,t)=>{Vt.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ia(e,`_ZodString`,{regex(...e){return this.check(Kr(...e))},includes(...e){return this.check(Yr(...e))},startsWith(...e){return this.check(Xr(...e))},endsWith(...e){return this.check(Zr(...e))},min(...e){return this.check(Wr(...e))},max(...e){return this.check(Ur(...e))},length(...e){return this.check(Gr(...e))},nonempty(...e){return this.check(Wr(1,...e))},lowercase(e){return this.check(qr(e))},uppercase(e){return this.check(Jr(e))},trim(){return this.check(ei())},normalize(...e){return this.check($r(...e))},toLowerCase(){return this.check(ti())},toUpperCase(){return this.check(ni())},slugify(){return this.check(ri())}})}),oa=n(`ZodString`,(e,t)=>{Vt.init(e,t),aa.init(e,t),e.email=t=>e.check(or(sa,t)),e.url=t=>e.check(fr(ua,t)),e.jwt=t=>e.check(Dr(Ta,t)),e.emoji=t=>e.check(pr(da,t)),e.guid=t=>e.check(sr(ca,t)),e.uuid=t=>e.check(cr(la,t)),e.uuidv4=t=>e.check(lr(la,t)),e.uuidv6=t=>e.check(ur(la,t)),e.uuidv7=t=>e.check(dr(la,t)),e.nanoid=t=>e.check(mr(fa,t)),e.guid=t=>e.check(sr(ca,t)),e.cuid=t=>e.check(hr(pa,t)),e.cuid2=t=>e.check(gr(ma,t)),e.ulid=t=>e.check(_r(ha,t)),e.base64=t=>e.check(wr(Sa,t)),e.base64url=t=>e.check(Tr(Ca,t)),e.xid=t=>e.check(vr(ga,t)),e.ksuid=t=>e.check(yr(_a,t)),e.ipv4=t=>e.check(br(va,t)),e.ipv6=t=>e.check(xr(ya,t)),e.cidrv4=t=>e.check(Sr(ba,t)),e.cidrv6=t=>e.check(Cr(xa,t)),e.e164=t=>e.check(Er(wa,t)),e.datetime=t=>e.check(Ri(t)),e.date=t=>e.check(Bi(t)),e.time=t=>e.check(Hi(t)),e.duration=t=>e.check(Wi(t))});function w(e){return ar(oa,e)}const T=n(`ZodStringFormat`,(e,t)=>{y.init(e,t),aa.init(e,t)}),sa=n(`ZodEmail`,(e,t)=>{Wt.init(e,t),T.init(e,t)}),ca=n(`ZodGUID`,(e,t)=>{Ht.init(e,t),T.init(e,t)}),la=n(`ZodUUID`,(e,t)=>{Ut.init(e,t),T.init(e,t)}),ua=n(`ZodURL`,(e,t)=>{Gt.init(e,t),T.init(e,t)}),da=n(`ZodEmoji`,(e,t)=>{Kt.init(e,t),T.init(e,t)}),fa=n(`ZodNanoID`,(e,t)=>{qt.init(e,t),T.init(e,t)}),pa=n(`ZodCUID`,(e,t)=>{Jt.init(e,t),T.init(e,t)}),ma=n(`ZodCUID2`,(e,t)=>{Yt.init(e,t),T.init(e,t)}),ha=n(`ZodULID`,(e,t)=>{Xt.init(e,t),T.init(e,t)}),ga=n(`ZodXID`,(e,t)=>{Zt.init(e,t),T.init(e,t)}),_a=n(`ZodKSUID`,(e,t)=>{Qt.init(e,t),T.init(e,t)}),va=n(`ZodIPv4`,(e,t)=>{rn.init(e,t),T.init(e,t)}),ya=n(`ZodIPv6`,(e,t)=>{an.init(e,t),T.init(e,t)}),ba=n(`ZodCIDRv4`,(e,t)=>{on.init(e,t),T.init(e,t)}),xa=n(`ZodCIDRv6`,(e,t)=>{sn.init(e,t),T.init(e,t)}),Sa=n(`ZodBase64`,(e,t)=>{ln.init(e,t),T.init(e,t)}),Ca=n(`ZodBase64URL`,(e,t)=>{dn.init(e,t),T.init(e,t)}),wa=n(`ZodE164`,(e,t)=>{fn.init(e,t),T.init(e,t)}),Ta=n(`ZodJWT`,(e,t)=>{mn.init(e,t),T.init(e,t)}),Ea=n(`ZodNumber`,(e,t)=>{hn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r),ia(e,`ZodNumber`,{gt(e,t){return this.check(Br(e,t))},gte(e,t){return this.check(Vr(e,t))},min(e,t){return this.check(Vr(e,t))},lt(e,t){return this.check(Rr(e,t))},lte(e,t){return this.check(zr(e,t))},max(e,t){return this.check(zr(e,t))},int(e){return this.check(ka(e))},safe(e){return this.check(ka(e))},positive(e){return this.check(Br(0,e))},nonnegative(e){return this.check(Vr(0,e))},negative(e){return this.check(Rr(0,e))},nonpositive(e){return this.check(zr(0,e))},multipleOf(e,t){return this.check(Hr(e,t))},step(e,t){return this.check(Hr(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 Da(e){return Mr(Ea,e)}const Oa=n(`ZodNumberFormat`,(e,t)=>{gn.init(e,t),Ea.init(e,t)});function ka(e){return Nr(Oa,e)}const Aa=n(`ZodBoolean`,(e,t)=>{_n.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r)});function ja(e){return Pr(Aa,e)}const Ma=n(`ZodNull`,(e,t)=>{vn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_i(e,t,n,r)});function Na(e){return Fr(Ma,e)}const Pa=n(`ZodUnknown`,(e,t)=>{yn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Fa(){return Ir(Pa)}const Ia=n(`ZodNever`,(e,t)=>{bn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(e,t,n,r)});function La(e){return Lr(Ia,e)}const Ra=n(`ZodArray`,(e,t)=>{Sn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),e.element=t.element,ia(e,`ZodArray`,{min(e,t){return this.check(Wr(e,t))},nonempty(e){return this.check(Wr(1,e))},max(e,t){return this.check(Ur(e,t))},length(e,t){return this.check(Gr(e,t))},unwrap(){return this.element}})});function E(e,t){return ii(Ra,e,t)}const za=n(`ZodObject`,(e,t)=>{Dn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r),m(e,`shape`,()=>t.shape),ia(e,`ZodObject`,{keyof(){return Ya(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Fa()})},loose(){return this.clone({...this._zod.def,catchall:Fa()})},strict(){return this.clone({...this._zod.def,catchall:La()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ge(this,e)},safeExtend(e){return _e(this,e)},merge(e){return ve(this,e)},pick(e){return me(this,e)},omit(e){return he(this,e)},partial(...e){return ye($a,this,e[0])},required(...e){return be(lo,this,e[0])}})});function D(e,t){return new za({type:`object`,shape:e??{},...h(t)})}const Ba=n(`ZodUnion`,(e,t)=>{kn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),e.options=t.options});function Va(e,t){return new Ba({type:`union`,options:e,...h(t)})}const Ha=n(`ZodDiscriminatedUnion`,(e,t)=>{Ba.init(e,t),An.init(e,t)});function Ua(e,t,n){return new Ha({type:`union`,options:t,discriminator:e,...h(n)})}const Wa=n(`ZodIntersection`,(e,t)=>{jn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r)});function Ga(e,t){return new Wa({type:`intersection`,left:e,right:t})}const Ka=n(`ZodRecord`,(e,t)=>{Pn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function qa(e,t,n){return!t||!t._zod?new Ka({type:`record`,keyType:w(),valueType:e,...h(t)}):new Ka({type:`record`,keyType:e,valueType:t,...h(n)})}const Ja=n(`ZodEnum`,(e,t)=>{Fn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(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 Ja({...t,checks:[],...h(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 Ja({...t,checks:[],...h(r),entries:i})}});function Ya(e,t){return new Ja({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...h(t)})}function O(e,t){return new Ja({type:`enum`,entries:e,...h(t)})}const Xa=n(`ZodLiteral`,(e,t)=>{In.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(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 k(e,t){return new Xa({type:`literal`,values:Array.isArray(e)?e:[e],...h(t)})}const Za=n(`ZodTransform`,(e,t)=>{Ln.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(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(Ee(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(Ee(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 Qa(e){return new Za({type:`transform`,transform:e})}const $a=n(`ZodOptional`,(e,t)=>{zn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function eo(e){return new $a({type:`optional`,innerType:e})}const to=n(`ZodExactOptional`,(e,t)=>{Bn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function no(e){return new to({type:`optional`,innerType:e})}const ro=n(`ZodNullable`,(e,t)=>{Vn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function io(e){return new ro({type:`nullable`,innerType:e})}const ao=n(`ZodDefault`,(e,t)=>{Hn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function oo(e,t){return new ao({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ce(t)}})}const so=n(`ZodPrefault`,(e,t)=>{Wn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function co(e,t){return new so({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ce(t)}})}const lo=n(`ZodNonOptional`,(e,t)=>{Gn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uo(e,t){return new lo({type:`nonoptional`,innerType:e,...h(t)})}const fo=n(`ZodCatch`,(e,t)=>{qn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function po(e,t){return new fo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const mo=n(`ZodPipe`,(e,t)=>{Jn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.in=t.in,e.out=t.out});function ho(e,t){return new mo({type:`pipe`,in:e,out:t})}const go=n(`ZodReadonly`,(e,t)=>{Xn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _o(e){return new go({type:`readonly`,innerType:e})}const vo=n(`ZodLazy`,(e,t)=>{Qn.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function yo(e){return new vo({type:`lazy`,getter:e})}const bo=n(`ZodCustom`,(e,t)=>{$n.init(e,t),C.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r)});function xo(e,t={}){return ai(bo,e,t)}function So(e,t){return oi(e,t)}const A={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=yo(()=>Va([w(),Da(),ja(),Na(),E(To),qa(w(),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=D({type:w().trim().min(1)}).catchall(To),Ao=D({version:k(1),blocks:E(ko)}),jo=D({type:k(`opening-options`),data:D({text:w().trim().max(500),instruction:w().trim().max(2e3).optional(),file:D({types:E(O(Oo)).min(1).max(5),otherExtensions:E(w().trim().min(1).max(24)).max(50).optional()}).optional()})}),Mo=D({hints:Ao.optional(),options:E(jo).max(20).optional()}),No=D({version:k(`1.0.0`),name:w().trim().max(128),description:w().trim().max(500),icon:O(Eo),background:O(Do),nodes:E(D({id:w().trim().min(1),position:D({x:Da().finite(),y:Da().finite()}),data:D({type:k(`task`),icon:O(Eo),background:O(Do),title:w().trim().min(1).max(30),instructions:w().max(1e5),conversation_opener:Mo.optional()})})),edges:E(D({id:w().trim().min(1),source:w().trim().min(1),target:w().trim().min(1)}))}).superRefine((e,t)=>{let n=new Set;for(let r of e.nodes)n.has(r.id)&&t.addIssue({code:A.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:A.custom,message:`Duplicate edge id`,path:[`edges`]}),r.add(o.id),o.source===o.target&&t.addIssue({code:A.custom,message:`Edge cannot connect a node to itself`,path:[`edges`]}),(!n.has(o.source)||!n.has(o.target))&&t.addIssue({code:A.custom,message:`Edge endpoint is missing`,path:[`edges`]});let e=(i.get(o.target)??0)+1;e>1&&t.addIssue({code:A.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:A.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=D({id:w().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.OPENAI=`openai`,e.ANTHROPIC=`anthropic`,e.BEDROCK=`bedrock`,e.OPENROUTER=`openrouter`,e.OPENAI_COMPATIBLE=`openai-compatible`,e.DEEPSEEK=`deepseek`,e}({});const j={API_KEY:`apiKey`,BASE_URL:`baseUrl`,ORGANIZATION:`organization`,REGION:`region`,VALIDATION_MODEL:`validationModel`},M={SECURE:`secure`,TEXT:`text`,JSON:`json`},Lo={openrouter:{provider:`openrouter`,label:`OpenRouter`,sortOrder:10,fields:[{name:j.API_KEY,label:`API key`,type:M.SECURE,required:!0},{name:j.BASE_URL,label:`Custom API endpoint URL`,type:M.TEXT,required:!1,placeholder:`https://openrouter.ai/api/v1`},{name:j.VALIDATION_MODEL,label:`Validation model`,type:M.TEXT,required:!1,defaultValue:`anthropic/claude-haiku-4.5`}]},openai:{provider:`openai`,label:`OpenAI`,sortOrder:20,fields:[{name:j.API_KEY,label:`API key`,type:M.SECURE,required:!0},{name:j.BASE_URL,label:`Custom API endpoint URL`,type:M.TEXT,required:!1,placeholder:`https://api.openai.com/v1`},{name:j.ORGANIZATION,label:`Organization`,type:M.TEXT,required:!1},{name:j.VALIDATION_MODEL,label:`Validation model`,type:M.TEXT,required:!1,defaultValue:`gpt-5.5`}]},anthropic:{provider:`anthropic`,label:`Anthropic`,sortOrder:30,fields:[{name:j.API_KEY,label:`API key`,type:M.SECURE,required:!0},{name:j.BASE_URL,label:`Custom API endpoint URL`,type:M.TEXT,required:!1,placeholder:`https://api.anthropic.com`},{name:j.VALIDATION_MODEL,label:`Validation model`,type:M.TEXT,required:!1,defaultValue:`claude-haiku-4-5`}]},bedrock:{provider:`bedrock`,label:`Bedrock`,sortOrder:40,fields:[{name:j.API_KEY,label:`API key`,type:M.SECURE,required:!0},{name:j.BASE_URL,label:`Custom API endpoint URL`,type:M.TEXT,required:!1,placeholder:`https://bedrock-runtime.{region}.amazonaws.com`},{name:j.REGION,label:`AWS region`,type:M.TEXT,required:!0,defaultValue:`us-east-1`},{name:j.VALIDATION_MODEL,label:`Validation model`,type:M.TEXT,required:!1,defaultValue:`global.anthropic.claude-haiku-4-5-20251001-v1:0`}]},"openai-compatible":{provider:`openai-compatible`,label:`OpenAI Compatible`,sortOrder:50,fields:[{name:j.API_KEY,label:`API key`,type:M.SECURE,required:!0},{name:j.BASE_URL,label:`API endpoint URL`,type:M.TEXT,required:!0,placeholder:`https://api.example.com/v1`},{name:j.VALIDATION_MODEL,label:`Validation model`,type:M.TEXT,required:!0,placeholder:`provider/model-id`}]},deepseek:{provider:`deepseek`,label:`DeepSeek`,sortOrder:60,fields:[{name:j.API_KEY,label:`API key`,type:M.SECURE,required:!0},{name:j.BASE_URL,label:`Custom API endpoint URL`,type:M.TEXT,required:!1,defaultValue:`https://api.deepseek.com`},{name:j.VALIDATION_MODEL,label:`Validation model`,type:M.TEXT,required:!1,defaultValue:`deepseek-v4-flash`}]}};Object.values(Lo).sort((e,t)=>e.sortOrder-t.sortOrder);let 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.DEEPSEEK=`deepseek`,e.CUSTOM=`custom`,e}({});const Bo=qa(w(),To),Vo=D({contextWindowTokens:Da().int().positive(),compactionThresholdRatio:Da().min(0).max(1)}),Ho=Vo.extend({type:k(`prompt`)}).strict(),Uo=Ua(`type`,[Ho,Vo.extend({type:k(`native`)}).strict()]),Wo=D({modelId:w().trim().min(1),context:Uo,parameters:Bo.optional()}).strict(),Go=Wo.extend({family:O(zo)}).strict(),Ko=D({calculatorMethod:O(Ro),pricing:qa(w(),To)}).strict(),qo=D({provider:O(Io),modelConfig:Go}).strict().extend({billingConfig:Ko}).strict(),Jo=D({translate:w().trim().min(1),chat_basic:w().trim().min(1),fast_mode:w().trim().min(1),balanced_mode:w().trim().min(1),max_mode:w().trim().min(1),downstream_completion_summary:w().trim().min(1),project_template_instruction_generation:w().trim().min(1),task_title_generation:w().trim().min(1),guardrail:w().trim().min(1)});function Yo(e,t){for(let[n,r]of Object.entries(e.scenarios))e.models[r]||t.addIssue({code:A.custom,message:`Scenario references missing model config: ${r}`,path:[`scenarios`,n]});for(let[n,r]of Object.entries(e.models))r.modelConfig.family===`custom`&&t.addIssue({code:A.custom,message:`Platform model config cannot use custom family`,path:[`models`,n,`modelConfig`,`family`]})}const Xo=D({version:k(1),scenarios:Jo,models:qa(w().trim().min(1),qo)}).strict().superRefine(Yo);D({expectedRevision:w().nullable(),config:Xo});const Zo=D({temperature:Da().min(0).max(2)}).strict(),Qo=D({modelId:w().trim().min(1),context:Ho.optional(),customConfig:Zo.optional()}).strict(),N=D({credentialId:w().trim().min(1),modelConfig:Qo}).strict(),$o=D({translate:N.optional(),chat_basic:N.optional(),fast_mode:N.optional(),balanced_mode:N.optional(),max_mode:N.optional(),downstream_completion_summary:N.optional(),project_template_instruction_generation:N.optional(),task_title_generation:N.optional(),guardrail:N.optional()}).strict();D({enabled:ja(),scenarioRoutes:$o}).strict(),D({templates:E(Po)}).superRefine((e,t)=>{es(e.templates,t)}),D({expectedRevision:w().nullable(),templates:E(Po)}).superRefine((e,t)=>{es(e.templates,t)});function es(e,t){let n=new Set;for(let r of e)n.has(r.id)&&t.addIssue({code:A.custom,message:`Duplicate template blueprint id`,path:[`templates`]}),n.add(r.id)}const ts={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`},ns=Ya([`human`,`agent`]),rs=D({version:k(1),scenario:O(Fo),provider:O(Io),model_id:w().trim().min(1),model_family:O(zo),model_config:Wo}),is=Ua(`owner`,[rs.extend({owner:k(`platform`),platform_model_config_id:w().trim().min(1)}).catchall(To),rs.extend({owner:k(`workspace`),credential_id:w().trim().min(1)}).catchall(To)]);D({message_origin:ns.optional(),llm_route:is.optional()}).catchall(To);const as={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_DEFAULT_MODELS_LIST:`workspace.llmDefaultModels.list`,WORKSPACE_LLM_SETTINGS_GET:`workspace.llmSettings.get`,WORKSPACE_LLM_SETTINGS_UPDATE:`workspace.llmSettings.update`,WORKSPACE_LLM_ROUTE_TEST:`workspace.llmRoute.test`},os={AUTH_LOGIN_JWT:`auth:login:jwt`,CONNECTION_ACK:`connection.ack`,CONNECTION_EVENT_FILTER_SET:`connection.event_filter.set`},ss={CONNECTION_HEARTBEAT:`connection.heartbeat`},cs={PREFERENCES_GET:`preferences.get`,PREFERENCES_UPDATE:`preferences.update`},ls={USER_PIPELINE_SETTING_GET:`user.pipeline.setting.get`,USER_PIPELINE_SETTING_UPDATE:`user.pipeline.setting.update`},us={displayName:`Syncless`,slug:`syncless`,domain:`syncless.ai`,apiBaseHost:`api.syncless.ai`},ds={web:`${us.displayName} Web`,desktop:`${us.displayName} Desktop`,mobile:`${us.displayName} Mobile`,browserExtension:`${us.displayName} Browser`},fs={command:`syncless`,envPrefix:`SYNCLESS`},ps={scope:`@langgenius`,launcherPackageName:`@langgenius/syncless`,platformPackagePrefix:`@langgenius/syncless-`},ms=us.displayName;us.slug,ds.web,fs.command,ps.launcherPackageName;const hs={USER_FACING:`user_facing`},gs={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`},_s={SEND_FAILED:`send_failed`},vs={RPC_ERROR_CLASS:`rpc_error_class`,RPC_RESULT:`rpc_result`,TRANSPORT_PHASE:`transport_phase`},ys={HEARTBEAT_TIMEOUT:`heartbeat_timeout`},bs={finish:()=>{}},xs=()=>({setContext:()=>{},setFingerprint:()=>{},setLevel:()=>{},setTag:()=>{},setUser:()=>{}}),Ss=()=>({addBreadcrumb:e=>{},captureException:e=>{},destroy:async()=>{},enabled:!1,flush:async()=>!0,flushReplay:async()=>!1,init:async()=>{},startInactiveSpan:e=>bs,withScope:e=>e(xs())}),Cs=e=>{if(!e)return;let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=r);return t},ws=e=>typeof e==`string`?e:String(e),Ts=e=>{let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t},Es=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}}},Ds=(e,t,n)=>{let r=Ts(n);if(Object.keys(r).length===0){delete e.contexts[t];return}e.contexts[t]=r},Os=(e,t)=>{delete e.contexts[t]},ks=(e,t,n)=>{if(n==null||n===``){delete e.tags[t];return}e.tags[t]=ws(n)},As=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,js=/^[a-f0-9]{16,}$/i,Ms=/^\d{4,}$/,Ns=new Set([`access_token`,`code`,`jwt`,`refresh_token`,`session`,`signature`,`state`,`token`]),Ps=new Set([`authorization`,`cookie`,`set-auth-token`,`set-cookie`,`x-api-key`,`x-auth-token`,`x-csrf-token`]),Fs=e=>e&&(As.test(e)?`:uuid`:Ms.test(e)?`:id`:js.test(e)?`:hash`:e),Is=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`forEach`in e&&typeof e.forEach==`function`,Ls=e=>{if(!e)return[];if(Is(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)]])},Rs=e=>{let t={};for(let[n,r]of Ls(e)){let e=n.toLowerCase();Ps.has(e)||(t[e]=r)}return t},zs=e=>{try{let t=new URL(e);t.username=``,t.password=``,t.hash=``,t.pathname=t.pathname.split(`/`).map(Fs).join(`/`);let n=new URLSearchParams;return t.searchParams.forEach((e,t)=>{Ns.has(t.toLowerCase())||n.append(t,e)}),t.search=n.toString(),t.toString()}catch{let[t]=e.split(`?`);return t??e}},Bs=(e,t=512)=>e.length<=t?e:`${e.slice(0,t)}…`,Vs=e=>e<=0?!1:e>=1?!0:Math.random()<e,Hs=`cancelled`,Us=e=>e.errorClass===hs.USER_FACING?`warning`:`error`,Ws=e=>!(e.status===`ok`||e.status===Hs||e.status===_s.SEND_FAILED),Gs=e=>{switch(e){case`ok`:return`ok`;case Hs:return`cancelled`;case`timeout`:return`deadline_exceeded`;case _s.SEND_FAILED:return`internal_error`;default:return`internal_error`}},Ks=e=>e instanceof Error?e:Error(Bs(typeof e==`string`?e:`Unknown frontend stability error`)),qs=e=>e??`info`,Js=(e,t)=>{let n=e.flushTimeoutMs??1500,r=Es(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=Cs({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`&&!Vs(n??.2)||t.addBreadcrumb({...r,level:qs(r.level)})};return{addBreadcrumb:e=>{o(e)},captureException:(e,n)=>{t.enabled&&i(n,()=>{t.captureException(Ks(e))})},clearScopeContext:e=>{Os(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:Gs(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(Ks(a))})}}}}),createNetworkPort:()=>({onHeartbeatTimeout:({error:e,intervalMs:t})=>{o({category:`ws.heartbeat`,data:{intervalMs:t,[vs.TRANSPORT_PHASE]:ys.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:{[vs.RPC_RESULT]:a.status,...a.code?{rpc_code:a.code}:{},...a.domain?{rpc_domain:a.domain}:{},...a.errorClass?{[vs.RPC_ERROR_CLASS]:a.errorClass}:{}},status:Gs(a.status)}),a.status!==`ok`){if(!Ws(a)){o({category:`rpc.lifecycle`,data:{channel:e,...a.errorClass?{errorClass:a.errorClass}:{},[vs.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:Us(a),tags:{rpc_channel:e,[vs.RPC_RESULT]:a.status,...a.code?{rpc_code:a.code}:{},...a.domain?{rpc_domain:a.domain}:{},...a.errorClass?{[vs.RPC_ERROR_CLASS]:a.errorClass}:{}}},()=>{t.captureException(Ks(a.error))})}}}},onTransportError:({error:e,phase:n})=>{i({contexts:{transport:{phase:n}},level:`error`,tags:{[vs.TRANSPORT_PHASE]:n}},()=>{t.captureException(Ks(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:Gs(a)}),a===`error`&&i({contexts:{transport:{kind:e}},level:`error`,tags:{ws_kind:e,ws_result:a}},()=>{t.captureException(Ks(r))})}}},onWsEvent:({channel:e})=>{Vs(.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)=>{Ds(r,e,t)},setTag:(e,t)=>{ks(r,e,t)},setUser:e=>{r.user=e},startSpan:a}};function Ys(e,t){if(typeof e!=`string`)throw TypeError(`Expected string, received ${e===null?`null`:typeof e}`);return t(e)}function Xs(e){return Ys(e,e=>e.trim().toLowerCase())}function Zs(e){return Ys(e,e=>e.trim().toUpperCase())}const Qs=e=>e.length===0?[Ss()]:e,$s=e=>{let t=Qs(e);return t.find(e=>e.enabled)??t[0]??Ss()},ec=e=>{let t=Qs(e),n=$s(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 Ss().startInactiveSpan(e)}},withScope:e=>{let t=e;try{return n.withScope(t)}catch{return Ss().withScope(t)}}}};let tc=function(e){return e.NOOP=`noop`,e.POSTHOG_BROWSER=`posthog-browser`,e.POSTHOG_REACT_NATIVE=`posthog-react-native`,e.SENTRY=`sentry`,e}({});const nc=new Set(Object.values(tc)),rc=(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=Xs(e);if(!t)continue;if(!nc.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:[]}},ic=e=>{let t={};for(let[n,r]of Object.entries(e))r==null||r===``||(t[n]=r);return t},ac=e=>Object.keys(e).length>0,oc=(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=ic({deviceCode:t.deviceCode,environmentId:t.environmentId,memberId:t.memberId,pipelineId:t.pipelineId,taskId:t.taskId,workspaceId:t.workspaceId});ac(n)?e.setScopeContext(`echo`,n):e.clearScopeContext(`echo`);let r=ic({authPhase:t.authPhase,commandName:t.commandName,cwd:t.cwd,interactive:t.interactive,routeTemplate:t.routeTemplate,routeView:t.routeView,screen:t.screen});ac(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})},sc={finish:()=>{}},cc={finish:()=>{}},lc={finish:()=>{}},uc=()=>({onHeartbeatTimeout:()=>{},onRpcStart:()=>sc,onTransportError:()=>{},onWsConnectStart:()=>cc,onWsEvent:()=>{},onWsStatusChange:()=>{}}),dc=()=>({onRequestStart:()=>lc}),fc=/^[^@]+@([^+]+)(?:\+.+)?$/,pc=e=>{if(!e)return;let t=fc.exec(e.trim())?.[1]?.trim();if(t)return t},mc=/\/+$/,P=e=>e.replace(mc,``),hc=e=>e instanceof Request?e.url:e instanceof URL?e.toString():e,gc=(e,t)=>t?.method?t.method:e instanceof Request?e.method:`GET`,_c=(e={})=>{let t=e.fetchImpl??fetch,n=e.observability??dc(),r=e.kind??`http`;return async(e,i)=>{let a=zs(hc(e)),o=gc(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 vc;function F(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 yc=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},bc=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(vc=globalThis).__zod_globalConfig??(vc.__zod_globalConfig={});const xc=globalThis.__zod_globalConfig;function I(e){return e&&Object.assign(xc,e),xc}function Sc(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 Cc(e,t){return typeof t==`bigint`?t.toString():t}function wc(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function Tc(e){return e==null}function Ec(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Dc(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 Oc=Symbol(`evaluating`);function L(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Oc)return r===void 0&&(r=Oc,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function kc(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ac(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function jc(e){return JSON.stringify(e)}function Mc(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Nc=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Pc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Fc=wc(()=>{if(xc.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ic(e){if(Pc(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Pc(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Lc(e){return Ic(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Rc=new Set([`string`,`number`,`symbol`]);function zc(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Bc(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function R(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 Vc(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const Hc={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Uc(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 Bc(e,Ac(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 kc(this,`shape`,e),e},checks:[]}))}function Wc(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 Bc(e,Ac(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 kc(this,`shape`,r),r},checks:[]}))}function Gc(e,t){if(!Ic(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 Bc(e,Ac(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return kc(this,`shape`,n),n}}))}function Kc(e,t){if(!Ic(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Bc(e,Ac(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return kc(this,`shape`,n),n}}))}function qc(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Bc(e,Ac(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return kc(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Jc(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 Bc(t,Ac(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 kc(this,`shape`,i),i},checks:[]}))}function Yc(e,t,n){return Bc(t,Ac(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 kc(this,`shape`,i),i}}))}function Xc(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 Zc(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 Qc(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function $c(e){return typeof e==`string`?e:e?.message}function z(e,t,n){let r=e.message?e.message:$c(e.inst?._zod.def?.error?.(e))??$c(t?.error?.(e))??$c(n.customError?.(e))??$c(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 el(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function tl(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const nl=(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,Cc,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},rl=F(`$ZodError`,nl),il=F(`$ZodError`,nl,{Parent:Error});function al(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 ol(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 sl=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 yc;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>z(e,a,I())));throw Nc(t,i?.callee),t}return o.value},cl=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=>z(e,a,I())));throw Nc(t,i?.callee),t}return o.value},ll=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 yc;return a.issues.length?{success:!1,error:new(e??rl)(a.issues.map(e=>z(e,i,I())))}:{success:!0,data:a.value}},ul=ll(il),dl=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=>z(e,i,I())))}:{success:!0,data:a.value}},fl=dl(il),pl=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return sl(e)(t,n,i)},ml=e=>(t,n,r)=>sl(e)(t,n,r),hl=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return cl(e)(t,n,i)},gl=e=>async(t,n,r)=>cl(e)(t,n,r),_l=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ll(e)(t,n,i)},vl=e=>(t,n,r)=>ll(e)(t,n,r),yl=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return dl(e)(t,n,i)},bl=e=>async(t,n,r)=>dl(e)(t,n,r),xl=/^[cC][0-9a-z]{6,}$/,Sl=/^[0-9a-z]+$/,Cl=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wl=/^[0-9a-vA-V]{20}$/,Tl=/^[A-Za-z0-9]{27}$/,El=/^[a-zA-Z0-9_-]{21}$/,Dl=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ol=/^([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})$/,kl=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)$/,Al=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function jl(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const Ml=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nl=/^(([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}|:))$/,Pl=/^((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])$/,Fl=/^(([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])$/,Il=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ll=/^[A-Za-z0-9_-]*$/,Rl=/^https?$/,zl=/^\+[1-9]\d{6,14}$/,Bl=`(?:(?:\\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])))`,Vl=RegExp(`^${Bl}$`);function Hl(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 Ul(e){return RegExp(`^${Hl(e)}$`)}function Wl(e){let t=Hl({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(`^${Bl}T(?:${r})$`)}const Gl=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Kl=/^-?\d+$/,ql=/^-?\d+(?:\.\d+)?$/,Jl=/^(?:true|false)$/i,Yl=/^null$/i,Xl=/^[^A-Z]*$/,Zl=/^[^a-z]*$/,B=F(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ql={number:`number`,bigint:`bigint`,object:`date`},$l=F(`$ZodCheckLessThan`,(e,t)=>{B.init(e,t);let n=Ql[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})}}),eu=F(`$ZodCheckGreaterThan`,(e,t)=>{B.init(e,t);let n=Ql[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})}}),tu=F(`$ZodCheckMultipleOf`,(e,t)=>{B.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Dc(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})}}),nu=F(`$ZodCheckNumberFormat`,(e,t)=>{B.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Hc[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=Kl)}),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})}}),ru=F(`$ZodCheckMaxLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Tc(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=el(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),iu=F(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Tc(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=el(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),au=F(`$ZodCheckLengthEquals`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Tc(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=el(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})}}),ou=F(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),su=F(`$ZodCheckRegex`,(e,t)=>{ou.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})}}),cu=F(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Xl,ou.init(e,t)}),lu=F(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Zl,ou.init(e,t)}),uu=F(`$ZodCheckIncludes`,(e,t)=>{B.init(e,t);let n=zc(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})}}),du=F(`$ZodCheckStartsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`^${zc(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})}}),fu=F(`$ZodCheckEndsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`.*${zc(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})}}),pu=F(`$ZodCheckOverwrite`,(e,t)=>{B.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var mu=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 hu={major:4,minor:4,patch:3},V=F(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=hu;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=Xc(e),i;for(let a of t){if(a._zod.def.when){if(Zc(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 yc;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Xc(e,t))});else{if(e.issues.length===t)continue;r||=Xc(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Xc(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new yc;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 yc;return o.then(e=>t(e,r,a))}return t(o,r,a)}}L(e,`~standard`,()=>({validate:t=>{try{let n=ul(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return fl(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),gu=F(`$ZodString`,(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Gl(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}}),H=F(`$ZodStringFormat`,(e,t)=>{ou.init(e,t),gu.init(e,t)}),_u=F(`$ZodGUID`,(e,t)=>{t.pattern??=Ol,H.init(e,t)}),vu=F(`$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??=kl(e)}else t.pattern??=kl();H.init(e,t)}),yu=F(`$ZodEmail`,(e,t)=>{t.pattern??=Al,H.init(e,t)}),bu=F(`$ZodURL`,(e,t)=>{H.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Rl.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})}}}),xu=F(`$ZodEmoji`,(e,t)=>{t.pattern??=jl(),H.init(e,t)}),Su=F(`$ZodNanoID`,(e,t)=>{t.pattern??=El,H.init(e,t)}),Cu=F(`$ZodCUID`,(e,t)=>{t.pattern??=xl,H.init(e,t)}),wu=F(`$ZodCUID2`,(e,t)=>{t.pattern??=Sl,H.init(e,t)}),Tu=F(`$ZodULID`,(e,t)=>{t.pattern??=Cl,H.init(e,t)}),Eu=F(`$ZodXID`,(e,t)=>{t.pattern??=wl,H.init(e,t)}),Du=F(`$ZodKSUID`,(e,t)=>{t.pattern??=Tl,H.init(e,t)}),Ou=F(`$ZodISODateTime`,(e,t)=>{t.pattern??=Wl(t),H.init(e,t)}),ku=F(`$ZodISODate`,(e,t)=>{t.pattern??=Vl,H.init(e,t)}),Au=F(`$ZodISOTime`,(e,t)=>{t.pattern??=Ul(t),H.init(e,t)}),ju=F(`$ZodISODuration`,(e,t)=>{t.pattern??=Dl,H.init(e,t)}),Mu=F(`$ZodIPv4`,(e,t)=>{t.pattern??=Ml,H.init(e,t),e._zod.bag.format=`ipv4`}),Nu=F(`$ZodIPv6`,(e,t)=>{t.pattern??=Nl,H.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})}}}),Pu=F(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Pl,H.init(e,t)}),Fu=F(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Fl,H.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 Iu(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Lu=F(`$ZodBase64`,(e,t)=>{t.pattern??=Il,H.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Iu(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Ru(e){if(!Ll.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Iu(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const zu=F(`$ZodBase64URL`,(e,t)=>{t.pattern??=Ll,H.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Ru(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Bu=F(`$ZodE164`,(e,t)=>{t.pattern??=zl,H.init(e,t)});function Vu(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 Hu=F(`$ZodJWT`,(e,t)=>{H.init(e,t),e._zod.check=n=>{Vu(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Uu=F(`$ZodNumber`,(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??ql,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}}),Wu=F(`$ZodNumberFormat`,(e,t)=>{nu.init(e,t),Uu.init(e,t)}),Gu=F(`$ZodBoolean`,(e,t)=>{V.init(e,t),e._zod.pattern=Jl,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}}),Ku=F(`$ZodNull`,(e,t)=>{V.init(e,t),e._zod.pattern=Yl,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}}),qu=F(`$ZodUnknown`,(e,t)=>{V.init(e,t),e._zod.parse=e=>e}),Ju=F(`$ZodNever`,(e,t)=>{V.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Yu(e,t,n){e.issues.length&&t.issues.push(...Qc(n,e.issues)),t.value[n]=e.value}const Xu=F(`$ZodArray`,(e,t)=>{V.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=>Yu(t,n,e))):Yu(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Zu(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Qc(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 Qu(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=Vc(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function $u(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=>Zu(e,n,i,t,u,d))):Zu(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 ed=F(`$ZodObject`,(e,t)=>{if(V.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=wc(()=>Qu(t));L(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=Pc,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=>Zu(n,t,e,s,r,i))):Zu(a,t,e,s,r,i)}return i?$u(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),td=F(`$ZodObjectJIT`,(e,t)=>{ed.init(e,t);let n=e._zod.parse,r=wc(()=>Qu(t)),i=e=>{let t=new mu([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=jc(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=jc(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=Pc,s=!xc.jitless,c=s&&Fc.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?$u([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function nd(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=>!Xc(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=>z(e,r,I())))}),t)}const rd=F(`$ZodUnion`,(e,t)=>{V.init(e,t),L(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),L(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),L(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),L(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=>Ec(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=>nd(t,r,e,i)):nd(o,r,e,i)}}),id=F(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,rd.init(e,t);let n=e._zod.parse;L(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=wc(()=>{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(!Pc(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)}}),ad=F(`$ZodIntersection`,(e,t)=>{V.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])=>sd(e,t,n)):sd(e,i,a)}});function od(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ic(e)&&Ic(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=od(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=od(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 sd(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}),Xc(e))return e;let o=od(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const cd=F(`$ZodRecord`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Ic(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=>z(e,r,I())),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(...Qc(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...Qc(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`&&ql.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=>z(e,r,I())),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(...Qc(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Qc(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),ld=F(`$ZodEnum`,(e,t)=>{V.init(e,t);let n=Sc(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Rc.has(typeof e)).map(e=>typeof e==`string`?zc(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}}),ud=F(`$ZodLiteral`,(e,t)=>{if(V.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`?zc(e):e?zc(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}}),dd=F(`$ZodTransform`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new bc(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 yc;return n.value=i,n.fallback=!0,n}});function fd(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const pd=F(`$ZodOptional`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,L(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),L(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ec(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=>fd(e,r)):fd(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),md=F(`$ZodExactOptional`,(e,t)=>{pd.init(e,t),L(e._zod,`values`,()=>t.innerType._zod.values),L(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),hd=F(`$ZodNullable`,(e,t)=>{V.init(e,t),L(e._zod,`optin`,()=>t.innerType._zod.optin),L(e._zod,`optout`,()=>t.innerType._zod.optout),L(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ec(e.source)}|null)$`):void 0}),L(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)}),gd=F(`$ZodDefault`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,L(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=>_d(e,t)):_d(r,t)}});function _d(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const vd=F(`$ZodPrefault`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,L(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))}),yd=F(`$ZodNonOptional`,(e,t)=>{V.init(e,t),L(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=>bd(t,e)):bd(i,e)}});function bd(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 xd=F(`$ZodCatch`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,L(e._zod,`optout`,()=>t.innerType._zod.optout),L(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=>z(e,n,I()))},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=>z(e,n,I()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Sd=F(`$ZodPipe`,(e,t)=>{V.init(e,t),L(e._zod,`values`,()=>t.in._zod.values),L(e._zod,`optin`,()=>t.in._zod.optin),L(e._zod,`optout`,()=>t.out._zod.optout),L(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=>Cd(e,t.in,n)):Cd(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Cd(e,t.out,n)):Cd(r,t.out,n)}});function Cd(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 wd=F(`$ZodPreprocess`,(e,t)=>{Sd.init(e,t)}),Td=F(`$ZodReadonly`,(e,t)=>{V.init(e,t),L(e._zod,`propValues`,()=>t.innerType._zod.propValues),L(e._zod,`values`,()=>t.innerType._zod.values),L(e._zod,`optin`,()=>t.innerType?._zod?.optin),L(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(Ed):Ed(r)}});function Ed(e){return e.value=Object.freeze(e.value),e}const Dd=F(`$ZodLazy`,(e,t)=>{V.init(e,t),L(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),L(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),L(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),L(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),L(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Od=F(`$ZodCustom`,(e,t)=>{B.init(e,t),V.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=>kd(t,n,r,e));kd(i,n,r,e)}});function kd(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(tl(e))}}var Ad,jd=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 Md(){return new jd}(Ad=globalThis).__zod_globalRegistry??(Ad.__zod_globalRegistry=Md());const Nd=globalThis.__zod_globalRegistry;function Pd(e,t){return new e({type:`string`,...R(t)})}function Fd(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...R(t)})}function Id(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...R(t)})}function Ld(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...R(t)})}function Rd(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...R(t)})}function zd(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...R(t)})}function Bd(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...R(t)})}function Vd(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...R(t)})}function Hd(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...R(t)})}function Ud(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...R(t)})}function Wd(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...R(t)})}function Gd(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...R(t)})}function Kd(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...R(t)})}function qd(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...R(t)})}function Jd(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...R(t)})}function Yd(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...R(t)})}function Xd(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...R(t)})}function Zd(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...R(t)})}function Qd(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...R(t)})}function $d(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...R(t)})}function ef(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...R(t)})}function tf(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...R(t)})}function nf(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...R(t)})}function rf(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...R(t)})}function af(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...R(t)})}function of(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...R(t)})}function sf(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...R(t)})}function cf(e,t){return new e({type:`number`,checks:[],...R(t)})}function lf(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...R(t)})}function uf(e,t){return new e({type:`boolean`,...R(t)})}function df(e,t){return new e({type:`null`,...R(t)})}function ff(e){return new e({type:`unknown`})}function pf(e,t){return new e({type:`never`,...R(t)})}function mf(e,t){return new $l({check:`less_than`,...R(t),value:e,inclusive:!1})}function hf(e,t){return new $l({check:`less_than`,...R(t),value:e,inclusive:!0})}function gf(e,t){return new eu({check:`greater_than`,...R(t),value:e,inclusive:!1})}function _f(e,t){return new eu({check:`greater_than`,...R(t),value:e,inclusive:!0})}function vf(e,t){return new tu({check:`multiple_of`,...R(t),value:e})}function yf(e,t){return new ru({check:`max_length`,...R(t),maximum:e})}function bf(e,t){return new iu({check:`min_length`,...R(t),minimum:e})}function xf(e,t){return new au({check:`length_equals`,...R(t),length:e})}function Sf(e,t){return new su({check:`string_format`,format:`regex`,...R(t),pattern:e})}function Cf(e){return new cu({check:`string_format`,format:`lowercase`,...R(e)})}function wf(e){return new lu({check:`string_format`,format:`uppercase`,...R(e)})}function Tf(e,t){return new uu({check:`string_format`,format:`includes`,...R(t),includes:e})}function Ef(e,t){return new du({check:`string_format`,format:`starts_with`,...R(t),prefix:e})}function Df(e,t){return new fu({check:`string_format`,format:`ends_with`,...R(t),suffix:e})}function Of(e){return new pu({check:`overwrite`,tx:e})}function kf(e){return Of(t=>t.normalize(e))}function Af(){return Of(e=>e.trim())}function jf(){return Of(e=>e.toLowerCase())}function Mf(){return Of(e=>e.toUpperCase())}function Nf(){return Of(e=>Mc(e))}function Pf(e,t,n){return new e({type:`array`,element:t,...R(n)})}function Ff(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...R(n)})}function If(e,t){let n=Lf(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(tl(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(tl(r))}},e(t.value,t)),t);return n}function Lf(e,t){let n=new B({check:`custom`,...R(t)});return n._zod.check=e,n}function Rf(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??Nd,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 U(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,U(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`&&W(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 zf(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 Bf(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:Hf(t,`input`,e.processors),output:Hf(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function W(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 W(r.element,n);if(r.type===`set`)return W(r.valueType,n);if(r.type===`lazy`)return W(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 W(r.innerType,n);if(r.type===`intersection`)return W(r.left,n)||W(r.right,n);if(r.type===`record`||r.type===`map`)return W(r.keyType,n)||W(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:W(r.in,n)||W(r.out,n);if(r.type===`object`){for(let e in r.shape)if(W(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(W(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(W(e,n))return!0;return!!(r.rest&&W(r.rest,n))}return!1}const Vf=(e,t={})=>n=>{let r=Rf({...n,processors:t});return U(e,r),zf(r,e),Bf(r,e)},Hf=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Rf({...i??{},target:a,io:t,processors:n});return U(e,o),zf(o,e),Bf(o,e)},Uf={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Wf=(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=Uf[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}))])}},Gf=(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)},Kf=(e,t,n,r)=>{n.type=`boolean`},qf=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Jf=(e,t,n,r)=>{n.not={}},Yf=(e,t,n,r)=>{let i=e._zod.def,a=Sc(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Xf=(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},Zf=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Qf=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},$f=(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=U(a.element,t,{...r,path:[...r.path,`items`]})},ep=(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]=U(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=U(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},tp=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>U(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},np=(e,t,n,r)=>{let i=e._zod.def,a=U(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=U(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]]},rp=(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=U(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=U(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=U(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)}},ip=(e,t,n,r)=>{let i=e._zod.def,a=U(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`}]},ap=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},op=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},sp=(e,t,n,r)=>{let i=e._zod.def;U(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)))},cp=(e,t,n,r)=>{let i=e._zod.def;U(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},lp=(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;U(o,t,r);let s=t.seen.get(e);s.ref=o},up=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},dp=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},fp=(e,t,n,r)=>{let i=e._zod.innerType;U(i,t,r);let a=t.seen.get(e);a.ref=i},pp=F(`ZodISODateTime`,(e,t)=>{Ou.init(e,t),J.init(e,t)});function mp(e){return rf(pp,e)}const hp=F(`ZodISODate`,(e,t)=>{ku.init(e,t),J.init(e,t)});function gp(e){return af(hp,e)}const _p=F(`ZodISOTime`,(e,t)=>{Au.init(e,t),J.init(e,t)});function vp(e){return of(_p,e)}const yp=F(`ZodISODuration`,(e,t)=>{ju.init(e,t),J.init(e,t)});function bp(e){return sf(yp,e)}const G=F(`ZodError`,(e,t)=>{rl.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ol(e,t)},flatten:{value:t=>al(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Cc,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Cc,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),xp=sl(G),Sp=cl(G),Cp=ll(G),wp=dl(G),Tp=pl(G),Ep=ml(G),Dp=hl(G),Op=gl(G),kp=_l(G),Ap=vl(G),jp=yl(G),Mp=bl(G),Np=new WeakMap;function Pp(e,t,n){let r=Object.getPrototypeOf(e),i=Np.get(r);if(i||(i=new Set,Np.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 K=F(`ZodType`,(e,t)=>(V.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Hf(e,`input`),output:Hf(e,`output`)}}),e.toJSONSchema=Vf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>xp(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Cp(e,t,n),e.parseAsync=async(t,n)=>Sp(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>wp(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Tp(e,t,n),e.decode=(t,n)=>Ep(e,t,n),e.encodeAsync=async(t,n)=>Dp(e,t,n),e.decodeAsync=async(t,n)=>Op(e,t,n),e.safeEncode=(t,n)=>kp(e,t,n),e.safeDecode=(t,n)=>Ap(e,t,n),e.safeEncodeAsync=async(t,n)=>jp(e,t,n),e.safeDecodeAsync=async(t,n)=>Mp(e,t,n),Pp(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Ac(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 Bc(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(eh(e,t))},superRefine(e,t){return this.check(th(e,t))},overwrite(e){return this.check(Of(e))},optional(){return Nm(this)},exactOptional(){return Fm(this)},nullable(){return Lm(this)},nullish(){return Nm(Lm(this))},nonoptional(e){return Um(this,e)},array(){return gm(this)},or(e){return ym([this,e])},and(e){return Cm(this,e)},transform(e){return qm(this,jm(e))},default(e){return zm(this,e)},prefault(e){return Vm(this,e)},catch(e){return Gm(this,e)},pipe(e){return qm(this,e)},readonly(){return Xm(this)},describe(e){let t=this.clone();return Nd.add(t,{description:e}),t},meta(...e){if(e.length===0)return Nd.get(this);let t=this.clone();return Nd.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 Nd.get(e)?.description},configurable:!0}),e)),Fp=F(`_ZodString`,(e,t)=>{gu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wf(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Pp(e,`_ZodString`,{regex(...e){return this.check(Sf(...e))},includes(...e){return this.check(Tf(...e))},startsWith(...e){return this.check(Ef(...e))},endsWith(...e){return this.check(Df(...e))},min(...e){return this.check(bf(...e))},max(...e){return this.check(yf(...e))},length(...e){return this.check(xf(...e))},nonempty(...e){return this.check(bf(1,...e))},lowercase(e){return this.check(Cf(e))},uppercase(e){return this.check(wf(e))},trim(){return this.check(Af())},normalize(...e){return this.check(kf(...e))},toLowerCase(){return this.check(jf())},toUpperCase(){return this.check(Mf())},slugify(){return this.check(Nf())}})}),Ip=F(`ZodString`,(e,t)=>{gu.init(e,t),Fp.init(e,t),e.email=t=>e.check(Fd(Lp,t)),e.url=t=>e.check(Vd(Vp,t)),e.jwt=t=>e.check(nf(nm,t)),e.emoji=t=>e.check(Hd(Hp,t)),e.guid=t=>e.check(Id(zp,t)),e.uuid=t=>e.check(Ld(Bp,t)),e.uuidv4=t=>e.check(Rd(Bp,t)),e.uuidv6=t=>e.check(zd(Bp,t)),e.uuidv7=t=>e.check(Bd(Bp,t)),e.nanoid=t=>e.check(Ud(Up,t)),e.guid=t=>e.check(Id(zp,t)),e.cuid=t=>e.check(Wd(Wp,t)),e.cuid2=t=>e.check(Gd(Gp,t)),e.ulid=t=>e.check(Kd(Kp,t)),e.base64=t=>e.check($d($p,t)),e.base64url=t=>e.check(ef(em,t)),e.xid=t=>e.check(qd(qp,t)),e.ksuid=t=>e.check(Jd(Jp,t)),e.ipv4=t=>e.check(Yd(Yp,t)),e.ipv6=t=>e.check(Xd(Xp,t)),e.cidrv4=t=>e.check(Zd(Zp,t)),e.cidrv6=t=>e.check(Qd(Qp,t)),e.e164=t=>e.check(tf(tm,t)),e.datetime=t=>e.check(mp(t)),e.date=t=>e.check(gp(t)),e.time=t=>e.check(vp(t)),e.duration=t=>e.check(bp(t))});function q(e){return Pd(Ip,e)}const J=F(`ZodStringFormat`,(e,t)=>{H.init(e,t),Fp.init(e,t)}),Lp=F(`ZodEmail`,(e,t)=>{yu.init(e,t),J.init(e,t)});function Rp(e){return Fd(Lp,e)}const zp=F(`ZodGUID`,(e,t)=>{_u.init(e,t),J.init(e,t)}),Bp=F(`ZodUUID`,(e,t)=>{vu.init(e,t),J.init(e,t)}),Vp=F(`ZodURL`,(e,t)=>{bu.init(e,t),J.init(e,t)}),Hp=F(`ZodEmoji`,(e,t)=>{xu.init(e,t),J.init(e,t)}),Up=F(`ZodNanoID`,(e,t)=>{Su.init(e,t),J.init(e,t)}),Wp=F(`ZodCUID`,(e,t)=>{Cu.init(e,t),J.init(e,t)}),Gp=F(`ZodCUID2`,(e,t)=>{wu.init(e,t),J.init(e,t)}),Kp=F(`ZodULID`,(e,t)=>{Tu.init(e,t),J.init(e,t)}),qp=F(`ZodXID`,(e,t)=>{Eu.init(e,t),J.init(e,t)}),Jp=F(`ZodKSUID`,(e,t)=>{Du.init(e,t),J.init(e,t)}),Yp=F(`ZodIPv4`,(e,t)=>{Mu.init(e,t),J.init(e,t)}),Xp=F(`ZodIPv6`,(e,t)=>{Nu.init(e,t),J.init(e,t)}),Zp=F(`ZodCIDRv4`,(e,t)=>{Pu.init(e,t),J.init(e,t)}),Qp=F(`ZodCIDRv6`,(e,t)=>{Fu.init(e,t),J.init(e,t)}),$p=F(`ZodBase64`,(e,t)=>{Lu.init(e,t),J.init(e,t)}),em=F(`ZodBase64URL`,(e,t)=>{zu.init(e,t),J.init(e,t)}),tm=F(`ZodE164`,(e,t)=>{Bu.init(e,t),J.init(e,t)}),nm=F(`ZodJWT`,(e,t)=>{Hu.init(e,t),J.init(e,t)}),rm=F(`ZodNumber`,(e,t)=>{Uu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gf(e,t,n,r),Pp(e,`ZodNumber`,{gt(e,t){return this.check(gf(e,t))},gte(e,t){return this.check(_f(e,t))},min(e,t){return this.check(_f(e,t))},lt(e,t){return this.check(mf(e,t))},lte(e,t){return this.check(hf(e,t))},max(e,t){return this.check(hf(e,t))},int(e){return this.check(om(e))},safe(e){return this.check(om(e))},positive(e){return this.check(gf(0,e))},nonnegative(e){return this.check(_f(0,e))},negative(e){return this.check(mf(0,e))},nonpositive(e){return this.check(hf(0,e))},multipleOf(e,t){return this.check(vf(e,t))},step(e,t){return this.check(vf(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 im(e){return cf(rm,e)}const am=F(`ZodNumberFormat`,(e,t)=>{Wu.init(e,t),rm.init(e,t)});function om(e){return lf(am,e)}const sm=F(`ZodBoolean`,(e,t)=>{Gu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kf(e,t,n,r)});function cm(e){return uf(sm,e)}const lm=F(`ZodNull`,(e,t)=>{Ku.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qf(e,t,n,r)});function um(e){return df(lm,e)}const dm=F(`ZodUnknown`,(e,t)=>{qu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function fm(){return ff(dm)}const pm=F(`ZodNever`,(e,t)=>{Ju.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jf(e,t,n,r)});function mm(e){return pf(pm,e)}const hm=F(`ZodArray`,(e,t)=>{Xu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$f(e,t,n,r),e.element=t.element,Pp(e,`ZodArray`,{min(e,t){return this.check(bf(e,t))},nonempty(e){return this.check(bf(1,e))},max(e,t){return this.check(yf(e,t))},length(e,t){return this.check(xf(e,t))},unwrap(){return this.element}})});function gm(e,t){return Pf(hm,e,t)}const _m=F(`ZodObject`,(e,t)=>{td.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ep(e,t,n,r),L(e,`shape`,()=>t.shape),Pp(e,`ZodObject`,{keyof(){return Dm(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:fm()})},loose(){return this.clone({...this._zod.def,catchall:fm()})},strict(){return this.clone({...this._zod.def,catchall:mm()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Gc(this,e)},safeExtend(e){return Kc(this,e)},merge(e){return qc(this,e)},pick(e){return Uc(this,e)},omit(e){return Wc(this,e)},partial(...e){return Jc(Mm,this,e[0])},required(...e){return Yc(Hm,this,e[0])}})});function Y(e,t){return new _m({type:`object`,shape:e??{},...R(t)})}const vm=F(`ZodUnion`,(e,t)=>{rd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tp(e,t,n,r),e.options=t.options});function ym(e,t){return new vm({type:`union`,options:e,...R(t)})}const bm=F(`ZodDiscriminatedUnion`,(e,t)=>{vm.init(e,t),id.init(e,t)});function xm(e,t,n){return new bm({type:`union`,options:t,discriminator:e,...R(n)})}const Sm=F(`ZodIntersection`,(e,t)=>{ad.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>np(e,t,n,r)});function Cm(e,t){return new Sm({type:`intersection`,left:e,right:t})}const wm=F(`ZodRecord`,(e,t)=>{cd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rp(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Tm(e,t,n){return!t||!t._zod?new wm({type:`record`,keyType:q(),valueType:e,...R(t)}):new wm({type:`record`,keyType:e,valueType:t,...R(n)})}const Em=F(`ZodEnum`,(e,t)=>{ld.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yf(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 Em({...t,checks:[],...R(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 Em({...t,checks:[],...R(r),entries:i})}});function Dm(e,t){return new Em({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...R(t)})}function Om(e,t){return new Em({type:`enum`,entries:e,...R(t)})}const km=F(`ZodLiteral`,(e,t)=>{ud.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xf(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 X(e,t){return new km({type:`literal`,values:Array.isArray(e)?e:[e],...R(t)})}const Am=F(`ZodTransform`,(e,t)=>{dd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qf(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new bc(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(tl(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(tl(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 jm(e){return new Am({type:`transform`,transform:e})}const Mm=F(`ZodOptional`,(e,t)=>{pd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nm(e){return new Mm({type:`optional`,innerType:e})}const Pm=F(`ZodExactOptional`,(e,t)=>{md.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fm(e){return new Pm({type:`optional`,innerType:e})}const Im=F(`ZodNullable`,(e,t)=>{hd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ip(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lm(e){return new Im({type:`nullable`,innerType:e})}const Rm=F(`ZodDefault`,(e,t)=>{gd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>op(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function zm(e,t){return new Rm({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Lc(t)}})}const Bm=F(`ZodPrefault`,(e,t)=>{vd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vm(e,t){return new Bm({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Lc(t)}})}const Hm=F(`ZodNonOptional`,(e,t)=>{yd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ap(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Um(e,t){return new Hm({type:`nonoptional`,innerType:e,...R(t)})}const Wm=F(`ZodCatch`,(e,t)=>{xd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Gm(e,t){return new Wm({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const Km=F(`ZodPipe`,(e,t)=>{Sd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lp(e,t,n,r),e.in=t.in,e.out=t.out});function qm(e,t){return new Km({type:`pipe`,in:e,out:t})}const Jm=F(`ZodPreprocess`,(e,t)=>{Km.init(e,t),wd.init(e,t)}),Ym=F(`ZodReadonly`,(e,t)=>{Td.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>up(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xm(e){return new Ym({type:`readonly`,innerType:e})}const Zm=F(`ZodLazy`,(e,t)=>{Dd.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fp(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Qm(e){return new Zm({type:`lazy`,getter:e})}const $m=F(`ZodCustom`,(e,t)=>{Od.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zf(e,t,n,r)});function eh(e,t={}){return Ff($m,e,t)}function th(e,t){return If(e,t)}function nh(e,t){return new Jm({type:`pipe`,in:jm(e),out:t})}const rh=[`en`,`zh-Hans`];Y({identityToken:q().trim().min(1),nonce:q().trim().optional().nullable(),email:q().trim().email().optional().nullable(),name:Y({firstName:q().trim().optional().nullable(),lastName:q().trim().optional().nullable()}).optional().nullable(),preferredLanguage:Dm(rh)}),Y({isAvailable:cm()});const ih=e=>nh(e=>e===null?void 0:e,e.optional()),ah=Qm(()=>ym([q(),im(),cm(),um(),gm(ah),Tm(q(),ah)])),oh=q().trim().pipe(Rp()),sh=Y({error:q().trim().min(1),details:Tm(q(),ah)}),ch=Y({expiresAt:mp(),updatedAt:mp()}),lh=Y({id:q().trim().min(1),email:oh,name:q(),image:q().nullable()}),uh=Y({token:q().trim().min(1),onboardingCompleted:cm(),projectTemplateOnboardingCompleted:cm(),session:ch,user:lh}),dh=Y({token:q().trim().min(1)});Y({token:q().trim().min(1)});const Z={PENDING:`pending`,COMPLETED:`completed`,EXPIRED:`expired`,ERROR:`error`};Z.COMPLETED,Z.EXPIRED,Z.ERROR;const fh={BROWSER_PAGE:`browser_page`,DEEP_LINK:`deep_link`},ph={GITHUB:`github`,GOOGLE:`google`,SLACK:`slack`},mh={GOOGLE_WORKSPACE:`google-workspace`},hh=Dm([fh.BROWSER_PAGE,fh.DEEP_LINK]),gh=Dm([ph.GITHUB,ph.GOOGLE,ph.SLACK]),_h=Dm([mh.GOOGLE_WORKSPACE]);Y({returnMode:hh,preferredLanguage:Dm(rh)});const vh=Y({authorizationUrl:q().trim().min(1),expiresAt:q().datetime(),state:q().trim().min(1)}),yh=vh.extend({provider:gh}),bh=vh.extend({provider:_h}),xh=Y({state:q().trim().min(1)}),Sh=xh.extend({expiresAt:q().datetime(),name:q(),token:q().trim().min(1),userId:q().trim().min(1),avatarUrl:q()}),Ch=xh.extend({reason:q().trim().min(1),status:X(Z.ERROR)}),wh=xm(`status`,[xh.extend({provider:gh,status:X(Z.PENDING)}),Sh.extend({provider:gh,status:X(Z.COMPLETED)}),xh.extend({provider:gh,status:X(Z.EXPIRED)}),Ch.extend({provider:gh})]),Th=xm(`status`,[xh.extend({provider:_h,status:X(Z.PENDING)}),Sh.extend({provider:_h,status:X(Z.COMPLETED)}),xh.extend({provider:_h,status:X(Z.EXPIRED)}),Ch.extend({provider:_h})]);var Eh=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}})),Dh=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}})),Oh=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getStatusText=e.getStatusCode=e.getReasonPhrase=void 0;var t=Dh();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})),kh=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||={})})),Ah=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||={})})),Q=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(Eh()),o=Oh(),s=Oh();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=kh();Object.defineProperty(e,`StatusCodes`,{enumerable:!0,get:function(){return c.StatusCodes}});var l=Ah();Object.defineProperty(e,`ReasonPhrases`,{enumerable:!0,get:function(){return l.ReasonPhrases}}),r(Eh(),e),e.default=t(t({},a.default),{getStatusCode:o.getStatusCode,getStatusText:o.getStatusText})}))();const $=(e,t)=>{let n=JSON.parse(e),r=t.safeParse(n);if(!r.success)throw r.error;return r.data};let jh=function(e){return e.OK=`ok`,e.UNAUTHORIZED=`unauthorized`,e}({});const Mh=Y({success:cm()}),Nh=Y({token:q().trim().min(1),userId:q().trim().min(1),email:q().trim().email(),expiresAt:q().datetime(),updatedAt:q().datetime(),name:q(),avatarUrl:q()}),Ph=Y({ok:X(!0),revokedAt:q().datetime(),sessionId:q().trim().min(1)}),Fh=async(e,t)=>{let n=$(await e.text(),sh);throw Error(n.error)},Ih=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${P(e)}/api/auth/email-otp/send-verification-otp`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:t.email})});return r.status===Q.StatusCodes.NO_CONTENT?{success:!0}:r.status===Q.StatusCodes.OK?$(await r.text(),Mh):await Fh(r,`Failed to request sign-in code`)},Lh=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${P(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===Q.StatusCodes.OK?$(await r.text(),dh):await Fh(r,`Failed to verify sign-in code`)},Rh=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${P(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===Q.StatusCodes.OK?$(await r.text(),yh):await Fh(r,`Failed to start external OAuth login`)},zh=async(e,t,n={})=>{let r=n.fetchImpl??fetch,i=new URL(`/api/auth/oauth/${encodeURIComponent(t.provider)}/completion`,P(e));i.searchParams.set(`state`,t.state);let a=await r(i,{method:`GET`});return a.status===Q.StatusCodes.OK?$(await a.text(),wh):await Fh(a,`Failed to load external OAuth completion state`)},Bh=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${P(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===Q.StatusCodes.OK?$(await r.text(),bh):await Fh(r,`Failed to start external SSO login`)},Vh=async(e,t,n={})=>{let r=n.fetchImpl??fetch,i=new URL(`/api/auth/sso/${encodeURIComponent(t.provider)}/completion`,P(e));i.searchParams.set(`state`,t.state);let a=await r(i,{method:`GET`});return a.status===Q.StatusCodes.OK?$(await a.text(),Th):await Fh(a,`Failed to load external SSO completion state`)},Hh=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${P(e)}/api/auth/cli-session/exchange`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return r.status===Q.StatusCodes.OK?$(await r.text(),Nh):await Fh(r,`Failed to create CLI session`)},Uh=async(e,t,n={})=>{let r=await(n.fetchImpl??fetch)(`${P(e)}/api/auth/cli-session/logout`,{method:`POST`,headers:{authorization:`Bearer ${t.token}`}});if(r.status===Q.StatusCodes.UNAUTHORIZED)throw Error(`Stored auth is invalid or expired`);return r.status===Q.StatusCodes.OK?$(await r.text(),Ph):await Fh(r,`Failed to revoke CLI session`)},Wh=async(e,t,n={})=>{let r=n.fetchImpl??fetch,i=new URL(`/api/auth/get-session`,P(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===Q.StatusCodes.OK?{status:`ok`,session:$(await a.text(),uh),error:null}:a.status===Q.StatusCodes.UNAUTHORIZED?{status:`unauthorized`,session:null,error:$(await a.text(),sh)}:await Fh(a,`Failed to refresh session`)};var Gh=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 Kh=async e=>{try{return await e.clone().text()}catch{return}},qh=async(e,t=`HTTP request failed`)=>{if(e.ok)return;let n=await Kh(e);throw new Gh(t,{status:e.status,statusText:e.statusText,bodyText:n})},Jh=/^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-]+)*)?$/,Yh=/^\d+$/;let Xh=function(e){return e.CLI=`cli`,e.DESKTOP=`desktop`,e.MOBILE=`mobile`,e.BROWSER_USE=`browser-use`,e}({}),Zh=function(e){return e.STABLE=`stable`,e.BETA=`beta`,e.PREVIEW=`preview`,e}({}),Qh=function(e){return e.COMMAND=`command`,e.DOWNLOAD=`download`,e.STORE=`store`,e.DOCS=`docs`,e}({}),$h=function(e){return e.DARWIN_ARM64=`darwin-arm64`,e.DARWIN_X64=`darwin-x64`,e.WIN_X64=`win-x64`,e}({}),eg=function(e){return e.DARWIN_ARM64=`darwin-arm64`,e.DARWIN_X64=`darwin-x64`,e.LINUX_X64=`linux-x64`,e.LINUX_ARM64=`linux-arm64`,e}({}),tg=function(e){return e.IOS=`ios`,e.ANDROID=`android`,e}({}),ng=function(e){return e.CHROME=`chrome`,e}({});const rg=new Set(Object.values(Xh)),ig=new Set(Object.values(Zh)),ag=new Set(Object.values(Qh)),og=Object.values($h),sg={cli:Object.values(eg),desktop:og,mobile:Object.values(tg),"browser-use":Object.values(ng)},cg=e=>typeof e==`object`&&!!e,lg=(e,t)=>{if(typeof e!=`string`||e.trim().length===0)throw Error(`Release manifest ${t} must be a non-empty string`);return e.trim()},ug=(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()}},dg=(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}},fg=(e,t)=>{let n=dg(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}},pg=(e,t)=>{let n=Yh.test(e),r=Yh.test(t);return n&&r?Number(e)-Number(t):n?-1:r?1:e.localeCompare(t)},mg=e=>{let t=e.trim().match(Jh);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(`.`):[]}},hg=e=>rg.has(e),gg=e=>ig.has(e),_g=e=>ag.has(e),vg=(e,t)=>sg[e].includes(t),yg=(e,t)=>{let n=mg(e),r=mg(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=pg(t,i);if(a!==0)return a}return 0},bg=(e,t)=>yg(t,e.minimumSupportedVersion)<0?`update_required`:yg(t,e.latestVersion)<0?`update_available`:`up_to_date`,xg=e=>{if(!vg(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`},Sg=e=>{if(!cg(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=lg(e.product,`product`);if(!hg(n))throw Error(`Unsupported release product: ${n}`);let r=lg(e.channel,`channel`);if(!gg(r))throw Error(`Unsupported release channel: ${r}`);let i=lg(e.platform,`platform`);if(!vg(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(!cg(e))throw TypeError(`Release manifest actions[${t}] must be an object`);let n=lg(e.kind,`actions[${t}].kind`);if(!_g(n))throw Error(`Unsupported release action kind: ${n}`);return{kind:n,label:lg(e.label,`actions[${t}].label`),url:ug(e.url,`actions[${t}].url`),command:ug(e.command,`actions[${t}].command`),sha256:ug(e.sha256,`actions[${t}].sha256`),size:fg(e.size,`actions[${t}].size`)}}),c=dg(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:lg(e.latestVersion,`latestVersion`),minimumSupportedVersion:lg(e.minimumSupportedVersion,`minimumSupportedVersion`),publishedAt:lg(e.publishedAt,`publishedAt`),releaseNotesUrl:ug(e.releaseNotesUrl,`releaseNotesUrl`),message:ug(e.message,`message`),rolloutPercentage:c,actions:s}},Cg=new Set([`localhost`,`127.0.0.1`,`::1`]),wg=e=>Cg.has(e),Tg=e=>{let t=P(e.trim()),n=new URL(t);if(n.protocol===`https:`||n.protocol===`http:`&&wg(n.hostname))return P(n.toString());throw Error(`Updates base URL must use https or localhost http: ${e}`)},Eg=e=>`${Tg(e.baseUrl)}/${xg({product:e.product,channel:e.channel,platform:e.platform})}`,Dg=async e=>e.json(),Og=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 qh(n,`Release manifest request failed`),Sg(await Dg(n))}finally{clearTimeout(n)}},kg=async e=>{let t=e.fetch??fetch,n=await Og({url:Eg({baseUrl:e.baseUrl,product:e.product,channel:e.channel,platform:e.platform}),fetchImpl:t,timeoutMs:e.timeoutMs??5e3});return{availability:bg(n,e.currentVersion),manifest:n}};export{cs as $,_c as A,Rs as B,Om as C,q as D,Tm as E,rc as F,fs as G,zs as H,pc as I,vs as J,gs as K,Xs as L,oc as M,ec as N,ym as O,uc as P,os as Q,Zs as R,X as S,Y as T,Cs as U,Bs as V,Ss as W,ms as X,ys as Y,ss as Z,Dm as _,jh as a,ja as at,xm as b,Wh as c,D as ct,Ih as d,wo as et,Lh as f,ih as g,ah as h,Xh as i,Ya as it,tc as j,fm as k,Vh as l,qa as lt,Bh as m,eg as n,ls as nt,Hh as o,Ua as ot,Rh as p,_s as q,Zh as r,as as rt,zh as s,k as st,kg as t,ts as tt,Uh as u,w as ut,gm as v,im as w,Qm as x,cm as y,Js as z};
130
+ //# debugId=cdddab8b-5b12-5f35-a398-dbfffb15a0fb
@@ -1,4 +1,4 @@
1
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]="1e406bb4-05a9-54ff-ad74-02e9bc8ef089")}catch(e){}}();
3
- import{t as e}from"./status-jFJKIUBU-BCgr1MV_.js";import{r as t,t as n}from"./runtime_auth_helpers-BDWCKc_--CPDRhoOH.js";const r=async e=>{await new Promise(t=>{setTimeout(t,e)})},i=e=>{switch(e){case`github`:return`github`;case`google`:return`google`;case`slack`:return`slack`;case`googleWorkspace`:return`google-workspace`;default:throw Error(`EXTERNAL_AUTH_PROVIDER_REQUIRED`)}},a=e=>e===`googleWorkspace`?`sso`:`oauth`,o=(e,t)=>{switch(t){case`github`:if(!e.github)throw Error(`GITHUB_LOGIN_ADAPTER_REQUIRED`);return e.github;case`google`:if(!e.google)throw Error(`GOOGLE_LOGIN_ADAPTER_REQUIRED`);return e.google;case`slack`:if(!e.slack)throw Error(`SLACK_LOGIN_ADAPTER_REQUIRED`);return e.slack;case`googleWorkspace`:if(!e.googleWorkspace)throw Error(`GOOGLE_WORKSPACE_LOGIN_ADAPTER_REQUIRED`);return e.googleWorkspace;case`appleNative`:if(!e.appleNative)throw Error(`APPLE_NATIVE_LOGIN_ADAPTER_REQUIRED`);return e.appleNative;default:throw Error(`UNSUPPORTED_AUTH_PROVIDER`)}},s=e=>`exchangeForToken`in e,c=e=>{if(e)return{fetchImpl:e}},l=l=>({startLogin:async(u,d)=>{let f=l.useLoginCycleStore.getState();if(u===`email`){let e=d;f.patchState({email:e.email,errorMessage:null,pendingExternalAuth:null,status:e.code?`finalizing_login`:`email_requesting_code`});try{if(!e.code)return await n(l.apiBaseUrl,e.email,c(l.httpFetch)),f.patchState({status:`email_awaiting_code`}),{ok:!0};let r=await t(l.apiBaseUrl,e.email,e.code,e.preferredLanguage,c(l.httpFetch));return f.reset(),{ok:!0,token:r.token}}catch(e){return f.patchState({errorMessage:e instanceof Error?e.message:`EMAIL_LOGIN_FAILED`,status:`error`}),{ok:!1}}}let p=o(l.providers,u);f.patchState({errorMessage:null,pendingExternalAuth:null,status:`external_auth_starting`});try{let t=d;if(s(p)){f.patchState({status:`finalizing_login`});let e=await p.exchangeForToken(l.apiBaseUrl,t,c(l.httpFetch));return f.reset(),{ok:!0,token:e.token}}let n=await p.startLogin(l.apiBaseUrl,{preferredLanguage:t.preferredLanguage},c(l.httpFetch)),o={kind:a(u),provider:i(u),state:n.state};for(f.patchState({pendingExternalAuth:o,status:`external_auth_waiting`}),await l.hooks.openExternalUrl(n.authorizationUrl);;){let t=await p.requestCompletion(l.apiBaseUrl,{state:o.state},c(l.httpFetch));if(t.status===e.PENDING){await r(500);continue}if(t.status===e.EXPIRED)return f.patchState({errorMessage:`Authentication timed out`,pendingExternalAuth:null,status:`error`}),{ok:!1};if(t.status===e.ERROR){let e=typeof t.reason==`string`?t.reason:`Authentication failed`;return f.patchState({errorMessage:e,pendingExternalAuth:null,status:`error`}),{ok:!1}}return t.token?(f.patchState({status:`finalizing_login`}),f.reset(),{ok:!0,token:t.token}):(f.patchState({errorMessage:`Authentication could not be completed`,pendingExternalAuth:null,status:`error`}),{ok:!1})}}catch(e){return f.patchState({errorMessage:e instanceof Error?e.message:`EXTERNAL_LOGIN_FAILED`,pendingExternalAuth:null,status:`error`}),{ok:!1}}},reset:()=>{l.useLoginCycleStore.getState().reset()}});export{l as createLoginCycle};
4
- //# debugId=1e406bb4-05a9-54ff-ad74-02e9bc8ef089
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]="b928bb95-ca4b-5297-8f3b-7ed3197366ba")}catch(e){}}();
3
+ import{t as e}from"./status-jFJKIUBU-BCgr1MV_.js";import{r as t,t as n}from"./runtime_auth_helpers-RMpae5_X-BmKa0ad1.js";const r=async e=>{await new Promise(t=>{setTimeout(t,e)})},i=e=>{switch(e){case`github`:return`github`;case`google`:return`google`;case`slack`:return`slack`;case`googleWorkspace`:return`google-workspace`;default:throw Error(`EXTERNAL_AUTH_PROVIDER_REQUIRED`)}},a=e=>e===`googleWorkspace`?`sso`:`oauth`,o=(e,t)=>{switch(t){case`github`:if(!e.github)throw Error(`GITHUB_LOGIN_ADAPTER_REQUIRED`);return e.github;case`google`:if(!e.google)throw Error(`GOOGLE_LOGIN_ADAPTER_REQUIRED`);return e.google;case`slack`:if(!e.slack)throw Error(`SLACK_LOGIN_ADAPTER_REQUIRED`);return e.slack;case`googleWorkspace`:if(!e.googleWorkspace)throw Error(`GOOGLE_WORKSPACE_LOGIN_ADAPTER_REQUIRED`);return e.googleWorkspace;case`appleNative`:if(!e.appleNative)throw Error(`APPLE_NATIVE_LOGIN_ADAPTER_REQUIRED`);return e.appleNative;default:throw Error(`UNSUPPORTED_AUTH_PROVIDER`)}},s=e=>`exchangeForToken`in e,c=e=>{if(e)return{fetchImpl:e}},l=l=>({startLogin:async(u,d)=>{let f=l.useLoginCycleStore.getState();if(u===`email`){let e=d;f.patchState({email:e.email,errorMessage:null,pendingExternalAuth:null,status:e.code?`finalizing_login`:`email_requesting_code`});try{if(!e.code)return await n(l.apiBaseUrl,e.email,c(l.httpFetch)),f.patchState({status:`email_awaiting_code`}),{ok:!0};let r=await t(l.apiBaseUrl,e.email,e.code,e.preferredLanguage,c(l.httpFetch));return f.reset(),{ok:!0,token:r.token}}catch(e){return f.patchState({errorMessage:e instanceof Error?e.message:`EMAIL_LOGIN_FAILED`,status:`error`}),{ok:!1}}}let p=o(l.providers,u);f.patchState({errorMessage:null,pendingExternalAuth:null,status:`external_auth_starting`});try{let t=d;if(s(p)){f.patchState({status:`finalizing_login`});let e=await p.exchangeForToken(l.apiBaseUrl,t,c(l.httpFetch));return f.reset(),{ok:!0,token:e.token}}let n=await p.startLogin(l.apiBaseUrl,{preferredLanguage:t.preferredLanguage},c(l.httpFetch)),o={kind:a(u),provider:i(u),state:n.state};for(f.patchState({pendingExternalAuth:o,status:`external_auth_waiting`}),await l.hooks.openExternalUrl(n.authorizationUrl);;){let t=await p.requestCompletion(l.apiBaseUrl,{state:o.state},c(l.httpFetch));if(t.status===e.PENDING){await r(500);continue}if(t.status===e.EXPIRED)return f.patchState({errorMessage:`Authentication timed out`,pendingExternalAuth:null,status:`error`}),{ok:!1};if(t.status===e.ERROR){let e=typeof t.reason==`string`?t.reason:`Authentication failed`;return f.patchState({errorMessage:e,pendingExternalAuth:null,status:`error`}),{ok:!1}}return t.token?(f.patchState({status:`finalizing_login`}),f.reset(),{ok:!0,token:t.token}):(f.patchState({errorMessage:`Authentication could not be completed`,pendingExternalAuth:null,status:`error`}),{ok:!1})}}catch(e){return f.patchState({errorMessage:e instanceof Error?e.message:`EXTERNAL_LOGIN_FAILED`,pendingExternalAuth:null,status:`error`}),{ok:!1}}},reset:()=>{l.useLoginCycleStore.getState().reset()}});export{l as createLoginCycle};
4
+ //# debugId=b928bb95-ca4b-5297-8f3b-7ed3197366ba
@@ -1,4 +1,4 @@
1
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]="57bd6797-917e-530e-80e0-58a2c3945e28")}catch(e){}}();
3
- import{a as e,c as t,d as n,f as r}from"./dist-CWCqXHLl.js";const i=e=>({token:e.token,expiresAt:e.session.expiresAt,updatedAt:e.session.updatedAt,userId:e.user.id,email:e.user.email,name:e.user.name,avatarUrl:e.user.image??``,onboardingCompleted:e.onboardingCompleted,projectTemplateOnboardingCompleted:e.projectTemplateOnboardingCompleted}),a=async(n,r,a)=>{let o=await t(n,{token:r},a);if(o.status===e.UNAUTHORIZED)return{status:e.UNAUTHORIZED,session:null};if(!o.session)throw Error(`GET_SESSION_BODY_REQUIRED`);return{status:e.OK,session:i(o.session)}},o=async(e,t,r)=>{await n(e,{email:t},r)},s=async(t,n,i,o,s)=>{let c=await a(t,(await r(t,{email:n,otp:i,preferredLanguage:o},s)).token,s);if(c.status!==e.OK||!c.session)throw Error(`Failed to load authenticated session`);return c.session};export{a as n,s as r,o as t};
4
- //# debugId=57bd6797-917e-530e-80e0-58a2c3945e28
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]="76f226bf-5bff-502a-9522-174db191b28c")}catch(e){}}();
3
+ import{a as e,c as t,d as n,f as r}from"./dist-o6UXKlbH.js";const i=e=>({token:e.token,expiresAt:e.session.expiresAt,updatedAt:e.session.updatedAt,userId:e.user.id,email:e.user.email,name:e.user.name,avatarUrl:e.user.image??``,onboardingCompleted:e.onboardingCompleted,projectTemplateOnboardingCompleted:e.projectTemplateOnboardingCompleted}),a=async(n,r,a)=>{let o=await t(n,{token:r},a);if(o.status===e.UNAUTHORIZED)return{status:e.UNAUTHORIZED,session:null};if(!o.session)throw Error(`GET_SESSION_BODY_REQUIRED`);return{status:e.OK,session:i(o.session)}},o=async(e,t,r)=>{await n(e,{email:t},r)},s=async(t,n,i,o,s)=>{let c=await a(t,(await r(t,{email:n,otp:i,preferredLanguage:o},s)).token,s);if(c.status!==e.OK||!c.session)throw Error(`Failed to load authenticated session`);return c.session};export{a as n,s as r,o as t};
4
+ //# debugId=76f226bf-5bff-502a-9522-174db191b28c