conformtools 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/dist/browser/timeline_core_bg.wasm +0 -0
- package/dist/chunk-6TM32YIJ.js +7 -0
- package/dist/chunk-7XTBFOUJ.js +3 -0
- package/dist/chunk-E6YXZIJS.js +230 -0
- package/dist/chunk-GXEVALBL.js +3 -0
- package/dist/{chunk-YPRTUS5W.js → chunk-N43NAG5E.js} +1 -1
- package/dist/chunk-PSMXHDMX.js +3 -0
- package/dist/chunk-PZFWQJCF.js +3 -0
- package/dist/chunk-R6WJ6JIQ.js +3 -0
- package/dist/chunk-UUDNNFU7.js +3 -0
- package/dist/chunk-XDHIIZ6A.js +3 -0
- package/dist/chunk-Y2BEEOPB.js +3 -0
- package/dist/chunk-ZAHP3ES5.js +3 -0
- package/dist/cli.js +5 -4
- package/dist/cr3-wasm-CWKEOCYH.js +3 -0
- package/dist/dng-wasm-JNFS44V5.js +3 -0
- package/dist/dpx-wasm-VNJRFPYY.js +3 -0
- package/dist/exr-wasm-5D66YR7A.js +3 -0
- package/dist/{h264-JHQCJTWP.js → h264-ZB5DJSNV.js} +1 -1
- package/dist/{h264-mxf-4M63NBQK.js → h264-mxf-NVBLGU3V.js} +1 -1
- package/dist/http.js +2 -2
- package/dist/{inspect-6OM4FTVW.js → inspect-MGSZRRAF.js} +2 -2
- package/dist/isobmff-7G55HKDG.js +3 -0
- package/dist/mcp.js +11 -9
- package/dist/media_core-AISE7FMT.js +9 -0
- package/dist/{media_core_bg-XIM7Y4R3.js → media_core_bg-FGAR5KA5.js} +1 -1
- package/dist/mxf-YH2A2XLW.js +3 -0
- package/dist/{ops-7HVBBXUQ.js → ops-BQDPU4M6.js} +1 -1
- package/dist/premiere-uxp/icons/panel.png +0 -0
- package/dist/premiere-uxp/icons/panel@2x.png +0 -0
- package/dist/premiere-uxp/icons/plugin.png +0 -0
- package/dist/premiere-uxp/icons/plugin@2x.png +0 -0
- package/dist/premiere-uxp/index.html +38 -0
- package/dist/premiere-uxp/index.js +93 -0
- package/dist/premiere-uxp/lib/clipmeta.js +170 -0
- package/dist/premiere-uxp/lib/ctx.js +62 -0
- package/dist/premiere-uxp/lib/handles.js +57 -0
- package/dist/premiere-uxp/lib/markers.js +198 -0
- package/dist/premiere-uxp/lib/pairing.js +58 -0
- package/dist/premiere-uxp/lib/premiere.js +82 -0
- package/dist/premiere-uxp/lib/probe.js +139 -0
- package/dist/premiere-uxp/lib/protocol.js +165 -0
- package/dist/premiere-uxp/lib/render.js +38 -0
- package/dist/premiere-uxp/lib/session.js +85 -0
- package/dist/premiere-uxp/lib/sizing.js +312 -0
- package/dist/premiere-uxp/lib/time.js +82 -0
- package/dist/premiere-uxp/lib/timeline.js +336 -0
- package/dist/premiere-uxp/lib/verbs.js +20 -0
- package/dist/premiere-uxp/lib/write.js +97 -0
- package/dist/premiere-uxp/manifest.json +102 -0
- package/dist/r3d-T6D3M2XJ.js +3 -0
- package/dist/{r3d-AT6NNIY3.js → r3d-U4XTQJXQ.js} +1 -1
- package/dist/resolve-bridge.py +551 -0
- package/dist/resolve-presets/conform.tools.xml +127 -0
- package/dist/skills/auto-conform/SKILL.md +87 -0
- package/dist/skills/conform-artist/SKILL.md +68 -0
- package/dist/skills/conform-artist/references/avid.md +19 -0
- package/dist/skills/conform-artist/references/other-hosts.md +23 -0
- package/dist/skills/conform-artist/references/premiere.md +18 -0
- package/dist/skills/conform-artist/references/resolve.md +19 -0
- package/dist/skills/conform-artist/references/troubleshooting.md +33 -0
- package/dist/skills/conform-artist/references/turnover-checklist.md +37 -0
- package/dist/skills/delivery-qc/SKILL.md +48 -0
- package/dist/sscd-embed-DHFTEIOC.js +3 -0
- package/dist/sscd-sweep-OYS4XAID.js +3 -0
- package/dist/{still-E4HLCCST.js → still-UFLOAEM4.js} +1 -1
- package/dist/tiff-wasm-2CEABW6L.js +3 -0
- package/dist/wasm/media_core_bg.wasm +0 -0
- package/dist/wasm/udf_bg.wasm +0 -0
- package/dist/wasm-threads/media_core_bg.wasm +0 -0
- package/dist/{wav-DXF73Y56.js → wav-KNJZMOGX.js} +1 -1
- package/package.json +1 -1
- package/dist/chunk-35U7WGES.js +0 -3
- package/dist/chunk-3XTUTEKJ.js +0 -102
- package/dist/chunk-HJXRLQOI.js +0 -3
- package/dist/chunk-IDDQR56R.js +0 -7
- package/dist/chunk-UUMHVA7R.js +0 -3
- package/dist/chunk-WWGQFOB2.js +0 -64
- package/dist/cr3-wasm-X6Q4YMUU.js +0 -3
- package/dist/dng-wasm-EAB24KDN.js +0 -3
- package/dist/dpx-wasm-OX2D24ZB.js +0 -3
- package/dist/exr-wasm-Z6BBPJSN.js +0 -3
- package/dist/isobmff-XL33CVJR.js +0 -3
- package/dist/media_core-VSTO6CS4.js +0 -9
- package/dist/mxf-VIANACTI.js +0 -3
- package/dist/r3d-2QCFX7UX.js +0 -3
- package/dist/sscd-sweep-IXM4OD7O.js +0 -3
- package/dist/tiff-wasm-XYTQNL2F.js +0 -3
- package/dist/zod-IPSV75LP.js +0 -3
- /package/dist/{arriraw-Y5VXHXNX.js → arriraw-3GKCR6K2.js} +0 -0
- /package/dist/{chunk-NYB4ISL3.js → chunk-WHY3DVXS.js} +0 -0
- /package/dist/{media_core_bg-BKXQLNFA.js → media_core_bg-YK63OUDM.js} +0 -0
- /package/dist/{prores-TQEZ3KFH.js → prores-L4JZZWGH.js} +0 -0
- /package/dist/{timeline_core_bg-QEOVAIWP.js → timeline_core_bg-2TYWZ35G.js} +0 -0
- /package/dist/{udf_bg-UTQ6BVXX.js → udf_bg-A4WEMSAX.js} +0 -0
package/README.md
CHANGED
|
@@ -46,6 +46,28 @@ Then just ask:
|
|
|
46
46
|
- "Relink this cut to the media in /Volumes/OCF."
|
|
47
47
|
- "Trim A001C003.mov from 01:00:10:00 to 01:00:14:12 with 12 frames of handles."
|
|
48
48
|
- "Consolidate the media for this cut into ~/Deliver with 24 frame handles."
|
|
49
|
+
- "Which clips in this cut are retimed?" · "What media in this project is unused?" · "Export the red markers as CSV."
|
|
50
|
+
- "What do I have open in Resolve?" · "Bring this turnover into my Resolve project." · "Render 01:00:10:00 to 01:00:20:00 of Reel 2 with my ProRes Master preset."
|
|
51
|
+
- "Make a 30-shot test cut from /Volumes/OCF with every hard case, seed 7." (`timeline_generate`: a seeded random edit — short shots, jump cuts, look-alike takes, punch-ins, off-rate, retimes, PiP, gaps — each shot tagged with what it tests, so a conform of its render can be scored per case)
|
|
52
|
+
- "Check Reel 2 for black edges." · "QC the master before it goes out." (DaVinci Resolve Studio with the conform.tools renderplugin: every frame is measured after grading; findings land as markers)
|
|
53
|
+
|
|
54
|
+
Working with a running DaVinci Resolve Studio needs Preferences > System > General > External
|
|
55
|
+
scripting using: **Local**. Imports always land as a new timeline in a conform.tools folder; renders
|
|
56
|
+
run only their own job and put your Deliver settings, timeline and page back.
|
|
57
|
+
|
|
58
|
+
**Skills come with it.** The server also ships Agent Skills (the MCP Skills
|
|
59
|
+
Extension, `io.modelcontextprotocol/skills`), so the agent learns how a conform
|
|
60
|
+
artist uses the tools, not just what they do:
|
|
61
|
+
|
|
62
|
+
- `skill://conform-artist/SKILL.md`: turnover checks, relink, write, judge and
|
|
63
|
+
report losses, with notes per host (Resolve, Premiere, Avid, Flame, Final Cut,
|
|
64
|
+
Baselight, Pro Tools).
|
|
65
|
+
- `skill://delivery-qc/SKILL.md`: consolidate, package (folder or ISO) and QC a
|
|
66
|
+
delivery before it leaves.
|
|
67
|
+
|
|
68
|
+
Hosts that support the extension list and load them natively. Other hosts see the
|
|
69
|
+
same files as ordinary MCP resources, and the server's instructions point the agent
|
|
70
|
+
at them. Your host decides whether a skill is loaded.
|
|
49
71
|
|
|
50
72
|
## 2b. Or use it from a terminal
|
|
51
73
|
|
|
@@ -81,6 +103,42 @@ writing timelines use conform.tools, exactly as the website does: the engine sen
|
|
|
81
103
|
edit's structure and gets the finished timeline back. Tools that do this are marked
|
|
82
104
|
"(on conform.tools)" in `conformtools --list`, and need an internet connection.
|
|
83
105
|
|
|
106
|
+
## Feedback and privacy
|
|
107
|
+
|
|
108
|
+
When you tell Claude (or any AI app) that a result is wrong, it can send us a report with the
|
|
109
|
+
`report_issue` tool, and it tells you when it has, with a report id. A report contains:
|
|
110
|
+
|
|
111
|
+
- the words the AI wrote: a one-line summary, what happened, what you expected, and the
|
|
112
|
+
session, tool and job it was about
|
|
113
|
+
- the conformtools version and whether timelines were read on this machine or on conform.tools
|
|
114
|
+
- your OS and Node.js version, and the signed-in account
|
|
115
|
+
- the last 20 lines of the engine's own log for that session or job (which tool ran, how long
|
|
116
|
+
it took, whether it failed and the error), with every folder path cut down to the file name:
|
|
117
|
+
`/Volumes/CLIENT/secret/A001.mov` is sent as `A001.mov`
|
|
118
|
+
|
|
119
|
+
When the AI does a post-production task with something other than conformtools (ffprobe, a
|
|
120
|
+
script, steps it asks you to do in your editing app), or finds that conformtools can't do it,
|
|
121
|
+
it sends a short `report_gap` saying what the task was, what it used instead and why, so we
|
|
122
|
+
know which tool to build next. File names at most, never folder paths.
|
|
123
|
+
|
|
124
|
+
Neither report ever sends media, file contents or timeline files. A copy of each report,
|
|
125
|
+
exactly as sent, is kept in `~/.conform-mcp/reports/`.
|
|
126
|
+
|
|
127
|
+
**Outcome telemetry is off unless you turn it on.**
|
|
128
|
+
|
|
129
|
+
```sh
|
|
130
|
+
conformtools telemetry on # or off, or status
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
When it is on it records, for each tool run: the tool's name, whether it worked (or the error
|
|
134
|
+
code), how long it took, the conformtools version, local or conform.tools, and counts such as
|
|
135
|
+
the number of clips, files, or matched and unmatched references (numbers only). For a call
|
|
136
|
+
the AI got wrong (missing or invalid arguments) it records the tool's name and the names of
|
|
137
|
+
the arguments, never their values. It never records paths, file or clip names, timeline
|
|
138
|
+
contents or media. Events are sent in batches at most every 15 minutes, a failed send never
|
|
139
|
+
slows a tool down, and turning it off deletes anything not yet sent. `CONFORM_TELEMETRY=off`
|
|
140
|
+
forces it off on a machine.
|
|
141
|
+
|
|
84
142
|
## Account
|
|
85
143
|
|
|
86
144
|
Every tool except sign-in needs a signed-in account with an active trial or subscription. If you go
|
|
Binary file
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
var Me=Symbol("Let zodToJsonSchema decide on which parser to use");var $e={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},ze=r=>typeof r=="string"?{...$e,name:r}:{...$e,...r};var x;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let s={};for(let i of n)s[i]=i;return s},r.getValidEnumValues=n=>{let s=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(let o of s)i[o]=n[o];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(s){return n[s]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let s=[];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&s.push(i);return s},r.find=(n,s)=>{for(let i of n)if(s(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function a(n,s=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}r.joinValues=a,r.jsonStringifyReplacer=(n,s)=>typeof s=="bigint"?s.toString():s})(x||(x={}));var Le;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Le||(Le={}));var f=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),E=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}};var u=x.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var O=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(s){return s.message},a={_errors:[]},n=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)a._errors.push(t(i));else{let o=a,c=0;for(;c<i.path.length;){let p=i.path[c],g=c===i.path.length-1;if(p==="_errors"){g&&o._errors.push(t(i)),c++;continue}Object.prototype.hasOwnProperty.call(o,p)||(p==="__proto__"?Object.defineProperty(o,p,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):o[p]={_errors:[]}),o=o[p],g&&o._errors.push(t(i)),c++}}};return n(this),a}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t=Object.create(null),a=[];for(let n of this.issues)if(n.path.length>0){let s=n.path[0];t[s]=t[s]||[],t[s].push(e(n))}else a.push(e(n));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}};O.create=r=>new O(r);var xt=(r,e)=>{let t;switch(r.code){case u.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case u.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case u.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}},z=xt;var bt=z;function ne(){return bt}var ge=r=>{let{data:e,path:t,errorMaps:a,issueData:n}=r,s=[...t,...n.path||[]],i={...n,path:s};if(n.message!==void 0)return{...n,path:s,message:n.message};let o="",c=a.filter(p=>!!p).slice().reverse();for(let p of c)o=p(i,{data:e,defaultError:o}).message;return{...n,path:s,message:o}};function l(r,e){let t=ne(),a=ge({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===z?void 0:z].filter(n=>!!n)});r.common.issues.push(a)}var w=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let a=[];for(let n of t){if(n.status==="aborted")return h;n.status==="dirty"&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){let a=[];for(let n of t){let s=await n.key,i=await n.value;a.push({key:s,value:i})}return r.mergeObjectSync(e,a)}static mergeObjectSync(e,t){let a={};for(let n of t){let{key:s,value:i}=n;if(s.status==="aborted"||i.status==="aborted")return h;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(a[s.value]=i.value)}return{status:e.value,value:a}}},h=Object.freeze({status:"aborted"}),B=r=>({status:"dirty",value:r}),A=r=>({status:"valid",value:r}),Te=r=>r.status==="aborted",Oe=r=>r.status==="dirty",F=r=>r.status==="valid",se=r=>typeof Promise<"u"&&r instanceof Promise;var m;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}));var j=class{constructor(e,t,a,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ve=(r,e)=>{if(F(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new O(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:a,description:n}=r;if(e&&(t||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{let{message:c}=r;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??a??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:n}}var v=class{get description(){return this._def.description}_getType(e){return E(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:E(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new w,ctx:{common:e.parent.common,data:e.data,parsedType:E(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(se(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){let a={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:E(e)},n=this._parseSync({data:e,path:a.path,parent:a});return Ve(a,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:E(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:t});return F(a)?{value:a.value}:{issues:t.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>F(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){let a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){let a={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:E(e)},n=this._parse({data:e,path:a.path,parent:a}),s=await(se(n)?n:Promise.resolve(n));return Ve(a,s)}refine(e,t){let a=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,s)=>{let i=e(n),o=()=>s.addIssue({code:u.custom,...a(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((a,n)=>e(a)?!0:(n.addIssue(typeof t=="function"?t(a,n):t),!1))}_refinement(e){return new C({schema:this,typeName:d.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return N.create(this,this._def)}nullable(){return M.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return V.create(this)}promise(){return U.create(this,this._def)}or(e){return Y.create([this,e],this._def)}and(e){return K.create(this,e,this._def)}transform(e){return new C({..._(this._def),schema:this,typeName:d.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new te({..._(this._def),innerType:this,defaultValue:t,typeName:d.ZodDefault})}brand(){return new _e({typeName:d.ZodBranded,type:this,..._(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new re({..._(this._def),innerType:this,catchValue:t,typeName:d.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ve.create(this,e)}readonly(){return ae.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},kt=/^c[^\s-]{8,}$/i,wt=/^[0-9a-z]+$/,At=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Tt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,St=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Pt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,jt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Nt="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",Se,Ct=/^(?:(?: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])$/,Zt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Dt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Rt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Et=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,It=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fe="((\\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])))",$t=new RegExp(`^${Fe}$`);function Ue(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Mt(r){return new RegExp(`^${Ue(r)}$`)}function zt(r){let e=`${Fe}T${Ue(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Lt(r,e){return!!((e==="v4"||!e)&&Ct.test(r)||(e==="v6"||!e)&&Dt.test(r))}function Vt(r,e){if(!St.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let a=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(a));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Ft(r,e){return!!((e==="v4"||!e)&&Zt.test(r)||(e==="v6"||!e)&&Rt.test(r))}var q=class r extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.string,received:s.parsedType}),h}let a=new w,n;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="max")e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,o=e.data.length<s.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?l(n,{code:u.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&l(n,{code:u.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),a.dirty())}else if(s.kind==="email")jt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"email",code:u.invalid_string,message:s.message}),a.dirty());else if(s.kind==="emoji")Se||(Se=new RegExp(Nt,"u")),Se.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"emoji",code:u.invalid_string,message:s.message}),a.dirty());else if(s.kind==="uuid")Tt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"uuid",code:u.invalid_string,message:s.message}),a.dirty());else if(s.kind==="nanoid")Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"nanoid",code:u.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid")kt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid",code:u.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid2")wt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid2",code:u.invalid_string,message:s.message}),a.dirty());else if(s.kind==="ulid")At.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ulid",code:u.invalid_string,message:s.message}),a.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),l(n,{validation:"url",code:u.invalid_string,message:s.message}),a.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"regex",code:u.invalid_string,message:s.message}),a.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),a.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:{startsWith:s.value},message:s.message}),a.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:{endsWith:s.value},message:s.message}),a.dirty()):s.kind==="datetime"?zt(s).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:"datetime",message:s.message}),a.dirty()):s.kind==="date"?$t.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:"date",message:s.message}),a.dirty()):s.kind==="time"?Mt(s).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_string,validation:"time",message:s.message}),a.dirty()):s.kind==="duration"?Pt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"duration",code:u.invalid_string,message:s.message}),a.dirty()):s.kind==="ip"?Lt(e.data,s.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ip",code:u.invalid_string,message:s.message}),a.dirty()):s.kind==="jwt"?Vt(e.data,s.alg)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"jwt",code:u.invalid_string,message:s.message}),a.dirty()):s.kind==="cidr"?Ft(e.data,s.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cidr",code:u.invalid_string,message:s.message}),a.dirty()):s.kind==="base64"?Et.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64",code:u.invalid_string,message:s.message}),a.dirty()):s.kind==="base64url"?It.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64url",code:u.invalid_string,message:s.message}),a.dirty()):x.assertNever(s);return{status:a.value,value:e.data}}_regex(e,t,a){return this.refinement(n=>e.test(n),{validation:t,code:u.invalid_string,...m.errToObj(a)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...m.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...m.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...m.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errToObj(t)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};q.create=r=>new q({checks:[],typeName:d.ZodString,coerce:r?.coerce??!1,..._(r)});function Ut(r,e){let t=(r.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,n=t>a?t:a,s=Number.parseInt(r.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return s%i/10**n}var ie=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){let s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.number,received:s.parsedType}),h}let a,n=new w;for(let s of this._def.checks)s.kind==="int"?x.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{code:u.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:u.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:u.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="multipleOf"?Ut(e.data,s.value)!==0&&(a=this._getOrReturnCtx(e,a),l(a,{code:u.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{code:u.not_finite,message:s.message}),n.dirty()):x.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,a,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:m.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(t===null||a.value>t)&&(t=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}};ie.create=r=>new ie({checks:[],typeName:d.ZodNumber,coerce:r?.coerce||!1,..._(r)});var oe=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let a,n=new w;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:u.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:u.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),l(a,{code:u.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):x.assertNever(s);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return l(t,{code:u.invalid_type,expected:f.bigint,received:t.parsedType}),h}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,a,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:m.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};oe.create=r=>new oe({checks:[],typeName:d.ZodBigInt,coerce:r?.coerce??!1,..._(r)});var ce=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let a=this._getOrReturnCtx(e);return l(a,{code:u.invalid_type,expected:f.boolean,received:a.parsedType}),h}return A(e.data)}};ce.create=r=>new ce({typeName:d.ZodBoolean,coerce:r?.coerce||!1,..._(r)});var ue=class r extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.date,received:s.parsedType}),h}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_date}),h}let a=new w,n;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),a.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):x.assertNever(s);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};ue.create=r=>new ue({checks:[],coerce:r?.coerce||!1,typeName:d.ZodDate,..._(r)});var de=class extends v{_parse(e){if(this._getType(e)!==f.symbol){let a=this._getOrReturnCtx(e);return l(a,{code:u.invalid_type,expected:f.symbol,received:a.parsedType}),h}return A(e.data)}};de.create=r=>new de({typeName:d.ZodSymbol,..._(r)});var J=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let a=this._getOrReturnCtx(e);return l(a,{code:u.invalid_type,expected:f.undefined,received:a.parsedType}),h}return A(e.data)}};J.create=r=>new J({typeName:d.ZodUndefined,..._(r)});var H=class extends v{_parse(e){if(this._getType(e)!==f.null){let a=this._getOrReturnCtx(e);return l(a,{code:u.invalid_type,expected:f.null,received:a.parsedType}),h}return A(e.data)}};H.create=r=>new H({typeName:d.ZodNull,..._(r)});var le=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return A(e.data)}};le.create=r=>new le({typeName:d.ZodAny,..._(r)});var L=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return A(e.data)}};L.create=r=>new L({typeName:d.ZodUnknown,..._(r)});var R=class extends v{_parse(e){let t=this._getOrReturnCtx(e);return l(t,{code:u.invalid_type,expected:f.never,received:t.parsedType}),h}};R.create=r=>new R({typeName:d.ZodNever,..._(r)});var pe=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let a=this._getOrReturnCtx(e);return l(a,{code:u.invalid_type,expected:f.void,received:a.parsedType}),h}return A(e.data)}};pe.create=r=>new pe({typeName:d.ZodVoid,..._(r)});var V=class r extends v{_parse(e){let{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==f.array)return l(t,{code:u.invalid_type,expected:f.array,received:t.parsedType}),h;if(n.exactLength!==null){let i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(l(t,{code:i?u.too_big:u.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(l(t,{code:u.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(l(t,{code:u.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new j(t,i,t.path,o)))).then(i=>w.mergeArray(a,i));let s=[...t.data].map((i,o)=>n.type._parseSync(new j(t,i,t.path,o)));return w.mergeArray(a,s)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}};V.create=(r,e)=>new V({type:r,minLength:null,maxLength:null,exactLength:null,typeName:d.ZodArray,..._(e)});function W(r){if(r instanceof S){let e={};for(let t in r.shape){let a=r.shape[t];e[t]=N.create(W(a))}return new S({...r._def,shape:()=>e})}else return r instanceof V?new V({...r._def,type:W(r.element)}):r instanceof N?N.create(W(r.unwrap())):r instanceof M?M.create(W(r.unwrap())):r instanceof $?$.create(r.items.map(e=>W(e))):r}var S=class r extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==f.object){let p=this._getOrReturnCtx(e);return l(p,{code:u.invalid_type,expected:f.object,received:p.parsedType}),h}let{status:a,ctx:n}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof R&&this._def.unknownKeys==="strip"))for(let p in n.data)i.includes(p)||o.push(p);let c=[];for(let p of i){let g=s[p],P=n.data[p];c.push({key:{status:"valid",value:p},value:g._parse(new j(n,P,n.path,p)),alwaysSet:p in n.data})}if(this._def.catchall instanceof R){let p=this._def.unknownKeys;if(p==="passthrough")for(let g of o)c.push({key:{status:"valid",value:g},value:{status:"valid",value:n.data[g]}});else if(p==="strict")o.length>0&&(l(n,{code:u.unrecognized_keys,keys:o}),a.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let g of o){let P=n.data[g];c.push({key:{status:"valid",value:g},value:p._parse(new j(n,P,n.path,g)),alwaysSet:g in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let p=[];for(let g of c){let P=await g.key,Ie=await g.value;p.push({key:P,value:Ie,alwaysSet:g.alwaysSet})}return p}).then(p=>w.mergeObjectSync(a,p)):w.mergeObjectSync(a,c)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,a)=>{let n=this._def.errorMap?.(t,a).message??a.defaultError;return t.code==="unrecognized_keys"?{message:m.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:d.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let a of x.objectKeys(e))e[a]&&this.shape[a]&&(t[a]=this.shape[a]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let a of x.objectKeys(this.shape))e[a]||(t[a]=this.shape[a]);return new r({...this._def,shape:()=>t})}deepPartial(){return W(this)}partial(e){let t={};for(let a of x.objectKeys(this.shape)){let n=this.shape[a];e&&!e[a]?t[a]=n:t[a]=n.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let a of x.objectKeys(this.shape))if(e&&!e[a])t[a]=this.shape[a];else{let s=this.shape[a];for(;s instanceof N;)s=s._def.innerType;t[a]=s}return new r({...this._def,shape:()=>t})}keyof(){return Be(x.objectKeys(this.shape))}};S.create=(r,e)=>new S({shape:()=>r,unknownKeys:"strip",catchall:R.create(),typeName:d.ZodObject,..._(e)});S.strictCreate=(r,e)=>new S({shape:()=>r,unknownKeys:"strict",catchall:R.create(),typeName:d.ZodObject,..._(e)});S.lazycreate=(r,e)=>new S({shape:r,unknownKeys:"strip",catchall:R.create(),typeName:d.ZodObject,..._(e)});var Y=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),a=this._def.options;function n(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map(o=>new O(o.ctx.common.issues));return l(t,{code:u.invalid_union,unionErrors:i}),h}if(t.common.async)return Promise.all(a.map(async s=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let s,i=[];for(let c of a){let p={...t,common:{...t.common,issues:[]},parent:null},g=c._parseSync({data:t.data,path:t.path,parent:p});if(g.status==="valid")return g;g.status==="dirty"&&!s&&(s={result:g,ctx:p}),p.common.issues.length&&i.push(p.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map(c=>new O(c));return l(t,{code:u.invalid_union,unionErrors:o}),h}}get options(){return this._def.options}};Y.create=(r,e)=>new Y({options:r,typeName:d.ZodUnion,..._(e)});var I=r=>r instanceof G?I(r.schema):r instanceof C?I(r.innerType()):r instanceof Q?[r.value]:r instanceof X?r.options:r instanceof ee?x.objectValues(r.enum):r instanceof te?I(r._def.innerType):r instanceof J?[void 0]:r instanceof H?[null]:r instanceof N?[void 0,...I(r.unwrap())]:r instanceof M?[null,...I(r.unwrap())]:r instanceof _e||r instanceof ae?I(r.unwrap()):r instanceof re?I(r._def.innerType):[],Pe=class r extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return l(t,{code:u.invalid_type,expected:f.object,received:t.parsedType}),h;let a=this.discriminator,n=t.data[a],s=this.optionsMap.get(n);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:u.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){let n=new Map;for(let s of t){let i=I(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,s)}}return new r({typeName:d.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,..._(a)})}};function je(r,e){let t=E(r),a=E(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&a===f.object){let n=x.objectKeys(e),s=x.objectKeys(r).filter(o=>n.indexOf(o)!==-1),i={...r,...e};Object.prototype.hasOwnProperty.call(i,"__proto__")&&delete i.__proto__;for(let o of s){if(o==="__proto__")continue;let c=je(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===f.array&&a===f.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let s=0;s<r.length;s++){let i=r[s],o=e[s],c=je(i,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===f.date&&a===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var K=class extends v{_parse(e){let{status:t,ctx:a}=this._processInputParams(e),n=(s,i)=>{if(Te(s)||Te(i))return h;let o=je(s.value,i.value);return o.valid?((Oe(s)||Oe(i))&&t.dirty(),{status:t.value,value:o.data}):(l(a,{code:u.invalid_intersection_types}),h)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([s,i])=>n(s,i)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};K.create=(r,e,t)=>new K({left:r,right:e,typeName:d.ZodIntersection,..._(t)});var $=class r extends v{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==f.array)return l(a,{code:u.invalid_type,expected:f.array,received:a.parsedType}),h;if(a.data.length<this._def.items.length)return l(a,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&a.data.length>this._def.items.length&&(l(a,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...a.data].map((i,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new j(a,i,a.path,o)):null}).filter(i=>!!i);return a.common.async?Promise.all(s).then(i=>w.mergeArray(t,i)):w.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};$.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $({items:r,typeName:d.ZodTuple,rest:null,..._(e)})};var Ne=class r extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==f.object)return l(a,{code:u.invalid_type,expected:f.object,received:a.parsedType}),h;let n=[],s=this._def.keyType,i=this._def.valueType;for(let o in a.data)n.push({key:s._parse(new j(a,o,a.path,o)),value:i._parse(new j(a,a.data[o],a.path,o)),alwaysSet:o in a.data});return a.common.async?w.mergeObjectAsync(t,n):w.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,a){return t instanceof v?new r({keyType:e,valueType:t,typeName:d.ZodRecord,..._(a)}):new r({keyType:q.create(),valueType:e,typeName:d.ZodRecord,..._(t)})}},fe=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==f.map)return l(a,{code:u.invalid_type,expected:f.map,received:a.parsedType}),h;let n=this._def.keyType,s=this._def.valueType,i=[...a.data.entries()].map(([o,c],p)=>({key:n._parse(new j(a,o,a.path,[p,"key"])),value:s._parse(new j(a,c,a.path,[p,"value"]))}));if(a.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of i){let p=await c.key,g=await c.value;if(p.status==="aborted"||g.status==="aborted")return h;(p.status==="dirty"||g.status==="dirty")&&t.dirty(),o.set(p.value,g.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let c of i){let p=c.key,g=c.value;if(p.status==="aborted"||g.status==="aborted")return h;(p.status==="dirty"||g.status==="dirty")&&t.dirty(),o.set(p.value,g.value)}return{status:t.value,value:o}}}};fe.create=(r,e,t)=>new fe({valueType:e,keyType:r,typeName:d.ZodMap,..._(t)});var me=class r extends v{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==f.set)return l(a,{code:u.invalid_type,expected:f.set,received:a.parsedType}),h;let n=this._def;n.minSize!==null&&a.data.size<n.minSize.value&&(l(a,{code:u.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&a.data.size>n.maxSize.value&&(l(a,{code:u.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let s=this._def.valueType;function i(c){let p=new Set;for(let g of c){if(g.status==="aborted")return h;g.status==="dirty"&&t.dirty(),p.add(g.value)}return{status:t.value,value:p}}let o=[...a.data.values()].map((c,p)=>s._parse(new j(a,c,a.path,p)));return a.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new r({...this._def,minSize:{value:e,message:m.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:m.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};me.create=(r,e)=>new me({valueType:r,minSize:null,maxSize:null,typeName:d.ZodSet,..._(e)});var Ce=class r extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return l(t,{code:u.invalid_type,expected:f.function,received:t.parsedType}),h;function a(o,c){return ge({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ne(),z].filter(p=>!!p),issueData:{code:u.invalid_arguments,argumentsError:c}})}function n(o,c){return ge({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ne(),z].filter(p=>!!p),issueData:{code:u.invalid_return_type,returnTypeError:c}})}let s={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof U){let o=this;return A(async function(...c){let p=new O([]),g=await o._def.args.parseAsync(c,s).catch(Ae=>{throw p.addIssue(a(c,Ae)),p}),P=await Reflect.apply(i,this,g);return await o._def.returns._def.type.parseAsync(P,s).catch(Ae=>{throw p.addIssue(n(P,Ae)),p})})}else{let o=this;return A(function(...c){let p=o._def.args.safeParse(c,s);if(!p.success)throw new O([a(c,p.error)]);let g=Reflect.apply(i,this,p.data),P=o._def.returns.safeParse(g,s);if(!P.success)throw new O([n(g,P.error)]);return P.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:$.create(e).rest(L.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new r({args:e||$.create([]).rest(L.create()),returns:t||L.create(),typeName:d.ZodFunction,..._(a)})}},G=class extends v{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};G.create=(r,e)=>new G({getter:r,typeName:d.ZodLazy,..._(e)});var Q=class extends v{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}};Q.create=(r,e)=>new Q({value:r,typeName:d.ZodLiteral,..._(e)});function Be(r,e){return new X({values:r,typeName:d.ZodEnum,..._(e)})}var X=class r extends v{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),a=this._def.values;return l(t,{expected:x.joinValues(a),received:t.parsedType,code:u.invalid_type}),h}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),a=this._def.values;return l(t,{received:t.data,code:u.invalid_enum_value,options:a}),h}return A(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(a=>!e.includes(a)),{...this._def,...t})}};X.create=Be;var ee=class extends v{_parse(e){let t=x.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==f.string&&a.parsedType!==f.number){let n=x.objectValues(t);return l(a,{expected:x.joinValues(n),received:a.parsedType,code:u.invalid_type}),h}if(this._cache||(this._cache=new Set(x.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=x.objectValues(t);return l(a,{received:a.data,code:u.invalid_enum_value,options:n}),h}return A(e.data)}get enum(){return this._def.values}};ee.create=(r,e)=>new ee({values:r,typeName:d.ZodNativeEnum,..._(e)});var U=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return l(t,{code:u.invalid_type,expected:f.promise,received:t.parsedType}),h;let a=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return A(a.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};U.create=(r,e)=>new U({type:r,typeName:d.ZodPromise,..._(e)});var C=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===d.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:a}=this._processInputParams(e),n=this._def.effect||null,s={addIssue:i=>{l(a,i),i.fatal?t.abort():t.dirty()},get path(){return a.path}};if(s.addIssue=s.addIssue.bind(s),n.type==="preprocess"){let i=n.transform(a.data,s);if(a.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return h;let c=await this._def.schema._parseAsync({data:o,path:a.path,parent:a});return c.status==="aborted"?h:c.status==="dirty"?B(c.value):t.value==="dirty"?B(c.value):c});{if(t.value==="aborted")return h;let o=this._def.schema._parseSync({data:i,path:a.path,parent:a});return o.status==="aborted"?h:o.status==="dirty"?B(o.value):t.value==="dirty"?B(o.value):o}}if(n.type==="refinement"){let i=o=>{let c=n.refinement(o,s);if(a.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?h:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>o.status==="aborted"?h:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(a.common.async===!1){let i=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!F(i))return h;let o=n.transform(i.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(i=>F(i)?Promise.resolve(n.transform(i.value,s)).then(o=>({status:t.value,value:o})):h);x.assertNever(n)}};C.create=(r,e,t)=>new C({schema:r,typeName:d.ZodEffects,effect:e,..._(t)});C.createWithPreprocess=(r,e,t)=>new C({schema:e,effect:{type:"preprocess",transform:r},typeName:d.ZodEffects,..._(t)});var N=class extends v{_parse(e){return this._getType(e)===f.undefined?A(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};N.create=(r,e)=>new N({innerType:r,typeName:d.ZodOptional,..._(e)});var M=class extends v{_parse(e){return this._getType(e)===f.null?A(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};M.create=(r,e)=>new M({innerType:r,typeName:d.ZodNullable,..._(e)});var te=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),a=t.data;return t.parsedType===f.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};te.create=(r,e)=>new te({innerType:r,typeName:d.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var re=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return se(n)?n.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new O(a.common.issues)},input:a.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new O(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};re.create=(r,e)=>new re({innerType:r,typeName:d.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var he=class extends v{_parse(e){if(this._getType(e)!==f.nan){let a=this._getOrReturnCtx(e);return l(a,{code:u.invalid_type,expected:f.nan,received:a.parsedType}),h}return{status:"valid",value:e.data}}};he.create=r=>new he({typeName:d.ZodNaN,..._(r)});var gr=Symbol("zod_brand"),_e=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}},ve=class r extends v{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return s.status==="aborted"?h:s.status==="dirty"?(t.dirty(),B(s.value)):this._def.out._parseAsync({data:s.value,path:a.path,parent:a})})();{let n=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?h:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:a.path,parent:a})}}static create(e,t){return new r({in:e,out:t,typeName:d.ZodPipeline})}},ae=class extends v{_parse(e){let t=this._def.innerType._parse(e),a=n=>(F(n)&&(n.value=Object.freeze(n.value)),n);return se(t)?t.then(n=>a(n)):a(t)}unwrap(){return this._def.innerType}};ae.create=(r,e)=>new ae({innerType:r,typeName:d.ZodReadonly,..._(e)});var _r={object:S.lazycreate},d;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(d||(d={}));var vr=q.create,xr=ie.create,br=he.create,kr=oe.create,wr=ce.create,Ar=ue.create,Tr=de.create,Or=J.create,Sr=H.create,Pr=le.create,jr=L.create,Nr=R.create,Cr=pe.create,Zr=V.create,Dr=S.create,Rr=S.strictCreate,Er=Y.create,Ir=Pe.create,$r=K.create,Mr=$.create,zr=Ne.create,Lr=fe.create,Vr=me.create,Fr=Ce.create,Ur=G.create,Br=Q.create,Wr=X.create,qr=ee.create,Jr=U.create,Hr=C.create,Yr=N.create,Kr=M.create,Gr=C.createWithPreprocess,Qr=ve.create;var xe=(r,e)=>{let t=0;for(;t<r.length&&t<e.length&&r[t]===e[t];t++);return[(r.length-t).toString(),...e.slice(t)].join("/")};function k(r){if(r.target!=="openAi")return{};let e=[...r.basePath,r.definitionPath,r.openAiAnyTypeName];return r.flags.hasReferencedOpenAiAnyType=!0,{$ref:r.$refStrategy==="relative"?xe(e,r.currentPath):e.join("/")}}function Ze(r,e,t,a){a?.errorMessages&&t&&(r.errorMessage={...r.errorMessage,[e]:t})}function b(r,e,t,a,n){r[e]=t,Ze(r,e,a,n)}function We(r,e){let t={type:"array"};return r.type?._def&&r.type?._def?.typeName!==d.ZodAny&&(t.items=y(r.type._def,{...e,currentPath:[...e.currentPath,"items"]})),r.minLength&&b(t,"minItems",r.minLength.value,r.minLength.message,e),r.maxLength&&b(t,"maxItems",r.maxLength.value,r.maxLength.message,e),r.exactLength&&(b(t,"minItems",r.exactLength.value,r.exactLength.message,e),b(t,"maxItems",r.exactLength.value,r.exactLength.message,e)),t}function qe(r,e){let t={type:"integer",format:"int64"};if(!r.checks)return t;for(let a of r.checks)switch(a.kind){case"min":e.target==="jsonSchema7"?a.inclusive?b(t,"minimum",a.value,a.message,e):b(t,"exclusiveMinimum",a.value,a.message,e):(a.inclusive||(t.exclusiveMinimum=!0),b(t,"minimum",a.value,a.message,e));break;case"max":e.target==="jsonSchema7"?a.inclusive?b(t,"maximum",a.value,a.message,e):b(t,"exclusiveMaximum",a.value,a.message,e):(a.inclusive||(t.exclusiveMaximum=!0),b(t,"maximum",a.value,a.message,e));break;case"multipleOf":b(t,"multipleOf",a.value,a.message,e);break}return t}function Je(){return{type:"boolean"}}function be(r,e){return y(r.type._def,e)}var He=(r,e)=>y(r.innerType._def,e);function De(r,e,t){let a=t??e.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,s)=>De(r,e,n))};switch(a){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Bt(r,e)}}var Bt=(r,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let a of r.checks)switch(a.kind){case"min":b(t,"minimum",a.value,a.message,e);break;case"max":b(t,"maximum",a.value,a.message,e);break}return t};function Ye(r,e){return{...y(r.innerType._def,e),default:r.defaultValue()}}function Ke(r,e){return e.effectStrategy==="input"?y(r.schema._def,e):k(e)}function Ge(r){return{type:"string",enum:Array.from(r.values)}}var Wt=r=>"type"in r&&r.type==="string"?!1:"allOf"in r;function Qe(r,e){let t=[y(r.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),y(r.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),a=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return t.forEach(s=>{if(Wt(s))n.push(...s.allOf),s.unevaluatedProperties===void 0&&(a=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:o,...c}=s;i=c}else a=void 0;n.push(i)}}),n.length?{allOf:n,...a}:void 0}function Xe(r,e){let t=typeof r.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(r.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[r.value]}:{type:t==="bigint"?"integer":t,const:r.value}}var Re,Z={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Re===void 0&&(Re=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Re),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function ke(r,e){let t={type:"string"};if(r.checks)for(let a of r.checks)switch(a.kind){case"min":b(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,a.value):a.value,a.message,e);break;case"max":b(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,a.value):a.value,a.message,e);break;case"email":switch(e.emailStrategy){case"format:email":D(t,"email",a.message,e);break;case"format:idn-email":D(t,"idn-email",a.message,e);break;case"pattern:zod":T(t,Z.email,a.message,e);break}break;case"url":D(t,"uri",a.message,e);break;case"uuid":D(t,"uuid",a.message,e);break;case"regex":T(t,a.regex,a.message,e);break;case"cuid":T(t,Z.cuid,a.message,e);break;case"cuid2":T(t,Z.cuid2,a.message,e);break;case"startsWith":T(t,RegExp(`^${Ee(a.value,e)}`),a.message,e);break;case"endsWith":T(t,RegExp(`${Ee(a.value,e)}$`),a.message,e);break;case"datetime":D(t,"date-time",a.message,e);break;case"date":D(t,"date",a.message,e);break;case"time":D(t,"time",a.message,e);break;case"duration":D(t,"duration",a.message,e);break;case"length":b(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,a.value):a.value,a.message,e),b(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,a.value):a.value,a.message,e);break;case"includes":{T(t,RegExp(Ee(a.value,e)),a.message,e);break}case"ip":{a.version!=="v6"&&D(t,"ipv4",a.message,e),a.version!=="v4"&&D(t,"ipv6",a.message,e);break}case"base64url":T(t,Z.base64url,a.message,e);break;case"jwt":T(t,Z.jwt,a.message,e);break;case"cidr":{a.version!=="v6"&&T(t,Z.ipv4Cidr,a.message,e),a.version!=="v4"&&T(t,Z.ipv6Cidr,a.message,e);break}case"emoji":T(t,Z.emoji(),a.message,e);break;case"ulid":{T(t,Z.ulid,a.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{D(t,"binary",a.message,e);break}case"contentEncoding:base64":{b(t,"contentEncoding","base64",a.message,e);break}case"pattern:zod":{T(t,Z.base64,a.message,e);break}}break}case"nanoid":T(t,Z.nanoid,a.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function Ee(r,e){return e.patternStrategy==="escape"?Jt(r):r}var qt=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Jt(r){let e="";for(let t=0;t<r.length;t++)qt.has(r[t])||(e+="\\"),e+=r[t];return e}function D(r,e,t,a){r.format||r.anyOf?.some(n=>n.format)?(r.anyOf||(r.anyOf=[]),r.format&&(r.anyOf.push({format:r.format,...r.errorMessage&&a.errorMessages&&{errorMessage:{format:r.errorMessage.format}}}),delete r.format,r.errorMessage&&(delete r.errorMessage.format,Object.keys(r.errorMessage).length===0&&delete r.errorMessage)),r.anyOf.push({format:e,...t&&a.errorMessages&&{errorMessage:{format:t}}})):b(r,"format",e,t,a)}function T(r,e,t,a){r.pattern||r.allOf?.some(n=>n.pattern)?(r.allOf||(r.allOf=[]),r.pattern&&(r.allOf.push({pattern:r.pattern,...r.errorMessage&&a.errorMessages&&{errorMessage:{pattern:r.errorMessage.pattern}}}),delete r.pattern,r.errorMessage&&(delete r.errorMessage.pattern,Object.keys(r.errorMessage).length===0&&delete r.errorMessage)),r.allOf.push({pattern:et(e,a),...t&&a.errorMessages&&{errorMessage:{pattern:t}}})):b(r,"pattern",et(e,a),t,a)}function et(r,e){if(!e.applyRegexFlags||!r.flags)return r.source;let t={i:r.flags.includes("i"),m:r.flags.includes("m"),s:r.flags.includes("s")},a=t.i?r.source.toLowerCase():r.source,n="",s=!1,i=!1,o=!1;for(let c=0;c<a.length;c++){if(s){n+=a[c],s=!1;continue}if(t.i){if(i){if(a[c].match(/[a-z]/)){o?(n+=a[c],n+=`${a[c-2]}-${a[c]}`.toUpperCase(),o=!1):a[c+1]==="-"&&a[c+2]?.match(/[a-z]/)?(n+=a[c],o=!0):n+=`${a[c]}${a[c].toUpperCase()}`;continue}}else if(a[c].match(/[a-z]/)){n+=`[${a[c]}${a[c].toUpperCase()}]`;continue}}if(t.m){if(a[c]==="^"){n+=`(^|(?<=[\r
|
|
4
|
+
]))`;continue}else if(a[c]==="$"){n+=`($|(?=[\r
|
|
5
|
+
]))`;continue}}if(t.s&&a[c]==="."){n+=i?`${a[c]}\r
|
|
6
|
+
`:`[${a[c]}\r
|
|
7
|
+
]`;continue}n+=a[c],a[c]==="\\"?s=!0:i&&a[c]==="]"?i=!1:!i&&a[c]==="["&&(i=!0)}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),r.source}return n}function we(r,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&r.keyType?._def.typeName===d.ZodEnum)return{type:"object",required:r.keyType._def.values,properties:r.keyType._def.values.reduce((a,n)=>({...a,[n]:y(r.valueType._def,{...e,currentPath:[...e.currentPath,"properties",n]})??k(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:y(r.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(r.keyType?._def.typeName===d.ZodString&&r.keyType._def.checks?.length){let{type:a,...n}=ke(r.keyType._def,e);return{...t,propertyNames:n}}else{if(r.keyType?._def.typeName===d.ZodEnum)return{...t,propertyNames:{enum:r.keyType._def.values}};if(r.keyType?._def.typeName===d.ZodBranded&&r.keyType._def.type._def.typeName===d.ZodString&&r.keyType._def.type._def.checks?.length){let{type:a,...n}=be(r.keyType._def,e);return{...t,propertyNames:n}}}return t}function tt(r,e){if(e.mapStrategy==="record")return we(r,e);let t=y(r.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||k(e),a=y(r.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||k(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,a],minItems:2,maxItems:2}}}function rt(r){let e=r.values,a=Object.keys(r.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),n=Array.from(new Set(a.map(s=>typeof s)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:a}}function at(r){return r.target==="openAi"?void 0:{not:k({...r,currentPath:[...r.currentPath,"not"]})}}function nt(r){return r.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var ye={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function it(r,e){if(e.target==="openApi3")return st(r,e);let t=r.options instanceof Map?Array.from(r.options.values()):r.options;if(t.every(a=>a._def.typeName in ye&&(!a._def.checks||!a._def.checks.length))){let a=t.reduce((n,s)=>{let i=ye[s._def.typeName];return i&&!n.includes(i)?[...n,i]:n},[]);return{type:a.length>1?a:a[0]}}else if(t.every(a=>a._def.typeName==="ZodLiteral"&&!a.description)){let a=t.reduce((n,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...n,i];case"bigint":return[...n,"integer"];case"object":if(s._def.value===null)return[...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(a.length===t.length){let n=a.filter((s,i,o)=>o.indexOf(s)===i);return{type:n.length>1?n:n[0],enum:t.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(t.every(a=>a._def.typeName==="ZodEnum"))return{type:"string",enum:t.reduce((a,n)=>[...a,...n._def.values.filter(s=>!a.includes(s))],[])};return st(r,e)}var st=(r,e)=>{let t=(r.options instanceof Map?Array.from(r.options.values()):r.options).map((a,n)=>y(a._def,{...e,currentPath:[...e.currentPath,"anyOf",`${n}`]})).filter(a=>!!a&&(!e.strictUnions||typeof a=="object"&&Object.keys(a).length>0));return t.length?{anyOf:t}:void 0};function ot(r,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(r.innerType._def.typeName)&&(!r.innerType._def.checks||!r.innerType._def.checks.length))return e.target==="openApi3"?{type:ye[r.innerType._def.typeName],nullable:!0}:{type:[ye[r.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let a=y(r.innerType._def,{...e,currentPath:[...e.currentPath]});return a&&"$ref"in a?{allOf:[a],nullable:!0}:a&&{...a,nullable:!0}}let t=y(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function ct(r,e){let t={type:"number"};if(!r.checks)return t;for(let a of r.checks)switch(a.kind){case"int":t.type="integer",Ze(t,"type",a.message,e);break;case"min":e.target==="jsonSchema7"?a.inclusive?b(t,"minimum",a.value,a.message,e):b(t,"exclusiveMinimum",a.value,a.message,e):(a.inclusive||(t.exclusiveMinimum=!0),b(t,"minimum",a.value,a.message,e));break;case"max":e.target==="jsonSchema7"?a.inclusive?b(t,"maximum",a.value,a.message,e):b(t,"exclusiveMaximum",a.value,a.message,e):(a.inclusive||(t.exclusiveMaximum=!0),b(t,"maximum",a.value,a.message,e));break;case"multipleOf":b(t,"multipleOf",a.value,a.message,e);break}return t}function ut(r,e){let t=e.target==="openAi",a={type:"object",properties:{}},n=[],s=r.shape();for(let o in s){let c=s[o];if(c===void 0||c._def===void 0)continue;let p=Yt(c);p&&t&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),p=!1);let g=y(c._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});g!==void 0&&(a.properties[o]=g,p||n.push(o))}n.length&&(a.required=n);let i=Ht(r,e);return i!==void 0&&(a.additionalProperties=i),a}function Ht(r,e){if(r.catchall._def.typeName!=="ZodNever")return y(r.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(r.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Yt(r){try{return r.isOptional()}catch{return!0}}var dt=(r,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return y(r.innerType._def,e);let t=y(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:k(e)},t]}:k(e)};var lt=(r,e)=>{if(e.pipeStrategy==="input")return y(r.in._def,e);if(e.pipeStrategy==="output")return y(r.out._def,e);let t=y(r.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),a=y(r.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,a].filter(n=>n!==void 0)}};function pt(r,e){return y(r.type._def,e)}function ft(r,e){let a={type:"array",uniqueItems:!0,items:y(r.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return r.minSize&&b(a,"minItems",r.minSize.value,r.minSize.message,e),r.maxSize&&b(a,"maxItems",r.maxSize.value,r.maxSize.message,e),a}function mt(r,e){return r.rest?{type:"array",minItems:r.items.length,items:r.items.map((t,a)=>y(t._def,{...e,currentPath:[...e.currentPath,"items",`${a}`]})).reduce((t,a)=>a===void 0?t:[...t,a],[]),additionalItems:y(r.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:r.items.length,maxItems:r.items.length,items:r.items.map((t,a)=>y(t._def,{...e,currentPath:[...e.currentPath,"items",`${a}`]})).reduce((t,a)=>a===void 0?t:[...t,a],[])}}function ht(r){return{not:k(r)}}function yt(r){return k(r)}var gt=(r,e)=>y(r.innerType._def,e);var _t=(r,e,t)=>{switch(e){case d.ZodString:return ke(r,t);case d.ZodNumber:return ct(r,t);case d.ZodObject:return ut(r,t);case d.ZodBigInt:return qe(r,t);case d.ZodBoolean:return Je();case d.ZodDate:return De(r,t);case d.ZodUndefined:return ht(t);case d.ZodNull:return nt(t);case d.ZodArray:return We(r,t);case d.ZodUnion:case d.ZodDiscriminatedUnion:return it(r,t);case d.ZodIntersection:return Qe(r,t);case d.ZodTuple:return mt(r,t);case d.ZodRecord:return we(r,t);case d.ZodLiteral:return Xe(r,t);case d.ZodEnum:return Ge(r);case d.ZodNativeEnum:return rt(r);case d.ZodNullable:return ot(r,t);case d.ZodOptional:return dt(r,t);case d.ZodMap:return tt(r,t);case d.ZodSet:return ft(r,t);case d.ZodLazy:return()=>r.getter()._def;case d.ZodPromise:return pt(r,t);case d.ZodNaN:case d.ZodNever:return at(t);case d.ZodEffects:return Ke(r,t);case d.ZodAny:return k(t);case d.ZodUnknown:return yt(t);case d.ZodDefault:return Ye(r,t);case d.ZodBranded:return be(r,t);case d.ZodReadonly:return gt(r,t);case d.ZodCatch:return He(r,t);case d.ZodPipeline:return lt(r,t);case d.ZodFunction:case d.ZodVoid:case d.ZodSymbol:return;default:return(a=>{})(e)}};function y(r,e,t=!1){let a=e.seen.get(r);if(e.override){let o=e.override?.(r,e,a,t);if(o!==Me)return o}if(a&&!t){let o=Kt(a,e);if(o!==void 0)return o}let n={def:r,path:e.currentPath,jsonSchema:void 0};e.seen.set(r,n);let s=_t(r,r.typeName,e),i=typeof s=="function"?y(s(),e):s;if(i&&Gt(r,e,i),e.postProcess){let o=e.postProcess(i,r,e);return n.jsonSchema=i,o}return n.jsonSchema=i,i}var Kt=(r,e)=>{switch(e.$refStrategy){case"root":return{$ref:r.path.join("/")};case"relative":return{$ref:xe(e.currentPath,r.path)};case"none":case"seen":return r.path.length<e.currentPath.length&&r.path.every((t,a)=>e.currentPath[a]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),k(e)):e.$refStrategy==="seen"?k(e):void 0}},Gt=(r,e,t)=>(r.description&&(t.description=r.description,e.markdownDescription&&(t.markdownDescription=r.description)),t);var vt=r=>{let e=ze(r),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([a,n])=>[n._def,{def:n._def,path:[...e.basePath,e.definitionPath,a],jsonSchema:void 0}]))}};var Qt=(r,e)=>{let t=vt(e),a=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[p,g])=>({...c,[p]:y(g._def,{...t,currentPath:[...t.basePath,t.definitionPath,p]},!0)??k(t)}),{}):void 0,n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=y(r._def,n===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,n]},!1)??k(t),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(s.title=i),t.flags.hasReferencedOpenAiAnyType&&(a||(a={}),a[t.openAiAnyTypeName]||(a[t.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:t.$refStrategy==="relative"?"1":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join("/")}}));let o=n===void 0?a?{...s,[t.definitionPath]:a}:s:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,n].join("/"),[t.definitionPath]:{...a,[n]:s}};return t.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};export{Dr as a,Qt as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{a as s,b as m}from"./chunk-DKGGJM6Z.js";import{Aa as d,Ca as n,U as c,o as u}from"./chunk-R6WJ6JIQ.js";async function x(r){await n();let e=c(r);return e==="null"?null:JSON.parse(e)}async function p(r){await n();let e;try{e=u(r)}catch{return null}if(e.length<8)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=t.getUint32(0,!0),i=t.getUint32(4,!0),o=a*i*4;return e.length<8+o?null:{width:a,height:i,rgba:new Uint8ClampedArray(e.subarray(8,8+o))}}async function y(r,e=8){await n();let t=m(d,"decode_dpx_preview");if(!t)return p(r);try{return s(t(r,e))}catch{return null}}export{x as a,p as b,y as c};
|