eve 0.52.4 → 0.53.0

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 (149) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/src/cli/commands/init-agent-workspace.d.ts +2 -0
  3. package/dist/src/cli/commands/init-agent-workspace.js +1 -1
  4. package/dist/src/cli/commands/init-install.d.ts +8 -0
  5. package/dist/src/cli/commands/init-install.js +1 -0
  6. package/dist/src/cli/commands/init.d.ts +3 -4
  7. package/dist/src/cli/commands/init.js +1 -1
  8. package/dist/src/cli/dev/tui/message-queue.js +1 -1
  9. package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
  10. package/dist/src/cli/run.js +2 -2
  11. package/dist/src/cli/telemetry/index.d.ts +3 -0
  12. package/dist/src/cli/telemetry/index.js +1 -1
  13. package/dist/src/compiled/.vendor-stamp.json +17 -16
  14. package/dist/src/compiled/@ai-sdk/anthropic/index.d.ts +23 -2
  15. package/dist/src/compiled/@ai-sdk/anthropic/index.js +2 -4
  16. package/dist/src/compiled/@ai-sdk/google/index.d.ts +145 -33
  17. package/dist/src/compiled/@ai-sdk/google/index.js +10 -7
  18. package/dist/src/compiled/@ai-sdk/mcp/index.d.ts +176 -7
  19. package/dist/src/compiled/@ai-sdk/mcp/index.js +1 -1
  20. package/dist/src/compiled/@ai-sdk/openai/index.d.ts +71 -40
  21. package/dist/src/compiled/@ai-sdk/openai/index.js +8 -8
  22. package/dist/src/compiled/@ai-sdk/otel/index.js +1 -1
  23. package/dist/src/compiled/@ai-sdk/provider/index.d.ts +225 -3
  24. package/dist/src/compiled/@ai-sdk/provider-utils/index.d.ts +220 -151
  25. package/dist/src/compiled/@workflow/core/create-hook.d.ts +3 -0
  26. package/dist/src/compiled/@workflow/core/index.js +2 -2
  27. package/dist/src/compiled/@workflow/core/private.js +1 -1
  28. package/dist/src/compiled/@workflow/core/runtime/resume-hook.d.ts +59 -7
  29. package/dist/src/compiled/@workflow/core/runtime/run.d.ts +42 -0
  30. package/dist/src/compiled/@workflow/core/runtime/start.d.ts +31 -1
  31. package/dist/src/compiled/@workflow/core/runtime.d.ts +2 -2
  32. package/dist/src/compiled/@workflow/core/runtime.js +2 -2
  33. package/dist/src/compiled/@workflow/core/serialization.d.ts +22 -0
  34. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  35. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  36. package/dist/src/compiled/@workflow/errors/index.d.ts +37 -3
  37. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  38. package/dist/src/compiled/@workflow/world/attributes-validation.d.ts +68 -0
  39. package/dist/src/compiled/@workflow/world/index.d.ts +1 -1
  40. package/dist/src/compiled/@workflow/world/interfaces.d.ts +21 -0
  41. package/dist/src/compiled/@workflow/world-local/index.js +5 -5
  42. package/dist/src/compiled/@workflow/world-vercel/index.js +3 -3
  43. package/dist/src/compiled/_chunks/workflow/attribute-changes-C6H-fRVP.js +20 -0
  44. package/dist/src/compiled/_chunks/workflow/dist-DDeH-1ER.js +40 -0
  45. package/dist/src/compiled/_chunks/workflow/dist-DhncQSl7.js +74 -0
  46. package/dist/src/compiled/_chunks/workflow/{dist-BIO9Inoc.js → dist-xTushGCp.js} +1 -1
  47. package/dist/src/compiled/_chunks/workflow/frames-DsEqSDes.js +3 -0
  48. package/dist/src/compiled/_chunks/workflow/{private-aXEeo0fU.js → private-CFJkQA7R.js} +1 -1
  49. package/dist/src/compiled/_chunks/workflow/resume-hook-BRDLAb67.js +1 -0
  50. package/dist/src/compiled/_chunks/workflow/run-BM2OFphk.js +1 -0
  51. package/dist/src/compiled/_chunks/workflow/sleep-6cG0F99-.js +1 -0
  52. package/dist/src/compiled/_chunks/workflow/{ws-transport-M7uk8HV8.js → ws-transport-DuK82LLz.js} +1 -1
  53. package/dist/src/compiler/extension-compatibility.d.ts +7 -6
  54. package/dist/src/compiler/extension-compatibility.js +1 -1
  55. package/dist/src/compiler/manifest.js +1 -1
  56. package/dist/src/compiler/normalize-agent-config.js +1 -1
  57. package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
  58. package/dist/src/context/dynamic-model-lifecycle.js +1 -1
  59. package/dist/src/context/keys.d.ts +11 -2
  60. package/dist/src/context/keys.js +1 -1
  61. package/dist/src/evals/mock-model.js +1 -1
  62. package/dist/src/evals/runner/run-evals.d.ts +1 -1
  63. package/dist/src/evals/runner/run-evals.js +1 -1
  64. package/dist/src/execution/activity-cohort.d.ts +20 -0
  65. package/dist/src/execution/activity-cohort.js +1 -0
  66. package/dist/src/execution/authorization-callback-match.d.ts +1 -0
  67. package/dist/src/execution/authorization-callback-match.js +1 -1
  68. package/dist/src/execution/cancelled-model-call-batch.d.ts +15 -0
  69. package/dist/src/execution/cancelled-model-call-batch.js +1 -0
  70. package/dist/src/execution/coordination-dispatch-shared.js +1 -1
  71. package/dist/src/execution/model-call-batching.d.ts +11 -0
  72. package/dist/src/execution/model-call-batching.js +1 -0
  73. package/dist/src/execution/parked-delivery-wait.js +1 -1
  74. package/dist/src/execution/session-activity-projection.d.ts +2 -0
  75. package/dist/src/execution/session-activity-projection.js +1 -1
  76. package/dist/src/execution/skills/instructions.js +1 -1
  77. package/dist/src/execution/tools/sleep-workflow.js +1 -1
  78. package/dist/src/execution/tools/subagent/invoke-agent.d.ts +5 -5
  79. package/dist/src/execution/tools/subagent/invoke-agent.js +1 -1
  80. package/dist/src/execution/tools/subagent/start.js +1 -1
  81. package/dist/src/execution/tools/workflow/body.js +1 -1
  82. package/dist/src/execution/turn-workflow.js +1 -1
  83. package/dist/src/execution/wire/session-inbox-resume.js +1 -1
  84. package/dist/src/execution/workflow-steps.d.ts +1 -1
  85. package/dist/src/execution/workflow-steps.js +1 -1
  86. package/dist/src/harness/approval-delivery-coordinator.js +1 -1
  87. package/dist/src/harness/authorization.d.ts +1 -0
  88. package/dist/src/harness/authorization.js +1 -1
  89. package/dist/src/harness/compaction.js +1 -1
  90. package/dist/src/harness/current-messages.d.ts +8 -2
  91. package/dist/src/harness/current-messages.js +1 -1
  92. package/dist/src/harness/hitl/approval-input-requests.js +1 -1
  93. package/dist/src/harness/input-requests.js +1 -1
  94. package/dist/src/harness/pending-input-batches.d.ts +4 -0
  95. package/dist/src/harness/pending-input-batches.js +1 -1
  96. package/dist/src/harness/tool-loop.js +2 -2
  97. package/dist/src/harness/turn-client-context.d.ts +1 -1
  98. package/dist/src/internal/application/package.js +1 -1
  99. package/dist/src/internal/authored-definition/core.js +1 -1
  100. package/dist/src/internal/authored-package-boundary.js +1 -1
  101. package/dist/src/internal/mock-model-identity.d.ts +2 -0
  102. package/dist/src/internal/mock-model-identity.js +1 -0
  103. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
  104. package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -1
  105. package/dist/src/public/tools/index.d.ts +1 -0
  106. package/dist/src/public/tools/index.js +1 -1
  107. package/dist/src/runtime/resolve-agent.js +1 -1
  108. package/dist/src/self-modification/agent.d.ts +2 -2
  109. package/dist/src/self-modification/agent.js +1 -1
  110. package/dist/src/self-modification/config.d.ts +15 -0
  111. package/dist/src/self-modification/config.js +1 -1
  112. package/dist/src/self-modification/extension/extension.d.ts +3 -0
  113. package/dist/src/self-modification/extension/extension.js +1 -1
  114. package/dist/src/self-modification/setup.d.ts +3 -0
  115. package/dist/src/self-modification/setup.js +25 -4
  116. package/dist/src/setup/integrations/self-modification/setup.js +1 -1
  117. package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
  118. package/dist/src/setup/scaffold/create/project.js +2 -2
  119. package/dist/src/setup/scaffold/update/web-options.js +1 -1
  120. package/dist/src/shared/agent-definition.d.ts +11 -2
  121. package/dist/src/tasks/delivery-context.d.ts +2 -2
  122. package/dist/src/tasks/delivery-context.js +2 -18
  123. package/dist/src/tasks/delivery-policy.js +1 -1
  124. package/dist/src/tools/durable-callbacks.d.ts +18 -1
  125. package/dist/src/tools/durable-callbacks.js +1 -1
  126. package/dist/src/tools/workflow-definition.d.ts +38 -4
  127. package/docs/agent-config.md +44 -8
  128. package/docs/channels/overview.mdx +2 -0
  129. package/docs/channels/slack.mdx +2 -0
  130. package/docs/concepts/execution-model-and-durability.mdx +20 -2
  131. package/docs/evals/running.mdx +3 -1
  132. package/docs/guides/dev-tui.md +11 -11
  133. package/docs/guides/dynamic-capabilities.md +36 -1
  134. package/docs/guides/instrumentation.md +3 -2
  135. package/docs/instructions.mdx +1 -1
  136. package/docs/reference/cli.md +1 -1
  137. package/docs/reference/telemetry.md +1 -1
  138. package/docs/reference/typescript-api.md +36 -35
  139. package/docs/subagents/index.mdx +1 -1
  140. package/docs/tools/overview.mdx +4 -2
  141. package/docs/tools/workflows.mdx +15 -10
  142. package/package.json +17 -17
  143. package/dist/src/compiled/_chunks/workflow/attribute-changes-DpruylJZ.js +0 -20
  144. package/dist/src/compiled/_chunks/workflow/dist-ChzQSWQA.js +0 -65
  145. package/dist/src/compiled/_chunks/workflow/dist-veFIAdWV.js +0 -40
  146. package/dist/src/compiled/_chunks/workflow/frames-DKxlMf3X.js +0 -3
  147. package/dist/src/compiled/_chunks/workflow/resume-hook-DWDi_wCN.js +0 -1
  148. package/dist/src/compiled/_chunks/workflow/run-vsAdI41O.js +0 -1
  149. package/dist/src/compiled/_chunks/workflow/sleep-BKxoNDRv.js +0 -1
@@ -1,65 +0,0 @@
1
- var e=`vercel.ai.error`,t=Symbol.for(e),n,r,i=class i extends (r=Error,n=t,r){constructor({name:e,message:t,cause:r}){super(t),this[n]=!0,this.name=e,this.cause=r}static isInstance(t){return i.hasMarker(t,e)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}},a=`AI_APICallError`,o=`vercel.ai.error.${a}`,s=Symbol.for(o),c,l,u=class extends (l=i,c=s,l){constructor({message:e,url:t,requestBodyValues:n,statusCode:r,responseHeaders:i,responseBody:o,cause:s,isRetryable:l=r!=null&&(r===408||r===409||r===429||r>=500),data:u}){super({name:a,message:e,cause:s}),this[c]=!0,this.url=t,this.requestBodyValues=n,this.statusCode=r,this.responseHeaders=i,this.responseBody=o,this.isRetryable=l,this.data=u}static isInstance(e){return i.hasMarker(e,o)}},d=`AI_EmptyResponseBodyError`,f=`vercel.ai.error.${d}`,p=Symbol.for(f),m,h,ee=class extends (h=i,m=p,h){constructor({message:e=`Empty response body`}={}){super({name:d,message:e}),this[m]=!0}static isInstance(e){return i.hasMarker(e,f)}};function g(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.toString():JSON.stringify(e)}var te=`AI_InvalidArgumentError`,ne=`vercel.ai.error.${te}`,re=Symbol.for(ne),ie,ae,oe=class extends (ae=i,ie=re,ae){constructor({message:e,cause:t,argument:n}){super({name:te,message:e,cause:t}),this[ie]=!0,this.argument=n}static isInstance(e){return i.hasMarker(e,ne)}},se=`AI_InvalidPromptError`,ce=`vercel.ai.error.${se}`,le=Symbol.for(ce),ue,de,fe=class extends (de=i,ue=le,de){constructor({prompt:e,message:t,cause:n}){super({name:se,message:`Invalid prompt: ${t}`,cause:n}),this[ue]=!0,this.prompt=e}static isInstance(e){return i.hasMarker(e,ce)}},pe=`AI_InvalidResponseDataError`,me=`vercel.ai.error.${pe}`,he=Symbol.for(me),ge,_e,ve=class extends (_e=i,ge=he,_e){constructor({data:e,message:t=`Invalid response data: ${JSON.stringify(e)}.`}){super({name:pe,message:t}),this[ge]=!0,this.data=e}static isInstance(e){return i.hasMarker(e,me)}},ye=`AI_JSONParseError`,be=`vercel.ai.error.${ye}`,xe=Symbol.for(be),Se,Ce,we=class extends (Ce=i,Se=xe,Ce){constructor({text:e,cause:t}){super({name:ye,message:`JSON parsing failed: Text: ${e}.
2
- Error message: ${g(t)}`,cause:t}),this[Se]=!0,this.text=e}static isInstance(e){return i.hasMarker(e,be)}},Te=`AI_LoadAPIKeyError`,Ee=`vercel.ai.error.${Te}`,De=Symbol.for(Ee),Oe,ke,Ae=class extends (ke=i,Oe=De,ke){constructor({message:e}){super({name:Te,message:e}),this[Oe]=!0}static isInstance(e){return i.hasMarker(e,Ee)}},je=`AI_NoSuchModelError`,Me=`vercel.ai.error.${je}`,Ne=Symbol.for(Me),Pe,Fe,Ie=class extends (Fe=i,Pe=Ne,Fe){constructor({errorName:e=je,modelId:t,modelType:n,message:r=`No such ${n}: ${t}`}){super({name:e,message:r}),this[Pe]=!0,this.modelId=t,this.modelType=n}static isInstance(e){return i.hasMarker(e,Me)}},Le=`AI_NoSuchProviderReferenceError`,Re=`vercel.ai.error.${Le}`,ze=Symbol.for(Re),Be,Ve,He=class extends (Ve=i,Be=ze,Ve){constructor({provider:e,reference:t,message:n=`No provider reference found for provider '${e}'. Available providers: ${Object.keys(t).join(`, `)}`}){super({name:Le,message:n}),this[Be]=!0,this.provider=e,this.reference=t}static isInstance(e){return i.hasMarker(e,Re)}},Ue=`AI_TooManyEmbeddingValuesForCallError`,We=`vercel.ai.error.${Ue}`,Ge=Symbol.for(We),Ke,qe,Je=class extends (qe=i,Ke=Ge,qe){constructor(e){super({name:Ue,message:`Too many values for a single embedding call. The ${e.provider} model "${e.modelId}" can only embed up to ${e.maxEmbeddingsPerCall} values per call, but ${e.values.length} values were provided.`}),this[Ke]=!0,this.provider=e.provider,this.modelId=e.modelId,this.maxEmbeddingsPerCall=e.maxEmbeddingsPerCall,this.values=e.values}static isInstance(e){return i.hasMarker(e,We)}},Ye=`AI_TypeValidationError`,Xe=`vercel.ai.error.${Ye}`,Ze=Symbol.for(Xe),Qe,$e,et=class e extends ($e=i,Qe=Ze,$e){constructor({value:e,cause:t,context:n}){let r=`Type validation failed`;if(n?.field&&(r+=` for ${n.field}`),n?.entityName||n?.entityId){r+=` (`;let e=[];n.entityName&&e.push(n.entityName),n.entityId&&e.push(`id: "${n.entityId}"`),r+=e.join(`, `),r+=`)`}super({name:Ye,message:`${r}: Value: ${JSON.stringify(e)}.
3
- Error message: ${g(t)}`,cause:t}),this[Qe]=!0,this.value=e,this.context=n}static isInstance(e){return i.hasMarker(e,Xe)}static wrap({value:t,cause:n,context:r}){return e.isInstance(n)&&n.value===t&&n.context?.field===r?.field&&n.context?.entityName===r?.entityName&&n.context?.entityId===r?.entityId?n:new e({value:t,cause:n,context:r})}},tt=`AI_UnsupportedFunctionalityError`,nt=`vercel.ai.error.${tt}`,rt=Symbol.for(nt),it,at,ot=class extends (at=i,it=rt,at){constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:tt,message:t}),this[it]=!0,this.functionality=e}static isInstance(e){return i.hasMarker(e,nt)}};function st(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`?!0:Array.isArray(e)?e.every(st):typeof e==`object`&&Object.entries(e).every(([e,t])=>typeof e==`string`&&(t===void 0||st(t)))}function ct(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&(t===void 0||st(t)))}function lt(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 ut(e,t=`|`){return e.map(e=>Tt(e)).join(t)}function dt(e,t){return typeof t==`bigint`?t.toString():t}function ft(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function pt(e){return e==null}function mt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ht(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}const gt=Symbol(`evaluating`);function _t(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==gt)return r===void 0&&(r=gt,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function _(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function v(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function vt(e){return JSON.stringify(e)}function yt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const bt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function xt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const St=ft(()=>{if(M.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function y(e){if(xt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return xt(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Ct(e){return y(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const wt=new Set([`string`,`number`,`symbol`]);function b(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function x(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function S(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 Tt(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Et(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}const Dt={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ot(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 x(e,v(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&_(e,r,n.shape[r])}return _(this,`shape`,e),e},checks:[]}))}function kt(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 x(e,v(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return _(this,`shape`,r),r},checks:[]}))}function At(e,t){if(!y(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 of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return x(e,v(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return _(this,`shape`,n),n}}))}function jt(e,t){if(!y(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return x(e,v(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return _(this,`shape`,n),n}}))}function Mt(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return x(e,v(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return _(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Nt(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return x(t,v(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return _(this,`shape`,i),i},checks:[]}))}function Pt(e,t,n){return x(t,v(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return _(this,`shape`,i),i}}))}function C(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 Ft(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 w(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function It(e){return typeof e==`string`?e:e?.message}function Lt(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function T(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:It(e.inst?._zod.def?.error?.(e))??It(a?.(e))??It(t?.error?.(e))??It(n.customError?.(e))??It(n.localeError?.(e))??`Invalid input`,{inst:s,schema:c,continue:l,input:u,...d}=e;return d.path??=[],d.message=o,t?.reportInput&&(d.input=u),d}const Rt=/[\uD800-\uDBFF]/;function zt(e){let t=e.length;if(!Rt.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Bt(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Vt(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function E(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Ht(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Wt(e,n,r.value)}}function D(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Ut(e,t,n){return D(e,t,n,!1)}function Wt(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:D(this,t,n.bind(this))},set(e){D(this,t,e)}})}function Gt(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let Kt,O=!1;const qt={configurable:!0,get(){O=!0}};function k(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Kt!==e._zod){Kt=void 0;return}Kt=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,qt);let e=O;O=!1;try{let r=n(this);return O?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),O||=e,r}catch(n){throw delete this[t],O||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Jt(e,t,n,r){let i=Gt(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function Yt(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var Xt;const Zt=Object.freeze({status:`aborted`}),Qt={value:void 0,enumerable:!1};let $t=`captureStackTrace`in Error?Error:null;function en(e){let t=$t;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return $t=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function A(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Qt.value=new a(r);try{Object.defineProperty(n,"_zod",Qt)}finally{Qt.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Ht(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?en(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var j=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},tn=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Xt=globalThis).__zod_globalConfig??(Xt.__zod_globalConfig={});const M=globalThis.__zod_globalConfig;function N(e){return e&&Object.assign(M,e),M}function nn(){let e=this._zod;return e.message??=JSON.stringify(e.def,dt,2),e.message}function rn(e){this._zod.message=e}const an={get:nn,set:rn,enumerable:!0,configurable:!0},on={value:void 0,enumerable:!1},sn={value:void 0,enumerable:!1},cn=new WeakSet([Object.prototype,Error.prototype]),ln=(e,t)=>{e.name=`$ZodError`,on.value=e._zod,Object.defineProperty(e,"_zod",on),sn.value=t,Object.defineProperty(e,"issues",sn),on.value=void 0,sn.value=void 0,Object.defineProperty(e,"message",an);let n=Object.getPrototypeOf(e);cn.has(n)||(cn.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},un=A(`$ZodError`,ln),dn=A(`$ZodError`,ln,void 0,{Parent:Error});function fn(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function pn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?fn(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function mn(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],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function hn(e,t){return{callee:t?.callee??e,Err:t?.Err}}const gn=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new j;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>T(e,o,N())));throw bt(n,a?.callee??t),n}return s.value};return t},_n=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>T(e,o,N())));throw bt(n,a?.callee??t),n}return s.value};return t},vn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new j;return a.issues.length?{success:!1,error:new(e??un)(a.issues.map(e=>T(e,i,N())))}:{success:!0,data:a.value}},yn=vn(dn),bn=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=>T(e,i,N())))}:{success:!0,data:a.value}},xn=bn(dn),Sn=e=>{let t=gn(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,hn(n,a))};return n},Cn=e=>{let t=gn(e),n=(e,r,i,a)=>t(e,r,i,hn(n,a));return n},wn=e=>{let t=_n(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,hn(n,a))};return n},Tn=e=>{let t=_n(e),n=async(e,r,i,a)=>await t(e,r,i,hn(n,a));return n},En=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return vn(e)(t,n,i)},Dn=e=>(t,n,r)=>vn(e)(t,n,r),On=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return bn(e)(t,n,i)},kn=e=>async(t,n,r)=>bn(e)(t,n,r),An=/^[cC][0-9a-z]{6,}$/,jn=/^[0-9a-z]+$/,Mn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Nn=/^[0-9a-vA-V]{20}$/,Pn=/^[A-Za-z0-9]{27}$/,Fn=/^[a-zA-Z0-9_-]{21}$/;function In(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const Ln=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Rn=/^([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})$/,zn=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)$/,Bn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Vn(){return RegExp(`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}const Hn=/^(?:(?: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])$/,Un=/^(([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}|:))$/,Wn=/^((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])$/,Gn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Kn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,qn=/^[A-Za-z0-9_-]*$/,Jn=/^https?$/,Yn=/^\+[1-9]\d{6,14}$/,Xn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Zn(e){return RegExp(`^${e}$`)}const Qn=Zn(Xn);function $n(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function er(e){return RegExp(`^${$n(e)}$`)}function tr(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${$n({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${$n({precision:e.precision})}`:n;return RegExp(`^${Xn}T(?:${r})$`)}const nr=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},rr=/^-?\d+$/,ir=/^-?\d+(?:\.\d+)?$/,ar=/^(?:true|false)$/i,or=/^null$/i,sr=/^[^A-Z]*$/,cr=/^[^a-z]*$/,P=A(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),lr=e=>{let t=e.value;return!pt(t)&&t.length!==void 0},ur={number:`number`,bigint:`bigint`,object:`date`},dr=A(`$ZodCheckLessThan`,(e,t)=>{P.init(e,t);let n=ur[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:ur[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fr=A(`$ZodCheckGreaterThan`,(e,t)=>{P.init(e,t);let n=ur[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:ur[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),pr=A(`$ZodCheckMultipleOf`,(e,t)=>{P.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`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):ht(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})}}),mr=A(`$ZodCheckNumberFormat`,(e,t)=>{P.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Dt[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=rr)}),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})}}),hr=A(`$ZodCheckMaxLength`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=lr),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,i=r.length;if((typeof r==`string`&&i>t.maximum?zt(r):i)<=t.maximum)return;let a=Bt(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),gr=A(`$ZodCheckMinLength`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=lr),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,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?zt(r):i)>=t.minimum)return;let a=Bt(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),_r=A(`$ZodCheckLengthEquals`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=lr),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,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?zt(r):i;if(a===t.length)return;let o=Bt(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),vr=A(`$ZodCheckStringFormat`,(e,t)=>{var n,r;P.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=()=>{})}),yr=A(`$ZodCheckRegex`,(e,t)=>{vr.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})}}),br=A(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=sr,vr.init(e,t)}),xr=A(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=cr,vr.init(e,t)}),Sr=A(`$ZodCheckIncludes`,(e,t)=>{P.init(e,t);let n=b(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})}}),Cr=A(`$ZodCheckStartsWith`,(e,t)=>{P.init(e,t);let n=RegExp(`^${b(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})}}),wr=A(`$ZodCheckEndsWith`,(e,t)=>{P.init(e,t);let n=RegExp(`.*${b(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})}}),Tr=A(`$ZodCheckOverwrite`,(e,t)=>{P.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Er=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
4
- `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
5
- `)}\n};`)(...Object.values(this.closed))}};const Dr={major:4,minor:5,patch:4},F=A(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Dr;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=C(t),a;for(let o of n){if(o._zod.def.when){if(Ft(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new j;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Lt(t.issues,n,e),i||=C(t,n))});else{if(t.issues.length===n)continue;Lt(t.issues,n,e),i||=C(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(C(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new j;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new j;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Ut(this,`~standard`,kr(this))},set"~standard"(e){D(this,`~standard`,e)}}),Or=e=>e.success?{value:e.data}:{issues:e.error?.issues};function kr(e){return{validate:t=>{try{return Or(yn(e,t))}catch{return xn(e,t).then(Or)}},vendor:`zod`,version:1}}const Ar=A(`$ZodString`,(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??nr(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}}),I=A(`$ZodStringFormat`,(e,t)=>{vr.init(e,t),Ar.init(e,t)}),jr=A(`$ZodGUID`,(e,t)=>{t.pattern??=Rn,I.init(e,t)}),Mr=A(`$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??=zn(e)}else t.pattern??=zn();I.init(e,t)}),Nr=A(`$ZodEmail`,(e,t)=>{t.pattern??=Bn,I.init(e,t)});function Pr(e,t){if(!t.normalize&&t.protocol?.source===Jn.source&&!/^https?:\/\//i.test(e))return 1;try{return new URL(e)}catch{return 2}}const Fr=/[\t\n\r]/g;function Ir(e){return e.replace(Fr,``)}function Lr(e,t){return t.lastIndex=0,t.test(e.hostname)}function Rr(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}const zr=A(`$ZodURL`,(e,t)=>{I.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Pr(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}t.hostname&&!Lr(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Rr(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Ir(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Br=A(`$ZodEmoji`,(e,t)=>{t.pattern??=Vn(),I.init(e,t)}),Vr=A(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Fn:In(t.length),I.init(e,t)}),Hr=A(`$ZodCUID`,(e,t)=>{t.pattern??=An,I.init(e,t)}),Ur=A(`$ZodCUID2`,(e,t)=>{t.pattern??=jn,I.init(e,t)}),Wr=A(`$ZodULID`,(e,t)=>{t.pattern??=Mn,I.init(e,t)}),Gr=A(`$ZodXID`,(e,t)=>{t.pattern??=Nn,I.init(e,t)}),Kr=A(`$ZodKSUID`,(e,t)=>{t.pattern??=Pn,I.init(e,t)}),qr=A(`$ZodISODateTime`,(e,t)=>{t.pattern??=tr(t),I.init(e,t),(t.local||t.precision===-1)&&(e._zod.bag.laxFormat=!0,e._zod.onattach.push(e=>{e._zod.bag.laxFormat=!0}))}),Jr=A(`$ZodISODate`,(e,t)=>{t.pattern??=Qn,I.init(e,t)}),Yr=A(`$ZodISOTime`,(e,t)=>{t.pattern??=er(t),I.init(e,t)}),Xr=A(`$ZodISODuration`,(e,t)=>{t.pattern??=Ln,I.init(e,t)}),Zr=A(`$ZodIPv4`,(e,t)=>{t.pattern??=Hn,I.init(e,t),e._zod.bag.format=`ipv4`}),Qr=/^[0-9a-fA-F:.]+$/;function $r(e){if(!Qr.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}const ei=A(`$ZodIPv6`,(e,t)=>{t.pattern??=Un,I.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{$r(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),ti=A(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Wn,I.init(e,t)});function ni(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:$r(n)}const ri=A(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Gn,I.init(e,t),e._zod.check=n=>{ni(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function ii(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const ai=A(`$ZodBase64`,(e,t)=>{t.pattern??=Kn,I.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{ii(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function oi(e){if(!qn.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return ii(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const si=A(`$ZodBase64URL`,(e,t)=>{t.pattern??=qn,I.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{oi(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),ci=A(`$ZodE164`,(e,t)=>{t.pattern??=Yn,I.init(e,t)});function li(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const ui=A(`$ZodJWT`,(e,t)=>{I.init(e,t),e._zod.check=n=>{li(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),di=A(`$ZodNumber`,(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??ir,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:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),fi=A(`$ZodNumberFormat`,(e,t)=>{mr.init(e,t),di.init(e,t)}),pi=A(`$ZodBoolean`,(e,t)=>{F.init(e,t),e._zod.pattern=ar,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}}),mi=A(`$ZodNull`,(e,t)=>{F.init(e,t),e._zod.pattern=or,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}}),hi=A(`$ZodAny`,(e,t)=>{F.init(e,t),e._zod.parse=e=>e}),gi=A(`$ZodUnknown`,(e,t)=>{F.init(e,t),e._zod.parse=e=>e}),_i=A(`$ZodNever`,(e,t)=>{F.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function vi(e,t,n){e.issues.length&&t.issues.push(...w(n,e.issues)),t.value[n]=e.value}const yi=A(`$ZodArray`,(e,t)=>{F.init(e,t);let n=M.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[];for(let e=0;e<a.length;e++){let n=a[e],s=t.element._zod.run({value:n,issues:[]},i);s instanceof Promise?o.push(s.then(t=>vi(t,r,e))):vi(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function bi(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...w(n,e.issues))}if(!o&&i===void 0){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}}const xi=[];function Si(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:xi,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Et(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Ci(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin,d=c.optout;for(let i in t){if(s.has(i))continue;if(i===`__proto__`){l===`never`&&o.push(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=>bi(e,n,i,t,u,d))):bi(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const wi=new WeakMap,Ti=A(`$ZodObject`,(e,t)=>{if(F.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;wi.set(t,e),Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),wi.set(t,n),n}})}let n=ft(()=>Si(t));k(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||_(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let r=xt,i=t.catchall,a,o=M.memoizer;o?.attach(e),e._zod.parse=(t,s)=>{a??=n.value;let c=t.value;if(!r(c))return t.issues.push({expected:`object`,code:`invalid_type`,input:c,inst:e}),t;t.value=o?o.alloc(e,t,{},s):{};let l=[],u=a.shape;for(let e of a.allKeys){if(e===`__proto__`)continue;let n=u[e],r=n._zod.optin,i=n._zod.optout,a=n._zod.run({value:c[e],issues:[]},s);a instanceof Promise?l.push(a.then(n=>bi(n,t,e,c,r,i))):bi(a,t,e,c,r,i)}return i?Ci(l,c,t,s,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),Ei=A(`$ZodObjectJIT`,(e,t)=>{Ti.init(e,t);let n=e._zod.parse,r=ft(()=>Si(t)),i=M.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Er([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
6
- for (let i = 0; i < ${e}.issues.length; i++) {
7
- const iss = ${e}.issues[i];
8
- iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
9
- payload.issues.push(iss);
10
- }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:vt(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
11
- const ${n}_present = ${i};
12
- if (!${n}.issues.length || ${n}_present) {
13
- if (${n}.issues.length) {${c(n,r)}
14
- }
15
-
16
- if (${e}) {
17
- newResult[${r}] = ${n}.value;
18
- }
19
- }
20
-
21
- `)}else f?o.write(`
22
- if (${n}.issues.length) {${c(n,r)}
23
- }
24
-
25
- if (${n}.value === undefined) {
26
- if (${i}) {
27
- newResult[${r}] = undefined;
28
- }
29
- } else {
30
- newResult[${r}] = ${n}.value;
31
- }
32
-
33
- `):o.write(`
34
- const ${n}_present = ${i};
35
- if (${n}.issues.length) {${c(n,r)}
36
- }
37
- if (!${n}_present && !${n}.issues.length) {
38
- payload.issues.push({
39
- code: "invalid_type",
40
- expected: "nonoptional",
41
- input: undefined,
42
- path: [${r}]
43
- });
44
- }
45
-
46
- if (${n}_present) {
47
- newResult[${r}] = ${n}.value;
48
- }
49
-
50
- `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=xt,c=!M.jitless,l=c&&St.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Ci([],p,i,f,d,e):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Di(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=>!C(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=>T(e,r,N())))}),t)}const Oi=A(`$ZodUnion`,(e,t)=>{F.init(e,t),k(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),k(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),k(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),k(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>mt(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=>Di(t,r,e,i)):Di(o,r,e,i)}}),ki=A(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Oi.init(e,t);let n=e._zod.parse;k(e,`propValues`,e=>{let t={};for(let n of e.def.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(n)}"`);for(let[e,n]of Object.entries(r)){Object.prototype.hasOwnProperty.call(t,e)||_(t,e,new Set);for(let r of n)t[e].add(r)}}return t}),t.options.forEach((e,n)=>{let r=wi.get(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=ft(()=>{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(!xt(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)}}),Ai=A(`$ZodIntersection`,(e,t)=>{F.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])=>Mi(e,t,n)):Mi(e,i,a)}});function ji(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(y(e)&&y(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=ji(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=ji(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 Mi(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=ji(t.value,n.value);if(!c.valid){if(C(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const Ni=A(`$ZodTuple`,(e,t)=>{F.init(e,t);let n=t.items,r=M.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=Pi(n,`optin`),l=Pi(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):u[e]=t}if(t.rest){let e=n.length-1,r=o.slice(n.length);for(let n of r){e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>Fi(t,i,e))):Fi(r,i,e)}}return s.length?Promise.all(s).then(()=>Ii(u,i,n,o,l)):Ii(u,i,n,o,l)}});function Pi(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function Fi(e,t,n){e.issues.length&&t.issues.push(...w(n,e.issues)),t.value[n]=e.value}function Ii(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...w(a,o.issues))}t.value[a]=o.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}const Li=A(`$ZodRecord`,(e,t)=>{F.init(e,t);let n=M.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!y(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>T(e,i,N())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...w(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...w(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&ir.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>T(e,i,N())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...w(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...w(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Ri=A(`$ZodEnum`,(e,t)=>{F.init(e,t);let n=lt(t.entries),r=new Set(n);e._zod.values=r;let i=n.filter(e=>wt.has(typeof e));e._zod.pattern=RegExp(i.length?`^(${i.map(e=>b(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`),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}}),zi=A(`$ZodLiteral`,(e,t)=>{F.init(e,t);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(t.values.length?`^(${t.values.map(e=>typeof e==`string`?b(e):e?b(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`),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}}),Bi=A(`$ZodTransform`,(e,t)=>{F.init(e,t),e._zod.optin=`optional`,M.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new tn(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new j;return n.value=i,n}});function Vi(e,t){return e.value=t.issues.length?void 0:t.value,e}const Hi=A(`$ZodOptional`,(e,t)=>{F.init(e,t),k(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,k(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),k(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${mt(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Vi(e,t)):Vi(e,r)}return t.innerType._zod.run(e,n)}}),Ui=A(`$ZodExactOptional`,(e,t)=>{Hi.init(e,t),k(e,`values`,e=>e.def.innerType._zod.values),k(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Wi=A(`$ZodNullable`,(e,t)=>{F.init(e,t),k(e,`optin`,e=>e.def.innerType._zod.optin),k(e,`optout`,e=>e.def.innerType._zod.optout),k(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${mt(t.source)}|null)$`):void 0}),k(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Gi=A(`$ZodDefault`,(e,t)=>{F.init(e,t),e._zod.optin=`defaulted`,k(e,`values`,e=>e.def.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=>Ki(e,t)):Ki(r,t)}});function Ki(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const qi=A(`$ZodPrefault`,(e,t)=>{F.init(e,t),e._zod.optin=`defaulted`,k(e,`values`,e=>e.def.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))}),Ji=A(`$ZodNonOptional`,(e,t)=>{F.init(e,t),k(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].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=>Yi(t,e)):Yi(i,e)}});function Yi(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Xi(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>T(e,r,N()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const Zi=A(`$ZodCatch`,(e,t)=>{F.init(e,t),k(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),k(e,`optout`,e=>e.def.innerType._zod.optout),k(e,`values`,e=>e.def.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({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Xi(e,r,t,n)):Xi(e,r,t,n)}}),Qi=A(`$ZodPipe`,(e,t)=>{F.init(e,t),k(e,`values`,e=>e.def.in._zod.values),k(e,`optin`,e=>e.def.in._zod.optin),k(e,`optout`,e=>e.def.out._zod.optout),k(e,`propValues`,e=>e.def.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=>$i(e,t.in,n)):$i(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>$i(e,t.out,n)):$i(r,t.out,n)}});function $i(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const ea=A(`$ZodReadonly`,(e,t)=>{F.init(e,t),k(e,`propValues`,e=>e.def.innerType._zod.propValues),k(e,`values`,e=>e.def.innerType._zod.values),k(e,`optin`,e=>e.def.innerType?._zod?.optin),k(e,`optout`,e=>e.def.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(ta):ta(r)}});function ta(e){return e.memo||(e.value=Object.freeze(e.value)),e}const na=A(`$ZodLazy`,(e,t)=>{F.init(e,t),_t(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),k(e,`pattern`,e=>e.innerType?._zod?.pattern),k(e,`propValues`,e=>e.innerType?._zod?.propValues),k(e,`optin`,e=>e.innerType?._zod?.optin??void 0),k(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),ra=A(`$ZodCustom`,(e,t)=>{P.init(e,t),F.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=>ia(t,n,r,e));ia(i,n,r,e)}});function ia(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(E(e))}}var aa=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};const oa=`~memo`,sa=[];function ca(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const la=new WeakMap;function ua(e,t){let n=la.get(e);if(n!==void 0)return n;if(t.has(e))return!0;t.add(e);let r=!1,i=e=>{!r&&e?._zod&&ua(e,t)&&(r=!0)},a=e._zod.def;switch(a.type){case`object`:for(let e of Reflect.ownKeys(a.shape))i(a.shape[e]);i(a.catchall);break;case`array`:i(a.element);break;case`tuple`:for(let e of a.items)i(e);i(a.rest);break;case`record`:case`map`:i(a.keyType),i(a.valueType);break;case`set`:i(a.valueType);break;case`union`:for(let e of a.options)i(e);break;case`intersection`:i(a.left),i(a.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:i(a.innerType);break;case`pipe`:i(a.in),i(a.out);break;case`function`:i(a.input),i(a.output);break;case`lazy`:i(e._zod.innerType);break;case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in a){let t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)i(n);else if(Array.isArray(n))for(let e of n)i(e)}}}return t.delete(e),la.set(e,r),r}function da(e,t){let n=e.buckets.get(t);return n||(n=new Map,e.buckets.set(t,n)),n}let fa;const pa=[],ma={alloc(e,t,n){let r=fa;if(!r)return n;fa=void 0;let i={value:n,issues:null};return r.set(t.value,i),pa.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&ga(n,e.value))throw new aa;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,a=(o,s)=>{if(n===void 0&&(n=ua(e,new Set),!n))return e._zod.parse=t,e._zod.run===a&&(e._zod.run=t),t(o,s);let c=o.value;if(typeof c!=`object`||!c)return t(o,s);let l=s[oa];l||(l={buckets:new Map,backEdges:void 0},s[oa]=l);let u;r===s?u=i:(u=da(l,e),r=s,i=u);let d=u.get(c);if(d)return o.value=d.value,d.issues?d.issues.length&&o.issues.push(...ca(d.issues)):(o.memo=!0,l.backEdges??(l.backEdges=new Set),l.backEdges.add(d.value)),o;fa=u;let f=pa.length,p=t(o,s);fa=void 0;let m=pa.length>f?pa.pop():void 0;return p instanceof Promise?p.then(e=>(m&&(m.issues=e.issues.length?ca(e.issues):sa),e)):(m&&(m.issues=p.issues.length?ca(p.issues):sa),p)};e._zod.parse=a,e._zod.run===t&&(e._zod.run=a)})}};function ha(){return ma}function ga(e,t){let n=e[oa]?.backEdges;return n!==void 0&&typeof t==`object`&&!!t&&n.has(t)}const _a=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,credit_card:`credit card number`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Vt(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Tt(e.values[0])}`:`Invalid option: expected one of ${ut(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${ut(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function va(){return{localeError:_a()}}var ya,ba=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 xa(){return new ba}(ya=globalThis).__zod_globalRegistry??(ya.__zod_globalRegistry=xa());const Sa=globalThis.__zod_globalRegistry;function Ca(e,t){return new e({type:`string`,...S(t)})}function wa(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...S(t)})}function Ta(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...S(t)})}function Ea(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...S(t)})}function Da(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...S(t)})}function Oa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...S(t)})}function ka(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...S(t)})}function Aa(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...S(t)})}function ja(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...S(t)})}function Ma(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...S(t)})}function Na(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...S(t)})}function Pa(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...S(t)})}function Fa(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...S(t)})}function Ia(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...S(t)})}function La(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...S(t)})}function Ra(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...S(t)})}function za(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...S(t)})}function Ba(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...S(t)})}function Va(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...S(t)})}function Ha(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...S(t)})}function Ua(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...S(t)})}function Wa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...S(t)})}function Ga(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...S(t)})}function Ka(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...S(t)})}function qa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...S(t)})}function Ja(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...S(t)})}function Ya(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...S(t)})}function Xa(e,t){return new e({type:`number`,checks:[],...S(t)})}function Za(e,t){return new e({type:`number`,coerce:!0,checks:[],...S(t)})}function Qa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...S(t)})}function $a(e,t){return new e({type:`boolean`,...S(t)})}function eo(e,t){return new e({type:`null`,...S(t)})}function to(e){return new e({type:`any`})}function no(e){return new e({type:`unknown`})}function ro(e,t){return new e({type:`never`,...S(t)})}function io(e,t){return new dr({check:`less_than`,...S(t),value:e,inclusive:!1})}function ao(e,t){return new dr({check:`less_than`,...S(t),value:e,inclusive:!0})}function oo(e,t){return new fr({check:`greater_than`,...S(t),value:e,inclusive:!1})}function so(e,t){return new fr({check:`greater_than`,...S(t),value:e,inclusive:!0})}function co(e,t){return new pr({check:`multiple_of`,...S(t),value:e})}function lo(e,t){return new hr({check:`max_length`,...S(t),maximum:e})}function uo(e,t){return new gr({check:`min_length`,...S(t),minimum:e})}function fo(e,t){return new _r({check:`length_equals`,...S(t),length:e})}function po(e,t){return new yr({check:`string_format`,format:`regex`,...S(t),pattern:e})}function mo(e){return new br({check:`string_format`,format:`lowercase`,...S(e)})}function ho(e){return new xr({check:`string_format`,format:`uppercase`,...S(e)})}function go(e,t){return new Sr({check:`string_format`,format:`includes`,...S(t),includes:e})}function _o(e,t){return new Cr({check:`string_format`,format:`starts_with`,...S(t),prefix:e})}function vo(e,t){return new wr({check:`string_format`,format:`ends_with`,...S(t),suffix:e})}function L(e){return new Tr({check:`overwrite`,tx:e})}function yo(e){return L(t=>t.normalize(e))}function bo(){return L(e=>e.trim())}function xo(){return L(e=>e.toLowerCase())}function So(){return L(e=>e.toUpperCase())}function Co(){return L(e=>yt(e))}function wo(e,t,n){return new e({type:`array`,element:t,...S(n)})}function To(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...S(n)})}function Eo(e,t){let n=Do(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(E(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(E(r))}},e(t.value,t)),t);return n}function Do(e,t){let n=new P({check:`custom`,...S(t)});return n._zod.check=e,n}function Oo(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&_(e,t,n[t]);return e}function ko(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??Sa,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function R(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function z(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),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;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,z(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Oo(o.schema,c),t.io===`input`&&B(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 Ao(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function jo(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let 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}/${Ao(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ao(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>
51
-
52
- 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}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Mo(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Mo(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const No=new Set([`type`,`properties`,`required`,`additionalProperties`]),Po=[`oneOf`,`anyOf`];function Fo(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Io(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!No.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Fo(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}_(n,r,e.length===1?e[0]:Io(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Fo(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Lo(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of No)if(t in e)return;let n=t.filter(e=>Po.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Io(t);else{let e=n[0],i=Po.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Io([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Oo(e,r))}function Ro(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)):Oo(i,s),Oo(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Mo(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Lo(e)}}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)}Oo(i,n.defId?n.schema: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??{};if(!e.external||e.sharedEmitDoneFor!==e.external)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&&(e.sharedEmitDoneFor=e.external),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:Bo(t,`input`,e.processors),output:Bo(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function B(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 B(r.element,n);if(r.type===`set`)return B(r.valueType,n);if(r.type===`lazy`)return B(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return B(r.innerType,n);if(r.type===`intersection`)return B(r.left,n)||B(r.right,n);if(r.type===`record`||r.type===`map`)return B(r.keyType,n)||B(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:B(r.in,n)||B(r.out,n);if(r.type===`object`){for(let e in r.shape)if(B(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(B(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(B(e,n))return!0;return!!(r.rest&&B(r.rest,n))}return!1}const zo=(e,t={})=>n=>{let r=ko({...n,processors:t});return z(e,r),jo(r,e),Ro(r,e)},Bo=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ko({...i??{},target:a,io:t,processors:n});return z(e,o),jo(o,e),Ro(o,e)},Vo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ho=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Vo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&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}))])}},Uo=(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),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(Number.isFinite(c)&&c!==0?i.multipleOf=Math.abs(c):R(e,t,i,r,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))},Wo=(e,t,n,r)=>{n.type=`boolean`},Go=(e,t,n,r)=>{R(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},Ko=(e,t,n,r)=>{R(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},qo=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Jo=(e,t,n,r)=>{R(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},Yo=(e,t,n,r)=>{R(e,t,n,r,`Void cannot be represented in JSON Schema`)},Xo=(e,t,n,r)=>{n.not={}},Zo=(e,t,n,r)=>{},Qo=(e,t,n,r)=>{},$o=(e,t,n,r)=>{R(e,t,n,r,`Date cannot be represented in JSON Schema`)},es=(e,t,n,r)=>{let i=e._zod.def,a=lt(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ts=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(R(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(R(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);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}},ns=(e,t,n,r)=>{R(e,t,n,r,`NaN cannot be represented in JSON Schema`)},rs=(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},is=(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)},as=(e,t,n,r)=>{n.type=`boolean`},os=(e,t,n,r)=>{R(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},ss=(e,t,n,r)=>{R(e,t,n,r,`Function types cannot be represented in JSON Schema`)},cs=(e,t,n,r)=>{R(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},ls=(e,t,n,r)=>{R(e,t,n,r,`Map cannot be represented in JSON Schema`)},us=(e,t,n,r)=>{R(e,t,n,r,`Set cannot be represented in JSON Schema`)},ds=(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=z(a.element,t,{...r,path:[...r.path,`items`]})};function V(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?V(t.out):t.type===`catch`?V(t.innerType):e._zod.optin}const fs=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&R(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)_(i.properties,e,z(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];return t.io===`input`?V(n)===void 0:n._zod.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=z(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ps=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>z(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ms=(e,t,n,r)=>{let i=e._zod.def,a=z(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=z(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},hs=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>z(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?z(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?V(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=e._zod.bag;typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function gs(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=gs(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>gs(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?ir:rr).source),p):p}const _s=new WeakMap;function vs(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of _s.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=gs(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}const ys=(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=z(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)_(i.patternProperties,t.source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=z(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=_s.get(t);n||(n=[],_s.set(t,n),t.deferred.push(()=>vs(t))),n.push(e)}i.additionalProperties=z(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&V(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},bs=(e,t,n,r)=>{let i=e._zod.def,a=z(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`}]},xs=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ss=Symbol();function Cs(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(R(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Ss):JSON.parse(o)}const ws=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Cs(i.defaultValue,e,t,n,r);o!==Ss&&(n.default=o)},Ts=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Cs(i.defaultValue,e,t,n,r);o!==Ss&&(n._prefault=o)},Es=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{R(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Ds=(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;z(o,t,r);let s=t.seen.get(e);s.ref=o},Os=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ks=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},As=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},js=(e,t,n,r)=>{let i=e._zod.innerType;z(i,t,r);let a=t.seen.get(e);a.ref=i},Ms={string:Ho,number:Uo,boolean:Wo,bigint:Go,symbol:Ko,null:qo,undefined:Jo,void:Yo,never:Xo,any:Zo,unknown:Qo,date:$o,enum:es,literal:ts,nan:ns,template_literal:rs,file:is,success:as,custom:os,function:ss,transform:cs,map:ls,set:us,array:ds,object:fs,union:ps,intersection:ms,tuple:hs,record:ys,nullable:bs,nonoptional:xs,default:ws,prefault:Ts,catch:Es,pipe:Ds,readonly:Os,promise:ks,optional:As,lazy:js};function Ns(e,t){if(`_idmap`in e){let n=e,r=ko({...t,processors:Ms}),i={};for(let e of n._idmap.entries()){let[t,n]=e;z(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;jo(r,n),_(a,t,Ro(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=ko({...t,processors:Ms});return z(e,n),jo(n,e),Ro(n,e)}const Ps=new WeakSet([Object.prototype,Error.prototype]);function Fs(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}const H=A(`ZodError`,(e,t)=>{un.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Ps.has(n)||(Ps.add(n),Fs(n,`format`,e=>t=>mn(e,t)),Fs(n,`flatten`,e=>t=>pn(e,t)),Fs(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,dt,2)}),Fs(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,dt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Is=gn(H),Ls=_n(H),Rs=vn(H),zs=bn(H),Bs=Sn(H),Vs=Cn(H),Hs=wn(H),Us=Tn(H),Ws=En(H),Gs=Dn(H),Ks=On(H),qs=kn(H);function Js(){M.localeError||N(va())}function Ys(){M.memoizer||N({memoizer:ha()})}const U=A(`ZodType`,(e,t)=>(Js(),F.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(v(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return x(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Tl(e,t))},superRefine(e,t){return this.check(El(e,t))},overwrite(e){return this.check(L(e))},optional(){return al(this)},exactOptional(){return sl(this)},nullable(){return ll(this)},nullish(){return al(ll(this))},nonoptional(e){return hl(this,e)},array(){return Rc(this)},or(e){return Uc([this,e])},and(e){return qc(this,e)},transform(e){return yl(this,rl(e))},default(e){return dl(this,e)},prefault(e){return pl(this,e)},catch(e){return _l(this,e)},pipe(e){return yl(this,e)},readonly(){return xl(this)},describe(e){let t=this.clone();return Sa.add(t,{description:e}),t},meta(...e){if(e.length===0)return Sa.get(this);let t=this.clone();return Sa.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Ut(this,`~standard`,{...kr(this),jsonSchema:{input:Bo(this,`input`),output:Bo(this,`output`)}})},set"~standard"(e){D(this,`~standard`,e)},parse:function e(t,n){return Is(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Ls(this,t,n,{callee:e})},safeParse(e,t){return Rs(this,e,t)},async safeParseAsync(e,t){return zs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){D(this,`spa`,e)},encode:function e(t,n){return Bs(this,t,n,{callee:e})},decode:function e(t,n){return Vs(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Hs(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Us(this,t,n,{callee:e})},safeEncode(e,t){return Ws(this,e,t)},safeDecode(e,t){return Gs(this,e,t)},async safeEncodeAsync(e,t){return Ks(this,e,t)},async safeDecodeAsync(e,t){return qs(this,e,t)},toJSONSchema(e){return zo(this,{})(e)},get description(){return Sa.get(this)?.description},get _def(){return this._zod.def}}),Xs=A(`_ZodString`,(e,t)=>{Ar.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(po(...e))},includes(...e){return this.check(go(...e))},startsWith(...e){return this.check(_o(...e))},endsWith(...e){return this.check(vo(...e))},min(...e){return this.check(uo(...e))},max(...e){return this.check(lo(...e))},length(...e){return this.check(fo(...e))},nonempty(...e){return this.check(uo(1,...e))},lowercase(e){return this.check(mo(e))},uppercase(e){return this.check(ho(e))},trim(){return this.check(bo())},normalize(...e){return this.check(yo(...e))},toLowerCase(){return this.check(xo())},toUpperCase(){return this.check(So())},slugify(){return this.check(Co())}}),Zs=A(`ZodString`,(e,t)=>{Ar.init(e,t),Xs.init(e,t)},{email(e){return this.check(wa(rc,e))},url(e){return this.check(Aa(oc,e))},jwt(e){return this.check(Ga(Sc,e))},emoji(e){return this.check(ja(sc,e))},guid(e){return this.check(Ta(ic,e))},uuid(e){return this.check(Ea(ac,e))},uuidv4(e){return this.check(Da(ac,e))},uuidv6(e){return this.check(Oa(ac,e))},uuidv7(e){return this.check(ka(ac,e))},nanoid(e){return this.check(Ma(cc,e))},cuid(e){return this.check(Na(lc,e))},cuid2(e){return this.check(Pa(uc,e))},ulid(e){return this.check(Fa(dc,e))},base64(e){return this.check(Ha(vc,e))},base64url(e){return this.check(Ua(bc,e))},xid(e){return this.check(Ia(fc,e))},ksuid(e){return this.check(La(pc,e))},ipv4(e){return this.check(Ra(mc,e))},ipv6(e){return this.check(za(hc,e))},cidrv4(e){return this.check(Ba(gc,e))},cidrv6(e){return this.check(Va(_c,e))},e164(e){return this.check(Wa(xc,e))},datetime(e){return this.check(Ka($s,e))},date(e){return this.check(qa(ec,e))},time(e){return this.check(Ja(tc,e))},duration(e){return this.check(Ya(nc,e))}});function Qs(e){return Ca(Zs,e)}const W=A(`ZodStringFormat`,(e,t)=>{I.init(e,t),Xs.init(e,t)}),$s=A(`ZodISODateTime`,(e,t)=>{qr.init(e,t),W.init(e,t)}),ec=A(`ZodISODate`,(e,t)=>{Jr.init(e,t),W.init(e,t)}),tc=A(`ZodISOTime`,(e,t)=>{Yr.init(e,t),W.init(e,t)}),nc=A(`ZodISODuration`,(e,t)=>{Xr.init(e,t),W.init(e,t)}),rc=A(`ZodEmail`,(e,t)=>{Nr.init(e,t),W.init(e,t)}),ic=A(`ZodGUID`,(e,t)=>{jr.init(e,t),W.init(e,t)}),ac=A(`ZodUUID`,(e,t)=>{Mr.init(e,t),W.init(e,t)}),oc=A(`ZodURL`,(e,t)=>{zr.init(e,t),W.init(e,t)}),sc=A(`ZodEmoji`,(e,t)=>{Br.init(e,t),W.init(e,t)}),cc=A(`ZodNanoID`,(e,t)=>{Vr.init(e,t),W.init(e,t)}),lc=A(`ZodCUID`,(e,t)=>{Hr.init(e,t),W.init(e,t)}),uc=A(`ZodCUID2`,(e,t)=>{Ur.init(e,t),W.init(e,t)}),dc=A(`ZodULID`,(e,t)=>{Wr.init(e,t),W.init(e,t)}),fc=A(`ZodXID`,(e,t)=>{Gr.init(e,t),W.init(e,t)}),pc=A(`ZodKSUID`,(e,t)=>{Kr.init(e,t),W.init(e,t)}),mc=A(`ZodIPv4`,(e,t)=>{Zr.init(e,t),W.init(e,t)}),hc=A(`ZodIPv6`,(e,t)=>{ei.init(e,t),W.init(e,t)}),gc=A(`ZodCIDRv4`,(e,t)=>{ti.init(e,t),W.init(e,t)}),_c=A(`ZodCIDRv6`,(e,t)=>{ri.init(e,t),W.init(e,t)}),vc=A(`ZodBase64`,(e,t)=>{ai.init(e,t),W.init(e,t)});function yc(e){return Ha(vc,e)}const bc=A(`ZodBase64URL`,(e,t)=>{si.init(e,t),W.init(e,t)}),xc=A(`ZodE164`,(e,t)=>{ci.init(e,t),W.init(e,t)}),Sc=A(`ZodJWT`,(e,t)=>{ui.init(e,t),W.init(e,t)}),Cc=A(`ZodNumber`,(e,t)=>{di.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r);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},{gt(e,t){return this.check(oo(e,t))},gte(e,t){return this.check(so(e,t))},min(e,t){return this.check(so(e,t))},lt(e,t){return this.check(io(e,t))},lte(e,t){return this.check(ao(e,t))},max(e,t){return this.check(ao(e,t))},int(e){return this.check(Ec(e))},safe(e){return this.check(Ec(e))},positive(e){return this.check(oo(0,e))},nonnegative(e){return this.check(so(0,e))},negative(e){return this.check(io(0,e))},nonpositive(e){return this.check(ao(0,e))},multipleOf(e,t){return this.check(co(e,t))},step(e,t){return this.check(co(e,t))},finite(){return this}});function wc(e){return Xa(Cc,e)}const Tc=A(`ZodNumberFormat`,(e,t)=>{fi.init(e,t),Cc.init(e,t)});function Ec(e){return Qa(Tc,e)}const Dc=A(`ZodBoolean`,(e,t)=>{pi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r)});function Oc(e){return $a(Dc,e)}const kc=A(`ZodNull`,(e,t)=>{mi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r)});function Ac(e){return eo(kc,e)}const jc=A(`ZodAny`,(e,t)=>{hi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Mc(){return to(jc)}const Nc=A(`ZodUnknown`,(e,t)=>{gi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Pc(){return no(Nc)}const Fc=A(`ZodNever`,(e,t)=>{_i.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r)});function Ic(e){return ro(Fc,e)}const Lc=A(`ZodArray`,(e,t)=>{Ys(),yi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ds(e,t,n,r),e.element=t.element},{min(e,t){return this.check(uo(e,t))},nonempty(e){return this.check(uo(1,e))},max(e,t){return this.check(lo(e,t))},length(e,t){return this.check(fo(e,t))},unwrap(){return this.element}});function Rc(e,t){return wo(Lc,e,t)}const zc=A(`ZodObject`,(e,t)=>{Ys(),Ei.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fs(e,t,n,r),Jt(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return $c(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Pc()})},loose(){return this.clone({...this._zod.def,catchall:Pc()})},strict(){return this.clone({...this._zod.def,catchall:Ic()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return At(this,e)},safeExtend(e){return jt(this,e)},merge(e){return Mt(this,e)},pick(e){return Ot(this,e)},omit(e){return kt(this,e)},partial(...e){return Nt(il,this,e[0])},exactPartial(...e){return Nt(ol,this,e[0],`exactPartial`)},required(...e){return Pt(ml,this,e[0])}});function Bc(e,t){let n={type:`object`,shape:e??{},...S(t)};return new zc(n)}function Vc(e,t){return new zc({type:`object`,shape:e,catchall:Pc(),...S(t)})}const Hc=A(`ZodUnion`,(e,t)=>{Oi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ps(e,t,n,r),e.options=t.options});function Uc(e,t){return new Hc({type:`union`,options:e,...S(t)})}const Wc=A(`ZodDiscriminatedUnion`,(e,t)=>{Hc.init(e,t),ki.init(e,t)});function Gc(e,t,n){return new Wc({type:`union`,options:t,discriminator:e,...S(n)})}const Kc=A(`ZodIntersection`,(e,t)=>{Ai.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ms(e,t,n,r)});function qc(e,t){return new Kc({type:`intersection`,left:e,right:t})}const Jc=A(`ZodTuple`,(e,t)=>{Ys(),Ni.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hs(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new il({type:`optional`,innerType:e}))})}});function Yc(e,t,n){let r=t instanceof F;return new Jc({type:`tuple`,items:e,rest:r?t:null,...S(r?n:t)})}const Xc=A(`ZodRecord`,(e,t)=>{Ys(),Li.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ys(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Zc(e,t,n){return!t||!t._zod?new Xc({type:`record`,keyType:Qs(),valueType:e,...S(t)}):new Xc({type:`record`,keyType:e,valueType:t,...S(n)})}const Qc=A(`ZodEnum`,(e,t)=>{Ri.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>es(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 Qc({...t,checks:[],...S(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 Qc({...t,checks:[],...S(r),entries:i})}});function $c(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Qc({type:`enum`,entries:n,...S(t)})}const el=A(`ZodLiteral`,(e,t)=>{zi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ts(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 tl(e,t){return new el({type:`literal`,values:Array.isArray(e)?e:[e],...S(t)})}const nl=A(`ZodTransform`,(e,t)=>{Ys(),Bi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cs(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new tn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(E(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(E(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function rl(e){return new nl({type:`transform`,transform:e})}const il=A(`ZodOptional`,(e,t)=>{Hi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>As(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function al(e){return new il({type:`optional`,innerType:e})}const ol=A(`ZodExactOptional`,(e,t)=>{Ui.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>As(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sl(e){return new ol({type:`optional`,innerType:e})}const cl=A(`ZodNullable`,(e,t)=>{Wi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ll(e){return new cl({type:`nullable`,innerType:e})}const ul=A(`ZodDefault`,(e,t)=>{Gi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ws(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dl(e,t){return new ul({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ct(t)}})}const fl=A(`ZodPrefault`,(e,t)=>{qi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ts(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pl(e,t){return new fl({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ct(t)}})}const ml=A(`ZodNonOptional`,(e,t)=>{Ji.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hl(e,t){return new ml({type:`nonoptional`,innerType:e,...S(t)})}const gl=A(`ZodCatch`,(e,t)=>{Zi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Es(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _l(e,t){return new gl({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Yt(t)})}const vl=A(`ZodPipe`,(e,t)=>{Qi.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ds(e,t,n,r),e.in=t.in,e.out=t.out});function yl(e,t){return new vl({type:`pipe`,in:e,out:t})}const bl=A(`ZodReadonly`,(e,t)=>{ea.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Os(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xl(e){return new bl({type:`readonly`,innerType:e})}const Sl=A(`ZodLazy`,(e,t)=>{na.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>js(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Cl(e){return new Sl({type:`lazy`,getter:e})}const wl=A(`ZodCustom`,(e,t)=>{ra.init(e,t),U.init(e,t),e._zod.processJSONSchema=(t,n,r)=>os(e,t,n,r)});function Tl(e,t={}){return To(wl,e,t)}function El(e,t){return Eo(e,t)}var Dl=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function Ol(e){}function kl(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=Ol,onError:n=Ol,onRetry:r=Ol,onComment:i,maxBufferSize:a}=e,o=[],s=0,c=!0,l,u=``,d=0,f,p=!1;function m(e){if(p)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),o.length===0){let t=ee(e);t!==``&&(o.push(t),s=t.length),h();return}if(e.indexOf(`
53
- `)===-1&&e.indexOf(`\r`)===-1){o.push(e),s+=e.length,h();return}o.push(e);let t=o.join(``);o.length=0,s=0;let n=ee(t);n!==``&&(o.push(n),s=n.length),h()}function h(){a!==void 0&&(s+u.length<=a||(p=!0,o.length=0,s=0,l=void 0,u=``,d=0,f=void 0,n(new Dl(`Buffered data exceeded max buffer size of ${a} characters`,{type:`max-buffer-size-exceeded`}))))}function ee(e){let n=0;if(e.indexOf(`\r`)===-1){let r=e.indexOf(`
54
- `,n);for(;r!==-1;){if(n===r){d>0&&t({id:l,event:f,data:u}),l=void 0,u=``,d=0,f=void 0,n=r+1,r=e.indexOf(`
55
- `,n);continue}let i=e.charCodeAt(n);if(Al(e,n,i)){let i=e.charCodeAt(n+5)===32?n+6:n+5,a=e.slice(i,r);if(d===0&&e.charCodeAt(r+1)===10){t({id:l,event:f,data:a}),l=void 0,u=``,f=void 0,n=r+2,r=e.indexOf(`
56
- `,n);continue}u=d===0?a:`${u}
57
- ${a}`,d++}else jl(e,n,i)?f=e.slice(e.charCodeAt(n+6)===32?n+7:n+6,r)||void 0:g(e,n,r);n=r+1,r=e.indexOf(`
58
- `,n)}return e.slice(n)}for(;n<e.length;){let t=e.indexOf(`\r`,n),r=e.indexOf(`
59
- `,n),i=-1;if(t!==-1&&r!==-1?i=t<r?t:r:t===-1?r!==-1&&(i=r):i=t===e.length-1?-1:t,i===-1)break;g(e,n,i),n=i+1,e.charCodeAt(n-1)===13&&e.charCodeAt(n)===10&&n++}return e.slice(n)}function g(e,t,n){if(t===n){ne();return}let r=e.charCodeAt(t);if(Al(e,t,r)){let r=e.charCodeAt(t+5)===32?t+6:t+5,i=e.slice(r,n);u=d===0?i:`${u}
60
- ${i}`,d++;return}if(jl(e,t,r)){f=e.slice(e.charCodeAt(t+6)===32?t+7:t+6,n)||void 0;return}if(r===105&&e.charCodeAt(t+1)===100&&e.charCodeAt(t+2)===58){let r=e.slice(e.charCodeAt(t+3)===32?t+4:t+3,n);l=r.includes(`\0`)?void 0:r;return}if(r===58){if(i){let r=e.slice(t,n);i(r.slice(e.charCodeAt(t+1)===32?2:1))}return}let a=e.slice(t,n),o=a.indexOf(`:`);if(o===-1){te(a,``,a);return}let s=a.slice(0,o),c=a.charCodeAt(o+1)===32?2:1;te(s,a.slice(o+c),a)}function te(e,t,i){switch(e){case`event`:f=t||void 0;break;case`data`:u=d===0?t:`${u}
61
- ${t}`,d++;break;case`id`:l=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new Dl(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new Dl(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:`unknown-field`,field:e,value:t,line:i}))}}function ne(){d>0&&t({id:l,event:f,data:u}),l=void 0,u=``,d=0,f=void 0}function re(e={}){if(e.consume&&o.length>0){let e=o.join(``);g(e,0,e.length)}c=!0,l=void 0,u=``,d=0,f=void 0,o.length=0,s=0,p=!1}return{feed:m,reset:re}}function Al(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function jl(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}var Ml=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n,maxBufferSize:r}={}){let i;super({start(a){i=kl({onEvent:e=>{a.enqueue(e)},onError(t){typeof e==`function`&&e(t),(e===`terminate`||t.type===`max-buffer-size-exceeded`)&&a.error(t)},onRetry:t,onComment:n,maxBufferSize:r})},transform(e){i.feed(e)}})}};function Nl(...e){return e.reduce((e,t)=>({...e,...t??{}}),{})}function Pl(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>t!=null))}async function Fl(e,t){if(e==null)return Promise.resolve();let n=t?.abortSignal;return new Promise((t,r)=>{if(n?.aborted){r(Il());return}let i=setTimeout(()=>{a(),t()},e),a=()=>{clearTimeout(i),n?.removeEventListener(`abort`,o)},o=()=>{a(),r(Il())};n?.addEventListener(`abort`,o)})}function Il(){return new DOMException(`Delay was aborted`,`AbortError`)}function Ll(e){let t=e??globalThis.WebSocket;if(t==null)throw Error(`No WebSocket implementation available.`);return t}function Rl(e){let t=new URL(e);return t.protocol===`http:`?t.protocol=`ws:`:t.protocol===`https:`&&(t.protocol=`wss:`),t}var zl=new TextDecoder;async function Bl(e){return typeof e==`string`?e:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?zl.decode(e):typeof Blob<`u`&&e instanceof Blob?e.text():String(e)}var Vl=1;async function Hl(e,{highWaterMark:t=1048576,pollIntervalMs:n=20,abortSignal:r}={}){for(;e.readyState===Vl&&(e.bufferedAmount??0)>t;){if(r?.aborted===!0)return;await Fl(n)}}function Ul({url:e,protocols:t,headers:n,webSocket:r,abortSignal:i,onOpen:a,onMessageText:o,onProcessingError:s,onSocketError:c,onClose:l,onAbort:u}){let d,f,p=e=>{f!=null&&(i?.removeEventListener(`abort`,f),f=void 0);try{d?.close(e)}catch{}};if(i?.aborted)return u?.(i.reason??Error(`Aborted`)),{socket:void 0,close:p};try{d=new(Ll(r))(e,t,{headers:Pl(n??{})})}catch(e){return s(e),{socket:void 0,close:p}}i!=null&&u!=null&&(f=()=>u(i.reason??Error(`Aborted`)),i.addEventListener(`abort`,f,{once:!0}));let m=d;d.onopen=()=>{try{a?.(m)}catch(e){s(e)}};let h=Promise.resolve();return d.onmessage=e=>{h=h.then(()=>Bl(e.data)).then(e=>o(e)).catch(s)},d.onerror=()=>{h=h.then(()=>c?.()).catch(s)},d.onclose=e=>{let t=e,n=typeof t?.code==`number`?t.code:void 0,r=typeof t?.reason==`string`?t.reason:void 0;h=h.then(()=>l?.({code:n,reason:r})).catch(s)},{socket:d,close:p}}function Wl(e){let t=!1;return new ReadableStream({async pull(n){if(!t)try{let{value:t,done:r}=await e.next();r?n.close():n.enqueue(t)}catch(e){n.error(e)}},async cancel(n){if(t=!0,e.return)try{await e.return(n)}catch{}}})}var{btoa:Gl,atob:Kl}=globalThis;function ql(e){let t=Kl(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.codePointAt(0))}function Jl(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCodePoint(e[n]);return Gl(t)}function Yl(e){return e instanceof Uint8Array?Jl(e):e}function Xl(e){return e.type===`text`?new TextEncoder().encode(e.text):e.data instanceof Uint8Array?e.data:e.data instanceof ArrayBuffer?new Uint8Array(e.data):ql(e.data)}function Zl(e,t={}){let{useArrayBrackets:n=!0}=t,r=new FormData;for(let[t,i]of Object.entries(e))if(i!=null){if(Array.isArray(i)){if(i.length===1){r.append(t,i[0]);continue}let e=n?`${t}[]`:t;for(let t of i)r.append(e,t);continue}r.append(t,i)}return r}function Ql({id:e,model:t,created:n}){return{id:e??void 0,modelId:t??void 0,timestamp:n==null?void 0:new Date(n*1e3)}}function $l(){return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0}}function eu({tools:e=[],providerToolNames:t}){let n={},r={};for(let i of e)if(i.type===`provider`&&i.id in t){let e=t[i.id];n[i.name]=e,r[e]=i.name}return{toProviderToolName:e=>n[e]??e,toCustomToolName:e=>r[e]??e}}var tu=[{mediaType:`image/gif`,bytesPrefix:[71,73,70]},{mediaType:`image/png`,bytesPrefix:[137,80,78,71]},{mediaType:`image/jpeg`,bytesPrefix:[255,216]},{mediaType:`image/webp`,bytesPrefix:[82,73,70,70,null,null,null,null,87,69,66,80]},{mediaType:`image/bmp`,bytesPrefix:[66,77]},{mediaType:`image/tiff`,bytesPrefix:[73,73,42,0]},{mediaType:`image/tiff`,bytesPrefix:[77,77,0,42]},{mediaType:`image/avif`,bytesPrefix:[0,0,0,32,102,116,121,112,97,118,105,102]},{mediaType:`image/heic`,bytesPrefix:[0,0,0,32,102,116,121,112,104,101,105,99]}],nu=[{mediaType:`application/pdf`,bytesPrefix:[37,80,68,70]}],ru=[{mediaType:`audio/mpeg`,bytesPrefix:[255,251]},{mediaType:`audio/mpeg`,bytesPrefix:[255,250]},{mediaType:`audio/mpeg`,bytesPrefix:[255,243]},{mediaType:`audio/mpeg`,bytesPrefix:[255,242]},{mediaType:`audio/mpeg`,bytesPrefix:[255,227]},{mediaType:`audio/mpeg`,bytesPrefix:[255,226]},{mediaType:`audio/wav`,bytesPrefix:[82,73,70,70,null,null,null,null,87,65,86,69]},{mediaType:`audio/ogg`,bytesPrefix:[79,103,103,83]},{mediaType:`audio/flac`,bytesPrefix:[102,76,97,67]},{mediaType:`audio/aac`,bytesPrefix:[64,21,0,0]},{mediaType:`audio/webm`,bytesPrefix:[26,69,223,163]}],iu=[...ru,{mediaType:`audio/mp4`,bytesPrefix:[0,0,0,null,102,116,121,112]}],au=[{mediaType:`video/mp4`,bytesPrefix:[0,0,0,null,102,116,121,112]},{mediaType:`video/webm`,bytesPrefix:[26,69,223,163]},{mediaType:`video/quicktime`,bytesPrefix:[0,0,0,20,102,116,121,112,113,116]},{mediaType:`video/x-msvideo`,bytesPrefix:[82,73,70,70]}],ou=18,su=131084;function cu(e,t){if(typeof e!=`string`)return e.length>t?e.subarray(0,t):e;let n=Math.ceil(t/3)*4,r=ql(e.substring(0,Math.min(e.length,n)));return r.length>t?r.subarray(0,t):r}function lu(e){return e.length>10&&e[0]===73&&e[1]===68&&e[2]===51}var uu=e=>{let t=(e[6]&127)<<21|(e[7]&127)<<14|(e[8]&127)<<7|e[9]&127;return e.subarray(t+10)};function du({data:e,signatures:t}){let n=cu(e,ou);lu(n)&&(n=uu(cu(e,su)));for(let e of t)if(n.length>=e.bytesPrefix.length&&e.bytesPrefix.every((e,t)=>e===null||n[t]===e))return e.mediaType}var fu={image:tu,audio:iu,video:au,application:nu};function pu({data:e,topLevelType:t}){if(t===void 0)return du({data:e,signatures:[...tu,...nu,...ru,...au]});let n=fu[t];if(n!==void 0)return du({data:e,signatures:n})}function mu(e){let t=e.indexOf(`/`);return t===-1?e:e.substring(0,t)}function hu(e){let t=e.indexOf(`/`);if(t===-1)return!1;let n=e.substring(t+1);return n.length>0&&n!==`*`}async function gu(e){try{await e.body?.cancel()}catch{}}var _u=`AI_DownloadError`,vu=`vercel.ai.error.${_u}`,yu=Symbol.for(vu),bu,xu,G=class extends (xu=i,bu=yu,xu){constructor({url:e,statusCode:t,statusText:n,cause:r,message:i=r==null?`Failed to download ${e}: ${t} ${n}`:`Failed to download ${e}: ${r}`}){super({name:_u,message:i,cause:r}),this[bu]=!0,this.url=e,this.statusCode=t,this.statusText=n}static isInstance(e){return i.hasMarker(e,vu)}};function Su(e=globalThis){return e.window!=null}function Cu(e,t){try{return new URL(e).origin===new URL(t).origin}catch{return!1}}function wu(e){let t;try{t=new URL(e)}catch{throw new G({url:e,message:`Invalid URL: ${e}`})}if(t.protocol===`data:`)return;if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new G({url:e,message:`URL scheme must be http, https, or data, got ${t.protocol}`});let n=t.hostname.toLowerCase().replace(/\.+$/,``);if(!n)throw new G({url:e,message:`URL must have a hostname`});if(n===`localhost`||n.endsWith(`.local`)||n.endsWith(`.localhost`))throw new G({url:e,message:`URL with hostname ${n} is not allowed`});if(n.startsWith(`[`)&&n.endsWith(`]`)){if(ku(n.slice(1,-1)))throw new G({url:e,message:`URL with IPv6 address ${n} is not allowed`});return}if(Eu(n)){if(Du(n))throw new G({url:e,message:`URL with IP address ${n} is not allowed`});return}}function Tu({address:e,family:t,hostname:n}){if(t===4?!Eu(e)||Du(e):t!==6||ku(e))throw new G({url:n,message:`Hostname ${n} resolved to disallowed IP address ${e}`})}function Eu(e){let t=e.split(`.`);return t.length===4&&t.every(e=>{let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=255&&String(t)===e})}function Du(e){let[t,n,r]=e.split(`.`).map(Number);return t===0||t===10||t===100&&n>=64&&n<=127||t===127||t===169&&n===254||t===172&&n>=16&&n<=31||t===192&&n===0&&r===0||t===192&&n===0&&r===2||t===192&&n===168||t===198&&(n===18||n===19)||t===198&&n===51&&r===100||t===203&&n===0&&r===113||t>=224}function Ou(e){let t=e.toLowerCase(),n=t.indexOf(`%`);n!==-1&&(t=t.slice(0,n));let r=t.split(`::`);if(r.length>2)return null;let i=e=>{if(e===``)return[];let t=[],n=e.split(`:`);for(let e=0;e<n.length;e++){let r=n[e];if(r.includes(`.`)){if(e!==n.length-1||!Eu(r))return null;let[i,a,o,s]=r.split(`.`).map(Number);t.push(i<<8|a,o<<8|s);continue}if(!/^[0-9a-f]{1,4}$/.test(r))return null;t.push(parseInt(r,16))}return t},a=i(r[0]);if(a===null)return null;if(r.length===2){let e=i(r[1]);if(e===null)return null;let t=8-a.length-e.length;return t<0?null:[...a,...Array(t).fill(0),...e]}return a.length===8?a:null}function ku(e){let t=Ou(e);if(t===null)return!0;let n=e=>t.slice(0,e).every(e=>e===0);return n(7)&&(t[7]===0||t[7]===1)||(t[0]&65024)==64512||(t[0]&65472)==65152||(t[0]&65472)==65216||(t[0]&65280)==65280||t[0]===8193&&t[1]===3512||t[0]===16383&&!(t[1]&61440)?!0:n(6)||n(5)&&t[5]===65535||n(4)&&t[4]===65535&&t[5]===0||t[0]===100&&t[1]===65435&&t[2]===0&&t[3]===0&&t[4]===0&&t[5]===0||t[0]===100&&t[1]===65435&&t[2]===1?Du(`${t[6]>>8&255}.${t[6]&255}.${t[7]>>8&255}.${t[7]&255}`):!1}function Au(e){return((t,n,r)=>{e(t,{...n,all:!0},(e,i)=>{if(e){r(e);return}try{let[e]=i;if(e==null)throw Error(`Hostname ${t} did not resolve to an address`);for(let{address:e,family:n}of i)Tu({address:e,family:n,hostname:t});n.all===!0?r(null,i):r(null,e.address,e.family)}catch(e){r(e instanceof Error?e:Error(String(e)))}})})}var ju,Mu=globalThis.fetch,Nu=Iu(Mu);function Pu(){let e=globalThis.process;return e?.release?.name===`node`&&e.versions?.bun==null}async function Fu(){return!Pu()||!Nu||globalThis.fetch!==Mu?globalThis.fetch:ju??=Promise.resolve().then(Lu)}function Iu(e){let t=Function.prototype.toString.call(e);return t.includes(`internal/deps/undici`)||t.includes(`lazy loading of undici`)}function Lu(){let{createRequire:e}=Ru(`node:module`),{lookup:t}=Ru(`node:dns`),{Agent:n,fetch:r}=e(zu())(`undici`),i=new n({connect:{lookup:Au(t)}});return((e,t)=>r(e,{...t,dispatcher:i}))}function Ru(e){let t=globalThis.process,n=(t?.getBuiltinModule)?.call(t,e);if(n==null)throw Error(`Node.js built-in module ${e} is unavailable`);return n}function zu(){let e=Error.prepareStackTrace;try{Error.prepareStackTrace=(e,t)=>t;let e=Error(`Capture current module path`);Error.captureStackTrace(e,zu);let[t]=e.stack,n=t?.getFileName();if(n==null)throw Error(`Unable to determine the current module path`);return n}finally{Error.prepareStackTrace=e}}var Bu=[`connection`,`keep-alive`,`te`,`trailer`,`transfer-encoding`,`upgrade`,`host`,`forwarded`,`proxy-authorization`,`via`,`x-forwarded-for`,`x-forwarded-host`,`x-forwarded-proto`,`x-real-ip`,`metadata`,`metadata-flavor`,`x-aws-ec2-metadata-token`,`x-metadata-token`,`cookie`,`set-cookie`];function Vu(e){let t=new Headers(e);for(let e of Bu)t.delete(e);return t}var Hu=10,Uu=new Set([301,302,303,307,308]);async function Wu({url:e,headers:t,abortSignal:n,maxRedirects:r=Hu,fetch:i,trustedOrigin:a}){let o=t===void 0?void 0:Vu(t),s=e=>{let t={signal:n,redirect:e};return o!==void 0&&(t.headers=new Headers(o)),t},c=e;for(let t=0;t<=r;t++){let t=a!==void 0&&Cu(c,a);t||wu(c);let n=i??(t?globalThis.fetch:await Fu()),r=await n(c,s(`manual`));if(r.type===`opaqueredirect`){if(!Su())throw new G({url:e,message:`Redirect from ${c} could not be validated and was blocked`});return await n(c,s(`follow`))}let l=r.headers.get(`location`);if(Uu.has(r.status)&&l){await gu(r);let e=new URL(l,c).toString();if(o!==void 0&&!Cu(e,c)){let e=o.get(`user-agent`);o=new Headers(e==null?void 0:{"user-agent":e})}c=e;continue}return r}throw new G({url:e,message:`Too many redirects (max ${r})`})}var Gu=2147483648;async function Ku({response:e,url:t,maxBytes:n=Gu}){let r=e.headers.get(`content-length`);if(r!=null){let i=parseInt(r,10);if(!isNaN(i)&&i>n)throw await gu(e),new G({url:t,message:`Download of ${t} exceeded maximum size of ${n} bytes (Content-Length: ${i}).`})}let i=e.body;if(i==null)return new Uint8Array;let a=i.getReader(),o=[],s=0;try{for(;;){let{done:e,value:r}=await a.read();if(e)break;if(s+=r.length,s>n)throw new G({url:t,message:`Download of ${t} exceeded maximum size of ${n} bytes.`});o.push(r)}}finally{try{await a.cancel()}finally{a.releaseLock()}}let c=new Uint8Array(s),l=0;for(let e of o)c.set(e,l),l+=e.length;return c}async function qu(e,t){try{let n=await Wu({url:e,abortSignal:t?.abortSignal});if(!n.ok)throw await gu(n),new G({url:e,statusCode:n.status,statusText:n.statusText});let r=await Ku({response:n,url:e,maxBytes:t?.maxBytes??Gu}),i=n.headers.get(`content-type`)??void 0;return new Blob([r],i?{type:i}:void 0)}catch(t){throw G.isInstance(t)?t:new G({url:e,cause:t})}}function K(e){return Object.fromEntries([...e.headers])}var Ju=(({prefix:e,size:t=16,alphabet:n=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,separator:r=`-`}={})=>{let i=()=>{let e=n.length,r=Array(t);for(let i=0;i<t;i++)r[i]=n[Math.random()*e|0];return r.join(``)};if(e==null)return i;if(n.includes(r))throw new oe({argument:`separator`,message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${i()}`})();function q(e){return(e instanceof Error||e instanceof DOMException)&&(e.name===`AbortError`||e.name===`ResponseAborted`||e.name===`TimeoutError`)}var Yu=[`fetch failed`,`failed to fetch`],Xu=[`ConnectionRefused`,`ConnectionClosed`,`FailedToOpenSocket`,`ECONNRESET`,`ECONNREFUSED`,`ETIMEDOUT`,`EPIPE`];function Zu(e){if(!(e instanceof Error))return!1;let t=e.code;return!!(typeof t==`string`&&Xu.includes(t))}function Qu({error:e,url:t,requestBodyValues:n}){if(q(e))return e;if(e instanceof TypeError&&Yu.includes(e.message.toLowerCase())){let r=e.cause;if(r!=null)return new u({message:`Cannot connect to API: ${r.message}`,cause:r,url:t,requestBodyValues:n,isRetryable:!0})}return Zu(e)?new u({message:`Cannot connect to API: ${e.message}`,cause:e,url:t,requestBodyValues:n,isRetryable:!0}):e}function $u(e=globalThis){return e.window?`runtime/browser`:e.navigator?.userAgent?`runtime/${e.navigator.userAgent.toLowerCase()}`:e.process?.versions?.node?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?`runtime/vercel-edge`:`runtime/unknown`}function ed(e){if(e==null)return{};let t={};if(e instanceof Headers)e.forEach((e,n)=>{t[n.toLowerCase()]=e});else{Array.isArray(e)||(e=Object.entries(e));for(let[n,r]of e)r!=null&&(t[n.toLowerCase()]=r)}return t}function td(e,...t){let n=new Headers(ed(e)),r=n.get(`user-agent`)||``;return n.set(`user-agent`,[r,...t].filter(Boolean).join(` `)),Object.fromEntries(n.entries())}var nd=`5.0.25`,rd=()=>globalThis.fetch,id=async({url:e,headers:t={},successfulResponseHandler:n,failedResponseHandler:r,abortSignal:i,fetch:a,validateUrl:o,credentialedOrigin:s,trustedOrigin:c})=>{try{let l=a??rd(),d=td(s!==void 0&&!Cu(e,s)?{}:t,`ai-sdk/provider-utils/${nd}`,$u()),f=o?await Wu({url:e,headers:d,abortSignal:i,fetch:a,trustedOrigin:c}):await l(e,{method:`GET`,headers:d,signal:i}),p=K(f);if(!f.ok){let t;try{t=await r({response:f,url:e,requestBodyValues:{}})}catch(t){throw q(t)||u.isInstance(t)?t:new u({message:`Failed to process error response`,cause:t,statusCode:f.status,url:e,responseHeaders:p,requestBodyValues:{}})}throw t.value}try{return await n({response:f,url:e,requestBodyValues:{}})}catch(t){throw t instanceof Error&&(q(t)||u.isInstance(t))?t:new u({message:`Failed to process successful response`,cause:t,statusCode:f.status,url:e,responseHeaders:p,requestBodyValues:{}})}}catch(t){throw Qu({error:t,url:e,requestBodyValues:{}})}};function ad(e){return e!=null}function od(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function sd({apiKey:e,environmentVariableName:t,apiKeyParameterName:n=`apiKey`,description:r}){if(typeof e==`string`)return e;if(e!=null)throw new Ae({message:`${r} API key must be a string.`});if(typeof process>`u`)throw new Ae({message:`${r} API key is missing. Pass it using the '${n}' parameter. Environment variables are not supported in this environment.`});if(e=process.env[t],e==null)throw new Ae({message:`${r} API key is missing. Pass it using the '${n}' parameter or the ${t} environment variable.`});if(typeof e!=`string`)throw new Ae({message:`${r} API key must be a string. The value of the ${t} environment variable is not a string.`});return e}function cd({settingValue:e,environmentVariableName:t}){if(typeof e==`string`||!(e!=null||typeof process>`u`)&&(e=process.env[t],e!=null&&typeof e==`string`))return e}function ld(e){return e!==void 0&&e!==`provider-default`}function ud({reasoning:e,effortMap:t,warnings:n}){let r=t[e];if(r==null){n.push({type:`unsupported`,feature:`reasoning`,details:`reasoning "${e}" is not supported by this model.`});return}return r!==e&&n.push({type:`compatibility`,feature:`reasoning`,details:`reasoning "${e}" is not directly supported by this model. mapped to effort "${r}".`}),r}var dd={minimal:.02,low:.1,medium:.3,high:.6,xhigh:.9};function fd({reasoning:e,maxOutputTokens:t,maxReasoningBudget:n,minReasoningBudget:r=1024,budgetPercentages:i=dd,warnings:a}){let o=i[e];if(o==null){a.push({type:`unsupported`,feature:`reasoning`,details:`reasoning "${e}" is not supported by this model.`});return}return Math.min(n,Math.max(r,Math.round(t*o)))}function pd(e){let[t,n=``]=e.toLowerCase().split(`/`);return{mpeg:`mp3`,"x-wav":`wav`,opus:`ogg`,mp4:`m4a`,"x-m4a":`m4a`}[n]??n}var md=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,hd=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function gd(e){let t=JSON.parse(e);return typeof t!=`object`||!t||md.test(e)===!1&&hd.test(e)===!1?t:_d(t)}function _d(e){let t=[e];for(;t.length;){let e=t;t=[];for(let n of e){if(Object.prototype.hasOwnProperty.call(n,`__proto__`)||Object.prototype.hasOwnProperty.call(n,`constructor`)&&n.constructor!==null&&typeof n.constructor==`object`&&Object.prototype.hasOwnProperty.call(n.constructor,`prototype`))throw SyntaxError(`Object contains forbidden prototype property`);for(let e in n){let r=n[e];r&&typeof r==`object`&&t.push(r)}}}return e}function vd(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return gd(e)}try{return gd(e)}finally{Error.stackTraceLimit=t}}function yd(e){if(e.type===`object`||Array.isArray(e.type)&&e.type.includes(`object`)){e.additionalProperties=!1;let{properties:t}=e;if(t!=null)for(let e of Object.keys(t))t[e]=J(t[e])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(J):J(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(J)),e.allOf!=null&&(e.allOf=e.allOf.map(J)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(J));let{definitions:t}=e;if(t!=null)for(let e of Object.keys(t))t[e]=J(t[e]);return e}function J(e){return typeof e==`boolean`?e:yd(e)}var bd=Symbol(`Let zodToJsonSchema decide on which parser to use`),xd={name:void 0,$refStrategy:`root`,basePath:[`#`],effectStrategy:`input`,pipeStrategy:`all`,dateStrategy:`format:date-time`,mapStrategy:`entries`,removeAdditionalStrategy:`passthrough`,allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:`definitions`,strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:`escape`,applyRegexFlags:!1,emailStrategy:`format:email`,base64Strategy:`contentEncoding:base64`,nameStrategy:`ref`},Sd=e=>typeof e==`string`?{...xd,name:e}:{...xd,...e};function Y(){return{}}function Cd(e,t){let n={type:`array`};return e.type?._def&&e.type?._def?.typeName!==`ZodAny`&&(n.items=$(e.type._def,{...t,currentPath:[...t.currentPath,`items`]})),e.minLength&&(n.minItems=e.minLength.value),e.maxLength&&(n.maxItems=e.maxLength.value),e.exactLength&&(n.minItems=e.exactLength.value,n.maxItems=e.exactLength.value),n}function wd(e){let t={type:`integer`,format:`int64`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value}return t}function Td(){return{type:`boolean`}}function Ed(e,t){return $(e.type._def,t)}var Dd=(e,t)=>$(e.innerType._def,t);function Od(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map(n=>Od(e,t,n))};switch(r){case`string`:case`format:date-time`:return{type:`string`,format:`date-time`};case`format:date`:return{type:`string`,format:`date`};case`integer`:return kd(e)}}var kd=e=>{let t={type:`integer`,format:`unix-time`};for(let n of e.checks)switch(n.kind){case`min`:t.minimum=n.value;break;case`max`:t.maximum=n.value}return t};function Ad(e,t){return{...$(e.innerType._def,t),default:e.defaultValue()}}function jd(e,t){return t.effectStrategy===`input`?$(e.schema._def,t):Y()}function Md(e){return{type:`string`,enum:Array.from(e.values)}}var Nd=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function Pd(e,t){let n=[$(e.left._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),$(e.right._def,{...t,currentPath:[...t.currentPath,`allOf`,`1`]})].filter(e=>!!e),r=[];return n.forEach(e=>{if(Nd(e))r.push(...e.allOf);else{let t=e;if(`additionalProperties`in e&&e.additionalProperties===!1){let{additionalProperties:n,...r}=e;t=r}r.push(t)}}),r.length?{allOf:r}:void 0}function Fd(e){let t=typeof e.value;return t!==`bigint`&&t!==`number`&&t!==`boolean`&&t!==`string`?{type:Array.isArray(e.value)?`array`:`object`}:{type:t===`bigint`?`integer`:t,const:e.value}}var Id=void 0,X={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Id===void 0&&(Id=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),Id),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Ld(e,t){let n={type:`string`};if(e.checks)for(let r of e.checks)switch(r.kind){case`min`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value;break;case`max`:n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`email`:switch(t.emailStrategy){case`format:email`:Z(n,`email`,r.message,t);break;case`format:idn-email`:Z(n,`idn-email`,r.message,t);break;case`pattern:zod`:Q(n,X.email,r.message,t)}break;case`url`:Z(n,`uri`,r.message,t);break;case`uuid`:Z(n,`uuid`,r.message,t);break;case`regex`:Q(n,r.regex,r.message,t);break;case`cuid`:Q(n,X.cuid,r.message,t);break;case`cuid2`:Q(n,X.cuid2,r.message,t);break;case`startsWith`:Q(n,RegExp(`^${Rd(r.value,t)}`),r.message,t);break;case`endsWith`:Q(n,RegExp(`${Rd(r.value,t)}$`),r.message,t);break;case`datetime`:Z(n,`date-time`,r.message,t);break;case`date`:Z(n,`date`,r.message,t);break;case`time`:Z(n,`time`,r.message,t);break;case`duration`:Z(n,`duration`,r.message,t);break;case`length`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`includes`:Q(n,RegExp(Rd(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&Z(n,`ipv4`,r.message,t),r.version!==`v4`&&Z(n,`ipv6`,r.message,t);break;case`base64url`:Q(n,X.base64url,r.message,t);break;case`jwt`:Q(n,X.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&Q(n,X.ipv4Cidr,r.message,t),r.version!==`v4`&&Q(n,X.ipv6Cidr,r.message,t);break;case`emoji`:Q(n,X.emoji(),r.message,t);break;case`ulid`:Q(n,X.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:Z(n,`binary`,r.message,t);break;case`contentEncoding:base64`:n.contentEncoding=`base64`;break;case`pattern:zod`:Q(n,X.base64,r.message,t)}break;case`nanoid`:Q(n,X.nanoid,r.message,t)}return n}function Rd(e,t){return t.patternStrategy===`escape`?Bd(e):e}var zd=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function Bd(e){let t=``;for(let n=0;n<e.length;n++)zd.has(e[n])||(t+=`\\`),t+=e[n];return t}function Z(e,t,n,r){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||=[],e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):e.format=t}function Q(e,t,n,r){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||=[],e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:Vd(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=Vd(t,r)}function Vd(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes(`i`),m:e.flags.includes(`m`),s:e.flags.includes(`s`)},r=n.i?e.source.toLowerCase():e.source,i=``,a=!1,o=!1,s=!1;for(let e=0;e<r.length;e++){if(a){i+=r[e],a=!1;continue}if(n.i){if(o){if(r[e].match(/[a-z]/)){s?(i+=r[e],i+=`${r[e-2]}-${r[e]}`.toUpperCase(),s=!1):r[e+1]===`-`&&r[e+2]?.match(/[a-z]/)?(i+=r[e],s=!0):i+=`${r[e]}${r[e].toUpperCase()}`;continue}}else if(r[e].match(/[a-z]/)){i+=`[${r[e]}${r[e].toUpperCase()}]`;continue}}if(n.m){if(r[e]===`^`){i+=`(^|(?<=[\r
62
- ]))`;continue}if(r[e]===`$`){i+=`($|(?=[\r
63
- ]))`;continue}}if(n.s&&r[e]===`.`){i+=o?`${r[e]}\r
64
- `:`[${r[e]}\r
65
- ]`;continue}i+=r[e],r[e]===`\\`?a=!0:o&&r[e]===`]`?o=!1:!o&&r[e]===`[`&&(o=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join(`/`)} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function Hd(e,t){let n={type:`object`,additionalProperties:$(e.valueType._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]})??t.allowedAdditionalProperties};if(e.keyType?._def.typeName===`ZodString`&&e.keyType._def.checks?.length){let{type:r,...i}=Ld(e.keyType._def,t);return{...n,propertyNames:i}}if(e.keyType?._def.typeName===`ZodEnum`)return{...n,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===`ZodBranded`&&e.keyType._def.type._def.typeName===`ZodString`&&e.keyType._def.type._def.checks?.length){let{type:r,...i}=Ed(e.keyType._def,t);return{...n,propertyNames:i}}return n}function Ud(e,t){return t.mapStrategy===`record`?Hd(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[$(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||Y(),$(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||Y()],minItems:2,maxItems:2}}}function Wd(e){let t=e.values,n=Object.keys(e.values).filter(e=>typeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function Gd(){return{not:Y()}}function Kd(){return{type:`null`}}var qd={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function Jd(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in qd&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=qd[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>e._def.typeName===`ZodLiteral`&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case`string`:case`number`:case`boolean`:return[...e,n];case`bigint`:return[...e,`integer`];case`object`:if(t._def.value===null)return[...e,`null`];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return Yd(e,t)}var Yd=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>$(e._def,{...t,currentPath:[...t.currentPath,`anyOf`,`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function Xd(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[qd[e.innerType._def.typeName],`null`]};let n=$(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function Zd(e){let t={type:`number`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`int`:t.type=`integer`;break;case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value}return t}function Qd(e,t){let n={type:`object`,properties:{}},r=[],i=e.shape();for(let e in i){let a=i[e];if(a===void 0||a._def===void 0)continue;let o=ef(a),s=$(a._def,{...t,currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]});s!==void 0&&(n.properties[e]=s,o||r.push(e))}r.length&&(n.required=r);let a=$d(e,t);return a!==void 0&&(n.additionalProperties=a),n}function $d(e,t){if(e.catchall._def.typeName!==`ZodNever`)return $(e.catchall._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]});switch(e.unknownKeys){case`passthrough`:return t.allowedAdditionalProperties;case`strict`:return t.rejectedAdditionalProperties;case`strip`:return t.removeAdditionalStrategy===`strict`?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function ef(e){try{return e.isOptional()}catch{return!0}}var tf=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return $(e.innerType._def,t);let n=$(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:Y()},n]}:Y()},nf=(e,t)=>{if(t.pipeStrategy===`input`)return $(e.in._def,t);if(t.pipeStrategy===`output`)return $(e.out._def,t);let n=$(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,$(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function rf(e,t){return $(e.type._def,t)}function af(e,t){let n={type:`array`,uniqueItems:!0,items:$(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function of(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>$(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:$(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>$(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function sf(){return{not:Y()}}function cf(){return Y()}var lf=(e,t)=>$(e.innerType._def,t),uf=(e,t,n)=>{switch(t){case`ZodString`:return Ld(e,n);case`ZodNumber`:return Zd(e);case`ZodObject`:return Qd(e,n);case`ZodBigInt`:return wd(e);case`ZodBoolean`:return Td();case`ZodDate`:return Od(e,n);case`ZodUndefined`:return sf();case`ZodNull`:return Kd();case`ZodArray`:return Cd(e,n);case`ZodUnion`:case`ZodDiscriminatedUnion`:return Jd(e,n);case`ZodIntersection`:return Pd(e,n);case`ZodTuple`:return of(e,n);case`ZodRecord`:return Hd(e,n);case`ZodLiteral`:return Fd(e);case`ZodEnum`:return Md(e);case`ZodNativeEnum`:return Wd(e);case`ZodNullable`:return Xd(e,n);case`ZodOptional`:return tf(e,n);case`ZodMap`:return Ud(e,n);case`ZodSet`:return af(e,n);case`ZodLazy`:return()=>e.getter()._def;case`ZodPromise`:return rf(e,n);case`ZodNaN`:case`ZodNever`:return Gd();case`ZodEffects`:return jd(e,n);case`ZodAny`:return Y();case`ZodUnknown`:return cf();case`ZodDefault`:return Ad(e,n);case`ZodBranded`:return Ed(e,n);case`ZodReadonly`:return lf(e,n);case`ZodCatch`:return Dd(e,n);case`ZodPipeline`:return nf(e,n);case`ZodFunction`:case`ZodVoid`:case`ZodSymbol`:return;default:return(e=>void 0)(t)}},df=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join(`/`)};function $(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.call(t,e,t,r,n);if(i!==bd)return i}if(r&&!n){let e=ff(r,t);if(e!==void 0)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let a=uf(e,e.typeName,t),o=typeof a==`function`?$(a(),t):a;if(o&&pf(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var ff=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:df(t.currentPath,e.path)};case`none`:case`seen`:return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),Y()):t.$refStrategy===`seen`?Y():void 0}},pf=(e,t,n)=>(e.description&&(n.description=e.description),n),mf=e=>{let t=Sd(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},hf=(e,t)=>{let n=mf(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:$(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??Y()}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=$(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??Y(),o=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;o!==void 0&&(a.title=o);let s=i===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy===`relative`?[]:n.basePath,n.definitionPath,i].join(`/`),[n.definitionPath]:{...r,[i]:a}};return s.$schema=`http://json-schema.org/draft-07/schema#`,s},gf=Symbol.for(`vercel.ai.schema`);function _f(e){let t;return()=>(t??=e(),t)}function vf(e,{validate:t}={}){return{[gf]:!0,_type:void 0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function yf(e){return typeof e==`object`&&!!e&&gf in e&&e[gf]===!0&&`jsonSchema`in e&&`validate`in e}function bf(e){return e==null?vf({type:`object`,properties:{},additionalProperties:!1}):yf(e)?e:`~standard`in e?e[`~standard`].vendor===`zod`?Ef(e):xf(e):e()}function xf(e){return vf(()=>{if(!Sf(e))throw Error(`Standard schema vendor '${e[`~standard`].vendor}' does not support JSON Schema conversion.`);return yd(e[`~standard`].jsonSchema.input({target:`draft-07`}))},{validate:async t=>{let n=await e[`~standard`].validate(t);return`value`in n?{success:!0,value:n.value}:{success:!1,error:new et({value:t,cause:n.issues})}}})}function Sf(e){return e[`~standard`].jsonSchema!=null}function Cf(e,t){let n=t?.useReferences??!1;return vf(()=>hf(e,{$refStrategy:n?`root`:`none`}),{validate:async t=>{let n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function wf(e,t){let n=t?.useReferences??!1;return vf(()=>yd(Ns(e,{target:`draft-7`,io:`input`,reused:n?`ref`:`inline`})),{validate:async t=>{let n=await zs(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function Tf(e){return`_zod`in e}function Ef(e,t){return Tf(e)?wf(e,t):Cf(e,t)}async function Df({value:e,schema:t,context:n}){let r=await Of({value:e,schema:t,context:n});if(!r.success)throw et.wrap({value:e,cause:r.error,context:n});return r.value}async function Of({value:e,schema:t,context:n}){let r=bf(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};let t=await r.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:et.wrap({value:e,cause:t.error,context:n}),rawValue:e}}catch(t){return{success:!1,error:et.wrap({value:e,cause:t,context:n}),rawValue:e}}}async function kf({text:e,schema:t}){try{let n=vd(e);return t==null?n:await Df({value:n,schema:t})}catch(t){throw we.isInstance(t)||et.isInstance(t)?t:new we({text:e,cause:t})}}async function Af({text:e,schema:t}){try{let n=vd(e);return t==null?{success:!0,value:n,rawValue:n}:await Of({value:n,schema:t})}catch(t){return{success:!1,error:we.isInstance(t)?t:new we({text:e,cause:t}),rawValue:void 0}}}function jf({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Ml).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await Af({text:e,schema:t}))}}))}async function Mf({provider:e,providerOptions:t,schema:n}){if(t?.[e]==null)return;let r=await Of({value:t[e],schema:n});if(!r.success)throw new oe({argument:`providerOptions`,message:`invalid ${e} provider options`,cause:r.error});return r.value}var Nf=()=>globalThis.fetch,Pf=async({url:e,headers:t,body:n,failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o})=>await If({url:e,headers:{"Content-Type":`application/json`,...t},body:{content:JSON.stringify(n),values:n},failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o}),Ff=async({url:e,headers:t,formData:n,failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o})=>await If({url:e,headers:t,body:{content:n,values:Object.fromEntries(n.entries())},failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o}),If=async({url:e,headers:t={},body:n,successfulResponseHandler:r,failedResponseHandler:i,abortSignal:a,fetch:o=Nf()})=>{try{let s=await o(e,{method:`POST`,headers:td(t,`ai-sdk/provider-utils/${nd}`,$u()),body:n.content,signal:a}),c=K(s);if(!s.ok){let t;try{t=await i({response:s,url:e,requestBodyValues:n.values})}catch(t){throw q(t)||u.isInstance(t)?t:new u({message:`Failed to process error response`,cause:t,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:n.values})}throw t.value}try{return await r({response:s,url:e,requestBodyValues:n.values})}catch(t){throw t instanceof Error&&(q(t)||u.isInstance(t))?t:new u({message:`Failed to process successful response`,cause:t,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:n.values})}}catch(t){throw Qu({error:t,url:e,requestBodyValues:n.values})}};function Lf(e){return e}function Rf(e){return{...e,type:`dynamic`}}function zf({id:e,inputSchema:t}){return({execute:n,outputSchema:r,needsApproval:i,toModelOutput:a,onInputStart:o,onInputDelta:s,onInputAvailable:c,...l})=>Lf({type:`provider`,isProviderExecuted:!1,id:e,args:l,inputSchema:t,outputSchema:r,execute:n,needsApproval:i,toModelOutput:a,onInputStart:o,onInputDelta:s,onInputAvailable:c})}function Bf({id:e,inputSchema:t,outputSchema:n}){return({execute:r,needsApproval:i,toModelOutput:a,onInputStart:o,onInputDelta:s,onInputAvailable:c,...l})=>Lf({type:`provider`,isProviderExecuted:!1,id:e,args:l,inputSchema:t,outputSchema:n,execute:r,needsApproval:i,toModelOutput:a,onInputStart:o,onInputDelta:s,onInputAvailable:c})}function Vf({id:e,inputSchema:t,outputSchema:n,supportsDeferredResults:r}){return({onInputStart:i,onInputDelta:a,onInputAvailable:o,...s})=>Lf({type:`provider`,isProviderExecuted:!0,id:e,args:s,inputSchema:t,outputSchema:n,onInputStart:i,onInputDelta:a,onInputAvailable:o,supportsDeferredResults:r})}async function Hf(e){return typeof e==`function`&&(e=e()),Promise.resolve(e)}function Uf({part:e}){if(hu(e.mediaType))return e.mediaType;if(e.data.type===`data`){let t=pu({data:e.data.data,topLevelType:mu(e.mediaType)});if(t)return t;throw new ot({functionality:`file of media type "${e.mediaType}" must specify subtype since it could not be auto-detected`})}throw new ot({functionality:`file of media type "${e.mediaType}" must specify subtype since it is not passed as inline bytes`})}function Wf({reference:e,provider:t}){let n=e[t];if(n!=null)return n;throw new He({provider:t,reference:e})}var Gf=({maxRetries:e=2,initialDelayInMs:t=2e3,backoffFactor:n=2,abortSignal:r,shouldRetry:i,getDelayInMs:a=({exponentialBackoffDelay:e})=>e,createRetryError:o=({message:e})=>Error(e)})=>async s=>Kf(s,{maxRetries:e,delayInMs:t,backoffFactor:n,abortSignal:r,shouldRetry:i,getDelayInMs:a,createRetryError:o});async function Kf(e,{maxRetries:t,delayInMs:n,backoffFactor:r,abortSignal:i,shouldRetry:a,getDelayInMs:o,createRetryError:s},c=[]){try{return await e()}catch(l){if(q(l)||t===0)throw l;let u=g(l),d=[...c,l],f=d.length;if(f>t)throw s({message:`Failed after ${f} attempts. Last error: ${u}`,reason:`maxRetriesExceeded`,errors:d});if(await a(l)&&f<=t)return await Fl(o({error:l,exponentialBackoffDelay:n}),{abortSignal:i}),Kf(e,{maxRetries:t,delayInMs:r*n,backoffFactor:r,abortSignal:i,shouldRetry:a,getDelayInMs:o,createRetryError:s},d);throw f===1?l:s({message:`Failed after ${f} attempts with non-retryable error: '${u}'`,reason:`errorNotRetryable`,errors:d})}}var qf=new TextDecoder;async function Jf({response:e,url:t}){return qf.decode(await Ku({response:e,url:t}))}var Yf=({errorSchema:e,errorToMessage:t,isRetryable:n})=>async({response:r,url:i,requestBodyValues:a})=>{let o=await Jf({response:r,url:i}),s=K(r);if(o.trim()===``)return{responseHeaders:s,value:new u({message:r.statusText,url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,isRetryable:n?.(r)})};try{let c=await kf({text:o,schema:e});return{responseHeaders:s,value:new u({message:t(c),url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,data:c,isRetryable:n?.(r,c)})}}catch{return{responseHeaders:s,value:new u({message:r.statusText,url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,isRetryable:n?.(r)})}}},Xf=e=>async({response:t})=>{let n=K(t);if(t.body==null)throw new ee({});return{responseHeaders:n,value:jf({stream:t.body,schema:e})}},Zf=e=>async({response:t,url:n,requestBodyValues:r})=>{let i=await Jf({response:t,url:n}),a=await Af({text:i,schema:e}),o=K(t);if(!a.success)throw new u({message:`Invalid JSON response`,cause:a.error,statusCode:t.status,responseHeaders:o,responseBody:i,url:n,requestBodyValues:r});return{responseHeaders:o,value:a.value,rawValue:a.rawValue}},Qf=()=>async({response:e,url:t,requestBodyValues:n})=>{let r=K(e);if(!e.body)throw new u({message:`Response body is empty`,url:t,requestBodyValues:n,statusCode:e.status,responseHeaders:r,responseBody:void 0});try{let t=await e.arrayBuffer();return{responseHeaders:r,value:new Uint8Array(t)}}catch(i){throw new u({message:`Failed to read response as array buffer`,url:t,requestBodyValues:n,statusCode:e.status,responseHeaders:r,responseBody:void 0,cause:i})}};function $f(e){if(e==null)return!0;let t=typeof e;return t===`string`||t===`number`||t===`boolean`?!0:t===`function`||t===`symbol`||t===`bigint`?!1:Array.isArray(e)?e.every($f):Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every($f)}var ep=`AI_SerializationError`,tp=`vercel.ai.error.${ep}`,np=Symbol.for(tp),rp,ip,ap=class extends (ip=i,rp=np,ip){constructor({message:e=`Failed to serialize value.`,cause:t}={}){super({name:ep,message:e,cause:t}),this[rp]=!0}static isInstance(e){return i.hasMarker(e,tp)}};function op(e){let t={};for(let[n,r]of Object.entries(e.config))if(n===`headers`){let e=sp(r);$f(e)&&(t[n]=e)}else $f(r)&&(t[n]=r);return{modelId:e.modelId,config:t}}function sp(e){let t=e;if(typeof e==`function`&&(t=e()),t instanceof Promise)throw new ap({message:`Cannot serialize asynchronous model options.`});return t}var cp=class{constructor(e,t={}){this.toolCalls=new Set,this.toolCallsById=new Map,this.toolCallsByIndex=new Map,this.controller=e,this._generateId=t.generateId??Ju,this.typeValidation=t.typeValidation??`none`,this.extractMetadata=t.extractMetadata,this.buildToolCallProviderMetadata=t.buildToolCallProviderMetadata}processDelta(e){let{id:t,index:n}=e,r=t!=null&&t.length>0?this.toolCallsById.get(t):n==null?this.latestToolCall:this.toolCallsByIndex.get(n);r==null?r=this.processNewToolCall(e):this.processExistingToolCall(r,e),n!=null&&this.toolCallsByIndex.set(n,r),this.latestToolCall=r}flush(){for(let e of this.toolCalls)e.hasFinished||this.finishToolCall(e)}processNewToolCall(e){if(this.typeValidation===`required`){if(e.type!==`function`)throw new ve({data:e,message:`Expected 'function' type.`})}else if(this.typeValidation===`if-present`&&e.type!=null&&e.type!==`function`)throw new ve({data:e,message:`Expected 'function' type.`});if(e.id==null)throw new ve({data:e,message:`Expected 'id' to be a string.`});if(e.function?.name==null)throw new ve({data:e,message:`Expected 'function.name' to be a string.`});this.controller.enqueue({type:`tool-input-start`,id:e.id,toolName:e.function.name});let t=this.extractMetadata?.call(this,e),n={id:e.id,type:`function`,function:{name:e.function.name,arguments:e.function.arguments??``},hasFinished:!1,metadata:t};return this.toolCalls.add(n),n.id.length>0&&this.toolCallsById.set(n.id,n),n.function.arguments.length>0&&this.controller.enqueue({type:`tool-input-delta`,id:n.id,delta:n.function.arguments}),n}processExistingToolCall(e,t){e.hasFinished||t.function?.arguments!=null&&(e.function.arguments+=t.function.arguments,this.controller.enqueue({type:`tool-input-delta`,id:e.id,delta:t.function.arguments}))}finishToolCall(e){this.controller.enqueue({type:`tool-input-end`,id:e.id});let t=this.buildToolCallProviderMetadata?.call(this,e.metadata);this.controller.enqueue({type:`tool-call`,toolCallId:e.id??this._generateId(),toolName:e.function.name,input:e.function.arguments,...t?{providerMetadata:t}:{}}),e.hasFinished=!0}};function lp(e){if(e?.trim()===``)throw new oe({argument:`baseURL`,message:`baseURL must be a non-empty string.`});return e}function up(e){return e?.replace(/\/$/,``)}function dp(e,t){return Object.defineProperty({...e},"experimental_toolCaller",{value:t})}export{vd as $,hu as A,Za as At,pd as B,ot as Bt,Rf as C,Bc as Ct,mu as D,Yc as Dt,$u as E,Qs as Et,_f as F,oe as Ft,Pf as G,kf as H,sd as I,fe as It,Uf as J,If as K,cd as L,ve as Lt,od as M,i as Mt,Cu as N,u as Nt,q as O,Uc as Ot,vf as P,ee as Pt,Of as Q,fd as R,Ie as Rt,qu as S,wc as St,id as T,Zc as Tt,Mf as U,ed as V,ct as Vt,Ff as W,Gf as X,Wf as Y,Af as Z,zf as _,Oc as _t,Wl as a,Df as at,eu as b,tl as bt,Yl as c,up as ct,Qf as d,Cc as dt,op as et,Xf as f,$c as ft,$l as g,yc as gt,Ql as h,Rc as ht,Ul as i,lp as it,ad as j,Zt as jt,ld as k,Pc as kt,Zl as l,Ef as lt,Zf as m,Mc as mt,bf as n,Lf as nt,ql as o,Hl as ot,Yf as p,Ac as pt,Hf as q,Nl as r,dp as rt,Xl as s,td as st,cp as t,Rl as tt,Jl as u,Ml as ut,Bf as v,Gc as vt,Ju as w,al as wt,Fl as x,Vc as xt,Vf as y,Cl as yt,ud as z,Je as zt};