evolve-sdk 0.0.55.dev1125__tar.gz → 0.0.55.dev1139__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/PKG-INFO +1 -1
  2. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/bridge/dist/bridge.bundle.cjs +1 -1
  3. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/__init__.py +7 -1
  4. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/hosted.py +119 -9
  5. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/results.py +14 -2
  6. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve_sdk.egg-info/PKG-INFO +1 -1
  7. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/pyproject.toml +1 -1
  8. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/LICENSE +0 -0
  9. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/MANIFEST.in +0 -0
  10. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/README.md +0 -0
  11. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/bridge/__init__.py +0 -0
  12. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/_http.py +0 -0
  13. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/agent.py +0 -0
  14. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/bridge.py +0 -0
  15. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/browser_credentials.py +0 -0
  16. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/browser_profiles.py +0 -0
  17. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/config.py +0 -0
  18. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/integrations.py +0 -0
  19. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/managed_secrets.py +0 -0
  20. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/pipeline/__init__.py +0 -0
  21. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/pipeline/pipeline.py +0 -0
  22. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/pipeline/types.py +0 -0
  23. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/prompts/__init__.py +0 -0
  24. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/prompts/agent_md/judge.md +0 -0
  25. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/prompts/agent_md/reduce.md +0 -0
  26. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/prompts/agent_md/verify.md +0 -0
  27. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/prompts/user/judge.md +0 -0
  28. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/prompts/user/retry_feedback.md +0 -0
  29. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/prompts/user/verify.md +0 -0
  30. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/py.typed +0 -0
  31. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/retry.py +0 -0
  32. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/schema.py +0 -0
  33. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/sessions_client.py +0 -0
  34. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/storage_client.py +0 -0
  35. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/swarm/__init__.py +0 -0
  36. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/swarm/results.py +0 -0
  37. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/swarm/swarm.py +0 -0
  38. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/swarm/types.py +0 -0
  39. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve/utils.py +0 -0
  40. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve_sdk.egg-info/SOURCES.txt +0 -0
  41. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve_sdk.egg-info/dependency_links.txt +0 -0
  42. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve_sdk.egg-info/requires.txt +0 -0
  43. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/evolve_sdk.egg-info/top_level.txt +0 -0
  44. {evolve_sdk-0.0.55.dev1125 → evolve_sdk-0.0.55.dev1139}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evolve-sdk
3
- Version: 0.0.55.dev1125
3
+ Version: 0.0.55.dev1139
4
4
  Summary: Pythonic SDK for multi-agent orchestration in E2B sandboxes
5
5
  Author-email: "Swarmlink, Inc." <brandomagnani@evolvingmachines.ai>
6
6
  License: Apache-2.0
@@ -668,7 +668,7 @@ def serve():
668
668
  if __name__ == "__main__":
669
669
  register_channel()
670
670
  serve()
671
- `;function MXe(e){return(e||process.env.EVOLVE_DASHBOARD_URL||ia).replace(/\/$/,"")}function DXe(e){let t=e.apiKey||process.env.EVOLVE_API_KEY;if(!t)throw new Error("EVOLVE_API_KEY is required for managed secrets");return t}async function UXe(e){return await e.text().catch(()=>"")}async function Iv(e,t,n={}){let r=await fetch(`${MXe(e.dashboardUrl)}${t}`,{...n,headers:{Authorization:`Bearer ${DXe(e)}`,accept:"application/json",...n.body?{"content-type":"application/json"}:{},...n.headers||{}}});if(!r.ok)throw new Error(`Managed secrets request failed (${r.status}): ${await UXe(r)}`);return await r.json()}function BXe(e){let t=n=>Array.isArray(n)?n.filter(r=>typeof r=="string"):[];return{id:String(e.id??""),name:String(e.name??""),...typeof e.label=="string"?{label:e.label}:{},...e.delivery==="brokered"||e.delivery==="direct"?{delivery:e.delivery}:{},allowedHosts:t(e.allowed_hosts??e.allowedHosts),allowedPathPrefixes:t(e.allowed_path_prefixes??e.allowedPathPrefixes),allowedMethods:t(e.allowed_methods??e.allowedMethods),createdAt:String(e.created_at??e.createdAt??""),updatedAt:String(e.updated_at??e.updatedAt??""),lastUsedAt:typeof(e.last_used_at??e.lastUsedAt)=="string"?e.last_used_at??e.lastUsedAt:null}}function SB(e={}){return{async list(){return(await Iv(e,"/api/managed-secrets")).secrets??[]},async set(t){let n={name:t.name,value:t.value,delivery:t.delivery,...t.label!==void 0?{label:t.label}:{},...t.allowedHosts!==void 0?{allowed_hosts:t.allowedHosts}:{},...t.allowedPathPrefixes!==void 0?{allowed_path_prefixes:t.allowedPathPrefixes}:{},...t.allowedMethods!==void 0?{allowed_methods:t.allowedMethods}:{}},r=await Iv(e,"/api/managed-secrets",{method:"POST",body:JSON.stringify(n)});return{status:r.status,secret:BXe(r.secret??{})}},async delete(t){let n=await Iv(e,"/api/managed-secrets",{method:"DELETE",body:JSON.stringify({name:t.name,...t.label!==void 0?{label:t.label}:{}})});return{ok:n.ok,name:n.name,label:n.label}}}}function FXe(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function WZ(e){try{return new URL(e).protocol==="https:"}catch{return!1}}function LXe(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return typeof t.token=="string"&&t.token.startsWith("evrt_")&&typeof t.bindingSecret=="string"&&t.bindingSecret.startsWith("evrb_")&&typeof t.egressUrl=="string"&&WZ(t.egressUrl)&&typeof t.channelUrl=="string"&&WZ(t.channelUrl)&&typeof t.expiresAt=="string"&&Array.isArray(t.env)&&t.env.every(n=>{if(!n||typeof n!="object"||Array.isArray(n))return!1;let r=n;return typeof r.name!="string"||typeof r.envName!="string"||!FXe(r.allowedHosts)?!1:r.delivery==="direct"?typeof r.value=="string"&&r.value.length>0:(r.delivery===void 0||r.delivery==="brokered")&&typeof r.placeholder=="string"&&r.placeholder.startsWith("evsec_")&&r.value===void 0})}async function lQ(e,t){let n=await Iv(e,"/api/managed-secrets/runtime-token",{method:"POST",body:JSON.stringify(t)});if(!LXe(n))throw new Error("Invalid managed secret runtime token response");return n}async function uQ(e,t){return(await Iv(e,"/api/managed-secrets/runtime-token",{method:"PATCH",body:JSON.stringify(t)})).ok}async function dQ(e,t){return(await Iv(e,"/api/managed-secrets/runtime-token",{method:"DELETE",body:JSON.stringify(t)})).ok}var VXe=/^[A-Za-z0-9._-]{1,80}$/;function qXe(e){if(!Array.isArray(e)||e.length===0)throw new Error("withManagedSecrets() requires at least one secret");return e.map((t,n)=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`managedSecrets[${n}] must be an object with a name`);let r=YZ(t.name,`managedSecrets[${n}].name`),a;if(t.label!==void 0){if(typeof t.label!="string"||!VXe.test(t.label.trim()))throw new Error(`managedSecrets[${n}].label may contain only letters, numbers, dots, underscores, and hyphens (at most 80 characters)`);a=t.label.trim()}let i=t.as===void 0?void 0:YZ(t.as,`managedSecrets[${n}].as`);return{name:r,...a!==void 0?{label:a}:{},...i!==void 0?{as:i}:{}}})}function YZ(e,t){if(typeof e!="string"||!e.trim())throw new Error(`${t} is required`);let n=e.trim().toUpperCase();if(!/^[A-Z_][A-Z0-9_]{0,127}$/.test(n))throw new Error(`${t} must be a valid environment variable name`);if(n.startsWith("EVOLVE_"))throw new Error(`${t} cannot use the reserved EVOLVE_ prefix`);return n}function $Xe(e){let t=new Set(["EVOLVE_API_KEY","EVOLVE_PROVIDER_RUNTIME_BINDING","GEMINI_DEFAULT_AUTH_TYPE",...sQ]),n=r=>{r&&t.add(r)};n(e.apiKeyEnv),n(e.baseUrlEnv),n(e.customHeadersEnv),n(e.gatewayConfigEnv),e.spendTrackingEnvs&&(n(e.spendTrackingEnvs.sessionTagEnv),n(e.spendTrackingEnvs.runTagEnv));for(let r of Object.values(e.providerEnvMap??{}))n(r.keyEnv);return t}function fQ(e,t){if(!e)return;let n=qXe(e),r=$Xe(t),a=new Set;for(let i of n){let s=i.as||i.name;if(r.has(s))throw new Error(`${s} is reserved for Evolve-managed sandbox services and cannot be used as a managed secret env var`);if(a.has(s))throw new Error(`duplicate managed secret env var: ${s}`);a.add(s)}return n}function _B(e){return e.env.some(t=>!bB(t))}function pQ(e){let t={};for(let a of e.env)bB(a)?t[a.envName]=a.value:t[a.envName]=a.placeholder;if(!_B(e))return t;let n=`http://127.0.0.1:${NO}`;t.HTTPS_PROXY=n,t.https_proxy=n,t.NODE_EXTRA_CA_CERTS=bm,t.SSL_CERT_FILE=wv,t.REQUESTS_CA_BUNDLE=wv,t.CURL_CA_BUNDLE=wv,t.GIT_SSL_CAINFO=wv;let r=new URL(e.egressUrl).hostname;return t.NO_PROXY=`localhost,127.0.0.1,::1,${r}`,t.no_proxy=t.NO_PROXY,t}function hQ(e){let t=e.env.filter(r=>!bB(r)),n=Array.from(new Set(t.flatMap(r=>r.allowedHosts)));return JSON.stringify({egress_url:e.egressUrl,channel_url:e.channelUrl,token:e.token,binding:e.bindingSecret,hosts:n,placeholders:t.map(r=>r.placeholder),base_dir:so,ca_cert:bm,ca_key:xO,port:NO,max_body_bytes:10*1024*1024},null,2)}function mQ(){return["umask 077",`mkdir -p ${so}/certs`,`chmod 700 ${so} ${so}/certs`,`chmod 700 ${Jw} 2>/dev/null || true`,`chmod 600 ${xv} 2>/dev/null || true`,`if [ ! -f ${xO} ]; then openssl genrsa -out ${xO} 2048 >/dev/null 2>&1; fi`,`if [ ! -f ${bm} ]; then openssl req -x509 -new -nodes -key ${xO} -sha256 -days 30 -subj "/CN=Evolve Managed Secrets" -addext "basicConstraints=critical,CA:TRUE" -addext "keyUsage=critical,keyCertSign,cRLSign" -out ${bm} >/dev/null 2>&1; fi`,`SYSTEM_CA_BUNDLE=""; for p in /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt /etc/ssl/ca-bundle.pem; do if [ -f "$p" ]; then SYSTEM_CA_BUNDLE="$p"; break; fi; done; if [ -n "$SYSTEM_CA_BUNDLE" ]; then cat "$SYSTEM_CA_BUNDLE" ${bm} > ${wv}; else cp ${bm} ${wv}; fi`,`if command -v update-ca-certificates >/dev/null 2>&1; then cp ${bm} /usr/local/share/ca-certificates/evolve-managed-secrets.crt 2>/dev/null && update-ca-certificates >/dev/null 2>&1 || true; fi`].join(" && ")}function gQ(){return`umask 077 && exec python3 ${Jw} ${xv}`}function yQ(){return`rm -f ${xv}`}function zXe(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e;if(typeof t.provisional!="boolean")return null;let n=r=>typeof r=="number"&&Number.isFinite(r)?r:null;return{provisional:t.provisional,spent_usd:n(t.spent_usd),input_tokens:n(t.input_tokens),cached_input_tokens:n(t.cached_input_tokens),output_tokens:n(t.output_tokens),as_of:typeof t.as_of=="string"?t.as_of:null}}var GXe=6e5,JXe=5e3;function jZ(e,t,n){let r=t??n;if(!Number.isFinite(r)||r<=0)throw new Error(`${e} must be a positive number`);return r}function MO(e){let t=e?.apiKey||process.env[vc];if(!t)throw new Error(`sessions() requires an API key. Set ${vc} or pass { apiKey } in config.`);let n=e?.dashboardUrl||ia;async function r(o,c){let l=await fetch(`${n}${o}`,{...c,headers:{Authorization:`Bearer ${t}`,...c?.headers}});if(!l.ok){let u=await l.text().catch(()=>"");throw new Error(`Dashboard API error (${l.status}): ${u||l.statusText}`)}return l}function a(o){return{id:o.id,tag:o.tag,agent:o.agent,model:o.model||null,provider:o.provider,sandboxId:o.sandboxId||null,state:o.isEnded?"ended":"live",runtimeStatus:o.runtimeStatus||"unknown",cost:typeof o.cost=="number"?o.cost:null,usage:zXe(o.usage),createdAt:o.createdAt,endedAt:o.endedAt||null,stepCount:o.stepCount||0,toolStats:o.toolStats||null}}function i(o,c){if(o.status!=="ready")throw new Error(`Browser replay is not ready (status: ${String(o.status||"unknown")})`);if(typeof o.replayUrl!="string"||typeof o.downloadUrl!="string")throw new Error("Browser replay response missing replayUrl or downloadUrl");return{sessionId:o.sessionId||c,status:"ready",replayUrl:o.replayUrl,downloadUrl:o.downloadUrl,suggestedStartSeconds:typeof o.suggestedStartSeconds=="number"?o.suggestedStartSeconds:void 0,sizeBytes:typeof o.sizeBytes=="number"?o.sizeBytes:void 0,readyAt:typeof o.readyAt=="string"?o.readyAt:void 0}}let s=o=>new Promise(c=>setTimeout(c,o));return{async list(o){let c=new URLSearchParams({paginationMode:"cursor",pageSize:String(Math.min(o?.limit??20,200)),paginated:"true"});if(o?.cursor&&c.set("cursor",o.cursor),o?.state&&o.state!=="all"&&c.set("state",o.state),o?.agent&&c.set("agent",o.agent),o?.tagPrefix&&c.set("tagPrefix",o.tagPrefix),o?.sort){let u={newest:"desc",oldest:"asc",cost:"desc"};c.set("sortDirection",u[o.sort]),o.sort==="cost"?c.set("sortField","cost"):c.set("sortField","timestamp")}let l=await(await r(`/api/sessions?${c}`)).json();return{items:(l.items||[]).map(a),nextCursor:l.nextCursor||null,hasMore:!!l.hasMore}},async get(o){let c=await(await r(`/api/sessions/${encodeURIComponent(o)}`)).json();return a(c)},async events(o,c){let l=new URLSearchParams;c?.since!=null&&l.set("since",String(c.since));let u=l.toString();return(await(await r(`/api/sessions/${encodeURIComponent(o)}/events${u?`?${u}`:""}`)).json()).events||[]},async download(o,c){let l=(await(await r(`/api/sessions/${encodeURIComponent(o)}`)).json()).tag||o,u=await fetch(`${n}/api/sessions/${encodeURIComponent(o)}/download`,{headers:{Authorization:`Bearer ${t}`},redirect:"follow"});if(!u.ok){let g=await u.text().catch(()=>"");throw new Error(`Download failed (${u.status}): ${g||u.statusText}`)}let d=c?.to||process.cwd();await(0,EO.mkdir)(d,{recursive:!0});let f=(0,pB.join)(d,`${l}.jsonl`);if(!u.body)throw new Error("Download response has no body");let h=XZ.Readable.fromWeb(u.body);return await(0,ZZ.pipeline)(h,(0,KZ.createWriteStream)(f)),f},async browserReplay(o,c){let l=jZ("timeoutMs",c?.timeoutMs,GXe),u=jZ("intervalMs",c?.intervalMs,JXe),d=Date.now()+l,f=`/api/sessions/${encodeURIComponent(o)}/browser-replay`;for(;;){let h=d-Date.now();if(h<=0)throw new Error(`Browser replay timed out after ${l}ms`);let g;try{g=await fetch(`${n}${f}`,{headers:{Authorization:`Bearer ${t}`,accept:"application/json"},signal:AbortSignal.timeout(Math.max(1,h))})}catch(b){let y=b.name;throw y==="AbortError"||y==="TimeoutError"?new Error(`Browser replay timed out after ${l}ms`):b}let v={};if(g.ok)v=await g.json();else{let b=await g.text().catch(()=>"");throw new Error(`Dashboard API error (${g.status}): ${b||g.statusText}`)}if(v.status==="ready")return i(v,o);if(v.status==="failed"){let b=typeof v.error=="string"?v.error:"unknown error";throw new Error(`Browser replay failed: ${b}`)}if(Date.now()>=d)throw new Error(`Browser replay timed out after ${l}ms`);await s(Math.min(u,Math.max(0,d-Date.now())))}}}}var mjt=30*6e4;fB();vQ();var UKe=require("events"),BKe=Ve(Jte(),1),Bo=require("crypto");pL();var gO=require("child_process"),iB=require("util"),Ct=require("fs/promises"),Up=require("os");var ft=require("path");var tne=Symbol("Let zodToJsonSchema decide on which parser to use");var ene={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},nne=e=>typeof e=="string"?{...ene,name:e}:{...ene,...e};var rne=e=>{let t=nne(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,a])=>[a._def,{def:a._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}};function hL(e,t,n,r){r?.errorMessages&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function yn(e,t,n,r,a){e[t]=n,hL(e,t,r,a)}var SA=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};var Xu={};Vu(Xu,{BRAND:()=>nit,DIRTY:()=>Nm,EMPTY_PATH:()=>Mrt,INVALID:()=>pt,NEVER:()=>Vit,OK:()=>Za,ParseStatus:()=>Oa,Schema:()=>zt,ZodAny:()=>jp,ZodArray:()=>df,ZodBigInt:()=>Dm,ZodBoolean:()=>Um,ZodBranded:()=>xI,ZodCatch:()=>Wm,ZodDate:()=>Bm,ZodDefault:()=>Hm,ZodDiscriminatedUnion:()=>IA,ZodEffects:()=>Ec,ZodEnum:()=>Gm,ZodError:()=>fo,ZodFirstPartyTypeKind:()=>Be,ZodFunction:()=>EA,ZodIntersection:()=>qm,ZodIssueCode:()=>Ce,ZodLazy:()=>$m,ZodLiteral:()=>zm,ZodMap:()=>Hv,ZodNaN:()=>Yv,ZodNativeEnum:()=>Jm,ZodNever:()=>gl,ZodNull:()=>Lm,ZodNullable:()=>Ku,ZodNumber:()=>Mm,ZodObject:()=>po,ZodOptional:()=>Ic,ZodParsedType:()=>Ye,ZodPipeline:()=>EI,ZodPromise:()=>Kp,ZodReadonly:()=>Ym,ZodRecord:()=>xA,ZodSchema:()=>zt,ZodSet:()=>Wv,ZodString:()=>Yp,ZodSymbol:()=>Gv,ZodTransformer:()=>Ec,ZodTuple:()=>ju,ZodType:()=>zt,ZodUndefined:()=>Fm,ZodUnion:()=>Vm,ZodUnknown:()=>uf,ZodVoid:()=>Jv,addIssueToContext:()=>Ge,any:()=>dit,array:()=>mit,bigint:()=>sit,boolean:()=>hne,coerce:()=>Lit,custom:()=>dne,date:()=>oit,datetimeRegex:()=>lne,defaultErrorMap:()=>cf,discriminatedUnion:()=>bit,effect:()=>Rit,enum:()=>Oit,function:()=>Eit,getErrorMap:()=>qv,getParsedType:()=>Yu,instanceof:()=>iit,intersection:()=>Sit,isAborted:()=>_A,isAsync:()=>$v,isDirty:()=>wA,isValid:()=>Wp,late:()=>rit,lazy:()=>Tit,literal:()=>kit,makeIssue:()=>II,map:()=>Iit,nan:()=>ait,nativeEnum:()=>Ait,never:()=>pit,null:()=>uit,nullable:()=>Nit,number:()=>pne,object:()=>git,objectUtil:()=>mL,oboolean:()=>Fit,onumber:()=>Bit,optional:()=>Cit,ostring:()=>Uit,pipeline:()=>Dit,preprocess:()=>Mit,promise:()=>Pit,quotelessJson:()=>Rrt,record:()=>wit,set:()=>xit,setErrorMap:()=>Nrt,strictObject:()=>yit,string:()=>fne,symbol:()=>cit,transformer:()=>Rit,tuple:()=>_it,undefined:()=>lit,union:()=>vit,unknown:()=>fit,util:()=>nn,void:()=>hit});var nn;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function n(a){throw new Error}e.assertNever=n,e.arrayToEnum=a=>{let i={};for(let s of a)i[s]=s;return i},e.getValidEnumValues=a=>{let i=e.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(let o of i)s[o]=a[o];return e.objectValues(s)},e.objectValues=a=>e.objectKeys(a).map(function(i){return a[i]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let i=[];for(let s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},e.find=(a,i)=>{for(let s of a)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(nn||(nn={}));var mL;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(mL||(mL={}));var Ye=nn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yu=e=>{switch(typeof e){case"undefined":return Ye.undefined;case"string":return Ye.string;case"number":return Number.isNaN(e)?Ye.nan:Ye.number;case"boolean":return Ye.boolean;case"function":return Ye.function;case"bigint":return Ye.bigint;case"symbol":return Ye.symbol;case"object":return Array.isArray(e)?Ye.array:e===null?Ye.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ye.promise:typeof Map<"u"&&e instanceof Map?Ye.map:typeof Set<"u"&&e instanceof Set?Ye.set:typeof Date<"u"&&e instanceof Date?Ye.date:Ye.object;default:return Ye.unknown}};var Ce=nn.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"]),Rrt=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),fo=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(i){return i.message},r={_errors:[]},a=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let o=r,c=0;for(;c<s.path.length;){let l=s.path[c];c===s.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(n(s))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return a(this),r}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,nn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n={},r=[];for(let a of this.issues)if(a.path.length>0){let i=a.path[0];n[i]=n[i]||[],n[i].push(t(a))}else r.push(t(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};fo.create=e=>new fo(e);var Crt=(e,t)=>{let n;switch(e.code){case Ce.invalid_type:e.received===Ye.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Ce.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,nn.jsonStringifyReplacer)}`;break;case Ce.unrecognized_keys:n=`Unrecognized key(s) in object: ${nn.joinValues(e.keys,", ")}`;break;case Ce.invalid_union:n="Invalid input";break;case Ce.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${nn.joinValues(e.options)}`;break;case Ce.invalid_enum_value:n=`Invalid enum value. Expected ${nn.joinValues(e.options)}, received '${e.received}'`;break;case Ce.invalid_arguments:n="Invalid function arguments";break;case Ce.invalid_return_type:n="Invalid function return type";break;case Ce.invalid_date:n="Invalid date";break;case Ce.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:nn.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Ce.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Ce.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Ce.custom:n="Invalid input";break;case Ce.invalid_intersection_types:n="Intersection results could not be merged";break;case Ce.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Ce.not_finite:n="Number must be finite";break;default:n=t.defaultError,nn.assertNever(e)}return{message:n}},cf=Crt;var ine=cf;function Nrt(e){ine=e}function qv(){return ine}var II=e=>{let{data:t,path:n,errorMaps:r,issueData:a}=e,i=[...n,...a.path||[]],s={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let o="",c=r.filter(l=>!!l).slice().reverse();for(let l of c)o=l(s,{data:t,defaultError:o}).message;return{...a,path:i,message:o}},Mrt=[];function Ge(e,t){let n=qv(),r=II({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===cf?void 0:cf].filter(a=>!!a)});e.common.issues.push(r)}var Oa=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let r=[];for(let a of n){if(a.status==="aborted")return pt;a.status==="dirty"&&t.dirty(),r.push(a.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){let r=[];for(let a of n){let i=await a.key,s=await a.value;r.push({key:i,value:s})}return e.mergeObjectSync(t,r)}static mergeObjectSync(t,n){let r={};for(let a of n){let{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return pt;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||a.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}},pt=Object.freeze({status:"aborted"}),Nm=e=>({status:"dirty",value:e}),Za=e=>({status:"valid",value:e}),_A=e=>e.status==="aborted",wA=e=>e.status==="dirty",Wp=e=>e.status==="valid",$v=e=>typeof Promise<"u"&&e instanceof Promise;var at;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(at||(at={}));var xc=class{constructor(t,n,r,a){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ane=(e,t)=>{if(Wp(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new fo(e.common.issues);return this._error=n,this._error}}};function Dt(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(s,o)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??r??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:c??n??o.defaultError}},description:a}}var zt=class{get description(){return this._def.description}_getType(t){return Yu(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Yu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Oa,ctx:{common:t.parent.common,data:t.data,parsedType:Yu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if($v(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yu(t)},a=this._parseSync({data:t,path:r.path,parent:r});return ane(r,a)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yu(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:n});return Wp(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>Wp(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){let r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yu(t)},a=this._parse({data:t,path:r.path,parent:r}),i=await($v(a)?a:Promise.resolve(a));return ane(r,i)}refine(t,n){let r=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,i)=>{let s=t(a),o=()=>i.addIssue({code:Ce.custom,...r(a)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(t,n){return this._refinement((r,a)=>t(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(t){return new Ec({schema:this,typeName:Be.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:n=>this["~validate"](n)}}optional(){return Ic.create(this,this._def)}nullable(){return Ku.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return df.create(this)}promise(){return Kp.create(this,this._def)}or(t){return Vm.create([this,t],this._def)}and(t){return qm.create(this,t,this._def)}transform(t){return new Ec({...Dt(this._def),schema:this,typeName:Be.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new Hm({...Dt(this._def),innerType:this,defaultValue:n,typeName:Be.ZodDefault})}brand(){return new xI({typeName:Be.ZodBranded,type:this,...Dt(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new Wm({...Dt(this._def),innerType:this,catchValue:n,typeName:Be.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return EI.create(this,t)}readonly(){return Ym.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Drt=/^c[^\s-]{8,}$/i,Urt=/^[0-9a-z]+$/,Brt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Frt=/^[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,Lrt=/^[a-z0-9_-]{21}$/i,Vrt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qrt=/^[-+]?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)?)??$/,$rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zrt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",gL,Grt=/^(?:(?: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])$/,Jrt=/^(?:(?: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])$/,Hrt=/^(([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]))$/,Wrt=/^(([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])$/,Yrt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,jrt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,one="((\\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])))",Krt=new RegExp(`^${one}$`);function cne(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Xrt(e){return new RegExp(`^${cne(e)}$`)}function lne(e){let t=`${one}T${cne(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Zrt(e,t){return!!((t==="v4"||!t)&&Grt.test(e)||(t==="v6"||!t)&&Hrt.test(e))}function Qrt(e,t){if(!Vrt.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||t&&a.alg!==t)}catch{return!1}}function eit(e,t){return!!((t==="v4"||!t)&&Jrt.test(e)||(t==="v6"||!t)&&Wrt.test(e))}var Yp=class e extends zt{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ye.string){let i=this._getOrReturnCtx(t);return Ge(i,{code:Ce.invalid_type,expected:Ye.string,received:i.parsedType}),pt}let r=new Oa,a;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,o=t.data.length<i.value;(s||o)&&(a=this._getOrReturnCtx(t,a),s?Ge(a,{code:Ce.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&Ge(a,{code:Ce.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")$rt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"email",code:Ce.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")gL||(gL=new RegExp(zrt,"u")),gL.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"emoji",code:Ce.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Frt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"uuid",code:Ce.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Lrt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"nanoid",code:Ce.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Drt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"cuid",code:Ce.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Urt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"cuid2",code:Ce.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Brt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"ulid",code:Ce.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),Ge(a,{validation:"url",code:Ce.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"regex",code:Ce.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?lne(i).test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Krt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Xrt(i).test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?qrt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"duration",code:Ce.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Zrt(t.data,i.version)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"ip",code:Ce.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Qrt(t.data,i.alg)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"jwt",code:Ce.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?eit(t.data,i.version)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"cidr",code:Ce.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?Yrt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"base64",code:Ce.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?jrt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"base64url",code:Ce.invalid_string,message:i.message}),r.dirty()):nn.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(a=>t.test(a),{validation:n,code:Ce.invalid_string,...at.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...at.errToObj(t)})}url(t){return this._addCheck({kind:"url",...at.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...at.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...at.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...at.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...at.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...at.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...at.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...at.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...at.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...at.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...at.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...at.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...at.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...at.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...at.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...at.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...at.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...at.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...at.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...at.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...at.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...at.errToObj(n)})}nonempty(t){return this.min(1,at.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Yp.create=e=>new Yp({checks:[],typeName:Be.ZodString,coerce:e?.coerce??!1,...Dt(e)});function tit(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r,i=Number.parseInt(e.toFixed(a).replace(".","")),s=Number.parseInt(t.toFixed(a).replace(".",""));return i%s/10**a}var Mm=class e extends zt{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)!==Ye.number){let i=this._getOrReturnCtx(t);return Ge(i,{code:Ce.invalid_type,expected:Ye.number,received:i.parsedType}),pt}let r,a=new Oa;for(let i of this._def.checks)i.kind==="int"?nn.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?tit(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.not_finite,message:i.message}),a.dirty()):nn.assertNever(i);return{status:a.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,at.toString(n))}gt(t,n){return this.setLimit("min",t,!1,at.toString(n))}lte(t,n){return this.setLimit("max",t,!0,at.toString(n))}lt(t,n){return this.setLimit("max",t,!1,at.toString(n))}setLimit(t,n,r,a){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:at.toString(a)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:at.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:at.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:at.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:at.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:at.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:at.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:at.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:at.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:at.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&nn.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}};Mm.create=e=>new Mm({checks:[],typeName:Be.ZodNumber,coerce:e?.coerce||!1,...Dt(e)});var Dm=class e extends zt{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)!==Ye.bigint)return this._getInvalidInput(t);let r,a=new Oa;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):nn.assertNever(i);return{status:a.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return Ge(n,{code:Ce.invalid_type,expected:Ye.bigint,received:n.parsedType}),pt}gte(t,n){return this.setLimit("min",t,!0,at.toString(n))}gt(t,n){return this.setLimit("min",t,!1,at.toString(n))}lte(t,n){return this.setLimit("max",t,!0,at.toString(n))}lt(t,n){return this.setLimit("max",t,!1,at.toString(n))}setLimit(t,n,r,a){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:at.toString(a)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:at.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:at.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:at.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:at.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:at.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Dm.create=e=>new Dm({checks:[],typeName:Be.ZodBigInt,coerce:e?.coerce??!1,...Dt(e)});var Um=class extends zt{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ye.boolean){let r=this._getOrReturnCtx(t);return Ge(r,{code:Ce.invalid_type,expected:Ye.boolean,received:r.parsedType}),pt}return Za(t.data)}};Um.create=e=>new Um({typeName:Be.ZodBoolean,coerce:e?.coerce||!1,...Dt(e)});var Bm=class e extends zt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ye.date){let i=this._getOrReturnCtx(t);return Ge(i,{code:Ce.invalid_type,expected:Ye.date,received:i.parsedType}),pt}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return Ge(i,{code:Ce.invalid_date}),pt}let r=new Oa,a;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):nn.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:at.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:at.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};Bm.create=e=>new Bm({checks:[],coerce:e?.coerce||!1,typeName:Be.ZodDate,...Dt(e)});var Gv=class extends zt{_parse(t){if(this._getType(t)!==Ye.symbol){let r=this._getOrReturnCtx(t);return Ge(r,{code:Ce.invalid_type,expected:Ye.symbol,received:r.parsedType}),pt}return Za(t.data)}};Gv.create=e=>new Gv({typeName:Be.ZodSymbol,...Dt(e)});var Fm=class extends zt{_parse(t){if(this._getType(t)!==Ye.undefined){let r=this._getOrReturnCtx(t);return Ge(r,{code:Ce.invalid_type,expected:Ye.undefined,received:r.parsedType}),pt}return Za(t.data)}};Fm.create=e=>new Fm({typeName:Be.ZodUndefined,...Dt(e)});var Lm=class extends zt{_parse(t){if(this._getType(t)!==Ye.null){let r=this._getOrReturnCtx(t);return Ge(r,{code:Ce.invalid_type,expected:Ye.null,received:r.parsedType}),pt}return Za(t.data)}};Lm.create=e=>new Lm({typeName:Be.ZodNull,...Dt(e)});var jp=class extends zt{constructor(){super(...arguments),this._any=!0}_parse(t){return Za(t.data)}};jp.create=e=>new jp({typeName:Be.ZodAny,...Dt(e)});var uf=class extends zt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Za(t.data)}};uf.create=e=>new uf({typeName:Be.ZodUnknown,...Dt(e)});var gl=class extends zt{_parse(t){let n=this._getOrReturnCtx(t);return Ge(n,{code:Ce.invalid_type,expected:Ye.never,received:n.parsedType}),pt}};gl.create=e=>new gl({typeName:Be.ZodNever,...Dt(e)});var Jv=class extends zt{_parse(t){if(this._getType(t)!==Ye.undefined){let r=this._getOrReturnCtx(t);return Ge(r,{code:Ce.invalid_type,expected:Ye.void,received:r.parsedType}),pt}return Za(t.data)}};Jv.create=e=>new Jv({typeName:Be.ZodVoid,...Dt(e)});var df=class e extends zt{_parse(t){let{ctx:n,status:r}=this._processInputParams(t),a=this._def;if(n.parsedType!==Ye.array)return Ge(n,{code:Ce.invalid_type,expected:Ye.array,received:n.parsedType}),pt;if(a.exactLength!==null){let s=n.data.length>a.exactLength.value,o=n.data.length<a.exactLength.value;(s||o)&&(Ge(n,{code:s?Ce.too_big:Ce.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(Ge(n,{code:Ce.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(Ge(n,{code:Ce.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,o)=>a.type._parseAsync(new xc(n,s,n.path,o)))).then(s=>Oa.mergeArray(r,s));let i=[...n.data].map((s,o)=>a.type._parseSync(new xc(n,s,n.path,o)));return Oa.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:at.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:at.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:at.toString(n)}})}nonempty(t){return this.min(1,t)}};df.create=(e,t)=>new df({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Be.ZodArray,...Dt(t)});function zv(e){if(e instanceof po){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Ic.create(zv(r))}return new po({...e._def,shape:()=>t})}else return e instanceof df?new df({...e._def,type:zv(e.element)}):e instanceof Ic?Ic.create(zv(e.unwrap())):e instanceof Ku?Ku.create(zv(e.unwrap())):e instanceof ju?ju.create(e.items.map(t=>zv(t))):e}var po=class e extends zt{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=nn.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Ye.object){let l=this._getOrReturnCtx(t);return Ge(l,{code:Ce.invalid_type,expected:Ye.object,received:l.parsedType}),pt}let{status:r,ctx:a}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof gl&&this._def.unknownKeys==="strip"))for(let l in a.data)s.includes(l)||o.push(l);let c=[];for(let l of s){let u=i[l],d=a.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new xc(a,d,a.path,l)),alwaysSet:l in a.data})}if(this._def.catchall instanceof gl){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of o)c.push({key:{status:"valid",value:u},value:{status:"valid",value:a.data[u]}});else if(l==="strict")o.length>0&&(Ge(a,{code:Ce.unrecognized_keys,keys:o}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of o){let d=a.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new xc(a,d,a.path,u)),alwaysSet:u in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key,f=await u.value;l.push({key:d,value:f,alwaysSet:u.alwaysSet})}return l}).then(l=>Oa.mergeObjectSync(r,l)):Oa.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return at.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{let a=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:at.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Be.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let r of nn.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let r of nn.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}deepPartial(){return zv(this)}partial(t){let n={};for(let r of nn.objectKeys(this.shape)){let a=this.shape[r];t&&!t[r]?n[r]=a:n[r]=a.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let r of nn.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Ic;)i=i._def.innerType;n[r]=i}return new e({...this._def,shape:()=>n})}keyof(){return une(nn.objectKeys(this.shape))}};po.create=(e,t)=>new po({shape:()=>e,unknownKeys:"strip",catchall:gl.create(),typeName:Be.ZodObject,...Dt(t)});po.strictCreate=(e,t)=>new po({shape:()=>e,unknownKeys:"strict",catchall:gl.create(),typeName:Be.ZodObject,...Dt(t)});po.lazycreate=(e,t)=>new po({shape:e,unknownKeys:"strip",catchall:gl.create(),typeName:Be.ZodObject,...Dt(t)});var Vm=class extends zt{_parse(t){let{ctx:n}=this._processInputParams(t),r=this._def.options;function a(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;let s=i.map(o=>new fo(o.ctx.common.issues));return Ge(n,{code:Ce.invalid_union,unionErrors:s}),pt}if(n.common.async)return Promise.all(r.map(async i=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(a);{let i,s=[];for(let c of r){let l={...n,common:{...n.common,issues:[]},parent:null},u=c._parseSync({data:n.data,path:n.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map(c=>new fo(c));return Ge(n,{code:Ce.invalid_union,unionErrors:o}),pt}}get options(){return this._def.options}};Vm.create=(e,t)=>new Vm({options:e,typeName:Be.ZodUnion,...Dt(t)});var lf=e=>e instanceof $m?lf(e.schema):e instanceof Ec?lf(e.innerType()):e instanceof zm?[e.value]:e instanceof Gm?e.options:e instanceof Jm?nn.objectValues(e.enum):e instanceof Hm?lf(e._def.innerType):e instanceof Fm?[void 0]:e instanceof Lm?[null]:e instanceof Ic?[void 0,...lf(e.unwrap())]:e instanceof Ku?[null,...lf(e.unwrap())]:e instanceof xI||e instanceof Ym?lf(e.unwrap()):e instanceof Wm?lf(e._def.innerType):[],IA=class e extends zt{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ye.object)return Ge(n,{code:Ce.invalid_type,expected:Ye.object,received:n.parsedType}),pt;let r=this.discriminator,a=n.data[r],i=this.optionsMap.get(a);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(Ge(n,{code:Ce.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),pt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let a=new Map;for(let i of n){let s=lf(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let o of s){if(a.has(o))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(o)}`);a.set(o,i)}}return new e({typeName:Be.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:a,...Dt(r)})}};function yL(e,t){let n=Yu(e),r=Yu(t);if(e===t)return{valid:!0,data:e};if(n===Ye.object&&r===Ye.object){let a=nn.objectKeys(t),i=nn.objectKeys(e).filter(o=>a.indexOf(o)!==-1),s={...e,...t};for(let o of i){let c=yL(e[o],t[o]);if(!c.valid)return{valid:!1};s[o]=c.data}return{valid:!0,data:s}}else if(n===Ye.array&&r===Ye.array){if(e.length!==t.length)return{valid:!1};let a=[];for(let i=0;i<e.length;i++){let s=e[i],o=t[i],c=yL(s,o);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return n===Ye.date&&r===Ye.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var qm=class extends zt{_parse(t){let{status:n,ctx:r}=this._processInputParams(t),a=(i,s)=>{if(_A(i)||_A(s))return pt;let o=yL(i.value,s.value);return o.valid?((wA(i)||wA(s))&&n.dirty(),{status:n.value,value:o.data}):(Ge(r,{code:Ce.invalid_intersection_types}),pt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>a(i,s)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};qm.create=(e,t,n)=>new qm({left:e,right:t,typeName:Be.ZodIntersection,...Dt(n)});var ju=class e extends zt{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ye.array)return Ge(r,{code:Ce.invalid_type,expected:Ye.array,received:r.parsedType}),pt;if(r.data.length<this._def.items.length)return Ge(r,{code:Ce.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pt;!this._def.rest&&r.data.length>this._def.items.length&&(Ge(r,{code:Ce.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((s,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new xc(r,s,r.path,o)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>Oa.mergeArray(n,s)):Oa.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ju.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ju({items:e,typeName:Be.ZodTuple,rest:null,...Dt(t)})};var xA=class e extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ye.object)return Ge(r,{code:Ce.invalid_type,expected:Ye.object,received:r.parsedType}),pt;let a=[],i=this._def.keyType,s=this._def.valueType;for(let o in r.data)a.push({key:i._parse(new xc(r,o,r.path,o)),value:s._parse(new xc(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?Oa.mergeObjectAsync(n,a):Oa.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof zt?new e({keyType:t,valueType:n,typeName:Be.ZodRecord,...Dt(r)}):new e({keyType:Yp.create(),valueType:t,typeName:Be.ZodRecord,...Dt(n)})}},Hv=class extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ye.map)return Ge(r,{code:Ce.invalid_type,expected:Ye.map,received:r.parsedType}),pt;let a=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([o,c],l)=>({key:a._parse(new xc(r,o,r.path,[l,"key"])),value:i._parse(new xc(r,c,r.path,[l,"value"]))}));if(r.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of s){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return pt;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(l.value,u.value)}return{status:n.value,value:o}})}else{let o=new Map;for(let c of s){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return pt;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(l.value,u.value)}return{status:n.value,value:o}}}};Hv.create=(e,t,n)=>new Hv({valueType:t,keyType:e,typeName:Be.ZodMap,...Dt(n)});var Wv=class e extends zt{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ye.set)return Ge(r,{code:Ce.invalid_type,expected:Ye.set,received:r.parsedType}),pt;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(Ge(r,{code:Ce.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(Ge(r,{code:Ce.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let i=this._def.valueType;function s(c){let l=new Set;for(let u of c){if(u.status==="aborted")return pt;u.status==="dirty"&&n.dirty(),l.add(u.value)}return{status:n.value,value:l}}let o=[...r.data.values()].map((c,l)=>i._parse(new xc(r,c,r.path,l)));return r.common.async?Promise.all(o).then(c=>s(c)):s(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:at.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:at.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};Wv.create=(e,t)=>new Wv({valueType:e,minSize:null,maxSize:null,typeName:Be.ZodSet,...Dt(t)});var EA=class e extends zt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ye.function)return Ge(n,{code:Ce.invalid_type,expected:Ye.function,received:n.parsedType}),pt;function r(o,c){return II({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,qv(),cf].filter(l=>!!l),issueData:{code:Ce.invalid_arguments,argumentsError:c}})}function a(o,c){return II({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,qv(),cf].filter(l=>!!l),issueData:{code:Ce.invalid_return_type,returnTypeError:c}})}let i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Kp){let o=this;return Za(async function(...c){let l=new fo([]),u=await o._def.args.parseAsync(c,i).catch(h=>{throw l.addIssue(r(c,h)),l}),d=await Reflect.apply(s,this,u);return await o._def.returns._def.type.parseAsync(d,i).catch(h=>{throw l.addIssue(a(d,h)),l})})}else{let o=this;return Za(function(...c){let l=o._def.args.safeParse(c,i);if(!l.success)throw new fo([r(c,l.error)]);let u=Reflect.apply(s,this,l.data),d=o._def.returns.safeParse(u,i);if(!d.success)throw new fo([a(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:ju.create(t).rest(uf.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new e({args:t||ju.create([]).rest(uf.create()),returns:n||uf.create(),typeName:Be.ZodFunction,...Dt(r)})}},$m=class extends zt{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};$m.create=(e,t)=>new $m({getter:e,typeName:Be.ZodLazy,...Dt(t)});var zm=class extends zt{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return Ge(n,{received:n.data,code:Ce.invalid_literal,expected:this._def.value}),pt}return{status:"valid",value:t.data}}get value(){return this._def.value}};zm.create=(e,t)=>new zm({value:e,typeName:Be.ZodLiteral,...Dt(t)});function une(e,t){return new Gm({values:e,typeName:Be.ZodEnum,...Dt(t)})}var Gm=class e extends zt{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),r=this._def.values;return Ge(n,{expected:nn.joinValues(r),received:n.parsedType,code:Ce.invalid_type}),pt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),r=this._def.values;return Ge(n,{received:n.data,code:Ce.invalid_enum_value,options:r}),pt}return Za(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}};Gm.create=une;var Jm=class extends zt{_parse(t){let n=nn.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Ye.string&&r.parsedType!==Ye.number){let a=nn.objectValues(n);return Ge(r,{expected:nn.joinValues(a),received:r.parsedType,code:Ce.invalid_type}),pt}if(this._cache||(this._cache=new Set(nn.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let a=nn.objectValues(n);return Ge(r,{received:r.data,code:Ce.invalid_enum_value,options:a}),pt}return Za(t.data)}get enum(){return this._def.values}};Jm.create=(e,t)=>new Jm({values:e,typeName:Be.ZodNativeEnum,...Dt(t)});var Kp=class extends zt{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ye.promise&&n.common.async===!1)return Ge(n,{code:Ce.invalid_type,expected:Ye.promise,received:n.parsedType}),pt;let r=n.parsedType===Ye.promise?n.data:Promise.resolve(n.data);return Za(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Kp.create=(e,t)=>new Kp({type:e,typeName:Be.ZodPromise,...Dt(t)});var Ec=class extends zt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Be.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:r}=this._processInputParams(t),a=this._def.effect||null,i={addIssue:s=>{Ge(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){let s=a.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async o=>{if(n.value==="aborted")return pt;let c=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return c.status==="aborted"?pt:c.status==="dirty"?Nm(c.value):n.value==="dirty"?Nm(c.value):c});{if(n.value==="aborted")return pt;let o=this._def.schema._parseSync({data:s,path:r.path,parent:r});return o.status==="aborted"?pt:o.status==="dirty"?Nm(o.value):n.value==="dirty"?Nm(o.value):o}}if(a.type==="refinement"){let s=o=>{let c=a.refinement(o,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?pt:(o.status==="dirty"&&n.dirty(),s(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?pt:(o.status==="dirty"&&n.dirty(),s(o.value).then(()=>({status:n.value,value:o.value}))))}if(a.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Wp(s))return pt;let o=a.transform(s.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Wp(s)?Promise.resolve(a.transform(s.value,i)).then(o=>({status:n.value,value:o})):pt);nn.assertNever(a)}};Ec.create=(e,t,n)=>new Ec({schema:e,typeName:Be.ZodEffects,effect:t,...Dt(n)});Ec.createWithPreprocess=(e,t,n)=>new Ec({schema:t,effect:{type:"preprocess",transform:e},typeName:Be.ZodEffects,...Dt(n)});var Ic=class extends zt{_parse(t){return this._getType(t)===Ye.undefined?Za(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ic.create=(e,t)=>new Ic({innerType:e,typeName:Be.ZodOptional,...Dt(t)});var Ku=class extends zt{_parse(t){return this._getType(t)===Ye.null?Za(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ku.create=(e,t)=>new Ku({innerType:e,typeName:Be.ZodNullable,...Dt(t)});var Hm=class extends zt{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return n.parsedType===Ye.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Hm.create=(e,t)=>new Hm({innerType:e,typeName:Be.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Dt(t)});var Wm=class extends zt{_parse(t){let{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return $v(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new fo(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new fo(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Wm.create=(e,t)=>new Wm({innerType:e,typeName:Be.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Dt(t)});var Yv=class extends zt{_parse(t){if(this._getType(t)!==Ye.nan){let r=this._getOrReturnCtx(t);return Ge(r,{code:Ce.invalid_type,expected:Ye.nan,received:r.parsedType}),pt}return{status:"valid",value:t.data}}};Yv.create=e=>new Yv({typeName:Be.ZodNaN,...Dt(e)});var nit=Symbol("zod_brand"),xI=class extends zt{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},EI=class e extends zt{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?pt:i.status==="dirty"?(n.dirty(),Nm(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?pt:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(t,n){return new e({in:t,out:n,typeName:Be.ZodPipeline})}},Ym=class extends zt{_parse(t){let n=this._def.innerType._parse(t),r=a=>(Wp(a)&&(a.value=Object.freeze(a.value)),a);return $v(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}};Ym.create=(e,t)=>new Ym({innerType:e,typeName:Be.ZodReadonly,...Dt(t)});function sne(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function dne(e,t={},n){return e?jp.create().superRefine((r,a)=>{let i=e(r);if(i instanceof Promise)return i.then(s=>{if(!s){let o=sne(t,r),c=o.fatal??n??!0;a.addIssue({code:"custom",...o,fatal:c})}});if(!i){let s=sne(t,r),o=s.fatal??n??!0;a.addIssue({code:"custom",...s,fatal:o})}}):jp.create()}var rit={object:po.lazycreate},Be;(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"})(Be||(Be={}));var iit=(e,t={message:`Input not instance of ${e.name}`})=>dne(n=>n instanceof e,t),fne=Yp.create,pne=Mm.create,ait=Yv.create,sit=Dm.create,hne=Um.create,oit=Bm.create,cit=Gv.create,lit=Fm.create,uit=Lm.create,dit=jp.create,fit=uf.create,pit=gl.create,hit=Jv.create,mit=df.create,git=po.create,yit=po.strictCreate,vit=Vm.create,bit=IA.create,Sit=qm.create,_it=ju.create,wit=xA.create,Iit=Hv.create,xit=Wv.create,Eit=EA.create,Tit=$m.create,kit=zm.create,Oit=Gm.create,Ait=Jm.create,Pit=Kp.create,Rit=Ec.create,Cit=Ic.create,Nit=Ku.create,Mit=Ec.createWithPreprocess,Dit=EI.create,Uit=()=>fne().optional(),Bit=()=>pne().optional(),Fit=()=>hne().optional(),Lit={string:e=>Yp.create({...e,coerce:!0}),number:e=>Mm.create({...e,coerce:!0}),boolean:e=>Um.create({...e,coerce:!0}),bigint:e=>Dm.create({...e,coerce:!0}),date:e=>Bm.create({...e,coerce:!0})};var Vit=pt;function Gr(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?SA(t,e.currentPath):t.join("/")}}function mne(e,t){let n={type:"array"};return e.type?._def&&e.type?._def?.typeName!==Be.ZodAny&&(n.items=gt(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&yn(n,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&yn(n,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(yn(n,"minItems",e.exactLength.value,e.exactLength.message,t),yn(n,"maxItems",e.exactLength.value,e.exactLength.message,t)),n}function gne(e,t){let n={type:"integer",format:"int64"};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case"min":t.target==="jsonSchema7"?r.inclusive?yn(n,"minimum",r.value,r.message,t):yn(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),yn(n,"minimum",r.value,r.message,t));break;case"max":t.target==="jsonSchema7"?r.inclusive?yn(n,"maximum",r.value,r.message,t):yn(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),yn(n,"maximum",r.value,r.message,t));break;case"multipleOf":yn(n,"multipleOf",r.value,r.message,t);break}return n}function yne(){return{type:"boolean"}}function TA(e,t){return gt(e.type._def,t)}var vne=(e,t)=>gt(e.innerType._def,t);function vL(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((a,i)=>vL(e,t,a))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return qit(e,t)}}var qit=(e,t)=>{let n={type:"integer",format:"unix-time"};if(t.target==="openApi3")return n;for(let r of e.checks)switch(r.kind){case"min":yn(n,"minimum",r.value,r.message,t);break;case"max":yn(n,"maximum",r.value,r.message,t);break}return n};function bne(e,t){return{...gt(e.innerType._def,t),default:e.defaultValue()}}function Sne(e,t){return t.effectStrategy==="input"?gt(e.schema._def,t):Gr(t)}function _ne(e){return{type:"string",enum:Array.from(e.values)}}var $it=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function wne(e,t){let n=[gt(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),gt(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(i=>!!i),r=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,a=[];return n.forEach(i=>{if($it(i))a.push(...i.allOf),i.unevaluatedProperties===void 0&&(r=void 0);else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:o,...c}=i;s=c}else r=void 0;a.push(s)}}),a.length?{allOf:a,...r}:void 0}function Ine(e,t){let n=typeof e.value;return n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:n==="bigint"?"integer":n,enum:[e.value]}:{type:n==="bigint"?"integer":n,const:e.value}}var bL,yl={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(bL===void 0&&(bL=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),bL),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function kA(e,t){let n={type:"string"};if(e.checks)for(let r of e.checks)switch(r.kind){case"min":yn(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,r.message,t);break;case"max":yn(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":vl(n,"email",r.message,t);break;case"format:idn-email":vl(n,"idn-email",r.message,t);break;case"pattern:zod":$s(n,yl.email,r.message,t);break}break;case"url":vl(n,"uri",r.message,t);break;case"uuid":vl(n,"uuid",r.message,t);break;case"regex":$s(n,r.regex,r.message,t);break;case"cuid":$s(n,yl.cuid,r.message,t);break;case"cuid2":$s(n,yl.cuid2,r.message,t);break;case"startsWith":$s(n,RegExp(`^${SL(r.value,t)}`),r.message,t);break;case"endsWith":$s(n,RegExp(`${SL(r.value,t)}$`),r.message,t);break;case"datetime":vl(n,"date-time",r.message,t);break;case"date":vl(n,"date",r.message,t);break;case"time":vl(n,"time",r.message,t);break;case"duration":vl(n,"duration",r.message,t);break;case"length":yn(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,r.message,t),yn(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"includes":{$s(n,RegExp(SL(r.value,t)),r.message,t);break}case"ip":{r.version!=="v6"&&vl(n,"ipv4",r.message,t),r.version!=="v4"&&vl(n,"ipv6",r.message,t);break}case"base64url":$s(n,yl.base64url,r.message,t);break;case"jwt":$s(n,yl.jwt,r.message,t);break;case"cidr":{r.version!=="v6"&&$s(n,yl.ipv4Cidr,r.message,t),r.version!=="v4"&&$s(n,yl.ipv6Cidr,r.message,t);break}case"emoji":$s(n,yl.emoji(),r.message,t);break;case"ulid":{$s(n,yl.ulid,r.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{vl(n,"binary",r.message,t);break}case"contentEncoding:base64":{yn(n,"contentEncoding","base64",r.message,t);break}case"pattern:zod":{$s(n,yl.base64,r.message,t);break}}break}case"nanoid":$s(n,yl.nanoid,r.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}function SL(e,t){return t.patternStrategy==="escape"?Git(e):e}var zit=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Git(e){let t="";for(let n=0;n<e.length;n++)zit.has(e[n])||(t+="\\"),t+=e[n];return t}function vl(e,t,n,r){e.format||e.anyOf?.some(a=>a.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):yn(e,"format",t,n,r)}function $s(e,t,n,r){e.pattern||e.allOf?.some(a=>a.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:xne(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):yn(e,"pattern",xne(t,r),n,r)}function xne(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},r=n.i?e.source.toLowerCase():e.source,a="",i=!1,s=!1,o=!1;for(let c=0;c<r.length;c++){if(i){a+=r[c],i=!1;continue}if(n.i){if(s){if(r[c].match(/[a-z]/)){o?(a+=r[c],a+=`${r[c-2]}-${r[c]}`.toUpperCase(),o=!1):r[c+1]==="-"&&r[c+2]?.match(/[a-z]/)?(a+=r[c],o=!0):a+=`${r[c]}${r[c].toUpperCase()}`;continue}}else if(r[c].match(/[a-z]/)){a+=`[${r[c]}${r[c].toUpperCase()}]`;continue}}if(n.m){if(r[c]==="^"){a+=`(^|(?<=[\r
671
+ `;function MXe(e){return(e||process.env.EVOLVE_DASHBOARD_URL||ia).replace(/\/$/,"")}function DXe(e){let t=e.apiKey||process.env.EVOLVE_API_KEY;if(!t)throw new Error("EVOLVE_API_KEY is required for managed secrets");return t}async function UXe(e){return await e.text().catch(()=>"")}async function Iv(e,t,n={}){let r=await fetch(`${MXe(e.dashboardUrl)}${t}`,{...n,headers:{Authorization:`Bearer ${DXe(e)}`,accept:"application/json",...n.body?{"content-type":"application/json"}:{},...n.headers||{}}});if(!r.ok)throw new Error(`Managed secrets request failed (${r.status}): ${await UXe(r)}`);return await r.json()}function BXe(e){let t=n=>Array.isArray(n)?n.filter(r=>typeof r=="string"):[];return{id:String(e.id??""),name:String(e.name??""),...typeof e.label=="string"?{label:e.label}:{},...e.delivery==="brokered"||e.delivery==="direct"?{delivery:e.delivery}:{},allowedHosts:t(e.allowed_hosts??e.allowedHosts),allowedPathPrefixes:t(e.allowed_path_prefixes??e.allowedPathPrefixes),allowedMethods:t(e.allowed_methods??e.allowedMethods),createdAt:String(e.created_at??e.createdAt??""),updatedAt:String(e.updated_at??e.updatedAt??""),lastUsedAt:typeof(e.last_used_at??e.lastUsedAt)=="string"?e.last_used_at??e.lastUsedAt:null}}function SB(e={}){return{async list(){return(await Iv(e,"/api/managed-secrets")).secrets??[]},async set(t){let n={name:t.name,value:t.value,delivery:t.delivery,...t.label!==void 0?{label:t.label}:{},...t.allowedHosts!==void 0?{allowed_hosts:t.allowedHosts}:{},...t.allowedPathPrefixes!==void 0?{allowed_path_prefixes:t.allowedPathPrefixes}:{},...t.allowedMethods!==void 0?{allowed_methods:t.allowedMethods}:{}},r=await Iv(e,"/api/managed-secrets",{method:"POST",body:JSON.stringify(n)});return{status:r.status,secret:BXe(r.secret??{})}},async delete(t){let n=await Iv(e,"/api/managed-secrets",{method:"DELETE",body:JSON.stringify({name:t.name,...t.label!==void 0?{label:t.label}:{}})});return{ok:n.ok,name:n.name,label:n.label}}}}function FXe(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function WZ(e){try{return new URL(e).protocol==="https:"}catch{return!1}}function LXe(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return typeof t.token=="string"&&t.token.startsWith("evrt_")&&typeof t.bindingSecret=="string"&&t.bindingSecret.startsWith("evrb_")&&typeof t.egressUrl=="string"&&WZ(t.egressUrl)&&typeof t.channelUrl=="string"&&WZ(t.channelUrl)&&typeof t.expiresAt=="string"&&Array.isArray(t.env)&&t.env.every(n=>{if(!n||typeof n!="object"||Array.isArray(n))return!1;let r=n;return typeof r.name!="string"||typeof r.envName!="string"||!FXe(r.allowedHosts)?!1:r.delivery==="direct"?typeof r.value=="string"&&r.value.length>0:(r.delivery===void 0||r.delivery==="brokered")&&typeof r.placeholder=="string"&&r.placeholder.startsWith("evsec_")&&r.value===void 0})}async function lQ(e,t){let n=await Iv(e,"/api/managed-secrets/runtime-token",{method:"POST",body:JSON.stringify(t)});if(!LXe(n))throw new Error("Invalid managed secret runtime token response");return n}async function uQ(e,t){return(await Iv(e,"/api/managed-secrets/runtime-token",{method:"PATCH",body:JSON.stringify(t)})).ok}async function dQ(e,t){return(await Iv(e,"/api/managed-secrets/runtime-token",{method:"DELETE",body:JSON.stringify(t)})).ok}var VXe=/^[A-Za-z0-9._-]{1,80}$/;function qXe(e){if(!Array.isArray(e)||e.length===0)throw new Error("withManagedSecrets() requires at least one secret");return e.map((t,n)=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`managedSecrets[${n}] must be an object with a name`);let r=YZ(t.name,`managedSecrets[${n}].name`),a;if(t.label!==void 0){if(typeof t.label!="string"||!VXe.test(t.label.trim()))throw new Error(`managedSecrets[${n}].label may contain only letters, numbers, dots, underscores, and hyphens (at most 80 characters)`);a=t.label.trim()}let i=t.as===void 0?void 0:YZ(t.as,`managedSecrets[${n}].as`);return{name:r,...a!==void 0?{label:a}:{},...i!==void 0?{as:i}:{}}})}function YZ(e,t){if(typeof e!="string"||!e.trim())throw new Error(`${t} is required`);let n=e.trim().toUpperCase();if(!/^[A-Z_][A-Z0-9_]{0,127}$/.test(n))throw new Error(`${t} must be a valid environment variable name`);if(n.startsWith("EVOLVE_"))throw new Error(`${t} cannot use the reserved EVOLVE_ prefix`);return n}function $Xe(e){let t=new Set(["EVOLVE_API_KEY","EVOLVE_PROVIDER_RUNTIME_BINDING","GEMINI_DEFAULT_AUTH_TYPE",...sQ]),n=r=>{r&&t.add(r)};n(e.apiKeyEnv),n(e.baseUrlEnv),n(e.customHeadersEnv),n(e.gatewayConfigEnv),e.spendTrackingEnvs&&(n(e.spendTrackingEnvs.sessionTagEnv),n(e.spendTrackingEnvs.runTagEnv));for(let r of Object.values(e.providerEnvMap??{}))n(r.keyEnv);return t}function fQ(e,t){if(!e)return;let n=qXe(e),r=$Xe(t),a=new Set;for(let i of n){let s=i.as||i.name;if(r.has(s))throw new Error(`${s} is reserved for Evolve-managed sandbox services and cannot be used as a managed secret env var`);if(a.has(s))throw new Error(`duplicate managed secret env var: ${s}`);a.add(s)}return n}function _B(e){return e.env.some(t=>!bB(t))}function pQ(e){let t={};for(let a of e.env)bB(a)?t[a.envName]=a.value:t[a.envName]=a.placeholder;if(!_B(e))return t;let n=`http://127.0.0.1:${NO}`;t.HTTPS_PROXY=n,t.https_proxy=n,t.NODE_EXTRA_CA_CERTS=bm,t.SSL_CERT_FILE=wv,t.REQUESTS_CA_BUNDLE=wv,t.CURL_CA_BUNDLE=wv,t.GIT_SSL_CAINFO=wv;let r=new URL(e.egressUrl).hostname;return t.NO_PROXY=`localhost,127.0.0.1,::1,${r}`,t.no_proxy=t.NO_PROXY,t}function hQ(e){let t=e.env.filter(r=>!bB(r)),n=Array.from(new Set(t.flatMap(r=>r.allowedHosts)));return JSON.stringify({egress_url:e.egressUrl,channel_url:e.channelUrl,token:e.token,binding:e.bindingSecret,hosts:n,placeholders:t.map(r=>r.placeholder),base_dir:so,ca_cert:bm,ca_key:xO,port:NO,max_body_bytes:10*1024*1024},null,2)}function mQ(){return["umask 077",`mkdir -p ${so}/certs`,`chmod 700 ${so} ${so}/certs`,`chmod 700 ${Jw} 2>/dev/null || true`,`chmod 600 ${xv} 2>/dev/null || true`,`if [ ! -f ${xO} ]; then openssl genrsa -out ${xO} 2048 >/dev/null 2>&1; fi`,`if [ ! -f ${bm} ]; then openssl req -x509 -new -nodes -key ${xO} -sha256 -days 30 -subj "/CN=Evolve Managed Secrets" -addext "basicConstraints=critical,CA:TRUE" -addext "keyUsage=critical,keyCertSign,cRLSign" -out ${bm} >/dev/null 2>&1; fi`,`SYSTEM_CA_BUNDLE=""; for p in /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt /etc/ssl/ca-bundle.pem; do if [ -f "$p" ]; then SYSTEM_CA_BUNDLE="$p"; break; fi; done; if [ -n "$SYSTEM_CA_BUNDLE" ]; then cat "$SYSTEM_CA_BUNDLE" ${bm} > ${wv}; else cp ${bm} ${wv}; fi`,`if command -v update-ca-certificates >/dev/null 2>&1; then cp ${bm} /usr/local/share/ca-certificates/evolve-managed-secrets.crt 2>/dev/null && update-ca-certificates >/dev/null 2>&1 || true; fi`].join(" && ")}function gQ(){return`umask 077 && exec python3 ${Jw} ${xv}`}function yQ(){return`rm -f ${xv}`}function zXe(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e;if(typeof t.provisional!="boolean")return null;let n=r=>typeof r=="number"&&Number.isFinite(r)?r:null;return{provisional:t.provisional,spent_usd:n(t.spent_usd),input_tokens:n(t.input_tokens),cached_input_tokens:n(t.cached_input_tokens),cache_write_tokens:n(t.cache_write_tokens),output_tokens:n(t.output_tokens),as_of:typeof t.as_of=="string"?t.as_of:null}}var GXe=6e5,JXe=5e3;function jZ(e,t,n){let r=t??n;if(!Number.isFinite(r)||r<=0)throw new Error(`${e} must be a positive number`);return r}function MO(e){let t=e?.apiKey||process.env[vc];if(!t)throw new Error(`sessions() requires an API key. Set ${vc} or pass { apiKey } in config.`);let n=e?.dashboardUrl||ia;async function r(o,c){let l=await fetch(`${n}${o}`,{...c,headers:{Authorization:`Bearer ${t}`,...c?.headers}});if(!l.ok){let u=await l.text().catch(()=>"");throw new Error(`Dashboard API error (${l.status}): ${u||l.statusText}`)}return l}function a(o){return{id:o.id,tag:o.tag,agent:o.agent,model:o.model||null,provider:o.provider,sandboxId:o.sandboxId||null,state:o.isEnded?"ended":"live",runtimeStatus:o.runtimeStatus||"unknown",cost:typeof o.cost=="number"?o.cost:null,usage:zXe(o.usage),createdAt:o.createdAt,endedAt:o.endedAt||null,stepCount:o.stepCount||0,toolStats:o.toolStats||null}}function i(o,c){if(o.status!=="ready")throw new Error(`Browser replay is not ready (status: ${String(o.status||"unknown")})`);if(typeof o.replayUrl!="string"||typeof o.downloadUrl!="string")throw new Error("Browser replay response missing replayUrl or downloadUrl");return{sessionId:o.sessionId||c,status:"ready",replayUrl:o.replayUrl,downloadUrl:o.downloadUrl,suggestedStartSeconds:typeof o.suggestedStartSeconds=="number"?o.suggestedStartSeconds:void 0,sizeBytes:typeof o.sizeBytes=="number"?o.sizeBytes:void 0,readyAt:typeof o.readyAt=="string"?o.readyAt:void 0}}let s=o=>new Promise(c=>setTimeout(c,o));return{async list(o){let c=new URLSearchParams({paginationMode:"cursor",pageSize:String(Math.min(o?.limit??20,200)),paginated:"true"});if(o?.cursor&&c.set("cursor",o.cursor),o?.state&&o.state!=="all"&&c.set("state",o.state),o?.agent&&c.set("agent",o.agent),o?.tagPrefix&&c.set("tagPrefix",o.tagPrefix),o?.sort){let u={newest:"desc",oldest:"asc",cost:"desc"};c.set("sortDirection",u[o.sort]),o.sort==="cost"?c.set("sortField","cost"):c.set("sortField","timestamp")}let l=await(await r(`/api/sessions?${c}`)).json();return{items:(l.items||[]).map(a),nextCursor:l.nextCursor||null,hasMore:!!l.hasMore}},async get(o){let c=await(await r(`/api/sessions/${encodeURIComponent(o)}`)).json();return a(c)},async events(o,c){let l=new URLSearchParams;c?.since!=null&&l.set("since",String(c.since));let u=l.toString();return(await(await r(`/api/sessions/${encodeURIComponent(o)}/events${u?`?${u}`:""}`)).json()).events||[]},async download(o,c){let l=(await(await r(`/api/sessions/${encodeURIComponent(o)}`)).json()).tag||o,u=await fetch(`${n}/api/sessions/${encodeURIComponent(o)}/download`,{headers:{Authorization:`Bearer ${t}`},redirect:"follow"});if(!u.ok){let g=await u.text().catch(()=>"");throw new Error(`Download failed (${u.status}): ${g||u.statusText}`)}let d=c?.to||process.cwd();await(0,EO.mkdir)(d,{recursive:!0});let f=(0,pB.join)(d,`${l}.jsonl`);if(!u.body)throw new Error("Download response has no body");let h=XZ.Readable.fromWeb(u.body);return await(0,ZZ.pipeline)(h,(0,KZ.createWriteStream)(f)),f},async browserReplay(o,c){let l=jZ("timeoutMs",c?.timeoutMs,GXe),u=jZ("intervalMs",c?.intervalMs,JXe),d=Date.now()+l,f=`/api/sessions/${encodeURIComponent(o)}/browser-replay`;for(;;){let h=d-Date.now();if(h<=0)throw new Error(`Browser replay timed out after ${l}ms`);let g;try{g=await fetch(`${n}${f}`,{headers:{Authorization:`Bearer ${t}`,accept:"application/json"},signal:AbortSignal.timeout(Math.max(1,h))})}catch(b){let y=b.name;throw y==="AbortError"||y==="TimeoutError"?new Error(`Browser replay timed out after ${l}ms`):b}let v={};if(g.ok)v=await g.json();else{let b=await g.text().catch(()=>"");throw new Error(`Dashboard API error (${g.status}): ${b||g.statusText}`)}if(v.status==="ready")return i(v,o);if(v.status==="failed"){let b=typeof v.error=="string"?v.error:"unknown error";throw new Error(`Browser replay failed: ${b}`)}if(Date.now()>=d)throw new Error(`Browser replay timed out after ${l}ms`);await s(Math.min(u,Math.max(0,d-Date.now())))}}}}var mjt=30*6e4;fB();vQ();var UKe=require("events"),BKe=Ve(Jte(),1),Bo=require("crypto");pL();var gO=require("child_process"),iB=require("util"),Ct=require("fs/promises"),Up=require("os");var ft=require("path");var tne=Symbol("Let zodToJsonSchema decide on which parser to use");var ene={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},nne=e=>typeof e=="string"?{...ene,name:e}:{...ene,...e};var rne=e=>{let t=nne(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,a])=>[a._def,{def:a._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}};function hL(e,t,n,r){r?.errorMessages&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function yn(e,t,n,r,a){e[t]=n,hL(e,t,r,a)}var SA=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};var Xu={};Vu(Xu,{BRAND:()=>nit,DIRTY:()=>Nm,EMPTY_PATH:()=>Mrt,INVALID:()=>pt,NEVER:()=>Vit,OK:()=>Za,ParseStatus:()=>Oa,Schema:()=>zt,ZodAny:()=>jp,ZodArray:()=>df,ZodBigInt:()=>Dm,ZodBoolean:()=>Um,ZodBranded:()=>xI,ZodCatch:()=>Wm,ZodDate:()=>Bm,ZodDefault:()=>Hm,ZodDiscriminatedUnion:()=>IA,ZodEffects:()=>Ec,ZodEnum:()=>Gm,ZodError:()=>fo,ZodFirstPartyTypeKind:()=>Be,ZodFunction:()=>EA,ZodIntersection:()=>qm,ZodIssueCode:()=>Ce,ZodLazy:()=>$m,ZodLiteral:()=>zm,ZodMap:()=>Hv,ZodNaN:()=>Yv,ZodNativeEnum:()=>Jm,ZodNever:()=>gl,ZodNull:()=>Lm,ZodNullable:()=>Ku,ZodNumber:()=>Mm,ZodObject:()=>po,ZodOptional:()=>Ic,ZodParsedType:()=>Ye,ZodPipeline:()=>EI,ZodPromise:()=>Kp,ZodReadonly:()=>Ym,ZodRecord:()=>xA,ZodSchema:()=>zt,ZodSet:()=>Wv,ZodString:()=>Yp,ZodSymbol:()=>Gv,ZodTransformer:()=>Ec,ZodTuple:()=>ju,ZodType:()=>zt,ZodUndefined:()=>Fm,ZodUnion:()=>Vm,ZodUnknown:()=>uf,ZodVoid:()=>Jv,addIssueToContext:()=>Ge,any:()=>dit,array:()=>mit,bigint:()=>sit,boolean:()=>hne,coerce:()=>Lit,custom:()=>dne,date:()=>oit,datetimeRegex:()=>lne,defaultErrorMap:()=>cf,discriminatedUnion:()=>bit,effect:()=>Rit,enum:()=>Oit,function:()=>Eit,getErrorMap:()=>qv,getParsedType:()=>Yu,instanceof:()=>iit,intersection:()=>Sit,isAborted:()=>_A,isAsync:()=>$v,isDirty:()=>wA,isValid:()=>Wp,late:()=>rit,lazy:()=>Tit,literal:()=>kit,makeIssue:()=>II,map:()=>Iit,nan:()=>ait,nativeEnum:()=>Ait,never:()=>pit,null:()=>uit,nullable:()=>Nit,number:()=>pne,object:()=>git,objectUtil:()=>mL,oboolean:()=>Fit,onumber:()=>Bit,optional:()=>Cit,ostring:()=>Uit,pipeline:()=>Dit,preprocess:()=>Mit,promise:()=>Pit,quotelessJson:()=>Rrt,record:()=>wit,set:()=>xit,setErrorMap:()=>Nrt,strictObject:()=>yit,string:()=>fne,symbol:()=>cit,transformer:()=>Rit,tuple:()=>_it,undefined:()=>lit,union:()=>vit,unknown:()=>fit,util:()=>nn,void:()=>hit});var nn;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function n(a){throw new Error}e.assertNever=n,e.arrayToEnum=a=>{let i={};for(let s of a)i[s]=s;return i},e.getValidEnumValues=a=>{let i=e.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(let o of i)s[o]=a[o];return e.objectValues(s)},e.objectValues=a=>e.objectKeys(a).map(function(i){return a[i]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let i=[];for(let s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},e.find=(a,i)=>{for(let s of a)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(nn||(nn={}));var mL;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(mL||(mL={}));var Ye=nn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yu=e=>{switch(typeof e){case"undefined":return Ye.undefined;case"string":return Ye.string;case"number":return Number.isNaN(e)?Ye.nan:Ye.number;case"boolean":return Ye.boolean;case"function":return Ye.function;case"bigint":return Ye.bigint;case"symbol":return Ye.symbol;case"object":return Array.isArray(e)?Ye.array:e===null?Ye.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ye.promise:typeof Map<"u"&&e instanceof Map?Ye.map:typeof Set<"u"&&e instanceof Set?Ye.set:typeof Date<"u"&&e instanceof Date?Ye.date:Ye.object;default:return Ye.unknown}};var Ce=nn.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"]),Rrt=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),fo=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(i){return i.message},r={_errors:[]},a=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let o=r,c=0;for(;c<s.path.length;){let l=s.path[c];c===s.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(n(s))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return a(this),r}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,nn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n={},r=[];for(let a of this.issues)if(a.path.length>0){let i=a.path[0];n[i]=n[i]||[],n[i].push(t(a))}else r.push(t(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};fo.create=e=>new fo(e);var Crt=(e,t)=>{let n;switch(e.code){case Ce.invalid_type:e.received===Ye.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Ce.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,nn.jsonStringifyReplacer)}`;break;case Ce.unrecognized_keys:n=`Unrecognized key(s) in object: ${nn.joinValues(e.keys,", ")}`;break;case Ce.invalid_union:n="Invalid input";break;case Ce.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${nn.joinValues(e.options)}`;break;case Ce.invalid_enum_value:n=`Invalid enum value. Expected ${nn.joinValues(e.options)}, received '${e.received}'`;break;case Ce.invalid_arguments:n="Invalid function arguments";break;case Ce.invalid_return_type:n="Invalid function return type";break;case Ce.invalid_date:n="Invalid date";break;case Ce.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:nn.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Ce.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Ce.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Ce.custom:n="Invalid input";break;case Ce.invalid_intersection_types:n="Intersection results could not be merged";break;case Ce.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Ce.not_finite:n="Number must be finite";break;default:n=t.defaultError,nn.assertNever(e)}return{message:n}},cf=Crt;var ine=cf;function Nrt(e){ine=e}function qv(){return ine}var II=e=>{let{data:t,path:n,errorMaps:r,issueData:a}=e,i=[...n,...a.path||[]],s={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let o="",c=r.filter(l=>!!l).slice().reverse();for(let l of c)o=l(s,{data:t,defaultError:o}).message;return{...a,path:i,message:o}},Mrt=[];function Ge(e,t){let n=qv(),r=II({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===cf?void 0:cf].filter(a=>!!a)});e.common.issues.push(r)}var Oa=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let r=[];for(let a of n){if(a.status==="aborted")return pt;a.status==="dirty"&&t.dirty(),r.push(a.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){let r=[];for(let a of n){let i=await a.key,s=await a.value;r.push({key:i,value:s})}return e.mergeObjectSync(t,r)}static mergeObjectSync(t,n){let r={};for(let a of n){let{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return pt;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||a.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}},pt=Object.freeze({status:"aborted"}),Nm=e=>({status:"dirty",value:e}),Za=e=>({status:"valid",value:e}),_A=e=>e.status==="aborted",wA=e=>e.status==="dirty",Wp=e=>e.status==="valid",$v=e=>typeof Promise<"u"&&e instanceof Promise;var at;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(at||(at={}));var xc=class{constructor(t,n,r,a){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ane=(e,t)=>{if(Wp(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new fo(e.common.issues);return this._error=n,this._error}}};function Dt(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(s,o)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??r??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:c??n??o.defaultError}},description:a}}var zt=class{get description(){return this._def.description}_getType(t){return Yu(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Yu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Oa,ctx:{common:t.parent.common,data:t.data,parsedType:Yu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if($v(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yu(t)},a=this._parseSync({data:t,path:r.path,parent:r});return ane(r,a)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yu(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:n});return Wp(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>Wp(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){let r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yu(t)},a=this._parse({data:t,path:r.path,parent:r}),i=await($v(a)?a:Promise.resolve(a));return ane(r,i)}refine(t,n){let r=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,i)=>{let s=t(a),o=()=>i.addIssue({code:Ce.custom,...r(a)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(t,n){return this._refinement((r,a)=>t(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(t){return new Ec({schema:this,typeName:Be.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:n=>this["~validate"](n)}}optional(){return Ic.create(this,this._def)}nullable(){return Ku.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return df.create(this)}promise(){return Kp.create(this,this._def)}or(t){return Vm.create([this,t],this._def)}and(t){return qm.create(this,t,this._def)}transform(t){return new Ec({...Dt(this._def),schema:this,typeName:Be.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new Hm({...Dt(this._def),innerType:this,defaultValue:n,typeName:Be.ZodDefault})}brand(){return new xI({typeName:Be.ZodBranded,type:this,...Dt(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new Wm({...Dt(this._def),innerType:this,catchValue:n,typeName:Be.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return EI.create(this,t)}readonly(){return Ym.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Drt=/^c[^\s-]{8,}$/i,Urt=/^[0-9a-z]+$/,Brt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Frt=/^[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,Lrt=/^[a-z0-9_-]{21}$/i,Vrt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qrt=/^[-+]?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)?)??$/,$rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zrt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",gL,Grt=/^(?:(?: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])$/,Jrt=/^(?:(?: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])$/,Hrt=/^(([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]))$/,Wrt=/^(([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])$/,Yrt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,jrt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,one="((\\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])))",Krt=new RegExp(`^${one}$`);function cne(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Xrt(e){return new RegExp(`^${cne(e)}$`)}function lne(e){let t=`${one}T${cne(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Zrt(e,t){return!!((t==="v4"||!t)&&Grt.test(e)||(t==="v6"||!t)&&Hrt.test(e))}function Qrt(e,t){if(!Vrt.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||t&&a.alg!==t)}catch{return!1}}function eit(e,t){return!!((t==="v4"||!t)&&Jrt.test(e)||(t==="v6"||!t)&&Wrt.test(e))}var Yp=class e extends zt{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ye.string){let i=this._getOrReturnCtx(t);return Ge(i,{code:Ce.invalid_type,expected:Ye.string,received:i.parsedType}),pt}let r=new Oa,a;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,o=t.data.length<i.value;(s||o)&&(a=this._getOrReturnCtx(t,a),s?Ge(a,{code:Ce.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&Ge(a,{code:Ce.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")$rt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"email",code:Ce.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")gL||(gL=new RegExp(zrt,"u")),gL.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"emoji",code:Ce.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Frt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"uuid",code:Ce.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Lrt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"nanoid",code:Ce.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Drt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"cuid",code:Ce.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Urt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"cuid2",code:Ce.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Brt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"ulid",code:Ce.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),Ge(a,{validation:"url",code:Ce.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"regex",code:Ce.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?lne(i).test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Krt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Xrt(i).test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?qrt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"duration",code:Ce.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Zrt(t.data,i.version)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"ip",code:Ce.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Qrt(t.data,i.alg)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"jwt",code:Ce.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?eit(t.data,i.version)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"cidr",code:Ce.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?Yrt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"base64",code:Ce.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?jrt.test(t.data)||(a=this._getOrReturnCtx(t,a),Ge(a,{validation:"base64url",code:Ce.invalid_string,message:i.message}),r.dirty()):nn.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(a=>t.test(a),{validation:n,code:Ce.invalid_string,...at.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...at.errToObj(t)})}url(t){return this._addCheck({kind:"url",...at.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...at.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...at.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...at.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...at.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...at.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...at.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...at.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...at.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...at.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...at.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...at.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...at.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...at.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...at.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...at.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...at.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...at.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...at.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...at.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...at.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...at.errToObj(n)})}nonempty(t){return this.min(1,at.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Yp.create=e=>new Yp({checks:[],typeName:Be.ZodString,coerce:e?.coerce??!1,...Dt(e)});function tit(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r,i=Number.parseInt(e.toFixed(a).replace(".","")),s=Number.parseInt(t.toFixed(a).replace(".",""));return i%s/10**a}var Mm=class e extends zt{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)!==Ye.number){let i=this._getOrReturnCtx(t);return Ge(i,{code:Ce.invalid_type,expected:Ye.number,received:i.parsedType}),pt}let r,a=new Oa;for(let i of this._def.checks)i.kind==="int"?nn.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?tit(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.not_finite,message:i.message}),a.dirty()):nn.assertNever(i);return{status:a.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,at.toString(n))}gt(t,n){return this.setLimit("min",t,!1,at.toString(n))}lte(t,n){return this.setLimit("max",t,!0,at.toString(n))}lt(t,n){return this.setLimit("max",t,!1,at.toString(n))}setLimit(t,n,r,a){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:at.toString(a)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:at.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:at.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:at.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:at.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:at.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:at.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:at.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:at.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:at.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&nn.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}};Mm.create=e=>new Mm({checks:[],typeName:Be.ZodNumber,coerce:e?.coerce||!1,...Dt(e)});var Dm=class e extends zt{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)!==Ye.bigint)return this._getInvalidInput(t);let r,a=new Oa;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Ge(r,{code:Ce.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):nn.assertNever(i);return{status:a.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return Ge(n,{code:Ce.invalid_type,expected:Ye.bigint,received:n.parsedType}),pt}gte(t,n){return this.setLimit("min",t,!0,at.toString(n))}gt(t,n){return this.setLimit("min",t,!1,at.toString(n))}lte(t,n){return this.setLimit("max",t,!0,at.toString(n))}lt(t,n){return this.setLimit("max",t,!1,at.toString(n))}setLimit(t,n,r,a){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:at.toString(a)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:at.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:at.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:at.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:at.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:at.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Dm.create=e=>new Dm({checks:[],typeName:Be.ZodBigInt,coerce:e?.coerce??!1,...Dt(e)});var Um=class extends zt{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ye.boolean){let r=this._getOrReturnCtx(t);return Ge(r,{code:Ce.invalid_type,expected:Ye.boolean,received:r.parsedType}),pt}return Za(t.data)}};Um.create=e=>new Um({typeName:Be.ZodBoolean,coerce:e?.coerce||!1,...Dt(e)});var Bm=class e extends zt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ye.date){let i=this._getOrReturnCtx(t);return Ge(i,{code:Ce.invalid_type,expected:Ye.date,received:i.parsedType}),pt}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return Ge(i,{code:Ce.invalid_date}),pt}let r=new Oa,a;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(a=this._getOrReturnCtx(t,a),Ge(a,{code:Ce.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):nn.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:at.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:at.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};Bm.create=e=>new Bm({checks:[],coerce:e?.coerce||!1,typeName:Be.ZodDate,...Dt(e)});var Gv=class extends zt{_parse(t){if(this._getType(t)!==Ye.symbol){let r=this._getOrReturnCtx(t);return Ge(r,{code:Ce.invalid_type,expected:Ye.symbol,received:r.parsedType}),pt}return Za(t.data)}};Gv.create=e=>new Gv({typeName:Be.ZodSymbol,...Dt(e)});var Fm=class extends zt{_parse(t){if(this._getType(t)!==Ye.undefined){let r=this._getOrReturnCtx(t);return Ge(r,{code:Ce.invalid_type,expected:Ye.undefined,received:r.parsedType}),pt}return Za(t.data)}};Fm.create=e=>new Fm({typeName:Be.ZodUndefined,...Dt(e)});var Lm=class extends zt{_parse(t){if(this._getType(t)!==Ye.null){let r=this._getOrReturnCtx(t);return Ge(r,{code:Ce.invalid_type,expected:Ye.null,received:r.parsedType}),pt}return Za(t.data)}};Lm.create=e=>new Lm({typeName:Be.ZodNull,...Dt(e)});var jp=class extends zt{constructor(){super(...arguments),this._any=!0}_parse(t){return Za(t.data)}};jp.create=e=>new jp({typeName:Be.ZodAny,...Dt(e)});var uf=class extends zt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Za(t.data)}};uf.create=e=>new uf({typeName:Be.ZodUnknown,...Dt(e)});var gl=class extends zt{_parse(t){let n=this._getOrReturnCtx(t);return Ge(n,{code:Ce.invalid_type,expected:Ye.never,received:n.parsedType}),pt}};gl.create=e=>new gl({typeName:Be.ZodNever,...Dt(e)});var Jv=class extends zt{_parse(t){if(this._getType(t)!==Ye.undefined){let r=this._getOrReturnCtx(t);return Ge(r,{code:Ce.invalid_type,expected:Ye.void,received:r.parsedType}),pt}return Za(t.data)}};Jv.create=e=>new Jv({typeName:Be.ZodVoid,...Dt(e)});var df=class e extends zt{_parse(t){let{ctx:n,status:r}=this._processInputParams(t),a=this._def;if(n.parsedType!==Ye.array)return Ge(n,{code:Ce.invalid_type,expected:Ye.array,received:n.parsedType}),pt;if(a.exactLength!==null){let s=n.data.length>a.exactLength.value,o=n.data.length<a.exactLength.value;(s||o)&&(Ge(n,{code:s?Ce.too_big:Ce.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(Ge(n,{code:Ce.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(Ge(n,{code:Ce.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,o)=>a.type._parseAsync(new xc(n,s,n.path,o)))).then(s=>Oa.mergeArray(r,s));let i=[...n.data].map((s,o)=>a.type._parseSync(new xc(n,s,n.path,o)));return Oa.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:at.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:at.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:at.toString(n)}})}nonempty(t){return this.min(1,t)}};df.create=(e,t)=>new df({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Be.ZodArray,...Dt(t)});function zv(e){if(e instanceof po){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Ic.create(zv(r))}return new po({...e._def,shape:()=>t})}else return e instanceof df?new df({...e._def,type:zv(e.element)}):e instanceof Ic?Ic.create(zv(e.unwrap())):e instanceof Ku?Ku.create(zv(e.unwrap())):e instanceof ju?ju.create(e.items.map(t=>zv(t))):e}var po=class e extends zt{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=nn.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Ye.object){let l=this._getOrReturnCtx(t);return Ge(l,{code:Ce.invalid_type,expected:Ye.object,received:l.parsedType}),pt}let{status:r,ctx:a}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof gl&&this._def.unknownKeys==="strip"))for(let l in a.data)s.includes(l)||o.push(l);let c=[];for(let l of s){let u=i[l],d=a.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new xc(a,d,a.path,l)),alwaysSet:l in a.data})}if(this._def.catchall instanceof gl){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of o)c.push({key:{status:"valid",value:u},value:{status:"valid",value:a.data[u]}});else if(l==="strict")o.length>0&&(Ge(a,{code:Ce.unrecognized_keys,keys:o}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of o){let d=a.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new xc(a,d,a.path,u)),alwaysSet:u in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key,f=await u.value;l.push({key:d,value:f,alwaysSet:u.alwaysSet})}return l}).then(l=>Oa.mergeObjectSync(r,l)):Oa.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return at.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{let a=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:at.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Be.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let r of nn.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let r of nn.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}deepPartial(){return zv(this)}partial(t){let n={};for(let r of nn.objectKeys(this.shape)){let a=this.shape[r];t&&!t[r]?n[r]=a:n[r]=a.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let r of nn.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Ic;)i=i._def.innerType;n[r]=i}return new e({...this._def,shape:()=>n})}keyof(){return une(nn.objectKeys(this.shape))}};po.create=(e,t)=>new po({shape:()=>e,unknownKeys:"strip",catchall:gl.create(),typeName:Be.ZodObject,...Dt(t)});po.strictCreate=(e,t)=>new po({shape:()=>e,unknownKeys:"strict",catchall:gl.create(),typeName:Be.ZodObject,...Dt(t)});po.lazycreate=(e,t)=>new po({shape:e,unknownKeys:"strip",catchall:gl.create(),typeName:Be.ZodObject,...Dt(t)});var Vm=class extends zt{_parse(t){let{ctx:n}=this._processInputParams(t),r=this._def.options;function a(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;let s=i.map(o=>new fo(o.ctx.common.issues));return Ge(n,{code:Ce.invalid_union,unionErrors:s}),pt}if(n.common.async)return Promise.all(r.map(async i=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(a);{let i,s=[];for(let c of r){let l={...n,common:{...n.common,issues:[]},parent:null},u=c._parseSync({data:n.data,path:n.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map(c=>new fo(c));return Ge(n,{code:Ce.invalid_union,unionErrors:o}),pt}}get options(){return this._def.options}};Vm.create=(e,t)=>new Vm({options:e,typeName:Be.ZodUnion,...Dt(t)});var lf=e=>e instanceof $m?lf(e.schema):e instanceof Ec?lf(e.innerType()):e instanceof zm?[e.value]:e instanceof Gm?e.options:e instanceof Jm?nn.objectValues(e.enum):e instanceof Hm?lf(e._def.innerType):e instanceof Fm?[void 0]:e instanceof Lm?[null]:e instanceof Ic?[void 0,...lf(e.unwrap())]:e instanceof Ku?[null,...lf(e.unwrap())]:e instanceof xI||e instanceof Ym?lf(e.unwrap()):e instanceof Wm?lf(e._def.innerType):[],IA=class e extends zt{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ye.object)return Ge(n,{code:Ce.invalid_type,expected:Ye.object,received:n.parsedType}),pt;let r=this.discriminator,a=n.data[r],i=this.optionsMap.get(a);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(Ge(n,{code:Ce.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),pt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let a=new Map;for(let i of n){let s=lf(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let o of s){if(a.has(o))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(o)}`);a.set(o,i)}}return new e({typeName:Be.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:a,...Dt(r)})}};function yL(e,t){let n=Yu(e),r=Yu(t);if(e===t)return{valid:!0,data:e};if(n===Ye.object&&r===Ye.object){let a=nn.objectKeys(t),i=nn.objectKeys(e).filter(o=>a.indexOf(o)!==-1),s={...e,...t};for(let o of i){let c=yL(e[o],t[o]);if(!c.valid)return{valid:!1};s[o]=c.data}return{valid:!0,data:s}}else if(n===Ye.array&&r===Ye.array){if(e.length!==t.length)return{valid:!1};let a=[];for(let i=0;i<e.length;i++){let s=e[i],o=t[i],c=yL(s,o);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return n===Ye.date&&r===Ye.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var qm=class extends zt{_parse(t){let{status:n,ctx:r}=this._processInputParams(t),a=(i,s)=>{if(_A(i)||_A(s))return pt;let o=yL(i.value,s.value);return o.valid?((wA(i)||wA(s))&&n.dirty(),{status:n.value,value:o.data}):(Ge(r,{code:Ce.invalid_intersection_types}),pt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>a(i,s)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};qm.create=(e,t,n)=>new qm({left:e,right:t,typeName:Be.ZodIntersection,...Dt(n)});var ju=class e extends zt{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ye.array)return Ge(r,{code:Ce.invalid_type,expected:Ye.array,received:r.parsedType}),pt;if(r.data.length<this._def.items.length)return Ge(r,{code:Ce.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pt;!this._def.rest&&r.data.length>this._def.items.length&&(Ge(r,{code:Ce.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((s,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new xc(r,s,r.path,o)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>Oa.mergeArray(n,s)):Oa.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ju.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ju({items:e,typeName:Be.ZodTuple,rest:null,...Dt(t)})};var xA=class e extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ye.object)return Ge(r,{code:Ce.invalid_type,expected:Ye.object,received:r.parsedType}),pt;let a=[],i=this._def.keyType,s=this._def.valueType;for(let o in r.data)a.push({key:i._parse(new xc(r,o,r.path,o)),value:s._parse(new xc(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?Oa.mergeObjectAsync(n,a):Oa.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof zt?new e({keyType:t,valueType:n,typeName:Be.ZodRecord,...Dt(r)}):new e({keyType:Yp.create(),valueType:t,typeName:Be.ZodRecord,...Dt(n)})}},Hv=class extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ye.map)return Ge(r,{code:Ce.invalid_type,expected:Ye.map,received:r.parsedType}),pt;let a=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([o,c],l)=>({key:a._parse(new xc(r,o,r.path,[l,"key"])),value:i._parse(new xc(r,c,r.path,[l,"value"]))}));if(r.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of s){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return pt;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(l.value,u.value)}return{status:n.value,value:o}})}else{let o=new Map;for(let c of s){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return pt;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(l.value,u.value)}return{status:n.value,value:o}}}};Hv.create=(e,t,n)=>new Hv({valueType:t,keyType:e,typeName:Be.ZodMap,...Dt(n)});var Wv=class e extends zt{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ye.set)return Ge(r,{code:Ce.invalid_type,expected:Ye.set,received:r.parsedType}),pt;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(Ge(r,{code:Ce.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(Ge(r,{code:Ce.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let i=this._def.valueType;function s(c){let l=new Set;for(let u of c){if(u.status==="aborted")return pt;u.status==="dirty"&&n.dirty(),l.add(u.value)}return{status:n.value,value:l}}let o=[...r.data.values()].map((c,l)=>i._parse(new xc(r,c,r.path,l)));return r.common.async?Promise.all(o).then(c=>s(c)):s(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:at.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:at.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};Wv.create=(e,t)=>new Wv({valueType:e,minSize:null,maxSize:null,typeName:Be.ZodSet,...Dt(t)});var EA=class e extends zt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ye.function)return Ge(n,{code:Ce.invalid_type,expected:Ye.function,received:n.parsedType}),pt;function r(o,c){return II({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,qv(),cf].filter(l=>!!l),issueData:{code:Ce.invalid_arguments,argumentsError:c}})}function a(o,c){return II({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,qv(),cf].filter(l=>!!l),issueData:{code:Ce.invalid_return_type,returnTypeError:c}})}let i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Kp){let o=this;return Za(async function(...c){let l=new fo([]),u=await o._def.args.parseAsync(c,i).catch(h=>{throw l.addIssue(r(c,h)),l}),d=await Reflect.apply(s,this,u);return await o._def.returns._def.type.parseAsync(d,i).catch(h=>{throw l.addIssue(a(d,h)),l})})}else{let o=this;return Za(function(...c){let l=o._def.args.safeParse(c,i);if(!l.success)throw new fo([r(c,l.error)]);let u=Reflect.apply(s,this,l.data),d=o._def.returns.safeParse(u,i);if(!d.success)throw new fo([a(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:ju.create(t).rest(uf.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new e({args:t||ju.create([]).rest(uf.create()),returns:n||uf.create(),typeName:Be.ZodFunction,...Dt(r)})}},$m=class extends zt{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};$m.create=(e,t)=>new $m({getter:e,typeName:Be.ZodLazy,...Dt(t)});var zm=class extends zt{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return Ge(n,{received:n.data,code:Ce.invalid_literal,expected:this._def.value}),pt}return{status:"valid",value:t.data}}get value(){return this._def.value}};zm.create=(e,t)=>new zm({value:e,typeName:Be.ZodLiteral,...Dt(t)});function une(e,t){return new Gm({values:e,typeName:Be.ZodEnum,...Dt(t)})}var Gm=class e extends zt{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),r=this._def.values;return Ge(n,{expected:nn.joinValues(r),received:n.parsedType,code:Ce.invalid_type}),pt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),r=this._def.values;return Ge(n,{received:n.data,code:Ce.invalid_enum_value,options:r}),pt}return Za(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}};Gm.create=une;var Jm=class extends zt{_parse(t){let n=nn.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Ye.string&&r.parsedType!==Ye.number){let a=nn.objectValues(n);return Ge(r,{expected:nn.joinValues(a),received:r.parsedType,code:Ce.invalid_type}),pt}if(this._cache||(this._cache=new Set(nn.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let a=nn.objectValues(n);return Ge(r,{received:r.data,code:Ce.invalid_enum_value,options:a}),pt}return Za(t.data)}get enum(){return this._def.values}};Jm.create=(e,t)=>new Jm({values:e,typeName:Be.ZodNativeEnum,...Dt(t)});var Kp=class extends zt{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ye.promise&&n.common.async===!1)return Ge(n,{code:Ce.invalid_type,expected:Ye.promise,received:n.parsedType}),pt;let r=n.parsedType===Ye.promise?n.data:Promise.resolve(n.data);return Za(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Kp.create=(e,t)=>new Kp({type:e,typeName:Be.ZodPromise,...Dt(t)});var Ec=class extends zt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Be.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:r}=this._processInputParams(t),a=this._def.effect||null,i={addIssue:s=>{Ge(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){let s=a.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async o=>{if(n.value==="aborted")return pt;let c=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return c.status==="aborted"?pt:c.status==="dirty"?Nm(c.value):n.value==="dirty"?Nm(c.value):c});{if(n.value==="aborted")return pt;let o=this._def.schema._parseSync({data:s,path:r.path,parent:r});return o.status==="aborted"?pt:o.status==="dirty"?Nm(o.value):n.value==="dirty"?Nm(o.value):o}}if(a.type==="refinement"){let s=o=>{let c=a.refinement(o,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?pt:(o.status==="dirty"&&n.dirty(),s(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?pt:(o.status==="dirty"&&n.dirty(),s(o.value).then(()=>({status:n.value,value:o.value}))))}if(a.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Wp(s))return pt;let o=a.transform(s.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Wp(s)?Promise.resolve(a.transform(s.value,i)).then(o=>({status:n.value,value:o})):pt);nn.assertNever(a)}};Ec.create=(e,t,n)=>new Ec({schema:e,typeName:Be.ZodEffects,effect:t,...Dt(n)});Ec.createWithPreprocess=(e,t,n)=>new Ec({schema:t,effect:{type:"preprocess",transform:e},typeName:Be.ZodEffects,...Dt(n)});var Ic=class extends zt{_parse(t){return this._getType(t)===Ye.undefined?Za(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ic.create=(e,t)=>new Ic({innerType:e,typeName:Be.ZodOptional,...Dt(t)});var Ku=class extends zt{_parse(t){return this._getType(t)===Ye.null?Za(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ku.create=(e,t)=>new Ku({innerType:e,typeName:Be.ZodNullable,...Dt(t)});var Hm=class extends zt{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return n.parsedType===Ye.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Hm.create=(e,t)=>new Hm({innerType:e,typeName:Be.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Dt(t)});var Wm=class extends zt{_parse(t){let{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return $v(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new fo(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new fo(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Wm.create=(e,t)=>new Wm({innerType:e,typeName:Be.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Dt(t)});var Yv=class extends zt{_parse(t){if(this._getType(t)!==Ye.nan){let r=this._getOrReturnCtx(t);return Ge(r,{code:Ce.invalid_type,expected:Ye.nan,received:r.parsedType}),pt}return{status:"valid",value:t.data}}};Yv.create=e=>new Yv({typeName:Be.ZodNaN,...Dt(e)});var nit=Symbol("zod_brand"),xI=class extends zt{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},EI=class e extends zt{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?pt:i.status==="dirty"?(n.dirty(),Nm(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?pt:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(t,n){return new e({in:t,out:n,typeName:Be.ZodPipeline})}},Ym=class extends zt{_parse(t){let n=this._def.innerType._parse(t),r=a=>(Wp(a)&&(a.value=Object.freeze(a.value)),a);return $v(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}};Ym.create=(e,t)=>new Ym({innerType:e,typeName:Be.ZodReadonly,...Dt(t)});function sne(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function dne(e,t={},n){return e?jp.create().superRefine((r,a)=>{let i=e(r);if(i instanceof Promise)return i.then(s=>{if(!s){let o=sne(t,r),c=o.fatal??n??!0;a.addIssue({code:"custom",...o,fatal:c})}});if(!i){let s=sne(t,r),o=s.fatal??n??!0;a.addIssue({code:"custom",...s,fatal:o})}}):jp.create()}var rit={object:po.lazycreate},Be;(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"})(Be||(Be={}));var iit=(e,t={message:`Input not instance of ${e.name}`})=>dne(n=>n instanceof e,t),fne=Yp.create,pne=Mm.create,ait=Yv.create,sit=Dm.create,hne=Um.create,oit=Bm.create,cit=Gv.create,lit=Fm.create,uit=Lm.create,dit=jp.create,fit=uf.create,pit=gl.create,hit=Jv.create,mit=df.create,git=po.create,yit=po.strictCreate,vit=Vm.create,bit=IA.create,Sit=qm.create,_it=ju.create,wit=xA.create,Iit=Hv.create,xit=Wv.create,Eit=EA.create,Tit=$m.create,kit=zm.create,Oit=Gm.create,Ait=Jm.create,Pit=Kp.create,Rit=Ec.create,Cit=Ic.create,Nit=Ku.create,Mit=Ec.createWithPreprocess,Dit=EI.create,Uit=()=>fne().optional(),Bit=()=>pne().optional(),Fit=()=>hne().optional(),Lit={string:e=>Yp.create({...e,coerce:!0}),number:e=>Mm.create({...e,coerce:!0}),boolean:e=>Um.create({...e,coerce:!0}),bigint:e=>Dm.create({...e,coerce:!0}),date:e=>Bm.create({...e,coerce:!0})};var Vit=pt;function Gr(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?SA(t,e.currentPath):t.join("/")}}function mne(e,t){let n={type:"array"};return e.type?._def&&e.type?._def?.typeName!==Be.ZodAny&&(n.items=gt(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&yn(n,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&yn(n,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(yn(n,"minItems",e.exactLength.value,e.exactLength.message,t),yn(n,"maxItems",e.exactLength.value,e.exactLength.message,t)),n}function gne(e,t){let n={type:"integer",format:"int64"};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case"min":t.target==="jsonSchema7"?r.inclusive?yn(n,"minimum",r.value,r.message,t):yn(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),yn(n,"minimum",r.value,r.message,t));break;case"max":t.target==="jsonSchema7"?r.inclusive?yn(n,"maximum",r.value,r.message,t):yn(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),yn(n,"maximum",r.value,r.message,t));break;case"multipleOf":yn(n,"multipleOf",r.value,r.message,t);break}return n}function yne(){return{type:"boolean"}}function TA(e,t){return gt(e.type._def,t)}var vne=(e,t)=>gt(e.innerType._def,t);function vL(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((a,i)=>vL(e,t,a))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return qit(e,t)}}var qit=(e,t)=>{let n={type:"integer",format:"unix-time"};if(t.target==="openApi3")return n;for(let r of e.checks)switch(r.kind){case"min":yn(n,"minimum",r.value,r.message,t);break;case"max":yn(n,"maximum",r.value,r.message,t);break}return n};function bne(e,t){return{...gt(e.innerType._def,t),default:e.defaultValue()}}function Sne(e,t){return t.effectStrategy==="input"?gt(e.schema._def,t):Gr(t)}function _ne(e){return{type:"string",enum:Array.from(e.values)}}var $it=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function wne(e,t){let n=[gt(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),gt(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(i=>!!i),r=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,a=[];return n.forEach(i=>{if($it(i))a.push(...i.allOf),i.unevaluatedProperties===void 0&&(r=void 0);else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:o,...c}=i;s=c}else r=void 0;a.push(s)}}),a.length?{allOf:a,...r}:void 0}function Ine(e,t){let n=typeof e.value;return n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:n==="bigint"?"integer":n,enum:[e.value]}:{type:n==="bigint"?"integer":n,const:e.value}}var bL,yl={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(bL===void 0&&(bL=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),bL),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function kA(e,t){let n={type:"string"};if(e.checks)for(let r of e.checks)switch(r.kind){case"min":yn(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,r.message,t);break;case"max":yn(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":vl(n,"email",r.message,t);break;case"format:idn-email":vl(n,"idn-email",r.message,t);break;case"pattern:zod":$s(n,yl.email,r.message,t);break}break;case"url":vl(n,"uri",r.message,t);break;case"uuid":vl(n,"uuid",r.message,t);break;case"regex":$s(n,r.regex,r.message,t);break;case"cuid":$s(n,yl.cuid,r.message,t);break;case"cuid2":$s(n,yl.cuid2,r.message,t);break;case"startsWith":$s(n,RegExp(`^${SL(r.value,t)}`),r.message,t);break;case"endsWith":$s(n,RegExp(`${SL(r.value,t)}$`),r.message,t);break;case"datetime":vl(n,"date-time",r.message,t);break;case"date":vl(n,"date",r.message,t);break;case"time":vl(n,"time",r.message,t);break;case"duration":vl(n,"duration",r.message,t);break;case"length":yn(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,r.message,t),yn(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"includes":{$s(n,RegExp(SL(r.value,t)),r.message,t);break}case"ip":{r.version!=="v6"&&vl(n,"ipv4",r.message,t),r.version!=="v4"&&vl(n,"ipv6",r.message,t);break}case"base64url":$s(n,yl.base64url,r.message,t);break;case"jwt":$s(n,yl.jwt,r.message,t);break;case"cidr":{r.version!=="v6"&&$s(n,yl.ipv4Cidr,r.message,t),r.version!=="v4"&&$s(n,yl.ipv6Cidr,r.message,t);break}case"emoji":$s(n,yl.emoji(),r.message,t);break;case"ulid":{$s(n,yl.ulid,r.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{vl(n,"binary",r.message,t);break}case"contentEncoding:base64":{yn(n,"contentEncoding","base64",r.message,t);break}case"pattern:zod":{$s(n,yl.base64,r.message,t);break}}break}case"nanoid":$s(n,yl.nanoid,r.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}function SL(e,t){return t.patternStrategy==="escape"?Git(e):e}var zit=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Git(e){let t="";for(let n=0;n<e.length;n++)zit.has(e[n])||(t+="\\"),t+=e[n];return t}function vl(e,t,n,r){e.format||e.anyOf?.some(a=>a.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):yn(e,"format",t,n,r)}function $s(e,t,n,r){e.pattern||e.allOf?.some(a=>a.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:xne(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):yn(e,"pattern",xne(t,r),n,r)}function xne(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},r=n.i?e.source.toLowerCase():e.source,a="",i=!1,s=!1,o=!1;for(let c=0;c<r.length;c++){if(i){a+=r[c],i=!1;continue}if(n.i){if(s){if(r[c].match(/[a-z]/)){o?(a+=r[c],a+=`${r[c-2]}-${r[c]}`.toUpperCase(),o=!1):r[c+1]==="-"&&r[c+2]?.match(/[a-z]/)?(a+=r[c],o=!0):a+=`${r[c]}${r[c].toUpperCase()}`;continue}}else if(r[c].match(/[a-z]/)){a+=`[${r[c]}${r[c].toUpperCase()}]`;continue}}if(n.m){if(r[c]==="^"){a+=`(^|(?<=[\r
672
672
  ]))`;continue}else if(r[c]==="$"){a+=`($|(?=[\r
673
673
  ]))`;continue}}if(n.s&&r[c]==="."){a+=s?`${r[c]}\r
674
674
  `:`[${r[c]}\r
@@ -82,6 +82,7 @@ from .hosted import (
82
82
  JobImportPage,
83
83
  JobImportPhaseProgress,
84
84
  JobImportProgress,
85
+ JobImportSkippedTrial,
85
86
  JobImportSource,
86
87
  DatasetPage,
87
88
  DatasetPreflight,
@@ -118,6 +119,8 @@ from .hosted import (
118
119
  JobCounts,
119
120
  JobDeleteResult,
120
121
  JobEvent,
122
+ JobEventType,
123
+ InfraFailureSignature,
121
124
  JobFailure,
122
125
  JobPage,
123
126
  JobRetryConfig,
@@ -469,7 +472,7 @@ async def list_checkpoints(
469
472
  await store.close()
470
473
 
471
474
 
472
- __version__ = '0.0.55.dev1125'
475
+ __version__ = '0.0.55.dev1139'
473
476
 
474
477
  __all__ = [
475
478
  # Main classes
@@ -621,6 +624,8 @@ __all__ = [
621
624
  'SkillsClient',
622
625
  'TrialTally',
623
626
  'JobEvent',
627
+ 'JobEventType',
628
+ 'InfraFailureSignature',
624
629
  'CompareResponse',
625
630
  'CompareJobAggregate',
626
631
  'CompareCell',
@@ -658,6 +663,7 @@ __all__ = [
658
663
  'JobImportPage',
659
664
  'JobImportPhaseProgress',
660
665
  'JobImportProgress',
666
+ 'JobImportSkippedTrial',
661
667
  'JobImportSource',
662
668
  'ApiKey',
663
669
  'AuthStatus',
@@ -273,6 +273,11 @@ HostedErrorCode = Literal[
273
273
  # (409; analyze is deliberately not among the refusers).
274
274
  'not_a_job_dir',
275
275
  'invalid_trial',
276
+ # One trial's artifact is over a stated per-trial bound (the per-file
277
+ # cap, the session-tree cap). Never an HTTP answer and never the import's
278
+ # failure: the trial is SKIPPED and this code names why, on the import's
279
+ # skipped_trials entries — the rest of the archive lands.
280
+ 'trial_too_large',
276
281
  'upload_too_large',
277
282
  'job_uploaded',
278
283
  # Re-uploading an archive whose job this caller already uploaded (409),
@@ -504,9 +509,22 @@ class ImportSettleError(Exception):
504
509
  JobStatus = Literal[
505
510
  'QUEUED', 'RUNNING', 'CANCELLING', 'COMPLETED', 'CANCELLED', 'FAILED'
506
511
  ]
512
+ #: Trial status law: a valid reward (including 0) = SCORED; verifier crash
513
+ #: or out-of-domain reward = SCORING_ERROR (never a fabricated zero);
514
+ #: INFRASTRUCTURE_ERROR = the trial was lost before a result was recorded;
515
+ #: BUDGET = a budget above the trial's own cap refused it — the account's
516
+ #: credits, the organization's monthly budget, or the platform's global stop
517
+ #: — at the platform's pre-boot wallet check (nothing was started) or
518
+ #: mid-run; ``exception_info.exception_type`` is ``ApiUsageLimitError`` and
519
+ #: the message carries the subject (``user:``, ``team:``, ``other:``) right
520
+ #: after the ``[agent-phase:budget_exhausted]`` stage prefix every
521
+ #: agent-phase failure detail carries;
522
+ #: never retried automatically, resume once the budget is raised (a hosted
523
+ #: extension — Harbor has no wallet); INDETERMINATE = the platform cannot
524
+ #: tell whether the trial completed.
507
525
  TrialStatus = Literal[
508
526
  'QUEUED', 'RUNNING', 'SCORING', 'SCORED',
509
- 'SCORING_ERROR', 'INFRASTRUCTURE_ERROR', 'INDETERMINATE', 'CANCELLED',
527
+ 'SCORING_ERROR', 'INFRASTRUCTURE_ERROR', 'BUDGET', 'INDETERMINATE', 'CANCELLED',
510
528
  ]
511
529
  EvalSandboxProvider = Literal['e2b', 'daytona', 'modal']
512
530
 
@@ -540,6 +558,31 @@ AttemptPhase = Literal[
540
558
  #: The caller's role in an organization: owner manages, member reads and
541
559
  #: runs (spec ``OrgRole``).
542
560
  OrgRole = Literal['owner', 'member']
561
+ #: The job stream's event vocabulary — every ``JobEvent.type`` the platform
562
+ #: emits, in the contract's own order (spec ``JobEvent`` discriminator).
563
+ #: ``job.failed`` is reserved: declared terminal, emitted by no server path
564
+ #: today. A ``trial.settled`` is not final for a trial the retry policy may
565
+ #: still re-run: ``trial.retrying`` follows the settle it retries, and
566
+ #: ``trial.retry_circuit_broken`` follows the settle whose retry the circuit
567
+ #: breaker refused.
568
+ JobEventType = Literal[
569
+ 'job.created', 'job.running', 'job.cancelling', 'job.cancelled',
570
+ 'job.completed', 'job.failed', 'trial.running', 'trial.scoring',
571
+ 'trial.spend', 'trial.settled', 'trial.retrying',
572
+ 'trial.retry_circuit_broken',
573
+ ]
574
+ #: The CLASS of infrastructure fault the auto-retry circuit breaker compares
575
+ #: on — resolved from the trial's typed failure phase, never from message text
576
+ #: (spec ``InfraFailureSignature``): ``'sandbox_death'`` the box ceased to
577
+ #: exist while a run still owed it, ``'provider_create_failure'`` the box
578
+ #: never came up, ``'stream_disconnect'`` the run's event stream ended without
579
+ #: the harness ever speaking, ``'exec_chdir_failure'`` the container exec
580
+ #: never started the harness at all (the OCI runtime refused its working
581
+ #: directory).
582
+ InfraFailureSignature = Literal[
583
+ 'sandbox_death', 'provider_create_failure', 'stream_disconnect',
584
+ 'exec_chdir_failure',
585
+ ]
543
586
 
544
587
 
545
588
  @dataclass
@@ -1984,9 +2027,10 @@ class ExceptionInfo:
1984
2027
  """Why a trial failed, when it did.
1985
2028
 
1986
2029
  ``exception_type`` is one of the platform's stable failure names
1987
- (``ScoringError``, ``InfrastructureError``, ``CancelledError``,
1988
- ``IncompleteTrialError``) — but filter with ``Trial.status``, which is the
1989
- primary key for failure classes; this is the detail.
2030
+ (``ScoringError``, ``InfrastructureError``, ``ApiUsageLimitError``,
2031
+ ``CancelledError``, ``IncompleteTrialError``) — but filter with
2032
+ ``Trial.status``, which is the primary key for failure classes; this is
2033
+ the detail.
1990
2034
  """
1991
2035
  exception_type: str
1992
2036
  #: Truncated to 2000 chars on list rows; full on the detail route.
@@ -2253,11 +2297,23 @@ class JobEvent:
2253
2297
  dict passes them through verbatim where a per-type dataclass would have to
2254
2298
  chase every payload change. TypeScript narrows the same union statically;
2255
2299
  in Python, branch on ``type`` and read ``data`` by key.
2300
+
2301
+ ``type`` is the closed :data:`JobEventType` vocabulary — the contract's
2302
+ own list, held to it by the spec gate — so a type-checker catches a
2303
+ misspelt branch; at runtime the string the server sent is assigned as
2304
+ is, exactly as TS casts, so a newer server's frame still flows through.
2305
+ The retry frames' keys: ``trial.retrying`` carries ``trial_id``,
2306
+ ``task_name``, ``retry`` (1-based), ``max_retries``, ``delay_sec``,
2307
+ ``exception_type``; ``trial.retry_circuit_broken`` carries ``trial_id``,
2308
+ ``task_name``, ``signature`` (:data:`InfraFailureSignature`),
2309
+ ``consecutive``, ``failure_phase``, ``max_retries``, ``retries_unused``
2310
+ and ``exception_message`` (the last failure in its own words; ``None``
2311
+ only on a frame recorded before the words rode it).
2256
2312
  """
2257
2313
  # Monotonic sequence number (SSE id; the Last-Event-ID resume position)
2258
2314
  seq: int
2259
2315
  # Event type, e.g. "job.created", "trial.settled", "job.completed"
2260
- type: str
2316
+ type: JobEventType
2261
2317
  data: Dict[str, Any]
2262
2318
 
2263
2319
 
@@ -2783,7 +2839,27 @@ class JobImportFailure:
2783
2839
  ``upload_too_large``, ``not_a_job_dir``, ``job_already_uploaded``
2784
2840
  (``details['existing_job_id']``), the dataset-hint codes,
2785
2841
  ``job_too_large``, ``invalid_trial`` (``details['trial']``) — plus the
2786
- platform's own ``import_failed`` and ``import_lease_expired``."""
2842
+ platform's own ``import_failed`` and ``import_lease_expired``. A trial
2843
+ over a per-trial artifact bound is not a failure: it is skipped
2844
+ (:class:`JobImportSkippedTrial`) and the import completes."""
2845
+ code: str
2846
+ message: str
2847
+ details: Optional[Dict[str, Any]] = None
2848
+
2849
+
2850
+ @dataclass
2851
+ class JobImportSkippedTrial:
2852
+ """One trial a job import LEFT OUT, typed (spec ``JobImportSkippedTrial``):
2853
+ the failure-envelope grammar plus the trial directory it names.
2854
+ ``trial_too_large`` is the one cause — the named ``details['file']`` is
2855
+ over the per-file cap, or ``agent/sessions/`` totals over the
2856
+ session-tree cap (``limits['uploads']`` on the capability document), or
2857
+ ``agent/trajectory.json`` would cost more heap to parse than the
2858
+ per-trial bound (its structure counted from the bytes, never parsed);
2859
+ ``details`` carry the ``bytes`` measured and the ``max_bytes`` bound.
2860
+ The rest of the archive lands; a skipped trial contributes nothing to
2861
+ the job."""
2862
+ trial: str
2787
2863
  code: str
2788
2864
  message: str
2789
2865
  details: Optional[Dict[str, Any]] = None
@@ -2811,6 +2887,12 @@ class JobImport:
2811
2887
  job_id: Optional[str] = None
2812
2888
  #: Trials the ingested job carries, from COMPLETED on (Harbor's own spelling).
2813
2889
  n_trials_uploaded: Optional[int] = None
2890
+ #: Trials the ingest left out, typed, from COMPLETED on — 0 when none
2891
+ #: (Harbor's own spelling). None until COMPLETED.
2892
+ n_trials_skipped: Optional[int] = None
2893
+ #: One entry per skipped trial, in archive order, from COMPLETED on
2894
+ #: ([] when none). None until COMPLETED.
2895
+ skipped_trials: Optional[List[JobImportSkippedTrial]] = None
2814
2896
  failure: Optional[JobImportFailure] = None
2815
2897
  #: None until the worker's first report (a QUEUED import).
2816
2898
  progress: Optional[JobImportProgress] = None
@@ -4031,6 +4113,28 @@ def _map_job_import_progress(raw: Any) -> Optional[JobImportProgress]:
4031
4113
  return JobImportProgress(phase=phase, started_at=started_at, phases=phases)
4032
4114
 
4033
4115
 
4116
+ def _map_job_import_skipped_trials(raw: Any) -> Optional[List[JobImportSkippedTrial]]:
4117
+ """Map the wire ``skipped_trials`` list of a job import; None for
4118
+ absent/None and for anything short of the shape (one malformed entry
4119
+ nulls the whole list — a shorter list would be a false count beside
4120
+ ``n_trials_skipped``)."""
4121
+ if not isinstance(raw, list):
4122
+ return None
4123
+ out: List[JobImportSkippedTrial] = []
4124
+ for entry in raw:
4125
+ if not isinstance(entry, dict):
4126
+ return None
4127
+ trial, code, message = entry.get('trial'), entry.get('code'), entry.get('message')
4128
+ if not (isinstance(trial, str) and isinstance(code, str) and isinstance(message, str)):
4129
+ return None
4130
+ details = entry.get('details')
4131
+ out.append(JobImportSkippedTrial(
4132
+ trial=trial, code=code, message=message,
4133
+ details=details if isinstance(details, dict) else None,
4134
+ ))
4135
+ return out
4136
+
4137
+
4034
4138
  def _map_job_import(data: Dict[str, Any]) -> JobImport:
4035
4139
  """The job-import shape (spec ``JobImport``), every required member read
4036
4140
  as the contract states it."""
@@ -4063,6 +4167,11 @@ def _map_job_import(data: Dict[str, Any]) -> JobImport:
4063
4167
  data.get('n_trials_uploaded')
4064
4168
  if isinstance(data.get('n_trials_uploaded'), int) else None
4065
4169
  ),
4170
+ n_trials_skipped=(
4171
+ data.get('n_trials_skipped')
4172
+ if isinstance(data.get('n_trials_skipped'), int) else None
4173
+ ),
4174
+ skipped_trials=_map_job_import_skipped_trials(data.get('skipped_trials')),
4066
4175
  failure=failure,
4067
4176
  progress=_map_job_import_progress(data.get('progress')),
4068
4177
  created_at=data.get('created_at') if isinstance(data.get('created_at'), str) else None,
@@ -6871,7 +6980,8 @@ class JobsClient:
6871
6980
  is never mutated. ``filter_error_types`` selects which failures to
6872
6981
  resume by their ``exception_info.exception_type``; omitted, the server
6873
6982
  default set applies (ScoringError, InfrastructureError,
6874
- IncompleteTrialError, plus stopped trials — settled CANCELLED,
6983
+ ApiUsageLimitError, IncompleteTrialError, plus stopped trials —
6984
+ settled CANCELLED,
6875
6985
  exception type CancelledError — and still-QUEUED trials of a
6876
6986
  cancelled source). Supports Idempotency-Key.
6877
6987
  """
@@ -6902,8 +7012,8 @@ class JobsClient:
6902
7012
  is never mutated. The selection is ``trial_ids`` XOR ``failed_only``
6903
7013
  (both together is refused): omitted, every trial of the (terminal)
6904
7014
  source retries; ``failed_only=True`` narrows a terminal source to its
6905
- failures (SCORING_ERROR, INFRASTRUCTURE_ERROR, INDETERMINATE —
6906
- stopped and scored trials are not failures); ``trial_ids`` names
7015
+ failures (SCORING_ERROR, INFRASTRUCTURE_ERROR, BUDGET, INDETERMINATE
7016
+ — stopped and scored trials are not failures); ``trial_ids`` names
6907
7017
  exact trials all-or-nothing, each must be SETTLED (the job itself may
6908
7018
  still be running — a settled trial's facts are final).
6909
7019
 
@@ -174,8 +174,18 @@ class UsageReading:
174
174
  spent_usd: Metered model spend so far, USD. None = the money was
175
175
  never measured (a trial's ``spend_source`` lane ``assumed_cap``;
176
176
  the token fields beside it may still carry real readings).
177
- input_tokens: Prompt tokens so far, INCLUDING the cached share.
178
- cached_input_tokens: The cached share of ``input_tokens``.
177
+ input_tokens: Prompt tokens so far, INCLUDING the cached share and
178
+ the cache-write share.
179
+ cached_input_tokens: The cached share of ``input_tokens`` (read from
180
+ the provider's prompt cache).
181
+ cache_write_tokens: The share of ``input_tokens`` WRITTEN to the
182
+ provider's prompt cache. Anthropic bills it at a premium above the
183
+ plain input price, so it is the fourth count ``spent_usd`` needs
184
+ to be reproducible from the tokens; providers without a
185
+ cache-write price report 0. None when the meter never answered —
186
+ and on a run settled before the platform recorded this share (an
187
+ older server omits the key), where the three counts beside it stay
188
+ real: None is never a fabricated 0.
179
189
  output_tokens: Completion tokens so far.
180
190
  as_of: When this reading was taken — show its age, never the figure
181
191
  alone.
@@ -184,6 +194,7 @@ class UsageReading:
184
194
  spent_usd: Optional[float]
185
195
  input_tokens: Optional[int]
186
196
  cached_input_tokens: Optional[int]
197
+ cache_write_tokens: Optional[int]
187
198
  output_tokens: Optional[int]
188
199
  as_of: Optional[str]
189
200
 
@@ -214,6 +225,7 @@ def _usage_reading_from_data(data: Any) -> Optional[UsageReading]:
214
225
  spent_usd=_num(data.get('spent_usd')),
215
226
  input_tokens=_num(data.get('input_tokens')),
216
227
  cached_input_tokens=_num(data.get('cached_input_tokens')),
228
+ cache_write_tokens=_num(data.get('cache_write_tokens')),
217
229
  output_tokens=_num(data.get('output_tokens')),
218
230
  as_of=as_of if isinstance(as_of, str) else None,
219
231
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evolve-sdk
3
- Version: 0.0.55.dev1125
3
+ Version: 0.0.55.dev1139
4
4
  Summary: Pythonic SDK for multi-agent orchestration in E2B sandboxes
5
5
  Author-email: "Swarmlink, Inc." <brandomagnani@evolvingmachines.ai>
6
6
  License: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "evolve-sdk"
7
- version = "0.0.55.dev1125"
7
+ version = "0.0.55.dev1139"
8
8
  description = "Pythonic SDK for multi-agent orchestration in E2B sandboxes"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"