@fungi.computer/grove 0.4.0 → 0.5.1

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.
Files changed (65) hide show
  1. package/dist/assets/Effect-TOXKEWei.js +76 -0
  2. package/dist/assets/{anthropic-messages-BC32dQ9I.js → anthropic-messages-BTv37DKo.js} +3 -3
  3. package/dist/assets/{azure-openai-responses-CxbiKRMB.js → azure-openai-responses-CLI5CTea.js} +1 -1
  4. package/dist/assets/{base-face-BEjKYyJe.js → base-face-CD4oLBv-.js} +1 -1
  5. package/dist/assets/burger-BrMTWnA6.js +1 -0
  6. package/dist/assets/cat-Ce0yvAsw.js +1 -0
  7. package/dist/assets/compat-BQZx9Jx3.js +2 -0
  8. package/dist/assets/{document-CI1e8oXD.js → document-aOA3zT2S.js} +1 -1
  9. package/dist/assets/extension-hook-UDdYbDsl.js +819 -0
  10. package/dist/assets/extensions-DF9U5f_Z.js +1 -0
  11. package/dist/assets/{google-generative-ai-0DBJk_8o.js → google-generative-ai-_8qHW2IX.js} +1 -1
  12. package/dist/assets/{google-shared-BL1Pe-wK.js → google-shared-BjptlrJn.js} +1 -1
  13. package/dist/assets/{google-vertex-CPgYcjfH.js → google-vertex-C6JPlmUK.js} +1 -1
  14. package/dist/assets/index-DM8ziIjn.js +174 -0
  15. package/dist/assets/index-DRqG5MfY.css +1 -0
  16. package/dist/assets/{mistral-conversations-C3vHwl30.js → mistral-conversations-C_XYmgUS.js} +1 -1
  17. package/dist/assets/{mushroom-D2oxknl9.js → mushroom-BTxbn3Sf.js} +1 -1
  18. package/dist/assets/{node.browser-C4Y5T0IC.js → node.browser-Bc9i4viB.js} +1 -1
  19. package/dist/assets/{openai-codex-responses-BJGSPctB.js → openai-codex-responses-C0Thlbgz.js} +1 -1
  20. package/dist/assets/{openai-completions-2akGjxPU.js → openai-completions-CJJn6-l3.js} +1 -1
  21. package/dist/assets/{openai-responses-D6H3TRtV.js → openai-responses-BuHYr0Ip.js} +1 -1
  22. package/dist/assets/{openai-responses-shared-DZesysou.js → openai-responses-shared-px8hA25N.js} +1 -1
  23. package/dist/assets/parakeet-conversation-gakMmXhW.js +4 -0
  24. package/dist/assets/renderer-69rvqVnj.js +1 -0
  25. package/dist/assets/runtime-core-CHfIZEOV.js +40 -0
  26. package/dist/assets/{transform-messages-CgFTI6NF.js → transform-messages-zEOZxc_F.js} +1 -1
  27. package/dist/index.html +6 -6
  28. package/package.json +20 -10
  29. package/dist/assets/Effect-BY0T-p9d.js +0 -76
  30. package/dist/assets/Effect-Bibd7o64.js +0 -76
  31. package/dist/assets/anthropic-messages-BrTyy87S.js +0 -19
  32. package/dist/assets/azure-openai-responses-Cxq6500u.js +0 -1
  33. package/dist/assets/base-face-Dc6wvM5e.js +0 -1
  34. package/dist/assets/burger-DCM1Ryjl.js +0 -1
  35. package/dist/assets/burger-Zw2lKYST.js +0 -1
  36. package/dist/assets/cat-D2ceQOG1.js +0 -1
  37. package/dist/assets/cat-Dg3HQp8e.js +0 -1
  38. package/dist/assets/compat-CNGE3olg.js +0 -2
  39. package/dist/assets/compat-DgqxVOn_.js +0 -2
  40. package/dist/assets/document-DjWTbvB5.js +0 -1
  41. package/dist/assets/extension-hook-C8RQgls9.js +0 -741
  42. package/dist/assets/extension-hook-CBuX_bUG.js +0 -721
  43. package/dist/assets/extensions-DEfvRHbZ.js +0 -1
  44. package/dist/assets/extensions-DYjwCmO5.js +0 -1
  45. package/dist/assets/google-generative-ai-C-fVQ8eG.js +0 -1
  46. package/dist/assets/google-shared-CRsSlHta.js +0 -8
  47. package/dist/assets/google-vertex-DFCQBu0N.js +0 -1
  48. package/dist/assets/index-26gTYfVj.js +0 -171
  49. package/dist/assets/index-DIRtUgKp.css +0 -1
  50. package/dist/assets/index-HgPChePI.js +0 -171
  51. package/dist/assets/index-u-fIUxtz.css +0 -1
  52. package/dist/assets/mistral-conversations-Dx6vubnB.js +0 -4
  53. package/dist/assets/mushroom-DcQ2lek6.js +0 -1
  54. package/dist/assets/node.browser-DF9afU1k.js +0 -1
  55. package/dist/assets/openai-codex-responses-CK2Z6kMm.js +0 -9
  56. package/dist/assets/openai-completions-C35dP-q-.js +0 -5
  57. package/dist/assets/openai-responses-DPFd_3HO.js +0 -1
  58. package/dist/assets/openai-responses-shared-DaKV5GAS.js +0 -10
  59. package/dist/assets/parakeet-conversation-DKtvvfd-.js +0 -4
  60. package/dist/assets/parakeet-conversation-Di3EPCdu.js +0 -4
  61. package/dist/assets/renderer-BHU7Ec4o.js +0 -1
  62. package/dist/assets/renderer-cVoUiOqk.js +0 -1
  63. package/dist/assets/runtime-core-COw0PWwZ.js +0 -1
  64. package/dist/assets/runtime-core-DOL1texL.js +0 -1
  65. package/dist/assets/transform-messages-utWG7TCG.js +0 -1
@@ -1,76 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-hePW80VL.js";var t,n=Object.freeze({status:`aborted`});function r(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 i=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},a=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(t=globalThis).__zod_globalConfig??(t.__zod_globalConfig={});var o=globalThis.__zod_globalConfig;function s(e){return e&&Object.assign(o,e),o}function c(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 l(e,t){return typeof t==`bigint`?t.toString():t}function u(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function d(e){return e==null}function f(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ee(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}var te=Symbol(`evaluating`);function p(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==te)return r===void 0&&(r=te,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function m(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ne(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function re(e){return JSON.stringify(e)}function ie(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ae=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function oe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var se=u(()=>{if(o.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ce(e){if(oe(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return oe(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function le(e){return ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ue=new Set([`string`,`number`,`symbol`]),de=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function fe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function pe(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 me(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var he={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ge={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function _e(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 pe(e,ne(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 m(this,`shape`,e),e},checks:[]}))}function ve(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 pe(e,ne(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 m(this,`shape`,r),r},checks:[]}))}function ye(e,t){if(!ce(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return pe(e,ne(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return m(this,`shape`,n),n}}))}function be(e,t){if(!ce(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return pe(e,ne(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return m(this,`shape`,n),n}}))}function xe(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return pe(e,ne(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return m(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Se(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 pe(t,ne(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 m(this,`shape`,i),i},checks:[]}))}function Ce(e,t,n){return pe(t,ne(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 m(this,`shape`,i),i}}))}function we(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 Te(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 g(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ee(e){return typeof e==`string`?e:e?.message}function _(e,t,n){let r=e.message?e.message:Ee(e.inst?._zod.def?.error?.(e))??Ee(t?.error?.(e))??Ee(n.customError?.(e))??Ee(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 De(e){return e instanceof Set?`set`:e instanceof Map?`map`:e instanceof File?`file`:`unknown`}function Oe(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ke(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ae=(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,l,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},je=r(`$ZodError`,Ae),Me=r(`$ZodError`,Ae,{Parent:Error});function Ne(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 Pe(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}function Fe(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function Ie(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${Fe(e.path)}`);return t.join(`
2
- `)}var Le=e=>(t,n,r,a)=>{let o=r?{...r,async:!1}:{async:!1},c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise)throw new i;if(c.issues.length){let t=new((a?.Err)??e)(c.issues.map(e=>_(e,o,s())));throw ae(t,a?.callee),t}return c.value},Re=Le(Me),ze=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=>_(e,a,s())));throw ae(t,i?.callee),t}return o.value},Be=ze(Me),Ve=e=>(t,n,r)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new i;return o.issues.length?{success:!1,error:new(e??je)(o.issues.map(e=>_(e,a,s())))}:{success:!0,data:o.value}},He=Ve(Me),Ue=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>_(e,i,s())))}:{success:!0,data:a.value}},We=Ue(Me),Ge=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Le(e)(t,n,i)},Ke=e=>(t,n,r)=>Le(e)(t,n,r),qe=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ze(e)(t,n,i)},Je=e=>async(t,n,r)=>ze(e)(t,n,r),Ye=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ve(e)(t,n,i)},Xe=e=>(t,n,r)=>Ve(e)(t,n,r),Ze=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ue(e)(t,n,i)},Qe=e=>async(t,n,r)=>Ue(e)(t,n,r),$e=e({base64:()=>Et,base64url:()=>Dt,bigint:()=>Rt,boolean:()=>Vt,browserEmail:()=>vt,cidrv4:()=>wt,cidrv6:()=>Tt,cuid:()=>et,cuid2:()=>tt,date:()=>Nt,datetime:()=>It,domain:()=>kt,duration:()=>ot,e164:()=>jt,email:()=>pt,emoji:()=>bt,extendedDuration:()=>st,guid:()=>ct,hex:()=>Kt,hostname:()=>Ot,html5Email:()=>mt,httpProtocol:()=>At,idnEmail:()=>_t,integer:()=>zt,ipv4:()=>xt,ipv6:()=>St,ksuid:()=>it,lowercase:()=>Wt,mac:()=>Ct,md5_base64:()=>Xt,md5_base64url:()=>Zt,md5_hex:()=>Yt,nanoid:()=>at,null:()=>Ht,number:()=>Bt,rfc5322Email:()=>ht,sha1_base64:()=>$t,sha1_base64url:()=>en,sha1_hex:()=>Qt,sha256_base64:()=>nn,sha256_base64url:()=>rn,sha256_hex:()=>tn,sha384_base64:()=>on,sha384_base64url:()=>sn,sha384_hex:()=>an,sha512_base64:()=>ln,sha512_base64url:()=>un,sha512_hex:()=>cn,string:()=>Lt,time:()=>Ft,ulid:()=>nt,undefined:()=>Ut,unicodeEmail:()=>gt,uppercase:()=>Gt,uuid:()=>lt,uuid4:()=>ut,uuid6:()=>dt,uuid7:()=>ft,xid:()=>rt}),et=/^[cC][0-9a-z]{6,}$/,tt=/^[0-9a-z]+$/,nt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rt=/^[0-9a-vA-V]{20}$/,it=/^[A-Za-z0-9]{27}$/,at=/^[a-zA-Z0-9_-]{21}$/,ot=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,st=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ct=/^([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})$/,lt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ut=lt(4),dt=lt(6),ft=lt(7),pt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,mt=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ht=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,gt=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,_t=gt,vt=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,yt=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function bt(){return new RegExp(yt,`u`)}var xt=/^(?:(?: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])$/,St=/^(([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}|:))$/,Ct=e=>{let t=fe(e??`:`);return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},wt=/^((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])$/,Tt=/^(([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])$/,Et=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Dt=/^[A-Za-z0-9_-]*$/,Ot=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,kt=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,At=/^https?$/,jt=/^\+[1-9]\d{6,14}$/,Mt=`(?:(?:\\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])))`,Nt=RegExp(`^${Mt}$`);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 Ft(e){return RegExp(`^${Pt(e)}$`)}function It(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(`^${Mt}T(?:${r})$`)}var Lt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Rt=/^-?\d+n?$/,zt=/^-?\d+$/,Bt=/^-?\d+(?:\.\d+)?$/,Vt=/^(?:true|false)$/i,Ht=/^null$/i,Ut=/^undefined$/i,Wt=/^[^A-Z]*$/,Gt=/^[^a-z]*$/,Kt=/^[0-9a-fA-F]*$/;function qt(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Jt(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Yt=/^[0-9a-fA-F]{32}$/,Xt=qt(22,`==`),Zt=Jt(22),Qt=/^[0-9a-fA-F]{40}$/,$t=qt(27,`=`),en=Jt(27),tn=/^[0-9a-fA-F]{64}$/,nn=qt(43,`=`),rn=Jt(43),an=/^[0-9a-fA-F]{96}$/,on=qt(64,``),sn=Jt(64),cn=/^[0-9a-fA-F]{128}$/,ln=qt(86,`==`),un=Jt(86),v=r(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),dn={number:`number`,bigint:`bigint`,object:`date`},fn=r(`$ZodCheckLessThan`,(e,t)=>{v.init(e,t);let n=dn[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})}}),pn=r(`$ZodCheckGreaterThan`,(e,t)=>{v.init(e,t);let n=dn[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})}}),mn=r(`$ZodCheckMultipleOf`,(e,t)=>{v.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):ee(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})}}),hn=r(`$ZodCheckNumberFormat`,(e,t)=>{v.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=he[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=zt)}),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})}}),gn=r(`$ZodCheckBigIntFormat`,(e,t)=>{v.init(e,t);let[n,r]=ge[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=n,i.maximum=r}),e._zod.check=i=>{let a=i.value;a<n&&i.issues.push({origin:`bigint`,input:a,code:`too_small`,minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>r&&i.issues.push({origin:`bigint`,input:a,code:`too_big`,maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),_n=r(`$ZodCheckMaxSize`,(e,t)=>{var n;v.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!d(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;r.size<=t.maximum||n.issues.push({origin:De(r),code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),vn=r(`$ZodCheckMinSize`,(e,t)=>{var n;v.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!d(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;r.size>=t.minimum||n.issues.push({origin:De(r),code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),yn=r(`$ZodCheckSizeEquals`,(e,t)=>{var n;v.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!d(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=n=>{let r=n.value,i=r.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:De(r),...a?{code:`too_big`,maximum:t.size}:{code:`too_small`,minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),bn=r(`$ZodCheckMaxLength`,(e,t)=>{var n;v.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!d(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=Oe(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),xn=r(`$ZodCheckMinLength`,(e,t)=>{var n;v.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!d(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=Oe(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Sn=r(`$ZodCheckLengthEquals`,(e,t)=>{var n;v.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!d(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=Oe(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})}}),Cn=r(`$ZodCheckStringFormat`,(e,t)=>{var n,r;v.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),wn=r(`$ZodCheckRegex`,(e,t)=>{Cn.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})}}),Tn=r(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Wt,Cn.init(e,t)}),En=r(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Gt,Cn.init(e,t)}),Dn=r(`$ZodCheckIncludes`,(e,t)=>{v.init(e,t);let n=fe(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})}}),On=r(`$ZodCheckStartsWith`,(e,t)=>{v.init(e,t);let n=RegExp(`^${fe(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})}}),kn=r(`$ZodCheckEndsWith`,(e,t)=>{v.init(e,t);let n=RegExp(`.*${fe(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function An(e,t,n){e.issues.length&&t.issues.push(...g(n,e.issues))}var jn=r(`$ZodCheckProperty`,(e,t)=>{v.init(e,t),e._zod.check=e=>{let n=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(n=>An(n,e,t.property));An(n,e,t.property)}}),Mn=r(`$ZodCheckMimeType`,(e,t)=>{v.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:`invalid_value`,values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),Nn=r(`$ZodCheckOverwrite`,(e,t)=>{v.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Pn=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(`
3
- `).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(`
4
- `))}},Fn={major:4,minor:4,patch:3},y=r(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Fn;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=we(e),a;for(let o of t){if(o._zod.def.when){if(Te(e)||!o._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&n?.async===!1)throw new i;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(r||=we(e,t))});else{if(e.issues.length===t)continue;r||=we(e,t)}}return a?a.then(()=>e):e},n=(n,a,o)=>{if(we(n))return n.aborted=!0,n;let s=t(a,r,o);if(s instanceof Promise){if(o.async===!1)throw new i;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 i;return s.then(e=>t(e,r,o))}return t(s,r,o)}}p(e,`~standard`,()=>({validate:t=>{try{let n=He(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return We(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),In=r(`$ZodString`,(e,t)=>{y.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Lt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),b=r(`$ZodStringFormat`,(e,t)=>{Cn.init(e,t),In.init(e,t)}),Ln=r(`$ZodGUID`,(e,t)=>{t.pattern??=ct,b.init(e,t)}),Rn=r(`$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??=lt(e)}else t.pattern??=lt();b.init(e,t)}),zn=r(`$ZodEmail`,(e,t)=>{t.pattern??=pt,b.init(e,t)}),Bn=r(`$ZodURL`,(e,t)=>{b.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===At.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})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Vn=r(`$ZodEmoji`,(e,t)=>{t.pattern??=bt(),b.init(e,t)}),Hn=r(`$ZodNanoID`,(e,t)=>{t.pattern??=at,b.init(e,t)}),Un=r(`$ZodCUID`,(e,t)=>{t.pattern??=et,b.init(e,t)}),Wn=r(`$ZodCUID2`,(e,t)=>{t.pattern??=tt,b.init(e,t)}),Gn=r(`$ZodULID`,(e,t)=>{t.pattern??=nt,b.init(e,t)}),Kn=r(`$ZodXID`,(e,t)=>{t.pattern??=rt,b.init(e,t)}),qn=r(`$ZodKSUID`,(e,t)=>{t.pattern??=it,b.init(e,t)}),Jn=r(`$ZodISODateTime`,(e,t)=>{t.pattern??=It(t),b.init(e,t)}),Yn=r(`$ZodISODate`,(e,t)=>{t.pattern??=Nt,b.init(e,t)}),Xn=r(`$ZodISOTime`,(e,t)=>{t.pattern??=Ft(t),b.init(e,t)}),Zn=r(`$ZodISODuration`,(e,t)=>{t.pattern??=ot,b.init(e,t)}),Qn=r(`$ZodIPv4`,(e,t)=>{t.pattern??=xt,b.init(e,t),e._zod.bag.format=`ipv4`}),$n=r(`$ZodIPv6`,(e,t)=>{t.pattern??=St,b.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),er=r(`$ZodMAC`,(e,t)=>{t.pattern??=Ct(t.delimiter),b.init(e,t),e._zod.bag.format=`mac`}),tr=r(`$ZodCIDRv4`,(e,t)=>{t.pattern??=wt,b.init(e,t)}),nr=r(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Tt,b.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function rr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var ir=r(`$ZodBase64`,(e,t)=>{t.pattern??=Et,b.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{rr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function ar(e){if(!Dt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return rr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var or=r(`$ZodBase64URL`,(e,t)=>{t.pattern??=Dt,b.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{ar(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),sr=r(`$ZodE164`,(e,t)=>{t.pattern??=jt,b.init(e,t)});function cr(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}}var lr=r(`$ZodJWT`,(e,t)=>{b.init(e,t),e._zod.check=n=>{cr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ur=r(`$ZodCustomStringFormat`,(e,t)=>{b.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:`invalid_format`,format:t.format,input:n.value,inst:e,continue:!t.abort})}}),dr=r(`$ZodNumber`,(e,t)=>{y.init(e,t),e._zod.pattern=e._zod.bag.pattern??Bt,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}}),fr=r(`$ZodNumberFormat`,(e,t)=>{hn.init(e,t),dr.init(e,t)}),pr=r(`$ZodBoolean`,(e,t)=>{y.init(e,t),e._zod.pattern=Vt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),mr=r(`$ZodBigInt`,(e,t)=>{y.init(e,t),e._zod.pattern=Rt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value==`bigint`||n.issues.push({expected:`bigint`,code:`invalid_type`,input:n.value,inst:e}),n}}),hr=r(`$ZodBigIntFormat`,(e,t)=>{gn.init(e,t),mr.init(e,t)}),gr=r(`$ZodSymbol`,(e,t)=>{y.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return typeof r==`symbol`||t.issues.push({expected:`symbol`,code:`invalid_type`,input:r,inst:e}),t}}),_r=r(`$ZodUndefined`,(e,t)=>{y.init(e,t),e._zod.pattern=Ut,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),vr=r(`$ZodNull`,(e,t)=>{y.init(e,t),e._zod.pattern=Ht,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}}),yr=r(`$ZodAny`,(e,t)=>{y.init(e,t),e._zod.parse=e=>e}),br=r(`$ZodUnknown`,(e,t)=>{y.init(e,t),e._zod.parse=e=>e}),xr=r(`$ZodNever`,(e,t)=>{y.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),Sr=r(`$ZodVoid`,(e,t)=>{y.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),Cr=r(`$ZodDate`,(e,t)=>{y.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function wr(e,t,n){e.issues.length&&t.issues.push(...g(n,e.issues)),t.value[n]=e.value}var Tr=r(`$ZodArray`,(e,t)=>{y.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>wr(t,n,e))):wr(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Er(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...g(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 Dr(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=me(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Or(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=>Er(e,n,i,t,u,d))):Er(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}var kr=r(`$ZodObject`,(e,t)=>{if(y.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=u(()=>Dr(t));p(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=oe,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=>Er(n,t,e,s,r,i))):Er(a,t,e,s,r,i)}return i?Or(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Ar=r(`$ZodObjectJIT`,(e,t)=>{kr.init(e,t);let n=e._zod.parse,r=u(()=>Dr(t)),i=e=>{let t=new Pn([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=re(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=re(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
5
- if (${n}.issues.length) {
6
- if (${o} in input) {
7
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
8
- ...iss,
9
- path: iss.path ? [${o}, ...iss.path] : [${o}]
10
- })));
11
- }
12
- }
13
-
14
- if (${n}.value === undefined) {
15
- if (${o} in input) {
16
- newResult[${o}] = undefined;
17
- }
18
- } else {
19
- newResult[${o}] = ${n}.value;
20
- }
21
-
22
- `):c?t.write(`
23
- if (${n}.issues.length) {
24
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
25
- ...iss,
26
- path: iss.path ? [${o}, ...iss.path] : [${o}]
27
- })));
28
- }
29
-
30
- if (${n}.value === undefined) {
31
- if (${o} in input) {
32
- newResult[${o}] = undefined;
33
- }
34
- } else {
35
- newResult[${o}] = ${n}.value;
36
- }
37
-
38
- `):t.write(`
39
- const ${n}_present = ${o} in input;
40
- if (${n}.issues.length) {
41
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
42
- ...iss,
43
- path: iss.path ? [${o}, ...iss.path] : [${o}]
44
- })));
45
- }
46
- if (!${n}_present && !${n}.issues.length) {
47
- payload.issues.push({
48
- code: "invalid_type",
49
- expected: "nonoptional",
50
- input: undefined,
51
- path: [${o}]
52
- });
53
- }
54
-
55
- if (${n}_present) {
56
- if (${n}.value === undefined) {
57
- newResult[${o}] = undefined;
58
- } else {
59
- newResult[${o}] = ${n}.value;
60
- }
61
- }
62
-
63
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,s=oe,c=!o.jitless,l=c&&se.value,d=t.catchall,f;e._zod.parse=(o,u)=>{f??=r.value;let ee=o.value;return s(ee)?c&&l&&u?.async===!1&&u.jitless!==!0?(a||=i(t.shape),o=a(o,u),d?Or([],ee,o,u,f,e):o):n(o,u):(o.issues.push({expected:`object`,code:`invalid_type`,input:ee,inst:e}),o)}});function jr(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=>!we(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>_(e,r,s())))}),t)}var Mr=r(`$ZodUnion`,(e,t)=>{y.init(e,t),p(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),p(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),p(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),p(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=>f(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=>jr(t,r,e,i)):jr(o,r,e,i)}});function Nr(e,t,n,r){let i=e.filter(e=>e.issues.length===0);return i.length===1?(t.value=i[0].value,t):(i.length===0?t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>_(e,r,s())))}):t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:[],inclusive:!1}),t)}var Pr=r(`$ZodXor`,(e,t)=>{Mr.init(e,t),t.inclusive=!1;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);t instanceof Promise?(o.push(t),a=!0):o.push(t)}return a?Promise.all(o).then(t=>Nr(t,r,e,i)):Nr(o,r,e,i)}}),Fr=r(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Mr.init(e,t);let n=e._zod.parse;p(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=u(()=>{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(!oe(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)}}),Ir=r(`$ZodIntersection`,(e,t)=>{y.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Rr(e,t,n)):Rr(e,i,a)}});function Lr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ce(e)&&ce(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Lr(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=Lr(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 Rr(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}),we(e))return e;let o=Lr(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var zr=r(`$ZodTuple`,(e,t)=>{y.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=Br(n,`optin`),c=Br(n,`optout`);if(!t.rest){if(a.length<s)return r.issues.push({code:`too_small`,minimum:s,inclusive:!0,input:a,inst:e,origin:`array`}),r;a.length>n.length&&r.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:a,inst:e,origin:`array`})}let l=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:a[e],issues:[]},i);t instanceof Promise?o.push(t.then(t=>{l[e]=t})):l[e]=t}if(t.rest){let e=n.length-1,s=a.slice(n.length);for(let n of s){e++;let a=t.rest._zod.run({value:n,issues:[]},i);a instanceof Promise?o.push(a.then(t=>Vr(t,r,e))):Vr(a,r,e)}}return o.length?Promise.all(o).then(()=>Hr(l,r,n,a,c)):Hr(l,r,n,a,c)}});function Br(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function Vr(e,t,n){e.issues.length&&t.issues.push(...g(n,e.issues)),t.value[n]=e.value}function Hr(e,t,n,r,i){for(let a=0;a<n.length;a++){let n=e[a],o=a<r.length;if(n.issues.length){if(!o&&a>=i){t.value.length=a;break}t.issues.push(...g(a,n.issues))}t.value[a]=n.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var Ur=r(`$ZodRecord`,(e,t)=>{y.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!ce(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let c=new Set;for(let l of o)if(typeof l==`string`||typeof l==`number`||typeof l==`symbol`){c.add(typeof l==`number`?l.toString():l);let o=t.keyType._zod.run({value:l,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=>_(e,r,s())),input:l,path:[l],inst:e});continue}let u=o.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(...g(l,e.issues)),n.value[u]=e.value})):(d.issues.length&&n.issues.push(...g(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 o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let c=t.keyType._zod.run({value:o,issues:[]},r);if(c instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Bt.test(o)&&c.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&&(c=e)}if(c.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:c.issues.map(e=>_(e,r,s())),input:o,path:[o],inst:e});continue}let l=t.valueType._zod.run({value:i[o],issues:[]},r);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&n.issues.push(...g(o,e.issues)),n.value[c.value]=e.value})):(l.issues.length&&n.issues.push(...g(o,l.issues)),n.value[c.value]=l.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Wr=r(`$ZodMap`,(e,t)=>{y.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:`map`,code:`invalid_type`,input:i,inst:e}),n;let a=[];n.value=new Map;for(let[o,s]of i){let c=t.keyType._zod.run({value:o,issues:[]},r),l=t.valueType._zod.run({value:s,issues:[]},r);c instanceof Promise||l instanceof Promise?a.push(Promise.all([c,l]).then(([t,a])=>{Gr(t,a,n,o,i,e,r)})):Gr(c,l,n,o,i,e,r)}return a.length?Promise.all(a).then(()=>n):n}});function Gr(e,t,n,r,i,a,o){e.issues.length&&(ue.has(typeof r)?n.issues.push(...g(r,e.issues)):n.issues.push({code:`invalid_key`,origin:`map`,input:i,inst:a,issues:e.issues.map(e=>_(e,o,s()))})),t.issues.length&&(ue.has(typeof r)?n.issues.push(...g(r,t.issues)):n.issues.push({origin:`map`,code:`invalid_element`,input:i,inst:a,key:r,issues:t.issues.map(e=>_(e,o,s()))})),n.value.set(e.value,t.value)}var Kr=r(`$ZodSet`,(e,t)=>{y.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:`set`,code:`invalid_type`}),n;let a=[];n.value=new Set;for(let e of i){let i=t.valueType._zod.run({value:e,issues:[]},r);i instanceof Promise?a.push(i.then(e=>qr(e,n))):qr(i,n)}return a.length?Promise.all(a).then(()=>n):n}});function qr(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var Jr=r(`$ZodEnum`,(e,t)=>{y.init(e,t);let n=c(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ue.has(typeof e)).map(e=>typeof e==`string`?fe(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}}),Yr=r(`$ZodLiteral`,(e,t)=>{if(y.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?fe(e):e?fe(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}}),Xr=r(`$ZodFile`,(e,t)=>{y.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r instanceof File||t.issues.push({expected:`file`,code:`invalid_type`,input:r,inst:e}),t}}),Zr=r(`$ZodTransform`,(e,t)=>{y.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new a(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(n.value=e,n.fallback=!0,n));if(o instanceof Promise)throw new i;return n.value=o,n.fallback=!0,n}});function Qr(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var $r=r(`$ZodOptional`,(e,t)=>{y.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,p(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),p(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${f(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=>Qr(e,r)):Qr(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),ei=r(`$ZodExactOptional`,(e,t)=>{$r.init(e,t),p(e._zod,`values`,()=>t.innerType._zod.values),p(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ti=r(`$ZodNullable`,(e,t)=>{y.init(e,t),p(e._zod,`optin`,()=>t.innerType._zod.optin),p(e._zod,`optout`,()=>t.innerType._zod.optout),p(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${f(e.source)}|null)$`):void 0}),p(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)}),ni=r(`$ZodDefault`,(e,t)=>{y.init(e,t),e._zod.optin=`optional`,p(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=>ri(e,t)):ri(r,t)}});function ri(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ii=r(`$ZodPrefault`,(e,t)=>{y.init(e,t),e._zod.optin=`optional`,p(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))}),ai=r(`$ZodNonOptional`,(e,t)=>{y.init(e,t),p(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=>oi(t,e)):oi(i,e)}});function oi(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var si=r(`$ZodSuccess`,(e,t)=>{y.init(e,t),e._zod.parse=(e,n)=>{if(n.direction===`backward`)throw new a(`ZodSuccess`);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>(e.value=t.issues.length===0,e)):(e.value=r.issues.length===0,e)}}),ci=r(`$ZodCatch`,(e,t)=>{y.init(e,t),e._zod.optin=`optional`,p(e._zod,`optout`,()=>t.innerType._zod.optout),p(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>_(e,n,s()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>_(e,n,s()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),li=r(`$ZodNaN`,(e,t)=>{y.init(e,t),e._zod.parse=(t,n)=>((typeof t.value!=`number`||!Number.isNaN(t.value))&&t.issues.push({input:t.value,inst:e,expected:`nan`,code:`invalid_type`}),t)}),ui=r(`$ZodPipe`,(e,t)=>{y.init(e,t),p(e._zod,`values`,()=>t.in._zod.values),p(e._zod,`optin`,()=>t.in._zod.optin),p(e._zod,`optout`,()=>t.out._zod.optout),p(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=>di(e,t.in,n)):di(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>di(e,t.out,n)):di(r,t.out,n)}});function di(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var fi=r(`$ZodCodec`,(e,t)=>{y.init(e,t),p(e._zod,`values`,()=>t.in._zod.values),p(e._zod,`optin`,()=>t.in._zod.optin),p(e._zod,`optout`,()=>t.out._zod.optout),p(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if((n.direction||`forward`)===`forward`){let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>pi(e,t,n)):pi(r,t,n)}{let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>pi(e,t,n)):pi(r,t,n)}}});function pi(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||`forward`)===`forward`){let r=t.transform(e.value,e);return r instanceof Promise?r.then(r=>mi(e,r,t.out,n)):mi(e,r,t.out,n)}{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(r=>mi(e,r,t.in,n)):mi(e,r,t.in,n)}}function mi(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}var hi=r(`$ZodPreprocess`,(e,t)=>{ui.init(e,t)}),gi=r(`$ZodReadonly`,(e,t)=>{y.init(e,t),p(e._zod,`propValues`,()=>t.innerType._zod.propValues),p(e._zod,`values`,()=>t.innerType._zod.values),p(e._zod,`optin`,()=>t.innerType?._zod?.optin),p(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(_i):_i(r)}});function _i(e){return e.value=Object.freeze(e.value),e}var vi=r(`$ZodTemplateLiteral`,(e,t)=>{y.init(e,t);let n=[];for(let e of t.parts)if(typeof e==`object`&&e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let r=+!!t.startsWith(`^`),i=t.endsWith(`$`)?t.length-1:t.length;n.push(t.slice(r,i))}else if(e===null||de.has(typeof e))n.push(fe(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${n.join(``)}$`),e._zod.parse=(n,r)=>typeof n.value==`string`?(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:`invalid_format`,format:t.format??`template_literal`,pattern:e._zod.pattern.source}),n):(n.issues.push({input:n.value,inst:e,expected:`string`,code:`invalid_type`}),n)}),yi=r(`$ZodFunction`,(e,t)=>(y.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if(typeof t!=`function`)throw Error(`implement() must be called with a function`);return function(...n){let r=e._def.input?Re(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?Re(e._def.output,i):i}},e.implementAsync=t=>{if(typeof t!=`function`)throw Error(`implementAsync() must be called with a function`);return async function(...n){let r=e._def.input?await Be(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await Be(e._def.output,i):i}},e._zod.parse=(t,n)=>typeof t.value==`function`?(t.value=e._def.output&&e._def.output._zod.def.type===`promise`?e.implementAsync(t.value):e.implement(t.value),t):(t.issues.push({code:`invalid_type`,expected:`function`,input:t.value,inst:e}),t),e.input=(...t)=>{let n=e.constructor;return Array.isArray(t[0])?new n({type:`function`,input:new zr({type:`tuple`,items:t[0],rest:t[1]}),output:e._def.output}):new n({type:`function`,input:t[0],output:e._def.output})},e.output=t=>{let n=e.constructor;return new n({type:`function`,input:e._def.input,output:t})},e)),bi=r(`$ZodPromise`,(e,t)=>{y.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),xi=r(`$ZodLazy`,(e,t)=>{y.init(e,t),p(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),p(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),p(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),p(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),p(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Si=r(`$ZodCustom`,(e,t)=>{v.init(e,t),y.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Ci(t,n,r,e));Ci(i,n,r,e)}});function Ci(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(ke(e))}}var wi,Ti=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 Ei(){return new Ti}(wi=globalThis).__zod_globalRegistry??(wi.__zod_globalRegistry=Ei());var Di=globalThis.__zod_globalRegistry;function Oi(e,t){return new e({type:`string`,...h(t)})}function ki(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...h(t)})}function Ai(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...h(t)})}function ji(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...h(t)})}function Mi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...h(t)})}function Ni(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...h(t)})}function Pi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...h(t)})}function Fi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...h(t)})}function Ii(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...h(t)})}function Li(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...h(t)})}function Ri(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...h(t)})}function zi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...h(t)})}function Bi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...h(t)})}function Vi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...h(t)})}function Hi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...h(t)})}function Ui(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...h(t)})}function Wi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...h(t)})}function Gi(e,t){return new e({type:`string`,format:`mac`,check:`string_format`,abort:!1,...h(t)})}function Ki(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...h(t)})}function qi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...h(t)})}function Ji(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...h(t)})}function Yi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...h(t)})}function Xi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...h(t)})}function Zi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...h(t)})}function Qi(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...h(t)})}function $i(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...h(t)})}function ea(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...h(t)})}function ta(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...h(t)})}function na(e,t){return new e({type:`number`,checks:[],...h(t)})}function ra(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...h(t)})}function ia(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float32`,...h(t)})}function aa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float64`,...h(t)})}function oa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`int32`,...h(t)})}function sa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`uint32`,...h(t)})}function ca(e,t){return new e({type:`boolean`,...h(t)})}function la(e,t){return new e({type:`bigint`,...h(t)})}function ua(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`int64`,...h(t)})}function da(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`uint64`,...h(t)})}function fa(e,t){return new e({type:`symbol`,...h(t)})}function pa(e,t){return new e({type:`undefined`,...h(t)})}function ma(e,t){return new e({type:`null`,...h(t)})}function ha(e){return new e({type:`any`})}function ga(e){return new e({type:`unknown`})}function _a(e,t){return new e({type:`never`,...h(t)})}function va(e,t){return new e({type:`void`,...h(t)})}function ya(e,t){return new e({type:`date`,...h(t)})}function ba(e,t){return new e({type:`nan`,...h(t)})}function xa(e,t){return new fn({check:`less_than`,...h(t),value:e,inclusive:!1})}function Sa(e,t){return new fn({check:`less_than`,...h(t),value:e,inclusive:!0})}function Ca(e,t){return new pn({check:`greater_than`,...h(t),value:e,inclusive:!1})}function x(e,t){return new pn({check:`greater_than`,...h(t),value:e,inclusive:!0})}function wa(e){return Ca(0,e)}function Ta(e){return xa(0,e)}function Ea(e){return Sa(0,e)}function Da(e){return x(0,e)}function Oa(e,t){return new mn({check:`multiple_of`,...h(t),value:e})}function ka(e,t){return new _n({check:`max_size`,...h(t),maximum:e})}function Aa(e,t){return new vn({check:`min_size`,...h(t),minimum:e})}function ja(e,t){return new yn({check:`size_equals`,...h(t),size:e})}function Ma(e,t){return new bn({check:`max_length`,...h(t),maximum:e})}function Na(e,t){return new xn({check:`min_length`,...h(t),minimum:e})}function Pa(e,t){return new Sn({check:`length_equals`,...h(t),length:e})}function Fa(e,t){return new wn({check:`string_format`,format:`regex`,...h(t),pattern:e})}function Ia(e){return new Tn({check:`string_format`,format:`lowercase`,...h(e)})}function La(e){return new En({check:`string_format`,format:`uppercase`,...h(e)})}function Ra(e,t){return new Dn({check:`string_format`,format:`includes`,...h(t),includes:e})}function za(e,t){return new On({check:`string_format`,format:`starts_with`,...h(t),prefix:e})}function Ba(e,t){return new kn({check:`string_format`,format:`ends_with`,...h(t),suffix:e})}function Va(e,t,n){return new jn({check:`property`,property:e,schema:t,...h(n)})}function Ha(e,t){return new Mn({check:`mime_type`,mime:e,...h(t)})}function Ua(e){return new Nn({check:`overwrite`,tx:e})}function Wa(e){return Ua(t=>t.normalize(e))}function Ga(){return Ua(e=>e.trim())}function Ka(){return Ua(e=>e.toLowerCase())}function qa(){return Ua(e=>e.toUpperCase())}function Ja(){return Ua(e=>ie(e))}function Ya(e,t,n){return new e({type:`array`,element:t,...h(n)})}function Xa(e,t){return new e({type:`file`,...h(t)})}function Za(e,t,n){let r=h(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function Qa(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...h(n)})}function $a(e,t){let n=eo(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(ke(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(ke(r))}},e(t.value,t)),t);return n}function eo(e,t){let n=new v({check:`custom`,...h(t)});return n._zod.check=e,n}function to(e){let t=new v({check:`describe`});return t._zod.onattach=[t=>{let n=Di.get(t)??{};Di.add(t,{...n,description:e})}],t._zod.check=()=>{},t}function no(e){let t=new v({check:`meta`});return t._zod.onattach=[t=>{let n=Di.get(t)??{};Di.add(t,{...n,...e})}],t._zod.check=()=>{},t}function ro(e,t){let n=h(t),r=n.truthy??[`true`,`1`,`yes`,`on`,`y`,`enabled`],i=n.falsy??[`false`,`0`,`no`,`off`,`n`,`disabled`];n.case!==`sensitive`&&(r=r.map(e=>typeof e==`string`?e.toLowerCase():e),i=i.map(e=>typeof e==`string`?e.toLowerCase():e));let a=new Set(r),o=new Set(i),s=e.Codec??fi,c=e.Boolean??pr,l=new s({type:`pipe`,in:new(e.String??In)({type:`string`,error:n.error}),out:new c({type:`boolean`,error:n.error}),transform:((e,t)=>{let r=e;return n.case!==`sensitive`&&(r=r.toLowerCase()),a.has(r)?!0:!o.has(r)&&(t.issues.push({code:`invalid_value`,expected:`stringbool`,values:[...a,...o],input:t.value,inst:l,continue:!1}),{})}),reverseTransform:((e,t)=>e===!0?r[0]||`true`:i[0]||`false`),error:n.error});return l}function io(e,t,n,r={}){let i=h(r),a={...h(r),check:`string_format`,type:`string`,format:t,fn:typeof n==`function`?n:e=>n.test(e),...i};return n instanceof RegExp&&(a.pattern=n),new e(a)}function ao(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??Di,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 S(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,S(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`&&C(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 oo(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>
64
-
65
- 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 so(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:lo(t,`input`,e.processors),output:lo(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function C(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 C(r.element,n);if(r.type===`set`)return C(r.valueType,n);if(r.type===`lazy`)return C(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 C(r.innerType,n);if(r.type===`intersection`)return C(r.left,n)||C(r.right,n);if(r.type===`record`||r.type===`map`)return C(r.keyType,n)||C(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:C(r.in,n)||C(r.out,n);if(r.type===`object`){for(let e in r.shape)if(C(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(C(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(C(e,n))return!0;return!!(r.rest&&C(r.rest,n))}return!1}var co=(e,t={})=>n=>{let r=ao({...n,processors:t});return S(e,r),oo(r,e),so(r,e)},lo=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ao({...i??{},target:a,io:t,processors:n});return S(e,o),oo(o,e),so(o,e)},uo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},fo=(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=uo[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}))])}},po=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),ee=t.target===`draft-04`||t.target===`openapi-3.0`;d?ee?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?ee?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},mo=(e,t,n,r)=>{n.type=`boolean`},ho=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},go=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},_o=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},vo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},yo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},bo=(e,t,n,r)=>{n.not={}},xo=(e,t,n,r)=>{},So=(e,t,n,r)=>{},Co=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},wo=(e,t,n,r)=>{let i=e._zod.def,a=c(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},To=(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}},Eo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},Do=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Oo=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},ko=(e,t,n,r)=>{n.type=`boolean`},Ao=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},jo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Mo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},No=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},Po=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Fo=(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=S(a.element,t,{...r,path:[...r.path,`items`]})},Io=(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]=S(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=S(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Lo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>S(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ro=(e,t,n,r)=>{let i=e._zod.def,a=S(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=S(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]]},zo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>S(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?S(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Bo=(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=S(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=S(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=S(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)}},Vo=(e,t,n,r)=>{let i=e._zod.def,a=S(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`}]},Ho=(e,t,n,r)=>{let i=e._zod.def;S(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Uo=(e,t,n,r)=>{let i=e._zod.def;S(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Wo=(e,t,n,r)=>{let i=e._zod.def;S(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)))},Go=(e,t,n,r)=>{let i=e._zod.def;S(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},Ko=(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;S(o,t,r);let s=t.seen.get(e);s.ref=o},qo=(e,t,n,r)=>{let i=e._zod.def;S(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Jo=(e,t,n,r)=>{let i=e._zod.def;S(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Yo=(e,t,n,r)=>{let i=e._zod.def;S(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Xo=(e,t,n,r)=>{let i=e._zod.innerType;S(i,t,r);let a=t.seen.get(e);a.ref=i},Zo={string:fo,number:po,boolean:mo,bigint:ho,symbol:go,null:_o,undefined:vo,void:yo,never:bo,any:xo,unknown:So,date:Co,enum:wo,literal:To,nan:Eo,template_literal:Do,file:Oo,success:ko,custom:Ao,function:jo,transform:Mo,map:No,set:Po,array:Fo,object:Io,union:Lo,intersection:Ro,tuple:zo,record:Bo,nullable:Vo,nonoptional:Ho,default:Uo,prefault:Wo,catch:Go,pipe:Ko,readonly:qo,promise:Jo,optional:Yo,lazy:Xo};function Qo(e,t){if(`_idmap`in e){let n=e,r=ao({...t,processors:Zo}),i={};for(let e of n._idmap.entries()){let[t,n]=e;S(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;oo(r,n),a[t]=so(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=ao({...t,processors:Zo});return S(e,n),oo(n,e),so(n,e)}var $o=e({ZodISODate:()=>ns,ZodISODateTime:()=>es,ZodISODuration:()=>os,ZodISOTime:()=>is,date:()=>rs,datetime:()=>ts,duration:()=>ss,time:()=>as}),es=r(`ZodISODateTime`,(e,t)=>{Jn.init(e,t),E.init(e,t)});function ts(e){return Qi(es,e)}var ns=r(`ZodISODate`,(e,t)=>{Yn.init(e,t),E.init(e,t)});function rs(e){return $i(ns,e)}var is=r(`ZodISOTime`,(e,t)=>{Xn.init(e,t),E.init(e,t)});function as(e){return ea(is,e)}var os=r(`ZodISODuration`,(e,t)=>{Zn.init(e,t),E.init(e,t)});function ss(e){return ta(os,e)}var w=r(`ZodError`,(e,t)=>{je.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Pe(e,t)},flatten:{value:t=>Ne(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,l,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,l,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),cs=Le(w),ls=ze(w),us=Ve(w),ds=Ue(w),fs=Ge(w),ps=Ke(w),ms=qe(w),hs=Je(w),gs=Ye(w),_s=Xe(w),vs=Ze(w),ys=Qe(w),bs=e({ZodAny:()=>Hc,ZodArray:()=>Qc,ZodBase64:()=>cc,ZodBase64URL:()=>uc,ZodBigInt:()=>jc,ZodBigIntFormat:()=>Nc,ZodBoolean:()=>kc,ZodCIDRv4:()=>ic,ZodCIDRv6:()=>oc,ZodCUID:()=>Hs,ZodCUID2:()=>Ws,ZodCatch:()=>ql,ZodCodec:()=>$l,ZodCustom:()=>pu,ZodCustomStringFormat:()=>gc,ZodDate:()=>Xc,ZodDefault:()=>zl,ZodDiscriminatedUnion:()=>ll,ZodE164:()=>fc,ZodEmail:()=>Es,ZodEmoji:()=>Rs,ZodEnum:()=>Cl,ZodExactOptional:()=>Pl,ZodFile:()=>Ol,ZodFunction:()=>du,ZodGUID:()=>Os,ZodIPv4:()=>Qs,ZodIPv6:()=>nc,ZodIntersection:()=>dl,ZodJWT:()=>mc,ZodKSUID:()=>Xs,ZodLazy:()=>su,ZodLiteral:()=>El,ZodMAC:()=>ec,ZodMap:()=>yl,ZodNaN:()=>Yl,ZodNanoID:()=>Bs,ZodNever:()=>Kc,ZodNonOptional:()=>Ul,ZodNull:()=>Bc,ZodNullable:()=>Il,ZodNumber:()=>xc,ZodNumberFormat:()=>Cc,ZodObject:()=>tl,ZodOptional:()=>Ml,ZodPipe:()=>Zl,ZodPrefault:()=>Vl,ZodPreprocess:()=>nu,ZodPromise:()=>lu,ZodReadonly:()=>ru,ZodRecord:()=>hl,ZodSet:()=>xl,ZodString:()=>ws,ZodStringFormat:()=>E,ZodSuccess:()=>Gl,ZodSymbol:()=>Ic,ZodTemplateLiteral:()=>au,ZodTransform:()=>Al,ZodTuple:()=>pl,ZodType:()=>T,ZodULID:()=>Ks,ZodURL:()=>Fs,ZodUUID:()=>As,ZodUndefined:()=>Rc,ZodUnion:()=>al,ZodUnknown:()=>Wc,ZodVoid:()=>Jc,ZodXID:()=>Js,ZodXor:()=>sl,_ZodString:()=>Cs,_default:()=>Bl,_function:()=>fu,any:()=>Uc,array:()=>$c,base64:()=>lc,base64url:()=>dc,bigint:()=>Mc,boolean:()=>Ac,catch:()=>Jl,check:()=>mu,cidrv4:()=>ac,cidrv6:()=>sc,codec:()=>eu,cuid:()=>Us,cuid2:()=>Gs,custom:()=>hu,date:()=>Zc,describe:()=>vu,discriminatedUnion:()=>ul,e164:()=>pc,email:()=>Ds,emoji:()=>zs,enum:()=>wl,exactOptional:()=>Fl,file:()=>kl,float32:()=>Tc,float64:()=>Ec,function:()=>fu,guid:()=>ks,hash:()=>bc,hex:()=>yc,hostname:()=>vc,httpUrl:()=>Ls,instanceof:()=>bu,int:()=>wc,int32:()=>Dc,int64:()=>Pc,intersection:()=>fl,invertCodec:()=>tu,ipv4:()=>$s,ipv6:()=>rc,json:()=>Su,jwt:()=>hc,keyof:()=>el,ksuid:()=>Zs,lazy:()=>cu,literal:()=>Dl,looseObject:()=>il,looseRecord:()=>vl,mac:()=>tc,map:()=>bl,meta:()=>yu,nan:()=>Xl,nanoid:()=>Vs,nativeEnum:()=>Tl,never:()=>qc,nonoptional:()=>Wl,null:()=>Vc,nullable:()=>Ll,nullish:()=>Rl,number:()=>Sc,object:()=>nl,optional:()=>Nl,partialRecord:()=>_l,pipe:()=>Ql,prefault:()=>Hl,preprocess:()=>Cu,promise:()=>uu,readonly:()=>iu,record:()=>gl,refine:()=>gu,set:()=>Sl,strictObject:()=>rl,string:()=>Ts,stringFormat:()=>_c,stringbool:()=>xu,success:()=>Kl,superRefine:()=>_u,symbol:()=>Lc,templateLiteral:()=>ou,transform:()=>jl,tuple:()=>ml,uint32:()=>Oc,uint64:()=>Fc,ulid:()=>qs,undefined:()=>zc,union:()=>ol,unknown:()=>Gc,url:()=>Is,uuid:()=>js,uuidv4:()=>Ms,uuidv6:()=>Ns,uuidv7:()=>Ps,void:()=>Yc,xid:()=>Ys,xor:()=>cl}),xs=new WeakMap;function Ss(e,t,n){let r=Object.getPrototypeOf(e),i=xs.get(r);if(i||(i=new Set,xs.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})}})}}}var T=r(`ZodType`,(e,t)=>(y.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:lo(e,`input`),output:lo(e,`output`)}}),e.toJSONSchema=co(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>cs(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>us(e,t,n),e.parseAsync=async(t,n)=>ls(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ds(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>fs(e,t,n),e.decode=(t,n)=>ps(e,t,n),e.encodeAsync=async(t,n)=>ms(e,t,n),e.decodeAsync=async(t,n)=>hs(e,t,n),e.safeEncode=(t,n)=>gs(e,t,n),e.safeDecode=(t,n)=>_s(e,t,n),e.safeEncodeAsync=async(t,n)=>vs(e,t,n),e.safeDecodeAsync=async(t,n)=>ys(e,t,n),Ss(e,`ZodType`,{check(...e){let t=this.def;return this.clone(ne(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 pe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(gu(e,t))},superRefine(e,t){return this.check(_u(e,t))},overwrite(e){return this.check(Ua(e))},optional(){return Nl(this)},exactOptional(){return Fl(this)},nullable(){return Ll(this)},nullish(){return Nl(Ll(this))},nonoptional(e){return Wl(this,e)},array(){return $c(this)},or(e){return ol([this,e])},and(e){return fl(this,e)},transform(e){return Ql(this,jl(e))},default(e){return Bl(this,e)},prefault(e){return Hl(this,e)},catch(e){return Jl(this,e)},pipe(e){return Ql(this,e)},readonly(){return iu(this)},describe(e){let t=this.clone();return Di.add(t,{description:e}),t},meta(...e){if(e.length===0)return Di.get(this);let t=this.clone();return Di.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 Di.get(e)?.description},configurable:!0}),e)),Cs=r(`_ZodString`,(e,t)=>{In.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Ss(e,`_ZodString`,{regex(...e){return this.check(Fa(...e))},includes(...e){return this.check(Ra(...e))},startsWith(...e){return this.check(za(...e))},endsWith(...e){return this.check(Ba(...e))},min(...e){return this.check(Na(...e))},max(...e){return this.check(Ma(...e))},length(...e){return this.check(Pa(...e))},nonempty(...e){return this.check(Na(1,...e))},lowercase(e){return this.check(Ia(e))},uppercase(e){return this.check(La(e))},trim(){return this.check(Ga())},normalize(...e){return this.check(Wa(...e))},toLowerCase(){return this.check(Ka())},toUpperCase(){return this.check(qa())},slugify(){return this.check(Ja())}})}),ws=r(`ZodString`,(e,t)=>{In.init(e,t),Cs.init(e,t),e.email=t=>e.check(ki(Es,t)),e.url=t=>e.check(Fi(Fs,t)),e.jwt=t=>e.check(Zi(mc,t)),e.emoji=t=>e.check(Ii(Rs,t)),e.guid=t=>e.check(Ai(Os,t)),e.uuid=t=>e.check(ji(As,t)),e.uuidv4=t=>e.check(Mi(As,t)),e.uuidv6=t=>e.check(Ni(As,t)),e.uuidv7=t=>e.check(Pi(As,t)),e.nanoid=t=>e.check(Li(Bs,t)),e.guid=t=>e.check(Ai(Os,t)),e.cuid=t=>e.check(Ri(Hs,t)),e.cuid2=t=>e.check(zi(Ws,t)),e.ulid=t=>e.check(Bi(Ks,t)),e.base64=t=>e.check(Ji(cc,t)),e.base64url=t=>e.check(Yi(uc,t)),e.xid=t=>e.check(Vi(Js,t)),e.ksuid=t=>e.check(Hi(Xs,t)),e.ipv4=t=>e.check(Ui(Qs,t)),e.ipv6=t=>e.check(Wi(nc,t)),e.cidrv4=t=>e.check(Ki(ic,t)),e.cidrv6=t=>e.check(qi(oc,t)),e.e164=t=>e.check(Xi(fc,t)),e.datetime=t=>e.check(ts(t)),e.date=t=>e.check(rs(t)),e.time=t=>e.check(as(t)),e.duration=t=>e.check(ss(t))});function Ts(e){return Oi(ws,e)}var E=r(`ZodStringFormat`,(e,t)=>{b.init(e,t),Cs.init(e,t)}),Es=r(`ZodEmail`,(e,t)=>{zn.init(e,t),E.init(e,t)});function Ds(e){return ki(Es,e)}var Os=r(`ZodGUID`,(e,t)=>{Ln.init(e,t),E.init(e,t)});function ks(e){return Ai(Os,e)}var As=r(`ZodUUID`,(e,t)=>{Rn.init(e,t),E.init(e,t)});function js(e){return ji(As,e)}function Ms(e){return Mi(As,e)}function Ns(e){return Ni(As,e)}function Ps(e){return Pi(As,e)}var Fs=r(`ZodURL`,(e,t)=>{Bn.init(e,t),E.init(e,t)});function Is(e){return Fi(Fs,e)}function Ls(e){return Fi(Fs,{protocol:At,hostname:kt,...h(e)})}var Rs=r(`ZodEmoji`,(e,t)=>{Vn.init(e,t),E.init(e,t)});function zs(e){return Ii(Rs,e)}var Bs=r(`ZodNanoID`,(e,t)=>{Hn.init(e,t),E.init(e,t)});function Vs(e){return Li(Bs,e)}var Hs=r(`ZodCUID`,(e,t)=>{Un.init(e,t),E.init(e,t)});function Us(e){return Ri(Hs,e)}var Ws=r(`ZodCUID2`,(e,t)=>{Wn.init(e,t),E.init(e,t)});function Gs(e){return zi(Ws,e)}var Ks=r(`ZodULID`,(e,t)=>{Gn.init(e,t),E.init(e,t)});function qs(e){return Bi(Ks,e)}var Js=r(`ZodXID`,(e,t)=>{Kn.init(e,t),E.init(e,t)});function Ys(e){return Vi(Js,e)}var Xs=r(`ZodKSUID`,(e,t)=>{qn.init(e,t),E.init(e,t)});function Zs(e){return Hi(Xs,e)}var Qs=r(`ZodIPv4`,(e,t)=>{Qn.init(e,t),E.init(e,t)});function $s(e){return Ui(Qs,e)}var ec=r(`ZodMAC`,(e,t)=>{er.init(e,t),E.init(e,t)});function tc(e){return Gi(ec,e)}var nc=r(`ZodIPv6`,(e,t)=>{$n.init(e,t),E.init(e,t)});function rc(e){return Wi(nc,e)}var ic=r(`ZodCIDRv4`,(e,t)=>{tr.init(e,t),E.init(e,t)});function ac(e){return Ki(ic,e)}var oc=r(`ZodCIDRv6`,(e,t)=>{nr.init(e,t),E.init(e,t)});function sc(e){return qi(oc,e)}var cc=r(`ZodBase64`,(e,t)=>{ir.init(e,t),E.init(e,t)});function lc(e){return Ji(cc,e)}var uc=r(`ZodBase64URL`,(e,t)=>{or.init(e,t),E.init(e,t)});function dc(e){return Yi(uc,e)}var fc=r(`ZodE164`,(e,t)=>{sr.init(e,t),E.init(e,t)});function pc(e){return Xi(fc,e)}var mc=r(`ZodJWT`,(e,t)=>{lr.init(e,t),E.init(e,t)});function hc(e){return Zi(mc,e)}var gc=r(`ZodCustomStringFormat`,(e,t)=>{ur.init(e,t),E.init(e,t)});function _c(e,t,n={}){return io(gc,e,t,n)}function vc(e){return io(gc,`hostname`,Ot,e)}function yc(e){return io(gc,`hex`,Kt,e)}function bc(e,t){let n=`${e}_${t?.enc??`hex`}`,r=$e[n];if(!r)throw Error(`Unrecognized hash format: ${n}`);return io(gc,n,r,t)}var xc=r(`ZodNumber`,(e,t)=>{dr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),Ss(e,`ZodNumber`,{gt(e,t){return this.check(Ca(e,t))},gte(e,t){return this.check(x(e,t))},min(e,t){return this.check(x(e,t))},lt(e,t){return this.check(xa(e,t))},lte(e,t){return this.check(Sa(e,t))},max(e,t){return this.check(Sa(e,t))},int(e){return this.check(wc(e))},safe(e){return this.check(wc(e))},positive(e){return this.check(Ca(0,e))},nonnegative(e){return this.check(x(0,e))},negative(e){return this.check(xa(0,e))},nonpositive(e){return this.check(Sa(0,e))},multipleOf(e,t){return this.check(Oa(e,t))},step(e,t){return this.check(Oa(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 Sc(e){return na(xc,e)}var Cc=r(`ZodNumberFormat`,(e,t)=>{fr.init(e,t),xc.init(e,t)});function wc(e){return ra(Cc,e)}function Tc(e){return ia(Cc,e)}function Ec(e){return aa(Cc,e)}function Dc(e){return oa(Cc,e)}function Oc(e){return sa(Cc,e)}var kc=r(`ZodBoolean`,(e,t)=>{pr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r)});function Ac(e){return ca(kc,e)}var jc=r(`ZodBigInt`,(e,t)=>{mr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.gte=(t,n)=>e.check(x(t,n)),e.min=(t,n)=>e.check(x(t,n)),e.gt=(t,n)=>e.check(Ca(t,n)),e.gte=(t,n)=>e.check(x(t,n)),e.min=(t,n)=>e.check(x(t,n)),e.lt=(t,n)=>e.check(xa(t,n)),e.lte=(t,n)=>e.check(Sa(t,n)),e.max=(t,n)=>e.check(Sa(t,n)),e.positive=t=>e.check(Ca(BigInt(0),t)),e.negative=t=>e.check(xa(BigInt(0),t)),e.nonpositive=t=>e.check(Sa(BigInt(0),t)),e.nonnegative=t=>e.check(x(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(Oa(t,n));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function Mc(e){return la(jc,e)}var Nc=r(`ZodBigIntFormat`,(e,t)=>{hr.init(e,t),jc.init(e,t)});function Pc(e){return ua(Nc,e)}function Fc(e){return da(Nc,e)}var Ic=r(`ZodSymbol`,(e,t)=>{gr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r)});function Lc(e){return fa(Ic,e)}var Rc=r(`ZodUndefined`,(e,t)=>{_r.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(e,t,n,r)});function zc(e){return pa(Rc,e)}var Bc=r(`ZodNull`,(e,t)=>{vr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r)});function Vc(e){return ma(Bc,e)}var Hc=r(`ZodAny`,(e,t)=>{yr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Uc(){return ha(Hc)}var Wc=r(`ZodUnknown`,(e,t)=>{br.init(e,t),T.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Gc(){return ga(Wc)}var Kc=r(`ZodNever`,(e,t)=>{xr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r)});function qc(e){return _a(Kc,e)}var Jc=r(`ZodVoid`,(e,t)=>{Sr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r)});function Yc(e){return va(Jc,e)}var Xc=r(`ZodDate`,(e,t)=>{Cr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.min=(t,n)=>e.check(x(t,n)),e.max=(t,n)=>e.check(Sa(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function Zc(e){return ya(Xc,e)}var Qc=r(`ZodArray`,(e,t)=>{Tr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.element=t.element,Ss(e,`ZodArray`,{min(e,t){return this.check(Na(e,t))},nonempty(e){return this.check(Na(1,e))},max(e,t){return this.check(Ma(e,t))},length(e,t){return this.check(Pa(e,t))},unwrap(){return this.element}})});function $c(e,t){return Ya(Qc,e,t)}function el(e){let t=e._zod.def.shape;return wl(Object.keys(t))}var tl=r(`ZodObject`,(e,t)=>{Ar.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),p(e,`shape`,()=>t.shape),Ss(e,`ZodObject`,{keyof(){return wl(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Gc()})},loose(){return this.clone({...this._zod.def,catchall:Gc()})},strict(){return this.clone({...this._zod.def,catchall:qc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ye(this,e)},safeExtend(e){return be(this,e)},merge(e){return xe(this,e)},pick(e){return _e(this,e)},omit(e){return ve(this,e)},partial(...e){return Se(Ml,this,e[0])},required(...e){return Ce(Ul,this,e[0])}})});function nl(e,t){return new tl({type:`object`,shape:e??{},...h(t)})}function rl(e,t){return new tl({type:`object`,shape:e,catchall:qc(),...h(t)})}function il(e,t){return new tl({type:`object`,shape:e,catchall:Gc(),...h(t)})}var al=r(`ZodUnion`,(e,t)=>{Mr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.options=t.options});function ol(e,t){return new al({type:`union`,options:e,...h(t)})}var sl=r(`ZodXor`,(e,t)=>{al.init(e,t),Pr.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.options=t.options});function cl(e,t){return new sl({type:`union`,options:e,inclusive:!1,...h(t)})}var ll=r(`ZodDiscriminatedUnion`,(e,t)=>{al.init(e,t),Fr.init(e,t)});function ul(e,t,n){return new ll({type:`union`,options:t,discriminator:e,...h(n)})}var dl=r(`ZodIntersection`,(e,t)=>{Ir.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r)});function fl(e,t){return new dl({type:`intersection`,left:e,right:t})}var pl=r(`ZodTuple`,(e,t)=>{zr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function ml(e,t,n){let r=t instanceof y;return new pl({type:`tuple`,items:e,rest:r?t:null,...h(r?n:t)})}var hl=r(`ZodRecord`,(e,t)=>{Ur.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function gl(e,t,n){return!t||!t._zod?new hl({type:`record`,keyType:Ts(),valueType:e,...h(t)}):new hl({type:`record`,keyType:e,valueType:t,...h(n)})}function _l(e,t,n){let r=pe(e);return r._zod.values=void 0,new hl({type:`record`,keyType:r,valueType:t,...h(n)})}function vl(e,t,n){return new hl({type:`record`,keyType:e,valueType:t,mode:`loose`,...h(n)})}var yl=r(`ZodMap`,(e,t)=>{Wr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...t)=>e.check(Aa(...t)),e.nonempty=t=>e.check(Aa(1,t)),e.max=(...t)=>e.check(ka(...t)),e.size=(...t)=>e.check(ja(...t))});function bl(e,t,n){return new yl({type:`map`,keyType:e,valueType:t,...h(n)})}var xl=r(`ZodSet`,(e,t)=>{Kr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.min=(...t)=>e.check(Aa(...t)),e.nonempty=t=>e.check(Aa(1,t)),e.max=(...t)=>e.check(ka(...t)),e.size=(...t)=>e.check(ja(...t))});function Sl(e,t){return new xl({type:`set`,valueType:e,...h(t)})}var Cl=r(`ZodEnum`,(e,t)=>{Jr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(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 Cl({...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 Cl({...t,checks:[],...h(r),entries:i})}});function wl(e,t){return new Cl({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...h(t)})}function Tl(e,t){return new Cl({type:`enum`,entries:e,...h(t)})}var El=r(`ZodLiteral`,(e,t)=>{Yr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(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 Dl(e,t){return new El({type:`literal`,values:Array.isArray(e)?e:[e],...h(t)})}var Ol=r(`ZodFile`,(e,t)=>{Xr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.min=(t,n)=>e.check(Aa(t,n)),e.max=(t,n)=>e.check(ka(t,n)),e.mime=(t,n)=>e.check(Ha(Array.isArray(t)?t:[t],n))});function kl(e){return Xa(Ol,e)}var Al=r(`ZodTransform`,(e,t)=>{Zr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new a(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ke(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(ke(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function jl(e){return new Al({type:`transform`,transform:e})}var Ml=r(`ZodOptional`,(e,t)=>{$r.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nl(e){return new Ml({type:`optional`,innerType:e})}var Pl=r(`ZodExactOptional`,(e,t)=>{ei.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fl(e){return new Pl({type:`optional`,innerType:e})}var Il=r(`ZodNullable`,(e,t)=>{ti.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ll(e){return new Il({type:`nullable`,innerType:e})}function Rl(e){return Nl(Ll(e))}var zl=r(`ZodDefault`,(e,t)=>{ni.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Bl(e,t){return new zl({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():le(t)}})}var Vl=r(`ZodPrefault`,(e,t)=>{ii.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hl(e,t){return new Vl({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():le(t)}})}var Ul=r(`ZodNonOptional`,(e,t)=>{ai.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Wl(e,t){return new Ul({type:`nonoptional`,innerType:e,...h(t)})}var Gl=r(`ZodSuccess`,(e,t)=>{si.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kl(e){return new Gl({type:`success`,innerType:e})}var ql=r(`ZodCatch`,(e,t)=>{ci.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Jl(e,t){return new ql({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Yl=r(`ZodNaN`,(e,t)=>{li.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r)});function Xl(e){return ba(Yl,e)}var Zl=r(`ZodPipe`,(e,t)=>{ui.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.in=t.in,e.out=t.out});function Ql(e,t){return new Zl({type:`pipe`,in:e,out:t})}var $l=r(`ZodCodec`,(e,t)=>{Zl.init(e,t),fi.init(e,t)});function eu(e,t,n){return new $l({type:`pipe`,in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function tu(e){let t=e._zod.def;return new $l({type:`pipe`,in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var nu=r(`ZodPreprocess`,(e,t)=>{Zl.init(e,t),hi.init(e,t)}),ru=r(`ZodReadonly`,(e,t)=>{gi.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function iu(e){return new ru({type:`readonly`,innerType:e})}var au=r(`ZodTemplateLiteral`,(e,t)=>{vi.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r)});function ou(e,t){return new au({type:`template_literal`,parts:e,...h(t)})}var su=r(`ZodLazy`,(e,t)=>{xi.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function cu(e){return new su({type:`lazy`,getter:e})}var lu=r(`ZodPromise`,(e,t)=>{bi.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uu(e){return new lu({type:`promise`,innerType:e})}var du=r(`ZodFunction`,(e,t)=>{yi.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r)});function fu(e){return new du({type:`function`,input:Array.isArray(e?.input)?ml(e?.input):e?.input??$c(Gc()),output:e?.output??Gc()})}var pu=r(`ZodCustom`,(e,t)=>{Si.init(e,t),T.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r)});function mu(e){let t=new v({check:`custom`});return t._zod.check=e,t}function hu(e,t){return Za(pu,e??(()=>!0),t)}function gu(e,t={}){return Qa(pu,e,t)}function _u(e,t){return $a(e,t)}var vu=to,yu=no;function bu(e,t={}){let n=new pu({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...h(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}var xu=(...e)=>ro({Codec:$l,Boolean:kc,String:ws},...e);function Su(e){let t=cu(()=>ol([Ts(e),Sc(),Ac(),Vc(),$c(t),gl(Ts(),t)]));return t}function Cu(e,t){return new nu({type:`pipe`,in:jl(e),out:t})}var wu=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},Tu={pipe(){return wu(this,arguments)}},Eu=function(){function e(){}return e.prototype=Tu,e}(),D=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},O=e=>e,Du=e=>()=>e,Ou=Du(!0),ku=Du(!1),Au=Du(void 0),ju=Au;function Mu(e,t,n,r,i,a,o,s,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return a(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return o(a(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return s(o(a(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(s(o(a(i(r(n(t(e.apply(this,arguments)))))))))}}}function Nu(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i}}function Pu(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i!==n&&t.set(i,i),i}}var Fu=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(`stack`);let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let e=Reflect.ownKeys(r);for(let n=0;n<e.length;n++)t.add(e[n]);r=Object.getPrototypeOf(r)}return t.has(`constructor`)&&typeof e.constructor==`function`&&n===e.constructor.prototype&&t.delete(`constructor`),t},Iu=new WeakSet,Lu=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Ru=0,zu=()=>{Ru++};function Bu(e){return typeof e==`string`}function Vu(e){return typeof e==`number`}function Hu(e){return typeof e==`boolean`}function Uu(e){return typeof e==`bigint`}function Wu(e){return typeof e==`symbol`}function Gu(e){return Bu(e)||Vu(e)||Wu(e)}function Ku(e){return typeof e==`function`}function qu(e){return e===void 0}function Ju(e){return e!==void 0}function Yu(e){return e!=null}function Xu(e){return!1}function Zu(e){return!0}function Qu(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $u(e){return typeof e==`object`&&!!e||Ku(e)}var k=D(2,(e,t)=>$u(e)&&t in e);function ed(e){return k(e,Symbol.iterator)||Bu(e)}var A=`~effect/Hash`,j=e=>{switch(typeof e){case`number`:return ad(e);case`bigint`:return N(e.toString(10));case`string`:return N(e);case`function`:case`object`:if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?N(`Invalid Date`):N(e.toISOString());if(e instanceof RegExp)return N(e.toString());{if(Iu.has(e))return td(e);let t=md.get(e);if(t!==void 0)return t;if(hd.has(e))return zu(),N(`[Circular]`);hd.add(e);let n=Ru,r;try{r=`~effect/Hash`in e?e[A]():typeof e==`function`?td(e):e instanceof DataView?ld(Lu(e)):Array.isArray(e)||ArrayBuffer.isView(e)?ld(e):e instanceof Map?ud(e):e instanceof Set?fd(e):sd(e)}finally{hd.delete(e)}return n===Ru&&md.set(e,r),r}}return rd(nd(N(String(e))))},td=e=>(pd.has(e)||pd.set(e,rd(Math.random()*4294967296|0)),pd.get(e)),nd=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),M=D(2,(e,t)=>nd(Math.imul(e,2654435761)+Math.imul(t,2246822507))),rd=e=>e&3221225471|e>>>1&1073741824,id=new DataView(new ArrayBuffer(8)),ad=e=>{let t=e|0;return t===e?rd(t):(id.setFloat64(0,e===e?e:NaN),rd(M(id.getInt32(0),id.getInt32(4))))},N=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return rd(t)},od=(e,t)=>{let n=12289;for(let r of t)n^=M(j(r),j(e[r]));return rd(n)},sd=e=>od(e,Fu(e)),cd=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return rd(r)},ld=e=>{let t=6151;for(let n of e)t=M(t,j(n));return rd(t)},ud=cd(N(`Map`),([e,t])=>M(j(e),j(t))),dd=N(`Set`),fd=cd(dd,e=>M(dd,j(e))),pd=new WeakMap,md=new WeakMap,hd=new WeakSet,P=`~effect/Equal`;function F(){return arguments.length===1?e=>gd(e,arguments[0]):gd(arguments[0],arguments[1])}function gd(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n===typeof t?n===`number`&&e!==e&&t!==t?!0:n!==`object`&&n!==`function`||Iu.has(e)||Iu.has(t)?!1:_d(e,t):!1}function _d(e,t){let n=yd.length;for(let r=n;r-->0;)if(yd[r]===e&&bd[r]===t)return!0;if(n)return vd(e,t);let r=xd.get(e);r||xd.set(e,r=new WeakMap);let i=r.get(t);return i===void 0&&r.set(t,i=vd(e,t)),i}function vd(e,t){yd.push(e),bd.push(t);try{return Sd(e,t)}finally{yd.pop(),bd.pop()}}var yd=[],bd=[],xd=new WeakMap;function Sd(e,t){if(j(e)!==j(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),r=t.getTime();return n===r||Number.isNaN(n)&&Number.isNaN(r)}if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let n=Md(e);if(n!==Md(t)||typeof e==`function`&&!n)return!1;if(n)return e[P](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:Cd(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;return!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView?!1:n?wd(Lu(e),Lu(t)):wd(e,t)}return e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:Ed(e,t,Dd,Od):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:Ed(e,t,j,gd):Td(e,t)}function Cd(e,t){for(let n=0;n<e.length;n++)if(!gd(e[n],t[n]))return!1;return!0}function wd(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Td(e,t){let n=Fu(e),r=Fu(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!gd(e[i],t[i]))return!1;return!0}function Ed(e,t,n,r){let i=new Map,a=0;for(let e of t){let t=n(e),r=i.get(t);r?r.push(e):i.set(t,[e]),a++}outer:for(let t of e){let e=i.get(n(t));if(e){for(let n=0;n<e.length;n++)if(r(t,e[n])){e[n]=e[e.length-1],e.pop(),a--;continue outer}}return!1}return a===0}var Dd=e=>j(e[0]),Od=(e,t)=>gd(e[0],t[0])&&gd(e[1],t[1]),kd=()=>0;function Ad(e,t){return jd((n,r)=>e(n[0],r[0])&&t(n[1],r[1]))}function jd(e){return function(t,n){return Ed(t,n,kd,e)}}var Md=e=>k(e,P),Nd=e=>(t,n)=>t===n||e(t,n),Pd=(e,t)=>e===t,Fd=()=>Pd;function Id(e){return Nd((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e[r](t[r],n[r]))return!1;return!0})}function Ld(e){return Nd((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0})}var Rd=e=>e.length>0;function zd(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function Bd(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&zd(e,n,t[n])}var Vd=Symbol.for(`~effect/Redactable`),Hd=e=>k(e,Vd);function Ud(e){return Hd(e)?Wd(e):e}function Wd(e){return e[Vd](globalThis[`~effect/Fiber/currentFiber`]?.context??qd)}var Gd=`~effect/Fiber/currentFiber`,Kd=new Map,qd={"~effect/Context":{},base:Kd,depth:0,mapUnsafe:Kd,pipe(){return wu(this,arguments)}};function I(e,t){let n=t?.space??0,r=new WeakSet,i=n?typeof n==`number`?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,t=0){try{return l(e,t)}catch{return(typeof e==`object`&&e||typeof e==`function`)&&r.delete(e),`[inspection threw]`}}function l(e,n=0){if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||e==null||typeof e==`boolean`||typeof e==`symbol`)return String(e);if(typeof e==`bigint`)return String(e)+`n`;if(typeof e==`object`||typeof e==`function`){if(r.has(e))return Jd;r.add(e);let l;if(Vd in e)l=c(Wd(e),n);else if(Array.isArray(e))l=!i||e.length<=1?`[${e.map(e=>c(e,n)).join(`,`)}]`:`[\n${a(n+1)}${e.map(e=>c(e,n+1)).join(`,
66
- `+a(n+1))}\n${a(n)}]`;else if(e instanceof Date)l=Zd(e);else if(!t?.ignoreToString&&k(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=Qd(e);l=e instanceof Error&&e.cause!==void 0?`${t} (cause: ${c(e.cause,n)})`:t}else if(Symbol.iterator in e)l=`${e.constructor.name}(${c(Array.from(e),n)})`;else{let t=s(e);if(!i||t.length<=1){let r=`{${t.map(t=>`${Yd(t)}:${c($d(e,t),n)}`).join(`,`)}}`;l=o(e,r)}else{let r=`{\n${t.map(t=>`${a(n+1)}${Yd(t)}: ${c($d(e,t),n+1)}`).join(`,
67
- `)}\n${a(n)}}`;l=o(e,r)}}return r.delete(e),l}return String(e)}return c(e,0)}var Jd=`[Circular]`;function Yd(e){return typeof e==`string`?JSON.stringify(e):String(e)}function Xd(e){return e.map(e=>`[${Yd(e)}]`).join(``)}function Zd(e){try{return e.toISOString()}catch{return`Invalid Date`}}function Qd(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function $d(e,t){try{return e[t]}catch{return`[property access threw]`}}function ef(e,t){let n=[];return JSON.stringify(e,function(e,t){let r=Object.getOwnPropertyDescriptor(this,e)?.value,i=k(r,Vd)?Ud(r):Ud(t);if(typeof i==`bigint`)return I(i);if(typeof i!=`object`||!i)return i;let a=i instanceof Error&&!k(i,`toJSON`)?{...i,name:i.name,message:i.message}:i;for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(i))return;if(n.push(i),a!==i&&n.push(a),!tf(a)||nf(a))return a;let o=new Proxy(a,{get(e,t){let n=Reflect.get(e,t,e);return Object.getOwnPropertyDescriptor(e,t)?.get===void 0?n:Ud(n)}});return n.push(o),o},t?.space)??`null`}function tf(e){for(let t of Object.getOwnPropertyNames(e))if(Object.getOwnPropertyDescriptor(e,t)?.get!==void 0)return!0;return!1}function nf(e){for(let t of[Number.prototype.valueOf,Boolean.prototype.valueOf,String.prototype.valueOf])try{return Reflect.apply(t,e,[]),!0}catch{}return!1}var rf=Symbol.for(`nodejs.util.inspect.custom`),af=e=>{try{return e=Ud(e),k(e,`toJSON`)&&Ku(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(af):e}catch{return`[toJSON threw]`}},of=(e,t=2)=>{if(typeof e==`string`)return e;try{return typeof e==`object`?ef(e,{space:t}):I(e,{space:t})}catch{return String(e)}},sf={toJSON(){return af(this)},[rf](){return this.toJSON()},toString(){return I(this.toJSON())}},cf=(()=>{let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,`writable`)?e.writable===!0:e.set!==void 0})(),lf=()=>Error.stackTraceLimit,uf=e=>{cf&&(Error.stackTraceLimit=e)},df=class{constructor(e){this.value=e,this.done=!1}next(e){return this.done?(this.value=e,this):(this.done=!0,{value:this.value,done:!1})}},ff=(()=>{let e=`~effect/Utils/internal`,t={[e]:e=>e()},n={[e]:e=>{try{return e()}finally{}}};return lf()!==0&&t[e](()=>Error().stack)?.includes(e)===!0?t[e]:n[e]})(),pf=`~effect/Effect`,mf=`~effect/Exit`,hf={_A:O,_E:O,_R:O},gf=`${pf}/identifier`,L=`${pf}/args`,R=`${pf}/evaluate`,z=`${pf}/successCont`,B=`${pf}/failureCont`,_f=`${pf}/ensureCont`,vf=Symbol.for(`effect/Effect/Yield`),yf={pipe(){return wu(this,arguments)},toJSON(){return{...this}},toString(){return I(this.toJSON(),{ignoreToString:!0,space:2})},[rf](){return this.toJSON()}},bf={[pf]:hf,...yf,[Symbol.iterator](){return new df(this)},toJSON(){return{_id:`Effect`,op:this[gf],...L in this?{args:this[L]}:void 0}}},xf=e=>k(e,pf),Sf=e=>k(e,mf),Cf=`~effect/Cause`,wf=`~effect/Cause/Reason`,Tf=e=>k(e,Cf),Ef=class{constructor(e){this[Cf]=Cf,this.reasons=e}pipe(){return wu(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${I(this.reasons)})`}[rf](){return this.toJSON()}[P](e){return Tf(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>F(t,e.reasons[n]))}[A](){return ld(this.reasons)}},Df=new WeakMap,Of=class{[wf];annotations;_tag;constructor(e,t,n){if(this[wf]=wf,this._tag=e,t!==kf&&typeof n==`object`&&n&&t.size>0){let e=Df.get(n);e&&(t=new Map([...e,...t])),Df.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((e,r)=>{t?.overwrite!==!0&&n.has(r)||n.set(r,e)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return wu(this,arguments)}toString(){return I(this)}[rf](){return this.toString()}},kf=new Map,Af=class extends Of{constructor(e,t=kf){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${I(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[P](e){return zf(e)&&F(this.error,e.error)&&F(this.annotations,e.annotations)}[A](){return M(N(this._tag))(M(j(this.error))(j(this.annotations)))}},jf=e=>new Ef(e),Mf=(e,t)=>{let n=new Map,r=[];for(let i of e.concat(t)){let e=j(i),t=n.get(e);if(t===void 0)n.set(e,[i]);else if(t.some(e=>F(e,i)))continue;else t.push(i);r.push(i)}return r},Nf=D(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new Ef(Mf(e.reasons,t.reasons));return F(e,n)?e:n}),Pf=new Ef([]),Ff=e=>new Ef([new Af(e)]),If=class extends Of{constructor(e,t=kf){super(`Die`,t,e),this.defect=e}toString(){return`Die(${I(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[P](e){return Bf(e)&&F(this.defect,e.defect)&&F(this.annotations,e.annotations)}[A](){return M(N(this._tag))(M(j(this.defect))(j(this.annotations)))}},Lf=e=>new Ef([new If(e)]),Rf=D(e=>Tf(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new Ef(e.reasons.map(e=>e.annotate(t,n)))),zf=e=>e._tag===`Fail`,Bf=e=>e._tag===`Die`,Vf=e=>e._tag===`Interrupt`;function Hf(e){return Yf(`Effect.evaluate: Not implemented`)}var V=e=>({...bf,[gf]:e.op,[R]:e[R]??Hf,[z]:e[z],[B]:e[B],[_f]:e[_f]}),Uf=e=>{let t=V(e),n=function(e){this[L]=e};return n.prototype=t,function(e){return new n(e)}},Wf=e=>{let t={[mf]:mf,_tag:e.op,get[e.prop](){return this[L]},...V(e),toString(){return`${e.op}(${I(this[L])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[L]}},[P](e){return Sf(e)&&e._tag===this._tag&&F(this[L],e[L])},[A](){return M(N(e.op),j(this[L]))}},n=function(e){this[L]=e};return n.prototype=t,function(e){return new n(e)}},H=Wf({op:`Success`,prop:`value`,[R](e){let t=e.getCont(z);return t?t[z](this[L],e,this):e.yieldWith(this)}}),Gf={key:`effect/Cause/StackTrace`},Kf={key:`effect/Cause/InterruptorStackTrace`},qf=Wf({op:`Failure`,prop:`cause`,[R](e){let t=this[L],n=!1;e.cache.stackFrame&&(t=Rf(t,{mapUnsafe:new Map([[Gf.key,e.cache.stackFrame]])}),n=!0);let r=e.getCont(B),i=e._interruptedCause;if(i&&e.interruptible){let a=!1;for(;r&&e.interruptible;)a||=gf in r,r=e.getCont(B);a&&(t=jf(t.reasons.filter(e=>e._tag!==`Fail`))),t=Nf(t,i),n=!0}return r?r[B](t,e,n?void 0:this):e.yieldWith(n?qf(t):this)}}),Jf=e=>qf(Ff(e)),Yf=e=>qf(Lf(e)),U=Uf({op:`WithFiber`,[R](e){return this[L](e)}}),Xf=function(){class e extends globalThis.Error{}let t=V({op:`YieldableError`,[R](){return Jf(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),Zf=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends Xf{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(Bd(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),Qf=e=>{class t extends Zf{_tag=e}return t.prototype.name=e,t};Qf(`NoSuchElementError`);var $f=`~effect/Cause/Done`,ep=e=>k(e,$f),tp={[$f]:$f,_tag:`Done`,value:void 0},np=e=>e===void 0?tp:{[$f]:$f,_tag:`Done`,value:e},rp=Jf(tp),ip=e=>e===void 0?rp:Jf(np(e)),ap=`~effect/Option`,op={[ap]:{_A:e=>e},...yf,[Symbol.iterator](){return new df(this)}},sp=Object.defineProperty(Object.assign(Object.create(op),{_tag:`Some`,_op:`Some`,[P](e){return up(e)&&fp(e)&&F(this.value,e.value)},[A](){return M(j(this._tag))(j(this.value))},toString(){return`some(${I(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:af(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),cp=j(`None`),lp=Object.assign(Object.create(op),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[P](e){return up(e)&&dp(e)},[A](){return cp},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),up=e=>k(e,ap),dp=e=>e._tag===`None`,fp=e=>e._tag===`Some`,pp=Object.create(lp),mp=function(e){this.value=e};mp.prototype=sp;var hp=e=>new mp(e),gp=`~effect/Result`,_p={[gp]:{_A:e=>e,_E:e=>e},...yf,[Symbol.iterator](){return new df(this)}},vp=Object.assign(Object.create(_p),{_tag:`Success`,_op:`Success`,[P](e){return bp(e)&&Sp(e)&&F(this.success,e.success)},[A](){return M(j(this._tag))(j(this.success))},toString(){return`success(${I(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:af(this.success)}}}),yp=Object.assign(Object.create(_p),{_tag:`Failure`,_op:`Failure`,[P](e){return bp(e)&&xp(e)&&F(this.failure,e.failure)},[A](){return M(j(this._tag))(j(this.failure))},toString(){return`failure(${I(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:af(this.failure)}}}),bp=e=>k(e,gp),xp=e=>e._tag===`Failure`,Sp=e=>e._tag===`Success`,Cp=function(e){this.failure=e};Cp.prototype=yp;var wp=e=>new Cp(e),Tp=function(e){this.success=e};Tp.prototype=vp;var Ep=e=>new Tp(e),Dp=e=>xp(e)?pp:hp(e.success);function Op(e){return(t,n)=>t===n?0:e(t,n)}var kp=Op((e,t)=>e<t?-1:1),Ap=Op((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),jp=Op((e,t)=>e<t?-1:1),Mp=D(2,(e,t)=>Op((n,r)=>e(t(n),t(r)))),Np=Mp(Ap,e=>e.getTime()),Pp=e=>D(2,(t,n)=>e(t,n)===-1),Fp=e=>D(2,(t,n)=>e(t,n)===1),Ip=e=>D(2,(t,n)=>e(t,n)!==1),Lp=e=>D(2,(t,n)=>e(t,n)!==-1),Rp=()=>pp,zp=hp,Bp=up,Vp=dp,Hp=fp,Up=D(2,(e,{onNone:t,onSome:n})=>Vp(e)?t():n(e.value)),Wp=D(2,(e,t)=>Vp(e)?t():e.value),Gp=D(2,(e,t)=>Vp(e)?t():e),Kp=e=>e==null?Rp():zp(e),qp=Wp(Au),Jp=e=>(...t)=>{try{return zp(e(...t))}catch{return Rp()}},Yp=D(2,(e,t)=>Vp(e)?Rp():zp(t(e.value))),Xp=D(2,(e,t)=>Vp(e)?Rp():t(e.value))(O),Zp=e=>Vp(e)?[]:[e.value],Qp=D(2,(e,t)=>Vp(e)?Rp():t(e.value)?zp(e.value):Rp()),$p=Ep,em=wp,tm=xp,nm=Sp,rm=Dp,im=D(2,(e,t)=>tm(e)?em(t(e.failure)):e),am=D(2,(e,t)=>nm(e)?$p(t(e.success)):e),om=D(2,(e,{onFailure:t,onSuccess:n})=>tm(e)?t(e.failure):n(e.success)),sm=D(2,(e,t)=>{if(nm(e))return e.success;throw t(e.failure)})(O),cm=globalThis.Array,lm=e=>cm.isArray(e)?e:cm.from(e),um=D(2,(e,t)=>[...e,t]);cm.isArray;var dm=Rd,fm=Rd,pm=()=>[],mm=e=>[e],hm=D(2,(e,t)=>e.map(t)),gm=Ld,_m=e=>V({op:e.label,[R]:e.evaluate}),vm=`~effect/Context/Service`,ym=function(){function e(){}let t=e;Object.setPrototypeOf(t,bm);let n=(e,n)=>(t.key=e,n?.defaultValue&&(t[Sm]=Sm,t.defaultValue=n.defaultValue),n?.make&&(t.make=n.make),n?.fiberCached&&xm.add(e),t);return arguments.length>0?n(arguments[0],arguments[1]):n},bm={[vm]:vm,..._m({label:`Service`,evaluate(e){return H(W(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key}},of(e){return e},context(e){return zm(this,e)},use(e){return U(t=>e(W(t.context,this)))},useSync(e){return U(t=>H(e(W(t.context,this))))}},xm=new Set,Sm=`~effect/Context/Reference`,Cm=`~effect/Context`,wm=8,Tm=8,Em=(e,t,n,r)=>{let i=Object.create(Nm);return i.cacheRoot=e??i,i.base=t,i.overlay=n,i.depth=r,i._flat=void 0,i.baseHits=0,i},Dm=(e,t)=>{t&&(Dm(e,t.parent),e.set(t.key,t.value))},Om=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return Dm(t,e.overlay),e._flat=t},km=(e,t)=>{let n=new Map(e.mapUnsafe);return t(n),Mm(n)},Am=Symbol(),jm=(e,t)=>{let n=e;for(let e=n.overlay;e;e=e.parent)if(e.key===t)return e.value;let r=n.base.get(t);return r===void 0&&!n.base.has(t)?Am:(n.overlay&&++n.baseHits>=n.base.size&&n.baseHits>=Tm&&(n.base=Om(n),n.overlay=void 0,n.depth=0),r)},Mm=e=>Em(void 0,e,void 0,0),Nm={get mapUnsafe(){return Om(this)},...yf,[Cm]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[P](e){if(!Fm(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[e,r]of t)if(!n.has(e)||!F(r,n.get(e)))return!1;return!0},[A](){return ad(this.mapUnsafe.size)}},Pm=(e,t)=>e.cacheRoot===t.cacheRoot,Fm=e=>k(e,Cm),Im=e=>!!e[Sm],Lm=()=>Rm,Rm=Mm(new Map),zm=(e,t)=>Mm(new Map([[e.key,t]])),Bm=D(3,(e,t,n)=>Vm(e,t.key,n)),Vm=(e,t,n)=>{let r=e,i=xm.has(t)?void 0:r.cacheRoot;if(r.depth>=wm){let e=new Map(r.mapUnsafe);return e.set(t,n),Em(i,e,void 0,0)}return Em(i,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)},Hm=(e,t)=>{let n=jm(e,t);return n===Am?void 0:n},Um=D(2,(e,t)=>{let n=jm(e,t.key);if(n===Am){if(Im(t))return Gm(t);throw Km(t)}return n}),W=Um,Wm=`~effect/Context/defaultValue`,Gm=e=>Wm in e?e[Wm]:e[Wm]=e.defaultValue(),Km=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(t.stack){let e=t.stack.split(`
68
- `);e.splice(1,3),t.stack=e.join(`
69
- `)}return t},qm=D(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:km(e,e=>t.mapUnsafe.forEach((t,n)=>e.set(n,t)))),G=ym,Jm=`~effect/Duration`,Ym=BigInt(0),Xm=BigInt(1),Zm=BigInt(2),Qm=BigInt(10),$m=BigInt(1e3),eh=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),th=e=>eh(e*1e6),nh=(e,t)=>{let n=e.indexOf(`.`);if(n===-1)return BigInt(e)*t;let r=e[0]===`-`,i=e.slice(n+1),a=Qm**BigInt(i.length),o=(BigInt(e.slice(+!!r,n))*a+BigInt(i))*t,s=o/a+(o%a*Zm>=a?Xm:Ym);return r?-s:s},rh=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,ih=e=>{switch(typeof e){case`number`:return gh(e);case`bigint`:return hh(e);case`string`:{if(e===`Infinity`)return ph;if(e===`-Infinity`)return mh;let t=rh.exec(e);if(!t)break;let[n,r,i]=t;if(i===`nano`||i===`nanos`)return hh(nh(r,Xm));if(i===`micro`||i===`micros`)return hh(nh(r,$m));let a=Number(r);switch(i){case`milli`:case`millis`:return gh(a);case`second`:case`seconds`:return _h(a);case`minute`:case`minutes`:return vh(a);case`hour`:case`hours`:return yh(a);case`day`:case`days`:return bh(a);case`week`:case`weeks`:return xh(a)}break}case`object`:{if(e===null)break;if(Jm in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(Vu)?ah(e):Number.isNaN(e[0])||Number.isNaN(e[1])?fh:e[0]===-1/0||e[1]===-1/0?mh:e[0]===1/0||e[1]===1/0?ph:K(eh(e[0]*1e9+e[1]));let t=e,n=0;return t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds?K(n):K(eh(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return ah(e)},ah=e=>{throw Error(`Invalid Input: ${e}`)},oh={_tag:`Millis`,millis:0},sh={_tag:`Infinity`},ch={_tag:`NegativeInfinity`},lh={[Jm]:Jm,[A](){switch(this.value._tag){case`Millis`:{let e=this.value.millis*1e6;return Number.isFinite(e)?j(eh(e)):ad(this.value.millis)}case`Nanos`:return j(this.value.nanos);default:return sd(this.value)}},[P](e){return uh(e)&&Oh(this,e)},toString(){switch(this.value._tag){case`Infinity`:return`Infinity`;case`NegativeInfinity`:return`-Infinity`;case`Nanos`:return`${this.value.nanos} nanos`;case`Millis`:return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case`Millis`:return{_id:`Duration`,_tag:`Millis`,millis:this.value.millis};case`Nanos`:return{_id:`Duration`,_tag:`Nanos`,nanos:String(this.value.nanos)};case`Infinity`:return{_id:`Duration`,_tag:`Infinity`};case`NegativeInfinity`:return{_id:`Duration`,_tag:`NegativeInfinity`}}},[rf](){return this.toJSON()},pipe(){return wu(this,arguments)}},K=e=>{let t=Object.create(lh);return t.value=typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?oh:Number.isFinite(e)?Number.isInteger(e)?{_tag:`Millis`,millis:e}:{_tag:`Nanos`,nanos:th(e)}:e>0?sh:ch:e===Ym?oh:{_tag:`Nanos`,nanos:e},t},uh=e=>k(e,Jm),dh=e=>e.value._tag!==`Infinity`&&e.value._tag!==`NegativeInfinity`,fh=K(0),ph=K(1/0),mh=K(-1/0),hh=e=>K(e),gh=e=>K(e),_h=e=>K(e*1e3),vh=e=>K(e*6e4),yh=e=>K(e*36e5),bh=e=>K(e*864e5),xh=e=>K(e*6048e5),Sh=e=>Th(ih(e),{onMillis:O,onNanos:e=>Number(e)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Ch=e=>Th(ih(e),{onMillis:e=>e/1e3,onNanos:e=>Number(e)/1e9,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),wh=e=>{let t=ih(e);switch(t.value._tag){case`Infinity`:case`NegativeInfinity`:throw Error(`Cannot convert infinite duration to nanos`);case`Nanos`:return t.value.nanos;case`Millis`:return th(t.value.millis)}},Th=D(2,(e,t)=>{switch(e.value._tag){case`Millis`:return t.onMillis(e.value.millis);case`Nanos`:return t.onNanos(e.value.nanos);case`Infinity`:return t.onInfinity();case`NegativeInfinity`:return(t.onNegativeInfinity??t.onInfinity)()}}),Eh=D(3,(e,t,n)=>e.value._tag===`Infinity`||e.value._tag===`NegativeInfinity`||t.value._tag===`Infinity`||t.value._tag===`NegativeInfinity`?n.onInfinity(e,t):e.value._tag===`Millis`?t.value._tag===`Millis`?n.onMillis(e.value.millis,t.value.millis):n.onNanos(wh(e),t.value.nanos):n.onNanos(e.value.nanos,wh(t))),Dh=(e,t)=>Eh(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t,onInfinity:(e,t)=>e.value._tag===t.value._tag}),Oh=D(2,(e,t)=>Dh(e,t)),kh=e=>t=>{let n=e(t);return tm(n)?Rp():zp(n.success)},Ah=G(`effect/Scheduler`,{fiberCached:!0,defaultValue:()=>new Fh}),jh=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},Mh=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},Nh=e=>{try{return Mh(e)}catch{return jh(e)}},Ph=class{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,i,a=0;for(;a<r&&!(n[a][0]>t);a++)i=n[a];i&&i[0]===t?i[1].push(e):a===r?n.push([t,[e]]):n.splice(a,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}},Fh=class{executionMode;setImmediate;constructor(e=`async`,t){this.executionMode=e,this.setImmediate=t??(e===`sync`?jh:Nh)}shouldYield(e){return e.currentOpCount>=e.cache.maxOpsBeforeYield}makeDispatcher(){return new Ih(this.setImmediate)}},Ih=class{tasks=new Ph;running=void 0;setImmediate;constructor(e=Nh){this.setImmediate=e}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let e=0;e<n.length;e++)n[e]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},Lh=G(`effect/Scheduler/MaxOpsBeforeYield`,{fiberCached:!0,defaultValue:()=>2048}),Rh=G(`effect/Scheduler/PreventSchedulerYield`,{fiberCached:!0,defaultValue:()=>!1}),zh=`effect/Tracer/ParentSpan`;ym()(zh,{fiberCached:!0});var Bh=`effect/Tracer`,Vh=`effect/Metric/FiberRuntimeMetrics`,Hh=G(`effect/References/CurrentStackFrame`,{fiberCached:!0,defaultValue:Au}),Uh=G(`effect/References/TracerEnabled`,{fiberCached:!0,defaultValue:Ou}),Wh=G(`effect/References/CurrentLogAnnotations`,{defaultValue:()=>({})}),Gh=G(`effect/References/CurrentLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),Kh=G(`effect/References/MinimumLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),qh=G(`effect/References/CurrentLogSpans`,{defaultValue:()=>[]}),Jh=class extends Of{constructor(e,t=kf){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[P](e){return Vf(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[A](){return M(N(`${this._tag}:${this.fiberId}`))(td(this.annotations))}},Yh=e=>new Ef([new Jh(e)]),Xh=e=>{let t=e.reasons.find(zf);return t?$p(t):em(e)},Zh=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return $p(n.error)}return em(e)},Qh=kh(Zh),$h=e=>{let t=e.reasons.find(Bf);return t?$p(t.defect):em(e)},eg=e=>e.reasons.some(Vf),tg=e=>{let t;for(let n=0;n<e.reasons.length;n++){let r=e.reasons[n];r._tag===`Interrupt`&&(t??=new Set,r.fiberId!==void 0&&t.add(r.fiberId))}return t?$p(t):em(e)},ng=e=>e.reasons.length>0&&e.reasons.every(Vf),rg=D(2,(e,t)=>{let n=!1,r=e.reasons.map(e=>zf(e)?(n=!0,new Af(t(e.error),e.annotations)):e);return n?jf(r):e}),ig=e=>{let t;for(let n of e.reasons){if(n._tag===`Fail`)return n.error;n._tag===`Die`&&(t??=n)}return t===void 0?e.reasons.length>0?new globalThis.Error(`All fibers interrupted without error`):new globalThis.Error(`Empty cause`):t.defect},ag=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let i=lf();i!==0&&uf(1);try{for(let i of e.reasons){if(i._tag===`Interrupt`){r.push(i);continue}n.push(og(i._tag===`Die`?i.defect:i.error,i.annotations,t))}if(n.length===0){let e=Error(`The fiber was interrupted by:`);e.name=`InterruptCause`,e.stack=dg(e,r);let i=new globalThis.Error(`All fibers interrupted without error`,{cause:e});i.name=`InterruptError`,i.stack=`${i.name}: ${i.message}`,n.push(og(i,r[0].annotations,t))}}finally{i!==0&&uf(i)}return n},og=(e,t,n)=>{let r=typeof e,i;if(e&&r===`object`){if(i=new globalThis.Error(sg(e),{cause:e.cause?og(e.cause):void 0}),typeof e.name==`string`&&(i.name=e.name),typeof e.stack==`string`)i.stack=lg(e.stack,i,t);else{let e=`${i.name}: ${i.message}`;i.stack=t?ug(e,t):e}n?.includeCauseInStack&&(i.stack=mg(i));for(let t of Object.keys(e))t in i||(i[t]=e[t])}else{i=new globalThis.Error(e?r===`string`?e:ef(e):`Unknown error: ${e}`);let n=`${i.name}: ${i.message}`;i.stack=t?ug(n,t):n}return i},sg=e=>{if(typeof e.message==`string`)return e.message;if(typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return ef(e)},cg=/\((.*)\)/g,lg=(e,t,n)=>{let r=`${t.name}: ${t.message}`,i=(e.startsWith(r)?e.slice(r.length):e).split(`
70
- `),a=[r];for(let e=1;e<i.length&&!/Generator\.next|~effect\/(?:Effect|Utils)/.test(i[e]);e++)a.push(i[e]);return n?ug(a.join(`
71
- `),n):a.join(`
72
- `)},ug=(e,t)=>{let n=t?.get(Gf.key);return n&&(e=`${e}\n${fg(n)}`),e},dg=(e,t)=>{let n=[`${e.name}: ${e.message}`];for(let e of t){let t=e.fiberId===void 0?`unknown`:`#${e.fiberId}`,r=e.annotations.get(Kf.key);n.push(` at fiber (${t})`),r&&n.push(fg(r))}return n.join(`
73
- `)},fg=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(cg),i=!1;for(let[,e]of r)i=!0,t.push(` at ${n.name} (${e})`);i||t.push(` at ${n.name} (${e.replace(/^at /,``)})`)}else t.push(` at ${n.name}`);n=n.parent,r++}return t.join(`
74
- `)},pg=e=>ag(e).map(mg).join(`
75
- `),mg=e=>e.cause?`${e.stack} {\n${hg(e.cause,` `)}\n}`:e.stack,hg=(e,t)=>{let n=e.stack.split(`
76
- `),r=`${t}[cause]: ${n[0]}`;for(let e=1,i=n.length;e<i;e++)r+=`\n${t}${n[e]}`;return e.cause&&(r+=` {\n${hg(e.cause,`${t} `)}\n${t}}`),r},gg=`~effect/Fiber`,_g={_A:O,_E:O},vg={id:0},yg=(()=>{try{return globalThis.process?.getBuiltinModule?.(`node:async_hooks`)?.AsyncResource}catch{return}})(),bg=()=>yg===void 0?void 0:new yg(`effect/Fiber`),xg=()=>globalThis[Gd],Sg=class{constructor(e,t=!0){this.setContext(e),this.id=++vg.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=void 0,this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this._parent=void 0,this._asyncContext=void 0,this.cache.runtimeMetrics?.recordFiberStart(this.context)}get[gg](){return _g}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(e){return W(this.context,e)}addObserver(e){return this._exit?(e(this._exit),ju):(this._observers===void 0?this._observers=[e]:this._observers.push(e),()=>this.removeObserver(e))}removeObserver(e){if(this._exit||this._observers===void 0)return;let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)}interruptUnsafe(e,t){if(this._exit)return;let n=Yh(e);this.cache.stackFrame&&(n=Rf(n,zm(Gf,this.cache.stackFrame))),t&&(n=Rf(n,t)),this._interruptedCause=this._interruptedCause?Nf(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(J(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;if(this._asyncContext!==void 0){let t=this._asyncContext;return this._asyncContext=void 0,t.runInAsyncScope(this.evaluate,this,e)}if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===vf){this._asyncContext=bg();return}let n=Eg.interruptChildren&&Eg.interruptChildren(this);if(n!==void 0)return this.evaluate(Q(n,()=>t));if(this._exit=t,this.cache.runtimeMetrics?.recordFiberEnd(this.context,this._exit),this._parent&&=(this._parent._children?.delete(this),void 0),this._observers!==void 0){let e=this._observers;this._observers=void 0;for(let n=0;n<e.length;n++)e[n](t)}this._stack.length=0,this._children=void 0,this.context=Lm()}runLoop(e){let t=globalThis[Gd];globalThis[Gd]=this;let n=this._running;this._running=!0;let r=!1,i=e;this.currentOpCount=0;try{for(;;)try{this._deferredInterrupt&&(this._deferredInterrupt=!1,i=J(this._interruptedCause)),this.currentOpCount++;let e=this.cache;if(!r&&!e.preventYield&&e.scheduler.shouldYield(this)){r=!0;let e=i;i=Q(Lg,()=>e)}if(i=e.tracerContext?e.tracerContext(i,this):i[R](this),i===vf){let e=this._yielded;if(mf in e)return this._deferredInterrupt=!1,this._yielded=void 0,e;if(this._deferredInterrupt){this._yielded=void 0,e();continue}return vf}}catch(e){if(!k(i,R))return Yf(`Fiber.runLoop: Not a valid effect: ${String(i)}`);i=Yf(e)}}finally{this._running=n,globalThis[Gd]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,wg;for(;;){let t=this._stack.pop();if(!t)return;let n=t[_f];if(n!==void 0){let r=n.call(t,this);if(r)return r[e]=r,r}if(t[e])return t}}succeedWith(e){if(!(++this.currentOpCount&Tg-1))return H(e);let t=this.getCont(z);return t?t[z](e,this):this.yieldWith(H(e))}yieldWith(e){return this._yielded=e,vf}children(){return this._children??=new Set}pipe(){return wu(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&Pm(t,e))return;let n=e.cacheRoot,r=n._fiberCache??=Cg(e);this.cache?.scheduler!==r.scheduler&&(this._dispatcher=void 0),this.cache=r}get currentSpanLocal(){let e=this.cache.span;return e?._tag===`Span`?e:void 0}},Cg=e=>{let t=Hm(e,Bh);return{scheduler:W(e,Ah),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:W(e,Uh),span:Hm(e,zh),logLevel:W(e,Gh),minimumLogLevel:W(e,Kh),stackFrame:W(e,Hh),runtimeMetrics:Hm(e,Vh),maxOpsBeforeYield:W(e,Lh),preventYield:W(e,Rh)}},wg={[z](e,t){return J(t._interruptedCause)},[B](e,t){return J(t._interruptedCause)}},Tg=32,Eg={interruptChildren:void 0},Dg=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(Kf.key,e.cache.stackFrame),Mm(t)},Og=e=>{if(e._children!==void 0&&e._children.size!==0)return Pg(e._children)},kg=e=>{let t=e;return t._exit?q(t._exit):Jg(n=>t._exit?n(q(t._exit)):Y(e.addObserver(e=>n(q(e)))))},Ag=e=>Jg(t=>{let n=e[Symbol.iterator](),r=[],i;function a(){let e=n.next();for(;!e.done;){if(e.value._exit){r.push(e.value._exit),e=n.next();continue}i=e.value.addObserver(e=>{r.push(e),a()});return}t(q(r))}return a(),Y(()=>i?.())}),jg=e=>{let t=e;return t._exit?t._exit:Jg(n=>t._exit?n(t._exit):Y(e.addObserver(n)))},Mg=e=>U(t=>Ng(e,t.id)),Ng=D(e=>k(e[0],gg),(e,t,n)=>U(r=>{let i=Dg(r);return i=i&&n?qm(i,n):i??n,e.interruptUnsafe(t,i),g_(kg(e))})),Pg=e=>U(t=>{let n=Dg(t),r=pm();for(let i of e)i.interruptUnsafe(t.id,n),r.push(i);return g_(Ag(r))}),q=H,J=qf,Fg=Jf,Y=Uf({op:`Sync`,[R](e){let t=this[L](),n=e.getCont(z);return n?n[z](t,e):e.yieldWith(H(t))}}),X=Uf({op:`Suspend`,[R](e){return this[L]()}}),Ig=om({onFailure:Fg,onSuccess:q}),Lg=Uf({op:`Yield`,[R](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(k_)},this[L]??0),e.yieldWith(()=>{t=!0})}})(0),Rg=q(Rp()),zg=e=>X(()=>J(e())),Bg=e=>Yf(e),Vg=e=>X(()=>Fg(e())),Z=q(void 0),Hg=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new Uy(e,`An error occurred in Effect.try`):e.catch;return X(()=>{try{return q(t())}catch(e){return Fg(n(e))}})},Ug=e=>Kg(function(t,n){e(n).then(e=>t(q(e)),e=>t(Bg(e)))},e.length!==0),Wg=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new Uy(e,`An error occurred in Effect.tryPromise`):e.catch;return Kg(function(e,r){let i=e=>X(()=>{try{return Fg(ff(()=>n(e)))}catch(e){return Bg(e)}});try{t(r).then(t=>e(q(t)),t=>e(i(t)))}catch(t){e(i(t))}},t.length!==0)},Gg=e=>U(t=>e(t.id)),Kg=function(){let e=V({op:`Async`,[R](e){let t=!1,n=!1,r=this.withSignal?new AbortController:void 0,i=this.register.call(e.cache.scheduler,r=>{t||(t=!0,n?e.evaluate(r):n=r)},r?.signal);return n===!1?(n=!0,e._yielded=()=>{t=!0},r===void 0&&i===void 0||e._stack.push(qg(()=>(t=!0,r?.abort(),i??k_))),vf):n}}),t=function(e,t){this.register=e,this.withSignal=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),qg=Uf({op:`AsyncFinalizer`,[_f](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Yv))},[B](e,t){return eg(e)?Q(yv(qf(e),this[L]()),()=>J(e)):J(e)}}),Jg=e=>Kg(e,e.length>=2),Yg=Jg(ju),Xg=(...e)=>{if(e.length===1){let t=e[0];return X(()=>t_(t()))}let[t,n]=e;return X(()=>t_(n.call(t.self)))},Zg=(e,...t)=>{let n=t.length===0?function(){return X(()=>t_(e.apply(this,arguments)))}:function(){let n=X(()=>t_(e.apply(this,arguments)));for(let e=0;e<t.length;e++)n=t[e](n,...arguments);return n};return Qg(e.length,n)},Qg=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),$g=(e,...t)=>Qg(e.length,t.length===0?function(){return e_(()=>e.apply(this,arguments))}:function(){let n=e_(()=>e.apply(this,arguments));for(let e of t)n=e(n,...arguments);return n}),e_=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return q(r.value);let i=r.value;if(i&&i._tag===`Success`){n=i.value;continue}if(i&&i._tag===`Failure`)return r.value;{let n=!0;return X(()=>n?(n=!1,Q(r.value,e=>t_(t,e))):X(()=>t_(e())))}}}catch(e){return Bg(e)}},t_=function(){let e=V({op:`Iterator`,[z](e,t){let n=this.iterator;for(;;){let r=n.next(e);if(r.done)return q(r.value);if(!$(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[R](e){return this[z](this.initial,e)}}),t=function(e,t){this.iterator=e,this.initial=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),n_=D(2,(e,t)=>new a_(e,o_,q(t))),r_=function(e){return e._stack.push(this),this[L]},i_=V({op:`OnSuccess`,[R]:r_}),a_=function(e,t,n){this[L]=e,this[z]=t,this.payload=n};a_.prototype=i_;var o_=function(){return this.payload},s_=function(e,t){return t.succeedWith(this.payload)},c_=(()=>{let e=`~effect/Effect/stackProbe`;return{[e]:function(){return Error().stack}}[e]()?.includes(`[as `+e+`]`)===!0})(),l_=function(e,t){let n=this.payload;return t.succeedWith(c_?n(e):ff(()=>n(e)))},u_=function(e){let t=this.payload;return t(e)},d_=function(e){let t=this.payload;return new a_(t(e),s_,e)},f_=function(e){return new a_(this.payload,s_,e)},p_=e=>S_(e,zp),m_=D(2,(e,t)=>new a_(e,xf(t)?o_:u_,t)),h_=D(2,(e,t)=>new a_(e,xf(t)?f_:d_,t)),g_=e=>new a_(e,o_,k_),__=(e,t)=>U(n=>{let r=new Set;return zv(n,()=>r.size===0?void 0:Pg(r)),Jg(i=>{let a=!1,o=0;for(let s of e){if(a)break;let e=o++,c=dy(n,s,!0,!0,!1);r.add(c),c.addObserver(o=>{r.delete(c);let s=!a;a=!0,i(o),s&&t?.onWinner&&t.onWinner({fiber:c,index:e,parentFiber:n})})}})}),v_=D(e=>xf(e[1]),(e,t,n)=>__([e,t],n)),Q=D(2,(e,t)=>new a_(e,u_,t)),y_=D(2,(e,t)=>$(e)?e._tag===`Success`?t.onSuccess(e.value):t.onFailure(e.cause):tv(e,t)),$=e=>e[mf]!==void 0,b_=D(2,(e,t)=>$(e)?e._tag===`Success`?t(e.value):e:Q(e,t)),x_=e=>Q(e,O),S_=D(2,(e,t)=>new a_(e,l_,t)),C_=D(2,(e,t)=>$(e)?A_(e,t):S_(e,t)),w_=D(2,(e,t)=>$(e)?j_(e,t):Z_(e,t)),T_=e=>qf(Yh(e)),E_=e=>e._tag===`Success`,D_=e=>e._tag===`Failure`,O_=e=>e._tag===`Failure`?$p(e.cause):em(e),k_=H(void 0),A_=D(2,(e,t)=>e._tag===`Success`?H(t(e.value)):e),j_=D(2,(e,t)=>{if(e._tag===`Success`)return e;let n=Zh(e.cause);return tm(n)?e:Jf(t(n.success))}),M_=D(2,(e,t)=>E_(e)?t:e),N_=D(2,(e,t)=>E_(e)?t.onSuccess(e.value):t.onFailure(e.cause)),P_=e=>{let t=[];for(let n of e)n._tag===`Failure`&&t.push(...n.cause.reasons);return t.length===0?k_:qf(jf(t))},F_=D(2,(e,t)=>U(n=>{let r=n.context,i=t(r);return r===i?e:(n.setContext(i),zv(n,()=>{n.setContext(r)}),e)})),I_=D(3,(e,t,n)=>F_(e,e=>{let r=Um(e,t),i=n(r);return r===i?e:Bm(e,t,i)})),L_=()=>R_,R_=U(e=>q(e.context)),z_=e=>U(t=>e(t.context)),B_=D(2,(e,t)=>$(e)?e:F_(e,qm(t))),V_=function(){return arguments.length===1?D(2,(e,t)=>H_(e,arguments[0],t)):D(3,(e,t,n)=>H_(e,t,n)).apply(this,arguments)},H_=(e,t,n)=>F_(e,Bm(t,n)),U_=D(e=>xf(e[0]),(e,t)=>ny({while:Ou,body:Du(t?.disableYield?e:Q(e,e=>Lg)),step:ju})),W_=D(2,(e,t)=>new K_(e,t.length===1?t:e=>t(e))),G_=V({op:`OnFailure`,[R]:r_}),K_=function(e,t){this[L]=e,this[B]=t};K_.prototype=G_;var q_=D(3,(e,t,n)=>W_(e,e=>{let r=t(e);return tm(r)?J(r.failure):n(r.success,e)})),J_=D(2,(e,t)=>q_(e,Zh,e=>t(e))),Y_=D(3,(e,t,n)=>W_(e,e=>{let r=t(e);return tm(r)?J(e):m_(n(r.success,e),J(e))})),X_=D(2,(e,t)=>Y_(e,Zh,e=>t(e))),Z_=D(2,(e,t)=>J_(e,e=>Vg(()=>t(e)))),Q_=e=>J_(e,Bg),$_=D(e=>xf(e[0]),(e,t)=>{if(!t?.log)return ov(e,{onFailure:e=>Z,onSuccess:e=>Z});let n=Qy(t.log===!0?void 0:t.log);return tv(e,{onFailure(e){let r=Xh(e);return tm(r)?J(r.failure):t.message===void 0?n(e):n(t.message,e)},onSuccess:e=>Z})}),ev=e=>cv(e,{onFailure:em,onSuccess:$p}),tv=D(2,(e,t)=>new rv(e,t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),t.onFailure.length===1?t.onFailure:e=>t.onFailure(e))),nv=V({op:`OnSuccessAndFailure`,[R]:r_}),rv=function(e,t,n){this[L]=e,this[z]=t,this[B]=n};rv.prototype=nv;var iv=function(e,t){let n=this.payload;return t.succeedWith(c_?n.onSuccess(e):ff(()=>n.onSuccess(e)))},av=((e,t)=>{let n=V({op:e,[R]:r_,[z]:iv,[B]:t}),r=function(e,t){this[L]=e,this.payload=t};return r.prototype=n,r})(`Match`,function(e,t){let n=e.reasons.find(zf);if(n===void 0)return J(e);let r=this.payload;return t.succeedWith(c_?r.onFailure(n.error):ff(()=>r.onFailure(n.error)))}),ov=D(2,(e,t)=>tv(e,{onFailure:e=>{let n=e.reasons.find(zf);return n?t.onFailure(n.error):J(e)},onSuccess:t.onSuccess})),sv=D(2,(e,t)=>new av(e,t)),cv=D(2,(e,t)=>{if($(e)){if(e._tag===`Success`)return H(t.onSuccess(e.value));let n=Zh(e.cause);return tm(n)?e:H(t.onFailure(n.success))}return sv(e,t)}),lv=e=>$(e)?H(e):uv(e),uv=Uf({op:`Exit`,[R](e){return e._stack.push(this),this[L]},[z](e,t,n){return t.succeedWith(n??H(e))},[B](e,t,n){return t.succeedWith(n??qf(e))}}),dv=D(2,(e,t)=>Q(fv(e,t.duration),e=>Vp(e)?t.orElse():q(e.value))),fv=D(2,(e,t)=>v_(p_(e),n_(Iy(t),Rp()))),pv=`~effect/Scope`,mv=`~effect/Scope/Closeable`,hv=ym(`effect/Scope`),gv=(e,t)=>U(n=>(Qv(n),_v(e,t)??Z)),_v=(e,t)=>{let n=e.state;if(n._tag===`Closed`||(e.state={_tag:`Closed`,exit:t},e.parent!==void 0&&Ev(e.parent,e),n._tag===`Empty`))return;if(n.finalizer!==void 0)return vv(n.finalizer,t);let r=n.finalizers;return r.size===1?vv(r.values().next().value,t):bv(e,r,t)},vv=(e,t)=>{try{return e(t)}catch(e){return Yf(e)}},yv=(e,t)=>E_(e)?t:W_(t,t=>J(Nf(e.cause,t))),bv=Zg(function*(e,t,n){let r=[],i=[],a=Array.from(t.values()),o=xg();for(let t=a.length-1;t>=0;t--){let s=a[t];e.strategy===`sequential`?r.push(yield*lv(vv(s,n))):i.push(dy(o,vv(s,n),!0,!0,`inherit`))}return i.length>0&&(r=yield*Ag(i)),yield*P_(r)}),xv=(e,t)=>Y(()=>Sv(e,t)),Sv=(e,t)=>{let n=Ov(t,e);return e.state._tag===`Closed`?(n.state=e.state,n):(Tv(e,n,e=>gv(n,e)),n)},Cv=(e,t)=>X(()=>e.state._tag===`Closed`?t(e.state.exit):(Tv(e,{},t),Z)),wv=(e,t)=>Cv(e,Du(t)),Tv=(e,t,n)=>{if(e.state._tag===`Empty`)e.state={_tag:`Open`,finalizerKey:t,finalizer:n,finalizers:void 0};else if(e.state._tag===`Open`){let r=e.state;r.finalizer===void 0?r.finalizers.set(t,n):(r.finalizers=new Map([[r.finalizerKey,r.finalizer]]),r.finalizerKey=void 0,r.finalizer=void 0,r.finalizers.set(t,n))}},Ev=(e,t)=>{if(e.state._tag!==`Open`)return;let n=e.state;n.finalizerKey===t?e.state=kv:n.finalizers!==void 0&&(n.finalizers.delete(t),n.finalizers.size===0&&(e.state=kv))},Dv=e=>Ov(e,void 0),Ov=(e=`sequential`,t)=>({[mv]:mv,[pv]:pv,strategy:e,parent:t,state:kv}),kv={_tag:`Empty`},Av=e=>Y(()=>Dv(e)),jv=hv,Mv=V_(hv),Nv=e=>U(t=>{let n=t.context,r=Dv();return t.setContext(Bm(t.context,hv,r)),zv(t,e=>(t.setContext(n),_v(r,e))),e}),Pv=e=>X(()=>{let t=Dv();return Bv(e(t),e=>X(()=>_v(t,e)??Z))}),Fv=(e,t,n)=>z_(r=>ey(i=>Q(jv,a=>h_(n?.interruptible?i(e):e,e=>Cv(a,n=>B_(t(e,n),r)))))),Iv=e=>Q(jv,t=>z_(n=>Cv(t,t=>B_(e(t),n)))),Lv=function(){let e=V({op:`OnExit`,[R](e){return e._stack.push(this),this.effect},[_f](e){e.interruptible&&this.interruptible!==!0&&(e._stack.push(Yv),e.interruptible=!1)},[z](e,t,n){n??=H(e);let r;try{r=this.onExit(n)}catch(e){r=Yf(e)}return r?Q(r,e=>n):n},[B](e,t,n){n??=qf(e);let r;try{r=this.onExit(n)}catch(e){r=Yf(e)}return r?Q(yv(n,r),e=>n):n}}),t=function(e,t,n){this.effect=e,this.onExit=t,this.interruptible=n};return t.prototype=e,t}(),Rv=(e,t,n)=>new Lv(e,t,n),zv=(e,t)=>{e._stack.push(new Lv(void 0,t,void 0))},Bv=D(2,Rv),Vv=D(2,(e,t)=>Bv(e,e=>t)),Hv=D(3,(e,t,n)=>Bv(e,e=>{let r=t(e);return tm(r)?Z:n(r.success,e)})),Uv=D(2,(e,t)=>Hv(e,O_,t)),Wv=D(3,(e,t,n)=>Bv(e,e=>{if(e._tag!==`Failure`)return Z;let r=t(e.cause);return tm(r)?Z:n(r.success,e.cause)})),Gv=D(2,(e,t)=>Wv(tg,t)(e)),Kv=(e,t,n)=>ey(r=>Q(e,e=>Rv(X(()=>r(t(e))),t=>n(e,t),!0))),qv=e=>U(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Yv),e):e),Jv=Uf({op:`SetInterruptible`,[_f](e){if(e.interruptible=this[L],e._interruptedCause&&e.interruptible)return()=>J(e._interruptedCause)}}),Yv=Jv(!0),Xv=Jv(!1),Zv=e=>{if(e.interruptible=!0,e._stack.push(Xv),e._interruptedCause)return J(e._interruptedCause)},Qv=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push(Yv))},$v=e=>U(t=>t.interruptible?e:Zv(t)??e),ey=e=>U(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Yv),e($v)):e(O)),ty=(e,t)=>ed(e)?t?.mode===`result`?ry(e,ev,t):ry(e,O,t):t?.discard?t.mode===`result`?ry(Object.values(e),ev,t):ry(Object.values(e),O,t):X(()=>{let n={};return n_(ry(Object.entries(e),([e,r])=>S_(t?.mode===`result`?ev(r):r,t=>{zd(n,e,t)}),{discard:!0,concurrency:t?.concurrency}),n)}),ny=Uf({op:`While`,[z](e,t){return this[L].step(e),this[L].while()?(t._stack.push(this),this[L].body()):k_},[R](e){return this[L].while()?(e._stack.push(this),this[L].body()):k_}}),ry=D(e=>typeof e[1]==`function`,(e,t,n)=>X(()=>{let r=ay(n?.concurrency);if(r===1)return iy(e,t,n);let i=lm(e),a=i.length;if(a===0)return n?.discard?Z:q([]);let o=n?.discard?void 0:Array(a),s=ly({f:t,out:o},i,{concurrency:r});return s?n_(s,o):q(o)})),iy=(e,t,n)=>X(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return n_(ny({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),ay=e=>e===`unbounded`?1/0:Math.max(1,e??1),oy=()=>e=>{let t=e.onItem,n=e.step,r=(e,t,r,a,o)=>Q(lv(o),o=>n(e,t[r],o,r)??i(e,t,r+1,a)??Z),i=(e,i,a=0,o=i.length)=>{for(;a<o;a++){let s=i[a],c=t(e,s,a);if(!$(c))return r(e,i,a,o,c);let l=n(e,s,c,a);if(l)return l._tag===`Failure`?l:void 0}};return i},sy=e=>{let t=e.onItem,n=e.step;return(e,r,i)=>{let a=0,o=i.end??r.length,s=i.concurrency,c=!1,l,u,d,f,ee,te=e=>{let t=Yf(e);return f=t,c=!0,u&&u.size>0?Q(qv(Pg(Array.from(u))),()=>f??t):t},p=()=>{let i=!1;for(;!f&&a<o;a++){let o=r[a],m=ee??t(e,o,a);if($(m)){if(f=n(e,o,m,a),f)break}else if(l){ee=void 0;let t=dy(l,m,!0,!0,`inherit`);if(t._exit){if(f=n(e,o,t._exit,a),f)break;continue}u.add(t);let r=a;if(t.addObserver(a=>{u.delete(t);try{if(f){if(a._tag===`Failure`){let e=a.cause.reasons.filter(e=>e._tag!==`Interrupt`);if(e.length>0){let t=jf(e);f=qf(f._tag===`Failure`?Nf(f.cause,t):t)}}}else{let t=n(e,o,a,r);t&&(f=t,p())}if(i){let e=p();e&&d(e)}else c&&u.size===0&&d(f??Z)}catch(e){d(te(e))}}),u.size<s)continue;i=!0,a++;return}else return Jg(e=>{l=xg(),u=new Set,ee=m,d=e;let t;try{t=p()}catch(t){return e(te(t))}return t?e(t):X(()=>(f??=k_,Q(u?Pg(u):Z,()=>f?._tag===`Failure`?f:Z)))})}if(c=!0,f){if(u&&u.size>0){let e=Dg(l);u.forEach(t=>t.interruptUnsafe(l.id,e));return}if(d||f._tag===`Failure`)return f}else if(d){if(u)u.size===0&&d(Z);else return k_}};return p()}},cy=()=>e=>sy(e),ly=sy({onItem(e,t,n){return e.f(t,n)},step(e,t,n,r){if(n._tag===`Failure`)return n;e.out&&(e.out[r]=n.value)}}),uy=D(e=>xf(e[0]),(e,t)=>U(n=>(rb(),q(dy(n,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),dy=(e,t,n=!1,r=!1,i=!1)=>{let a=e,o=i===`inherit`?a.interruptible:!i,s=new Sg(a.context,o);return r||(a.children().add(s),s._parent=a),n?s.evaluate(t):(s._asyncContext=bg(),a.currentDispatcher.scheduleTask(()=>s.evaluate(t),0)),s},fy=D(e=>xf(e[0]),(e,t)=>U(n=>q(dy(n,e,t?.startImmediately,!0,t?.uninterruptible)))),py=D(e=>xf(e[0]),(e,t,n)=>U(r=>{let i=dy(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!i._exit){if(t.state._tag!==`Closed`){let e={};Tv(t,e,()=>Gg(e=>e===i.id?Z:Mg(i))),i.addObserver(()=>Ev(t,e))}else i.interruptUnsafe(r.id,Dg(r))}return q(i)})),my=D(e=>xf(e[0]),(e,t)=>Q(jv,n=>py(e,n,t))),hy=e=>(t,n)=>{let r=new Sg(n?.scheduler?Bm(e,Ah,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal){if(n.signal.aborted)r.interruptUnsafe();else{let e=()=>r.interruptUnsafe();n.signal.addEventListener(`abort`,e,{once:!0}),r.addObserver(()=>n.signal.removeEventListener(`abort`,e))}}return n?.onFiberStart&&n.onFiberStart(r),r},gy=D(2,(e,t)=>e._exit?e:t.state._tag===`Closed`?(e.interruptUnsafe(e.id),e):(Ev(t,e),Tv(t,e,()=>Mg(e)),e.addObserver(()=>Ev(t,e)),e)),_y=hy(Lm()),vy=e=>{let t=hy(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},yy=vy(Lm()),by=e=>{let t=vy(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw ig(e.cause);return e.value})},xy=e=>{let t=hy(e);return e=>{if($(e))return e;let n=new Fh(`sync`),r=t(e,{scheduler:n});return r._dispatcher?.flush(),r._exit??Yf(new Vy(r))}},Sy=xy(Lm()),Cy=(e=>{let t=xy(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw ig(n.cause);return n.value}})(Lm()),wy=q(!0),Ty=q(!1),Ey=class{waiters=[];scheduled=void 0;_isOpen;constructor(e){this._isOpen=e}scheduleUnsafe(e){if(this.waiters.length===0)return wy;if(this.scheduled===void 0)this.scheduled=this.waiters,e.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let e=0;e<this.waiters.length;e++)this.scheduled.push(this.waiters[e]);return this.waiters=[],wy}flushScheduled=()=>{if(this.scheduled===void 0)return;let e=this.scheduled;this.scheduled=void 0;for(let t=0;t<e.length;t++)e[t](k_)};flushWaiters(){let e=this.waiters;this.waiters=[],this.flushScheduled();for(let t=0;t<e.length;t++)e[t](k_)}open=U(e=>this._isOpen?Ty:(this._isOpen=!0,this.scheduleUnsafe(e)));release=U(e=>this._isOpen?Ty:this.scheduleUnsafe(e));openUnsafe(){return!this._isOpen&&(this._isOpen=!0,this.flushWaiters(),!0)}await=Jg(e=>this._isOpen?e(Z):(this.waiters.push(e),Y(()=>{let t=this.waiters.indexOf(e);t===-1?this.scheduled!==void 0&&(t=this.scheduled.indexOf(e),t!==-1&&this.scheduled.splice(t,1)):this.waiters.splice(t,1)})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=Y(()=>this.closeUnsafe());whenOpen=e=>Q(this.await,()=>e);isOpen(){return this._isOpen}},Dy=e=>new Ey(e??!1),Oy=e=>Y(()=>Dy(e)),ky=G(`effect/Clock`,{defaultValue:()=>new jy}),Ay=2**31-1,jy=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=Y(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return Py()}currentTimeNanos=Y(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return Ny()}monotonicTimeNanos=Y(()=>this.monotonicTimeNanosUnsafe());sleep(e){return this.sleepMillis(Sh(e))}sleepMillis(e){return e<=0?Lg:Number.isFinite(e)?Jg(t=>{let n=e>Ay?this.sleepMillis(e-Ay):Z,r=setTimeout(()=>t(n),Math.min(e,Ay));return Y(()=>clearTimeout(r))}):Yg}},My=BigInt(1e6),Ny=function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint==`function`)return()=>e.bigint();if(typeof performance<`u`&&typeof performance.now==`function`)return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let e=BigInt(Date.now())*My;return e>t&&(t=e),t}}(),Py=function(){let e=BigInt(1e9),t;return()=>{let n=Ny(),r=BigInt(Date.now())*My;if(t===void 0)t=r-n;else{let i=t+n;(r>i?r-i:i-r)>e&&(t=r-n)}return t+n}}(),Fy=e=>U(t=>e(t.getRef(ky))),Iy=e=>Fy(t=>t.sleep(ih(e))),Ly=Fy(e=>e.currentTimeMillis);Qf(`TimeoutError`);var Ry=`~effect/Cause/IllegalArgumentError`,zy=class extends Qf(`IllegalArgumentError`){[Ry]=Ry;constructor(e){super({message:e})}};Qf(`ExceededCapacityError`);var By=`~effect/Cause/AsyncFiberError`,Vy=class extends Qf(`AsyncFiberError`){[By]=By;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}},Hy=`~effect/Cause/UnknownError`,Uy=class extends Qf(`UnknownError`){[Hy]=Hy;constructor(e,t){super({message:t,cause:e})}},Wy=G(`effect/Console`,{defaultValue:()=>globalThis.console}),Gy=Fp(Mp(Ap,e=>{switch(e){case`All`:return-(2**53-1);case`Fatal`:return 5e4;case`Error`:return 4e4;case`Warn`:return 3e4;case`Info`:return 2e4;case`Debug`:return 1e4;case`Trace`:return 0;case`None`:return 2**53-1}})),Ky=G(`effect/Logger/CurrentLoggers`,{defaultValue:()=>new Set([tb,nb])}),qy=G(`effect/Logger/LogToStderr`,{defaultValue:ku}),Jy={"~effect/Logger":{_Message:O,_Output:O},pipe(){return wu(this,arguments)}},Yy=e=>{let t=Object.create(Jy);return t.log=e,t},Xy=e=>e.replace(/[\s="]/g,`_`),Zy=(e,t)=>`${Xy(e[0])}=${t-e[1]}ms`,Qy=e=>(...t)=>{let n;for(let e=0,r=t.length;e<r;e++){let r=t[e];Tf(r)&&(n?t.splice(e,1):t=t.slice(0,e).concat(t.slice(e+1)),n=n?jf(n.reasons.concat(r.reasons)):r,e--)}return n===void 0&&(n=Pf),U(r=>{let i=e??r.cache.logLevel;if(Gy(r.cache.minimumLogLevel,i))return Z;let a=r.getRef(ky),o=r.getRef(Ky);if(o.size>0){let e=new Date(a.currentTimeMillisUnsafe());for(let a of o)a.log({cause:n,fiber:r,date:e,logLevel:i,message:t})}return Z})},$y={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};$y.gray,$y.blue,$y.green,$y.yellow,$y.red,$y.bgBrightRed,$y.black;var eb=e=>`${e.getHours().toString().padStart(2,`0`)}:${e.getMinutes().toString().padStart(2,`0`)}:${e.getSeconds().toString().padStart(2,`0`)}.${e.getMilliseconds().toString().padStart(3,`0`)}`,tb=Yy(({cause:e,date:t,fiber:n,logLevel:r,message:i})=>{let a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(pg(e));let o=t.getTime(),s=n.getRef(qh),c=``;for(let e of s)c+=` ${Zy(e,o)}`;let l=n.getRef(Wh);Object.keys(l).length>0&&a.push(l);let u=n.getRef(Wy);(n.getRef(qy)?u.error:u.log)(`[${eb(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...a)}),nb=Yy(({cause:e,fiber:t,logLevel:n,message:r})=>{let i=t.getRef(ky),a=t.getRef(Wh),o=t.cache.span;if(o===void 0||o._tag===`ExternalSpan`)return;let s={};for(let[e,t]of Object.entries(a))zd(s,e,t);s[`effect.fiberId`]=t.id,s[`effect.logLevel`]=n.toUpperCase(),e.reasons.length>0&&(s[`effect.cause`]=pg(e)),o.event(of(Array.isArray(r)&&r.length===1?r[0]:r),i.currentTimeNanosUnsafe(),s)});function rb(){Eg.interruptChildren??=Og}var ib=Wh,ab=xf,ob=ty,sb=ry,cb=ny,lb=Ug,ub=Wg,db=q,fb=X,pb=Y,mb=Z,hb=Jg,gb=Yg,_b=Xg,vb=Fg,yb=J,bb=zg,xb=Bg,Sb=Hg,Cb=Lg,wb=Ig,Tb=Q,Eb=x_,Db=m_,Ob=h_,kb=ev,Ab=lv,jb=S_,Mb=n_,Nb=g_,Pb=J_,Fb=W_,Ib=Z_,Lb=Q_,Rb=X_,zb=$_,Bb=fv,Vb=dv,Hb=Iy,Ub=v_,Wb=sv,Gb=y_,Kb=tv,qb=ov,Jb=L_,Yb=B_,Xb=V_,Zb=jv,Qb=Nv,$b=Pv,ex=Fv,tx=Kv,nx=Iv,rx=Vv,ix=Uv,ax=Rv,ox=Bv,sx=Gv,cx=qv,lx=ey,ux=U_,dx=uy,fx=py,px=my,mx=fy,hx=_y,gx=hy,_x=by,vx=yy,yx=Cy,bx=Sy,xx=Zg,Sx=Qy(`Warn`),Cx=Qy(`Error`),wx=D(e=>ab(e[0]),(e,...t)=>I_(e,ib,e=>{let n=t.length===1?{...e,...t[0]}:{...e};return t.length===1||zd(n,t[0],t[1]),n}));ym()(`effect/Effect/Transaction`);var Tx=C_,Ex=w_,Dx=b_,Ox=$g;export{Ub as $,Ga as $a,Ac as $i,Bp as $n,P as $r,cy as $t,wb as A,Sa as Aa,wu as Ai,um as An,H as Ar,rg as At,Wb as B,Ea as Ba,Zl as Bi,rm as Bn,I as Br,N_ as Bt,Ox as C,Ba as Ca,D as Ci,_h as Cn,Ff as Cr,cb as Ct,mx as D,Pa as Da,Pu as Di,Bm as Dn,Yf as Dr,p_ as Dt,dx as E,Ra as Ea,Nu as Ei,ym as En,R as Er,m_ as Et,Sx as F,Aa as Fa,El as Fi,gm as Fn,U as Fr,$ as Ft,ix as G,Qa as Ga,fu as Gi,om as Gn,zd as Gr,jg as Gt,Gb as H,Ua as Ha,T as Hi,nm as Hn,Xd as Hr,M_ as Ht,jb as I,Oa as Ia,Il as Ii,hm as In,lf as Ir,P_ as It,sx as J,Ja,zc as Ji,Xp as Jn,Nd as Jr,Zh as Jt,ox as K,Fa as Ka,bu as Ki,$p as Kn,Ld as Kr,gy as Kt,Tx as L,Ta as La,xc as Li,mm as Ln,uf as Lr,T_ as Lt,zb as M,ka as Ma,kc as Mi,lm as Mn,Sf as Mr,ig as Mt,ab as N,Ha as Na,zl as Ni,dm as Nn,zf as Nr,z_ as Nt,fx as O,Ia as Oa,Eu as Oi,Lm as On,Jf as Or,Jg as Ot,Cx as P,Na as Pa,Cl as Pi,fm as Pn,Uf as Pr,Ly as Pt,Xb as Q,qa as Qa,Mc as Qi,Vp as Qn,jd as Qr,ng as Qt,Ib as R,_a as Ra,tl as Ri,em as Rn,sf as Rr,D_ as Rt,xx as S,Qo as Sa,Du as Si,dh as Sn,n as So,Lf as Sr,mb as St,ux as T,x as Ta,O as Ti,G as Tn,ip as Tr,zy as Tt,qb as U,wa as Ua,al as Ui,am as Un,Yd as Ur,kg as Ut,Kb as V,Wa as Va,ws as Vi,tm as Vn,Zd as Vr,k_ as Vt,gb as W,Va as Wa,wl as Wi,im as Wn,Bd as Wr,Mg as Wt,lb as X,Oi as Xa,$c as Xi,Wp as Xn,F as Xr,Q as Xt,Lb as Y,za as Ya,Yc as Yi,Kp as Yn,Fd as Yr,Qh as Yt,Yb as Z,Ka as Za,lc as Zi,qp as Zn,Ad as Zr,xg as Zt,yb as _,ol as _a,Bu as _i,Y as _n,Ie as _o,np as _r,Vb as _t,Db as a,Dl as aa,A as ai,ay as an,xi as ao,Gp as ar,yx as at,Dx as b,js as ba,Zu as bi,Fh as bn,h as bo,Qf as br,cx as bt,Nb as c,Sc as ca,Hu as ci,gv as cn,ti as co,jp as cr,Qb as ct,Pb as d,gl as da,Yu as di,Av as dn,In as do,kp as dr,db as dt,hu as ea,ld as ei,oy as en,La as eo,Hp as er,kb as et,Jb as f,bs as fa,Ju as fi,Dv as fn,y as fo,Fp as fr,fb as ft,vb as g,ml as ga,Gu as gi,X as gn,We as go,Op as gr,Bb as gt,Ab as h,Lc as ha,$u as hi,Rg as hn,He as ho,Ip as hr,Rb as ht,ob as i,cu as ia,N as ii,Mv as in,Jr as io,Rp as ir,_x as it,_b as j,Ma as ja,Qc as ji,pm as jn,ep as jr,pg as jt,px as k,xa as ka,Tu as ki,W as kn,qf as kr,q_ as kt,hb as l,nl as la,Ku as li,xv as ln,kr as lo,Np as lr,$b as lt,rx as m,Ts as ma,Qu as mi,q as mn,Be as mo,Pp as mr,Ob as mt,tx as n,wc as na,j as ni,Dy as nn,Si as no,Yp as nr,gx as nt,wx as o,il as oa,k as oi,wv as on,Yr as oo,zp as or,bx as ot,xb as p,rl as pa,Vu as pi,hv as pn,Re as po,Lp as pr,pb as pt,ax as q,ja as qa,Vc as qi,Qp as qn,Id as qr,$h as qt,nx as r,Su as ra,ad as ri,Rv as rn,Fr as ro,Up as rr,vx as rt,Mb as s,Xl as sa,Uu as si,Cv as sn,xr as so,Zp as sr,Zb as st,ex as t,ul as ta,M as ti,Oy as tn,Di as to,Jp as tr,hx as tt,Fb as u,uu as ua,Xu as ui,Sv as un,$r as uo,Ap as ur,Hb as ut,bb as v,Gc as va,Wu as vi,ey as vn,pe as vo,Zf as vr,ub as vt,sb as w,Ca as wa,Mu as wi,Ch as wn,jf as wr,Cb as wt,Eb as x,$o as xa,ju as xi,ih as xn,r as xo,L as xr,lx as xt,Tb as y,Is as ya,qu as yi,Z as yn,p as yo,yf as yr,Sb as yt,Ex as z,Da as za,Ml as zi,sm as zn,rf as zr,E_ as zt};