@cline/shared 0.0.92 → 0.0.93-nightly.1792117748
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.d.ts +4 -0
- package/dist/automation/index.js +12 -12
- package/dist/db/index.js +5 -5
- package/dist/extensions/contribution-registry.d.ts +18 -0
- package/dist/feature-flags.d.ts +1 -1
- package/dist/hub.d.ts +81 -3
- package/dist/index.browser.d.ts +3 -1
- package/dist/index.browser.js +19 -19
- package/dist/index.d.ts +3 -1
- package/dist/index.js +42 -42
- package/dist/llms/tokens.d.ts +23 -0
- package/dist/providers/defaults.d.ts +6 -2
- package/dist/remote-config/index.js +26 -26
- package/dist/rpc/runtime.d.ts +5 -1
- package/dist/services/telemetry-selfcheck.d.ts +26 -0
- package/dist/services/telemetry.d.ts +2 -0
- package/dist/storage/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import G from"node:fs/promises";import
|
|
2
|
-
`),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery){if(this.service==="s3"&&!b.has("X-Amz-Expires"))b.set("X-Amz-Expires","86400");b.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),b.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),b.set("X-Amz-SignedHeaders",this.signedHeaders)}if(this.service==="s3")try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch(C){this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");if(!h)this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/");this.encodedPath=
|
|
1
|
+
import G from"node:fs/promises";import bt from"node:path";async function Yc(e){try{return await G.access(e),!0}catch{return!1}}class vt{filePath;constructor(e){this.filePath=e}async read(){try{return JSON.parse(await G.readFile(this.filePath,"utf8"))}catch(e){if(e.code==="ENOENT")return;throw e}}async write(e){await G.mkdir(bt.dirname(this.filePath),{recursive:!0}),await G.writeFile(this.filePath,JSON.stringify(e,null,2),"utf8")}async clear(){await G.rm(this.filePath,{force:!0})}}class De{async writeText(e,t){await G.mkdir(bt.dirname(e),{recursive:!0}),await G.writeFile(e,t,"utf8")}async remove(e){await G.rm(e,{recursive:!0,force:!0})}async removeChildren(e){if(!await Yc(e))return;let t=await G.readdir(e);await Promise.all(t.map((r)=>G.rm(bt.join(e,r),{recursive:!0,force:!0})))}}import{createHmac as ra}from"node:crypto";import{basename as na}from"node:path";var wt=new TextEncoder,Qc={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},ea=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]);class Le{constructor({accessKeyId:e,secretAccessKey:t,sessionToken:r,service:n,region:o,cache:i,retries:s,initRetryMs:c}){if(e==null)throw TypeError("accessKeyId is a required option");if(t==null)throw TypeError("secretAccessKey is a required option");this.accessKeyId=e,this.secretAccessKey=t,this.sessionToken=r,this.service=n,this.region=o,this.cache=i||new Map,this.retries=s!=null?s:10,this.initRetryMs=c||50}async sign(e,t){if(e instanceof Request){let{method:o,url:i,headers:s,body:c}=e;if(t=Object.assign({method:o,url:i,headers:s},t),t.body==null&&s.has("Content-Type"))t.body=c!=null&&s.has("X-Amz-Content-Sha256")?c:await e.clone().arrayBuffer();e=i}let r=new un(Object.assign({url:e.toString()},t,this,t&&t.aws)),n=Object.assign({},t,await r.sign());delete n.aws;try{return new Request(n.url.toString(),n)}catch(o){if(o instanceof TypeError)return new Request(n.url.toString(),Object.assign({duplex:"half"},n));throw o}}async fetch(e,t){for(let r=0;r<=this.retries;r++){let n=fetch(await this.sign(e,t));if(r===this.retries)return n;let o=await n;if(o.status<500&&o.status!==429)return o;await new Promise((i)=>setTimeout(i,Math.random()*this.initRetryMs*Math.pow(2,r)))}throw Error("An unknown error occurred, ensure retries is not negative")}}class un{constructor({method:e,url:t,headers:r,body:n,accessKeyId:o,secretAccessKey:i,sessionToken:s,service:c,region:a,cache:u,datetime:l,signQuery:f,appendSessionToken:m,allHeaders:d,singleEncode:h}){if(t==null)throw TypeError("url is a required option");if(o==null)throw TypeError("accessKeyId is a required option");if(i==null)throw TypeError("secretAccessKey is a required option");this.method=e||(n?"POST":"GET"),this.url=new URL(t),this.headers=new Headers(r||{}),this.body=n,this.accessKeyId=o,this.secretAccessKey=i,this.sessionToken=s;let y,_;if(!c||!a)[y,_]=ta(this.url,this.headers);if(this.service=c||y||"",this.region=a||_||"us-east-1",this.cache=u||new Map,this.datetime=l||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=f,this.appendSessionToken=m||this.service==="iotdevicegateway",this.headers.delete("Host"),this.service==="s3"&&!this.signQuery&&!this.headers.has("X-Amz-Content-Sha256"))this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD");let b=this.signQuery?this.url.searchParams:this.headers;if(b.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken)b.set("X-Amz-Security-Token",this.sessionToken);if(this.signableHeaders=["host",...this.headers.keys()].filter((C)=>d||!ea.has(C)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map((C)=>C+":"+(C==="host"?this.url.host:(this.headers.get(C)||"").replace(/\s+/g," "))).join(`
|
|
2
|
+
`),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery){if(this.service==="s3"&&!b.has("X-Amz-Expires"))b.set("X-Amz-Expires","86400");b.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),b.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),b.set("X-Amz-SignedHeaders",this.signedHeaders)}if(this.service==="s3")try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch(C){this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");if(!h)this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/");this.encodedPath=an(this.encodedPath);let I=new Set;this.encodedSearch=[...this.url.searchParams].filter(([C])=>{if(!C)return!1;if(this.service==="s3"){if(I.has(C))return!1;I.add(C)}return!0}).map((C)=>C.map((H)=>an(encodeURIComponent(H)))).sort(([C,H],[R,w])=>C<R?-1:C>R?1:H<w?-1:H>w?1:0).map((C)=>C.join("=")).join("&")}async sign(){if(this.signQuery){if(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken)this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)}else this.headers.set("Authorization",await this.authHeader());return{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){let e=this.datetime.slice(0,8),t=[this.secretAccessKey,e,this.region,this.service].join(),r=this.cache.get(t);if(!r){let n=await _e("AWS4"+this.secretAccessKey,e),o=await _e(n,this.region),i=await _e(o,this.service);r=await _e(i,"aws4_request"),this.cache.set(t,r)}return zt(await _e(r,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,zt(await sn(await this.canonicalString()))].join(`
|
|
3
3
|
`)}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+`
|
|
4
4
|
`,this.signedHeaders,await this.hexBodyHash()].join(`
|
|
5
|
-
`)}async hexBodyHash(){let e=this.headers.get("X-Amz-Content-Sha256")||(this.service==="s3"&&this.signQuery?"UNSIGNED-PAYLOAD":null);if(e==null){if(this.body&&typeof this.body!=="string"&&!("byteLength"in this.body))throw Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");e=
|
|
5
|
+
`)}async hexBodyHash(){let e=this.headers.get("X-Amz-Content-Sha256")||(this.service==="s3"&&this.signQuery?"UNSIGNED-PAYLOAD":null);if(e==null){if(this.body&&typeof this.body!=="string"&&!("byteLength"in this.body))throw Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");e=zt(await sn(this.body||""))}return e}}async function _e(e,t){let r=await crypto.subtle.importKey("raw",typeof e==="string"?wt.encode(e):e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",r,wt.encode(t))}async function sn(e){return crypto.subtle.digest("SHA-256",typeof e==="string"?wt.encode(e):e)}var cn=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function zt(e){let t=new Uint8Array(e),r="";for(let n=0;n<t.length;n++){let o=t[n];r+=cn[o>>>4&15],r+=cn[o&15]}return r}function an(e){return e.replace(/[!'()*]/g,(t)=>"%"+t.charCodeAt(0).toString(16).toUpperCase())}function ta(e,t){let{hostname:r,pathname:n}=e;if(r.endsWith(".on.aws")){let c=r.match(/^[^.]{1,63}\.lambda-url\.([^.]{1,63})\.on\.aws$/);return c!=null?["lambda",c[1]||""]:["",""]}if(r.endsWith(".r2.cloudflarestorage.com"))return["s3","auto"];if(r.endsWith(".backblazeb2.com")){let c=r.match(/^(?:[^.]{1,63}\.)?s3\.([^.]{1,63})\.backblazeb2\.com$/);return c!=null?["s3",c[1]||""]:["",""]}let o=r.replace("dualstack.","").match(/([^.]{1,63})\.(?:([^.]{0,63})\.)?amazonaws\.com(?:\.cn)?$/),i=o&&o[1]||"",s=o&&o[2];if(s==="us-gov")s="us-gov-west-1";else if(s==="s3"||s==="s3-accelerate")s="us-east-1",i="s3";else if(i==="iot")if(r.startsWith("iot."))i="execute-api";else if(r.startsWith("data.jobs.iot."))i="iot-jobs-data";else i=n==="/mqtt"?"iotdevicegateway":"iotdata";else if(i==="autoscaling"){let c=(t.get("X-Amz-Target")||"").split(".")[0];if(c==="AnyScaleFrontendService")i="application-autoscaling";else if(c==="AnyScaleScalingPlannerFrontendService")i="autoscaling-plans"}else if(s==null&&i.startsWith("s3-"))s=i.slice(3).replace(/^fips-|^external-1/,""),i="s3";else if(i.endsWith("-fips"))i=i.slice(0,-5);else if(s&&/-\d$/.test(i)&&!/-\d$/.test(s))[i,s]=[s,i];return[Qc[i]||i,s||""]}var oa="enterprise.blobUpload",Be=new Map;function $t(e,t){return{adapterType:e,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,region:t.region,bucket:t.bucket,endpoint:t.endpoint,accountId:t.accountId}}function pn(e){return{adapterType:e.adapterType,bucket:e.bucket,region:e.region,endpoint:e.endpoint,accountId:e.accountId}}function ia(e){if(!e||e.enabled!==!0)return;if(e.type==="s3_access_keys"&&e.s3AccessSettings)return $t("s3",e.s3AccessSettings);if(e.type==="r2_access_keys"&&e.r2AccessSettings)return $t("r2",e.r2AccessSettings);if(e.type==="azure_access_keys"&&e.azureAccessSettings)return $t("azure",e.azureAccessSettings);return}function fn(e){return ia(e?.enterpriseTelemetry?.promptUploading)}function np(e,t){let r=fn(e);if(!r)return;return{version:1,storage:pn(r),userDistinctId:t}}function op(e,t,r){let n=fn(t);if(!n){Be.delete(e);return}return Be.set(e,n),{version:1,storage:pn(n),userDistinctId:r}}function ip(e){Be.delete(e)}function dn(e,t,r){let n=`${t}/${r}`;return{async write(o,i){let s=await e.fetch(`${n}/${o}`,{method:"PUT",body:i,headers:{"Content-Type":"application/json; charset=utf-8"}});if(!s.ok)throw Error(`Failed to write ${o}: ${s.status}`)}}}function sa(e){let{bucket:t,accessKeyId:r,secretAccessKey:n}=e;if(!t||!r||!n)return;let o=e.region||"us-east-1",i=e.endpoint||`https://s3.${o}.amazonaws.com`;return dn(new Le({region:o,accessKeyId:r,secretAccessKey:n}),i,t)}function ca(e){let{accountId:t,endpoint:r,bucket:n,accessKeyId:o,secretAccessKey:i}=e;if(!r&&!t||!n||!o||!i)return;return dn(new Le({accessKeyId:o,secretAccessKey:i}),e.endpoint??`https://${t}.r2.cloudflarestorage.com`,n)}function aa(e,t,r,n,o){let i=o["Content-Length"]||"",s=o["Content-Type"]||"",c=Object.entries(o).filter(([m])=>m.toLowerCase().startsWith("x-ms-")).sort(([m],[d])=>m.toLowerCase().localeCompare(d.toLowerCase())).map(([m,d])=>`${m.toLowerCase()}:${d}`).join(`
|
|
6
6
|
`),a=`/${e}${n}`,u=[r,"","",i,"",s,"","","","","","",c,a].join(`
|
|
7
|
-
`),l=Buffer.from(t,"base64"),f=
|
|
7
|
+
`),l=Buffer.from(t,"base64"),f=ra("sha256",l).update(u,"utf8").digest("base64");return`SharedKey ${e}:${f}`}function ua(e){let{accessKeyId:t,secretAccessKey:r,bucket:n}=e;if(!t||!r||!n)return;let o=e.endpoint||`https://${t}.blob.core.windows.net`;return{async write(i,s){let c=`/${n}/${i}`,a=new Date().toUTCString(),u=Buffer.from(s,"utf8"),l={"x-ms-date":a,"x-ms-version":"2024-11-04","x-ms-blob-type":"BlockBlob","Content-Type":"application/json; charset=utf-8","Content-Length":u.byteLength.toString()};l.Authorization=aa(t,r,"PUT",c,l);let f=await fetch(`${o}${c}`,{method:"PUT",body:u,headers:l});if(!f.ok){let m=await f.text().catch(()=>"");throw Error(`Failed to write ${i}: ${f.status} ${m}`.trim())}}}}function la(e){if(e.adapterType==="s3")return sa(e);if(e.adapterType==="r2")return ca(e);if(e.adapterType==="azure")return ua(e);return}function ln(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function pa(e){let t=e?.metadata?.[oa];if(!ln(t))return;let r=t.storage;if(!ln(r))return;let n=r.adapterType;if(n!=="s3"&&n!=="r2"&&n!=="azure")return;if(typeof r.bucket!=="string")return;return{version:1,storage:{adapterType:n,bucket:r.bucket,region:typeof r.region==="string"?r.region:void 0,endpoint:typeof r.endpoint==="string"?r.endpoint:void 0,accountId:typeof r.accountId==="string"?r.accountId:void 0},keyPrefix:typeof t.keyPrefix==="string"?t.keyPrefix:void 0,userDistinctId:typeof t.userDistinctId==="string"?t.userDistinctId:void 0}}function fa(e,t,r){return["sessions",r.userDistinctId?.trim()||"unknown",e,t?.endsWith("messages.json")?"messages.json":na(t)].filter((i)=>Boolean(i?.trim())).join("/")}function sp(){let e=new Map;return{async uploadMessagesFile({sessionId:t,path:r,contents:n,row:o}){let i=pa(o);if(!i)return;let s=Be.get(t);if(!s)return;let c=JSON.stringify(s),a=e.get(c);if(!a){if(a=la(s),!a)return;e.set(c,a)}await a.write(fa(t,r,i),n)}}}function St(e,t,r){return{id:`remote-config:${e}:${r}:${t.name}`,name:t.name,kind:e,contents:t.contents,alwaysEnabled:t.alwaysEnabled}}var up="remote://";function mn(e){let t="",r=!1;for(let n of e.trim().toLowerCase()){let o=n.charCodeAt(0);if(o>=97&&o<=122||o>=48&&o<=57||n==="."||n==="_"||n==="-"){if(r&&t&&t[t.length-1]!=="-")t+="-";r=!1,t+=n}else r=!0;if(t.length>=80)break}while(t.endsWith("-"))t=t.slice(0,-1);while(t.startsWith("-"))t=t.slice(1);return t||"item"}function da(e){let t=e?.globalRules?.map((n,o)=>St("rule",n,`${o}`))??[],r=e?.globalWorkflows?.map((n,o)=>St("workflow",n,`${o}`))??[];return[...t,...r]}function ma(e){return[...da(e.remoteConfig),...e.managedInstructions??[]]}function ha(e){return e.map((t)=>{let r=`## ${t.name}`,n=t.alwaysEnabled?`_Always enabled_
|
|
8
8
|
`:"";return`${r}
|
|
9
9
|
|
|
10
10
|
${n}${t.contents.trim()}`}).join(`
|
|
11
11
|
|
|
12
|
-
`)}function St(e,t){return e.filter((r)=>r.kind===t)}class kt{async materialize(e){let t=da(e.bundle),r=St(t,"rule"),n=St(t,"workflow"),o=St(t,"skill");await e.artifactStore.removeChildren(e.paths.workflowsPath),await e.artifactStore.removeChildren(e.paths.skillsPath);let i=[];if(r.length>0)await e.artifactStore.writeText(e.paths.rulesFilePath,ma(r)),i.push(...r.map((s)=>({kind:s.kind,filePath:e.paths.rulesFilePath,id:s.id,name:s.name})));else await e.artifactStore.remove(e.paths.rulesFilePath);for(let s of n){let c=`${e.paths.workflowsPath}/${dn(s.name.replace(/\.(md|markdown|txt)$/i,""))}.md`;await e.artifactStore.writeText(c,s.contents),i.push({kind:s.kind,filePath:c,id:s.id,name:s.name})}for(let s of o){let c=`${e.paths.skillsPath}/${dn(s.name)}/SKILL.md`;await e.artifactStore.writeText(c,s.contents),i.push({kind:s.kind,filePath:c,id:s.id,name:s.name})}return await e.artifactStore.writeText(e.paths.manifestPath,JSON.stringify({source:e.bundle.source,version:e.bundle.version,files:i},null,2)),{paths:e.paths,rulesFilePath:r.length>0?e.paths.rulesFilePath:void 0,files:i}}}import le from"node:path";var ha="remote-config";function Pt(e){let t=e.pluginName??ha,r=le.join(e.workspacePath,".cline",t);return{pluginName:t,pluginPath:r,workflowsPath:le.join(r,"workflows"),skillsPath:le.join(r,"skills"),bundleCachePath:le.join(r,"cache","bundle.json"),manifestPath:le.join(r,"managed.json"),rulesFilePath:le.join(r,"rules.md")}}function mn(e){return{workflowsDirectories:[e.workflowsPath],skillsDirectories:[e.skillsPath]}}function ga(e){if(!e)return;return{enabled:e.openTelemetryEnabled??!1,metricsExporter:e.openTelemetryMetricsExporter,logsExporter:e.openTelemetryLogsExporter,otlpProtocol:e.openTelemetryOtlpProtocol,otlpEndpoint:e.openTelemetryOtlpEndpoint,otlpHeaders:e.openTelemetryOtlpHeaders,otlpMetricsProtocol:e.openTelemetryOtlpMetricsProtocol,otlpMetricsEndpoint:e.openTelemetryOtlpMetricsEndpoint,otlpMetricsHeaders:e.openTelemetryOtlpMetricsHeaders,otlpLogsProtocol:e.openTelemetryOtlpLogsProtocol,otlpLogsEndpoint:e.openTelemetryOtlpLogsEndpoint,otlpLogsHeaders:e.openTelemetryOtlpLogsHeaders,metricExportInterval:e.openTelemetryMetricExportInterval,otlpInsecure:e.openTelemetryOtlpInsecure,logBatchSize:e.openTelemetryLogBatchSize,logBatchTimeout:e.openTelemetryLogBatchTimeout,logMaxQueueSize:e.openTelemetryLogMaxQueueSize}}function gn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function re(e,t){let r=e[t];return typeof r==="string"?r:void 0}function hn(e,t){let r=e[t];return typeof r==="boolean"?r:void 0}function Fe(e,t){let r=e[t];return typeof r==="number"&&Number.isFinite(r)?r:void 0}function Ct(e,t){let r=e[t];if(!gn(r))return;let n=Object.entries(r).filter((o)=>typeof o[1]==="string");return n.length>0?Object.fromEntries(n):void 0}function ya(e){if(!gn(e))return;let t={enabled:hn(e,"enabled"),metricsExporter:re(e,"metricsExporter"),logsExporter:re(e,"logsExporter"),otlpProtocol:re(e,"otlpProtocol"),otlpEndpoint:re(e,"otlpEndpoint"),otlpHeaders:Ct(e,"otlpHeaders"),otlpMetricsProtocol:re(e,"otlpMetricsProtocol"),otlpMetricsEndpoint:re(e,"otlpMetricsEndpoint"),otlpMetricsHeaders:Ct(e,"otlpMetricsHeaders"),otlpLogsProtocol:re(e,"otlpLogsProtocol"),otlpLogsEndpoint:re(e,"otlpLogsEndpoint"),otlpLogsHeaders:Ct(e,"otlpLogsHeaders"),metricExportInterval:Fe(e,"metricExportInterval"),otlpInsecure:hn(e,"otlpInsecure"),logBatchSize:Fe(e,"logBatchSize"),logBatchTimeout:Fe(e,"logBatchTimeout"),logMaxQueueSize:Fe(e,"logMaxQueueSize")};return Object.values(t).some((r)=>r!==void 0)?t:void 0}class Zt{name="remote-config";resolveTelemetry(e,t){return{...ga(e.remoteConfig),...ya(e.telemetry)}}}async function yp(e){let t=Pt(e),r=e.artifactStore??new De;await r.removeChildren(t.workflowsPath),await r.removeChildren(t.skillsPath),await r.remove(t.rulesFilePath),await r.remove(t.manifestPath),await r.remove(t.bundleCachePath)}function yn(e){return e?.claims}function _n(e,t){if(!e)return[];if(t.claimsMapper)return t.claimsMapper.mapClaimsToRoles(e);return e.roles??[]}function _a(e,t){return{...e,metadata:{...e.metadata??{},paths:t}}}class xn{options;constructor(e){this.options=e}async sync(e){let t=await this.options.controlPlane.fetchBundle({workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:this.options.logger});if(!t)throw Error("Remote config control plane returned no bundle");await this.options.bundleStore.write(t);let r=await this.options.materializer.materialize({bundle:t,paths:e.paths,artifactStore:this.options.artifactStore}),n=this.options.telemetryAdapter?await this.options.telemetryAdapter.resolveTelemetry(t,{workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:this.options.logger}):void 0,o=yn(t),i=_n(o,this.options);return{bundle:t,materialized:r,telemetry:n,roles:i,claims:o}}}function xa(e){let t=e?.name??"remote-config";return{name:t,manifest:{capabilities:["providers"]},async setup(r,n){r.registerProvider?.({name:t,description:"Remote-config managed runtime integration"}),await e?.setup?.(r,n)}}}async function _p(e){let t=Pt({workspacePath:e.workspacePath,pluginName:e.pluginName}),r=e.bundleStore??new bt(t.bundleCachePath),n=e.artifactStore??new De,o=e.materializer??new kt,i=e.telemetryAdapter??new Zt,s,c,a=[],u,l=!1,f=!1;if(e.controlPlane){let d=new xn({controlPlane:e.controlPlane,bundleStore:r,artifactStore:n,materializer:o,telemetryAdapter:i,claimsMapper:e.claimsMapper,logger:e.logger});try{let h=await d.sync({workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,paths:t,signal:e.signal,now:e.now});s=h.bundle,c=h.telemetry,a=h.roles,u=h.claims,f=!0}catch(h){if(e.useCachedBundle!==!1)s=await r.read(),l=Boolean(s);if(!s)throw h}}else if(e.useCachedBundle!==!1)s=await r.read(),l=Boolean(s);if(!s&&e.requireBundle)throw Error("Remote config runtime preparation requires a bundle");if(s){let d=_a(s,t);if(await r.write(d),!f)await o.materialize({bundle:d,paths:t,artifactStore:n});u??=yn(d),a=a.length>0?a:_n(u,e),c??=await i.resolveTelemetry(d,{workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:e.logger}),s=d}let m=mn(t);return{pluginName:t.pluginName,pluginDefinition:xa({name:t.pluginName}),paths:t,bundle:s,telemetry:c,roles:a,claims:u,usedCachedBundle:l,workflowsDirectories:m.workflowsDirectories,skillsDirectories:m.skillsDirectories}}function be(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function At(e,t="|"){return e.map((r)=>Tt(r)).join(t)}function ve(e,t){if(typeof t==="bigint")return t.toString();return t}class bn{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function we(e){return new bn(e)}function vn(e){return e===null||e===void 0}function Ue(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function wn(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function L(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ze(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ee(e){return ze(e._zod.def)??e._zod.def.shape}function zn(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return L(this,t,n),n},enumerable:!0,configurable:!0})}function $n(e,t,r){if(t in e)L(e,t,r);else e[t]=r}function se(e,t,r,n){let o=ee(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)zn(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c});else $n(e,i,n?n(s.value,i):s.value)}}function ba(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)zn(e,r,()=>t[r]);else $n(e,r,n.value)}}function B(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Sn(e){return JSON.stringify(e)}function kn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ot="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function pe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Pn=we(()=>{if(N.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ce(e){if(pe(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(pe(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function It(e){if(ce(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Cn=new Set(["string","number","symbol"]);function oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function g(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Tt(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Zn(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ke=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Et={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function va(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return se(i,e,Je(e,t)),X(e,B(r,{shape:i,checks:[]}))}function Je(e,t){let r=ee(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function wa(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Je(e,t)),s={};return se(s,e,Reflect.ownKeys(ee(e)).filter((c)=>!i.has(c))),X(e,B(r,{shape:s,checks:[]}))}function za(e,t){if(!ce(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=ee(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return X(e,B(e._zod.def,{shape:Rn(e,t)}))}function Rn(e,t){let r={};return se(r,e,Reflect.ownKeys(ee(e))),ba(r,t),r}function $a(e,t){if(!ce(t))throw Error("Invalid input to safeExtend: expected a plain object");return X(e,B(e._zod.def,{shape:Rn(e,t)}))}function Sa(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};se(r,e,Reflect.ownKeys(ee(e))),se(r,t,Reflect.ownKeys(ee(t)));let n=B(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return X(e,n)}function An(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(Je(t,r)):void 0,a={};return se(a,t,Reflect.ownKeys(ee(t)),e&&((u,l)=>c&&!c.has(l)?u:new e({type:"optional",innerType:u}))),X(t,B(t._zod.def,{shape:a,checks:[]}))}function ka(e,t,r){let n=r?new Set(Je(t,r)):void 0,o={};return se(o,t,Reflect.ownKeys(ee(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),X(t,B(t._zod.def,{shape:o}))}function J(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function On(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function q(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function xe(e){return typeof e==="string"?e:e?.message}function Mt(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function Y(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:xe(e.inst?._zod.def?.error?.(e))??xe(i?.(e))??xe(t?.error?.(e))??xe(r.customError?.(e))??xe(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e)){if(a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__")continue;c[a]=e[a]}if(c.path??(c.path=[]),c.message=s,t?.reportInput)c.input=e.input;return c}var Pa=/[\uD800-\uDBFF]/;function Ve(e){let t=e.length;if(!Pa.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function He(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function In(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function ae(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function Tn(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else Ca(e,r,n.value)}}function te(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function We(e,t,r){return te(e,t,r,!1)}function Nt(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return te(this,r,n(this))},set(o){te(this,r,o)}})}return t}function Ca(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:te(this,t,r.bind(this))},set(n){te(this,t,n)}})}function Za(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Rt,ne=!1,Ra={configurable:!0,get(){ne=!0;return}};function v(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Rt!==e._zod){Rt=void 0;return}Rt=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Ra);let o=ne;ne=!1;try{let i=r(this);if(ne)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return ne=ne||o,i}catch(i){throw delete this[t],ne=ne||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Aa(e,t,r,n){let o=Za(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var Oa="~constantCatch";function En(e){let t=()=>e;return t[Oa]=!0,t}var Mn;var jt={value:void 0,enumerable:!1},Nn="captureStackTrace"in Error?Error:null;function Ia(e){let t=Nn;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Nn=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function p(e,t,r,n){let o={};function i(m){this.def=m,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function a(m,d){if(!m._zod){jt.value=new i(d);try{Object.defineProperty(m,"_zod",jt)}finally{jt.value=void 0}}else if(m._zod.traits.has(e))return;if(m._zod.traits.add(e),t(m,d),c){let y=Object.getPrototypeOf(m),_=m._zod.constr.prototype,b=y;while(b&&b!==_)b=Object.getPrototypeOf(b);let I=b??y;if(!c.has(I))c.add(I),Tn(I,s)}let h=f.prototype;for(let y in h){if(!Object.prototype.hasOwnProperty.call(h,y))continue;if(!(y in m))m[y]=h[y].bind(m)}}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function f(m){let d=n?.Parent?Ia(l):this;a(d,m);let h=d._zod.deferred;if(h){for(let _ of h)_();d._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;if(y)y(d);return d}return Object.defineProperty(f,"init",{value:a}),Object.defineProperty(f,Symbol.hasInstance,{value:(m)=>{if(n?.Parent&&m instanceof n.Parent)return!0;return m?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class Q extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class $e extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Mn=globalThis).__zod_globalConfig??(Mn.__zod_globalConfig={});var N=globalThis.__zod_globalConfig;function F(e){if(e)Object.assign(N,e);return N}function Ta(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ve,2)),e.message}function Ea(e){this._zod.message=e}var Ma={get:Ta,set:Ea,enumerable:!0,configurable:!0},Lt={value:void 0,enumerable:!1},jn=new WeakSet([Object.prototype,Error.prototype]),Dn=(e,t)=>{e.name="$ZodError",Lt.value=t,Object.defineProperty(e,"issues",Lt),Lt.value=void 0,Object.defineProperty(e,"message",Ma);let r=Object.getPrototypeOf(e);if(!jn.has(r))jn.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},Ln=p("$ZodError",Dn),Bt=p("$ZodError",Dn,void 0,{Parent:Error});function Na(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function Bn(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)Na(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function Fn(e,t=(r)=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>n({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let a=r,u=0;while(u<c.length){let l=c[u],f=u===c.length-1;if(l==="_errors"){if(f)a._errors.push(t(s));u++;continue}if(!Object.prototype.hasOwnProperty.call(a,l))Object.defineProperty(a,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=a[l];if(f)m._errors.push(t(s));a=m,u++}}}};return n(e),r}function ja(e){let t=[],r=e.map((n)=>typeof n==="object"?n.key:n);for(let n of r)if(typeof n==="number")t.push(`[${n}]`);else if(typeof n==="symbol")t.push(`[${JSON.stringify(String(n))}]`);else if(/[^\w$]/.test(n))t.push(`[${JSON.stringify(n)}]`);else{if(t.length)t.push(".");t.push(n)}return t.join("")}function zp(e){let t=[],r=[...e.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)if(t.push(`✖ ${n.message}`),n.path?.length)t.push(` → at ${ja(n.path)}`);return t.join(`
|
|
13
|
-
`)}function Ge(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Se=(e)=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new Q;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map((u)=>Y(u,s,F())));throw Ot(a,i?.callee??t),a}return c.value};return t},Ft=Se(Bt),ke=(e)=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)c=await c;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map((u)=>Y(u,s,F())));throw Ot(a,i?.callee??t),a}return c.value};return t},Ut=ke(Bt),Xe=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Q;return i.issues.length?Un(e,i.issues,o):{success:!0,data:i.value}};function Un(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>Y(o,r,F()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var qe=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?Un(e,i.issues,o):{success:!0,data:i.value}};var La=Symbol.for("zod.compile.invalid"),Ba=Symbol.for("zod.compile.fallback"),Kt=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==La)return!0;if(n.definite===!0&&r===void 0)return!1}return Fa(e,t,r)};function Fa(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[Ba]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new Q;return i.issues.length===0}var Jt=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},Kn=(e)=>{let t=Se(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,Ge(r,s))};return r};var Jn=(e)=>{let t=Se(e),r=(n,o,i,s)=>t(n,o,i,Ge(r,s));return r};var Vn=(e)=>{let t=ke(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,Ge(r,s))};return r};var Hn=(e)=>{let t=ke(e),r=async(n,o,i,s)=>await t(n,o,i,Ge(r,s));return r};var Wn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Xe(e)(t,r,o)};var Gn=(e)=>(t,r,n)=>Xe(e)(t,r,n);var Xn=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return qe(e)(t,r,o)};var qn=(e)=>async(t,r,n)=>qe(e)(t,r,n);var Yn=/^[cC][0-9a-z]{6,}$/,Qn=/^[0-9a-z]+$/,eo=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,to=/^[0-9a-vA-V]{20}$/,ro=/^[A-Za-z0-9]{27}$/,no=/^[a-zA-Z0-9_-]{21}$/;function oo(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var io=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var so=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ht=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var co=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Ua="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function ao(){return new RegExp(Ua,"u")}var uo=/^(?:(?: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])$/,lo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var po=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,fo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ho=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var go=/^https?$/,yo=/^\+[1-9]\d{6,14}$/;var _o="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Ka(e){return new RegExp(`^${e}$`)}var xo=Ka(_o);function Vt(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function bo(e){return new RegExp(`^${Vt(e)}$`)}function vo(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Vt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Vt({precision:e.precision})}`:r;return new RegExp(`^${_o}T(?:${n})$`)}var wo=/^[\s\S]{0,}$/;var Wt=/^-?\d+$/,Pe=/^-?\d+(?:\.\d+)?$/,zo=/^(?:true|false)$/i;var $o=/^[^A-Z]*$/,So=/^[^a-z]*$/;var T=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Gt=(e)=>{let t=e.value;return!vn(t)&&t.length!==void 0},Ye={number:"number",bigint:"bigint",object:"date"},Xt=p("$ZodCheckLessThan",(e,t)=>{T.init(e,t);let r=Ye[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Ye[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qt=p("$ZodCheckGreaterThan",(e,t)=>{T.init(e,t);let r=Ye[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Ye[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ko=p("$ZodCheckMultipleOf",(e,t)=>{T.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):wn(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Po=p("$ZodCheckNumberFormat",(e,t)=>{T.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Ke[t.format];e._zod.check=(s)=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(c<o)s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(c>i)s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Co=p("$ZodCheckMaxLength",(e,t)=>{var r;T.init(e,t),(r=e._zod.def).when??(r.when=Gt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?Ve(o):i)<=t.maximum)return;let c=He(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Zo=p("$ZodCheckMinLength",(e,t)=>{var r;T.init(e,t),(r=e._zod.def).when??(r.when=Gt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?Ve(o):i)>=t.minimum)return;let c=He(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ro=p("$ZodCheckLengthEquals",(e,t)=>{var r;T.init(e,t),(r=e._zod.def).when??(r.when=Gt),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?Ve(o):i;if(s===t.length)return;let c=He(o),a=s>t.length;n.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ze=p("$ZodCheckStringFormat",(e,t)=>{var r,n;if(T.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),Ao=p("$ZodCheckRegex",(e,t)=>{Ze.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Oo=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=$o),Ze.init(e,t)}),Io=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=So),Ze.init(e,t)}),To=p("$ZodCheckIncludes",(e,t)=>{T.init(e,t);let r=oe(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Eo=p("$ZodCheckStartsWith",(e,t)=>{T.init(e,t);let r=new RegExp(`^${oe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Mo=p("$ZodCheckEndsWith",(e,t)=>{T.init(e,t);let r=new RegExp(`.*${oe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var No=p("$ZodCheckOverwrite",(e,t)=>{T.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Yt{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
12
|
+
`)}function kt(e,t){return e.filter((r)=>r.kind===t)}class Pt{async materialize(e){let t=ma(e.bundle),r=kt(t,"rule"),n=kt(t,"workflow"),o=kt(t,"skill");await e.artifactStore.removeChildren(e.paths.workflowsPath),await e.artifactStore.removeChildren(e.paths.skillsPath);let i=[];if(r.length>0)await e.artifactStore.writeText(e.paths.rulesFilePath,ha(r)),i.push(...r.map((s)=>({kind:s.kind,filePath:e.paths.rulesFilePath,id:s.id,name:s.name})));else await e.artifactStore.remove(e.paths.rulesFilePath);for(let s of n){let c=`${e.paths.workflowsPath}/${mn(s.name.replace(/\.(md|markdown|txt)$/i,""))}.md`;await e.artifactStore.writeText(c,s.contents),i.push({kind:s.kind,filePath:c,id:s.id,name:s.name})}for(let s of o){let c=`${e.paths.skillsPath}/${mn(s.name)}/SKILL.md`;await e.artifactStore.writeText(c,s.contents),i.push({kind:s.kind,filePath:c,id:s.id,name:s.name})}return await e.artifactStore.writeText(e.paths.manifestPath,JSON.stringify({source:e.bundle.source,version:e.bundle.version,files:i},null,2)),{paths:e.paths,rulesFilePath:r.length>0?e.paths.rulesFilePath:void 0,files:i}}}import le from"node:path";var ga="remote-config";function Ct(e){let t=e.pluginName??ga,r=le.join(e.workspacePath,".cline",t);return{pluginName:t,pluginPath:r,workflowsPath:le.join(r,"workflows"),skillsPath:le.join(r,"skills"),bundleCachePath:le.join(r,"cache","bundle.json"),manifestPath:le.join(r,"managed.json"),rulesFilePath:le.join(r,"rules.md")}}function hn(e){return{workflowsDirectories:[e.workflowsPath],skillsDirectories:[e.skillsPath]}}function ya(e){if(!e)return;return{enabled:e.openTelemetryEnabled??!1,metricsExporter:e.openTelemetryMetricsExporter,logsExporter:e.openTelemetryLogsExporter,otlpProtocol:e.openTelemetryOtlpProtocol,otlpEndpoint:e.openTelemetryOtlpEndpoint,otlpHeaders:e.openTelemetryOtlpHeaders,otlpMetricsProtocol:e.openTelemetryOtlpMetricsProtocol,otlpMetricsEndpoint:e.openTelemetryOtlpMetricsEndpoint,otlpMetricsHeaders:e.openTelemetryOtlpMetricsHeaders,otlpLogsProtocol:e.openTelemetryOtlpLogsProtocol,otlpLogsEndpoint:e.openTelemetryOtlpLogsEndpoint,otlpLogsHeaders:e.openTelemetryOtlpLogsHeaders,metricExportInterval:e.openTelemetryMetricExportInterval,otlpInsecure:e.openTelemetryOtlpInsecure,logBatchSize:e.openTelemetryLogBatchSize,logBatchTimeout:e.openTelemetryLogBatchTimeout,logMaxQueueSize:e.openTelemetryLogMaxQueueSize}}function yn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function re(e,t){let r=e[t];return typeof r==="string"?r:void 0}function gn(e,t){let r=e[t];return typeof r==="boolean"?r:void 0}function Fe(e,t){let r=e[t];return typeof r==="number"&&Number.isFinite(r)?r:void 0}function Zt(e,t){let r=e[t];if(!yn(r))return;let n=Object.entries(r).filter((o)=>typeof o[1]==="string");return n.length>0?Object.fromEntries(n):void 0}function _a(e){if(!yn(e))return;let t={enabled:gn(e,"enabled"),metricsExporter:re(e,"metricsExporter"),logsExporter:re(e,"logsExporter"),otlpProtocol:re(e,"otlpProtocol"),otlpEndpoint:re(e,"otlpEndpoint"),otlpHeaders:Zt(e,"otlpHeaders"),otlpMetricsProtocol:re(e,"otlpMetricsProtocol"),otlpMetricsEndpoint:re(e,"otlpMetricsEndpoint"),otlpMetricsHeaders:Zt(e,"otlpMetricsHeaders"),otlpLogsProtocol:re(e,"otlpLogsProtocol"),otlpLogsEndpoint:re(e,"otlpLogsEndpoint"),otlpLogsHeaders:Zt(e,"otlpLogsHeaders"),metricExportInterval:Fe(e,"metricExportInterval"),otlpInsecure:gn(e,"otlpInsecure"),logBatchSize:Fe(e,"logBatchSize"),logBatchTimeout:Fe(e,"logBatchTimeout"),logMaxQueueSize:Fe(e,"logMaxQueueSize")};return Object.values(t).some((r)=>r!==void 0)?t:void 0}class Rt{name="remote-config";resolveTelemetry(e,t){return{...ya(e.remoteConfig),..._a(e.telemetry)}}}async function bp(e){let t=Ct(e),r=e.artifactStore??new De;await r.removeChildren(t.workflowsPath),await r.removeChildren(t.skillsPath),await r.remove(t.rulesFilePath),await r.remove(t.manifestPath),await r.remove(t.bundleCachePath)}function _n(e){return e?.claims}function xn(e,t){if(!e)return[];if(t.claimsMapper)return t.claimsMapper.mapClaimsToRoles(e);return e.roles??[]}function xa(e,t){return{...e,metadata:{...e.metadata??{},paths:t}}}class bn{options;constructor(e){this.options=e}async sync(e){let t=await this.options.controlPlane.fetchBundle({workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:this.options.logger});if(!t)throw Error("Remote config control plane returned no bundle");await this.options.bundleStore.write(t);let r=await this.options.materializer.materialize({bundle:t,paths:e.paths,artifactStore:this.options.artifactStore}),n=this.options.telemetryAdapter?await this.options.telemetryAdapter.resolveTelemetry(t,{workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:this.options.logger}):void 0,o=_n(t),i=xn(o,this.options);return{bundle:t,materialized:r,telemetry:n,roles:i,claims:o}}}function ba(e){let t=e?.name??"remote-config";return{name:t,manifest:{capabilities:["providers"]},async setup(r,n){r.registerProvider?.({name:t,description:"Remote-config managed runtime integration"}),await e?.setup?.(r,n)}}}async function vp(e){let t=Ct({workspacePath:e.workspacePath,pluginName:e.pluginName}),r=e.bundleStore??new vt(t.bundleCachePath),n=e.artifactStore??new De,o=e.materializer??new Pt,i=e.telemetryAdapter??new Rt,s,c,a=[],u,l=!1,f=!1;if(e.controlPlane){let d=new bn({controlPlane:e.controlPlane,bundleStore:r,artifactStore:n,materializer:o,telemetryAdapter:i,claimsMapper:e.claimsMapper,logger:e.logger});try{let h=await d.sync({workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,paths:t,signal:e.signal,now:e.now});s=h.bundle,c=h.telemetry,a=h.roles,u=h.claims,f=!0}catch(h){if(e.useCachedBundle!==!1)s=await r.read(),l=Boolean(s);if(!s)throw h}}else if(e.useCachedBundle!==!1)s=await r.read(),l=Boolean(s);if(!s&&e.requireBundle)throw Error("Remote config runtime preparation requires a bundle");if(s){let d=xa(s,t);if(await r.write(d),!f)await o.materialize({bundle:d,paths:t,artifactStore:n});u??=_n(d),a=a.length>0?a:xn(u,e),c??=await i.resolveTelemetry(d,{workspacePath:e.workspacePath,rootPath:e.rootPath,context:e.context,signal:e.signal,now:e.now,logger:e.logger}),s=d}let m=hn(t);return{pluginName:t.pluginName,pluginDefinition:ba({name:t.pluginName}),paths:t,bundle:s,telemetry:c,roles:a,claims:u,usedCachedBundle:l,workflowsDirectories:m.workflowsDirectories,skillsDirectories:m.skillsDirectories}}function be(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Ot(e,t="|"){return e.map((r)=>Et(r)).join(t)}function ve(e,t){if(typeof t==="bigint")return t.toString();return t}class vn{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function ze(e){return new vn(e)}function zn(e){return e===null||e===void 0}function Ue(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function wn(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function L(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function we(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ee(e){return we(e._zod.def)??e._zod.def.shape}function $n(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return L(this,t,n),n},enumerable:!0,configurable:!0})}function Sn(e,t,r){if(t in e)L(e,t,r);else e[t]=r}function se(e,t,r,n){let o=ee(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)$n(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c});else Sn(e,i,n?n(s.value,i):s.value)}}function va(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)$n(e,r,()=>t[r]);else Sn(e,r,n.value)}}function B(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function kn(e){return JSON.stringify(e)}function Pn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var It="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function pe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Cn=ze(()=>{if(N.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ce(e){if(pe(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(pe(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Tt(e){if(ce(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Zn=new Set(["string","number","symbol"]);function oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function g(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Et(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Rn(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ke=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Mt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function za(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return se(i,e,Je(e,t)),X(e,B(r,{shape:i,checks:[]}))}function Je(e,t){let r=ee(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function wa(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Je(e,t)),s={};return se(s,e,Reflect.ownKeys(ee(e)).filter((c)=>!i.has(c))),X(e,B(r,{shape:s,checks:[]}))}function $a(e,t){if(!ce(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=ee(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return X(e,B(e._zod.def,{shape:An(e,t)}))}function An(e,t){let r={};return se(r,e,Reflect.ownKeys(ee(e))),va(r,t),r}function Sa(e,t){if(!ce(t))throw Error("Invalid input to safeExtend: expected a plain object");return X(e,B(e._zod.def,{shape:An(e,t)}))}function ka(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};se(r,e,Reflect.ownKeys(ee(e))),se(r,t,Reflect.ownKeys(ee(t)));let n=B(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return X(e,n)}function On(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(Je(t,r)):void 0,a={};return se(a,t,Reflect.ownKeys(ee(t)),e&&((u,l)=>c&&!c.has(l)?u:new e({type:"optional",innerType:u}))),X(t,B(t._zod.def,{shape:a,checks:[]}))}function Pa(e,t,r){let n=r?new Set(Je(t,r)):void 0,o={};return se(o,t,Reflect.ownKeys(ee(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),X(t,B(t._zod.def,{shape:o}))}function J(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function In(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function q(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function xe(e){return typeof e==="string"?e:e?.message}function Nt(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;if(o>=0)t.push([o,r])}return t}function Ve(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function Y(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:xe(e.inst?._zod.def?.error?.(e))??xe(i?.(e))??xe(t?.error?.(e))??xe(r.customError?.(e))??xe(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e)){if(a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__")continue;c[a]=e[a]}if(c.path??(c.path=[]),c.message=s,t?.reportInput)c.input=e.input;return c}var Ca=/[\uD800-\uDBFF]/;function He(e){let t=e.length;if(!Ca.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function We(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Tn(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function ae(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function En(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else Za(e,r,n.value)}}function te(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Ge(e,t,r){return te(e,t,r,!1)}function jt(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return te(this,r,n(this))},set(o){te(this,r,o)}})}return t}function Za(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:te(this,t,r.bind(this))},set(n){te(this,t,n)}})}function Ra(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var At,ne=!1,Aa={configurable:!0,get(){ne=!0;return}};function v(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&At!==e._zod){At=void 0;return}At=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Aa);let o=ne;ne=!1;try{let i=r(this);if(ne)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return ne=ne||o,i}catch(i){throw delete this[t],ne=ne||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Oa(e,t,r,n){let o=Ra(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var Ia="~constantCatch";function Mn(e){let t=()=>e;return t[Ia]=!0,t}var Nn;var Dt={value:void 0,enumerable:!1},jn="captureStackTrace"in Error?Error:null;function Ta(e){let t=jn;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return jn=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function p(e,t,r,n){let o={};function i(m){this.def=m,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function a(m,d){if(!m._zod){Dt.value=new i(d);try{Object.defineProperty(m,"_zod",Dt)}finally{Dt.value=void 0}}else if(m._zod.traits.has(e))return;if(m._zod.traits.add(e),t(m,d),c){let y=Object.getPrototypeOf(m),_=m._zod.constr.prototype,b=y;while(b&&b!==_)b=Object.getPrototypeOf(b);let I=b??y;if(!c.has(I))c.add(I),En(I,s)}let h=f.prototype;for(let y in h){if(!Object.prototype.hasOwnProperty.call(h,y))continue;if(!(y in m))m[y]=h[y].bind(m)}}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function f(m){let d=n?.Parent?Ta(l):this;a(d,m);let h=d._zod.deferred;if(h){for(let _ of h)_();d._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;if(y)y(d);return d}return Object.defineProperty(f,"init",{value:a}),Object.defineProperty(f,Symbol.hasInstance,{value:(m)=>{if(n?.Parent&&m instanceof n.Parent)return!0;return m?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class Q extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class $e extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Nn=globalThis).__zod_globalConfig??(Nn.__zod_globalConfig={});var N=globalThis.__zod_globalConfig;function F(e){if(e)Object.assign(N,e);return N}function Ea(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ve,2)),e.message}function Ma(e){this._zod.message=e}var Na={get:Ea,set:Ma,enumerable:!0,configurable:!0},Bt={value:void 0,enumerable:!1},Dn=new WeakSet([Object.prototype,Error.prototype]),Ln=(e,t)=>{e.name="$ZodError",Bt.value=t,Object.defineProperty(e,"issues",Bt),Bt.value=void 0,Object.defineProperty(e,"message",Na);let r=Object.getPrototypeOf(e);if(!Dn.has(r))Dn.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},Bn=p("$ZodError",Ln),Ft=p("$ZodError",Ln,void 0,{Parent:Error});function ja(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function Fn(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)ja(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function Un(e,t=(r)=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>n({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let a=r,u=0;while(u<c.length){let l=c[u],f=u===c.length-1;if(l==="_errors"){if(f)a._errors.push(t(s));u++;continue}if(!Object.prototype.hasOwnProperty.call(a,l))Object.defineProperty(a,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=a[l];if(f)m._errors.push(t(s));a=m,u++}}}};return n(e),r}function Da(e){let t=[],r=e.map((n)=>typeof n==="object"?n.key:n);for(let n of r)if(typeof n==="number")t.push(`[${n}]`);else if(typeof n==="symbol")t.push(`[${JSON.stringify(String(n))}]`);else if(/[^\w$]/.test(n))t.push(`[${JSON.stringify(n)}]`);else{if(t.length)t.push(".");t.push(n)}return t.join("")}function kp(e){let t=[],r=[...e.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)if(t.push(`✖ ${n.message}`),n.path?.length)t.push(` → at ${Da(n.path)}`);return t.join(`
|
|
13
|
+
`)}function Xe(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Se=(e)=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new Q;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map((u)=>Y(u,s,F())));throw It(a,i?.callee??t),a}return c.value};return t},Ut=Se(Ft),ke=(e)=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)c=await c;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map((u)=>Y(u,s,F())));throw It(a,i?.callee??t),a}return c.value};return t},Kt=ke(Ft),qe=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Q;return i.issues.length?Kn(e,i.issues,o):{success:!0,data:i.value}};function Kn(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>Y(o,r,F()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var Ye=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?Kn(e,i.issues,o):{success:!0,data:i.value}};var Ba=Symbol.for("zod.compile.invalid"),Fa=Symbol.for("zod.compile.fallback"),Jt=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Ba)return!0;if(n.definite===!0&&r===void 0)return!1}return Ua(e,t,r)};function Ua(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[Fa]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new Q;return i.issues.length===0}var Vt=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},Jn=(e)=>{let t=Se(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,Xe(r,s))};return r};var Vn=(e)=>{let t=Se(e),r=(n,o,i,s)=>t(n,o,i,Xe(r,s));return r};var Hn=(e)=>{let t=ke(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,Xe(r,s))};return r};var Wn=(e)=>{let t=ke(e),r=async(n,o,i,s)=>await t(n,o,i,Xe(r,s));return r};var Gn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return qe(e)(t,r,o)};var Xn=(e)=>(t,r,n)=>qe(e)(t,r,n);var qn=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Ye(e)(t,r,o)};var Yn=(e)=>async(t,r,n)=>Ye(e)(t,r,n);var Qn=/^[cC][0-9a-z]{6,}$/,eo=/^[0-9a-z]+$/,to=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ro=/^[0-9a-vA-V]{20}$/,no=/^[A-Za-z0-9]{27}$/,oo=/^[a-zA-Z0-9_-]{21}$/;function io(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var so=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var co=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Wt=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var ao=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Ka="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function uo(){return new RegExp(Ka,"u")}var lo=/^(?:(?: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])$/,po=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var fo=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,mo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ho=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,go=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var yo=/^https?$/,_o=/^\+[1-9]\d{6,14}$/;var xo="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Ja(e){return new RegExp(`^${e}$`)}var bo=Ja(xo);function Ht(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function vo(e){return new RegExp(`^${Ht(e)}$`)}function zo(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Ht({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Ht({precision:e.precision})}`:r;return new RegExp(`^${xo}T(?:${n})$`)}var wo=/^[\s\S]{0,}$/;var Gt=/^-?\d+$/,Pe=/^-?\d+(?:\.\d+)?$/,$o=/^(?:true|false)$/i;var So=/^[^A-Z]*$/,ko=/^[^a-z]*$/;var T=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Xt=(e)=>{let t=e.value;return!zn(t)&&t.length!==void 0},Qe={number:"number",bigint:"bigint",object:"date"},qt=p("$ZodCheckLessThan",(e,t)=>{T.init(e,t);let r=Qe[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Qe[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Yt=p("$ZodCheckGreaterThan",(e,t)=>{T.init(e,t);let r=Qe[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Qe[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Po=p("$ZodCheckMultipleOf",(e,t)=>{T.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):wn(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Co=p("$ZodCheckNumberFormat",(e,t)=>{T.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Ke[t.format];e._zod.check=(s)=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(c<o)s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(c>i)s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Zo=p("$ZodCheckMaxLength",(e,t)=>{var r;T.init(e,t),(r=e._zod.def).when??(r.when=Xt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?He(o):i)<=t.maximum)return;let c=We(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ro=p("$ZodCheckMinLength",(e,t)=>{var r;T.init(e,t),(r=e._zod.def).when??(r.when=Xt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?He(o):i)>=t.minimum)return;let c=We(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ao=p("$ZodCheckLengthEquals",(e,t)=>{var r;T.init(e,t),(r=e._zod.def).when??(r.when=Xt),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?He(o):i;if(s===t.length)return;let c=We(o),a=s>t.length;n.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ze=p("$ZodCheckStringFormat",(e,t)=>{var r,n;if(T.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),Oo=p("$ZodCheckRegex",(e,t)=>{Ze.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Io=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=So),Ze.init(e,t)}),To=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ko),Ze.init(e,t)}),Eo=p("$ZodCheckIncludes",(e,t)=>{T.init(e,t);let r=oe(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Mo=p("$ZodCheckStartsWith",(e,t)=>{T.init(e,t);let r=new RegExp(`^${oe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),No=p("$ZodCheckEndsWith",(e,t)=>{T.init(e,t);let r=new RegExp(`.*${oe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var jo=p("$ZodCheckOverwrite",(e,t)=>{T.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Qt{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
14
14
|
`).filter((i)=>i),n=Math.min(...r.map((i)=>i.length-i.trimStart().length)),o=r.map((i)=>i.slice(n)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
15
15
|
${t.join(`
|
|
16
16
|
`)}
|
|
17
|
-
};`)(...Object.values(this.closed))}}var Do={major:4,minor:6,patch:5};var w=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Do;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,a,u)=>{if(c.memo)return c;let l=J(c),f;for(let m of a){if(m._zod.def.when){if(On(c))continue;if(!m._zod.def.when(c))continue}else if(l)continue;let d=c.issues.length,h=m._zod.check(c);if(h instanceof Promise&&u?.async===!1)throw new Q;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,c.issues.length===d)return;if(Mt(c.issues,d,e),!l)l=J(c,d)});else{if(c.issues.length===d)continue;if(Mt(c.issues,d,e),!l)l=J(c,d)}}if(f)return f.then(()=>c);return c},s=(c,a,u)=>{if(J(c))return c.aborted=!0,c;let l=i(a,o,u);if(l instanceof Promise){if(u.async===!1)throw new Q;return l.then((f)=>e._zod.parse(f,u))}return e._zod.parse(l,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});if(l instanceof Promise)return l.then((f)=>s(f,c,a));return s(l,c,a)}let u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new Q;return u.then((l)=>i(l,o,a))}return i(u,o,a)}}},{get "~standard"(){return We(this,"~standard",er(this))},set "~standard"(e){te(this,"~standard",e)}}),Qo=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>Y(r,t,F()))}:{value:e.value};async function Ja(e,t){let r={async:!0};return Qo(await e._zod.run({value:t,issues:[]},r),r)}function er(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Qo(n,r)}catch(n){}return Ja(e,t)},vendor:"zod",version:1}}var rt=p("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=t.pattern??wo,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),P=p("$ZodStringFormat",(e,t)=>{Ze.init(e,t),rt.init(e,t)}),ei=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=so),P.init(e,t)}),ti=p("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ht(n))}else t.pattern??(t.pattern=Ht());P.init(e,t)}),ri=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=co),P.init(e,t)}),ni=1,et=2;function oi(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Va(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return oi(e)||et;return Ha(e,t)}function Ha(e,t){if(!t.normalize&&t.protocol?.source===go.source&&!/^https?:\/\//i.test(e))return ni;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??et}return new URL(e)}catch{return et}}var Wa=/[\t\n\r]/g;function Lo(e){return e.replace(Wa,"")}function Ga(e,t){return t.lastIndex=0,t.test(e.hostname)}function Xa(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ii=p("$ZodURL",(e,t)=>{P.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=Va(n,t);if(o===ni){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===et){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Lo(n);return}if(t.hostname&&!Ga(o,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!Xa(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:Lo(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),si=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ao()),P.init(e,t)}),ci=p("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?no:oo(t.length)),P.init(e,t)}),ai=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Yn),P.init(e,t)}),ui=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Qn),P.init(e,t)}),li=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=eo),P.init(e,t)}),pi=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=to),P.init(e,t)}),fi=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ro),P.init(e,t)}),di=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=vo(t)),P.init(e,t)}),mi=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=xo),P.init(e,t)}),hi=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=bo(t)),P.init(e,t)}),gi=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=io),P.init(e,t)}),yi=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=uo),P.init(e,t)}),qa=/^[0-9a-fA-F:.]+$/;function _i(e){if(!qa.test(e))return!1;return oi(`http://[${e}]`)}var xi=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=lo),P.init(e,t),e._zod.check=(r)=>{if(!_i(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var bi=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=po),P.init(e,t)});function Ya(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return _i(r)}var vi=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=fo),P.init(e,t),e._zod.check=(r)=>{if(!Ya(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function wi(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var tr=/^[0-9a-zA-Z+/]*={0,2}$/,zi=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=tr),P.init(e,t),e._zod.check=(r)=>{if(wi(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),nt=/^[A-Za-z0-9_-]*$/;function Qa(e){if(!nt.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return wi(r)}var $i=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=nt),P.init(e,t),e._zod.check=(r)=>{if(Qa(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Si=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=yo),P.init(e,t)});function eu(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var ki=p("$ZodJWT",(e,t)=>{P.init(e,t),e._zod.check=(r)=>{if(eu(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var rr=p("$ZodNumber",(e,t)=>{w.init(e,t),e._zod.pattern=Pe,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Pi=p("$ZodNumberFormat",(e,t)=>{Po.init(e,t),rr.init(e,t)}),Ci=p("$ZodBoolean",(e,t)=>{w.init(e,t),e._zod.pattern=zo,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Zi=p("$ZodUnknown",(e,t)=>{w.init(e,t),e._zod.parse=(r)=>r}),Ri=p("$ZodNever",(e,t)=>{w.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Ai=p("$ZodVoid",(e,t)=>{w.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(typeof o>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),Oi=p("$ZodDate",(e,t)=>{w.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(c){}let o=r.value,i=o instanceof Date;if(i&&!Number.isNaN(o.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function Bo(e,t,r){if(e.issues.length)t.issues.push(...q(r,e.issues));t.value[r]=e.value}var Ii=p("$ZodArray",(e,t)=>{w.init(e,t);let r=N.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let a=0;a<i.length;a++){let u=i[a],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then((f)=>Bo(f,n,a)));else if(Bo(l,n,a),c&&l.issues.length!==0&&J(l))break}if(s.length)return Promise.all(s).then(()=>n);return n}});function tt(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!s&&c&&o==="optional")return;if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...q(r,e.issues))}if(!s&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s||o==="defaulted"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var tu=[];function Ti(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:tu,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Zn(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Ei(e,t,r,n,o,i,s){let c=[],a=o.keySet,u=o.catchall._zod,l=u.def.type,{optin:f,optout:m}=u,d=0;for(let h in t){if(s&&r.issues.length!==d){if(J(r,d))break;d=r.issues.length}if(a.has(h))continue;if(h==="__proto__"){if(l==="never")c.push(h);continue}if(l==="never"){c.push(h);continue}let y=u.run({value:t[h],issues:[]},n);if(y instanceof Promise)e.push(y.then((_)=>tt(_,r,h,t,f,m)));else tt(y,r,h,t,f,m)}if(c.length)r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var ru=p("$ZodObject",(e,t)=>{w.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=we(()=>Ti(t));v(e,"propValues",(u)=>{let l=u.def.shape,f={};for(let m in l){let d=l[m]._zod;if(d.values){if(!Object.prototype.hasOwnProperty.call(f,m))L(f,m,new Set);for(let h of d.values)f[m].add(h);if(d.optin!==void 0)f[m].add(void 0)}}return f});let i=pe,s=t.catchall,c,a=N.memoizer;a?.attach(e),e._zod.parse=(u,l)=>{c??(c=o.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=a?a.alloc(e,u,{},l):{};let m=[],d=c.shape,h=l?.abortEarly,y=u.issues.length;for(let _ of c.allKeys){if(h&&u.issues.length!==y){if(J(u,y))break;y=u.issues.length}if(_==="__proto__")continue;let b=d[_],I=b._zod.optin,C=b._zod.optout,H=b._zod.run({value:f[_],issues:[]},l);if(H instanceof Promise)m.push(H.then((R)=>tt(R,u,_,f,I,C)));else tt(H,u,_,f,I,C)}if(!s)return m.length?Promise.all(m).then(()=>u):u;return Ei(m,f,u,l,o.value,e,h===!0)}}),Mi=p("$ZodObjectJIT",(e,t)=>{ru.init(e,t);let r=e._zod.parse,n=we(()=>Ti(t)),o=N.memoizer,i=(d)=>{let h=n.value,y=h.symbolKeys,_=new Yt(["payload","ctx"],{shape:d,inst:e,memo:o,syms:y}),b=(R)=>`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`,I=(R,z)=>`
|
|
17
|
+
};`)(...Object.values(this.closed))}}var Lo={major:4,minor:6,patch:7};var z=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Lo;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,a,u)=>{if(c.memo)return c;let l=J(c),f;for(let m of a){if(m._zod.def.when){if(In(c))continue;if(!m._zod.def.when(c))continue}else if(l)continue;let d=c.issues.length,h=m._zod.check(c);if(h instanceof Promise&&u?.async===!1)throw new Q;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,c.issues.length===d)return;if(Ve(c.issues,d,e),!l)l=J(c,d)});else{if(c.issues.length===d)continue;if(Ve(c.issues,d,e),!l)l=J(c,d)}}if(f)return f.then(()=>c);return c},s=(c,a,u)=>{if(J(c))return c.aborted=!0,c;let l=i(a,o,u);if(l instanceof Promise){if(u.async===!1)throw new Q;return l.then((f)=>e._zod.parse(f,u))}return e._zod.parse(l,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});if(l instanceof Promise)return l.then((f)=>s(f,c,a));return s(l,c,a)}let u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new Q;return u.then((l)=>i(l,o,a))}return i(u,o,a)}}},{get "~standard"(){return Ge(this,"~standard",tr(this))},set "~standard"(e){te(this,"~standard",e)}}),ei=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>Y(r,t,F()))}:{value:e.value};async function Va(e,t){let r={async:!0};return ei(await e._zod.run({value:t,issues:[]},r),r)}function tr(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return ei(n,r)}catch(n){}return Va(e,t)},vendor:"zod",version:1}}var nt=p("$ZodString",(e,t)=>{z.init(e,t),e._zod.pattern=t.pattern??wo,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),P=p("$ZodStringFormat",(e,t)=>{Ze.init(e,t),nt.init(e,t)}),ti=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=co),P.init(e,t)}),ri=p("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Wt(n))}else t.pattern??(t.pattern=Wt());P.init(e,t)}),ni=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ao),P.init(e,t)}),oi=1,tt=2;function ii(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Ha(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return ii(e)||tt;return Wa(e,t)}function Wa(e,t){if(!t.normalize&&t.protocol?.source===yo.source&&!/^https?:\/\//i.test(e))return oi;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??tt}return new URL(e)}catch{return tt}}var Ga=/[\t\n\r]/g;function Bo(e){return e.replace(Ga,"")}function Xa(e,t){return t.lastIndex=0,t.test(e.hostname)}function qa(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var si=p("$ZodURL",(e,t)=>{P.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=Ha(n,t);if(o===oi){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===tt){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Bo(n);return}if(t.hostname&&!Xa(o,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!qa(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:Bo(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ci=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=uo()),P.init(e,t)}),ai=p("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?oo:io(t.length)),P.init(e,t)}),ui=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Qn),P.init(e,t)}),li=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=eo),P.init(e,t)}),pi=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=to),P.init(e,t)}),fi=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ro),P.init(e,t)}),di=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=no),P.init(e,t)}),mi=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=zo(t)),P.init(e,t)}),hi=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=bo),P.init(e,t)}),gi=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=vo(t)),P.init(e,t)}),yi=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=so),P.init(e,t)}),_i=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=lo),P.init(e,t)}),Ya=/^[0-9a-fA-F:.]+$/;function xi(e){if(!Ya.test(e))return!1;return ii(`http://[${e}]`)}var bi=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=po),P.init(e,t),e._zod.check=(r)=>{if(!xi(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var vi=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=fo),P.init(e,t)});function Qa(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return xi(r)}var zi=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=mo),P.init(e,t),e._zod.check=(r)=>{if(!Qa(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function wi(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var rr=/^[0-9a-zA-Z+/]*={0,2}$/,$i=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=rr),P.init(e,t),e._zod.check=(r)=>{if(wi(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),ot=/^[A-Za-z0-9_-]*$/;function eu(e){if(!ot.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return wi(r)}var Si=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ot),P.init(e,t),e._zod.check=(r)=>{if(eu(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ki=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=_o),P.init(e,t)});function tu(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var Pi=p("$ZodJWT",(e,t)=>{P.init(e,t),e._zod.check=(r)=>{if(tu(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var nr=p("$ZodNumber",(e,t)=>{z.init(e,t),e._zod.pattern=Pe,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Ci=p("$ZodNumberFormat",(e,t)=>{Co.init(e,t),nr.init(e,t)}),Zi=p("$ZodBoolean",(e,t)=>{z.init(e,t),e._zod.pattern=$o,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Ri=p("$ZodUnknown",(e,t)=>{z.init(e,t),e._zod.parse=(r)=>r}),Ai=p("$ZodNever",(e,t)=>{z.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Oi=p("$ZodVoid",(e,t)=>{z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(typeof o>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),Ii=p("$ZodDate",(e,t)=>{z.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(c){}let o=r.value,i=o instanceof Date;if(i&&!Number.isNaN(o.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function ru(e,t){let r=Nt(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((i)=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let c=t(i.value);if(c>n&&!s?.skipChecks&&s?.direction!=="backward"){for(let[a,u]of Nt(e._zod.def.checks))if(c>a&&u._zod.def.when(i)){let l=i.issues.length;return u._zod.check(i),i.issues[l].continue=!1,Ve(i.issues,l,e),i}}return o(i,s)}}var nu=(e)=>Array.isArray(e)?e.length:-1;function Fo(e,t,r){if(e.issues.length)t.issues.push(...q(r,e.issues));t.value[r]=e.value}var Ti=p("$ZodArray",(e,t)=>{z.init(e,t);let r=N.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let a=0;a<i.length;a++){let u=i[a],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then((f)=>Fo(f,n,a)));else if(Fo(l,n,a),c&&l.issues.length!==0&&J(l))break}if(s.length)return Promise.all(s).then(()=>n);return n},ru(e,nu)});function rt(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!s&&c&&o==="optional")return;if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...q(r,e.issues))}if(!s&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s||o==="defaulted"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var ou=[];function Ei(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:ou,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Rn(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Mi(e,t,r,n,o,i,s){let c=[],a=o.keySet,u=o.catchall._zod,l=u.def.type,{optin:f,optout:m}=u,d=0;for(let h in t){if(s&&r.issues.length!==d){if(J(r,d))break;d=r.issues.length}if(a.has(h))continue;if(h==="__proto__"){if(l==="never")c.push(h);continue}if(l==="never"){c.push(h);continue}let y=u.run({value:t[h],issues:[]},n);if(y instanceof Promise)e.push(y.then((_)=>rt(_,r,h,t,f,m)));else rt(y,r,h,t,f,m)}if(c.length)r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var iu=p("$ZodObject",(e,t)=>{z.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=ze(()=>Ei(t));v(e,"propValues",(u)=>{let l=u.def.shape,f={};for(let m in l){let d=l[m]._zod;if(d.values){if(!Object.prototype.hasOwnProperty.call(f,m))L(f,m,new Set);for(let h of d.values)f[m].add(h);if(d.optin!==void 0)f[m].add(void 0)}}return f});let i=pe,s=t.catchall,c,a=N.memoizer;a?.attach(e),e._zod.parse=(u,l)=>{c??(c=o.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=a?a.alloc(e,u,{},l):{};let m=[],d=c.shape,h=l?.abortEarly,y=u.issues.length;for(let _ of c.allKeys){if(h&&u.issues.length!==y){if(J(u,y))break;y=u.issues.length}if(_==="__proto__")continue;let b=d[_],I=b._zod.optin,C=b._zod.optout,H=b._zod.run({value:f[_],issues:[]},l);if(H instanceof Promise)m.push(H.then((R)=>rt(R,u,_,f,I,C)));else rt(H,u,_,f,I,C)}if(!s)return m.length?Promise.all(m).then(()=>u):u;return Mi(m,f,u,l,o.value,e,h===!0)}}),Ni=p("$ZodObjectJIT",(e,t)=>{iu.init(e,t);let r=e._zod.parse,n=ze(()=>Ei(t)),o=N.memoizer,i=(d)=>{let h=n.value,y=h.symbolKeys,_=new Qt(["payload","ctx"],{shape:d,inst:e,memo:o,syms:y}),b=(R)=>`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`,I=(R,w)=>`
|
|
18
18
|
let ${R}_ab = false;
|
|
19
19
|
for (let i = 0; i < ${R}.issues.length; i++) {
|
|
20
20
|
const iss = ${R}.issues[i];
|
|
21
|
-
iss.path = iss.path ? [${
|
|
21
|
+
iss.path = iss.path ? [${w}, ...iss.path] : [${w}];
|
|
22
22
|
payload.issues.push(iss);
|
|
23
23
|
if (iss.continue !== true) ${R}_ab = true;
|
|
24
24
|
}
|
|
25
25
|
if (${R}_ab && ctx && ctx.abortEarly) {
|
|
26
26
|
payload.value = newResult;
|
|
27
27
|
return payload;
|
|
28
|
-
}`;_.write("const input = payload.value;");let C=Object.create(null),H=0;for(let R of h.allKeys)C[R]=`key_${H++}`;_.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let R of h.allKeys){if(R==="__proto__")continue;let
|
|
29
|
-
const ${
|
|
30
|
-
if (!${
|
|
31
|
-
if (${
|
|
28
|
+
}`;_.write("const input = payload.value;");let C=Object.create(null),H=0;for(let R of h.allKeys)C[R]=`key_${H++}`;_.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let R of h.allKeys){if(R==="__proto__")continue;let w=C[R],W=typeof R==="symbol"?`syms[${y.indexOf(R)}]`:kn(R),_t=`${W} in input`,nn=d[R],xt=nn?._zod?.optin,on=xt!==void 0,Xc=nn?._zod?.optout==="optional";if(_.write(`const ${w} = ${b(W)};`),on&&Xc){let qc=xt==="optional"?`${w}_present`:`${w}.value !== undefined || ${w}_present`;_.write(`
|
|
29
|
+
const ${w}_present = ${_t};
|
|
30
|
+
if (!${w}.issues.length || ${w}_present) {
|
|
31
|
+
if (${w}.issues.length) {${I(w,W)}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
if (${
|
|
35
|
-
newResult[${W}] = ${
|
|
34
|
+
if (${qc}) {
|
|
35
|
+
newResult[${W}] = ${w}.value;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
`)}else if(!
|
|
40
|
-
const ${
|
|
41
|
-
if (${
|
|
39
|
+
`)}else if(!on)_.write(`
|
|
40
|
+
const ${w}_present = ${_t};
|
|
41
|
+
if (${w}.issues.length) {${I(w,W)}
|
|
42
42
|
}
|
|
43
|
-
if (!${
|
|
43
|
+
if (!${w}_present && !${w}.issues.length) {
|
|
44
44
|
payload.issues.push({
|
|
45
45
|
code: "invalid_type",
|
|
46
46
|
expected: "nonoptional",
|
|
@@ -53,17 +53,17 @@ ${t.join(`
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
if (${
|
|
57
|
-
newResult[${W}] = ${
|
|
56
|
+
if (${w}_present) {
|
|
57
|
+
newResult[${W}] = ${w}.value;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
`);else if(_.write(`
|
|
61
|
-
if (${
|
|
61
|
+
if (${w}.issues.length) {${I(w,W)}
|
|
62
62
|
}
|
|
63
|
-
`),
|
|
64
|
-
if (${
|
|
65
|
-
newResult[${W}] = ${
|
|
63
|
+
`),xt==="defaulted")_.write(`newResult[${W}] = ${w}.value;`);else _.write(`
|
|
64
|
+
if (${w}.value !== undefined || ${_t}) {
|
|
65
|
+
newResult[${W}] = ${w}.value;
|
|
66
66
|
}
|
|
67
|
-
`)}return _.write("payload.value = newResult;"),_.write("return payload;"),_.compile()},s,c=pe,a=!N.jitless,l=a&&Pn.value,f=t.catchall,m;e._zod.parse=(d,h)=>{m??(m=n.value);let y=d.value;if(!c(y))return d.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),d;if(a&&l&&h?.async===!1&&h.jitless!==!0){if(!s)s=i(t.shape);if(d=s(d,h),!f)return d;return Ei([],y,d,h,m,e,h?.abortEarly===!0)}return r(d,h)}});function Fo(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!J(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>Y(s,n,F())))}),t}var nr=p("$ZodUnion",(e,t)=>{w.init(e,t),v(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),v(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),v(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),v(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>Ue(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}if(!i)return Fo(s,n,e,o);return Promise.all(s).then((c)=>Fo(c,n,e,o))}});function nu(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var Ni=p("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,nr.init(e,t);let r=e._zod.parse;v(e,"propValues",(o)=>{let i={},s=0;for(let c of o.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(c)}"`);if(a[o.def.discriminator]?.has(void 0))s++;for(let[u,l]of Object.entries(a)){if(!Object.prototype.hasOwnProperty.call(i,u))L(i,u,new Set);for(let f of l)i[u].add(f)}}if(!o.def.unionFallback&&s>1)i[o.def.discriminator]?.delete(void 0);return i}),t.options.forEach((o,i)=>{let s=ze(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let n=we(()=>nu(t));e._zod.parse=(o,i)=>{let s=o.value;if(!pe(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let c=s?.[t.discriminator],a=n.value.get(c);if(a&&(c!==void 0||i.direction!=="backward"))return a._zod.run(o,i);if(t.unionFallback||i.direction==="backward")return r(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((u)=>n.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o}}),ji=p("$ZodIntersection",(e,t)=>{w.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([a,u])=>Uo(r,a,u));return Uo(r,i,s)}});function Qt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ce(e)&&ce(t)){let r=Object.keys(t),n=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=Qt(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=Qt(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Uo(e,t,r){let n=new Map,o,i=new Map,s=(u,l)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let m=String(u.path[0]);if(!i.has(m))i.set(m,u);f=[m]}else return!1;for(let m of f){if(!n.has(m))n.set(m,{});n.get(m)[l]=!0}return!0};for(let u of t.issues)if(!s(u,"l"))e.issues.push(u);for(let u of r.issues)if(!s(u,"r"))e.issues.push(u);let c=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=o?c.filter((l)=>o.keys.includes(l)):[];if(u.length)e.issues.push({...o,keys:u});for(let l of c)if(!u.includes(l)&&i.has(l))e.issues.push(i.get(l))}let a=Qt(t.value,r.value);if(!a.valid){if(J(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var or=p("$ZodTuple",(e,t)=>{w.init(e,t);let r=t.items,n=N.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let c=[],a=Ko(r,"optin"),u=Ko(r,"optout");if(!t.rest){if(s.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:s,inst:e,origin:"array"}),o;if(s.length>r.length)o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=Array(r.length),f=t.rest?i?.abortEarly:void 0,m=!1;for(let d=0;d<r.length;d++){let h=r[d]._zod.run({value:s[d],issues:[]},i);if(h instanceof Promise)c.push(h.then((y)=>{l[d]=y}));else if(l[d]=h,f&&!m&&h.issues.length)m=J(h)}if(t.rest&&!m){let d=r.length-1,h=s.slice(r.length),y=o.issues.length;for(let _ of h){if(f&&o.issues.length!==y){if(J(o,y))break;y=o.issues.length}d++;let b=t.rest._zod.run({value:_,issues:[]},i);if(b instanceof Promise)c.push(b.then((I)=>Jo(I,o,d)));else Jo(b,o,d)}}if(c.length)return Promise.all(c).then(()=>Vo(l,o,r,s,u));return Vo(l,o,r,s,u)}});function Ko(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function Jo(e,t,r){if(e.issues.length)t.issues.push(...q(r,e.issues));t.value[r]=e.value}function Vo(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...q(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=n.length;i--)if(r[i]._zod.optout==="optional"&&t.value[i]===void 0)t.value.length=i;else break;return t}var Di=p("$ZodRecord",(e,t)=>{w.init(e,t);let r=N.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!ce(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let a=new Set;for(let l of c)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(a.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map((h)=>Y(h,o,F())),input:l,path:[l],inst:e});continue}let m=f.value;if(m==="__proto__")continue;let d=t.valueType._zod.run({value:i[l],issues:[]},o);if(d instanceof Promise)s.push(d.then((h)=>{if(h.issues.length)n.issues.push(...q(l,h.issues));n.value[m]=h.value}));else{if(d.issues.length)n.issues.push(...q(l,d.issues));n.value[m]=d.value}}let u;for(let l in i)if(!a.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else u=u??[],u.push(l);if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let a;for(let u of Reflect.ownKeys(i)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&Pe.test(u)&&l.issues.length){let h=t.keyType._zod.run({value:Number(u),issues:[]},o);if(h instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(h.issues.length===0)l=h}if(l.issues.length){if(t.mode==="loose")n.value[u]=i[u];else if(c)a=a??[],a.push(u);else n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((h)=>Y(h,o,F())),input:u,path:[u],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let d=t.valueType._zod.run({value:i[u],issues:[]},o);if(d instanceof Promise)s.push(d.then((h)=>{if(h.issues.length)n.issues.push(...q(u,h.issues));n.value[m]=h.value}));else{if(d.issues.length)n.issues.push(...q(u,d.issues));n.value[m]=d.value}}if(a&&a.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}if(s.length)return Promise.all(s).then(()=>n);return n}});var Li=p("$ZodEnum",(e,t)=>{w.init(e,t);let r=be(t.entries),n=new Set(r);e._zod.values=n,v(e,"pattern",(o)=>{let i=be(o.def.entries).filter((s)=>Cn.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>oe(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(n.has(s))return o;return o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),Bi=p("$ZodLiteral",(e,t)=>{w.init(e,t);let r=new Set(t.values);e._zod.values=r,v(e,"pattern",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?oe(i):i?oe(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;if(r.has(i))return n;return n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});var Fi=p("$ZodTransform",(e,t)=>{w.init(e,t),e._zod.optin="optional",N.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new $e(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(r.value=s,r));if(o instanceof Promise)throw new Q;return r.value=o,r}});function Ho(e,t){return e.value=t.issues.length?void 0:t.value,e}var ir=p("$ZodOptional",(e,t)=>{w.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",v(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),v(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ue(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>Ho(r,i));return Ho(r,o)}return t.innerType._zod.run(r,n)}}),Ui=p("$ZodExactOptional",(e,t)=>{ir.init(e,t),v(e,"values",(r)=>r.def.innerType._zod.values),v(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Ki=p("$ZodNullable",(e,t)=>{w.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin),v(e,"optout",(r)=>r.def.innerType._zod.optout),v(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ue(n.source)}|null)$`):void 0}),v(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),Ji=p("$ZodDefault",(e,t)=>{w.init(e,t),e._zod.optin="defaulted",v(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Wo(i,t));return Wo(o,t)}});function Wo(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Vi=p("$ZodPrefault",(e,t)=>{w.init(e,t),e._zod.optin="defaulted",v(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),Hi=p("$ZodNonOptional",(e,t)=>{w.init(e,t),v(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Go(i,e));return Go(o,e)}});function Go(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Xo(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>Y(o,n,F()))},input:e.value}),e}var Wi=p("$ZodCatch",(e,t)=>{w.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),v(e,"optout",(r)=>r.def.innerType._zod.optout),v(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>Xo(r,i,t,n));return Xo(r,o,t,n)}});var sr=p("$ZodPipe",(e,t)=>{w.init(e,t),v(e,"values",(r)=>r.def.in._zod.values),v(e,"optin",(r)=>r.def.in._zod.optin),v(e,"optout",(r)=>r.def.out._zod.optout),v(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);if(i instanceof Promise)return i.then((s)=>Qe(s,t.in,n));return Qe(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Qe(i,t.out,n));return Qe(o,t.out,n)}});function Qe(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Gi=p("$ZodPreprocess",(e,t)=>{sr.init(e,t)}),Xi=p("$ZodReadonly",(e,t)=>{w.init(e,t),v(e,"propValues",(r)=>r.def.innerType._zod.propValues),v(e,"values",(r)=>r.def.innerType._zod.values),v(e,"optin",(r)=>r.def.innerType?._zod?.optin),v(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(qo);return qo(o)}});function qo(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var qi=p("$ZodFunction",(e,t)=>(w.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=(r)=>{if(typeof r!=="function")throw Error("implement() must be called with a function");return Object.defineProperty(function(...n){let o=e._def.input?Ft(e._def.input,n):n,i=Reflect.apply(r,this,o);if(e._def.output)return Ft(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=(r)=>{if(typeof r!=="function")throw Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...n){let o=e._def.input?await Ut(e._def.input,n):n,i=await Reflect.apply(r,this,o);if(e._def.output)return await Ut(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,n)=>{if(typeof r.value!=="function")return r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r;if(e._def.output&&e._def.output._zod.def.type==="promise")r.value=e.implementAsync(r.value);else r.value=e.implement(r.value);return r},e.input=(...r)=>{let n=e.constructor;if(Array.isArray(r[0]))return new n({type:"function",input:new or({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output});return new n({type:"function",input:r[0],output:e._def.output})},e.output=(r)=>new e.constructor({type:"function",input:e._def.input,output:r}),e)),Yi=p("$ZodPromise",(e,t)=>{w.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then((o)=>t.innerType._zod.run({value:o,issues:[]},n))});var Qi=p("$ZodCustom",(e,t)=>{T.init(e,t),w.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((i)=>Yo(i,r,n,e));Yo(o,r,n,e);return}});function Yo(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(ae(o))}}class ts extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var ar="~memo",es=[];function rs(e){return e!==null&&typeof e==="object"}function cr(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var ns=new WeakMap,Re=0,st=1,Ae=2;function ct(e,t,r){let n=ns.get(e);if(n!==void 0)return n?Ae:Re;if(t.has(e))return Ae;t.add(e);let o=Re,i=(l)=>{if(o!==Ae&&l?._zod){let f=ct(l,t,r);if(f>o)o=f}},s=(l,f)=>{let m=Re;for(let d of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,d);if(f&&!h.enumerable)continue;let y=h.get?st:h.value?._zod?ct(h.value,t,r):Re;if(y>m)m=y}return m},c=(l)=>{if(l>o)o=l},a=e._zod.def,u=a.type;switch(u){case"object":{let l=ze(a);c(l?s(l,!0):st),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let l of a.items)i(l);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let l of a.options)i(l);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let l=a._cachedInner??(r?e._zod.innerType:void 0);c(l?ct(l,t,!1):st);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in a){let f=Object.getOwnPropertyDescriptor(a,l);if(!f||f.get)continue;let m=f.value;if(!m||typeof m!=="object")continue;if(m._zod)i(m);else if(Array.isArray(m))for(let d of m)i(d)}}return t.delete(e),ou(e,o)}function ou(e,t){if(t!==st)ns.set(e,t===Ae);return t}function iu(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var ot,it=[],su={alloc(e,t,r){let n=ot;if(!n)return r;ot=void 0;let o={value:r,issues:null};return n.set(t.value,o),it.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&cu(i,o.value))throw new ts;return r(o,i)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(a,u)=>{if(r===void 0){let b=ct(e,new Set,!1);if(b===Re){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(a,u)}if(b===Ae||n)r=!0;else n=!0}let l=a.value;if(!rs(l))return s(a,u);let f=u[ar];if(!f)f={buckets:new WeakMap,backEdges:void 0},u[ar]=f;let m;if(o===u)m=i;else m=iu(f,e),o=u,i=m;let d=m.get(l);if(d){if(a.value=d.value,d.issues){if(d.issues.length)a.issues.push(...cr(d.issues))}else a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(d.value);return a}ot=m;let h=it.length,y=s(a,u);ot=void 0;let _=it.length>h?it.pop():void 0;if(y instanceof Promise)return y.then((b)=>{if(_)_.issues=b.issues.length?cr(b.issues):es;return b});if(_)_.issues=y.issues.length?cr(y.issues):es;return y};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function os(){return su}function cu(e,t){let r=e[ar]?.backEdges;return r!==void 0&&rs(t)&&r.has(t)}var au=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return n[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=In(i.input),a=o(c,i.input);return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${Tt(i.values[0])}`;return`Invalid option: expected one of ${At(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);if(c)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);if(c)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${At(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((c)=>`'${c}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function ur(){return{localeError:au()}}var is;class ss{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function uu(){return new ss}(is=globalThis).__zod_globalRegistry??(is.__zod_globalRegistry=uu());var ue=globalThis.__zod_globalRegistry;function cs(e){if(e.checks)e.checks=[...e.checks];return e}function as(e,t){return new e(cs({type:"string",...g(t)}))}function us(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function ls(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function ps(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function fs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function ds(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function ms(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function hs(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function gs(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function ys(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function _s(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function xs(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function bs(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function vs(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function ws(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function zs(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function $s(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function Ss(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function ks(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function Ps(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function Cs(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function Zs(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function Rs(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function As(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function Os(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function Is(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function Ts(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function Es(e,t){return new e(cs({type:"number",checks:[],...g(t)}))}function Ms(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...g(t)})}function Ns(e,t){return new e({type:"boolean",...g(t)})}function js(e){return new e({type:"unknown"})}function Ds(e,t){return new e({type:"never",...g(t)})}function Ls(e,t){return new e({type:"void",...g(t)})}function Bs(e,t){return new e({type:"date",...g(t)})}function at(e,t){return new Xt({check:"less_than",...g(t),value:e,inclusive:!1})}function fe(e,t){return new Xt({check:"less_than",...g(t),value:e,inclusive:!0})}function ut(e,t){return new qt({check:"greater_than",...g(t),value:e,inclusive:!1})}function de(e,t){return new qt({check:"greater_than",...g(t),value:e,inclusive:!0})}function lt(e,t){return new ko({check:"multiple_of",...g(t),value:e})}function pt(e,t){return new Co({check:"max_length",...g(t),maximum:e})}function me(e,t){return new Zo({check:"min_length",...g(t),minimum:e})}function ft(e,t){return new Ro({check:"length_equals",...g(t),length:e})}function lr(e,t){return new Ao({check:"string_format",format:"regex",...g(t),pattern:e})}function pr(e){return new Oo({check:"string_format",format:"lowercase",...g(e)})}function fr(e){return new Io({check:"string_format",format:"uppercase",...g(e)})}function dr(e,t){return new To({check:"string_format",format:"includes",...g(t),includes:e})}function mr(e,t){return new Eo({check:"string_format",format:"starts_with",...g(t),prefix:e})}function hr(e,t){return new Mo({check:"string_format",format:"ends_with",...g(t),suffix:e})}function ie(e){return new No({check:"overwrite",tx:e})}function gr(e){return ie((t)=>t.normalize(e))}function yr(){return ie((e)=>e.trim())}function _r(){return ie((e)=>e.toLowerCase())}function xr(){return ie((e)=>e.toUpperCase())}function br(){return ie((e)=>kn(e))}function Fs(e,t,r){return new e({type:"array",element:t,...g(r)})}function Us(e,t,r){let n=g(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Ks(e,t,r){return new e({type:"custom",check:"custom",fn:t,...g(r)})}function Js(e,t){let r=lu((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(ae(o,n.value,r._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=n.value;i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(ae(i))}},e(n.value,n)),t);return r}function lu(e,t){let r=new T({check:"custom",...g(t)});return r._zod.check=e,r}function Oe(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))L(e,n,r[n]);return e}function Te(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??ue,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function O(e,t,r,n,o){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(r,i),!0}function k(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let m=s.schema,d=t.processors[o.type];if(!d)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,m,l)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;k(f,t,l),t.seen.get(f).isParent=!0}}let a=t.metadataRegistry.get(e);if(a)Oe(s.schema,a);if(t.io==="input"&&j(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Vs(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ee(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let a=n.get(c);if(a&&a!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,m=e.external.uri??((h)=>h);if(f)return{ref:m(f)};let d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${m("__shared")}#/${c}/${Vs(d)}`}}let a="#",u=`${a}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:a};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+Vs(l)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:a,defId:u}=o(s);if(c.def={...c.schema},u)c.defId=u;let l=c.schema;for(let f in l)delete l[f];l.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
67
|
+
`)}return _.write("payload.value = newResult;"),_.write("return payload;"),_.compile()},s,c=pe,a=!N.jitless,l=a&&Cn.value,f=t.catchall,m;e._zod.parse=(d,h)=>{m??(m=n.value);let y=d.value;if(!c(y))return d.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),d;if(a&&l&&h?.async===!1&&h.jitless!==!0){if(!s)s=i(t.shape);if(d=s(d,h),!f)return d;return Mi([],y,d,h,m,e,h?.abortEarly===!0)}return r(d,h)}});function Uo(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!J(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>Y(s,n,F())))}),t}var or=p("$ZodUnion",(e,t)=>{z.init(e,t),v(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),v(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),v(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),v(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>Ue(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}if(!i)return Uo(s,n,e,o);return Promise.all(s).then((c)=>Uo(c,n,e,o))}});function su(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var ji=p("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,or.init(e,t);let r=e._zod.parse;v(e,"propValues",(o)=>{let i={},s=0;for(let c of o.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(c)}"`);if(a[o.def.discriminator]?.has(void 0))s++;for(let[u,l]of Object.entries(a)){if(!Object.prototype.hasOwnProperty.call(i,u))L(i,u,new Set);for(let f of l)i[u].add(f)}}if(!o.def.unionFallback&&s>1)i[o.def.discriminator]?.delete(void 0);return i}),t.options.forEach((o,i)=>{let s=we(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let n=ze(()=>su(t));e._zod.parse=(o,i)=>{let s=o.value;if(!pe(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let c=s?.[t.discriminator],a=n.value.get(c);if(a&&(c!==void 0||i.direction!=="backward"))return a._zod.run(o,i);if(t.unionFallback||i.direction==="backward")return r(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((u)=>n.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o}}),Di=p("$ZodIntersection",(e,t)=>{z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([a,u])=>Ko(r,a,u));return Ko(r,i,s)}});function er(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ce(e)&&ce(t)){let r=Object.keys(t),n=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=er(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=er(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Ko(e,t,r){let n=new Map,o,i=new Map,s=(u,l)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let m=String(u.path[0]);if(!i.has(m))i.set(m,u);f=[m]}else return!1;for(let m of f){if(!n.has(m))n.set(m,{});n.get(m)[l]=!0}return!0};for(let u of t.issues)if(!s(u,"l"))e.issues.push(u);for(let u of r.issues)if(!s(u,"r"))e.issues.push(u);let c=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=o?c.filter((l)=>o.keys.includes(l)):[];if(u.length)e.issues.push({...o,keys:u});for(let l of c)if(!u.includes(l)&&i.has(l))e.issues.push(i.get(l))}let a=er(t.value,r.value);if(!a.valid){if(J(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var ir=p("$ZodTuple",(e,t)=>{z.init(e,t);let r=t.items,n=N.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let c=[],a=Jo(r,"optin"),u=Jo(r,"optout");if(!t.rest){if(s.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:s,inst:e,origin:"array"}),o;if(s.length>r.length)o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=Array(r.length),f=t.rest?i?.abortEarly:void 0,m=!1;for(let d=0;d<r.length;d++){let h=r[d]._zod.run({value:s[d],issues:[]},i);if(h instanceof Promise)c.push(h.then((y)=>{l[d]=y}));else if(l[d]=h,f&&!m&&h.issues.length)m=J(h)}if(t.rest&&!m){let d=r.length-1,h=s.slice(r.length),y=o.issues.length;for(let _ of h){if(f&&o.issues.length!==y){if(J(o,y))break;y=o.issues.length}d++;let b=t.rest._zod.run({value:_,issues:[]},i);if(b instanceof Promise)c.push(b.then((I)=>Vo(I,o,d)));else Vo(b,o,d)}}if(c.length)return Promise.all(c).then(()=>Ho(l,o,r,s,u));return Ho(l,o,r,s,u)}});function Jo(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function Vo(e,t,r){if(e.issues.length)t.issues.push(...q(r,e.issues));t.value[r]=e.value}function Ho(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...q(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=n.length;i--)if(r[i]._zod.optout==="optional"&&t.value[i]===void 0)t.value.length=i;else break;return t}var Li=p("$ZodRecord",(e,t)=>{z.init(e,t);let r=N.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!ce(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let a=new Set;for(let l of c)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(a.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map((h)=>Y(h,o,F())),input:l,path:[l],inst:e});continue}let m=f.value;if(m==="__proto__")continue;let d=t.valueType._zod.run({value:i[l],issues:[]},o);if(d instanceof Promise)s.push(d.then((h)=>{if(h.issues.length)n.issues.push(...q(l,h.issues));n.value[m]=h.value}));else{if(d.issues.length)n.issues.push(...q(l,d.issues));n.value[m]=d.value}}let u;for(let l in i)if(!a.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else u=u??[],u.push(l);if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let a;for(let u of Reflect.ownKeys(i)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&Pe.test(u)&&l.issues.length){let h=t.keyType._zod.run({value:Number(u),issues:[]},o);if(h instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(h.issues.length===0)l=h}if(l.issues.length){if(t.mode==="loose")n.value[u]=i[u];else if(c)a=a??[],a.push(u);else n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((h)=>Y(h,o,F())),input:u,path:[u],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let d=t.valueType._zod.run({value:i[u],issues:[]},o);if(d instanceof Promise)s.push(d.then((h)=>{if(h.issues.length)n.issues.push(...q(u,h.issues));n.value[m]=h.value}));else{if(d.issues.length)n.issues.push(...q(u,d.issues));n.value[m]=d.value}}if(a&&a.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}if(s.length)return Promise.all(s).then(()=>n);return n}});var Bi=p("$ZodEnum",(e,t)=>{z.init(e,t);let r=be(t.entries),n=new Set(r);e._zod.values=n,v(e,"pattern",(o)=>{let i=be(o.def.entries).filter((s)=>Zn.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>oe(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(n.has(s))return o;return o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),Fi=p("$ZodLiteral",(e,t)=>{z.init(e,t);let r=new Set(t.values);e._zod.values=r,v(e,"pattern",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?oe(i):i?oe(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;if(r.has(i))return n;return n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});var Ui=p("$ZodTransform",(e,t)=>{z.init(e,t),e._zod.optin="optional",N.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new $e(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(r.value=s,r));if(o instanceof Promise)throw new Q;return r.value=o,r}});function Wo(e,t){return e.value=t.issues.length?void 0:t.value,e}var sr=p("$ZodOptional",(e,t)=>{z.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",v(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),v(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ue(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>Wo(r,i));return Wo(r,o)}return t.innerType._zod.run(r,n)}}),Ki=p("$ZodExactOptional",(e,t)=>{sr.init(e,t),v(e,"values",(r)=>r.def.innerType._zod.values),v(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Ji=p("$ZodNullable",(e,t)=>{z.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin),v(e,"optout",(r)=>r.def.innerType._zod.optout),v(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ue(n.source)}|null)$`):void 0}),v(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),Vi=p("$ZodDefault",(e,t)=>{z.init(e,t),e._zod.optin="defaulted",v(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Go(i,t));return Go(o,t)}});function Go(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Hi=p("$ZodPrefault",(e,t)=>{z.init(e,t),e._zod.optin="defaulted",v(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),Wi=p("$ZodNonOptional",(e,t)=>{z.init(e,t),v(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Xo(i,e));return Xo(o,e)}});function Xo(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function qo(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>Y(o,n,F()))},input:e.value}),e}var Gi=p("$ZodCatch",(e,t)=>{z.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),v(e,"optout",(r)=>r.def.innerType._zod.optout),v(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>qo(r,i,t,n));return qo(r,o,t,n)}});var cr=p("$ZodPipe",(e,t)=>{z.init(e,t),v(e,"values",(r)=>r.def.in._zod.values),v(e,"optin",(r)=>r.def.in._zod.optin),v(e,"optout",(r)=>r.def.out._zod.optout),v(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);if(i instanceof Promise)return i.then((s)=>et(s,t.in,n));return et(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>et(i,t.out,n));return et(o,t.out,n)}});function et(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Xi=p("$ZodPreprocess",(e,t)=>{cr.init(e,t)}),qi=p("$ZodReadonly",(e,t)=>{z.init(e,t),v(e,"propValues",(r)=>r.def.innerType._zod.propValues),v(e,"values",(r)=>r.def.innerType._zod.values),v(e,"optin",(r)=>r.def.innerType?._zod?.optin),v(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(Yo);return Yo(o)}});function Yo(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Yi=p("$ZodFunction",(e,t)=>(z.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=(r)=>{if(typeof r!=="function")throw Error("implement() must be called with a function");return Object.defineProperty(function(...n){let o=e._def.input?Ut(e._def.input,n):n,i=Reflect.apply(r,this,o);if(e._def.output)return Ut(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=(r)=>{if(typeof r!=="function")throw Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...n){let o=e._def.input?await Kt(e._def.input,n):n,i=await Reflect.apply(r,this,o);if(e._def.output)return await Kt(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,n)=>{if(typeof r.value!=="function")return r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r;if(e._def.output&&e._def.output._zod.def.type==="promise")r.value=e.implementAsync(r.value);else r.value=e.implement(r.value);return r},e.input=(...r)=>{let n=e.constructor;if(Array.isArray(r[0]))return new n({type:"function",input:new ir({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output});return new n({type:"function",input:r[0],output:e._def.output})},e.output=(r)=>new e.constructor({type:"function",input:e._def.input,output:r}),e)),Qi=p("$ZodPromise",(e,t)=>{z.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then((o)=>t.innerType._zod.run({value:o,issues:[]},n))});var es=p("$ZodCustom",(e,t)=>{T.init(e,t),z.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((i)=>Qo(i,r,n,e));Qo(o,r,n,e);return}});function Qo(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(ae(o))}}class rs extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var ur="~memo",ts=[];function ns(e){return e!==null&&typeof e==="object"}function ar(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var os=new WeakMap,Re=0,ct=1,Ae=2;function at(e,t,r){let n=os.get(e);if(n!==void 0)return n?Ae:Re;if(t.has(e))return Ae;t.add(e);let o=Re,i=(l)=>{if(o!==Ae&&l?._zod){let f=at(l,t,r);if(f>o)o=f}},s=(l,f)=>{let m=Re;for(let d of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,d);if(f&&!h.enumerable)continue;let y=h.get?ct:h.value?._zod?at(h.value,t,r):Re;if(y>m)m=y}return m},c=(l)=>{if(l>o)o=l},a=e._zod.def,u=a.type;switch(u){case"object":{let l=we(a);c(l?s(l,!0):ct),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let l of a.items)i(l);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let l of a.options)i(l);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let l=a._cachedInner??(r?e._zod.innerType:void 0);c(l?at(l,t,!1):ct);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in a){let f=Object.getOwnPropertyDescriptor(a,l);if(!f||f.get)continue;let m=f.value;if(!m||typeof m!=="object")continue;if(m._zod)i(m);else if(Array.isArray(m))for(let d of m)i(d)}}return t.delete(e),cu(e,o)}function cu(e,t){if(t!==ct)os.set(e,t===Ae);return t}function au(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var it,st=[],uu={alloc(e,t,r){let n=it;if(!n)return r;it=void 0;let o={value:r,issues:null};return n.set(t.value,o),st.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&lu(i,o.value))throw new rs;return r(o,i)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(a,u)=>{if(r===void 0){let b=at(e,new Set,!1);if(b===Re){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(a,u)}if(b===Ae||n)r=!0;else n=!0}let l=a.value;if(!ns(l))return s(a,u);let f=u[ur];if(!f)f={buckets:new WeakMap,backEdges:void 0},u[ur]=f;let m;if(o===u)m=i;else m=au(f,e),o=u,i=m;let d=m.get(l);if(d){if(a.value=d.value,d.issues){if(d.issues.length)a.issues.push(...ar(d.issues))}else a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(d.value);return a}it=m;let h=st.length,y=s(a,u);it=void 0;let _=st.length>h?st.pop():void 0;if(y instanceof Promise)return y.then((b)=>{if(_)_.issues=b.issues.length?ar(b.issues):ts;return b});if(_)_.issues=y.issues.length?ar(y.issues):ts;return y};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function is(){return uu}function lu(e,t){let r=e[ur]?.backEdges;return r!==void 0&&ns(t)&&r.has(t)}var pu=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return n[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=Tn(i.input),a=o(c,i.input);return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${Et(i.values[0])}`;return`Invalid option: expected one of ${Ot(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);if(c)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);if(c)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Ot(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((c)=>`'${c}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function lr(){return{localeError:pu()}}var ss;class cs{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function fu(){return new cs}(ss=globalThis).__zod_globalRegistry??(ss.__zod_globalRegistry=fu());var ue=globalThis.__zod_globalRegistry;function as(e){if(e.checks)e.checks=[...e.checks];return e}function us(e,t){return new e(as({type:"string",...g(t)}))}function ls(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function ps(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function fs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function ds(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function ms(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function hs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function gs(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function ys(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function _s(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function xs(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function bs(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function vs(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function zs(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function ws(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function $s(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function Ss(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function ks(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function Ps(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function Cs(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function Zs(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function Rs(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function As(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function Os(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function Is(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function Ts(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function Es(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function Ms(e,t){return new e(as({type:"number",checks:[],...g(t)}))}function Ns(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...g(t)})}function js(e,t){return new e({type:"boolean",...g(t)})}function Ds(e){return new e({type:"unknown"})}function Ls(e,t){return new e({type:"never",...g(t)})}function Bs(e,t){return new e({type:"void",...g(t)})}function Fs(e,t){return new e({type:"date",...g(t)})}function ut(e,t){return new qt({check:"less_than",...g(t),value:e,inclusive:!1})}function fe(e,t){return new qt({check:"less_than",...g(t),value:e,inclusive:!0})}function lt(e,t){return new Yt({check:"greater_than",...g(t),value:e,inclusive:!1})}function de(e,t){return new Yt({check:"greater_than",...g(t),value:e,inclusive:!0})}function pt(e,t){return new Po({check:"multiple_of",...g(t),value:e})}function ft(e,t){return new Zo({check:"max_length",...g(t),maximum:e})}function me(e,t){return new Ro({check:"min_length",...g(t),minimum:e})}function dt(e,t){return new Ao({check:"length_equals",...g(t),length:e})}function pr(e,t){return new Oo({check:"string_format",format:"regex",...g(t),pattern:e})}function fr(e){return new Io({check:"string_format",format:"lowercase",...g(e)})}function dr(e){return new To({check:"string_format",format:"uppercase",...g(e)})}function mr(e,t){return new Eo({check:"string_format",format:"includes",...g(t),includes:e})}function hr(e,t){return new Mo({check:"string_format",format:"starts_with",...g(t),prefix:e})}function gr(e,t){return new No({check:"string_format",format:"ends_with",...g(t),suffix:e})}function ie(e){return new jo({check:"overwrite",tx:e})}function yr(e){return ie((t)=>t.normalize(e))}function _r(){return ie((e)=>e.trim())}function xr(){return ie((e)=>e.toLowerCase())}function br(){return ie((e)=>e.toUpperCase())}function vr(){return ie((e)=>Pn(e))}function Us(e,t,r){return new e({type:"array",element:t,...g(r)})}function Ks(e,t,r){let n=g(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Js(e,t,r){return new e({type:"custom",check:"custom",fn:t,...g(r)})}function Vs(e,t){let r=du((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(ae(o,n.value,r._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=n.value;i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(ae(i))}},e(n.value,n)),t);return r}function du(e,t){let r=new T({check:"custom",...g(t)});return r._zod.check=e,r}function Oe(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))L(e,n,r[n]);return e}function Te(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??ue,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function O(e,t,r,n,o){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(r,i),!0}function k(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let m=s.schema,d=t.processors[o.type];if(!d)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,m,l)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;k(f,t,l),t.seen.get(f).isParent=!0}}let a=t.metadataRegistry.get(e);if(a)Oe(s.schema,a);if(t.io==="input"&&j(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Hs(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ee(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let a=n.get(c);if(a&&a!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,m=e.external.uri??((h)=>h);if(f)return{ref:m(f)};let d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${m("__shared")}#/${c}/${Hs(d)}`}}let a="#",u=`${a}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:a};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+Hs(l)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:a,defId:u}=o(s);if(c.def={...c.schema},u)c.defId=u;let l=c.schema;for(let f in l)delete l[f];l.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
68
68
|
|
|
69
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Gs(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;Gs(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!r.includes(s))r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Xs=new Set(["type","properties","required","additionalProperties"]),Hs=["oneOf","anyOf"];function Ws(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function vr(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Xs.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let u of t){let l=u.properties?.[s]??Ws(u);if(l===null||l===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(l)))c.push(l)}let a=c.length===1?c[0]:vr(c)??{allOf:c};L(r,s,a)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=Ws(s);if(c&&!i.some((a)=>JSON.stringify(a)===JSON.stringify(c)))i.push(c)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function pu(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Xs)if(o in e)return;let r=t.filter((o)=>Hs.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=vr(t);else{let o=r[0],i=Hs.find((a)=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let s=t.filter((a)=>a!==o),c=o[i].map((a)=>vr([...s,a]));if(c.some((a)=>!a))return;n={[i]:c}}if(!n)return;delete e.allOf,Oe(e,n)}function Me(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(c)=>{let a=e.seen.get(c);if(a.ref===null)return;let u=a.def??a.schema,l={...u},f=a.ref;if(a.ref=null,f){n(f);let d=e.seen.get(f),h=d.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(h);else Oe(u,h);if(Oe(u,l),c._zod.parent===f)for(let _ in u){if(_==="$ref"||_==="allOf")continue;if(!(_ in l))delete u[_]}if(h.$ref&&d.def)for(let _ in u){if(_==="$ref"||_==="allOf")continue;if(_ in d.def&&JSON.stringify(u[_])===JSON.stringify(d.def[_]))delete u[_]}}let m=c._zod.parent;if(m&&m!==f){n(m);let d=e.seen.get(m);if(d?.schema.$ref){if(u.$ref=d.schema.$ref,d.def)for(let h in u){if(h==="$ref"||h==="allOf")continue;if(h in d.def&&JSON.stringify(u[h])===JSON.stringify(d.def[h]))delete u[h]}}}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())Gs(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let u of[a.schema,a.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let f=c.get(l);if(f)f.push(u);else c.set(l,[u])}for(let a of e.intersections)for(let u of c.get(a)??[])pu(u)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Oe(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];if(a.def&&a.defId){if(a.def.id===a.defId)delete a.def.id;L(s,a.defId,a.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ie(t,"input",e.processors),output:Ie(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function j(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return j(n.element,r);if(n.type==="set")return j(n.valueType,r);if(n.type==="lazy")return j(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return j(n.innerType,r);if(n.type==="intersection")return j(n.left,r)||j(n.right,r);if(n.type==="record"||n.type==="map")return j(n.keyType,r)||j(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return j(n.in,r)||j(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(j(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(j(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(j(o,r))return!0;if(n.rest&&j(n.rest,r))return!0;return!1}return!1}var qs=(e,t={})=>(r)=>{let n=Te({...r,processors:t});return k(e,n),Ee(n,e),Me(n,e)},Ie=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=Te({...o??{},target:i,io:t,processors:r});return k(e,s),Ee(s,e),Me(s,e)};var he=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},ge=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Ys=(e,t)=>{he(e,"minimum",t),ge(e,"maximum",t)},nc=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},oc=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},ic=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},sc=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Qs=(e,t)=>he(e,"minimum",t.minimum),ec=(e,t)=>ge(e,"maximum",t.maximum),tc=(e)=>(t,r)=>{sc(t,r.format);let[n,o]=e[r.format];he(t,"minimum",n),ge(t,"maximum",o)},fu={greater_than:(e,t)=>he(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ge(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>nc(e,t.value),number_format:tc(Ke),bigint_format:tc(Et),min_length:Qs,max_length:ec,length_equals:(e,t)=>Ys(e,t.length),min_size:Qs,max_size:ec,size_equals:(e,t)=>Ys(e,t.size),string_format:(e,t)=>{if(sc(e,t.format),t.pattern)oc(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>ic(e,t.mime)};function E(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)fu[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)he(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)he(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)ge(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)ge(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)nc(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)ic(t,o.mime);for(let i of o.patterns??[])oc(t,i);return t}var du={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},mu=new Map([[tr,mo],[nt,ho]]),cc=(e)=>mu.get(e)??e,$r=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:a,contentEncoding:u,laxFormat:l}=E(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(c){if(o.format=du[c]??c,o.format==="")delete o.format;if(c==="time"||l)delete o.format}if(u)o.contentEncoding=u;if(a&&a.size>0){let f=[...a].map(cc);if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((m)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))]}},Sr=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:u,isInt:l}=E(e);o.type=l?"integer":"number";let f=typeof u==="number"&&u>=(i??Number.NEGATIVE_INFINITY),m=typeof a==="number"&&a<=(s??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(d)o.minimum=u,o.exclusiveMinimum=!0;else o.exclusiveMinimum=u;else if(typeof i==="number")o.minimum=i;if(m)if(d)o.maximum=a,o.exclusiveMaximum=!0;else o.exclusiveMaximum=a;else if(typeof s==="number")o.maximum=s;if(c){let h=new Set;for(let b of c)if(Number.isFinite(b)&&b!==0)h.add(Math.abs(b));else O(e,t,o,n,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);let[y,..._]=h;if(y!==void 0)o.multipleOf=y;if(_.length)o.allOf=[...o.allOf??[],..._.map((b)=>({multipleOf:b}))]}},kr=(e,t,r,n)=>{r.type="boolean"},ac=(e,t,r,n)=>{O(e,t,r,n,"BigInt cannot be represented in JSON Schema")},uc=(e,t,r,n)=>{O(e,t,r,n,"Symbols cannot be represented in JSON Schema")},lc=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},pc=(e,t,r,n)=>{O(e,t,r,n,"Undefined cannot be represented in JSON Schema")},Pr=(e,t,r,n)=>{O(e,t,r,n,"Void cannot be represented in JSON Schema")},Cr=(e,t,r,n)=>{r.not={}},fc=(e,t,r,n)=>{},Zr=(e,t,r,n)=>{},Rr=(e,t,r,n)=>{O(e,t,r,n,"Date cannot be represented in JSON Schema")},Ar=(e,t,r,n)=>{let o=e._zod.def,i=be(o.entries);if(i.length===0){r.not={};return}if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i},Or=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(O(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(O(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";if(i.every((s)=>typeof s==="boolean"))r.type="boolean";if(i.every((s)=>s===null))r.type="null";r.enum=i}},dc=(e,t,r,n)=>{O(e,t,r,n,"NaN cannot be represented in JSON Schema")},mc=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},hc=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:c}=E(e);if(i!==void 0)o.minLength=i;if(s!==void 0)o.maxLength=s;if(!c)return;if(c.length===0)o.not={};else if(c.length===1)o.contentMediaType=c[0];else o.anyOf=c.map((a)=>({contentMediaType:a}))},gc=(e,t,r,n)=>{r.type="boolean"},Ir=(e,t,r,n)=>{O(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Tr=(e,t,r,n)=>{O(e,t,r,n,"Function types cannot be represented in JSON Schema")},Er=(e,t,r,n)=>{O(e,t,r,n,"Transforms cannot be represented in JSON Schema")},yc=(e,t,r,n)=>{O(e,t,r,n,"Map cannot be represented in JSON Schema")},_c=(e,t,r,n)=>{O(e,t,r,n,"Set cannot be represented in JSON Schema")},Mr=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=E(e);if(typeof s==="number")o.minItems=s;if(typeof c==="number")o.maxItems=c;o.type="array",o.items=k(i.element,t,{...n,path:[...n.path,"items"]})};function Ne(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Ne(t.out);if(t.type==="catch")return Ne(t.innerType);return e._zod.optin}var Nr=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&O(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)L(o.properties,u,k(s[u],t,{...n,path:[...n.path,"properties",u]}));let a=[];for(let u of Object.keys(s)){let l=i.shape[u];if(t.io==="input"?Ne(l)===void 0:l._zod.optout===void 0)a.push(u)}if(a.length>0)o.required=a;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=k(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},jr=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,a)=>k(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));if(i)r.oneOf=s;else r.anyOf=s},Dr=(e,t,r,n)=>{let o=e._zod.def,i=k(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=k(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=(u)=>("allOf"in u)&&Object.keys(u).length===1,a=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=a,t.intersections.push(a)},Lr=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",a=i.items.map((y,_)=>k(y,t,{...n,path:[...n.path,s,_]})),u=i.rest?k(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;while(l>0){let y=i.items[l-1];if(!(t.io==="input"?Ne(y)!==void 0:y._zod.optout==="optional"))break;l--}let f=i.items.length,m=!i.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=a,m)o.items=!1;else if(u)o.items=u;if(l>0)o.minItems=l;if(m)o.maxItems=f}else if(t.target==="openapi-3.0"){if(o.items={anyOf:a},u)o.items.anyOf.push(u);if(l>0)o.minItems=l;if(m)o.maxItems=f}else{if(o.items=a,m)o.additionalItems=!1;else if(u)o.additionalItems=u;if(l>0)o.minItems=l;if(m)o.maxItems=f}let{minimum:d,maximum:h}=E(e);if(typeof d==="number")o.minItems=d;if(typeof h==="number")o.maxItems=h};function wr(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let h=e.get(t)?.def;if(!h)return t;let y=wr(e,h,r);return y===h?t:y}for(let h of["anyOf","oneOf"]){let y=t[h];if(!Array.isArray(y))continue;let _=y.map((b)=>wr(e,b,r));if(_.some((b,I)=>b!==y[I]))t={...t,[h]:_}}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some((h)=>h==="number"||h==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some((h)=>typeof h==="number"))return t;let{minimum:s,maximum:c,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:l,format:f,id:m,...d}=t;if(d.enum)d.enum=d.enum.map((h)=>typeof h==="number"?String(h):h);else if(typeof d.const==="number")d.const=String(d.const);if(!o)return d;if(d.type="string",!i)d.pattern=(n.includes("number")?Pe:Wt).source;return d}var zr=new WeakMap;function hu(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of zr.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=wr(t,i,new Set);if(s!==i)r.set(i,s)}if(!r.size)return;for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);if(i)o.propertyNames=i}}var Br=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,c=E(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let l=k(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let f of c)L(o.patternProperties,cc(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=k(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=zr.get(t);if(!l)l=[],zr.set(t,l),t.deferred.push(()=>hu(t));l.push(e)}o.additionalProperties=k(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=s._zod.values,u=t.io==="input"&&Ne(i.valueType)!==void 0;if(a&&!i.partial&&!u){let l=[...a].filter((f)=>typeof f==="string"||typeof f==="number");if(l.length>0)o.required=l.map(String)}},Fr=(e,t,r,n)=>{let o=e._zod.def,i=k(o.innerType,t,n),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},Ur=(e,t,r,n)=>{let o=e._zod.def;k(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Kr=Symbol();function xc(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,a)=>{if(typeof a!=="bigint")return a;return i=!0,null});if(!i)return JSON.parse(s);return O(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Kr}var Jr=(e,t,r,n)=>{let o=e._zod.def;k(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=xc(o.defaultValue,e,t,r,n);if(s!==Kr)r.default=s},Vr=(e,t,r,n)=>{let o=e._zod.def;k(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=xc(o.defaultValue,e,t,r,n);if(s!==Kr)r._prefault=s},Hr=(e,t,r,n)=>{let o=e._zod.def;k(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{O(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Wr=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;k(s,t,n);let c=t.seen.get(e);c.ref=s},Gr=(e,t,r,n)=>{let o=e._zod.def;k(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Xr=(e,t,r,n)=>{let o=e._zod.def;k(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},dt=(e,t,r,n)=>{let o=e._zod.def;k(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},bc=(e,t,r,n)=>{let o=e._zod.innerType;k(o,t,n);let i=t.seen.get(e);i.ref=o},rc={string:$r,number:Sr,boolean:kr,bigint:ac,symbol:uc,null:lc,undefined:pc,void:Pr,never:Cr,any:fc,unknown:Zr,date:Rr,enum:Ar,literal:Or,nan:dc,template_literal:mc,file:hc,success:gc,custom:Ir,function:Tr,transform:Er,map:yc,set:_c,array:Mr,object:Nr,union:jr,intersection:Dr,tuple:Lr,record:Br,nullable:Fr,nonoptional:Ur,default:Jr,prefault:Vr,catch:Hr,pipe:Wr,readonly:Gr,promise:Xr,optional:dt,lazy:bc};function sf(e,t){if("_idmap"in e){let n=e,o=Te({...t,processors:rc}),i={};for(let a of n._idmap.entries()){let[u,l]=a;k(l,o)}let s={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let a of n._idmap.entries()){let[u,l]=a;Ee(o,l),L(s,u,Me(o,l))}if(Object.keys(i).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[a]:i}}return{schemas:s}}let r=Te({...t,processors:rc});return k(e,r),Ee(r,e),Me(r,e)}var vc=new WeakSet([Object.prototype,Error.prototype]);function mt(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var zu=(e,t)=>{Ln.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(vc.has(r))return;vc.add(r),mt(r,"format",(n)=>(o)=>Fn(n,o)),mt(r,"flatten",(n)=>(o)=>Bn(n,o)),mt(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,ve,2)}),mt(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,ve,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var U=p("ZodError",zu,void 0,{Parent:Error});var wc=Se(U),zc=ke(U),$c=Xe(U),Sc=qe(U),kc=Kn(U),Pc=Jn(U),Cc=Vn(U),Zc=Hn(U),Rc=Wn(U),Ac=Gn(U),Oc=Xn(U),Ic=qn(U);function Su(){if(!N.localeError)F(ur())}function je(){if(!N.memoizer)F({memoizer:os()})}var S=p("ZodType",(e,t)=>(Su(),w.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(B(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return X(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(kl(e,t))},superRefine(e,t){return this.check(Pl(e,t))},overwrite(e){return this.check(ie(e))},optional(){return Mc(this)},exactOptional(){return fl(this)},nullable(){return Nc(this)},nullish(){return Mc(Nc(this))},nonoptional(e){return _l(this,e)},array(){return K(this)},or(e){return Fc([this,e])},and(e){return sl(this,e)},transform(e){return jc(this,Uc(e))},default(e){return hl(this,e)},prefault(e){return yl(this,e)},catch(e){return bl(this,e)},pipe(e){return jc(this,e)},readonly(){return zl(this)},describe(e){let t=this.clone();return ue.add(t,{description:e}),t},meta(...e){if(e.length===0)return ue.get(this);let t=this.clone();return ue.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return We(this,"~standard",{...er(this),jsonSchema:{input:Ie(this,"input"),output:Ie(this,"output")}})},set "~standard"(e){te(this,"~standard",e)},parse:function e(t,r){return wc(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await zc(this,t,r,{callee:e})},safeParse(e,t){return $c(this,e,t)},async safeParseAsync(e,t){return Sc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){te(this,"spa",e)},validate(e,t){return Kt(this,e,t)},validateAsync(e,t){return Jt(this,e,t)},encode:function e(t,r){return kc(this,t,r,{callee:e})},decode:function e(t,r){return Pc(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Cc(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Zc(this,t,r,{callee:e})},safeEncode(e,t){return Rc(this,e,t)},safeDecode(e,t){return Ac(this,e,t)},async safeEncodeAsync(e,t){return Oc(this,e,t)},async safeDecodeAsync(e,t){return Ic(this,e,t)},toJSONSchema(e){return qs(this,{})(e)},get description(){return ue.get(this)?.description},get _def(){return this._zod.def}}),Dc=p("_ZodString",(e,t)=>{rt.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$r(e,r,n,o)},Nt({format:(e)=>E(e).format??null,minLength:(e)=>E(e).minimum??null,maxLength:(e)=>E(e).maximum??null},{regex(...e){return this.check(lr(...e))},includes(...e){return this.check(dr(...e))},startsWith(...e){return this.check(mr(...e))},endsWith(...e){return this.check(hr(...e))},min(...e){return this.check(me(...e))},max(...e){return this.check(pt(...e))},length(...e){return this.check(ft(...e))},nonempty(...e){return this.check(me(1,...e))},lowercase(e){return this.check(pr(e))},uppercase(e){return this.check(fr(e))},trim(){return this.check(yr())},normalize(...e){return this.check(gr(...e))},toLowerCase(){return this.check(_r())},toUpperCase(){return this.check(xr())},slugify(){return this.check(br())}})),ku=p("ZodString",(e,t)=>{rt.init(e,t),Dc.init(e,t)},{email(e){return this.check(us(Au,e))},url(e){return this.check(hs(Iu,e))},jwt(e){return this.check(Rs(Wu,e))},emoji(e){return this.check(gs(Tu,e))},guid(e){return this.check(ls(Ou,e))},uuid(e){return this.check(ps(ht,e))},uuidv4(e){return this.check(fs(ht,e))},uuidv6(e){return this.check(ds(ht,e))},uuidv7(e){return this.check(ms(ht,e))},nanoid(e){return this.check(ys(Eu,e))},cuid(e){return this.check(_s(Mu,e))},cuid2(e){return this.check(xs(Nu,e))},ulid(e){return this.check(bs(ju,e))},base64(e){return this.check(Ps(Ju,e))},base64url(e){return this.check(Cs(Vu,e))},xid(e){return this.check(vs(Du,e))},ksuid(e){return this.check(ws(Lu,e))},ipv4(e){return this.check(zs(Bu,e))},ipv6(e){return this.check($s(Fu,e))},cidrv4(e){return this.check(Ss(Uu,e))},cidrv6(e){return this.check(ks(Ku,e))},e164(e){return this.check(Zs(Hu,e))},datetime(e){return this.check(As(Pu,e))},date(e){return this.check(Os(Cu,e))},time(e){return this.check(Is(Zu,e))},duration(e){return this.check(Ts(Ru,e))}});function x(e){return as(ku,e)}var Z=p("ZodStringFormat",(e,t)=>{P.init(e,t),Dc.init(e,t)}),Pu=p("ZodISODateTime",(e,t)=>{di.init(e,t),Z.init(e,t)}),Cu=p("ZodISODate",(e,t)=>{mi.init(e,t),Z.init(e,t)}),Zu=p("ZodISOTime",(e,t)=>{hi.init(e,t),Z.init(e,t)}),Ru=p("ZodISODuration",(e,t)=>{gi.init(e,t),Z.init(e,t)}),Au=p("ZodEmail",(e,t)=>{ri.init(e,t),Z.init(e,t)});var Ou=p("ZodGUID",(e,t)=>{ei.init(e,t),Z.init(e,t)});var ht=p("ZodUUID",(e,t)=>{ti.init(e,t),Z.init(e,t)});var Iu=p("ZodURL",(e,t)=>{ii.init(e,t),Z.init(e,t)});var Tu=p("ZodEmoji",(e,t)=>{si.init(e,t),Z.init(e,t)});var Eu=p("ZodNanoID",(e,t)=>{ci.init(e,t),Z.init(e,t)});var Mu=p("ZodCUID",(e,t)=>{ai.init(e,t),Z.init(e,t)});var Nu=p("ZodCUID2",(e,t)=>{ui.init(e,t),Z.init(e,t)});var ju=p("ZodULID",(e,t)=>{li.init(e,t),Z.init(e,t)});var Du=p("ZodXID",(e,t)=>{pi.init(e,t),Z.init(e,t)});var Lu=p("ZodKSUID",(e,t)=>{fi.init(e,t),Z.init(e,t)});var Bu=p("ZodIPv4",(e,t)=>{yi.init(e,t),Z.init(e,t)});var Fu=p("ZodIPv6",(e,t)=>{xi.init(e,t),Z.init(e,t)});var Uu=p("ZodCIDRv4",(e,t)=>{bi.init(e,t),Z.init(e,t)});var Ku=p("ZodCIDRv6",(e,t)=>{vi.init(e,t),Z.init(e,t)});var Ju=p("ZodBase64",(e,t)=>{zi.init(e,t),Z.init(e,t)});var Vu=p("ZodBase64URL",(e,t)=>{$i.init(e,t),Z.init(e,t)});var Hu=p("ZodE164",(e,t)=>{Si.init(e,t),Z.init(e,t)});var Wu=p("ZodJWT",(e,t)=>{ki.init(e,t),Z.init(e,t)});var Lc=p("ZodNumber",(e,t)=>{rr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sr(e,r,n,o),e.isFinite=!0},Nt({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=E(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=E(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=E(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>E(e).format??null},{gt(e,t){return this.check(ut(e,t))},gte(e,t){return this.check(de(e,t))},min(e,t){return this.check(de(e,t))},lt(e,t){return this.check(at(e,t))},lte(e,t){return this.check(fe(e,t))},max(e,t){return this.check(fe(e,t))},int(e){return this.check(Tc(e))},safe(e){return this.check(Tc(e))},positive(e){return this.check(ut(0,e))},nonnegative(e){return this.check(de(0,e))},negative(e){return this.check(at(0,e))},nonpositive(e){return this.check(fe(0,e))},multipleOf(e,t){return this.check(lt(e,t))},step(e,t){return this.check(lt(e,t))},finite(){return this}}));function D(e){return Es(Lc,e)}var Gu=p("ZodNumberFormat",(e,t)=>{Pi.init(e,t),Lc.init(e,t)});function Tc(e){return Ms(Gu,e)}var Xu=p("ZodBoolean",(e,t)=>{Ci.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kr(e,r,n,o)});function M(e){return Ns(Xu,e)}var qu=p("ZodUnknown",(e,t)=>{Zi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zr(e,r,n,o)});function gt(){return js(qu)}var Yu=p("ZodNever",(e,t)=>{Ri.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cr(e,r,n,o)});function Qu(e){return Ds(Yu,e)}var el=p("ZodVoid",(e,t)=>{Ai.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pr(e,r,n,o)});function xd(e){return Ls(el,e)}var tl=p("ZodDate",(e,t)=>{Oi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rr(e,r,n,o),e.min=(r,n)=>e.check(de(r,n)),e.max=(r,n)=>e.check(fe(r,n))},Nt({minDate:(e)=>{let{minimum:t}=E(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=E(e);return t?new Date(t):null}},{}));function bd(e){return Bs(tl,e)}var rl=p("ZodArray",(e,t)=>{je(),Ii.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mr(e,r,n,o),e.element=t.element},{min(e,t){return this.check(me(e,t))},nonempty(e){return this.check(me(1,e))},max(e,t){return this.check(pt(e,t))},length(e,t){return this.check(ft(e,t))},unwrap(){return this.element}});function K(e,t){return Fs(rl,e,t)}var nl=p("ZodObject",(e,t)=>{je(),Mi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nr(e,r,n,o),Aa(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return ul(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(B(this._zod.def,{catchall:e}))},passthrough(){return this.clone(B(this._zod.def,{catchall:gt()}))},loose(){return this.clone(B(this._zod.def,{catchall:gt()}))},strict(){return this.clone(B(this._zod.def,{catchall:Qu()}))},strip(){return this.clone(B(this._zod.def,{catchall:void 0}))},extend(e){return za(this,e)},safeExtend(e){return $a(this,e)},merge(e){return Sa(this,e)},pick(e){return va(this,e)},omit(e){return wa(this,e)},partial(...e){return An(en,this,e[0])},exactPartial(...e){return An(Kc,this,e[0],"exactPartial")},required(...e){return ka(Jc,this,e[0])}});function A(e,t){let r={type:"object",shape:e??{},...g(t)};return new nl(r)}var Bc=p("ZodUnion",(e,t)=>{nr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jr(e,r,n,o),e.options=t.options});function Fc(e,t){return new Bc({type:"union",options:e,...g(t)})}var ol=p("ZodDiscriminatedUnion",(e,t)=>{Bc.init(e,t),Ni.init(e,t)});function vd(e,t,r){return new ol({type:"union",options:t,discriminator:e,...g(r)})}var il=p("ZodIntersection",(e,t)=>{ji.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dr(e,r,n,o)});function sl(e,t){return new il({type:"intersection",left:e,right:t})}var cl=p("ZodTuple",(e,t)=>{je(),or.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lr(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new en({type:"optional",innerType:t}))})}});function al(e,t,r){let n=t instanceof w,o=n?r:t;return new cl({type:"tuple",items:e,rest:n?t:null,...g(o)})}var Ec=p("ZodRecord",(e,t)=>{je(),Di.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Br(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ye(e,t,r){if(!t||!t._zod)return new Ec({type:"record",keyType:x(),valueType:e,...g(t)});return new Ec({type:"record",keyType:e,valueType:t,...g(r)})}var Yr=p("ZodEnum",(e,t)=>{Li.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ar(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Yr({...t,checks:[],...g(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Yr({...t,checks:[],...g(o),entries:i})}});function ul(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Yr({type:"enum",entries:r,...g(t)})}var ll=p("ZodLiteral",(e,t)=>{Bi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Or(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Qr(e,t){return new ll({type:"literal",values:Array.isArray(e)?e:[e],...g(t)})}var pl=p("ZodTransform",(e,t)=>{je(),Fi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Er(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new $e(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ae(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=r.value;s.inst??(s.inst=e),r.issues.push(ae(s))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});function Uc(e){return new pl({type:"transform",transform:e})}var en=p("ZodOptional",(e,t)=>{ir.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Mc(e){return new en({type:"optional",innerType:e})}var Kc=p("ZodExactOptional",(e,t)=>{Ui.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fl(e){return new Kc({type:"optional",innerType:e})}var dl=p("ZodNullable",(e,t)=>{Ki.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Nc(e){return new dl({type:"nullable",innerType:e})}var ml=p("ZodDefault",(e,t)=>{Ji.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function hl(e,t){return new ml({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():It(t)}})}var gl=p("ZodPrefault",(e,t)=>{Vi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function yl(e,t){return new gl({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():It(t)}})}var Jc=p("ZodNonOptional",(e,t)=>{Hi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ur(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function _l(e,t){return new Jc({type:"nonoptional",innerType:e,...g(t)})}var xl=p("ZodCatch",(e,t)=>{Wi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function bl(e,t){return new xl({type:"catch",innerType:e,catchValue:typeof t==="function"?t:En(t)})}var Vc=p("ZodPipe",(e,t)=>{sr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wr(e,r,n,o),e.in=t.in,e.out=t.out});function jc(e,t){return new Vc({type:"pipe",in:e,out:t})}var vl=p("ZodPreprocess",(e,t)=>{Vc.init(e,t),Gi.init(e,t)}),wl=p("ZodReadonly",(e,t)=>{Xi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zl(e){return new wl({type:"readonly",innerType:e})}var $l=p("ZodPromise",(e,t)=>{Yi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function wd(e){return new $l({type:"promise",innerType:e})}var Sl=p("ZodFunction",(e,t)=>{qi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tr(e,r,n,o)});function zd(e){return new Sl({type:"function",input:Array.isArray(e?.input)?al(e?.input):e?.input??K(gt()),output:e?.output??gt()})}var Hc=p("ZodCustom",(e,t)=>{Qi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ir(e,r,n,o)});function $d(e,t){return Us(Hc,e??(()=>!0),t)}function kl(e,t={}){return Ks(Hc,e,t)}function Pl(e,t){return Js(e,t)}function Sd(e,t){return new vl({type:"pipe",in:Uc(e),out:t})}var Zl=A({id:x(),temperature:D().optional(),maxTokens:D().optional(),contextWindow:D().optional(),inputPrice:D().optional(),outputPrice:D().optional(),supportsImages:M().optional()}),Rl=A({models:K(Zl).optional(),openAiBaseUrl:x().optional(),openAiHeaders:ye(x(),x()).optional(),azureApiVersion:x().optional(),azureIdentity:M().optional()}),Al=A({id:x(),thinkingBudgetTokens:D().optional()}),Ol=A({name:x(),baseModelId:x(),thinkingBudgetTokens:D().optional()}),Il=A({models:K(Al).optional(),customModels:K(Ol).optional(),awsRegion:x().optional(),awsUseCrossRegionInference:M().optional(),awsUseGlobalInference:M().optional(),awsBedrockUsePromptCache:M().optional(),awsBedrockEndpoint:x().optional()}),Tl=A({id:x()}),El=A({models:K(Tl).optional()}),Ml=A({id:x(),thinkingBudgetTokens:D().optional()}),Nl=A({models:K(Ml).optional(),vertexProjectId:x().optional(),vertexRegion:x().optional()}),jl=A({id:x(),thinkingBudgetTokens:D().optional(),promptCachingEnabled:M().optional()}),Dl=A({models:K(jl).optional(),baseUrl:x().optional()}),Ll=A({id:x(),thinkingBudgetTokens:D().optional()}),Bl=A({models:K(Ll).optional(),baseUrl:x().optional()}),Fl=A({OpenAiCompatible:Rl.optional(),AwsBedrock:Il.optional(),Cline:El.optional(),Vertex:Nl.optional(),LiteLLM:Dl.optional(),Anthropic:Bl.optional()}),Ul=A({id:x()}),Kl=A({name:x(),url:x(),alwaysEnabled:M().optional(),headers:ye(x(),x()).optional()}),Wc=A({alwaysEnabled:M(),name:x(),contents:x()}),tn=A({bucket:x(),accessKeyId:x(),secretAccessKey:x(),region:x().optional(),endpoint:x().optional(),accountId:x().optional()}),Jl=A({enabled:M().optional(),type:Fc([Qr("s3_access_keys"),Qr("r2_access_keys"),Qr("azure_access_keys")]).optional(),s3AccessSettings:tn.optional(),r2AccessSettings:tn.optional(),azureAccessSettings:tn.optional()}),Vl=A({promptUploading:Jl.optional()}),Rd=A({version:x(),providerSettings:Fl.optional(),telemetryEnabled:M().optional(),kanbanEnabled:M().optional(),mcpMarketplaceEnabled:M().optional(),allowedMCPServers:K(Ul).optional(),remoteMCPServers:K(Kl).optional(),blockPersonalRemoteMCPServers:M().optional(),yoloModeAllowed:M().optional(),openTelemetryEnabled:M().optional(),openTelemetryMetricsExporter:x().optional(),openTelemetryLogsExporter:x().optional(),openTelemetryOtlpProtocol:x().optional(),openTelemetryOtlpEndpoint:x().optional(),openTelemetryOtlpHeaders:ye(x(),x()).optional(),openTelemetryOtlpMetricsProtocol:x().optional(),openTelemetryOtlpMetricsEndpoint:x().optional(),openTelemetryOtlpMetricsHeaders:ye(x(),x()).optional(),openTelemetryOtlpLogsProtocol:x().optional(),openTelemetryOtlpLogsEndpoint:x().optional(),openTelemetryOtlpLogsHeaders:ye(x(),x()).optional(),openTelemetryMetricExportInterval:D().optional(),openTelemetryOtlpInsecure:M().optional(),openTelemetryLogBatchSize:D().optional(),openTelemetryLogBatchTimeout:D().optional(),openTelemetryLogMaxQueueSize:D().optional(),enterpriseTelemetry:Vl.optional(),globalRules:K(Wc).optional(),globalWorkflows:K(Wc).optional()}),Ad=ye(x(),x());export{Ad as APIKeySchema,Ul as AllowedMCPServerSchema,Ll as AnthropicModelSchema,Bl as AnthropicSchema,Ol as AwsBedrockCustomModelSchema,Al as AwsBedrockModelSchema,Il as AwsBedrockSettingsSchema,Tl as ClineModelSchema,El as ClineSettingsSchema,ha as DEFAULT_REMOTE_CONFIG_PLUGIN_NAME,Zt as DefaultRemoteConfigTelemetryAdapter,Vl as EnterpriseTelemetrySchema,bt as FileRemoteConfigBundleStore,De as FileSystemRemoteConfigManagedArtifactStore,kt as FileSystemRemoteConfigPolicyMaterializer,Wc as GlobalInstructionsFileSchema,jl as LiteLLMModelSchema,Dl as LiteLLMSchema,Zl as OpenAiCompatibleModelSchema,Rl as OpenAiCompatibleSchema,Jl as PromptUploadingSchema,na as REMOTE_CONFIG_SESSION_BLOB_UPLOAD_METADATA_KEY,sp as REMOTE_URI_SCHEME,Rd as RemoteConfigSchema,xn as RemoteConfigSyncService,Kl as RemoteMCPServerSchema,tn as S3AccessKeySettingsSchema,Ml as VertexModelSchema,Nl as VertexSettingsSchema,ep as buildRemoteConfigSessionBlobUploadMetadata,yp as clearMaterializedRemoteConfigRuntime,rp as clearRemoteConfigSessionBlobUpload,ua as createRemoteConfigBlobStorageAdapter,xa as createRemoteConfigPluginDefinition,np as createRemoteConfigSessionMessagesArtifactUploader,mn as getRemoteConfigCommandDirectories,ya as normalizeBundleTelemetry,_p as prepareRemoteConfigRuntime,la as readRemoteConfigSessionBlobUploadMetadata,tp as registerRemoteConfigSessionBlobUpload,$t as remoteConfigInstructionToManagedFile,oa as resolveBlobStoreSettingsFromPromptUploading,pn as resolveBlobStoreSettingsFromRemoteConfig,ga as resolveOpenTelemetryConfigFromRemoteConfig,Pt as resolveRemoteConfigPaths,_a as withRemoteConfigBundlePaths};
|
|
69
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Xs(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;Xs(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!r.includes(s))r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var qs=new Set(["type","properties","required","additionalProperties"]),Ws=["oneOf","anyOf"];function Gs(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function zr(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!qs.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let u of t){let l=u.properties?.[s]??Gs(u);if(l===null||l===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(l)))c.push(l)}let a=c.length===1?c[0]:zr(c)??{allOf:c};L(r,s,a)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=Gs(s);if(c&&!i.some((a)=>JSON.stringify(a)===JSON.stringify(c)))i.push(c)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function mu(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of qs)if(o in e)return;let r=t.filter((o)=>Ws.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=zr(t);else{let o=r[0],i=Ws.find((a)=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let s=t.filter((a)=>a!==o),c=o[i].map((a)=>zr([...s,a]));if(c.some((a)=>!a))return;n={[i]:c}}if(!n)return;delete e.allOf,Oe(e,n)}function Me(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(c)=>{let a=e.seen.get(c);if(a.ref===null)return;let u=a.def??a.schema,l={...u},f=a.ref;if(a.ref=null,f){n(f);let d=e.seen.get(f),h=d.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(h);else Oe(u,h);if(Oe(u,l),c._zod.parent===f)for(let _ in u){if(_==="$ref"||_==="allOf")continue;if(!(_ in l))delete u[_]}if(h.$ref&&d.def)for(let _ in u){if(_==="$ref"||_==="allOf")continue;if(_ in d.def&&JSON.stringify(u[_])===JSON.stringify(d.def[_]))delete u[_]}}let m=c._zod.parent;if(m&&m!==f){n(m);let d=e.seen.get(m);if(d?.schema.$ref){if(u.$ref=d.schema.$ref,d.def)for(let h in u){if(h==="$ref"||h==="allOf")continue;if(h in d.def&&JSON.stringify(u[h])===JSON.stringify(d.def[h]))delete u[h]}}}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())Xs(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let u of[a.schema,a.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let f=c.get(l);if(f)f.push(u);else c.set(l,[u])}for(let a of e.intersections)for(let u of c.get(a)??[])mu(u)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Oe(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];if(a.def&&a.defId){if(a.def.id===a.defId)delete a.def.id;L(s,a.defId,a.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ie(t,"input",e.processors),output:Ie(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function j(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return j(n.element,r);if(n.type==="set")return j(n.valueType,r);if(n.type==="lazy")return j(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return j(n.innerType,r);if(n.type==="intersection")return j(n.left,r)||j(n.right,r);if(n.type==="record"||n.type==="map")return j(n.keyType,r)||j(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return j(n.in,r)||j(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(j(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(j(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(j(o,r))return!0;if(n.rest&&j(n.rest,r))return!0;return!1}return!1}var Ys=(e,t={})=>(r)=>{let n=Te({...r,processors:t});return k(e,n),Ee(n,e),Me(n,e)},Ie=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=Te({...o??{},target:i,io:t,processors:r});return k(e,s),Ee(s,e),Me(s,e)};var he=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},ge=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Qs=(e,t)=>{he(e,"minimum",t),ge(e,"maximum",t)},oc=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},ic=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},sc=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},cc=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},ec=(e,t)=>he(e,"minimum",t.minimum),tc=(e,t)=>ge(e,"maximum",t.maximum),rc=(e)=>(t,r)=>{cc(t,r.format);let[n,o]=e[r.format];he(t,"minimum",n),ge(t,"maximum",o)},hu={greater_than:(e,t)=>he(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ge(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>oc(e,t.value),number_format:rc(Ke),bigint_format:rc(Mt),min_length:ec,max_length:tc,length_equals:(e,t)=>Qs(e,t.length),min_size:ec,max_size:tc,size_equals:(e,t)=>Qs(e,t.size),string_format:(e,t)=>{if(cc(e,t.format),t.pattern)ic(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>sc(e,t.mime)};function E(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)hu[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)he(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)he(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)ge(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)ge(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)oc(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)sc(t,o.mime);for(let i of o.patterns??[])ic(t,i);return t}var gu={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},yu=new Map([[rr,ho],[ot,go]]),ac=(e)=>yu.get(e)??e,Sr=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:a,contentEncoding:u,laxFormat:l}=E(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(c){if(o.format=gu[c]??c,o.format==="")delete o.format;if(c==="time"||l)delete o.format}if(u)o.contentEncoding=u;if(a&&a.size>0){let f=[...a].map(ac);if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((m)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))]}},kr=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:u,isInt:l}=E(e);o.type=l?"integer":"number";let f=typeof u==="number"&&u>=(i??Number.NEGATIVE_INFINITY),m=typeof a==="number"&&a<=(s??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(d)o.minimum=u,o.exclusiveMinimum=!0;else o.exclusiveMinimum=u;else if(typeof i==="number")o.minimum=i;if(m)if(d)o.maximum=a,o.exclusiveMaximum=!0;else o.exclusiveMaximum=a;else if(typeof s==="number")o.maximum=s;if(c){let h=new Set;for(let b of c)if(Number.isFinite(b)&&b!==0)h.add(Math.abs(b));else O(e,t,o,n,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);let[y,..._]=h;if(y!==void 0)o.multipleOf=y;if(_.length)o.allOf=[...o.allOf??[],..._.map((b)=>({multipleOf:b}))]}},Pr=(e,t,r,n)=>{r.type="boolean"},uc=(e,t,r,n)=>{O(e,t,r,n,"BigInt cannot be represented in JSON Schema")},lc=(e,t,r,n)=>{O(e,t,r,n,"Symbols cannot be represented in JSON Schema")},pc=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},fc=(e,t,r,n)=>{O(e,t,r,n,"Undefined cannot be represented in JSON Schema")},Cr=(e,t,r,n)=>{O(e,t,r,n,"Void cannot be represented in JSON Schema")},Zr=(e,t,r,n)=>{r.not={}},dc=(e,t,r,n)=>{},Rr=(e,t,r,n)=>{},Ar=(e,t,r,n)=>{O(e,t,r,n,"Date cannot be represented in JSON Schema")},Or=(e,t,r,n)=>{let o=e._zod.def,i=be(o.entries);if(i.length===0){r.not={};return}if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i},Ir=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(O(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(O(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";if(i.every((s)=>typeof s==="boolean"))r.type="boolean";if(i.every((s)=>s===null))r.type="null";r.enum=i}},mc=(e,t,r,n)=>{O(e,t,r,n,"NaN cannot be represented in JSON Schema")},hc=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},gc=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:c}=E(e);if(i!==void 0)o.minLength=i;if(s!==void 0)o.maxLength=s;if(!c)return;if(c.length===0)o.not={};else if(c.length===1)o.contentMediaType=c[0];else o.anyOf=c.map((a)=>({contentMediaType:a}))},yc=(e,t,r,n)=>{r.type="boolean"},Tr=(e,t,r,n)=>{O(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Er=(e,t,r,n)=>{O(e,t,r,n,"Function types cannot be represented in JSON Schema")},Mr=(e,t,r,n)=>{O(e,t,r,n,"Transforms cannot be represented in JSON Schema")},_c=(e,t,r,n)=>{O(e,t,r,n,"Map cannot be represented in JSON Schema")},xc=(e,t,r,n)=>{O(e,t,r,n,"Set cannot be represented in JSON Schema")},Nr=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=E(e);if(typeof s==="number")o.minItems=s;if(typeof c==="number")o.maxItems=c;o.type="array",o.items=k(i.element,t,{...n,path:[...n.path,"items"]})};function Ne(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Ne(t.out);if(t.type==="catch")return Ne(t.innerType);return e._zod.optin}var jr=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&O(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)L(o.properties,u,k(s[u],t,{...n,path:[...n.path,"properties",u]}));let a=[];for(let u of Object.keys(s)){let l=i.shape[u];if(t.io==="input"?Ne(l)===void 0:l._zod.optout===void 0)a.push(u)}if(a.length>0)o.required=a;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=k(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},Dr=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,a)=>k(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));if(i)r.oneOf=s;else r.anyOf=s},Lr=(e,t,r,n)=>{let o=e._zod.def,i=k(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=k(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=(u)=>("allOf"in u)&&Object.keys(u).length===1,a=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=a,t.intersections.push(a)},Br=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",a=i.items.map((y,_)=>k(y,t,{...n,path:[...n.path,s,_]})),u=i.rest?k(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;while(l>0){let y=i.items[l-1];if(!(t.io==="input"?Ne(y)!==void 0:y._zod.optout==="optional"))break;l--}let f=i.items.length,m=!i.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=a,m)o.items=!1;else if(u)o.items=u;if(l>0)o.minItems=l;if(m)o.maxItems=f}else if(t.target==="openapi-3.0"){if(o.items={anyOf:a},u)o.items.anyOf.push(u);if(l>0)o.minItems=l;if(m)o.maxItems=f}else{if(o.items=a,m)o.additionalItems=!1;else if(u)o.additionalItems=u;if(l>0)o.minItems=l;if(m)o.maxItems=f}let{minimum:d,maximum:h}=E(e);if(typeof d==="number")o.minItems=d;if(typeof h==="number")o.maxItems=h};function wr(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let h=e.get(t)?.def;if(!h)return t;let y=wr(e,h,r);return y===h?t:y}for(let h of["anyOf","oneOf"]){let y=t[h];if(!Array.isArray(y))continue;let _=y.map((b)=>wr(e,b,r));if(_.some((b,I)=>b!==y[I]))t={...t,[h]:_}}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some((h)=>h==="number"||h==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some((h)=>typeof h==="number"))return t;let{minimum:s,maximum:c,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:l,format:f,id:m,...d}=t;if(d.enum)d.enum=d.enum.map((h)=>typeof h==="number"?String(h):h);else if(typeof d.const==="number")d.const=String(d.const);if(!o)return d;if(d.type="string",!i)d.pattern=(n.includes("number")?Pe:Gt).source;return d}var $r=new WeakMap;function _u(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of $r.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=wr(t,i,new Set);if(s!==i)r.set(i,s)}if(!r.size)return;for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);if(i)o.propertyNames=i}}var Fr=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,c=E(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let l=k(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let f of c)L(o.patternProperties,ac(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=k(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=$r.get(t);if(!l)l=[],$r.set(t,l),t.deferred.push(()=>_u(t));l.push(e)}o.additionalProperties=k(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=s._zod.values,u=t.io==="input"&&Ne(i.valueType)!==void 0;if(a&&!i.partial&&!u){let l=[...a].filter((f)=>typeof f==="string"||typeof f==="number");if(l.length>0)o.required=l.map(String)}},Ur=(e,t,r,n)=>{let o=e._zod.def,i=k(o.innerType,t,n),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},Kr=(e,t,r,n)=>{let o=e._zod.def;k(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Jr=Symbol();function bc(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,a)=>{if(typeof a!=="bigint")return a;return i=!0,null});if(!i)return JSON.parse(s);return O(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Jr}var Vr=(e,t,r,n)=>{let o=e._zod.def;k(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=bc(o.defaultValue,e,t,r,n);if(s!==Jr)r.default=s},Hr=(e,t,r,n)=>{let o=e._zod.def;k(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=bc(o.defaultValue,e,t,r,n);if(s!==Jr)r._prefault=s},Wr=(e,t,r,n)=>{let o=e._zod.def;k(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{O(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Gr=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;k(s,t,n);let c=t.seen.get(e);c.ref=s},Xr=(e,t,r,n)=>{let o=e._zod.def;k(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},qr=(e,t,r,n)=>{let o=e._zod.def;k(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},mt=(e,t,r,n)=>{let o=e._zod.def;k(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},vc=(e,t,r,n)=>{let o=e._zod.innerType;k(o,t,n);let i=t.seen.get(e);i.ref=o},nc={string:Sr,number:kr,boolean:Pr,bigint:uc,symbol:lc,null:pc,undefined:fc,void:Cr,never:Zr,any:dc,unknown:Rr,date:Ar,enum:Or,literal:Ir,nan:mc,template_literal:hc,file:gc,success:yc,custom:Tr,function:Er,transform:Mr,map:_c,set:xc,array:Nr,object:jr,union:Dr,intersection:Lr,tuple:Br,record:Fr,nullable:Ur,nonoptional:Kr,default:Vr,prefault:Hr,catch:Wr,pipe:Gr,readonly:Xr,promise:qr,optional:mt,lazy:vc};function uf(e,t){if("_idmap"in e){let n=e,o=Te({...t,processors:nc}),i={};for(let a of n._idmap.entries()){let[u,l]=a;k(l,o)}let s={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let a of n._idmap.entries()){let[u,l]=a;Ee(o,l),L(s,u,Me(o,l))}if(Object.keys(i).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[a]:i}}return{schemas:s}}let r=Te({...t,processors:nc});return k(e,r),Ee(r,e),Me(r,e)}var zc=new WeakSet([Object.prototype,Error.prototype]);function ht(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var ku=(e,t)=>{Bn.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(zc.has(r))return;zc.add(r),ht(r,"format",(n)=>(o)=>Un(n,o)),ht(r,"flatten",(n)=>(o)=>Fn(n,o)),ht(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,ve,2)}),ht(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,ve,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var U=p("ZodError",ku,void 0,{Parent:Error});var wc=Se(U),$c=ke(U),Sc=qe(U),kc=Ye(U),Pc=Jn(U),Cc=Vn(U),Zc=Hn(U),Rc=Wn(U),Ac=Gn(U),Oc=Xn(U),Ic=qn(U),Tc=Yn(U);function Cu(){if(!N.localeError)F(lr())}function je(){if(!N.memoizer)F({memoizer:is()})}var S=p("ZodType",(e,t)=>(Cu(),z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(B(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return X(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Zl(e,t))},superRefine(e,t){return this.check(Rl(e,t))},overwrite(e){return this.check(ie(e))},optional(){return Nc(this)},exactOptional(){return hl(this)},nullable(){return jc(this)},nullish(){return Nc(jc(this))},nonoptional(e){return vl(this,e)},array(){return K(this)},or(e){return Uc([this,e])},and(e){return ul(this,e)},transform(e){return Dc(this,Kc(e))},default(e){return _l(this,e)},prefault(e){return bl(this,e)},catch(e){return wl(this,e)},pipe(e){return Dc(this,e)},readonly(){return kl(this)},describe(e){let t=this.clone();return ue.add(t,{description:e}),t},meta(...e){if(e.length===0)return ue.get(this);let t=this.clone();return ue.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return Ge(this,"~standard",{...tr(this),jsonSchema:{input:Ie(this,"input"),output:Ie(this,"output")}})},set "~standard"(e){te(this,"~standard",e)},parse:function e(t,r){return wc(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await $c(this,t,r,{callee:e})},safeParse(e,t){return Sc(this,e,t)},async safeParseAsync(e,t){return kc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){te(this,"spa",e)},validate(e,t){return Jt(this,e,t)},validateAsync(e,t){return Vt(this,e,t)},encode:function e(t,r){return Pc(this,t,r,{callee:e})},decode:function e(t,r){return Cc(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Zc(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Rc(this,t,r,{callee:e})},safeEncode(e,t){return Ac(this,e,t)},safeDecode(e,t){return Oc(this,e,t)},async safeEncodeAsync(e,t){return Ic(this,e,t)},async safeDecodeAsync(e,t){return Tc(this,e,t)},toJSONSchema(e){return Ys(this,{})(e)},get description(){return ue.get(this)?.description},get _def(){return this._zod.def}}),Lc=p("_ZodString",(e,t)=>{nt.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sr(e,r,n,o)},jt({format:(e)=>E(e).format??null,minLength:(e)=>E(e).minimum??null,maxLength:(e)=>E(e).maximum??null},{regex(...e){return this.check(pr(...e))},includes(...e){return this.check(mr(...e))},startsWith(...e){return this.check(hr(...e))},endsWith(...e){return this.check(gr(...e))},min(...e){return this.check(me(...e))},max(...e){return this.check(ft(...e))},length(...e){return this.check(dt(...e))},nonempty(...e){return this.check(me(1,...e))},lowercase(e){return this.check(fr(e))},uppercase(e){return this.check(dr(e))},trim(){return this.check(_r())},normalize(...e){return this.check(yr(...e))},toLowerCase(){return this.check(xr())},toUpperCase(){return this.check(br())},slugify(){return this.check(vr())}})),Zu=p("ZodString",(e,t)=>{nt.init(e,t),Lc.init(e,t)},{email(e){return this.check(ls(Tu,e))},url(e){return this.check(gs(Mu,e))},jwt(e){return this.check(As(qu,e))},emoji(e){return this.check(ys(Nu,e))},guid(e){return this.check(ps(Eu,e))},uuid(e){return this.check(fs(gt,e))},uuidv4(e){return this.check(ds(gt,e))},uuidv6(e){return this.check(ms(gt,e))},uuidv7(e){return this.check(hs(gt,e))},nanoid(e){return this.check(_s(ju,e))},cuid(e){return this.check(xs(Du,e))},cuid2(e){return this.check(bs(Lu,e))},ulid(e){return this.check(vs(Bu,e))},base64(e){return this.check(Cs(Wu,e))},base64url(e){return this.check(Zs(Gu,e))},xid(e){return this.check(zs(Fu,e))},ksuid(e){return this.check(ws(Uu,e))},ipv4(e){return this.check($s(Ku,e))},ipv6(e){return this.check(Ss(Ju,e))},cidrv4(e){return this.check(ks(Vu,e))},cidrv6(e){return this.check(Ps(Hu,e))},e164(e){return this.check(Rs(Xu,e))},datetime(e){return this.check(Os(Ru,e))},date(e){return this.check(Is(Au,e))},time(e){return this.check(Ts(Ou,e))},duration(e){return this.check(Es(Iu,e))}});function x(e){return us(Zu,e)}var Z=p("ZodStringFormat",(e,t)=>{P.init(e,t),Lc.init(e,t)}),Ru=p("ZodISODateTime",(e,t)=>{mi.init(e,t),Z.init(e,t)}),Au=p("ZodISODate",(e,t)=>{hi.init(e,t),Z.init(e,t)}),Ou=p("ZodISOTime",(e,t)=>{gi.init(e,t),Z.init(e,t)}),Iu=p("ZodISODuration",(e,t)=>{yi.init(e,t),Z.init(e,t)}),Tu=p("ZodEmail",(e,t)=>{ni.init(e,t),Z.init(e,t)});var Eu=p("ZodGUID",(e,t)=>{ti.init(e,t),Z.init(e,t)});var gt=p("ZodUUID",(e,t)=>{ri.init(e,t),Z.init(e,t)});var Mu=p("ZodURL",(e,t)=>{si.init(e,t),Z.init(e,t)});var Nu=p("ZodEmoji",(e,t)=>{ci.init(e,t),Z.init(e,t)});var ju=p("ZodNanoID",(e,t)=>{ai.init(e,t),Z.init(e,t)});var Du=p("ZodCUID",(e,t)=>{ui.init(e,t),Z.init(e,t)});var Lu=p("ZodCUID2",(e,t)=>{li.init(e,t),Z.init(e,t)});var Bu=p("ZodULID",(e,t)=>{pi.init(e,t),Z.init(e,t)});var Fu=p("ZodXID",(e,t)=>{fi.init(e,t),Z.init(e,t)});var Uu=p("ZodKSUID",(e,t)=>{di.init(e,t),Z.init(e,t)});var Ku=p("ZodIPv4",(e,t)=>{_i.init(e,t),Z.init(e,t)});var Ju=p("ZodIPv6",(e,t)=>{bi.init(e,t),Z.init(e,t)});var Vu=p("ZodCIDRv4",(e,t)=>{vi.init(e,t),Z.init(e,t)});var Hu=p("ZodCIDRv6",(e,t)=>{zi.init(e,t),Z.init(e,t)});var Wu=p("ZodBase64",(e,t)=>{$i.init(e,t),Z.init(e,t)});var Gu=p("ZodBase64URL",(e,t)=>{Si.init(e,t),Z.init(e,t)});var Xu=p("ZodE164",(e,t)=>{ki.init(e,t),Z.init(e,t)});var qu=p("ZodJWT",(e,t)=>{Pi.init(e,t),Z.init(e,t)});var Bc=p("ZodNumber",(e,t)=>{nr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kr(e,r,n,o),e.isFinite=!0},jt({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=E(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=E(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=E(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>E(e).format??null},{gt(e,t){return this.check(lt(e,t))},gte(e,t){return this.check(de(e,t))},min(e,t){return this.check(de(e,t))},lt(e,t){return this.check(ut(e,t))},lte(e,t){return this.check(fe(e,t))},max(e,t){return this.check(fe(e,t))},int(e){return this.check(Ec(e))},safe(e){return this.check(Ec(e))},positive(e){return this.check(lt(0,e))},nonnegative(e){return this.check(de(0,e))},negative(e){return this.check(ut(0,e))},nonpositive(e){return this.check(fe(0,e))},multipleOf(e,t){return this.check(pt(e,t))},step(e,t){return this.check(pt(e,t))},finite(){return this}}));function D(e){return Ms(Bc,e)}var Yu=p("ZodNumberFormat",(e,t)=>{Ci.init(e,t),Bc.init(e,t)});function Ec(e){return Ns(Yu,e)}var Qu=p("ZodBoolean",(e,t)=>{Zi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pr(e,r,n,o)});function M(e){return js(Qu,e)}var el=p("ZodUnknown",(e,t)=>{Ri.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rr(e,r,n,o)});function yt(){return Ds(el)}var tl=p("ZodNever",(e,t)=>{Ai.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zr(e,r,n,o)});function rl(e){return Ls(tl,e)}var nl=p("ZodVoid",(e,t)=>{Oi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cr(e,r,n,o)});function zd(e){return Bs(nl,e)}var ol=p("ZodDate",(e,t)=>{Ii.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ar(e,r,n,o),e.min=(r,n)=>e.check(de(r,n)),e.max=(r,n)=>e.check(fe(r,n))},jt({minDate:(e)=>{let{minimum:t}=E(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=E(e);return t?new Date(t):null}},{}));function wd(e){return Fs(ol,e)}var il=p("ZodArray",(e,t)=>{je(),Ti.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nr(e,r,n,o),e.element=t.element},{min(e,t){return this.check(me(e,t))},nonempty(e){return this.check(me(1,e))},max(e,t){return this.check(ft(e,t))},length(e,t){return this.check(dt(e,t))},unwrap(){return this.element}});function K(e,t){return Us(il,e,t)}var sl=p("ZodObject",(e,t)=>{je(),Ni.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jr(e,r,n,o),Oa(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return fl(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(B(this._zod.def,{catchall:e}))},passthrough(){return this.clone(B(this._zod.def,{catchall:yt()}))},loose(){return this.clone(B(this._zod.def,{catchall:yt()}))},strict(){return this.clone(B(this._zod.def,{catchall:rl()}))},strip(){return this.clone(B(this._zod.def,{catchall:void 0}))},extend(e){return $a(this,e)},safeExtend(e){return Sa(this,e)},merge(e){return ka(this,e)},pick(e){return za(this,e)},omit(e){return wa(this,e)},partial(...e){return On(tn,this,e[0])},exactPartial(...e){return On(Jc,this,e[0],"exactPartial")},required(...e){return Pa(Vc,this,e[0])}});function A(e,t){let r={type:"object",shape:e??{},...g(t)};return new sl(r)}var Fc=p("ZodUnion",(e,t)=>{or.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dr(e,r,n,o),e.options=t.options});function Uc(e,t){return new Fc({type:"union",options:e,...g(t)})}var cl=p("ZodDiscriminatedUnion",(e,t)=>{Fc.init(e,t),ji.init(e,t)});function $d(e,t,r){return new cl({type:"union",options:t,discriminator:e,...g(r)})}var al=p("ZodIntersection",(e,t)=>{Di.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lr(e,r,n,o)});function ul(e,t){return new al({type:"intersection",left:e,right:t})}var ll=p("ZodTuple",(e,t)=>{je(),ir.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Br(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new tn({type:"optional",innerType:t}))})}});function pl(e,t,r){let n=t instanceof z,o=n?r:t;return new ll({type:"tuple",items:e,rest:n?t:null,...g(o)})}var Mc=p("ZodRecord",(e,t)=>{je(),Li.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fr(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ye(e,t,r){if(!t||!t._zod)return new Mc({type:"record",keyType:x(),valueType:e,...g(t)});return new Mc({type:"record",keyType:e,valueType:t,...g(r)})}var Qr=p("ZodEnum",(e,t)=>{Bi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Or(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Qr({...t,checks:[],...g(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Qr({...t,checks:[],...g(o),entries:i})}});function fl(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Qr({type:"enum",entries:r,...g(t)})}var dl=p("ZodLiteral",(e,t)=>{Fi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ir(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function en(e,t){return new dl({type:"literal",values:Array.isArray(e)?e:[e],...g(t)})}var ml=p("ZodTransform",(e,t)=>{je(),Ui.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mr(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new $e(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ae(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=r.value;s.inst??(s.inst=e),r.issues.push(ae(s))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});function Kc(e){return new ml({type:"transform",transform:e})}var tn=p("ZodOptional",(e,t)=>{sr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Nc(e){return new tn({type:"optional",innerType:e})}var Jc=p("ZodExactOptional",(e,t)=>{Ki.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function hl(e){return new Jc({type:"optional",innerType:e})}var gl=p("ZodNullable",(e,t)=>{Ji.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ur(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function jc(e){return new gl({type:"nullable",innerType:e})}var yl=p("ZodDefault",(e,t)=>{Vi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _l(e,t){return new yl({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Tt(t)}})}var xl=p("ZodPrefault",(e,t)=>{Hi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bl(e,t){return new xl({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Tt(t)}})}var Vc=p("ZodNonOptional",(e,t)=>{Wi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function vl(e,t){return new Vc({type:"nonoptional",innerType:e,...g(t)})}var zl=p("ZodCatch",(e,t)=>{Gi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wl(e,t){return new zl({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Mn(t)})}var Hc=p("ZodPipe",(e,t)=>{cr.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gr(e,r,n,o),e.in=t.in,e.out=t.out});function Dc(e,t){return new Hc({type:"pipe",in:e,out:t})}var $l=p("ZodPreprocess",(e,t)=>{Hc.init(e,t),Xi.init(e,t)}),Sl=p("ZodReadonly",(e,t)=>{qi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function kl(e){return new Sl({type:"readonly",innerType:e})}var Pl=p("ZodPromise",(e,t)=>{Qi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Sd(e){return new Pl({type:"promise",innerType:e})}var Cl=p("ZodFunction",(e,t)=>{Yi.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Er(e,r,n,o)});function kd(e){return new Cl({type:"function",input:Array.isArray(e?.input)?pl(e?.input):e?.input??K(yt()),output:e?.output??yt()})}var Wc=p("ZodCustom",(e,t)=>{es.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tr(e,r,n,o)});function Pd(e,t){return Ks(Wc,e??(()=>!0),t)}function Zl(e,t={}){return Js(Wc,e,t)}function Rl(e,t){return Vs(e,t)}function Cd(e,t){return new $l({type:"pipe",in:Kc(e),out:t})}var Ol=A({id:x(),temperature:D().optional(),maxTokens:D().optional(),contextWindow:D().optional(),inputPrice:D().optional(),outputPrice:D().optional(),supportsImages:M().optional()}),Il=A({models:K(Ol).optional(),openAiBaseUrl:x().optional(),openAiHeaders:ye(x(),x()).optional(),azureApiVersion:x().optional(),azureIdentity:M().optional()}),Tl=A({id:x(),thinkingBudgetTokens:D().optional()}),El=A({name:x(),baseModelId:x(),thinkingBudgetTokens:D().optional()}),Ml=A({models:K(Tl).optional(),customModels:K(El).optional(),awsRegion:x().optional(),awsUseCrossRegionInference:M().optional(),awsUseGlobalInference:M().optional(),awsBedrockUsePromptCache:M().optional(),awsBedrockEndpoint:x().optional()}),Nl=A({id:x()}),jl=A({models:K(Nl).optional()}),Dl=A({id:x(),thinkingBudgetTokens:D().optional()}),Ll=A({models:K(Dl).optional(),vertexProjectId:x().optional(),vertexRegion:x().optional()}),Bl=A({id:x(),thinkingBudgetTokens:D().optional(),promptCachingEnabled:M().optional()}),Fl=A({models:K(Bl).optional(),baseUrl:x().optional()}),Ul=A({id:x(),thinkingBudgetTokens:D().optional()}),Kl=A({models:K(Ul).optional(),baseUrl:x().optional()}),Jl=A({OpenAiCompatible:Il.optional(),AwsBedrock:Ml.optional(),Cline:jl.optional(),Vertex:Ll.optional(),LiteLLM:Fl.optional(),Anthropic:Kl.optional()}),Vl=A({id:x()}),Hl=A({name:x(),url:x(),alwaysEnabled:M().optional(),headers:ye(x(),x()).optional()}),Gc=A({alwaysEnabled:M(),name:x(),contents:x()}),rn=A({bucket:x(),accessKeyId:x(),secretAccessKey:x(),region:x().optional(),endpoint:x().optional(),accountId:x().optional()}),Wl=A({enabled:M().optional(),type:Uc([en("s3_access_keys"),en("r2_access_keys"),en("azure_access_keys")]).optional(),s3AccessSettings:rn.optional(),r2AccessSettings:rn.optional(),azureAccessSettings:rn.optional()}),Gl=A({promptUploading:Wl.optional()}),Id=A({version:x(),providerSettings:Jl.optional(),telemetryEnabled:M().optional(),kanbanEnabled:M().optional(),mcpMarketplaceEnabled:M().optional(),allowedMCPServers:K(Vl).optional(),remoteMCPServers:K(Hl).optional(),blockPersonalRemoteMCPServers:M().optional(),yoloModeAllowed:M().optional(),openTelemetryEnabled:M().optional(),openTelemetryMetricsExporter:x().optional(),openTelemetryLogsExporter:x().optional(),openTelemetryOtlpProtocol:x().optional(),openTelemetryOtlpEndpoint:x().optional(),openTelemetryOtlpHeaders:ye(x(),x()).optional(),openTelemetryOtlpMetricsProtocol:x().optional(),openTelemetryOtlpMetricsEndpoint:x().optional(),openTelemetryOtlpMetricsHeaders:ye(x(),x()).optional(),openTelemetryOtlpLogsProtocol:x().optional(),openTelemetryOtlpLogsEndpoint:x().optional(),openTelemetryOtlpLogsHeaders:ye(x(),x()).optional(),openTelemetryMetricExportInterval:D().optional(),openTelemetryOtlpInsecure:M().optional(),openTelemetryLogBatchSize:D().optional(),openTelemetryLogBatchTimeout:D().optional(),openTelemetryLogMaxQueueSize:D().optional(),enterpriseTelemetry:Gl.optional(),globalRules:K(Gc).optional(),globalWorkflows:K(Gc).optional()}),Td=ye(x(),x());export{Td as APIKeySchema,Vl as AllowedMCPServerSchema,Ul as AnthropicModelSchema,Kl as AnthropicSchema,El as AwsBedrockCustomModelSchema,Tl as AwsBedrockModelSchema,Ml as AwsBedrockSettingsSchema,Nl as ClineModelSchema,jl as ClineSettingsSchema,ga as DEFAULT_REMOTE_CONFIG_PLUGIN_NAME,Rt as DefaultRemoteConfigTelemetryAdapter,Gl as EnterpriseTelemetrySchema,vt as FileRemoteConfigBundleStore,De as FileSystemRemoteConfigManagedArtifactStore,Pt as FileSystemRemoteConfigPolicyMaterializer,Gc as GlobalInstructionsFileSchema,Bl as LiteLLMModelSchema,Fl as LiteLLMSchema,Ol as OpenAiCompatibleModelSchema,Il as OpenAiCompatibleSchema,Wl as PromptUploadingSchema,oa as REMOTE_CONFIG_SESSION_BLOB_UPLOAD_METADATA_KEY,up as REMOTE_URI_SCHEME,Id as RemoteConfigSchema,bn as RemoteConfigSyncService,Hl as RemoteMCPServerSchema,rn as S3AccessKeySettingsSchema,Dl as VertexModelSchema,Ll as VertexSettingsSchema,np as buildRemoteConfigSessionBlobUploadMetadata,bp as clearMaterializedRemoteConfigRuntime,ip as clearRemoteConfigSessionBlobUpload,la as createRemoteConfigBlobStorageAdapter,ba as createRemoteConfigPluginDefinition,sp as createRemoteConfigSessionMessagesArtifactUploader,hn as getRemoteConfigCommandDirectories,_a as normalizeBundleTelemetry,vp as prepareRemoteConfigRuntime,pa as readRemoteConfigSessionBlobUploadMetadata,op as registerRemoteConfigSessionBlobUpload,St as remoteConfigInstructionToManagedFile,ia as resolveBlobStoreSettingsFromPromptUploading,fn as resolveBlobStoreSettingsFromRemoteConfig,ya as resolveOpenTelemetryConfigFromRemoteConfig,Ct as resolveRemoteConfigPaths,xa as withRemoteConfigBundlePaths};
|