experimental-ash 0.43.0 → 0.45.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.
- package/CHANGELOG.md +13 -0
- package/bin/ash.js +1 -0
- package/dist/docs/internals/mechanical-invariants.md +16 -0
- package/dist/docs/public/advanced/instrumentation.md +71 -21
- package/dist/docs/public/advanced/typescript-api.md +1 -1
- package/dist/docs/public/sandbox.md +38 -0
- package/dist/src/channel/compiled-channel.d.ts +4 -1
- package/dist/src/channel/compiled-channel.js +1 -1
- package/dist/src/channel/routes.d.ts +8 -10
- package/dist/src/compiled/.vendor-stamp.json +2 -2
- package/dist/src/compiled/@vercel/sandbox/index.d.ts +24 -19
- package/dist/src/compiled/@vercel/sandbox/index.js +5 -5
- package/dist/src/compiled/@vercel/sandbox/network-policy.d.ts +161 -0
- package/dist/src/compiled/@vercel/sandbox/package.json +1 -1
- package/dist/src/compiled/@workflow/core/runtime.js +13 -13
- package/dist/src/compiled/_chunks/node/{auth-CVVvWjaK.js → auth-BsyzphzW.js} +1 -1
- package/dist/src/compiled/_chunks/node/{version-nR4RSpFw.js → version-BGue04qw.js} +1 -1
- package/dist/src/compiled/just-bash/index.d.ts +23 -2
- package/dist/src/compiled/just-bash/network/types.d.ts +155 -0
- package/dist/src/compiler/artifacts.d.ts +1 -0
- package/dist/src/compiler/artifacts.js +1 -1
- package/dist/src/compiler/channel-instrumentation-types.d.ts +8 -0
- package/dist/src/compiler/channel-instrumentation-types.js +2 -0
- package/dist/src/context/dynamic-skill-lifecycle.d.ts +4 -3
- package/dist/src/context/dynamic-skill-lifecycle.js +1 -1
- package/dist/src/context/keys.d.ts +11 -4
- package/dist/src/execution/sandbox/bindings/local.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
- package/dist/src/execution/sandbox/session.d.ts +6 -1
- package/dist/src/execution/sandbox/session.js +1 -1
- package/dist/src/harness/tool-loop.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/packages/ash-scaffold/src/channels.js +1 -1
- package/dist/src/packages/ash-scaffold/src/web-template.js +1 -0
- package/dist/src/public/channels/discord/discordChannel.d.ts +5 -2
- package/dist/src/public/channels/index.d.ts +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +6 -8
- package/dist/src/public/channels/teams/teamsChannel.d.ts +5 -2
- package/dist/src/public/channels/telegram/telegramChannel.d.ts +5 -2
- package/dist/src/public/channels/twilio/twilioChannel.d.ts +6 -3
- package/dist/src/public/definitions/defineChannel.d.ts +6 -3
- package/dist/src/public/definitions/instrumentation.d.ts +1 -152
- package/dist/src/public/definitions/instrumentation.js +1 -1
- package/dist/src/public/definitions/sandbox.d.ts +1 -1
- package/dist/src/public/instrumentation/index.d.ts +178 -1
- package/dist/src/public/instrumentation/index.js +1 -1
- package/dist/src/public/sandbox/index.d.ts +1 -0
- package/dist/src/runtime/resolve-channel.js +1 -1
- package/dist/src/shared/sandbox-network-policy.d.ts +23 -0
- package/dist/src/shared/sandbox-network-policy.js +1 -0
- package/dist/src/shared/sandbox-session.d.ts +36 -0
- package/dist/src/shared/skill-package.d.ts +7 -0
- package/dist/src/shared/skill-package.js +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as e,o as t,r as n}from"./dist-BdTs18CF.js";import{n as r,t as i}from"./version-
|
|
1
|
+
import{c as e,o as t,r as n}from"./dist-BdTs18CF.js";import{n as r,t as i}from"./version-BGue04qw.js";import*as a from"node:path";import o from"node:path";import{homedir as s}from"node:os";import c from"node:fs";import{setTimeout as l}from"node:timers/promises";import*as u from"node:fs/promises";import d from"os";const f=r.string().transform((e,t)=>{try{return JSON.parse(e)}catch(e){return t.addIssue({code:r.ZodIssueCode.custom,message:`Invalid JSON: ${e.message}`}),r.NEVER}});var p=n(((e,n)=>{let r=t(`os`),i=t(`path`),a=/^win/i.test(process.platform);function o(e){return i.normalize(i.join(e,`.`))}let s=()=>{let{env:e}=process,t={};return t.home=()=>o(r.homedir?r.homedir():e.HOME),t.temp=()=>o(r.tmpdir?r.tmpdir():e.TMPDIR||e.TEMP||e.TMP),t},c=()=>{let{env:e}=process,t={};return t.home=()=>o(r.homedir?r.homedir():e.USERPROFILE||i.join(e.HOMEDRIVE,e.HOMEPATH)||e.HOME),t.temp=()=>o(r.tmpdir?r.tmpdir():e.TEMP||e.TMP||i.join(e.LOCALAPPDATA||e.SystemRoot||e.windir,`Temp`)),t};n.exports=new class e{constructor(){let t=function(){return new e};this._fn=t;let n=a?c():s();return Object.keys(n).forEach(e=>{this._fn[e]=n[e]}),this._fn}}})),m=n(((e,n)=>{let r=t(`path`),i=p(),a=()=>{let e={};return e.cache=()=>process.env.XDG_CACHE_HOME||r.join(i.home()||i.temp(),`.cache`),e.config=()=>process.env.XDG_CONFIG_HOME||r.join(i.home()||i.temp(),`.config`),e.data=()=>process.env.XDG_DATA_HOME||r.join(i.home()||i.temp(),`.local`,`share`),e.runtime=()=>process.env.XDG_RUNTIME_DIR||void 0,e.state=()=>process.env.XDG_STATE_HOME||r.join(i.home()||i.temp(),`.local`,`state`),e},o=()=>{let e={};return e.cache=()=>process.env.XDG_CACHE_HOME||r.join(r.join(i.home()||i.temp(),`Library`),`Caches`),e.config=()=>process.env.XDG_CONFIG_HOME||r.join(r.join(i.home()||i.temp(),`Library`),`Preferences`),e.data=()=>process.env.XDG_DATA_HOME||r.join(r.join(i.home()||i.temp(),`Library`),`Application Support`),e.runtime=()=>process.env.XDG_RUNTIME_DIR||void 0,e.state=()=>process.env.XDG_STATE_HOME||r.join(r.join(i.home()||i.temp(),`Library`),`State`),e},s=()=>{let e={};return e.cache=()=>{let e=process.env.LOCALAPPDATA||r.join(i.home()||i.temp(),`AppData`,`Local`);return process.env.XDG_CACHE_HOME||r.join(e,`xdg.cache`)},e.config=()=>{let e=process.env.APPDATA||r.join(i.home()||i.temp(),`AppData`,`Roaming`);return process.env.XDG_CONFIG_HOME||r.join(e,`xdg.config`)},e.data=()=>{let e=process.env.APPDATA||r.join(i.home()||i.temp(),`AppData`,`Roaming`);return process.env.XDG_DATA_HOME||r.join(e,`xdg.data`)},e.runtime=()=>process.env.XDG_RUNTIME_DIR||void 0,e.state=()=>{let e=process.env.LOCALAPPDATA||r.join(i.home()||i.temp(),`AppData`,`Local`);return process.env.XDG_STATE_HOME||r.join(e,`xdg.state`)},e},c=()=>{let e=function(){return c()},t={};return t=/^darwin$/i.test(process.platform)?o():/^win/i.test(process.platform)?s():a(),t.configDirs=()=>{let e=[];return e.push(t.config()),process.env.XDG_CONFIG_DIRS&&e.push(...process.env.XDG_CONFIG_DIRS.split(r.delimiter)),e},t.dataDirs=()=>{let e=[];return e.push(t.data()),process.env.XDG_DATA_DIRS&&e.push(...process.env.XDG_DATA_DIRS.split(r.delimiter)),e},Object.keys(t).forEach(n=>{e[n]=t[n]}),e};n.exports=c()})),h=e(n(((e,n)=>{let r=t(`path`),i=t(`os`),a=m(),o=/^win/i.test(process.platform);function s(e,t){if(e||={},typeof e!=`object`&&(e={isolated:e}),e.isolated=e.isolated===void 0||e.isolated===null?t:e.isolated,typeof e.isolated!=`boolean`)throw TypeError(`Expected boolean for "isolated" argument, got ${typeof e.isolated}`);return e}let c=(e,t)=>{let n={};return n.cache=(n={isolated:null})=>(n=s(n,t),r.join(a.cache(),n.isolated?e:``)),n.config=(n={isolated:null})=>(n=s(n,t),r.join(a.config(),n.isolated?e:``)),n.data=(n={isolated:null})=>(n=s(n,t),r.join(a.data(),n.isolated?e:``)),n.runtime=(n={isolated:null})=>(n=s(n,t),a.runtime()?r.join(a.runtime(),n.isolated?e:``):void 0),n.state=(n={isolated:null})=>(n=s(n,t),r.join(a.state(),n.isolated?e:``)),n.configDirs=(n={isolated:null})=>(n=s(n,t),a.configDirs().map(t=>r.join(t,n.isolated?e:``))),n.dataDirs=(n={isolated:null})=>(n=s(n,t),a.dataDirs().map(t=>r.join(t,n.isolated?e:``))),n},l=(e,t)=>{let{env:n}=process,o=i.homedir(),c=i.tmpdir(),l=n.APPDATA||r.join(o||c,`AppData`,`Roaming`),u=n.LOCALAPPDATA||r.join(o||c,`AppData`,`Local`),d={};return d.cache=(i={isolated:null})=>(i=s(i,t),!i.isolated||n.XDG_CACHE_HOME?r.join(a.cache(),i.isolated?e:``):r.join(u,i.isolated?e:``,`Cache`)),d.config=(i={isolated:null})=>(i=s(i,t),!i.isolated||n.XDG_CONFIG_HOME?r.join(a.config(),i.isolated?e:``):r.join(l,i.isolated?e:``,`Config`)),d.data=(i={isolated:null})=>(i=s(i,t),!i.isolated||n.XDG_DATA_HOME?r.join(a.data(),i.isolated?e:``):r.join(l,i.isolated?e:``,`Data`)),d.runtime=(n={isolated:null})=>(n=s(n,t),a.runtime()?r.join(a.runtime(),n.isolated?e:``):void 0),d.state=(i={isolated:null})=>(i=s(i,t),!i.isolated||n.XDG_STATE_HOME?r.join(a.state(),i.isolated?e:``):r.join(u,i.isolated?e:``,`State`)),d.configDirs=(i={isolated:null})=>{i=s(i,t);let a=[d.config(i)];return n.XDG_CONFIG_DIRS&&a.push(...n.XDG_CONFIG_DIRS.split(r.delimiter).map(t=>r.join(t,i.isolated?e:``))),a},d.dataDirs=(i={isolated:null})=>{i=s(i,t);let a=[d.data(i)];return n.XDG_DATA_DIRS&&a.push(...n.XDG_DATA_DIRS.split(r.delimiter).map(t=>r.join(t,i.isolated?e:``))),a},d};n.exports=new class e{constructor(n={name:null,suffix:null,isolated:!0}){let i=function(t={name:null,suffix:null,isolated:!0}){return new e(t)};this._fn=i,n||={},typeof n!=`object`&&(n={name:n});let a=n.name||``;if(typeof a!=`string`)throw TypeError(`Expected string for "name" argument, got ${typeof a}`);let s=n.suffix||``;if(typeof s!=`string`)throw TypeError(`Expected string for "suffix" argument, got ${typeof s}`);let u=n.isolated===void 0||n.isolated===null?!0:n.isolated;if(typeof u!=`boolean`)throw TypeError(`Expected boolean for "isolated" argument, got ${typeof u}`);a||=r.parse(process.pkg?process.execPath:t.main?t.main.filename:process.argv[0]).name,s&&(a+=s),this._fn.$name=()=>a,this._fn.$isolated=()=>u;let d=o?l(a,u):c(a,u);return Object.keys(d).forEach(e=>{this._fn[e]=d[e]}),this._fn}}}))(),1);const g=r.number().transform(e=>new Date(e*1e3)),_=r.object({token:r.string().min(1).optional(),refreshToken:r.string().min(1).optional(),expiresAt:g.optional()}),v=f.pipe(_),y=e=>{try{return c.lstatSync(e).isDirectory()}catch{return!1}},b=()=>{if(process.env.VERCEL_AUTH_CONFIG_DIR)return process.env.VERCEL_AUTH_CONFIG_DIR;let e=(0,h.default)(`com.vercel.cli`).dataDirs();return[...e,o.join(s(),`.now`),...(0,h.default)(`now`).dataDirs()].find(e=>y(e))||e[0]},x=()=>{try{let e=o.join(b(),`auth.json`);return v.parse(c.readFileSync(e,`utf8`))}catch{return null}};function S(e){let t=o.join(b(),`auth.json`);c.mkdirSync(o.dirname(t),{recursive:!0});let n={token:e.token,expiresAt:e.expiresAt&&Math.round(e.expiresAt.getTime()/1e3),refreshToken:e.refreshToken};c.writeFileSync(t,JSON.stringify(n)+`
|
|
2
2
|
`)}const C=`${d.hostname()} @ vercel/sandbox/${i} node-${process.version} ${d.platform()} (${d.arch()})`,w=new URL(`https://vercel.com`),T=`cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp`,E=r.object({issuer:r.string().url(),device_authorization_endpoint:r.string().url(),token_endpoint:r.string().url(),revocation_endpoint:r.string().url(),jwks_uri:r.string().url(),introspection_endpoint:r.string().url()});let D;const O=r.object({device_code:r.string(),user_code:r.string(),verification_uri:r.string().url(),verification_uri_complete:r.string().url(),expires_in:r.number(),interval:r.number()}),k=r.object({active:r.literal(!0),client_id:r.string(),session_id:r.string()}).or(r.object({active:r.literal(!1)}));async function A(){if(D)return D;let e=await fetch(new URL(`.well-known/openid-configuration`,w),{headers:{"Content-Type":`application/json`,"user-agent":C}});return D=E.parse(await e.json()),D}async function j(){let e=await A();return{async deviceAuthorizationRequest(){let t=await(await fetch(e.device_authorization_endpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,"user-agent":C},body:new URLSearchParams({client_id:T,scope:`openid offline_access`})})).json(),n=O.safeParse(t);if(!n.success)throw new F(`Failed to parse device authorization response: ${n.error.message}`,t);return{device_code:n.data.device_code,user_code:n.data.user_code,verification_uri:n.data.verification_uri,verification_uri_complete:n.data.verification_uri_complete,expiresAt:Date.now()+n.data.expires_in*1e3,interval:n.data.interval}},async deviceAccessTokenRequest(t){try{return[null,await fetch(e.token_endpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,"user-agent":C},body:new URLSearchParams({client_id:T,grant_type:`urn:ietf:params:oauth:grant-type:device_code`,device_code:t}),signal:AbortSignal.timeout(10*1e3)})]}catch(e){return e instanceof Error?[e]:[Error(`An unknown error occurred. See the logs for details.`,{cause:e})]}},async processTokenResponse(e){let t=await e.json(),n=M.safeParse(t);return n.success?[null,n.data]:[new F(`Failed to parse token response: ${n.error.message}`,t)]},async revokeToken(t){let n=await fetch(e.revocation_endpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,"user-agent":C},body:new URLSearchParams({token:t,client_id:T})});if(!n.ok)return new F(`Revocation request failed`,await n.json())},async refreshToken(t){let n=await fetch(e.token_endpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,"user-agent":C},body:new URLSearchParams({client_id:T,grant_type:`refresh_token`,refresh_token:t})}),[r,i]=await this.processTokenResponse(n);if(r)throw r;return i},async introspectToken(t){let n=await(await fetch(e.introspection_endpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,"user-agent":C},body:new URLSearchParams({token:t})})).json(),r=k.safeParse(n);if(!r.success)throw new F(`Failed to parse introspection response: ${r.error.message}`,n);return r.data}}}const M=r.object({access_token:r.string(),token_type:r.literal(`Bearer`),expires_in:r.number(),refresh_token:r.string().optional(),scope:r.string().optional()}),N=r.object({error:r.enum([`invalid_request`,`invalid_client`,`invalid_grant`,`unauthorized_client`,`unsupported_grant_type`,`invalid_scope`,`server_error`,`authorization_pending`,`slow_down`,`access_denied`,`expired_token`,`unsupported_token_type`]),error_description:r.string().optional(),error_uri:r.string().optional()});function P(e){try{return N.parse(e)}catch(e){return e instanceof r.ZodError?TypeError(`Invalid OAuth error response: ${e.message}`):TypeError(`Failed to parse OAuth error response`)}}var F=class extends Error{constructor(e,t){super(e),this.name=`OAuthError`;let n=P(t);if(n instanceof TypeError){let e=`Unexpected server response: ${JSON.stringify(t)}`;this.cause=Error(e,{cause:n}),this.code=`server_error`;return}let r=n.error;n.error_description&&(r+=`: ${n.error_description}`),n.error_uri&&(r+=` (${n.error_uri})`),this.cause=Error(r),this.code=n.error}};function I(e){return e instanceof F}async function*L({request:e,oauth:t}){let n=new AbortController;try{let r=e.interval*1e3;for(;Date.now()<e.expiresAt;){let[i,a]=await t.deviceAccessTokenRequest(e.device_code);if(i){if(i.message.includes(`timeout`)){r*=2,yield{_tag:`Timeout`,newInterval:r},await l(r,{signal:n.signal});continue}yield{_tag:`Error`,error:i};return}yield{_tag:`Response`,response:a.clone()};let[o,s]=await t.processTokenResponse(a);if(I(o)){let{code:e}=o;switch(e){case`authorization_pending`:await l(r,{signal:n.signal});continue;case`slow_down`:r+=5*1e3,yield{_tag:`SlowDown`,newInterval:r},await l(r,{signal:n.signal});continue;default:yield{_tag:`Error`,error:o.cause};return}}if(o){yield{_tag:`Error`,error:o};return}S({token:s.access_token,expiresAt:new Date(Date.now()+s.expires_in*1e3),refreshToken:s.refresh_token});return}yield{_tag:`Error`,error:Error(`Timed out waiting for authentication. Please try again.`)};return}finally{n.abort()}}var R=class extends Error{constructor(e){super(`HTTP ${e.statusCode}: ${e.responseText}`),this.name=`NotOk`,this.response=e}};async function z(e){let t=await fetch(`https://vercel.com/api${e.endpoint}`,{method:e.method,body:e.body,headers:{Authorization:`Bearer ${e.token}`,"Content-Type":`application/json`}});if(!t.ok){let e=await t.text();try{let{error:t}=JSON.parse(e);e=`${t.code.toUpperCase()}: ${t.message}`}catch{}throw new R({responseText:e,statusCode:t.status})}return await t.json()}const B=f.pipe(r.object({projectId:r.string(),orgId:r.string()}));async function V(e){let t=a.join(e,`.vercel`,`project.json`),n;try{n=await u.readFile(t,`utf-8`)}catch{return null}let r=B.safeParse(n);return r.success?{projectId:r.data.projectId,teamId:r.data.orgId}:null}const H=r.object({user:r.object({defaultTeamId:r.string().nullable(),username:r.string()})}),U=r.object({id:r.string(),slug:r.string(),updatedAt:r.number(),membership:r.object({role:r.string()}),billing:r.object({plan:r.string()})}),W=r.object({teams:r.array(U),pagination:r.object({count:r.number(),next:r.number().nullable()})}),G=`vercel-sandbox-default-project`;function K(e){return e instanceof R&&(e.response.statusCode===402||e.response.statusCode===403)}async function q(e){let t=await V(e.cwd??process.cwd());if(t){let n=await Y(e.token,t.teamId,t.projectId);return{...t,created:!1,...n}}if(e.teamId)return J(e.token,e.teamId);let{defaultTeamId:n,username:i}=(await z({token:e.token,endpoint:`/v2/user`}).then(H.parse)).user;if(n)try{let t=await J(e.token,n);try{let i=await z({token:e.token,endpoint:`/v2/teams/${encodeURIComponent(n)}`}).then(r.object({slug:r.string()}).parse);return{...t,teamSlug:i.slug}}catch{return t}}catch(e){if(!K(e))throw e}let a=null;do{let t=a===null?`/v2/teams?limit=20`:`/v2/teams?limit=20&until=${a}`,r=await z({token:e.token,endpoint:t}).then(W.parse);a=r.pagination.next;let o=r.teams.filter(e=>e.membership.role===`OWNER`&&e.billing.plan===`hobby`);if(o.length===0)continue;let s=o.find(e=>e.slug===i)??o.sort((e,t)=>t.updatedAt-e.updatedAt)[0];if(s&&s.id!==n)try{return{...await J(e.token,s.id),teamSlug:s.slug}}catch(e){if(!K(e))throw e}}while(a!==null);try{return{...await J(e.token,i),teamSlug:i}}catch(e){if(!K(e))throw e}throw new R({statusCode:403,responseText:`Authenticated as "${i}" but none of the available teams allow sandbox creation. Specify a team explicitly with --scope <team-id-or-slug>.`})}async function J(e,t){let n=t.startsWith(`team_`)?`teamId=${encodeURIComponent(t)}`:`slug=${encodeURIComponent(t)}`,r=!1;try{await z({token:e,endpoint:`/v2/projects/vercel-sandbox-default-project?${n}`})}catch(t){if(!(t instanceof R)||t.response.statusCode!==404)throw t;await z({token:e,endpoint:`/v11/projects?${n}`,method:`POST`,body:JSON.stringify({name:G})}),r=!0}return{projectId:G,teamId:t,created:r}}async function Y(e,t,n){try{let i=t.startsWith(`team_`)?`teamId=${encodeURIComponent(t)}`:`slug=${encodeURIComponent(t)}`,[a,o]=await Promise.all([z({token:e,endpoint:`/v2/teams/${encodeURIComponent(t)}`}).then(r.object({slug:r.string()}).parse),z({token:e,endpoint:`/v2/projects/${encodeURIComponent(n)}?${i}`}).then(r.object({name:r.string()}).parse)]);return{teamSlug:a.slug,projectSlug:o.name}}catch{return{}}}export{R as NotOk,j as OAuth,x as getAuth,q as inferScope,I as isOAuthError,L as pollForToken,S as updateAuthConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e;(function(e){e.assertEqual=e=>e;function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(e||={});var t;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(t||={});const n=e.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),r=e=>{switch(typeof e){case`undefined`:return n.undefined;case`string`:return n.string;case`number`:return isNaN(e)?n.nan:n.number;case`boolean`:return n.boolean;case`function`:return n.function;case`bigint`:return n.bigint;case`symbol`:return n.symbol;case`object`:return Array.isArray(e)?n.array:e===null?n.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?n.promise:typeof Map<`u`&&e instanceof Map?n.map:typeof Set<`u`&&e instanceof Set?n.set:typeof Date<`u`&&e instanceof Date?n.date:n.object;default:return n.unknown}},i=e.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),a=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,`$1:`);var o=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof t))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};o.create=e=>new o(e);const s=(t,r)=>{let a;switch(t.code){case i.invalid_type:a=t.received===n.undefined?`Required`:`Expected ${t.expected}, received ${t.received}`;break;case i.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case i.unrecognized_keys:a=`Unrecognized key(s) in object: ${e.joinValues(t.keys,`, `)}`;break;case i.invalid_union:a=`Invalid input`;break;case i.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case i.invalid_enum_value:a=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case i.invalid_arguments:a=`Invalid function arguments`;break;case i.invalid_return_type:a=`Invalid function return type`;break;case i.invalid_date:a=`Invalid date`;break;case i.invalid_string:typeof t.validation==`object`?`includes`in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position==`number`&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):`startsWith`in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:`endsWith`in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):a=t.validation===`regex`?`Invalid`:`Invalid ${t.validation}`;break;case i.too_small:a=t.type===`array`?`Array must contain ${t.exact?`exactly`:t.inclusive?`at least`:`more than`} ${t.minimum} element(s)`:t.type===`string`?`String must contain ${t.exact?`exactly`:t.inclusive?`at least`:`over`} ${t.minimum} character(s)`:t.type===`number`?`Number must be ${t.exact?`exactly equal to `:t.inclusive?`greater than or equal to `:`greater than `}${t.minimum}`:t.type===`date`?`Date must be ${t.exact?`exactly equal to `:t.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(t.minimum))}`:`Invalid input`;break;case i.too_big:a=t.type===`array`?`Array must contain ${t.exact?`exactly`:t.inclusive?`at most`:`less than`} ${t.maximum} element(s)`:t.type===`string`?`String must contain ${t.exact?`exactly`:t.inclusive?`at most`:`under`} ${t.maximum} character(s)`:t.type===`number`?`Number must be ${t.exact?`exactly`:t.inclusive?`less than or equal to`:`less than`} ${t.maximum}`:t.type===`bigint`?`BigInt must be ${t.exact?`exactly`:t.inclusive?`less than or equal to`:`less than`} ${t.maximum}`:t.type===`date`?`Date must be ${t.exact?`exactly`:t.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(t.maximum))}`:`Invalid input`;break;case i.custom:a=`Invalid input`;break;case i.invalid_intersection_types:a=`Intersection results could not be merged`;break;case i.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case i.not_finite:a=`Number must be finite`;break;default:a=r.defaultError,e.assertNever(t)}return{message:a}};let c=s;function ee(e){c=e}function te(){return c}const ne=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}},re=[];function l(e,t){let n=te(),r=ne({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===s?void 0:s].filter(e=>!!e)});e.common.issues.push(r)}var u=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return d;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return d;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}};const d=Object.freeze({status:`aborted`}),ie=e=>({status:`dirty`,value:e}),f=e=>({status:`valid`,value:e}),ae=e=>e.status===`aborted`,oe=e=>e.status===`dirty`,p=e=>e.status===`valid`,m=e=>typeof Promise<`u`&&e instanceof Promise;function h(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function se(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}var g;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(g||={});var _,v,y=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const ce=(e,t)=>{if(p(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new o(e.common.issues);return this._error=t,this._error}}};function b(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var x=class{get description(){return this._def.description}_getType(e){return r(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:r(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new u,ctx:{common:e.parent.common,data:e.data,parsedType:r(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(m(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:r(e)};return ce(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:r(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return p(n)?{value:n.value}:{issues:t.common.issues}}catch(e){((e?.message)?.toLowerCase())?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>p(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:r(e)},i=this._parse({data:e,path:n.path,parent:n});return ce(n,await(m(i)?i:Promise.resolve(i)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let a=e(t),o=()=>r.addIssue({code:i.custom,...n(t)});return typeof Promise<`u`&&a instanceof Promise?a.then(e=>e?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new q({schema:this,typeName:$.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return J.create(this,this._def)}nullable(){return Y.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return N.create(this)}promise(){return K.create(this,this._def)}or(e){return I.create([this,e],this._def)}and(e){return R.create(this,e,this._def)}transform(e){return new q({...b(this._def),schema:this,typeName:$.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new X({...b(this._def),innerType:this,defaultValue:t,typeName:$.ZodDefault})}brand(){return new Ve({typeName:$.ZodBranded,type:this,...b(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new Z({...b(this._def),innerType:this,catchValue:t,typeName:$.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return He.create(this,e)}readonly(){return Q.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const le=/^c[^\s-]{8,}$/i,ue=/^[0-9a-z]+$/,de=/^[0-9A-HJKMNP-TV-Z]{26}$/i,fe=/^[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}$/i,pe=/^[a-z0-9_-]{21}$/i,me=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,he=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ge=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let _e;const ve=/^(?:(?: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])$/,ye=/^(?:(?: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])$/,be=/^(([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]))$/,xe=/^(([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])$/,Se=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ce=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,we=`((\\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])))`,Te=RegExp(`^${we}$`);function Ee(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function De(e){return RegExp(`^${Ee(e)}$`)}function Oe(e){let t=`${we}T${Ee(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function ke(e,t){return!!((t===`v4`||!t)&&ve.test(e)||(t===`v6`||!t)&&be.test(e))}function Ae(e,t){if(!me.test(e))return!1;try{let[n]=e.split(`.`),r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||!i.typ||!i.alg||t&&i.alg!==t)}catch{return!1}}function je(e,t){return!!((t===`v4`||!t)&&ye.test(e)||(t===`v6`||!t)&&xe.test(e))}var S=class t extends x{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==n.string){let e=this._getOrReturnCtx(t);return l(e,{code:i.invalid_type,expected:n.string,received:e.parsedType}),d}let r=new u,a;for(let n of this._def.checks)if(n.kind===`min`)t.data.length<n.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:i.too_small,minimum:n.value,type:`string`,inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind===`max`)t.data.length>n.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:i.too_big,maximum:n.value,type:`string`,inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind===`length`){let e=t.data.length>n.value,o=t.data.length<n.value;(e||o)&&(a=this._getOrReturnCtx(t,a),e?l(a,{code:i.too_big,maximum:n.value,type:`string`,inclusive:!0,exact:!0,message:n.message}):o&&l(a,{code:i.too_small,minimum:n.value,type:`string`,inclusive:!0,exact:!0,message:n.message}),r.dirty())}else if(n.kind===`email`)ge.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`email`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`emoji`)_e||=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`),_e.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`emoji`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`uuid`)fe.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`uuid`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`nanoid`)pe.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`nanoid`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`cuid`)le.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`cuid`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`cuid2`)ue.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`cuid2`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`ulid`)de.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`ulid`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`url`)try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),l(a,{validation:`url`,code:i.invalid_string,message:n.message}),r.dirty()}else n.kind===`regex`?(n.regex.lastIndex=0,n.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`regex`,code:i.invalid_string,message:n.message}),r.dirty())):n.kind===`trim`?t.data=t.data.trim():n.kind===`includes`?t.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()):n.kind===`toLowerCase`?t.data=t.data.toLowerCase():n.kind===`toUpperCase`?t.data=t.data.toUpperCase():n.kind===`startsWith`?t.data.startsWith(n.value)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()):n.kind===`endsWith`?t.data.endsWith(n.value)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()):n.kind===`datetime`?Oe(n).test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:`datetime`,message:n.message}),r.dirty()):n.kind===`date`?Te.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:`date`,message:n.message}),r.dirty()):n.kind===`time`?De(n).test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:`time`,message:n.message}),r.dirty()):n.kind===`duration`?he.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`duration`,code:i.invalid_string,message:n.message}),r.dirty()):n.kind===`ip`?ke(t.data,n.version)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`ip`,code:i.invalid_string,message:n.message}),r.dirty()):n.kind===`jwt`?Ae(t.data,n.alg)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`jwt`,code:i.invalid_string,message:n.message}),r.dirty()):n.kind===`cidr`?je(t.data,n.version)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`cidr`,code:i.invalid_string,message:n.message}),r.dirty()):n.kind===`base64`?Se.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`base64`,code:i.invalid_string,message:n.message}),r.dirty()):n.kind===`base64url`?Ce.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`base64url`,code:i.invalid_string,message:n.message}),r.dirty()):e.assertNever(n);return{status:r.value,value:t.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:i.invalid_string,...g.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:`email`,...g.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...g.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...g.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...g.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...g.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...g.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...g.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...g.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...g.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...g.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...g.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...g.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...g.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...g.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...g.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...g.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...g.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...g.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...g.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...g.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...g.errToObj(t)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};S.create=e=>new S({checks:[],typeName:$.ZodString,coerce:e?.coerce??!1,...b(e)});function Me(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return parseInt(e.toFixed(i).replace(`.`,``))%parseInt(t.toFixed(i).replace(`.`,``))/10**i}var C=class t extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==n.number){let e=this._getOrReturnCtx(t);return l(e,{code:i.invalid_type,expected:n.number,received:e.parsedType}),d}let r,a=new u;for(let n of this._def.checks)n.kind===`int`?e.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),l(r,{code:i.invalid_type,expected:`integer`,received:`float`,message:n.message}),a.dirty()):n.kind===`min`?(n.inclusive?t.data<n.value:t.data<=n.value)&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.too_small,minimum:n.value,type:`number`,inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind===`max`?(n.inclusive?t.data>n.value:t.data>=n.value)&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.too_big,maximum:n.value,type:`number`,inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind===`multipleOf`?Me(t.data,n.value)!==0&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind===`finite`?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),l(r,{code:i.not_finite,message:n.message}),a.dirty()):e.assertNever(n);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit(`min`,e,!0,g.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,g.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,g.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,g.toString(t))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:`int`,message:g.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:g.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:g.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:g.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:g.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(t=>t.kind===`int`||t.kind===`multipleOf`&&e.isInteger(t.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};C.create=e=>new C({checks:[],typeName:$.ZodNumber,coerce:e?.coerce||!1,...b(e)});var w=class t extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==n.bigint)return this._getInvalidInput(t);let r,a=new u;for(let n of this._def.checks)n.kind===`min`?(n.inclusive?t.data<n.value:t.data<=n.value)&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.too_small,type:`bigint`,minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind===`max`?(n.inclusive?t.data>n.value:t.data>=n.value)&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.too_big,type:`bigint`,maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind===`multipleOf`?t.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):e.assertNever(n);return{status:a.value,value:t.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.bigint,received:t.parsedType}),d}gte(e,t){return this.setLimit(`min`,e,!0,g.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,g.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,g.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,g.toString(t))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:g.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};w.create=e=>new w({checks:[],typeName:$.ZodBigInt,coerce:e?.coerce??!1,...b(e)});var T=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==n.boolean){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.boolean,received:t.parsedType}),d}return f(e.data)}};T.create=e=>new T({typeName:$.ZodBoolean,coerce:e?.coerce||!1,...b(e)});var E=class t extends x{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==n.date){let e=this._getOrReturnCtx(t);return l(e,{code:i.invalid_type,expected:n.date,received:e.parsedType}),d}if(isNaN(t.data.getTime()))return l(this._getOrReturnCtx(t),{code:i.invalid_date}),d;let r=new u,a;for(let n of this._def.checks)n.kind===`min`?t.data.getTime()<n.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:i.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:`date`}),r.dirty()):n.kind===`max`?t.data.getTime()>n.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:i.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:`date`}),r.dirty()):e.assertNever(n);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:g.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:g.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};E.create=e=>new E({checks:[],coerce:e?.coerce||!1,typeName:$.ZodDate,...b(e)});var Ne=class extends x{_parse(e){if(this._getType(e)!==n.symbol){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.symbol,received:t.parsedType}),d}return f(e.data)}};Ne.create=e=>new Ne({typeName:$.ZodSymbol,...b(e)});var D=class extends x{_parse(e){if(this._getType(e)!==n.undefined){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.undefined,received:t.parsedType}),d}return f(e.data)}};D.create=e=>new D({typeName:$.ZodUndefined,...b(e)});var O=class extends x{_parse(e){if(this._getType(e)!==n.null){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.null,received:t.parsedType}),d}return f(e.data)}};O.create=e=>new O({typeName:$.ZodNull,...b(e)});var k=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return f(e.data)}};k.create=e=>new k({typeName:$.ZodAny,...b(e)});var A=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return f(e.data)}};A.create=e=>new A({typeName:$.ZodUnknown,...b(e)});var j=class extends x{_parse(e){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.never,received:t.parsedType}),d}};j.create=e=>new j({typeName:$.ZodNever,...b(e)});var M=class extends x{_parse(e){if(this._getType(e)!==n.undefined){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.void,received:t.parsedType}),d}return f(e.data)}};M.create=e=>new M({typeName:$.ZodVoid,...b(e)});var N=class e extends x{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==n.array)return l(t,{code:i.invalid_type,expected:n.array,received:t.parsedType}),d;if(a.exactLength!==null){let e=t.data.length>a.exactLength.value,n=t.data.length<a.exactLength.value;(e||n)&&(l(t,{code:e?i.too_big:i.too_small,minimum:n?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(l(t,{code:i.too_small,minimum:a.minLength.value,type:`array`,inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(l(t,{code:i.too_big,maximum:a.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>a.type._parseAsync(new y(t,e,t.path,n)))).then(e=>u.mergeArray(r,e));let o=[...t.data].map((e,n)=>a.type._parseSync(new y(t,e,t.path,n)));return u.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:g.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:g.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:g.toString(n)}})}nonempty(e){return this.min(1,e)}};N.create=(e,t)=>new N({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$.ZodArray,...b(t)});function P(e){if(e instanceof F){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=J.create(P(r))}return new F({...e._def,shape:()=>t})}else if(e instanceof N)return new N({...e._def,type:P(e.element)});else if(e instanceof J)return J.create(P(e.unwrap()));else if(e instanceof Y)return Y.create(P(e.unwrap()));else if(e instanceof z)return z.create(e.items.map(e=>P(e)));else return e}var F=class t extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=e.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(e){if(this._getType(e)!==n.object){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.object,received:t.parsedType}),d}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof j&&this._def.unknownKeys===`strip`))for(let e in r.data)o.includes(e)||s.push(e);let c=[];for(let e of o){let t=a[e],n=r.data[e];c.push({key:{status:`valid`,value:e},value:t._parse(new y(r,n,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof j){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of s)c.push({key:{status:`valid`,value:e},value:{status:`valid`,value:r.data[e]}});else if(e===`strict`)s.length>0&&(l(r,{code:i.unrecognized_keys,keys:s}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of s){let n=r.data[t];c.push({key:{status:`valid`,value:t},value:e._parse(new y(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of c){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>u.mergeObjectSync(t,e)):u.mergeObjectSync(t,c)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new t({...this._def,unknownKeys:`strict`,...e===void 0?{}:{errorMap:(t,n)=>{var r;let i=(r=this._def).errorMap?.call(r,t,n).message??n.defaultError;return t.code===`unrecognized_keys`?{message:g.errToObj(e).message??i}:{message:i}}}})}strip(){return new t({...this._def,unknownKeys:`strip`})}passthrough(){return new t({...this._def,unknownKeys:`passthrough`})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:$.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new t({...this._def,catchall:e})}pick(n){let r={};return e.objectKeys(n).forEach(e=>{n[e]&&this.shape[e]&&(r[e]=this.shape[e])}),new t({...this._def,shape:()=>r})}omit(n){let r={};return e.objectKeys(this.shape).forEach(e=>{n[e]||(r[e]=this.shape[e])}),new t({...this._def,shape:()=>r})}deepPartial(){return P(this)}partial(n){let r={};return e.objectKeys(this.shape).forEach(e=>{let t=this.shape[e];n&&!n[e]?r[e]=t:r[e]=t.optional()}),new t({...this._def,shape:()=>r})}required(n){let r={};return e.objectKeys(this.shape).forEach(e=>{if(n&&!n[e])r[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof J;)t=t._def.innerType;r[e]=t}}),new t({...this._def,shape:()=>r})}keyof(){return Re(e.objectKeys(this.shape))}};F.create=(e,t)=>new F({shape:()=>e,unknownKeys:`strip`,catchall:j.create(),typeName:$.ZodObject,...b(t)}),F.strictCreate=(e,t)=>new F({shape:()=>e,unknownKeys:`strict`,catchall:j.create(),typeName:$.ZodObject,...b(t)}),F.lazycreate=(e,t)=>new F({shape:e,unknownKeys:`strip`,catchall:j.create(),typeName:$.ZodObject,...b(t)});var I=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new o(e.ctx.common.issues));return l(t,{code:i.invalid_union,unionErrors:n}),d}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let a=r.map(e=>new o(e));return l(t,{code:i.invalid_union,unionErrors:a}),d}}get options(){return this._def.options}};I.create=(e,t)=>new I({options:e,typeName:$.ZodUnion,...b(t)});const L=t=>t instanceof H?L(t.schema):t instanceof q?L(t.innerType()):t instanceof U?[t.value]:t instanceof W?t.options:t instanceof G?e.objectValues(t.enum):t instanceof X?L(t._def.innerType):t instanceof D?[void 0]:t instanceof O?[null]:t instanceof J?[void 0,...L(t.unwrap())]:t instanceof Y?[null,...L(t.unwrap())]:t instanceof Ve||t instanceof Q?L(t.unwrap()):t instanceof Z?L(t._def.innerType):[];var Pe=class e extends x{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==n.object)return l(t,{code:i.invalid_type,expected:n.object,received:t.parsedType}),d;let r=this.discriminator,a=t.data[r],o=this.optionsMap.get(a);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:i.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),d)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=L(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:$.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...b(r)})}};function Fe(t,i){let a=r(t),o=r(i);if(t===i)return{valid:!0,data:t};if(a===n.object&&o===n.object){let n=e.objectKeys(i),r=e.objectKeys(t).filter(e=>n.indexOf(e)!==-1),a={...t,...i};for(let e of r){let n=Fe(t[e],i[e]);if(!n.valid)return{valid:!1};a[e]=n.data}return{valid:!0,data:a}}else if(a===n.array&&o===n.array){if(t.length!==i.length)return{valid:!1};let e=[];for(let n=0;n<t.length;n++){let r=t[n],a=i[n],o=Fe(r,a);if(!o.valid)return{valid:!1};e.push(o.data)}return{valid:!0,data:e}}else if(a===n.date&&o===n.date&&+t==+i)return{valid:!0,data:t};else return{valid:!1}}var R=class extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(ae(e)||ae(r))return d;let a=Fe(e.value,r.value);return a.valid?((oe(e)||oe(r))&&t.dirty(),{status:t.value,value:a.data}):(l(n,{code:i.invalid_intersection_types}),d)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};R.create=(e,t,n)=>new R({left:e,right:t,typeName:$.ZodIntersection,...b(n)});var z=class e extends x{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.array)return l(r,{code:i.invalid_type,expected:n.array,received:r.parsedType}),d;if(r.data.length<this._def.items.length)return l(r,{code:i.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),d;!this._def.rest&&r.data.length>this._def.items.length&&(l(r,{code:i.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let a=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new y(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>u.mergeArray(t,e)):u.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};z.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new z({items:e,typeName:$.ZodTuple,rest:null,...b(t)})};var Ie=class e extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.object)return l(r,{code:i.invalid_type,expected:n.object,received:r.parsedType}),d;let a=[],o=this._def.keyType,s=this._def.valueType;for(let e in r.data)a.push({key:o._parse(new y(r,e,r.path,e)),value:s._parse(new y(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?u.mergeObjectAsync(t,a):u.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof x?new e({keyType:t,valueType:n,typeName:$.ZodRecord,...b(r)}):new e({keyType:S.create(),valueType:t,typeName:$.ZodRecord,...b(n)})}},B=class extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.map)return l(r,{code:i.invalid_type,expected:n.map,received:r.parsedType}),d;let a=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([e,t],n)=>({key:a._parse(new y(r,e,r.path,[n,`key`])),value:o._parse(new y(r,t,r.path,[n,`value`]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of s){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return d;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of s){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return d;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};B.create=(e,t,n)=>new B({valueType:t,keyType:e,typeName:$.ZodMap,...b(n)});var V=class e extends x{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.set)return l(r,{code:i.invalid_type,expected:n.set,received:r.parsedType}),d;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(l(r,{code:i.too_small,minimum:a.minSize.value,type:`set`,inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(l(r,{code:i.too_big,maximum:a.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let o=this._def.valueType;function s(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return d;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let c=[...r.data.values()].map((e,t)=>o._parse(new y(r,e,r.path,t)));return r.common.async?Promise.all(c).then(e=>s(e)):s(c)}min(t,n){return new e({...this._def,minSize:{value:t,message:g.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:g.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};V.create=(e,t)=>new V({valueType:e,minSize:null,maxSize:null,typeName:$.ZodSet,...b(t)});var Le=class e extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==n.function)return l(t,{code:i.invalid_type,expected:n.function,received:t.parsedType}),d;function r(e,n){return ne({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,te(),s].filter(e=>!!e),issueData:{code:i.invalid_arguments,argumentsError:n}})}function a(e,n){return ne({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,te(),s].filter(e=>!!e),issueData:{code:i.invalid_return_type,returnTypeError:n}})}let c={errorMap:t.common.contextualErrorMap},ee=t.data;if(this._def.returns instanceof K){let e=this;return f(async function(...t){let n=new o([]),i=await e._def.args.parseAsync(t,c).catch(e=>{throw n.addIssue(r(t,e)),n}),s=await Reflect.apply(ee,this,i);return await e._def.returns._def.type.parseAsync(s,c).catch(e=>{throw n.addIssue(a(s,e)),n})})}else{let e=this;return f(function(...t){let n=e._def.args.safeParse(t,c);if(!n.success)throw new o([r(t,n.error)]);let i=Reflect.apply(ee,this,n.data),s=e._def.returns.safeParse(i,c);if(!s.success)throw new o([a(i,s.error)]);return s.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:z.create(t).rest(A.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||z.create([]).rest(A.create()),returns:n||A.create(),typeName:$.ZodFunction,...b(r)})}},H=class extends x{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};H.create=(e,t)=>new H({getter:e,typeName:$.ZodLazy,...b(t)});var U=class extends x{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:i.invalid_literal,expected:this._def.value}),d}return{status:`valid`,value:e.data}}get value(){return this._def.value}};U.create=(e,t)=>new U({value:e,typeName:$.ZodLiteral,...b(t)});function Re(e,t){return new W({values:e,typeName:$.ZodEnum,...b(t)})}var W=class t extends x{constructor(){super(...arguments),_.set(this,void 0)}_parse(t){if(typeof t.data!=`string`){let n=this._getOrReturnCtx(t),r=this._def.values;return l(n,{expected:e.joinValues(r),received:n.parsedType,code:i.invalid_type}),d}if(h(this,_,`f`)||se(this,_,new Set(this._def.values),`f`),!h(this,_,`f`).has(t.data)){let e=this._getOrReturnCtx(t),n=this._def.values;return l(e,{received:e.data,code:i.invalid_enum_value,options:n}),d}return f(t.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(t=>!e.includes(t)),{...this._def,...n})}};_=new WeakMap,W.create=Re;var G=class extends x{constructor(){super(...arguments),v.set(this,void 0)}_parse(t){let r=e.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==n.string&&a.parsedType!==n.number){let t=e.objectValues(r);return l(a,{expected:e.joinValues(t),received:a.parsedType,code:i.invalid_type}),d}if(h(this,v,`f`)||se(this,v,new Set(e.getValidEnumValues(this._def.values)),`f`),!h(this,v,`f`).has(t.data)){let t=e.objectValues(r);return l(a,{received:a.data,code:i.invalid_enum_value,options:t}),d}return f(t.data)}get enum(){return this._def.values}};v=new WeakMap,G.create=(e,t)=>new G({values:e,typeName:$.ZodNativeEnum,...b(t)});var K=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==n.promise&&t.common.async===!1?(l(t,{code:i.invalid_type,expected:n.promise,received:t.parsedType}),d):f((t.parsedType===n.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};K.create=(e,t)=>new K({type:e,typeName:$.ZodPromise,...b(t)});var q=class extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,a={addIssue:e=>{l(r,e),e.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type===`preprocess`){let e=i.transform(r.data,a);if(r.common.async)return Promise.resolve(e).then(async e=>{if(n.value===`aborted`)return d;let t=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return t.status===`aborted`?d:t.status===`dirty`||n.value===`dirty`?ie(t.value):t});{if(n.value===`aborted`)return d;let t=this._def.schema._parseSync({data:e,path:r.path,parent:r});return t.status===`aborted`?d:t.status===`dirty`||n.value===`dirty`?ie(t.value):t}}if(i.type===`refinement`){let e=e=>{let t=i.refinement(e,a);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(r.common.async===!1){let t=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return t.status===`aborted`?d:(t.status===`dirty`&&n.dirty(),e(t.value),{status:n.value,value:t.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(t=>t.status===`aborted`?d:(t.status===`dirty`&&n.dirty(),e(t.value).then(()=>({status:n.value,value:t.value}))))}if(i.type===`transform`)if(r.common.async===!1){let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!p(e))return e;let t=i.transform(e.value,a);if(t instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:n.value,value:t}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>p(e)?Promise.resolve(i.transform(e.value,a)).then(e=>({status:n.value,value:e})):e);e.assertNever(i)}};q.create=(e,t,n)=>new q({schema:e,typeName:$.ZodEffects,effect:t,...b(n)}),q.createWithPreprocess=(e,t,n)=>new q({schema:t,effect:{type:`preprocess`,transform:e},typeName:$.ZodEffects,...b(n)});var J=class extends x{_parse(e){return this._getType(e)===n.undefined?f(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};J.create=(e,t)=>new J({innerType:e,typeName:$.ZodOptional,...b(t)});var Y=class extends x{_parse(e){return this._getType(e)===n.null?f(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Y.create=(e,t)=>new Y({innerType:e,typeName:$.ZodNullable,...b(t)});var X=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===n.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};X.create=(e,t)=>new X({innerType:e,typeName:$.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...b(t)});var Z=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return m(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new o(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new o(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Z.create=(e,t)=>new Z({innerType:e,typeName:$.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...b(t)});var ze=class extends x{_parse(e){if(this._getType(e)!==n.nan){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.nan,received:t.parsedType}),d}return{status:`valid`,value:e.data}}};ze.create=e=>new ze({typeName:$.ZodNaN,...b(e)});const Be=Symbol(`zod_brand`);var Ve=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},He=class e extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?d:e.status===`dirty`?(t.dirty(),ie(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?d:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:$.ZodPipeline})}},Q=class extends x{_parse(e){let t=this._def.innerType._parse(e),n=e=>(p(e)&&(e.value=Object.freeze(e.value)),e);return m(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};Q.create=(e,t)=>new Q({innerType:e,typeName:$.ZodReadonly,...b(t)});function Ue(e,t){let n=typeof e==`function`?e(t):typeof e==`string`?{message:e}:e;return typeof n==`string`?{message:n}:n}function We(e,t={},n){return e?k.create().superRefine((r,i)=>{let a=e(r);if(a instanceof Promise)return a.then(e=>{if(!e){let e=Ue(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}});if(!a){let e=Ue(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}}):k.create()}const Ge={object:F.lazycreate};var $;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})($||={});const Ke=(e,t={message:`Input not instance of ${e.name}`})=>We(t=>t instanceof e,t),qe=S.create,Je=C.create,Ye=ze.create,Xe=w.create,Ze=T.create,Qe=E.create,$e=Ne.create,et=D.create,tt=O.create,nt=k.create,rt=A.create,it=j.create,at=M.create,ot=N.create,st=F.create,ct=F.strictCreate,lt=I.create,ut=Pe.create,dt=R.create,ft=z.create,pt=Ie.create,mt=B.create,ht=V.create,gt=Le.create,_t=H.create,vt=U.create,yt=W.create,bt=G.create,xt=K.create,St=q.create,Ct=J.create,wt=Y.create,Tt=q.createWithPreprocess,Et=He.create;var Dt=Object.freeze({__proto__:null,defaultErrorMap:s,setErrorMap:ee,getErrorMap:te,makeIssue:ne,EMPTY_PATH:re,addIssueToContext:l,ParseStatus:u,INVALID:d,DIRTY:ie,OK:f,isAborted:ae,isDirty:oe,isValid:p,isAsync:m,get util(){return e},get objectUtil(){return t},ZodParsedType:n,getParsedType:r,ZodType:x,datetimeRegex:Oe,ZodString:S,ZodNumber:C,ZodBigInt:w,ZodBoolean:T,ZodDate:E,ZodSymbol:Ne,ZodUndefined:D,ZodNull:O,ZodAny:k,ZodUnknown:A,ZodNever:j,ZodVoid:M,ZodArray:N,ZodObject:F,ZodUnion:I,ZodDiscriminatedUnion:Pe,ZodIntersection:R,ZodTuple:z,ZodRecord:Ie,ZodMap:B,ZodSet:V,ZodFunction:Le,ZodLazy:H,ZodLiteral:U,ZodEnum:W,ZodNativeEnum:G,ZodPromise:K,ZodEffects:q,ZodTransformer:q,ZodOptional:J,ZodNullable:Y,ZodDefault:X,ZodCatch:Z,ZodNaN:ze,BRAND:Be,ZodBranded:Ve,ZodPipeline:He,ZodReadonly:Q,custom:We,Schema:x,ZodSchema:x,late:Ge,get ZodFirstPartyTypeKind(){return $},coerce:{string:(e=>S.create({...e,coerce:!0})),number:(e=>C.create({...e,coerce:!0})),boolean:(e=>T.create({...e,coerce:!0})),bigint:(e=>w.create({...e,coerce:!0})),date:(e=>E.create({...e,coerce:!0}))},any:nt,array:ot,bigint:Xe,boolean:Ze,date:Qe,discriminatedUnion:ut,effect:St,enum:yt,function:gt,instanceof:Ke,intersection:dt,lazy:_t,literal:vt,map:mt,nan:Ye,nativeEnum:bt,never:it,null:tt,nullable:wt,number:Je,object:st,oboolean:()=>Ze().optional(),onumber:()=>Je().optional(),optional:Ct,ostring:()=>qe().optional(),pipeline:Et,preprocess:Tt,promise:xt,record:pt,set:ht,strictObject:ct,string:qe,symbol:$e,transformer:St,tuple:ft,undefined:et,union:lt,unknown:rt,void:at,NEVER:d,ZodIssueCode:i,quotelessJson:a,ZodError:o});const Ot=`2.0.1`;export{Dt as n,Ot as t};
|
|
1
|
+
var e;(function(e){e.assertEqual=e=>e;function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(e||={});var t;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(t||={});const n=e.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),r=e=>{switch(typeof e){case`undefined`:return n.undefined;case`string`:return n.string;case`number`:return isNaN(e)?n.nan:n.number;case`boolean`:return n.boolean;case`function`:return n.function;case`bigint`:return n.bigint;case`symbol`:return n.symbol;case`object`:return Array.isArray(e)?n.array:e===null?n.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?n.promise:typeof Map<`u`&&e instanceof Map?n.map:typeof Set<`u`&&e instanceof Set?n.set:typeof Date<`u`&&e instanceof Date?n.date:n.object;default:return n.unknown}},i=e.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),a=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,`$1:`);var o=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof t))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};o.create=e=>new o(e);const s=(t,r)=>{let a;switch(t.code){case i.invalid_type:a=t.received===n.undefined?`Required`:`Expected ${t.expected}, received ${t.received}`;break;case i.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case i.unrecognized_keys:a=`Unrecognized key(s) in object: ${e.joinValues(t.keys,`, `)}`;break;case i.invalid_union:a=`Invalid input`;break;case i.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case i.invalid_enum_value:a=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case i.invalid_arguments:a=`Invalid function arguments`;break;case i.invalid_return_type:a=`Invalid function return type`;break;case i.invalid_date:a=`Invalid date`;break;case i.invalid_string:typeof t.validation==`object`?`includes`in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position==`number`&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):`startsWith`in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:`endsWith`in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):a=t.validation===`regex`?`Invalid`:`Invalid ${t.validation}`;break;case i.too_small:a=t.type===`array`?`Array must contain ${t.exact?`exactly`:t.inclusive?`at least`:`more than`} ${t.minimum} element(s)`:t.type===`string`?`String must contain ${t.exact?`exactly`:t.inclusive?`at least`:`over`} ${t.minimum} character(s)`:t.type===`number`?`Number must be ${t.exact?`exactly equal to `:t.inclusive?`greater than or equal to `:`greater than `}${t.minimum}`:t.type===`date`?`Date must be ${t.exact?`exactly equal to `:t.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(t.minimum))}`:`Invalid input`;break;case i.too_big:a=t.type===`array`?`Array must contain ${t.exact?`exactly`:t.inclusive?`at most`:`less than`} ${t.maximum} element(s)`:t.type===`string`?`String must contain ${t.exact?`exactly`:t.inclusive?`at most`:`under`} ${t.maximum} character(s)`:t.type===`number`?`Number must be ${t.exact?`exactly`:t.inclusive?`less than or equal to`:`less than`} ${t.maximum}`:t.type===`bigint`?`BigInt must be ${t.exact?`exactly`:t.inclusive?`less than or equal to`:`less than`} ${t.maximum}`:t.type===`date`?`Date must be ${t.exact?`exactly`:t.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(t.maximum))}`:`Invalid input`;break;case i.custom:a=`Invalid input`;break;case i.invalid_intersection_types:a=`Intersection results could not be merged`;break;case i.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case i.not_finite:a=`Number must be finite`;break;default:a=r.defaultError,e.assertNever(t)}return{message:a}};let c=s;function ee(e){c=e}function te(){return c}const ne=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}},re=[];function l(e,t){let n=te(),r=ne({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===s?void 0:s].filter(e=>!!e)});e.common.issues.push(r)}var u=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return d;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return d;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}};const d=Object.freeze({status:`aborted`}),ie=e=>({status:`dirty`,value:e}),f=e=>({status:`valid`,value:e}),ae=e=>e.status===`aborted`,oe=e=>e.status===`dirty`,p=e=>e.status===`valid`,m=e=>typeof Promise<`u`&&e instanceof Promise;function h(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function se(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}var g;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(g||={});var _,v,y=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const ce=(e,t)=>{if(p(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new o(e.common.issues);return this._error=t,this._error}}};function b(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var x=class{get description(){return this._def.description}_getType(e){return r(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:r(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new u,ctx:{common:e.parent.common,data:e.data,parsedType:r(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(m(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:r(e)};return ce(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:r(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return p(n)?{value:n.value}:{issues:t.common.issues}}catch(e){((e?.message)?.toLowerCase())?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>p(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:r(e)},i=this._parse({data:e,path:n.path,parent:n});return ce(n,await(m(i)?i:Promise.resolve(i)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let a=e(t),o=()=>r.addIssue({code:i.custom,...n(t)});return typeof Promise<`u`&&a instanceof Promise?a.then(e=>e?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new q({schema:this,typeName:$.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return J.create(this,this._def)}nullable(){return Y.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return N.create(this)}promise(){return K.create(this,this._def)}or(e){return I.create([this,e],this._def)}and(e){return R.create(this,e,this._def)}transform(e){return new q({...b(this._def),schema:this,typeName:$.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new X({...b(this._def),innerType:this,defaultValue:t,typeName:$.ZodDefault})}brand(){return new Ve({typeName:$.ZodBranded,type:this,...b(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new Z({...b(this._def),innerType:this,catchValue:t,typeName:$.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return He.create(this,e)}readonly(){return Q.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const le=/^c[^\s-]{8,}$/i,ue=/^[0-9a-z]+$/,de=/^[0-9A-HJKMNP-TV-Z]{26}$/i,fe=/^[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}$/i,pe=/^[a-z0-9_-]{21}$/i,me=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,he=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ge=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let _e;const ve=/^(?:(?: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])$/,ye=/^(?:(?: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])$/,be=/^(([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]))$/,xe=/^(([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])$/,Se=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ce=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,we=`((\\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])))`,Te=RegExp(`^${we}$`);function Ee(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function De(e){return RegExp(`^${Ee(e)}$`)}function Oe(e){let t=`${we}T${Ee(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function ke(e,t){return!!((t===`v4`||!t)&&ve.test(e)||(t===`v6`||!t)&&be.test(e))}function Ae(e,t){if(!me.test(e))return!1;try{let[n]=e.split(`.`),r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||!i.typ||!i.alg||t&&i.alg!==t)}catch{return!1}}function je(e,t){return!!((t===`v4`||!t)&&ye.test(e)||(t===`v6`||!t)&&xe.test(e))}var S=class t extends x{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==n.string){let e=this._getOrReturnCtx(t);return l(e,{code:i.invalid_type,expected:n.string,received:e.parsedType}),d}let r=new u,a;for(let n of this._def.checks)if(n.kind===`min`)t.data.length<n.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:i.too_small,minimum:n.value,type:`string`,inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind===`max`)t.data.length>n.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:i.too_big,maximum:n.value,type:`string`,inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind===`length`){let e=t.data.length>n.value,o=t.data.length<n.value;(e||o)&&(a=this._getOrReturnCtx(t,a),e?l(a,{code:i.too_big,maximum:n.value,type:`string`,inclusive:!0,exact:!0,message:n.message}):o&&l(a,{code:i.too_small,minimum:n.value,type:`string`,inclusive:!0,exact:!0,message:n.message}),r.dirty())}else if(n.kind===`email`)ge.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`email`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`emoji`)_e||=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`),_e.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`emoji`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`uuid`)fe.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`uuid`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`nanoid`)pe.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`nanoid`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`cuid`)le.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`cuid`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`cuid2`)ue.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`cuid2`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`ulid`)de.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`ulid`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`url`)try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),l(a,{validation:`url`,code:i.invalid_string,message:n.message}),r.dirty()}else n.kind===`regex`?(n.regex.lastIndex=0,n.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`regex`,code:i.invalid_string,message:n.message}),r.dirty())):n.kind===`trim`?t.data=t.data.trim():n.kind===`includes`?t.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()):n.kind===`toLowerCase`?t.data=t.data.toLowerCase():n.kind===`toUpperCase`?t.data=t.data.toUpperCase():n.kind===`startsWith`?t.data.startsWith(n.value)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()):n.kind===`endsWith`?t.data.endsWith(n.value)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()):n.kind===`datetime`?Oe(n).test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:`datetime`,message:n.message}),r.dirty()):n.kind===`date`?Te.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:`date`,message:n.message}),r.dirty()):n.kind===`time`?De(n).test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:`time`,message:n.message}),r.dirty()):n.kind===`duration`?he.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`duration`,code:i.invalid_string,message:n.message}),r.dirty()):n.kind===`ip`?ke(t.data,n.version)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`ip`,code:i.invalid_string,message:n.message}),r.dirty()):n.kind===`jwt`?Ae(t.data,n.alg)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`jwt`,code:i.invalid_string,message:n.message}),r.dirty()):n.kind===`cidr`?je(t.data,n.version)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`cidr`,code:i.invalid_string,message:n.message}),r.dirty()):n.kind===`base64`?Se.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`base64`,code:i.invalid_string,message:n.message}),r.dirty()):n.kind===`base64url`?Ce.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`base64url`,code:i.invalid_string,message:n.message}),r.dirty()):e.assertNever(n);return{status:r.value,value:t.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:i.invalid_string,...g.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:`email`,...g.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...g.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...g.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...g.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...g.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...g.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...g.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...g.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...g.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...g.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...g.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...g.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...g.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...g.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...g.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...g.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...g.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...g.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...g.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...g.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...g.errToObj(t)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};S.create=e=>new S({checks:[],typeName:$.ZodString,coerce:e?.coerce??!1,...b(e)});function Me(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return parseInt(e.toFixed(i).replace(`.`,``))%parseInt(t.toFixed(i).replace(`.`,``))/10**i}var C=class t extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==n.number){let e=this._getOrReturnCtx(t);return l(e,{code:i.invalid_type,expected:n.number,received:e.parsedType}),d}let r,a=new u;for(let n of this._def.checks)n.kind===`int`?e.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),l(r,{code:i.invalid_type,expected:`integer`,received:`float`,message:n.message}),a.dirty()):n.kind===`min`?(n.inclusive?t.data<n.value:t.data<=n.value)&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.too_small,minimum:n.value,type:`number`,inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind===`max`?(n.inclusive?t.data>n.value:t.data>=n.value)&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.too_big,maximum:n.value,type:`number`,inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind===`multipleOf`?Me(t.data,n.value)!==0&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind===`finite`?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),l(r,{code:i.not_finite,message:n.message}),a.dirty()):e.assertNever(n);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit(`min`,e,!0,g.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,g.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,g.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,g.toString(t))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:`int`,message:g.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:g.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:g.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:g.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:g.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(t=>t.kind===`int`||t.kind===`multipleOf`&&e.isInteger(t.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};C.create=e=>new C({checks:[],typeName:$.ZodNumber,coerce:e?.coerce||!1,...b(e)});var w=class t extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==n.bigint)return this._getInvalidInput(t);let r,a=new u;for(let n of this._def.checks)n.kind===`min`?(n.inclusive?t.data<n.value:t.data<=n.value)&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.too_small,type:`bigint`,minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind===`max`?(n.inclusive?t.data>n.value:t.data>=n.value)&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.too_big,type:`bigint`,maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind===`multipleOf`?t.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):e.assertNever(n);return{status:a.value,value:t.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.bigint,received:t.parsedType}),d}gte(e,t){return this.setLimit(`min`,e,!0,g.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,g.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,g.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,g.toString(t))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:g.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};w.create=e=>new w({checks:[],typeName:$.ZodBigInt,coerce:e?.coerce??!1,...b(e)});var T=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==n.boolean){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.boolean,received:t.parsedType}),d}return f(e.data)}};T.create=e=>new T({typeName:$.ZodBoolean,coerce:e?.coerce||!1,...b(e)});var E=class t extends x{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==n.date){let e=this._getOrReturnCtx(t);return l(e,{code:i.invalid_type,expected:n.date,received:e.parsedType}),d}if(isNaN(t.data.getTime()))return l(this._getOrReturnCtx(t),{code:i.invalid_date}),d;let r=new u,a;for(let n of this._def.checks)n.kind===`min`?t.data.getTime()<n.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:i.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:`date`}),r.dirty()):n.kind===`max`?t.data.getTime()>n.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:i.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:`date`}),r.dirty()):e.assertNever(n);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:g.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:g.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};E.create=e=>new E({checks:[],coerce:e?.coerce||!1,typeName:$.ZodDate,...b(e)});var Ne=class extends x{_parse(e){if(this._getType(e)!==n.symbol){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.symbol,received:t.parsedType}),d}return f(e.data)}};Ne.create=e=>new Ne({typeName:$.ZodSymbol,...b(e)});var D=class extends x{_parse(e){if(this._getType(e)!==n.undefined){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.undefined,received:t.parsedType}),d}return f(e.data)}};D.create=e=>new D({typeName:$.ZodUndefined,...b(e)});var O=class extends x{_parse(e){if(this._getType(e)!==n.null){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.null,received:t.parsedType}),d}return f(e.data)}};O.create=e=>new O({typeName:$.ZodNull,...b(e)});var k=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return f(e.data)}};k.create=e=>new k({typeName:$.ZodAny,...b(e)});var A=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return f(e.data)}};A.create=e=>new A({typeName:$.ZodUnknown,...b(e)});var j=class extends x{_parse(e){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.never,received:t.parsedType}),d}};j.create=e=>new j({typeName:$.ZodNever,...b(e)});var M=class extends x{_parse(e){if(this._getType(e)!==n.undefined){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.void,received:t.parsedType}),d}return f(e.data)}};M.create=e=>new M({typeName:$.ZodVoid,...b(e)});var N=class e extends x{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==n.array)return l(t,{code:i.invalid_type,expected:n.array,received:t.parsedType}),d;if(a.exactLength!==null){let e=t.data.length>a.exactLength.value,n=t.data.length<a.exactLength.value;(e||n)&&(l(t,{code:e?i.too_big:i.too_small,minimum:n?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(l(t,{code:i.too_small,minimum:a.minLength.value,type:`array`,inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(l(t,{code:i.too_big,maximum:a.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>a.type._parseAsync(new y(t,e,t.path,n)))).then(e=>u.mergeArray(r,e));let o=[...t.data].map((e,n)=>a.type._parseSync(new y(t,e,t.path,n)));return u.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:g.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:g.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:g.toString(n)}})}nonempty(e){return this.min(1,e)}};N.create=(e,t)=>new N({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$.ZodArray,...b(t)});function P(e){if(e instanceof F){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=J.create(P(r))}return new F({...e._def,shape:()=>t})}else if(e instanceof N)return new N({...e._def,type:P(e.element)});else if(e instanceof J)return J.create(P(e.unwrap()));else if(e instanceof Y)return Y.create(P(e.unwrap()));else if(e instanceof z)return z.create(e.items.map(e=>P(e)));else return e}var F=class t extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=e.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(e){if(this._getType(e)!==n.object){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.object,received:t.parsedType}),d}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof j&&this._def.unknownKeys===`strip`))for(let e in r.data)o.includes(e)||s.push(e);let c=[];for(let e of o){let t=a[e],n=r.data[e];c.push({key:{status:`valid`,value:e},value:t._parse(new y(r,n,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof j){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of s)c.push({key:{status:`valid`,value:e},value:{status:`valid`,value:r.data[e]}});else if(e===`strict`)s.length>0&&(l(r,{code:i.unrecognized_keys,keys:s}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of s){let n=r.data[t];c.push({key:{status:`valid`,value:t},value:e._parse(new y(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of c){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>u.mergeObjectSync(t,e)):u.mergeObjectSync(t,c)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new t({...this._def,unknownKeys:`strict`,...e===void 0?{}:{errorMap:(t,n)=>{var r;let i=(r=this._def).errorMap?.call(r,t,n).message??n.defaultError;return t.code===`unrecognized_keys`?{message:g.errToObj(e).message??i}:{message:i}}}})}strip(){return new t({...this._def,unknownKeys:`strip`})}passthrough(){return new t({...this._def,unknownKeys:`passthrough`})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:$.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new t({...this._def,catchall:e})}pick(n){let r={};return e.objectKeys(n).forEach(e=>{n[e]&&this.shape[e]&&(r[e]=this.shape[e])}),new t({...this._def,shape:()=>r})}omit(n){let r={};return e.objectKeys(this.shape).forEach(e=>{n[e]||(r[e]=this.shape[e])}),new t({...this._def,shape:()=>r})}deepPartial(){return P(this)}partial(n){let r={};return e.objectKeys(this.shape).forEach(e=>{let t=this.shape[e];n&&!n[e]?r[e]=t:r[e]=t.optional()}),new t({...this._def,shape:()=>r})}required(n){let r={};return e.objectKeys(this.shape).forEach(e=>{if(n&&!n[e])r[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof J;)t=t._def.innerType;r[e]=t}}),new t({...this._def,shape:()=>r})}keyof(){return Re(e.objectKeys(this.shape))}};F.create=(e,t)=>new F({shape:()=>e,unknownKeys:`strip`,catchall:j.create(),typeName:$.ZodObject,...b(t)}),F.strictCreate=(e,t)=>new F({shape:()=>e,unknownKeys:`strict`,catchall:j.create(),typeName:$.ZodObject,...b(t)}),F.lazycreate=(e,t)=>new F({shape:e,unknownKeys:`strip`,catchall:j.create(),typeName:$.ZodObject,...b(t)});var I=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new o(e.ctx.common.issues));return l(t,{code:i.invalid_union,unionErrors:n}),d}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let a=r.map(e=>new o(e));return l(t,{code:i.invalid_union,unionErrors:a}),d}}get options(){return this._def.options}};I.create=(e,t)=>new I({options:e,typeName:$.ZodUnion,...b(t)});const L=t=>t instanceof H?L(t.schema):t instanceof q?L(t.innerType()):t instanceof U?[t.value]:t instanceof W?t.options:t instanceof G?e.objectValues(t.enum):t instanceof X?L(t._def.innerType):t instanceof D?[void 0]:t instanceof O?[null]:t instanceof J?[void 0,...L(t.unwrap())]:t instanceof Y?[null,...L(t.unwrap())]:t instanceof Ve||t instanceof Q?L(t.unwrap()):t instanceof Z?L(t._def.innerType):[];var Pe=class e extends x{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==n.object)return l(t,{code:i.invalid_type,expected:n.object,received:t.parsedType}),d;let r=this.discriminator,a=t.data[r],o=this.optionsMap.get(a);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:i.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),d)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=L(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:$.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...b(r)})}};function Fe(t,i){let a=r(t),o=r(i);if(t===i)return{valid:!0,data:t};if(a===n.object&&o===n.object){let n=e.objectKeys(i),r=e.objectKeys(t).filter(e=>n.indexOf(e)!==-1),a={...t,...i};for(let e of r){let n=Fe(t[e],i[e]);if(!n.valid)return{valid:!1};a[e]=n.data}return{valid:!0,data:a}}else if(a===n.array&&o===n.array){if(t.length!==i.length)return{valid:!1};let e=[];for(let n=0;n<t.length;n++){let r=t[n],a=i[n],o=Fe(r,a);if(!o.valid)return{valid:!1};e.push(o.data)}return{valid:!0,data:e}}else if(a===n.date&&o===n.date&&+t==+i)return{valid:!0,data:t};else return{valid:!1}}var R=class extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(ae(e)||ae(r))return d;let a=Fe(e.value,r.value);return a.valid?((oe(e)||oe(r))&&t.dirty(),{status:t.value,value:a.data}):(l(n,{code:i.invalid_intersection_types}),d)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};R.create=(e,t,n)=>new R({left:e,right:t,typeName:$.ZodIntersection,...b(n)});var z=class e extends x{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.array)return l(r,{code:i.invalid_type,expected:n.array,received:r.parsedType}),d;if(r.data.length<this._def.items.length)return l(r,{code:i.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),d;!this._def.rest&&r.data.length>this._def.items.length&&(l(r,{code:i.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let a=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new y(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>u.mergeArray(t,e)):u.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};z.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new z({items:e,typeName:$.ZodTuple,rest:null,...b(t)})};var Ie=class e extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.object)return l(r,{code:i.invalid_type,expected:n.object,received:r.parsedType}),d;let a=[],o=this._def.keyType,s=this._def.valueType;for(let e in r.data)a.push({key:o._parse(new y(r,e,r.path,e)),value:s._parse(new y(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?u.mergeObjectAsync(t,a):u.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof x?new e({keyType:t,valueType:n,typeName:$.ZodRecord,...b(r)}):new e({keyType:S.create(),valueType:t,typeName:$.ZodRecord,...b(n)})}},B=class extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.map)return l(r,{code:i.invalid_type,expected:n.map,received:r.parsedType}),d;let a=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([e,t],n)=>({key:a._parse(new y(r,e,r.path,[n,`key`])),value:o._parse(new y(r,t,r.path,[n,`value`]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of s){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return d;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of s){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return d;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};B.create=(e,t,n)=>new B({valueType:t,keyType:e,typeName:$.ZodMap,...b(n)});var V=class e extends x{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.set)return l(r,{code:i.invalid_type,expected:n.set,received:r.parsedType}),d;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(l(r,{code:i.too_small,minimum:a.minSize.value,type:`set`,inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(l(r,{code:i.too_big,maximum:a.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let o=this._def.valueType;function s(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return d;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let c=[...r.data.values()].map((e,t)=>o._parse(new y(r,e,r.path,t)));return r.common.async?Promise.all(c).then(e=>s(e)):s(c)}min(t,n){return new e({...this._def,minSize:{value:t,message:g.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:g.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};V.create=(e,t)=>new V({valueType:e,minSize:null,maxSize:null,typeName:$.ZodSet,...b(t)});var Le=class e extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==n.function)return l(t,{code:i.invalid_type,expected:n.function,received:t.parsedType}),d;function r(e,n){return ne({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,te(),s].filter(e=>!!e),issueData:{code:i.invalid_arguments,argumentsError:n}})}function a(e,n){return ne({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,te(),s].filter(e=>!!e),issueData:{code:i.invalid_return_type,returnTypeError:n}})}let c={errorMap:t.common.contextualErrorMap},ee=t.data;if(this._def.returns instanceof K){let e=this;return f(async function(...t){let n=new o([]),i=await e._def.args.parseAsync(t,c).catch(e=>{throw n.addIssue(r(t,e)),n}),s=await Reflect.apply(ee,this,i);return await e._def.returns._def.type.parseAsync(s,c).catch(e=>{throw n.addIssue(a(s,e)),n})})}else{let e=this;return f(function(...t){let n=e._def.args.safeParse(t,c);if(!n.success)throw new o([r(t,n.error)]);let i=Reflect.apply(ee,this,n.data),s=e._def.returns.safeParse(i,c);if(!s.success)throw new o([a(i,s.error)]);return s.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:z.create(t).rest(A.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||z.create([]).rest(A.create()),returns:n||A.create(),typeName:$.ZodFunction,...b(r)})}},H=class extends x{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};H.create=(e,t)=>new H({getter:e,typeName:$.ZodLazy,...b(t)});var U=class extends x{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:i.invalid_literal,expected:this._def.value}),d}return{status:`valid`,value:e.data}}get value(){return this._def.value}};U.create=(e,t)=>new U({value:e,typeName:$.ZodLiteral,...b(t)});function Re(e,t){return new W({values:e,typeName:$.ZodEnum,...b(t)})}var W=class t extends x{constructor(){super(...arguments),_.set(this,void 0)}_parse(t){if(typeof t.data!=`string`){let n=this._getOrReturnCtx(t),r=this._def.values;return l(n,{expected:e.joinValues(r),received:n.parsedType,code:i.invalid_type}),d}if(h(this,_,`f`)||se(this,_,new Set(this._def.values),`f`),!h(this,_,`f`).has(t.data)){let e=this._getOrReturnCtx(t),n=this._def.values;return l(e,{received:e.data,code:i.invalid_enum_value,options:n}),d}return f(t.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(t=>!e.includes(t)),{...this._def,...n})}};_=new WeakMap,W.create=Re;var G=class extends x{constructor(){super(...arguments),v.set(this,void 0)}_parse(t){let r=e.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==n.string&&a.parsedType!==n.number){let t=e.objectValues(r);return l(a,{expected:e.joinValues(t),received:a.parsedType,code:i.invalid_type}),d}if(h(this,v,`f`)||se(this,v,new Set(e.getValidEnumValues(this._def.values)),`f`),!h(this,v,`f`).has(t.data)){let t=e.objectValues(r);return l(a,{received:a.data,code:i.invalid_enum_value,options:t}),d}return f(t.data)}get enum(){return this._def.values}};v=new WeakMap,G.create=(e,t)=>new G({values:e,typeName:$.ZodNativeEnum,...b(t)});var K=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==n.promise&&t.common.async===!1?(l(t,{code:i.invalid_type,expected:n.promise,received:t.parsedType}),d):f((t.parsedType===n.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};K.create=(e,t)=>new K({type:e,typeName:$.ZodPromise,...b(t)});var q=class extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,a={addIssue:e=>{l(r,e),e.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type===`preprocess`){let e=i.transform(r.data,a);if(r.common.async)return Promise.resolve(e).then(async e=>{if(n.value===`aborted`)return d;let t=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return t.status===`aborted`?d:t.status===`dirty`||n.value===`dirty`?ie(t.value):t});{if(n.value===`aborted`)return d;let t=this._def.schema._parseSync({data:e,path:r.path,parent:r});return t.status===`aborted`?d:t.status===`dirty`||n.value===`dirty`?ie(t.value):t}}if(i.type===`refinement`){let e=e=>{let t=i.refinement(e,a);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(r.common.async===!1){let t=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return t.status===`aborted`?d:(t.status===`dirty`&&n.dirty(),e(t.value),{status:n.value,value:t.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(t=>t.status===`aborted`?d:(t.status===`dirty`&&n.dirty(),e(t.value).then(()=>({status:n.value,value:t.value}))))}if(i.type===`transform`)if(r.common.async===!1){let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!p(e))return e;let t=i.transform(e.value,a);if(t instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:n.value,value:t}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>p(e)?Promise.resolve(i.transform(e.value,a)).then(e=>({status:n.value,value:e})):e);e.assertNever(i)}};q.create=(e,t,n)=>new q({schema:e,typeName:$.ZodEffects,effect:t,...b(n)}),q.createWithPreprocess=(e,t,n)=>new q({schema:t,effect:{type:`preprocess`,transform:e},typeName:$.ZodEffects,...b(n)});var J=class extends x{_parse(e){return this._getType(e)===n.undefined?f(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};J.create=(e,t)=>new J({innerType:e,typeName:$.ZodOptional,...b(t)});var Y=class extends x{_parse(e){return this._getType(e)===n.null?f(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Y.create=(e,t)=>new Y({innerType:e,typeName:$.ZodNullable,...b(t)});var X=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===n.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};X.create=(e,t)=>new X({innerType:e,typeName:$.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...b(t)});var Z=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return m(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new o(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new o(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Z.create=(e,t)=>new Z({innerType:e,typeName:$.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...b(t)});var ze=class extends x{_parse(e){if(this._getType(e)!==n.nan){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.nan,received:t.parsedType}),d}return{status:`valid`,value:e.data}}};ze.create=e=>new ze({typeName:$.ZodNaN,...b(e)});const Be=Symbol(`zod_brand`);var Ve=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},He=class e extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?d:e.status===`dirty`?(t.dirty(),ie(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?d:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:$.ZodPipeline})}},Q=class extends x{_parse(e){let t=this._def.innerType._parse(e),n=e=>(p(e)&&(e.value=Object.freeze(e.value)),e);return m(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};Q.create=(e,t)=>new Q({innerType:e,typeName:$.ZodReadonly,...b(t)});function Ue(e,t){let n=typeof e==`function`?e(t):typeof e==`string`?{message:e}:e;return typeof n==`string`?{message:n}:n}function We(e,t={},n){return e?k.create().superRefine((r,i)=>{let a=e(r);if(a instanceof Promise)return a.then(e=>{if(!e){let e=Ue(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}});if(!a){let e=Ue(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}}):k.create()}const Ge={object:F.lazycreate};var $;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})($||={});const Ke=(e,t={message:`Input not instance of ${e.name}`})=>We(t=>t instanceof e,t),qe=S.create,Je=C.create,Ye=ze.create,Xe=w.create,Ze=T.create,Qe=E.create,$e=Ne.create,et=D.create,tt=O.create,nt=k.create,rt=A.create,it=j.create,at=M.create,ot=N.create,st=F.create,ct=F.strictCreate,lt=I.create,ut=Pe.create,dt=R.create,ft=z.create,pt=Ie.create,mt=B.create,ht=V.create,gt=Le.create,_t=H.create,vt=U.create,yt=W.create,bt=G.create,xt=K.create,St=q.create,Ct=J.create,wt=Y.create,Tt=q.createWithPreprocess,Et=He.create;var Dt=Object.freeze({__proto__:null,defaultErrorMap:s,setErrorMap:ee,getErrorMap:te,makeIssue:ne,EMPTY_PATH:re,addIssueToContext:l,ParseStatus:u,INVALID:d,DIRTY:ie,OK:f,isAborted:ae,isDirty:oe,isValid:p,isAsync:m,get util(){return e},get objectUtil(){return t},ZodParsedType:n,getParsedType:r,ZodType:x,datetimeRegex:Oe,ZodString:S,ZodNumber:C,ZodBigInt:w,ZodBoolean:T,ZodDate:E,ZodSymbol:Ne,ZodUndefined:D,ZodNull:O,ZodAny:k,ZodUnknown:A,ZodNever:j,ZodVoid:M,ZodArray:N,ZodObject:F,ZodUnion:I,ZodDiscriminatedUnion:Pe,ZodIntersection:R,ZodTuple:z,ZodRecord:Ie,ZodMap:B,ZodSet:V,ZodFunction:Le,ZodLazy:H,ZodLiteral:U,ZodEnum:W,ZodNativeEnum:G,ZodPromise:K,ZodEffects:q,ZodTransformer:q,ZodOptional:J,ZodNullable:Y,ZodDefault:X,ZodCatch:Z,ZodNaN:ze,BRAND:Be,ZodBranded:Ve,ZodPipeline:He,ZodReadonly:Q,custom:We,Schema:x,ZodSchema:x,late:Ge,get ZodFirstPartyTypeKind(){return $},coerce:{string:(e=>S.create({...e,coerce:!0})),number:(e=>C.create({...e,coerce:!0})),boolean:(e=>T.create({...e,coerce:!0})),bigint:(e=>w.create({...e,coerce:!0})),date:(e=>E.create({...e,coerce:!0}))},any:nt,array:ot,bigint:Xe,boolean:Ze,date:Qe,discriminatedUnion:ut,effect:St,enum:yt,function:gt,instanceof:Ke,intersection:dt,lazy:_t,literal:vt,map:mt,nan:Ye,nativeEnum:bt,never:it,null:tt,nullable:wt,number:Je,object:st,oboolean:()=>Ze().optional(),onumber:()=>Je().optional(),optional:Ct,ostring:()=>qe().optional(),pipeline:Et,preprocess:Tt,promise:xt,record:pt,set:ht,strictObject:ct,string:qe,symbol:$e,transformer:St,tuple:ft,undefined:et,union:lt,unknown:rt,void:at,NEVER:d,ZodIssueCode:i,quotelessJson:a,ZodError:o});const Ot=`2.1.0`;export{Dt as n,Ot as t};
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
// The network-policy types are copied verbatim from the installed just-bash at
|
|
2
|
+
// vendor time (see scripts/vendor-compiled/just-bash.mjs) so the credential-
|
|
3
|
+
// brokering surface (allowedUrlPrefixes + header transforms) never drifts.
|
|
4
|
+
import type { NetworkConfig } from "./network/types.js";
|
|
5
|
+
|
|
6
|
+
export type {
|
|
7
|
+
AllowedUrl,
|
|
8
|
+
AllowedUrlEntry,
|
|
9
|
+
HttpMethod,
|
|
10
|
+
NetworkConfig,
|
|
11
|
+
RequestTransform,
|
|
12
|
+
} from "./network/types.js";
|
|
13
|
+
|
|
1
14
|
export type InitialFileContent = string | Uint8Array;
|
|
2
15
|
export type InitialFiles = Record<string, InitialFileContent>;
|
|
3
16
|
|
|
@@ -5,6 +18,10 @@ export interface IFileSystem {
|
|
|
5
18
|
getAllPaths(): string[];
|
|
6
19
|
mkdir(path: string, options?: { recursive?: boolean | undefined }): Promise<void>;
|
|
7
20
|
readFileBuffer(path: string): Promise<Uint8Array>;
|
|
21
|
+
rm(
|
|
22
|
+
path: string,
|
|
23
|
+
options?: { force?: boolean | undefined; recursive?: boolean | undefined },
|
|
24
|
+
): Promise<void>;
|
|
8
25
|
stat(path: string): Promise<{
|
|
9
26
|
isDirectory: boolean;
|
|
10
27
|
isFile: boolean;
|
|
@@ -17,7 +34,7 @@ export interface BashOptions {
|
|
|
17
34
|
cwd: string;
|
|
18
35
|
env?: Readonly<Record<string, string>> | undefined;
|
|
19
36
|
fs: IFileSystem;
|
|
20
|
-
network?:
|
|
37
|
+
network?: NetworkConfig | undefined;
|
|
21
38
|
}
|
|
22
39
|
|
|
23
40
|
export interface BashExecResult {
|
|
@@ -38,6 +55,10 @@ export declare class InMemoryFs implements IFileSystem {
|
|
|
38
55
|
getAllPaths(): string[];
|
|
39
56
|
mkdir(path: string, options?: { recursive?: boolean | undefined }): Promise<void>;
|
|
40
57
|
readFileBuffer(path: string): Promise<Uint8Array>;
|
|
58
|
+
rm(
|
|
59
|
+
path: string,
|
|
60
|
+
options?: { force?: boolean | undefined; recursive?: boolean | undefined },
|
|
61
|
+
): Promise<void>;
|
|
41
62
|
stat(path: string): Promise<{
|
|
42
63
|
isDirectory: boolean;
|
|
43
64
|
isFile: boolean;
|
|
@@ -50,7 +71,7 @@ export interface SandboxOptions {
|
|
|
50
71
|
cwd?: string | undefined;
|
|
51
72
|
env?: Record<string, string> | undefined;
|
|
52
73
|
fs?: IFileSystem | undefined;
|
|
53
|
-
network?:
|
|
74
|
+
network?: NetworkConfig | undefined;
|
|
54
75
|
timeoutMs?: number | undefined;
|
|
55
76
|
}
|
|
56
77
|
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network configuration types
|
|
3
|
+
*
|
|
4
|
+
* Network access is disabled by default. To enable network access (e.g., for curl),
|
|
5
|
+
* you must explicitly configure allowed URLs.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* DNS lookup result used for private IP resolution checks
|
|
9
|
+
*/
|
|
10
|
+
export interface DnsLookupResult {
|
|
11
|
+
address: string;
|
|
12
|
+
family: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* HTTP methods that can be allowed
|
|
16
|
+
*/
|
|
17
|
+
export type HttpMethod = "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS";
|
|
18
|
+
/**
|
|
19
|
+
* Header transform applied at the fetch boundary.
|
|
20
|
+
* Headers specified here override any user-supplied headers with the same name.
|
|
21
|
+
*/
|
|
22
|
+
export interface RequestTransform {
|
|
23
|
+
headers: Record<string, string>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* An allowed URL entry with optional header transforms.
|
|
27
|
+
* Transforms are applied at the fetch boundary so secrets never enter the sandbox.
|
|
28
|
+
*/
|
|
29
|
+
export interface AllowedUrl {
|
|
30
|
+
url: string;
|
|
31
|
+
transform?: RequestTransform[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* An entry in the allowedUrlPrefixes list: either a plain URL string or
|
|
35
|
+
* an object with a URL and optional transforms.
|
|
36
|
+
*/
|
|
37
|
+
export type AllowedUrlEntry = string | AllowedUrl;
|
|
38
|
+
/**
|
|
39
|
+
* Configuration for network access
|
|
40
|
+
*/
|
|
41
|
+
export interface NetworkConfig {
|
|
42
|
+
/**
|
|
43
|
+
* List of allowed URL prefixes. Each entry must be a full origin (scheme + host),
|
|
44
|
+
* optionally followed by a path prefix:
|
|
45
|
+
* - An origin: "https://api.example.com" - allows all paths on this origin
|
|
46
|
+
* - An origin + path prefix: "https://api.example.com/v1/" - allows only paths starting with /v1/
|
|
47
|
+
*
|
|
48
|
+
* Entries can be plain strings or objects with transforms for credentials brokering:
|
|
49
|
+
* ```
|
|
50
|
+
* allowedUrlPrefixes: [
|
|
51
|
+
* "https://other-api.com",
|
|
52
|
+
* {
|
|
53
|
+
* url: "https://ai-gateway.vercel.sh",
|
|
54
|
+
* transform: [{ headers: { "Authorization": "Bearer secret" } }],
|
|
55
|
+
* },
|
|
56
|
+
* ]
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* The check is performed on the full URL, so "https://api.example.com/v1" will allow:
|
|
60
|
+
* - https://api.example.com/v1
|
|
61
|
+
* - https://api.example.com/v1/users
|
|
62
|
+
* - https://api.example.com/v1/users/123
|
|
63
|
+
*
|
|
64
|
+
* But NOT:
|
|
65
|
+
* - https://api.example.com/v10
|
|
66
|
+
* - https://api.example.com/v1-admin
|
|
67
|
+
* - https://api.example.com/v2/users
|
|
68
|
+
* - https://api.example.org/v1/users (different origin)
|
|
69
|
+
* - URLs that rely on ambiguous encoded separators like %2f or %5c
|
|
70
|
+
*
|
|
71
|
+
* Invalid entries (missing scheme, missing host, relative paths) will throw an error.
|
|
72
|
+
*/
|
|
73
|
+
allowedUrlPrefixes?: AllowedUrlEntry[];
|
|
74
|
+
/**
|
|
75
|
+
* List of allowed HTTP methods. Defaults to ["GET", "HEAD"] for safety.
|
|
76
|
+
* dangerouslyAllowFullInternetAccess to enables all methods.
|
|
77
|
+
*/
|
|
78
|
+
allowedMethods?: HttpMethod[];
|
|
79
|
+
/**
|
|
80
|
+
* Bypass the allow-list and allow all URLs and methods.
|
|
81
|
+
* DANGEROUS: Only use this in trusted environments.
|
|
82
|
+
*/
|
|
83
|
+
dangerouslyAllowFullInternetAccess?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Maximum number of redirects to follow (default: 20)
|
|
86
|
+
*/
|
|
87
|
+
maxRedirects?: number;
|
|
88
|
+
/**
|
|
89
|
+
* Request timeout in milliseconds (default: 30000)
|
|
90
|
+
*/
|
|
91
|
+
timeoutMs?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Maximum response body size in bytes (default: 10MB).
|
|
94
|
+
* Responses larger than this will be rejected with ResponseTooLargeError.
|
|
95
|
+
*/
|
|
96
|
+
maxResponseSize?: number;
|
|
97
|
+
/**
|
|
98
|
+
* Reject URLs with private/loopback IP addresses as hostnames.
|
|
99
|
+
* Performs both lexical hostname checks and DNS resolution to catch
|
|
100
|
+
* domains that resolve to private IPs (e.g., DNS rebinding attacks).
|
|
101
|
+
* Useful for mitigating SSRF attacks. Default: false (opt-in).
|
|
102
|
+
*
|
|
103
|
+
* When enabled, the private IP check is enforced even when
|
|
104
|
+
* `dangerouslyAllowFullInternetAccess` is true, ensuring that
|
|
105
|
+
* internal/loopback addresses are never reachable.
|
|
106
|
+
*/
|
|
107
|
+
denyPrivateRanges?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* @internal Override DNS resolution for testing.
|
|
110
|
+
* When set, used instead of the default `dns.lookup` for the
|
|
111
|
+
* denyPrivateRanges DNS rebinding check.
|
|
112
|
+
*/
|
|
113
|
+
_dnsResolve?: (hostname: string) => Promise<DnsLookupResult[]>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Result of a network fetch operation
|
|
117
|
+
*/
|
|
118
|
+
export interface FetchResult {
|
|
119
|
+
status: number;
|
|
120
|
+
statusText: string;
|
|
121
|
+
headers: Record<string, string>;
|
|
122
|
+
/** Raw response bytes (never decoded as UTF-8 text). */
|
|
123
|
+
body: Uint8Array;
|
|
124
|
+
url: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Error thrown when a URL is not allowed
|
|
128
|
+
*/
|
|
129
|
+
export declare class NetworkAccessDeniedError extends Error {
|
|
130
|
+
constructor(url: string, reason?: string);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Error thrown when too many redirects occur
|
|
134
|
+
*/
|
|
135
|
+
export declare class TooManyRedirectsError extends Error {
|
|
136
|
+
constructor(maxRedirects: number);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Error thrown when a redirect target is not allowed
|
|
140
|
+
*/
|
|
141
|
+
export declare class RedirectNotAllowedError extends Error {
|
|
142
|
+
constructor(url: string);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Error thrown when an HTTP method is not allowed
|
|
146
|
+
*/
|
|
147
|
+
export declare class MethodNotAllowedError extends Error {
|
|
148
|
+
constructor(method: string, allowedMethods: string[]);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Error thrown when a response body exceeds the maximum allowed size
|
|
152
|
+
*/
|
|
153
|
+
export declare class ResponseTooLargeError extends Error {
|
|
154
|
+
constructor(maxSize: number);
|
|
155
|
+
}
|
|
@@ -22,6 +22,7 @@ export declare const COMPILE_METADATA_VERSION = 5;
|
|
|
22
22
|
*/
|
|
23
23
|
export interface CompilerArtifactPaths {
|
|
24
24
|
appRoot: string;
|
|
25
|
+
channelInstrumentationTypesPath: string;
|
|
25
26
|
compiledManifestPath: string;
|
|
26
27
|
compileDirectoryPath: string;
|
|
27
28
|
compileMetadataPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join,relative,resolve}from"node:path";import{mkdir,writeFile}from"node:fs/promises";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{createHash}from"node:crypto";import{summarizeDiscoverDiagnostics}from"#discover/diagnostics.js";import{normalizeLogicalPath}from"#discover/filesystem.js";import{createCompiledModuleMapSource}from"#compiler/module-map.js";import{compileAgentManifest}from"#compiler/normalize-manifest.js";import{materializeWorkspaceResources}from"#compiler/workspace-resources.js";const COMPILE_METADATA_KIND=`ash-compile-metadata`,COMPILE_METADATA_VERSION=5;function resolveCompilerArtifactPaths(t){let r=resolve(t),i=join(r,`.ash`,`discovery`),a=join(r,`.ash`,`compile`);return{appRoot:r,compiledManifestPath:join(a,`compiled-agent-manifest.json`),compileDirectoryPath:a,compileMetadataPath:join(a,`compile-metadata.json`),diagnosticsPath:join(i,`diagnostics.json`),discoveryManifestPath:join(i,`agent-discovery-manifest.json`),discoveryDirectoryPath:i,moduleMapPath:join(a,`module-map.mjs`)}}function createDiscoveryDiagnosticsArtifact(e){return{diagnostics:[...e],kind:`ash-discovery-diagnostics`,summary:summarizeDiscoverDiagnostics(e),version:1}}function createCompileMetadata(e){let t=resolveInstalledPackageInfo(),n=createContentHash(e.discoveryManifestJson),r=createContentHash(e.diagnosticsArtifactJson),i=createContentHash(e.moduleMapSource);return{compile:{moduleMap:{path:toArtifactRelativePath(e.appRoot,e.paths.moduleMapPath),sha256:i}},discovery:{diagnostics:{path:toArtifactRelativePath(e.appRoot,e.paths.diagnosticsPath),sha256:r},manifest:{path:toArtifactRelativePath(e.appRoot,e.paths.discoveryManifestPath),sha256:n},sourceGraphHash:createContentHash(`${n}:${r}:${i}`),summary:e.diagnosticsSummary},generator:{name:t.name,version:t.version},kind:COMPILE_METADATA_KIND,status:e.diagnosticsSummary.errors>0?`failed`:`ready`,version:5}}async function writeCompilerArtifacts(e){let t=resolveCompilerArtifactPaths(e.appRoot),n=createDiscoveryDiagnosticsArtifact(e.diagnostics),a=await materializeWorkspaceResources({compileDirectoryPath:t.compileDirectoryPath,manifest:await compileAgentManifest(e.manifest)}),o=serializeArtifactJson(a),s=serializeArtifactJson(e.manifest),c=serializeArtifactJson(n),l=createCompiledModuleMapSource({manifest:a,moduleMapPath:t.moduleMapPath}),u=createCompileMetadata({appRoot:e.appRoot,diagnosticsArtifactJson:c,diagnosticsSummary:n.summary,discoveryManifestJson:s,moduleMapSource:l,paths:t}),
|
|
1
|
+
import{join,relative,resolve}from"node:path";import{mkdir,writeFile}from"node:fs/promises";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{createHash}from"node:crypto";import{summarizeDiscoverDiagnostics}from"#discover/diagnostics.js";import{normalizeLogicalPath}from"#discover/filesystem.js";import{CHANNEL_INSTRUMENTATION_TYPES_FILE_NAME,createChannelInstrumentationTypesSource}from"#compiler/channel-instrumentation-types.js";import{createCompiledModuleMapSource}from"#compiler/module-map.js";import{compileAgentManifest}from"#compiler/normalize-manifest.js";import{materializeWorkspaceResources}from"#compiler/workspace-resources.js";const COMPILE_METADATA_KIND=`ash-compile-metadata`,COMPILE_METADATA_VERSION=5;function resolveCompilerArtifactPaths(t){let r=resolve(t),i=join(r,`.ash`,`discovery`),a=join(r,`.ash`,`compile`);return{appRoot:r,channelInstrumentationTypesPath:join(a,CHANNEL_INSTRUMENTATION_TYPES_FILE_NAME),compiledManifestPath:join(a,`compiled-agent-manifest.json`),compileDirectoryPath:a,compileMetadataPath:join(a,`compile-metadata.json`),diagnosticsPath:join(i,`diagnostics.json`),discoveryManifestPath:join(i,`agent-discovery-manifest.json`),discoveryDirectoryPath:i,moduleMapPath:join(a,`module-map.mjs`)}}function createDiscoveryDiagnosticsArtifact(e){return{diagnostics:[...e],kind:`ash-discovery-diagnostics`,summary:summarizeDiscoverDiagnostics(e),version:1}}function createCompileMetadata(e){let t=resolveInstalledPackageInfo(),n=createContentHash(e.discoveryManifestJson),r=createContentHash(e.diagnosticsArtifactJson),i=createContentHash(e.moduleMapSource);return{compile:{moduleMap:{path:toArtifactRelativePath(e.appRoot,e.paths.moduleMapPath),sha256:i}},discovery:{diagnostics:{path:toArtifactRelativePath(e.appRoot,e.paths.diagnosticsPath),sha256:r},manifest:{path:toArtifactRelativePath(e.appRoot,e.paths.discoveryManifestPath),sha256:n},sourceGraphHash:createContentHash(`${n}:${r}:${i}`),summary:e.diagnosticsSummary},generator:{name:t.name,version:t.version},kind:COMPILE_METADATA_KIND,status:e.diagnosticsSummary.errors>0?`failed`:`ready`,version:5}}async function writeCompilerArtifacts(e){let t=resolveCompilerArtifactPaths(e.appRoot),n=createDiscoveryDiagnosticsArtifact(e.diagnostics),a=await materializeWorkspaceResources({compileDirectoryPath:t.compileDirectoryPath,manifest:await compileAgentManifest(e.manifest)}),o=serializeArtifactJson(a),s=serializeArtifactJson(e.manifest),c=serializeArtifactJson(n),l=createCompiledModuleMapSource({manifest:a,moduleMapPath:t.moduleMapPath}),u=createChannelInstrumentationTypesSource({manifest:a,typesPath:t.channelInstrumentationTypesPath}),d=createCompileMetadata({appRoot:e.appRoot,diagnosticsArtifactJson:c,diagnosticsSummary:n.summary,discoveryManifestJson:s,moduleMapSource:l,paths:t}),f=serializeArtifactJson(d);return await mkdir(t.discoveryDirectoryPath,{recursive:!0}),await mkdir(t.compileDirectoryPath,{recursive:!0}),await Promise.all([writeFile(t.compiledManifestPath,o),writeFile(t.diagnosticsPath,c),writeFile(t.discoveryManifestPath,s),writeFile(t.channelInstrumentationTypesPath,u),writeFile(t.moduleMapPath,l),writeFile(t.compileMetadataPath,f)]),{compiledManifest:a,diagnosticsArtifact:n,metadata:d,moduleMapSource:l,paths:t}}function createContentHash(e){return createHash(`sha256`).update(e).digest(`hex`)}function serializeArtifactJson(e){return`${JSON.stringify(e,null,2)}\n`}function toArtifactRelativePath(e,r){return normalizeLogicalPath(relative(resolve(e),r))}export{COMPILE_METADATA_KIND,COMPILE_METADATA_VERSION,createCompileMetadata,resolveCompilerArtifactPaths,writeCompilerArtifacts};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CompiledAgentManifest } from "#compiler/manifest.js";
|
|
2
|
+
interface ChannelInstrumentationTypesSourceInput {
|
|
3
|
+
readonly manifest: CompiledAgentManifest;
|
|
4
|
+
readonly typesPath: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const CHANNEL_INSTRUMENTATION_TYPES_FILE_NAME = "channel-instrumentation-types.d.ts";
|
|
7
|
+
export declare function createChannelInstrumentationTypesSource(input: ChannelInstrumentationTypesSourceInput): string;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{dirname,join,relative}from"node:path";const CHANNEL_INSTRUMENTATION_TYPES_FILE_NAME=`channel-instrumentation-types.d.ts`;function createChannelInstrumentationTypesSource(e){let t=collectChannelInstrumentationDeclarations(e);return[`// Generated by Ash. Do not edit by hand.`,`import type { InferChannelMetadata } from "experimental-ash/channels";`,``,`declare module "experimental-ash/instrumentation" {`,...t.length===0?[` interface ChannelMetadataMap {}`,` interface ChannelReferenceMap {}`]:[` interface ChannelMetadataMap {`,...t.map(e=>` readonly ${JSON.stringify(e.kind)}: InferChannelMetadata<${renderImportedChannelType(e)}>;`),` }`,` interface ChannelReferenceMap {`,...t.map(e=>` readonly ${JSON.stringify(e.kind)}: ${renderImportedChannelType(e)};`),` }`],`}`,``].join(`
|
|
2
|
+
`)}function collectChannelInstrumentationDeclarations(t){let n=dirname(t.typesPath),r=new Map;for(let e of[...t.manifest.channels].filter(e=>e.kind===`channel`).sort(compareCompiledChannels)){let i=`channel:${e.name}`;r.has(i)||r.set(i,{exportName:e.exportName,importSpecifier:createChannelImportSpecifier({agentRoot:t.manifest.agentRoot,channel:e,fromDirectory:n}),kind:i})}return[...r.values()]}function compareCompiledChannels(e,t){return e.name.localeCompare(t.name)||e.logicalPath.localeCompare(t.logicalPath)||(e.exportName??``).localeCompare(t.exportName??``)||e.sourceId.localeCompare(t.sourceId)||e.method.localeCompare(t.method)||e.urlPath.localeCompare(t.urlPath)}function createChannelImportSpecifier(e){let r=join(e.agentRoot,toRuntimeImportLogicalPath(e.channel.logicalPath)),i=relative(e.fromDirectory,r).replaceAll(`\\`,`/`);return i.startsWith(`.`)?i:`./${i}`}function toRuntimeImportLogicalPath(e){return e.endsWith(`.mts`)?`${e.slice(0,-4)}.mjs`:e.endsWith(`.cts`)?`${e.slice(0,-4)}.cjs`:e.endsWith(`.ts`)?`${e.slice(0,-3)}.js`:e}function renderImportedChannelType(e){let t=e.exportName??`default`,n=`import(${JSON.stringify(e.importSpecifier)})`;return isIdentifierName(t)?`typeof ${n}.${t}`:`typeof ${n}[${JSON.stringify(t)}]`}function isIdentifierName(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}export{CHANNEL_INSTRUMENTATION_TYPES_FILE_NAME,createChannelInstrumentationTypesSource};
|
|
@@ -4,9 +4,10 @@ import type { ResolvedDynamicSkillResolver } from "#runtime/types.js";
|
|
|
4
4
|
import type { ContextContainer } from "#context/container.js";
|
|
5
5
|
import { ContextKey } from "#context/key.js";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* {@link dispatchDynamicSkillEvent}
|
|
9
|
-
* by the tool-loop to inject the announcement into model
|
|
7
|
+
* Durable pending skill announcement text. Set by
|
|
8
|
+
* {@link dispatchDynamicSkillEvent} whenever the dynamic skill manifest
|
|
9
|
+
* changes. Read by the tool-loop to inject the announcement into model
|
|
10
|
+
* context.
|
|
10
11
|
*/
|
|
11
12
|
export declare const PendingSkillAnnouncementKey: ContextKey<string>;
|
|
12
13
|
/**
|