@skyramp/testbot-core 0.13.2-v3.542 → 0.13.2-v3.544
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/VERSION.json +1 -1
- package/dist/data-safety-worker.js +1 -1
- package/dist/main.js +482 -481
- package/dist/post.js +67 -67
- package/dist/runner-client.cjs +11 -11
- package/package.json +1 -1
package/dist/VERSION.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.13.2-v3.
|
|
1
|
+
{"version":"0.13.2-v3.544","commit":"0cd839eb662e074bd1500197e00d1c6dbf4394aa"}
|
|
@@ -185,7 +185,7 @@ ${c}`:c:"",l=Function,d=`return (input) => {
|
|
|
185
185
|
${c}
|
|
186
186
|
}`,f;try{f=new l(...s,d)(...a)}catch(g){throw new oe(`this schema (generated code failed to evaluate: ${g.message})`)}return t?.debug&&(f.code=A),f.definite=i.definite,f}function q(e,t){for(let[i,r]of e.constants)if(r===t)return i;let n=`c${e.constantCounter++}`;return e.constants.set(n,t),n}function Ki(e,t){return e.definite=!1,q(e,t)}function P(e){return`v${e.varCounter++}`}function W9(e,t){let n=e._zod.run({value:t,issues:[]},{});if(n&&typeof n.then=="function")return ut;let i=n;return i.issues.length===0?i.value:ut}function et(e,t,n,i,r=!0){let o=e.content.length,s=t.constants.size,a=t.constantCounter,c=t.varCounter;try{return ke(e,t,n,i,r)}catch(A){if(!(A instanceof oe)||!A.islandable)throw A;if(e.content.length=o,t.constants.size>s){let l=Array.from(t.constants.keys()).slice(s);for(let d of l)t.constants.delete(d)}return t.constantCounter=a,t.varCounter=c,Z9(e,t,n,i)}}function Z9(e,t,n,i){t.definite=!1;let r=q(t,n),o=q(t,W9),s=P(t);return e.write(`const ${s} = ${o}(${r}, ${i});`),e.write(`if (${s} === INVALID) return INVALID;`),s}var K9=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function X9(e,t,n,i){let r=n._zod.def.checks;if(!r||r.length===0)return i;let o=i;for(let s of r){let a=s._zod.def;if(a.when&&!K9.has(a.check))throw new oe('check with a custom "when" condition');switch(a.check){case"greater_than":eK(e,t,a,o);break;case"less_than":tK(e,t,a,o);break;case"multiple_of":rK(e,t,a,o);break;case"number_format":KU(e,a,o);break;case"min_length":{let c=On(a.minimum,"min_length"),A=Yy(e,t,o,`${o}.length >= ${c} && ${o}.length < ${a.minimum*2}`);e.write(`if (${A} < ${c}) return INVALID;`);break}case"max_length":{let c=On(a.maximum,"max_length"),A=Yy(e,t,o,`${o}.length > ${c}`);e.write(`if (${A} > ${c}) return INVALID;`);break}case"length_equals":{let c=On(a.length,"length_equals"),A=Yy(e,t,o,`${o}.length >= ${c} && ${o}.length <= ${a.length*2}`);e.write(`if (${A} !== ${c}) return INVALID;`);break}case"min_size":e.write(`if (${o}.size < ${On(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${o}.size > ${On(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${o}.size !== ${On(a.size,"size_equals")}) return INVALID;`);break;case"string_format":o=XU(e,t,a,o);break;case"custom":o=cK(e,t,s,o);break;case"bigint_format":nK(e,a,o);break;case"mime_type":iK(e,t,a,o);break;case"property":sK(e,t,a,o);break;case"properties":oK(e,t,a,o);break;case"overwrite":{let c=P(t);aK(e,t,s,o,c),o=c;break}default:throw new oe(`check type ${a.check}`)}}return o}function Yy(e,t,n,i){let r=q(t,ji),o=P(t);return e.write(`const ${o} = typeof ${n} === "string" && ${i} ? ${r}(${n}) : ${n}.length;`),o}function On(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new oe(`${t} bound of type ${typeof e}`);return`${e}`}function ZU(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new oe("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new oe("comparison check with Invalid Date bound");return q(e,t)}throw new oe(`comparison check bound of type ${typeof t}`)}function eK(e,t,n,i){let r=n.inclusive?"<":"<=";e.write(`if (${i} ${r} ${ZU(t,n.value)}) return INVALID;`)}function tK(e,t,n,i){let r=n.inclusive?">":">=";e.write(`if (${i} ${r} ${ZU(t,n.value)}) return INVALID;`)}function rK(e,t,n,i){if(typeof n.value=="bigint"){if(n.value===BigInt(0))throw new oe("multiple_of check with a zero divisor");e.write(`if (${i} % ${n.value}n !== 0n) return INVALID;`)}else{let r=q(t,hc);e.write(`if (${r}(${i}, ${On(n.value,"multiple_of")}) !== 0) return INVALID;`)}}function KU(e,t,n){let i=t.format;switch(i){case"safeint":e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${n})) return INVALID;`);break;default:throw new oe(`number format ${i}`)}}function nK(e,t,n){let i=t.format;if(i)switch(i){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break;default:throw new oe(`bigint format ${i}`)}}function iK(e,t,n,i){let r=n.mime;if(r&&r.length>0){let o=q(t,new Set(r));e.write(`if (!${o}.has(${i}.type)) return INVALID;`)}}function oK(e,t,n,i){if(n.when)throw new oe('check with a custom "when" condition');e.write(`if (${i} == null) return INVALID;`);let r=n.shape;for(let o of Reflect.ownKeys(r)){let s=typeof o=="symbol"?q(t,o):ct(o),a=P(t);e.write(`const ${a} = ${i}[${s}];`),et(e,t,r[o],a,!1)}}function sK(e,t,n,i){let r=`${i}[${JSON.stringify(n.property)}]`;ke(e,t,n.schema,r)}function aK(e,t,n,i,r){let o=n._zod.def.tx;if(!o)throw new oe("overwrite check without a transform function");if(Xi(o))throw new yr("z.compile: async overwrite transforms are not supported");let s=q(t,o);e.write(`const ${r} = ${s}(${i});`)}function jy(){throw new Qt}function Wy(e){this.issues.push(e)}function cK(e,t,n,i){let r=n._zod.def;if(r.fn){if(Xi(r.fn))throw new yr("z.compile: async .refine() predicates are not supported");let o=Ki(t,r.fn),s=q(t,jy),a=P(t);return e.write(`const ${a} = ${o}(${i});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`),i}if(n._zod.check){if(Xi(n._zod.check))throw new yr("z.compile: async .superRefine() / check functions are not supported");let o=n._zod.check,a=Ki(t,A=>{let l={value:A,issues:[],addIssue:Wy};return o(l)instanceof Promise&&jy(),l.issues.length===0?l.value:ut}),c=P(t);return e.write(`const ${c} = ${a}(${i});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new oe("custom check without a predicate or check function")}var AK=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function XU(e,t,n,i,r=!0){let o=n.format;if(o==="base64"){let A=q(t,$c);return e.write(`if (!${A}(${i})) return INVALID;`),i}if(o==="base64url"){let A=q(t,hd);return e.write(`if (!${A}(${i})) return INVALID;`),i}if(o==="jwt"){let A=q(t,Ed),l=q(t,n.alg??null);return e.write(`if (!${A}(${i}, ${l})) return INVALID;`),i}if(o==="ipv6"){let A=q(t,Tc);return e.write(`if (!${A}(${i})) return INVALID;`),i}if(o==="cidrv6"){let A=q(t,gd);return e.write(`if (!${A}(${i})) return INVALID;`),i}if(o==="credit_card"){let A=q(t,md);return e.write(`if (!${A}(${i})) return INVALID;`),i}if(o==="iban"){let A=q(t,Id);return e.write(`if (!${A}(${i})) return INVALID;`),i}let s=n;if(o==="url"||o==="httpurl"||s.normalize||s.hostname!==void 0||s.protocol!==void 0){let A=q(t,ld),l=q(t,n),d=P(t),f=P(t);if(e.write(`const ${d} = ${i}.trim();`),e.write(`const ${f} = ${A}(${d}, ${l});`),e.write(`if (typeof ${f} === "number") return INVALID;`),s.hostname!==void 0){let h=q(t,dd);e.write(`if (!${h}(${f}, ${l}.hostname)) return INVALID;`)}if(s.protocol!==void 0){let h=q(t,fd);e.write(`if (!${h}(${f}, ${l}.protocol)) return INVALID;`)}if(!r)return null;let g=P(t),p=s.normalize?`${f}.href`:`${q(t,Uc)}(${d})`;return e.write(`const ${g} = ${p};`),g}let a=n.fn;if(a){if(Xi(a))throw new oe(`async string format ${o}`);let A=q(t,a);return e.write(`if (!${A}(${i})) return INVALID;`),i}if(AK.has(o)&&n.pattern){let A=q(t,n.pattern);return e.write(`${A}.lastIndex = 0;`),e.write(`if (!${A}.test(${i})) return INVALID;`),i}let c=n.format;switch(c){case"regex":throw new oe("regex format without a pattern");case"lowercase":e.write(`if (${i} !== ${i}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${i} !== ${i}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${i}.includes(${ct(n.includes)})) return INVALID;`);break;case"starts_with":{let A=n.prefix;e.write(`if (${i}.slice(0, ${A.length}) !== ${ct(A)}) return INVALID;`);break}case"ends_with":{let A=n.suffix;e.write(`if (${i}.slice(-${A.length}) !== ${ct(A)}) return INVALID;`);break}default:throw new oe(`string format ${c}`)}return i}function ke(e,t,n,i,r=!0){let o=n._zod.def,s=o.type;if(o.coerce)throw new oe(`coercion (z.coerce.${s}())`);let a=r||!!o.checks?.length,c;switch(s){case"string":c=uK(e,t,n,i,a);break;case"number":c=lK(e,n,i);break;case"boolean":c=dK(e,i);break;case"bigint":c=fK(e,n,i);break;case"symbol":c=gK(e,i);break;case"undefined":c=pK(e,i);break;case"null":c=hK(e,i);break;case"any":case"unknown":c=i;break;case"never":e.write("return INVALID;"),c=i;break;case"void":c=mK(e,i);break;case"nan":c=IK(e,i);break;case"date":c=EK(e,i);break;case"object":c=yK(e,t,n,i,a);break;case"optional":c=CK(e,t,n,i,a);break;case"nullable":c=vK(e,t,n,i,a);break;case"array":c=wK(e,t,n,i,a);break;case"literal":c=bK(e,t,n,i);break;case"enum":c=kK(e,t,n,i);break;case"readonly":{let A=HU(e,t,n,i),l=P(t);e.write(`const ${l} = Object.freeze(${A});`),c=l;break}case"success":HU(e,t,n,i),c="true";break;case"default":case"prefault":c=SK(e,t,n,i);break;case"nonoptional":c=xK(e,t,n,i);break;case"tuple":c=RK(e,t,n,i);break;case"union":c=DK(e,t,n,i);break;case"intersection":c=UK(e,t,n,i);break;case"record":c=TK(e,t,n,i);break;case"map":c=FK(e,t,n,i);break;case"set":c=MK(e,t,n,i);break;case"file":c=LK(e,i);break;case"template_literal":c=PK(e,t,n,i);break;case"lazy":c=OK(e,t,n,i);break;case"pipe":c=zK(e,t,n,i);break;case"custom":c=GK(e,t,n,i);break;case"transform":c=YK(e,t,n,i);break;case"catch":c=JK(e,t,n,i);break;default:throw new oe(`schema type ${s}`)}return c===null?null:X9(e,t,n,c)}function uK(e,t,n,i,r=!0){e.write(`if (typeof ${i} !== "string") return INVALID;`);let o=n._zod.def;return o.format===void 0?i:XU(e,t,o,i,r)}function lK(e,t,n){e.write(`if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`);let i=t._zod.def;return i.check==="number_format"&&i.format&&KU(e,{format:i.format},n),n}function dK(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function fK(e,t,n){e.write(`if (typeof ${n} !== "bigint") return INVALID;`);let i=t._zod.def;if(i.format)switch(i.format){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break}return n}function gK(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function pK(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function hK(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function mK(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function IK(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function EK(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function yK(e,t,n,i,r=!0){let o=n._zod.def;e.write(`if (typeof ${i} !== "object" || ${i} === null || Array.isArray(${i})) return INVALID;`);let s=o.shape,a=Object.keys(s),c=Object.getOwnPropertySymbols(s),A=c.length?[...a,...c]:a,l=C=>typeof C=="symbol"?q(t,C):ct(C),d=C=>typeof C=="symbol"?`[${l(C)}]`:ct(C),f=s;if(a.includes("__proto__"))throw new oe('object shape key "__proto__"');let g=new Map;for(let C of A){let v=f[C],b=l(C),$=P(t);if(e.write(`const ${$} = ${i}[${b}];`),v._zod.optin!==void 0){let T=P(t);e.write(`let ${T} = (() => {`),e.indented(K=>{let Se=et(K,t,v,$);K.write(`return ${Se};`)}),e.write("})();"),v._zod.optout==="optional"?(e.write(`if (${T} === INVALID) {`),e.indented(K=>{K.write(`if (${b} in ${i}) return INVALID;`),K.write(`${T} = undefined;`)}),e.write("}")):e.write(`if (${T} === INVALID) return INVALID;`),g.set(C,T)}else{QK(v)&&e.write(`if (!(${b} in ${i})) return INVALID;`);let T=et(e,t,v,$,r);T!==null&&g.set(C,T)}}let p=o.catchall,h="none";if(p){let C=p._zod.def.type;if(C==="never"){let v=a.map(b=>`k !== ${ct(b)}`).join(" && ")||"true";e.write(`for (const k in ${i}) {`),e.indented(b=>{b.write(`if (${v}) return INVALID;`)}),e.write("}")}else(C==="unknown"||C==="any")&&!p._zod.def.checks?.length?h="passthrough":h="schema"}let E=P(t),m=A.some(C=>jU(f[C])||Hy(f[C]));if(!r){if(h==="schema"){let C=a.length>0?q(t,new Set(a)):null;e.write(`for (const k in ${i}) {`),e.indented(v=>{v.write('if (k === "__proto__") continue;'),C&&v.write(`if (${C}.has(k)) continue;`);let b=P(t);v.write(`const ${b} = ${i}[k];`),et(v,t,p,b,!1)}),e.write("}")}return null}if(m){e.write(`const ${E} = {};`);for(let C of A){let v=l(C),b=g.get(C);Hy(f[C])?e.write(`if (${v} in ${i}) ${E}[${v}] = ${b};`):jU(f[C])?e.write(`if (${b} !== undefined || ${v} in ${i}) ${E}[${v}] = ${b};`):e.write(`${E}[${v}] = ${b};`)}}else{let C=A.map(v=>`${d(v)}: ${g.get(v)}`).join(", ");e.write(`const ${E} = { ${C} };`)}if(h!=="none"){let C=a.length>0?q(t,new Set(a)):null;e.write(`for (const k in ${i}) {`),e.indented(v=>{if(v.write('if (k === "__proto__") continue;'),C&&v.write(`if (${C}.has(k)) continue;`),h==="passthrough")v.write(`${E}[k] = ${i}[k];`);else{let b=P(t);v.write(`const ${b} = ${i}[k];`);let $=et(v,t,p,b);v.write(`${E}[k] = ${$};`)}}),e.write("}")}return E}function CK(e,t,n,i,r=!0){let o=n._zod.def;if(BK(n))return ke(e,t,o.innerType,i,r);if(o.innerType._zod.optin==="defaulted"){let a=P(t),c=P(t);return e.write(`let ${a};`),e.write(`if (${i} === undefined) {`),e.indented(A=>{A.write(`const ${c} = (() => {`),A.indented(l=>{let d=ke(l,t,o.innerType,i);l.write(`return ${d};`)}),A.write("})();"),A.write(`if (${c} !== INVALID) ${a} = ${c};`)}),e.write("} else {"),e.indented(A=>{let l=ke(A,t,o.innerType,i);A.write(`${a} = ${l};`)}),e.write("}"),a}let s=r?P(t):null;return s&&e.write(`let ${s};`),e.write(`if (${i} !== undefined) {`),e.indented(a=>{let c=ke(a,t,o.innerType,i,r);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function BK(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function QK(e){return e._zod.optin===void 0&&Zi(e)}function Zi(e){if(e._zod.def.coerce)return!0;let t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?Zi(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?Zi(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Zi):!0;case"intersection":return!t.left||!t.right?!0:Zi(t.left)&&Zi(t.right);case"pipe":return t.in?Zi(t.in):!0;default:return!0}}function Hy(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function jU(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&_s(e)}function _s(e){let t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?_s(t.innerType):!0;case"union":return t.options?t.options.some(_s):!0;case"intersection":return!t.left||!t.right||_s(t.left)||_s(t.right);case"pipe":return t.out?_s(t.out):!0;default:return!0}}function vK(e,t,n,i,r=!0){let o=n._zod.def,s=r?P(t):null;return s&&e.write(`let ${s} = null;`),e.write(`if (${i} !== null) {`),e.indented(a=>{let c=ke(a,t,o.innerType,i,r);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function Zy(e,t,n){for(let[i,r]of Bs(t._zod.def.checks))e.write(`if (${n} > ${On(i,r._zod.def.check)}) return INVALID;`)}function wK(e,t,n,i,r=!0){let o=n._zod.def;e.write(`if (!Array.isArray(${i})) return INVALID;`),Zy(e,n,`${i}.length`);let s=r?P(t):null,a=P(t),c=P(t);return s&&e.write(`const ${s} = new Array(${i}.length);`),e.write(`for (let ${a} = 0; ${a} < ${i}.length; ${a}++) {`),e.indented(A=>{A.write(`const ${c} = ${i}[${a}];`);let l=et(A,t,o.element,c,r);s&&l!==null&&A.write(`${s}[${a}] = ${l};`)}),e.write("}"),s}function bK(e,t,n,i){let o=n._zod.def.values;if(o.length!==1){let a=q(t,new Set(o));return e.write(`if (!${a}.has(${i})) return INVALID;`),i}let s=o[0];if(typeof s=="number"&&Number.isNaN(s)){let a=q(t,new Set(o));return e.write(`if (!${a}.has(${i})) return INVALID;`),i}if(typeof s=="string")e.write(`if (${i} !== ${ct(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")e.write(`if (${i} !== ${s}) return INVALID;`);else if(s===null)e.write(`if (${i} !== null) return INVALID;`);else if(s===void 0)e.write(`if (${i} !== undefined) return INVALID;`);else if(typeof s=="bigint")e.write(`if (${i} !== ${s}n) return INVALID;`);else throw new oe(`literal type ${typeof s}`);return i}function kK(e,t,n,i){let r=n._zod.values;if(!r)throw new oe("enum schema without enumerated values");let o=q(t,r);return e.write(`if (!${o}.has(${i})) return INVALID;`),i}function HU(e,t,n,i){let r=n._zod.def;return ke(e,t,r.innerType,i)}function SK(e,t,n,i){let r=n._zod.def,s=Object.getOwnPropertyDescriptor(n._zod.def,"defaultValue")?()=>n._zod.def.defaultValue:void 0;if(n._zod.def.type==="prefault"){if(!s)return ke(e,t,r.innerType,i);let c=q(t,s),A=P(t);return e.write(`let ${A} = ${i};`),e.write(`if (${i} === undefined) ${A} = ${c}();`),ke(e,t,r.innerType,A)}let a=P(t);if(s){let c=q(t,s),A=q(t,mc);e.write(`let ${a};`),e.write(`if (${i} === undefined) {`),e.indented(l=>{l.write(`${a} = ${A}(${c}());`)}),e.write("} else {"),e.indented(l=>{let d=ke(l,t,r.innerType,i);l.write(`${a} = ${d} === undefined ? ${A}(${c}()) : ${d};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${i} !== undefined) {`),e.indented(c=>{let A=ke(c,t,r.innerType,i);c.write(`${a} = ${A};`)}),e.write("}");return a}function xK(e,t,n,i){let r=n._zod.def,o=ke(e,t,r.innerType,i),s=P(t);return e.write(`const ${s} = ${o};`),e.write(`if (${s} === undefined) return INVALID;`),s}function RK(e,t,n,i){let r=n._zod.def,o=r.items,s=r.rest;e.write(`if (!Array.isArray(${i})) return INVALID;`);let a=qU(o,"optin"),c=qU(o,"optout");s?e.write(`if (${i}.length < ${a}) return INVALID;`):e.write(`if (${i}.length < ${a} || ${i}.length > ${o.length}) return INVALID;`);let A=P(t);e.write(`const ${A} = [];`);for(let l=0;l<o.length;l++){let d=o[l];if(l>=c)e.write(`if (${A}.length === ${l}) {`),e.indented(f=>{f.write(`if (${l} < ${i}.length) {`),f.indented(g=>{let p=P(t);g.write(`const ${p} = ${i}[${l}];`);let h=et(g,t,d,p);g.write(`${A}[${l}] = ${h};`)}),f.write("} else {"),f.indented(g=>{if(Hy(d)){g.write(`${A}.length = ${l};`);return}let p=P(t),h=P(t);g.write(`const ${p} = undefined;`),g.write(`const ${h} = (() => {`),g.indented(E=>{let m=et(E,t,d,p);E.write(`return ${m};`)}),g.write("})();"),g.write(`if (${h} === INVALID || ${h} === undefined) ${A}.length = ${l};`),g.write(`else ${A}[${l}] = ${h};`)}),f.write("}")}),e.write("}");else{let f=P(t);e.write(`const ${f} = ${i}[${l}];`);let g=et(e,t,d,f);e.write(`${A}[${l}] = ${g};`)}}if(s){let l=P(t),d=P(t);e.write(`for (let ${l} = ${o.length}; ${l} < ${i}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${d} = ${i}[${l}];`);let g=et(f,t,s,d);f.write(`${A}[${l}] = ${g};`)}),e.write("}")}return A}function qU(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function DK(e,t,n,i){let r=n._zod.def,o=r.options;if(r.discriminator)return _K(e,t,r,i);if(r.inclusive===!1)throw new oe("exclusive unions (z.xor)");if(o.length===0)return e.write("return INVALID;"),i;if(o.length===1)return ke(e,t,o[0],i);if(o.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(o.flatMap(l=>l._zod.def.values)),A=q(t,c);return e.write(`if (!${A}.has(${i})) return INVALID;`),i}let a=P(t);e.write(`let ${a};`);for(let c=0;c<o.length;c++){let A=o[c];c===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(l=>{let d=ke(l,t,A,i);l.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function _K(e,t,n,i){if(n.unionFallback)throw new oe("discriminated union with unionFallback");if(n.options.length===0)return e.write("return INVALID;"),i;let r=P(t),o=P(t);e.write(`const ${r} = ${i}?.[${ct(n.discriminator)}];`),e.write(`let ${o};`);let s=!0,a=new Set;for(let c of n.options){let A=c._zod.propValues?.[n.discriminator];if(!A||A.size===0)throw new oe("discriminated union option without static discriminator values");for(let f of A){if(a.has(f))throw new oe(`duplicate discriminator value ${String(f)}`);a.add(f)}let l=Array.from(A,f=>NK(t,r,f)),d=s?"if":"else if";e.write(`${d} (${l.join(" || ")}) {`),e.indented(f=>{let g=ke(f,t,c,i);f.write(`${o} = ${g};`)}),e.write("}"),s=!1}return e.write("else { return INVALID; }"),o}function NK(e,t,n){if(typeof n=="string")return`${t} === ${ct(n)}`;if(typeof n=="number")return Number.isNaN(n)?`Number.isNaN(${t})`:`${t} === ${n}`;if(typeof n=="boolean")return`${t} === ${n}`;if(n===null)return`${t} === null`;if(n===void 0)return`${t} === undefined`;if(typeof n=="bigint")return`${t} === ${n}n`;if(typeof n=="symbol"){let i=q(e,n);return`${t} === ${i}`}throw new oe(`literal discriminator value ${String(n)}`)}function UK(e,t,n,i){let r=n._zod.def;t.definite=!1;let o=et(e,t,r.left,i),s=et(e,t,r.right,i),a=q(t,xs),c=P(t);return e.write(`const ${c} = ${a}(${o}, ${s});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function TK(e,t,n,i){let r=n._zod.def,o=q(t,Xt);e.write(`if (!${o}(${i})) return INVALID;`);let s=P(t),a=P(t),c=P(t);e.write(`const ${s} = {};`);let A=r,l=A.partial?void 0:r.keyType._zod.values;if(l){let g=[];for(let h of l){if(!(typeof h=="string"||typeof h=="number"||typeof h=="symbol"))throw new oe(`record key value ${String(h)}`);let E=typeof h=="number"?h.toString():h;if(E==="__proto__")throw new oe('record key "__proto__"');g.push(E);let m=q(t,h),C=ke(e,t,r.keyType,m),v=P(t);e.write(`const ${v} = ${i}[${$K(t,E)}];`);let b=et(e,t,r.valueType,v);e.write(`${s}[${C}] = ${b};`)}let p=q(t,new Set(g));return e.write(`for (const ${a} in ${i}) {`),e.indented(h=>{h.write(`if (${p}.has(${a})) continue;`),A.mode==="loose"?h.write(`if (${a} !== "__proto__") ${s}[${a}] = ${i}[${a}];`):h.write("return INVALID;")}),e.write("}"),s}let d=r.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let g=r.mode==="loose",p=Fd(r.keyType);p.definite===!1&&(t.definite=!1);let h=q(t,p),E=q(t,ln),m=P(t);return WU(e,t,i,a,C=>{C.write(`let ${m} = ${h}(${a});`),C.write(`if (${m} === INVALID && typeof ${a} === "string" && ${E}.test(${a})) ${m} = ${h}(Number(${a}));`),g?C.write(`if (${m} === INVALID) { ${s}[${a}] = ${i}[${a}]; continue; }`):C.write(`if (${m} === INVALID) return INVALID;`),C.write(`if (${m} === "__proto__") continue;`);let v=P(t);C.write(`const ${v} = ${i}[${a}];`);let b=et(C,t,r.valueType,v);C.write(`${s}[${m}] = ${b};`)}),s}return WU(e,t,i,a,g=>{g.write(`const ${c} = ${i}[${a}];`);let p=et(g,t,r.valueType,c);g.write(`${s}[${a}] = ${p};`)},"return INVALID;"),s}function WU(e,t,n,i,r,o){let s=q(t,Object.prototype.propertyIsEnumerable),a=P(t),c=P(t),A=P(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${n});`),e.write(`const ${c} = Object.getOwnPropertyNames(${n});`),e.write(`for (let ${A} = 0; ${A} < ${c}.length; ${A}++) {`),e.indented(l=>{l.write(`const ${i} = ${c}[${A}];`),l.write(`if (${i} === "__proto__" || !${s}.call(${n}, ${i})) continue;`),r(l)}),e.write("}"),e.write(`for (let ${A} = 0; ${A} < ${a}.length; ${A}++) {`),e.indented(l=>{l.write(`const ${i} = ${a}[${A}];`),l.write(`if (!${s}.call(${n}, ${i})) continue;`),o?l.write(o):r(l)}),e.write("}")}function $K(e,t){return typeof t=="string"?ct(t):q(e,t)}function FK(e,t,n,i){let r=n._zod.def;e.write(`if (!(${i} instanceof Map)) return INVALID;`),Zy(e,n,`${i}.size`);let o=P(t),s=P(t),a=P(t);return e.write(`const ${o} = new Map();`),e.write(`for (const [${s}, ${a}] of ${i}) {`),e.indented(c=>{let A=ke(c,t,r.keyType,s),l=ke(c,t,r.valueType,a);c.write(`${o}.set(${A}, ${l});`)}),e.write("}"),o}function MK(e,t,n,i){let r=n._zod.def;e.write(`if (!(${i} instanceof Set)) return INVALID;`),Zy(e,n,`${i}.size`);let o=P(t),s=P(t);return e.write(`const ${o} = new Set();`),e.write(`for (const ${s} of ${i}) {`),e.indented(a=>{let c=ke(a,t,r.valueType,s);a.write(`${o}.add(${c});`)}),e.write("}"),o}function LK(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function PK(e,t,n,i){e.write(`if (typeof ${i} !== "string") return INVALID;`);let r=n._zod.pattern;if(r){let o=q(t,r);e.write(`${o}.lastIndex = 0;`),e.write(`if (!${o}.test(${i})) return INVALID;`)}return i}function OK(e,t,n,i){let r=n._zod.def,o=Ki(t,r.getter),s=q(t,{parser:null});e.write(`if (!${s}.parser) {`),e.indented(c=>{c.write(`const inner = ${o}();`),c.write(`${s}.parser = function(input) {`),c.indented(A=>{A.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),A.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),e.write("}");let a=P(t);return e.write(`const ${a} = ${s}.parser(${i});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function zK(e,t,n,i){let r=n._zod.def,o=ke(e,t,r.in,i);if(r.transform){if(Xi(r.transform))throw new yr("z.compile: async transforms in pipes are not supported");let s=r.transform,c=Ki(t,l=>{let d={value:l,issues:[],addIssue:Wy},f=s(l,d);return f instanceof Promise?ut:d.issues.length===0?f:ut}),A=P(t);return e.write(`const ${A} = ${c}(${o});`),e.write(`if (${A} === INVALID) return INVALID;`),ke(e,t,r.out,A)}else return ke(e,t,r.out,o)}function Xi(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function GK(e,t,n,i){let r=n._zod.def;if(r.fn){if(Xi(r.fn))throw new yr("z.compile: async custom predicates are not supported");let o=Ki(t,r.fn),s=q(t,jy),a=P(t);e.write(`const ${a} = ${o}(${i});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`)}else throw new oe("custom schema without a predicate function");return i}function VK(e,t,n){let i=e._zod.run({value:n,issues:[]},{});if(i&&typeof i.then=="function")return ut;let r=i;return r.issues.length===0?r.value:t()}function JK(e,t,n,i){let r=n._zod.def;if(!r.catchValue[zl])throw new oe("catch with a callback (only a constant catch value compiles)",!1);let o=P(t);e.write(`let ${o} = (() => {`),e.indented(A=>{let l=et(A,t,r.innerType,i);A.write(`return ${l};`)}),e.write("})();");let s=q(t,r.innerType),a=Ki(t,r.catchValue),c=q(t,VK);return e.write(`if (${o} === INVALID) {`),e.indented(A=>{A.write(`${o} = ${c}(${s}, ${a}, ${i});`),A.write(`if (${o} === INVALID) return INVALID;`)}),e.write("}"),o}function YK(e,t,n,i){let r=n._zod.def;if(r.transform){if(Xi(r.transform))throw new yr("z.compile: async transforms are not supported");let o=r.transform,a=Ki(t,A=>{let l={value:A,issues:[],addIssue:Wy},d=o(A,l);return d instanceof Promise?ut:l.issues.length===0?d:ut}),c=P(t);return e.write(`const ${c} = ${a}(${i});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return i}function Md(e){return e.checks&&(e.checks=[...e.checks]),e}function Ky(e,t){return new e(Md({type:"string",...x(t)}))}function Xy(e,t){return new e(Md({type:"string",coerce:!0,...x(t)}))}function Ld(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...x(t)})}function Pd(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...x(t)})}function Od(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...x(t)})}function zd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...x(t)})}function Gd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...x(t)})}function Vd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...x(t)})}function jc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...x(t)})}function Jd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...x(t)})}function Yd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...x(t)})}function jd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...x(t)})}function Hd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...x(t)})}function qd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...x(t)})}function Wd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...x(t)})}function Zd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...x(t)})}function Kd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...x(t)})}function Xd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...x(t)})}function eC(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...x(t)})}function ef(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...x(t)})}function tf(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...x(t)})}function rf(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...x(t)})}function nf(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...x(t)})}function of(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...x(t)})}function tC(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...x(t)})}function rC(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...x(t)})}function sf(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...x(t)})}var nC={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Hc(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...x(t)})}function qc(e,t){return new e({type:"string",format:"date",check:"string_format",...x(t)})}function Wc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...x(t)})}function Zc(e,t){return new e({type:"string",format:"duration",check:"string_format",...x(t)})}function iC(e,t){return new e(Md({type:"number",checks:[],...x(t)}))}function oC(e,t){return new e(Md({type:"number",coerce:!0,checks:[],...x(t)}))}function sC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...x(t)})}function aC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...x(t)})}function cC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...x(t)})}function AC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...x(t)})}function uC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...x(t)})}function lC(e,t){return new e({type:"boolean",...x(t)})}function dC(e,t){return new e({type:"boolean",coerce:!0,...x(t)})}function fC(e,t){return new e({type:"bigint",...x(t)})}function gC(e,t){return new e({type:"bigint",coerce:!0,...x(t)})}function pC(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...x(t)})}function hC(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...x(t)})}function mC(e,t){return new e({type:"symbol",...x(t)})}function IC(e,t){return new e({type:"undefined",...x(t)})}function EC(e,t){return new e({type:"null",...x(t)})}function yC(e){return new e({type:"any"})}function CC(e){return new e({type:"unknown"})}function BC(e,t){return new e({type:"never",...x(t)})}function QC(e,t){return new e({type:"void",...x(t)})}function vC(e,t){return new e({type:"date",...x(t)})}function wC(e,t){return new e({type:"date",coerce:!0,...x(t)})}function bC(e,t){return new e({type:"nan",...x(t)})}function Or(e,t){return new id({check:"less_than",...x(t),value:e,inclusive:!1})}function Mt(e,t){return new id({check:"less_than",...x(t),value:e,inclusive:!0})}function zr(e,t){return new od({check:"greater_than",...x(t),value:e,inclusive:!1})}function Lt(e,t){return new od({check:"greater_than",...x(t),value:e,inclusive:!0})}function af(e){return zr(0,e)}function cf(e){return Or(0,e)}function Af(e){return Mt(0,e)}function uf(e){return Lt(0,e)}function zn(e,t){return new cE({check:"multiple_of",...x(t),value:e})}function Gn(e,t){return new lE({check:"max_size",...x(t),maximum:e})}function Gr(e,t){return new dE({check:"min_size",...x(t),minimum:e})}function eo(e,t){return new fE({check:"size_equals",...x(t),size:e})}function to(e,t){return new gE({check:"max_length",...x(t),maximum:e})}function dn(e,t){return new pE({check:"min_length",...x(t),minimum:e})}function ro(e,t){return new hE({check:"length_equals",...x(t),length:e})}function Ns(e,t){return new mE({check:"string_format",format:"regex",...x(t),pattern:e})}function Us(e){return new IE({check:"string_format",format:"lowercase",...x(e)})}function Ts(e){return new EE({check:"string_format",format:"uppercase",...x(e)})}function $s(e,t){return new yE({check:"string_format",format:"includes",...x(t),includes:e})}function Fs(e,t){return new CE({check:"string_format",format:"starts_with",...x(t),prefix:e})}function Ms(e,t){return new BE({check:"string_format",format:"ends_with",...x(t),suffix:e})}function lf(e,t,n){return new QE({check:"property",property:e,schema:t,...x(n)})}function Ls(e,t){return new vE({check:"properties",shape:e,...x(t)})}function Ps(e,t){return new wE({check:"mime_type",mime:e,...x(t)})}function Cr(e){return new bE({check:"overwrite",tx:e})}function Os(e){return Cr(t=>t.normalize(e))}function zs(){return Cr(e=>e.trim())}function Gs(){return Cr(e=>e.toLowerCase())}function Vs(){return Cr(e=>e.toUpperCase())}function Js(){return Cr(e=>uI(e))}function kC(e,t,n){return new e({type:"array",element:t,...x(n)})}function jK(e,t,n){return new e({type:"union",options:t,...x(n)})}function HK(e,t,n){return new e({type:"union",options:t,inclusive:!1,...x(n)})}function qK(e,t,n,i){return new e({type:"union",options:n,discriminator:t,...x(i)})}function WK(e,t,n){return new e({type:"intersection",left:t,right:n})}function ZK(e,t,n,i){let r=n instanceof Z,o=r?i:n,s=r?n:null;return new e({type:"tuple",items:t,rest:s,...x(o)})}function KK(e,t,n,i){return new e({type:"record",keyType:t,valueType:n,...x(i)})}function XK(e,t,n,i){return new e({type:"map",keyType:t,valueType:n,...x(i)})}function e8(e,t,n){return new e({type:"set",valueType:t,...x(n)})}function t8(e,t,n){let i=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new e({type:"enum",entries:i,...x(n)})}function r8(e,t,n){return new e({type:"enum",entries:t,...x(n)})}function n8(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...x(n)})}function SC(e,t){return new e({type:"file",...x(t)})}function i8(e,t){return new e({type:"transform",transform:t})}function o8(e,t){return new e({type:"optional",innerType:t})}function s8(e,t){return new e({type:"nullable",innerType:t})}function a8(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():mc(n)}})}function c8(e,t,n){return new e({type:"nonoptional",innerType:t,...x(n)})}function A8(e,t){return new e({type:"success",innerType:t})}function u8(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:hI(n)})}function l8(e,t,n){return new e({type:"pipe",in:t,out:n})}function d8(e,t){return new e({type:"readonly",innerType:t})}function f8(e,t,n){return new e({type:"template_literal",parts:t,...x(n)})}function g8(e,t){return new e({type:"lazy",getter:t})}function p8(e,t){return new e({type:"promise",innerType:t})}function xC(e,t,n){let i=x(n);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}function RC(e,t,n){return new e({type:"custom",check:"custom",fn:t,...x(n)})}function DC(e,t){let n=eT(i=>(i.addIssue=r=>{if(typeof r=="string")i.issues.push(Qs(r,i.value,n._zod.def));else{let o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=i.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),i.issues.push(Qs(o))}},e(i.value,i)),t);return n}function eT(e,t){let n=new ye({check:"custom",...x(t)});return n._zod.check=e,n}function _C(e){let t=new ye({check:"describe"});return t._zod.onattach=[n=>{let i=He.get(n)??{};He.add(n,{...i,description:e})}],t._zod.check=()=>{},t}function NC(e){let t=new ye({check:"meta"});return t._zod.onattach=[n=>{let i=He.get(n)??{};He.add(n,{...i,...e})}],t._zod.check=()=>{},t}function UC(e,t){let n=x(t),i=n.truthy??["true","1","yes","on","y","enabled"],r=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(i=i.map(g=>typeof g=="string"?g.toLowerCase():g),r=r.map(g=>typeof g=="string"?g.toLowerCase():g));let o=new Set(i),s=new Set(r),a=e.Codec??Pc,c=e.Boolean??Mc,A=e.String??Wi,l=new A({type:"string",error:n.error}),d=new c({type:"boolean",error:n.error}),f=new a({type:"pipe",in:l,out:d,transform:((g,p)=>{let h=g;return n.case!=="sensitive"&&(h=h.toLowerCase()),o.has(h)?!0:s.has(h)?!1:(p.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...s],input:p.value,inst:f,continue:!1}),{})}),reverseTransform:((g,p)=>g===!0?i[0]||"true":r[0]||"false"),error:n.error});return f._zod.bag.truthy=i,f._zod.bag.falsy=r,f._zod.bag.case=n.case??"insensitive",f}function no(e,t,n,i={}){let r=x(i),o={check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...r};return n instanceof RegExp&&(o.pattern=n),new e(o)}function Kc(e,...t){for(let n of t)for(let i of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,i)&&je(e,i,n[i]);return e}function Vn(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??He,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 Fe(e,t,n,i,r){let o=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:i.path,message:r}):t.unrepresentable;if(o==="any")return!1;if(o===void 0||o==="throw")throw new Error(r);return Object.assign(n,o),!0}function pe(e,t,n={path:[],schemaPath:[]}){var i;let r=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let f=s.schema,g=t.processors[r.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);g(e,t,f,l)}let d=e._zod.parent;d&&(s.ref||(s.ref=d),pe(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Kc(s.schema,c),t.io==="input"&<(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function tT(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Jn(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let i=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=i.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,s[0])}}let r=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,f=e.external.uri??(p=>p);if(d)return{ref:f(d)};let g=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=g,{defId:g,ref:`${f("__shared")}#/${a}/${tT(g)}`}}let c="#",A=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:A+tT(l)}},o=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:A}=r(s);a.def={...a.schema},A&&(a.defId=A);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
187
187
|
|
|
188
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){o(s);continue}if(e.external){let A=e.external.registry.get(s[0])?.id;if(t!==s[0]&&A){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}a.count>1&&e.reused==="ref"&&o(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function iT(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let i of t){if(!i||typeof i!="object")return;iT(i);let r=Object.keys(i);if(r.length!==1||r[0]!=="type")return;let o=i.type;for(let s of Array.isArray(o)?o:[o]){if(typeof s!="string")return;n.includes(s)||n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var oT=new Set(["type","properties","required","additionalProperties"]),rT=["oneOf","anyOf"];function nT(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function TC(e){let t=[];for(let o of e){if(typeof o!="object"||o.type!=="object")return null;for(let s in o)if(!oT.has(s))return null;t.push(o)}let n={},i=new Set;for(let o of t){for(let s in o.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let A of t){let l=A.properties?.[s]??nT(A);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:TC(a)??{allOf:a};je(n,s,c)}for(let s of o.required??[])i.add(s)}let r={type:"object",properties:n};if(i.size&&(r.required=[...i]),t.every(o=>o.additionalProperties===!1))r.additionalProperties=!1;else{let o=[];for(let s of t){let a=nT(s);a&&!o.some(c=>JSON.stringify(c)===JSON.stringify(a))&&o.push(a)}o.length===1?r.additionalProperties=o[0]:o.length>1&&(r.additionalProperties={allOf:o})}return r}function h8(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let r of oT)if(r in e)return;let n=t.filter(r=>rT.some(o=>Array.isArray(r[o]))),i=null;if(!n.length)i=TC(t);else{let r=n[0],o=rT.find(c=>Array.isArray(r[c]));if(Object.keys(r).length!==1)return;let s=t.filter(c=>c!==r),a=r[o].map(c=>TC([...s,c]));if(a.some(c=>!c))return;i={[o]:a}}i&&(delete e.allOf,Kc(e,i))}function Yn(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=a=>{let c=e.seen.get(a);if(c.ref===null)return;let A=c.def??c.schema,l={...A},d=c.ref;if(c.ref=null,d){i(d);let g=e.seen.get(d),p=g.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(A.allOf=A.allOf??[],A.allOf.push(p)):Kc(A,p),Kc(A,l),a._zod.parent===d)for(let E in A)E==="$ref"||E==="allOf"||E in l||delete A[E];if(p.$ref&&g.def)for(let E in A)E==="$ref"||E==="allOf"||E in g.def&&JSON.stringify(A[E])===JSON.stringify(g.def[E])&&delete A[E]}let f=a._zod.parent;if(f&&f!==d){i(f);let g=e.seen.get(f);if(g?.schema.$ref&&(A.$ref=g.schema.$ref,g.def))for(let p in A)p==="$ref"||p==="allOf"||p in g.def&&JSON.stringify(A[p])===JSON.stringify(g.def[p])&&delete A[p]}e.override({zodSchema:a,jsonSchema:A,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())i(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())iT(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let A of[c.schema,c.def]){let l=A?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(A):a.set(l,[A])}for(let c of e.intersections)for(let A of a.get(c)??[])h8(A)}}let r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(a)}Kc(r,n.defId?n.schema:n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&r.id===o&&delete r.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,je(s,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?r.$defs=s:r.definitions=s);try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ys(t,"input",e.processors),output:Ys(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function lt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return lt(i.element,n);if(i.type==="set")return lt(i.valueType,n);if(i.type==="lazy")return lt(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return lt(i.innerType,n);if(i.type==="intersection")return lt(i.left,n)||lt(i.right,n);if(i.type==="record"||i.type==="map")return lt(i.keyType,n)||lt(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:lt(i.in,n)||lt(i.out,n);if(i.type==="object"){for(let r in i.shape)if(lt(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(lt(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(lt(r,n))return!0;return!!(i.rest&<(i.rest,n))}return!1}var $C=(e,t={})=>n=>{let i=Vn({...n,processors:t});return pe(e,i),Jn(i,e),Yn(i,e)},Ys=(e,t,n={})=>i=>{let{libraryOptions:r,target:o}=i??{},s=Vn({...r??{},target:o,io:t,processors:n});return pe(e,s),Jn(s,e),Yn(s,e)};var js=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Hs=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},sT=(e,t)=>{js(e,"minimum",t),Hs(e,"maximum",t)},uT=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},lT=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},dT=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},fT=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},aT=(e,t)=>js(e,"minimum",t.minimum),cT=(e,t)=>Hs(e,"maximum",t.maximum),AT=e=>(t,n)=>{fT(t,n.format);let[i,r]=e[n.format];js(t,"minimum",i),Hs(t,"maximum",r)},m8={greater_than:(e,t)=>js(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Hs(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>uT(e,t.value),number_format:AT(Ec),bigint_format:AT(yc),min_length:aT,max_length:cT,length_equals:(e,t)=>sT(e,t.length),min_size:aT,max_size:cT,size_equals:(e,t)=>sT(e,t.size),string_format:(e,t)=>{fT(e,t.format),t.pattern&&lT(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>dT(e,t.mime)};function Me(e){let t={},n=e._zod.def,i=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let o of i)m8[o._zod.def.check]?.(t,o._zod.def);let r=e._zod.bag;r.minimum!==void 0&&js(t,"minimum",r.minimum),r.exclusiveMinimum!==void 0&&js(t,"exclusiveMinimum",r.exclusiveMinimum),r.maximum!==void 0&&Hs(t,"maximum",r.maximum),r.exclusiveMaximum!==void 0&&Hs(t,"exclusiveMaximum",r.exclusiveMaximum),r.multipleOf!==void 0&&uT(t,r.multipleOf),r.format!==void 0&&(t.format??(t.format=r.format),r.format.includes("int")&&(t.isInt=!0)),r.mime&&dT(t,r.mime);for(let o of r.patterns??[])lT(t,o);return t}var I8={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},E8=new Map([[pd,zI],[Fc,GI]]),gT=e=>E8.get(e)??e,LC=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:o,maximum:s,format:a,patterns:c,contentEncoding:A,laxFormat:l}=Me(e);if(typeof o=="number"&&(r.minLength=o),typeof s=="number"&&(r.maxLength=s),a&&(r.format=I8[a]??a,r.format===""&&delete r.format,(a==="time"||l)&&delete r.format),A&&(r.contentEncoding=A),c&&c.size>0){let d=[...c].map(gT);d.length===1?r.pattern=d[0].source:d.length>1&&(r.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},PC=(e,t,n,i)=>{let r=n,{minimum:o,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:A,isInt:l}=Me(e);r.type=l?"integer":"number";let d=typeof A=="number"&&A>=(o??Number.NEGATIVE_INFINITY),f=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(d?g?(r.minimum=A,r.exclusiveMinimum=!0):r.exclusiveMinimum=A:typeof o=="number"&&(r.minimum=o),f?g?(r.maximum=c,r.exclusiveMaximum=!0):r.exclusiveMaximum=c:typeof s=="number"&&(r.maximum=s),a){let p=new Set;for(let m of a)Number.isFinite(m)&&m!==0?p.add(Math.abs(m)):Fe(e,t,r,i,`A multipleOf divisor of ${m} cannot be represented in JSON Schema`);let[h,...E]=p;h!==void 0&&(r.multipleOf=h),E.length&&(r.allOf=[...r.allOf??[],...E.map(m=>({multipleOf:m}))])}},OC=(e,t,n,i)=>{n.type="boolean"},zC=(e,t,n,i)=>{Fe(e,t,n,i,"BigInt cannot be represented in JSON Schema")},GC=(e,t,n,i)=>{Fe(e,t,n,i,"Symbols cannot be represented in JSON Schema")},VC=(e,t,n,i)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},JC=(e,t,n,i)=>{Fe(e,t,n,i,"Undefined cannot be represented in JSON Schema")},YC=(e,t,n,i)=>{Fe(e,t,n,i,"Void cannot be represented in JSON Schema")},jC=(e,t,n,i)=>{n.not={}},HC=(e,t,n,i)=>{},qC=(e,t,n,i)=>{},WC=(e,t,n,i)=>{Fe(e,t,n,i,"Date cannot be represented in JSON Schema")},ZC=(e,t,n,i)=>{let r=e._zod.def,o=Is(r.entries);if(o.length===0){n.not={};return}o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),n.enum=o},KC=(e,t,n,i)=>{let r=e._zod.def;if(r.values.length===0){n.not={};return}let o=[];for(let s of r.values)if(s===void 0){if(Fe(e,t,n,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(Fe(e,t,n,i,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),o.every(s=>typeof s=="boolean")&&(n.type="boolean"),o.every(s=>s===null)&&(n.type="null"),n.enum=o},XC=(e,t,n,i)=>{Fe(e,t,n,i,"NaN cannot be represented in JSON Schema")},eB=(e,t,n,i)=>{let r=n,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=o.source},tB=(e,t,n,i)=>{let r=n;r.type="string",r.format="binary",r.contentEncoding="binary";let{minimum:o,maximum:s,mime:a}=Me(e);o!==void 0&&(r.minLength=o),s!==void 0&&(r.maxLength=s),a&&(a.length===0?r.not={}:a.length===1?r.contentMediaType=a[0]:r.anyOf=a.map(c=>({contentMediaType:c})))},rB=(e,t,n,i)=>{n.type="boolean"},nB=(e,t,n,i)=>{Fe(e,t,n,i,"Custom types cannot be represented in JSON Schema")},iB=(e,t,n,i)=>{Fe(e,t,n,i,"Function types cannot be represented in JSON Schema")},oB=(e,t,n,i)=>{Fe(e,t,n,i,"Transforms cannot be represented in JSON Schema")},sB=(e,t,n,i)=>{Fe(e,t,n,i,"Map cannot be represented in JSON Schema")},aB=(e,t,n,i)=>{Fe(e,t,n,i,"Set cannot be represented in JSON Schema")},cB=(e,t,n,i)=>{let r=n,o=e._zod.def,{minimum:s,maximum:a}=Me(e);typeof s=="number"&&(r.minItems=s),typeof a=="number"&&(r.maxItems=a),r.type="array",r.items=pe(o.element,t,{...i,path:[...i.path,"items"]})};function Xc(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Xc(t.out):t.type==="catch"?Xc(t.innerType):e._zod.optin}var AB=(e,t,n,i)=>{let r=n,o=e._zod.def,s=o.shape;if(Object.getOwnPropertySymbols(s).length&&Fe(e,t,r,i,"Symbol keys cannot be represented in JSON Schema"))return;r.type="object",r.properties={};for(let A in s)je(r.properties,A,pe(s[A],t,{...i,path:[...i.path,"properties",A]}));let c=[];for(let A of Object.keys(s)){let l=o.shape[A];(t.io==="input"?Xc(l)===void 0:l._zod.optout===void 0)&&c.push(A)}c.length>0&&(r.required=c),o.catchall?._zod.def.type==="never"?r.additionalProperties=!1:o.catchall?o.catchall&&(r.additionalProperties=pe(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},ff=(e,t,n,i)=>{let r=e._zod.def,o=r.inclusive===!1,s=r.options.map((a,c)=>pe(a,t,{...i,path:[...i.path,o?"oneOf":"anyOf",c]}));o?n.oneOf=s:n.anyOf=s},uB=(e,t,n,i)=>{let r=e._zod.def,o=pe(r.left,t,{...i,path:[...i.path,"allOf",0]}),s=pe(r.right,t,{...i,path:[...i.path,"allOf",1]}),a=A=>"allOf"in A&&Object.keys(A).length===1,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},lB=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((h,E)=>pe(h,t,{...i,path:[...i.path,s,E]})),A=o.rest?pe(o.rest,t,{...i,path:[...i.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,l=o.items.length;for(;l>0;){let h=o.items[l-1];if(!(t.io==="input"?Xc(h)!==void 0:h._zod.optout==="optional"))break;l--}let d=o.items.length,f=!o.rest;t.target==="draft-2020-12"?(r.prefixItems=c,f?r.items=!1:A&&(r.items=A),l>0&&(r.minItems=l),f&&(r.maxItems=d)):t.target==="openapi-3.0"?(r.items={anyOf:c},A&&r.items.anyOf.push(A),l>0&&(r.minItems=l),f&&(r.maxItems=d)):(r.items=c,f?r.additionalItems=!1:A&&(r.additionalItems=A),l>0&&(r.minItems=l),f&&(r.maxItems=d));let{minimum:g,maximum:p}=Me(e);typeof g=="number"&&(r.minItems=g),typeof p=="number"&&(r.maxItems=p)};function FC(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let p=e.get(t)?.def;if(!p)return t;let h=FC(e,p,n);return h===p?t:h}for(let p of["anyOf","oneOf"]){let h=t[p];if(!Array.isArray(h))continue;let E=h.map(m=>FC(e,m,n));E.some((m,C)=>m!==h[C])&&(t={...t,[p]:E})}let i=Array.isArray(t.type)?t.type:[t.type],r=!i.includes("string")&&i.some(p=>p==="number"||p==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!r&&!o?.some(p=>typeof p=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:A,multipleOf:l,format:d,id:f,...g}=t;return g.enum?g.enum=g.enum.map(p=>typeof p=="number"?String(p):p):typeof g.const=="number"&&(g.const=String(g.const)),r&&(g.type="string",o||(g.pattern=(i.includes("number")?ln:Rc).source)),g}var MC=new WeakMap;function y8(e){let t=new Map;for(let i of e.seen.values())i.def&&!t.has(i.schema)&&t.set(i.schema,i);let n=new Map;for(let i of MC.get(e)??[]){let r=e.seen.get(i),o=(r?.def??r?.schema)?.propertyNames;if(!o||o===!0||n.has(o))continue;let s=FC(t,o,new Set);s!==o&&n.set(o,s)}if(n.size)for(let i of e.seen.values())for(let r of[i.schema,i.def]){let o=r&&n.get(r.propertyNames);o&&(r.propertyNames=o)}}var dB=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="object";let s=o.keyType,a=Me(s).patterns;if(o.mode==="loose"&&a&&a.size>0){let l=pe(o.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let d of a)je(r.patternProperties,gT(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){r.propertyNames=pe(o.keyType,t,{...i,path:[...i.path,"propertyNames"]});let l=MC.get(t);l||(l=[],MC.set(t,l),t.deferred.push(()=>y8(t))),l.push(e)}r.additionalProperties=pe(o.valueType,t,{...i,path:[...i.path,"additionalProperties"]})}let c=s._zod.values,A=t.io==="input"&&Xc(o.valueType)!==void 0;if(c&&!o.partial&&!A){let l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(r.required=l.map(String))}},fB=(e,t,n,i)=>{let r=e._zod.def,o=pe(r.innerType,t,i),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=r.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},gB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},pB=Symbol();function pT(e,t,n,i,r){let o=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(o=!0,null));return o?(Fe(t,n,i,r,"BigInt defaults cannot be represented in JSON Schema"),pB):JSON.parse(s)}var hB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let s=pT(r.defaultValue,e,t,n,i);s!==pB&&(n.default=s)},mB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);if(o.ref=r.innerType,t.io!=="input")return;let s=pT(r.defaultValue,e,t,n,i);s!==pB&&(n._prefault=s)},IB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let s;try{s=r.catchValue(void 0)}catch{Fe(e,t,n,i,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},EB=(e,t,n,i)=>{let r=e._zod.def,o=r.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?o?r.out:r.in:r.out;pe(s,t,i);let a=t.seen.get(e);a.ref=s},yB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,n.readOnly=!0},CB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},gf=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},BB=(e,t,n,i)=>{let r=e._zod.innerType;pe(r,t,i);let o=t.seen.get(e);o.ref=r},df={string:LC,number:PC,boolean:OC,bigint:zC,symbol:GC,null:VC,undefined:JC,void:YC,never:jC,any:HC,unknown:qC,date:WC,enum:ZC,literal:KC,nan:XC,template_literal:eB,file:tB,success:rB,custom:nB,function:iB,transform:oB,map:sB,set:aB,array:cB,object:AB,union:ff,intersection:uB,tuple:lB,record:dB,nullable:fB,nonoptional:gB,default:hB,prefault:mB,catch:IB,pipe:EB,readonly:yB,promise:CB,optional:gf,lazy:BB};function pf(e,t){if("_idmap"in e){let i=e,r=Vn({...t,processors:df}),o={};for(let c of i._idmap.entries()){let[A,l]=c;pe(l,r)}let s={},a={registry:i,uri:t?.uri,defs:o};r.external=a;for(let c of i._idmap.entries()){let[A,l]=c;Jn(r,l),je(s,A,Yn(r,l))}if(Object.keys(o).length>0){let c=r.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:o}}return{schemas:s}}let n=Vn({...t,processors:df});return pe(e,n),Jn(n,e),Yn(n,e)}var hf=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=Vn({processors:df,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return pe(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Jn(this.ctx,t);let i=Yn(this.ctx,t),{"~standard":r,...o}=i;return o}};var hT={};var ra={};Qr(ra,{ZodAny:()=>VB,ZodArray:()=>HB,ZodBase64:()=>Tf,ZodBase64URL:()=>$f,ZodBigInt:()=>ea,ZodBigIntFormat:()=>Lf,ZodBoolean:()=>Xs,ZodCIDRv4:()=>Nf,ZodCIDRv6:()=>Uf,ZodCUID:()=>bf,ZodCUID2:()=>kf,ZodCatch:()=>pQ,ZodCodec:()=>AA,ZodCreditCard:()=>$B,ZodCustom:()=>uA,ZodCustomStringFormat:()=>ao,ZodDate:()=>nA,ZodDefault:()=>AQ,ZodDiscriminatedUnion:()=>WB,ZodE164:()=>Ff,ZodEmail:()=>Bf,ZodEmoji:()=>vf,ZodEnum:()=>Ws,ZodExactOptional:()=>Gf,ZodFile:()=>oQ,ZodFunction:()=>wQ,ZodGUID:()=>Qf,ZodIBAN:()=>FB,ZodIPv4:()=>Df,ZodIPv6:()=>_f,ZodISODate:()=>Hn,ZodISODateTime:()=>jn,ZodISODuration:()=>Wn,ZodISOTime:()=>qn,ZodInstanceOf:()=>SQ,ZodIntersection:()=>ZB,ZodJWT:()=>Mf,ZodKSUID:()=>Rf,ZodLazy:()=>BQ,ZodLiteral:()=>iQ,ZodMAC:()=>TB,ZodMap:()=>rQ,ZodNaN:()=>mQ,ZodNanoID:()=>wf,ZodNever:()=>YB,ZodNonOptional:()=>Vf,ZodNull:()=>zB,ZodNullable:()=>cQ,ZodNumber:()=>Ks,ZodNumberFormat:()=>co,ZodObject:()=>oA,ZodOptional:()=>aA,ZodPipe:()=>cA,ZodPrefault:()=>lQ,ZodPreprocess:()=>IQ,ZodPromise:()=>vQ,ZodReadonly:()=>EQ,ZodRecord:()=>qs,ZodSet:()=>nQ,ZodString:()=>Zs,ZodStringFormat:()=>me,ZodSuccess:()=>gQ,ZodSymbol:()=>PB,ZodTemplateLiteral:()=>CQ,ZodTransform:()=>sQ,ZodTuple:()=>XB,ZodType:()=>ee,ZodULID:()=>Sf,ZodURL:()=>rA,ZodUUID:()=>Vr,ZodUndefined:()=>OB,ZodUnion:()=>sA,ZodUnknown:()=>JB,ZodVoid:()=>jB,ZodXID:()=>xf,ZodXor:()=>qB,_ZodString:()=>Cf,_default:()=>uQ,_function:()=>S$,any:()=>o$,array:()=>iA,base64:()=>LT,base64url:()=>PT,bigint:()=>e$,boolean:()=>LB,catch:()=>hQ,check:()=>x$,cidrv4:()=>FT,cidrv6:()=>MT,codec:()=>v$,creditCard:()=>zT,cuid:()=>xT,cuid2:()=>RT,currencyCode:()=>HT,custom:()=>R$,date:()=>a$,describe:()=>D$,discriminatedUnion:()=>f$,e164:()=>OT,email:()=>ET,emoji:()=>kT,enum:()=>Of,exactOptional:()=>aQ,file:()=>y$,float32:()=>WT,float64:()=>ZT,function:()=>S$,guid:()=>yT,hash:()=>qT,hex:()=>jT,hostname:()=>YT,httpUrl:()=>bT,iban:()=>GT,instanceof:()=>N$,int:()=>Ef,int32:()=>KT,int64:()=>t$,intersection:()=>KB,invertCodec:()=>w$,ipv4:()=>UT,ipv6:()=>$T,json:()=>T$,jwt:()=>VT,keyof:()=>c$,ksuid:()=>NT,lazy:()=>QQ,literal:()=>E$,looseObject:()=>l$,looseRecord:()=>p$,mac:()=>TT,map:()=>h$,meta:()=>_$,nan:()=>Q$,nanoid:()=>ST,nativeEnum:()=>I$,never:()=>Pf,nonoptional:()=>fQ,null:()=>GB,nullable:()=>tA,nullish:()=>C$,number:()=>MB,object:()=>A$,optional:()=>oo,partialRecord:()=>g$,pipe:()=>yf,prefault:()=>dQ,preprocess:()=>$$,promise:()=>k$,readonly:()=>yQ,record:()=>tQ,refine:()=>bQ,set:()=>m$,strictObject:()=>u$,string:()=>eA,stringFormat:()=>JT,stringbool:()=>U$,success:()=>B$,superRefine:()=>kQ,symbol:()=>n$,templateLiteral:()=>b$,transform:()=>zf,tuple:()=>eQ,uint32:()=>XT,uint64:()=>r$,ulid:()=>DT,undefined:()=>i$,union:()=>ta,unknown:()=>io,url:()=>wT,uuid:()=>CT,uuidv4:()=>BT,uuidv6:()=>QT,uuidv7:()=>vT,void:()=>s$,xid:()=>_T,xor:()=>d$});var mf={};Qr(mf,{endsWith:()=>Ms,gt:()=>zr,gte:()=>Lt,includes:()=>$s,length:()=>ro,lowercase:()=>Us,lt:()=>Or,lte:()=>Mt,maxLength:()=>to,maxSize:()=>Gn,mime:()=>Ps,minLength:()=>dn,minSize:()=>Gr,multipleOf:()=>zn,negative:()=>cf,nonnegative:()=>uf,nonpositive:()=>Af,normalize:()=>Os,overwrite:()=>Cr,positive:()=>af,properties:()=>Ls,property:()=>lf,regex:()=>Ns,size:()=>eo,slugify:()=>Js,startsWith:()=>Fs,toLowerCase:()=>Gs,toUpperCase:()=>Vs,trim:()=>zs,uppercase:()=>Ts});var mT=new WeakSet([Object.prototype,Error.prototype]);function If(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let i=n(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}var IT=(e,t)=>{BI.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);mT.has(n)||(mT.add(n),If(n,"format",i=>r=>bc(i,r)),If(n,"flatten",i=>r=>wc(i,r)),If(n,"addIssue",i=>r=>{i.issues.push(r),i.message=JSON.stringify(i.issues,Es,2)}),If(n,"addIssues",i=>r=>{i.issues.push(...r),i.message=JSON.stringify(i.issues,Es,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},B8=I("ZodError",IT),wt=I("ZodError",IT,void 0,{Parent:Error});var QB=vs(wt),vB=ws(wt),wB=bs(wt),bB=ks(wt),kB=Yl(wt),SB=jl(wt),xB=Hl(wt),RB=ql(wt),DB=Wl(wt),_B=Zl(wt),NB=Kl(wt),UB=Xl(wt);function v8(){ze.localeError||De(Dd())}function so(){ze.memoizer||De({memoizer:Vc()})}var ee=I("ZodType",(e,t)=>(v8(),Z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(B.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return fe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(bQ(e,t))},superRefine(e,t){return this.check(kQ(e,t))},overwrite(e){return this.check(Cr(e))},optional(){return oo(this)},exactOptional(){return aQ(this)},nullable(){return tA(this)},nullish(){return oo(tA(this))},nonoptional(e){return fQ(this,e)},array(){return iA(this)},or(e){return ta([this,e])},and(e){return KB(this,e)},transform(e){return yf(this,zf(e))},default(e){return uQ(this,e)},prefault(e){return dQ(this,e)},catch(e){return hQ(this,e)},pipe(e){return yf(this,e)},readonly(){return yQ(this)},describe(e){let t=this.clone();return He.add(t,{description:e}),t},meta(...e){if(e.length===0)return He.get(this);let t=this.clone();return He.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 B.hide(this,"~standard",{...ud(this),jsonSchema:{input:Ys(this,"input"),output:Ys(this,"output")}})},set"~standard"(e){B.own(this,"~standard",e)},parse:function e(t,n){return QB(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await vB(this,t,n,{callee:e})},safeParse(e,t){return wB(this,e,t)},async safeParseAsync(e,t){return bB(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){B.own(this,"spa",e)},validate(e,t){return kc(this,e,t)},validateAsync(e,t){return Sc(this,e,t)},encode:function e(t,n){return kB(this,t,n,{callee:e})},decode:function e(t,n){return SB(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await xB(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await RB(this,t,n,{callee:e})},safeEncode(e,t){return DB(this,e,t)},safeDecode(e,t){return _B(this,e,t)},async safeEncodeAsync(e,t){return NB(this,e,t)},async safeDecodeAsync(e,t){return UB(this,e,t)},toJSONSchema(e){return $C(this,{})(e)},get description(){return He.get(this)?.description},get _def(){return this._zod.def}}),Cf=I("_ZodString",(e,t)=>{Wi.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>LC(e,n,i,r)},B.derived({format:e=>Me(e).format??null,minLength:e=>Me(e).minimum??null,maxLength:e=>Me(e).maximum??null},{regex(...e){return this.check(Ns(...e))},includes(...e){return this.check($s(...e))},startsWith(...e){return this.check(Fs(...e))},endsWith(...e){return this.check(Ms(...e))},min(...e){return this.check(dn(...e))},max(...e){return this.check(to(...e))},length(...e){return this.check(ro(...e))},nonempty(...e){return this.check(dn(1,...e))},lowercase(e){return this.check(Us(e))},uppercase(e){return this.check(Ts(e))},trim(){return this.check(zs())},normalize(...e){return this.check(Os(...e))},toLowerCase(){return this.check(Gs())},toUpperCase(){return this.check(Vs())},slugify(){return this.check(Js())}})),Zs=I("ZodString",(e,t)=>{Wi.init(e,t),Cf.init(e,t)},{email(e){return this.check(Ld(Bf,e))},url(e){return this.check(jc(rA,e))},jwt(e){return this.check(sf(Mf,e))},emoji(e){return this.check(Jd(vf,e))},guid(e){return this.check(Pd(Qf,e))},uuid(e){return this.check(Od(Vr,e))},uuidv4(e){return this.check(zd(Vr,e))},uuidv6(e){return this.check(Gd(Vr,e))},uuidv7(e){return this.check(Vd(Vr,e))},nanoid(e){return this.check(Yd(wf,e))},cuid(e){return this.check(jd(bf,e))},cuid2(e){return this.check(Hd(kf,e))},ulid(e){return this.check(qd(Sf,e))},base64(e){return this.check(rf(Tf,e))},base64url(e){return this.check(nf($f,e))},xid(e){return this.check(Wd(xf,e))},ksuid(e){return this.check(Zd(Rf,e))},ipv4(e){return this.check(Kd(Df,e))},ipv6(e){return this.check(Xd(_f,e))},cidrv4(e){return this.check(ef(Nf,e))},cidrv6(e){return this.check(tf(Uf,e))},e164(e){return this.check(of(Ff,e))},datetime(e){return this.check(Hc(jn,e))},date(e){return this.check(qc(Hn,e))},time(e){return this.check(Wc(qn,e))},duration(e){return this.check(Zc(Wn,e))}});function eA(e){return Ky(Zs,e)}var me=I("ZodStringFormat",(e,t)=>{ge.init(e,t),Cf.init(e,t)}),jn=I("ZodISODateTime",(e,t)=>{zE.init(e,t),me.init(e,t)}),Hn=I("ZodISODate",(e,t)=>{GE.init(e,t),me.init(e,t)}),qn=I("ZodISOTime",(e,t)=>{VE.init(e,t),me.init(e,t)}),Wn=I("ZodISODuration",(e,t)=>{JE.init(e,t),me.init(e,t)}),Bf=I("ZodEmail",(e,t)=>{DE.init(e,t),me.init(e,t)});function ET(e){return Ld(Bf,e)}var Qf=I("ZodGUID",(e,t)=>{xE.init(e,t),me.init(e,t)});function yT(e){return Pd(Qf,e)}var Vr=I("ZodUUID",(e,t)=>{RE.init(e,t),me.init(e,t)});function CT(e){return Od(Vr,e)}function BT(e){return zd(Vr,e)}function QT(e){return Gd(Vr,e)}function vT(e){return Vd(Vr,e)}var rA=I("ZodURL",(e,t)=>{UE.init(e,t),me.init(e,t)});function wT(e){return jc(rA,e)}function bT(e){return jc(rA,{protocol:xc,hostname:JI,...B.normalizeParams(e)})}var vf=I("ZodEmoji",(e,t)=>{TE.init(e,t),me.init(e,t)});function kT(e){return Jd(vf,e)}var wf=I("ZodNanoID",(e,t)=>{$E.init(e,t),me.init(e,t)});function ST(e){return Yd(wf,e)}var bf=I("ZodCUID",(e,t)=>{FE.init(e,t),me.init(e,t)});function xT(e){return jd(bf,e)}var kf=I("ZodCUID2",(e,t)=>{ME.init(e,t),me.init(e,t)});function RT(e){return Hd(kf,e)}var Sf=I("ZodULID",(e,t)=>{LE.init(e,t),me.init(e,t)});function DT(e){return qd(Sf,e)}var xf=I("ZodXID",(e,t)=>{PE.init(e,t),me.init(e,t)});function _T(e){return Wd(xf,e)}var Rf=I("ZodKSUID",(e,t)=>{OE.init(e,t),me.init(e,t)});function NT(e){return Zd(Rf,e)}var Df=I("ZodIPv4",(e,t)=>{YE.init(e,t),me.init(e,t)});function UT(e){return Kd(Df,e)}var TB=I("ZodMAC",(e,t)=>{HE.init(e,t),me.init(e,t)});function TT(e){return eC(TB,e)}var _f=I("ZodIPv6",(e,t)=>{jE.init(e,t),me.init(e,t)});function $T(e){return Xd(_f,e)}var Nf=I("ZodCIDRv4",(e,t)=>{qE.init(e,t),me.init(e,t)});function FT(e){return ef(Nf,e)}var Uf=I("ZodCIDRv6",(e,t)=>{WE.init(e,t),me.init(e,t)});function MT(e){return tf(Uf,e)}var Tf=I("ZodBase64",(e,t)=>{ZE.init(e,t),me.init(e,t)});function LT(e){return rf(Tf,e)}var $f=I("ZodBase64URL",(e,t)=>{KE.init(e,t),me.init(e,t)});function PT(e){return nf($f,e)}var Ff=I("ZodE164",(e,t)=>{XE.init(e,t),me.init(e,t)});function OT(e){return of(Ff,e)}var $B=I("ZodCreditCard",(e,t)=>{ey.init(e,t),me.init(e,t)});function zT(e){return tC($B,e)}var FB=I("ZodIBAN",(e,t)=>{ty.init(e,t),me.init(e,t)});function GT(e){return rC(FB,e)}var Mf=I("ZodJWT",(e,t)=>{ry.init(e,t),me.init(e,t)});function VT(e){return sf(Mf,e)}var ao=I("ZodCustomStringFormat",(e,t)=>{ny.init(e,t),me.init(e,t)});function JT(e,t,n={}){return no(ao,e,t,n)}function YT(e){return no(ao,"hostname",VI,e)}function jT(e){return no(ao,"hex",oE,e)}function HT(e){return no(ao,"currency_code",jI,e)}function qT(e,t){let n=t?.enc??"hex",i=`${e}_${n}`,r=tr[i];if(!r)throw new Error(`Unrecognized hash format: ${i}`);return no(ao,i,r,t)}var Ks=I("ZodNumber",(e,t)=>{yd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>PC(e,n,i,r),e.isFinite=!0},B.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Me(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Me(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:n}=Me(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Me(e).format??null},{gt(e,t){return this.check(zr(e,t))},gte(e,t){return this.check(Lt(e,t))},min(e,t){return this.check(Lt(e,t))},lt(e,t){return this.check(Or(e,t))},lte(e,t){return this.check(Mt(e,t))},max(e,t){return this.check(Mt(e,t))},int(e){return this.check(Ef(e))},safe(e){return this.check(Ef(e))},positive(e){return this.check(zr(0,e))},nonnegative(e){return this.check(Lt(0,e))},negative(e){return this.check(Or(0,e))},nonpositive(e){return this.check(Mt(0,e))},multipleOf(e,t){return this.check(zn(e,t))},step(e,t){return this.check(zn(e,t))},finite(){return this}}));function MB(e){return iC(Ks,e)}var co=I("ZodNumberFormat",(e,t)=>{iy.init(e,t),Ks.init(e,t)});function Ef(e){return sC(co,e)}function WT(e){return aC(co,e)}function ZT(e){return cC(co,e)}function KT(e){return AC(co,e)}function XT(e){return uC(co,e)}var Xs=I("ZodBoolean",(e,t)=>{Mc.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>OC(e,n,i,r)});function LB(e){return lC(Xs,e)}var ea=I("ZodBigInt",(e,t)=>{Cd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>zC(e,n,i,r)},B.derived({minValue:e=>Me(e).minimum??null,maxValue:e=>Me(e).maximum??null,format:e=>Me(e).format??null},{gte(e,t){return this.check(Lt(e,t))},min(e,t){return this.check(Lt(e,t))},gt(e,t){return this.check(zr(e,t))},lt(e,t){return this.check(Or(e,t))},lte(e,t){return this.check(Mt(e,t))},max(e,t){return this.check(Mt(e,t))},positive(e){return this.check(zr(BigInt(0),e))},negative(e){return this.check(Or(BigInt(0),e))},nonpositive(e){return this.check(Mt(BigInt(0),e))},nonnegative(e){return this.check(Lt(BigInt(0),e))},multipleOf(e,t){return this.check(zn(e,t))}}));function e$(e){return fC(ea,e)}var Lf=I("ZodBigIntFormat",(e,t)=>{oy.init(e,t),ea.init(e,t)});function t$(e){return pC(Lf,e)}function r$(e){return hC(Lf,e)}var PB=I("ZodSymbol",(e,t)=>{sy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>GC(e,n,i,r)});function n$(e){return mC(PB,e)}var OB=I("ZodUndefined",(e,t)=>{ay.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>JC(e,n,i,r)});function i$(e){return IC(OB,e)}var zB=I("ZodNull",(e,t)=>{cy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>VC(e,n,i,r)});function GB(e){return EC(zB,e)}var VB=I("ZodAny",(e,t)=>{Ay.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>HC(e,n,i,r)});function o$(){return yC(VB)}var JB=I("ZodUnknown",(e,t)=>{uy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>qC(e,n,i,r)});function io(){return CC(JB)}var YB=I("ZodNever",(e,t)=>{ly.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>jC(e,n,i,r)});function Pf(e){return BC(YB,e)}var jB=I("ZodVoid",(e,t)=>{dy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>YC(e,n,i,r)});function s$(e){return QC(jB,e)}var nA=I("ZodDate",(e,t)=>{fy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>WC(e,n,i,r),e.min=(n,i)=>e.check(Lt(n,i)),e.max=(n,i)=>e.check(Mt(n,i))},B.derived({minDate:e=>{let{minimum:t}=Me(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=Me(e);return t?new Date(t):null}},{}));function a$(e){return vC(nA,e)}var HB=I("ZodArray",(e,t)=>{so(),py.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>cB(e,n,i,r),e.element=t.element},{min(e,t){return this.check(dn(e,t))},nonempty(e){return this.check(dn(1,e))},max(e,t){return this.check(to(e,t))},length(e,t){return this.check(ro(e,t))},unwrap(){return this.element}});function iA(e,t){return kC(HB,e,t)}function c$(e){let t=e._zod.def.shape;return Of(Object.keys(t))}var oA=I("ZodObject",(e,t)=>{so(),hy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>AB(e,n,i,r),B.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Of(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(B.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(B.mergeDefs(this._zod.def,{catchall:io()}))},loose(){return this.clone(B.mergeDefs(this._zod.def,{catchall:io()}))},strict(){return this.clone(B.mergeDefs(this._zod.def,{catchall:Pf()}))},strip(){return this.clone(B.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return B.extend(this,e)},safeExtend(e){return B.safeExtend(this,e)},merge(e){return B.merge(this,e)},pick(e){return B.pick(this,e)},omit(e){return B.omit(this,e)},partial(...e){return B.partial(aA,this,e[0])},exactPartial(...e){return B.partial(Gf,this,e[0],"exactPartial")},required(...e){return B.required(Vf,this,e[0])}});function A$(e,t){let n={type:"object",shape:e??{},...B.normalizeParams(t)};return new oA(n)}function u$(e,t){return new oA({type:"object",shape:e,catchall:Pf(),...B.normalizeParams(t)})}function l$(e,t){return new oA({type:"object",shape:e,catchall:io(),...B.normalizeParams(t)})}var sA=I("ZodUnion",(e,t)=>{Lc.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ff(e,n,i,r),e.options=t.options});function ta(e,t){return new sA({type:"union",options:e,...B.normalizeParams(t)})}var qB=I("ZodXor",(e,t)=>{sA.init(e,t),my.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ff(e,n,i,r),e.options=t.options});function d$(e,t){return new qB({type:"union",options:e,inclusive:!1,...B.normalizeParams(t)})}var WB=I("ZodDiscriminatedUnion",(e,t)=>{sA.init(e,t),Ey.init(e,t)});function f$(e,t,n){return new WB({type:"union",options:t,discriminator:e,...B.normalizeParams(n)})}var ZB=I("ZodIntersection",(e,t)=>{yy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>uB(e,n,i,r)});function KB(e,t){return new ZB({type:"intersection",left:e,right:t})}var XB=I("ZodTuple",(e,t)=>{so(),Bd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>lB(e,n,i,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new aA({type:"optional",innerType:t}))})}});function eQ(e,t,n){let i=t instanceof Z,r=i?n:t,o=i?t:null;return new XB({type:"tuple",items:e,rest:o,...B.normalizeParams(r)})}var qs=I("ZodRecord",(e,t)=>{so(),Cy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>dB(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function tQ(e,t,n){return!t||!t._zod?new qs({type:"record",keyType:eA(),valueType:e,...B.normalizeParams(t)}):new qs({type:"record",keyType:e,valueType:t,...B.normalizeParams(n)})}function g$(e,t,n){return new qs({type:"record",keyType:e,valueType:t,...B.normalizeParams(n),partial:!0})}function p$(e,t,n){return new qs({type:"record",keyType:e,valueType:t,mode:"loose",...B.normalizeParams(n)})}var rQ=I("ZodMap",(e,t)=>{so(),By.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>sB(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(Gr(...n)),e.nonempty=n=>e.check(Gr(1,n)),e.max=(...n)=>e.check(Gn(...n)),e.size=(...n)=>e.check(eo(...n))});function h$(e,t,n){return new rQ({type:"map",keyType:e,valueType:t,...B.normalizeParams(n)})}var nQ=I("ZodSet",(e,t)=>{so(),Qy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>aB(e,n,i,r),e.min=(...n)=>e.check(Gr(...n)),e.nonempty=n=>e.check(Gr(1,n)),e.max=(...n)=>e.check(Gn(...n)),e.size=(...n)=>e.check(eo(...n))});function m$(e,t){return new nQ({type:"set",valueType:e,...B.normalizeParams(t)})}var Ws=I("ZodEnum",(e,t)=>{vy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(i,r,o)=>ZC(e,i,r,o),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let o={};for(let s of i)if(n.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Ws({...t,checks:[],...B.normalizeParams(r),entries:o})},e.exclude=(i,r)=>{let o={...t.entries};for(let s of i)if(n.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new Ws({...t,checks:[],...B.normalizeParams(r),entries:o})}});function Of(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Ws({type:"enum",entries:n,...B.normalizeParams(t)})}function I$(e,t){return new Ws({type:"enum",entries:e,...B.normalizeParams(t)})}var iQ=I("ZodLiteral",(e,t)=>{wy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>KC(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function E$(e,t){return new iQ({type:"literal",values:Array.isArray(e)?e:[e],...B.normalizeParams(t)})}var oQ=I("ZodFile",(e,t)=>{by.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>tB(e,n,i,r),e.min=(n,i)=>e.check(Gr(n,i)),e.max=(n,i)=>e.check(Gn(n,i)),e.mime=(n,i)=>e.check(Ps(Array.isArray(n)?n:[n],i))});function y$(e){return SC(oQ,e)}var sQ=I("ZodTransform",(e,t)=>{so(),ky.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>oB(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Pn(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(B.issue(o,n.value,t));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=e),n.issues.push(B.issue(s))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(o=>(n.value=o,n)):(n.value=r,n)}});function zf(e){return new sQ({type:"transform",transform:e})}var aA=I("ZodOptional",(e,t)=>{Qd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>gf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function oo(e){return new aA({type:"optional",innerType:e})}var Gf=I("ZodExactOptional",(e,t)=>{Sy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>gf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function aQ(e){return new Gf({type:"optional",innerType:e})}var cQ=I("ZodNullable",(e,t)=>{xy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>fB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function tA(e){return new cQ({type:"nullable",innerType:e})}function C$(e){return oo(tA(e))}var AQ=I("ZodDefault",(e,t)=>{Ry.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>hB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function uQ(e,t){return new AQ({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():B.shallowClone(t)}})}var lQ=I("ZodPrefault",(e,t)=>{Dy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>mB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function dQ(e,t){return new lQ({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():B.shallowClone(t)}})}var Vf=I("ZodNonOptional",(e,t)=>{_y.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>gB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function fQ(e,t){return new Vf({type:"nonoptional",innerType:e,...B.normalizeParams(t)})}var gQ=I("ZodSuccess",(e,t)=>{Ny.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>rB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function B$(e){return new gQ({type:"success",innerType:e})}var pQ=I("ZodCatch",(e,t)=>{Uy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>IB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function hQ(e,t){return new pQ({type:"catch",innerType:e,catchValue:typeof t=="function"?t:B.constantCatch(t)})}var mQ=I("ZodNaN",(e,t)=>{Ty.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>XC(e,n,i,r)});function Q$(e){return bC(mQ,e)}var cA=I("ZodPipe",(e,t)=>{vd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>EB(e,n,i,r),e.in=t.in,e.out=t.out});function yf(e,t){return new cA({type:"pipe",in:e,out:t})}var AA=I("ZodCodec",(e,t)=>{cA.init(e,t),Pc.init(e,t)});function v$(e,t,n){return new AA({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function w$(e){let t=e._zod.def;return new AA({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var IQ=I("ZodPreprocess",(e,t)=>{cA.init(e,t),$y.init(e,t)}),EQ=I("ZodReadonly",(e,t)=>{Fy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>yB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function yQ(e){return new EQ({type:"readonly",innerType:e})}var CQ=I("ZodTemplateLiteral",(e,t)=>{My.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>eB(e,n,i,r)});function b$(e,t){return new CQ({type:"template_literal",parts:e,...B.normalizeParams(t)})}var BQ=I("ZodLazy",(e,t)=>{Oc.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>BB(e,n,i,r),e.unwrap=()=>e._zod.def.getter()});function QQ(e){return new BQ({type:"lazy",getter:e})}var vQ=I("ZodPromise",(e,t)=>{Py.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>CB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function k$(e){return new vQ({type:"promise",innerType:e})}var wQ=I("ZodFunction",(e,t)=>{Ly.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>iB(e,n,i,r)});function S$(e){return new wQ({type:"function",input:Array.isArray(e?.input)?eQ(e?.input):e?.input??iA(io()),output:e?.output??io()})}var uA=I("ZodCustom",(e,t)=>{Oy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>nB(e,n,i,r)});function x$(e){let t=new ye({check:"custom"});return t._zod.check=e,t}function R$(e,t){return xC(uA,e??(()=>!0),t)}function bQ(e,t={}){return RC(uA,e,t)}function kQ(e,t){return DC(e,t)}var D$=_C,_$=NC,SQ=I("ZodInstanceOf",(e,t)=>{uA.init(e,t)},{properties(e,t){return this.check(Ls(e,t))}});function N$(e,t={}){let n=new SQ({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...B.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:n,path:[...n._zod.def.path??[]]})},n}var U$=(...e)=>UC({Codec:AA,Boolean:Xs,String:Zs},...e);function T$(e){let t=QQ(()=>ta([eA(e),MB(),LB(),GB(),iA(t),tQ(eA(),t)]));return t}function $$(e,t){return new IQ({type:"pipe",in:zf(e),out:t})}var w8={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function b8(e){De({customError:e})}function k8(){return De().customError}var xQ;xQ||(xQ={});var lA={};Qr(lA,{ZodISODate:()=>Hn,ZodISODateTime:()=>jn,ZodISODuration:()=>Wn,ZodISOTime:()=>qn,date:()=>x8,datetime:()=>S8,duration:()=>D8,time:()=>R8});function S8(e){return Hc(jn,e)}function x8(e){return qc(Hn,e)}function R8(e){return Wc(qn,e)}function D8(e){return Zc(Wn,e)}var N={...ra,...mf,iso:lA},_8=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function N8(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function F$(e,t){return e.map((n,i)=>i<t?n:n.optional())}function U8(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function T8(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===i){let r=n[1]===void 0?void 0:U8(n[1]);if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}function $8(e,t){return N.transform(i=>i).check(i=>{let r=i.value;if(typeof r!="object"||r===null||Array.isArray(r))return;let o=Object.getOwnPropertyNames(r);if(t.minProperties!==void 0&&o.length<t.minProperties&&i.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:r,inst:e,continue:!0}),t.maxProperties!==void 0&&o.length>t.maxProperties&&i.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:r,inst:e,continue:!0}),t.keySchema)for(let s of o){let a=t.keySchema.safeParse(s);a.success||i.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function RQ(e,t){if(e===null)return"z";let n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;let i=String(e);return`${n[0]}${i.length}:${i}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let o=[];for(let s of e){let a=RQ(s,t);if(a===null)return null;o.push(a)}return`a${o.length}:[${o.join(",")}]`}let i=Object.keys(e).sort(),r=[];for(let o of i){let s=RQ(e[o],t);if(s===null)return null;r.push(`${o.length}:${o}=${s}`)}return`o${r.length}:{${r.join(",")}}`}finally{t.delete(e)}}var F8=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),M8=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function dA(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(dA):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,n])=>F8.has(t)?dA(n):!M8.has(t)||typeof n!="object"||n===null?!1:Object.values(n).some(dA))}function M$(e){return e===1?"element":"elements"}function L8(e,t){return N.transform(i=>i).check(i=>{let r=i.value;if(Array.isArray(r)){if(t.uniqueItems===!0){let o=new Map;for(let s=0;s<r.length;s++){let a=RQ(r[s],new Set);if(a===null)continue;let c=o.get(a);if(c===void 0){o.set(a,s);continue}i.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:r,path:[s],continue:!0})}}if(t.containsSchema){let o=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of r)if(t.containsSchema.safeParse(c).success&&++a>=s)break;a<o&&i.issues.push({code:"custom",message:`Array must contain at least ${o} matching ${M$(o)}; found ${a}`,input:r,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&i.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${M$(t.maxContains)}`,input:r,continue:!0})}}}).pipe(e)}function L$(e,t){if(e!==!1)return e===void 0||e===!0?N.any():dt(e,t)}var P8=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function P$(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return N.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return N.lazy(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);let o=T8(r,t),s=dt(o,t);return t.refs.set(r,s),t.processing.delete(r),s}if(e.enum!==void 0){let r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return N.null();if(r.length===0)return N.never();if(r.length===1)return N.literal(r[0]);if(r.every(s=>typeof s=="string"))return N.enum(r);let o=r.map(s=>N.literal(s));return o.length<2?o[0]:N.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return N.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(o=>{let s={...e,type:o};return P$(s,t)});return r.length===0?N.never():r.length===1?r[0]:N.union(r)}if(!n)return N.any();let i;switch(n){case"string":{let r=N.string();if(e.format){let o=e.format;o==="email"?r=r.check(N.email()):o==="uri"||o==="uri-reference"?r=r.check(N.url()):o==="uuid"||o==="guid"?r=r.check(N.uuid()):o==="date-time"?r=r.check(N.iso.datetime({offset:!0})):o==="date"?r=r.check(N.iso.date()):o==="time"?r=r.check(N.regex(P8)):o==="duration"?r=r.check(N.iso.duration()):o==="hostname"?r=r.check(N.hostname()):o==="ipv4"?r=r.check(N.ipv4()):o==="ipv6"?r=r.check(N.ipv6()):o==="mac"?r=r.check(N.mac()):o==="cidr"?r=r.check(N.cidrv4()):o==="cidr-v6"?r=r.check(N.cidrv6()):o==="base64"?r=r.check(N.base64()):o==="base64url"?r=r.check(N.base64url()):o==="e164"?r=r.check(N.e164()):o==="credit_card"?r=r.check(N.creditCard()):o==="iban"?r=r.check(N.iban()):o==="jwt"?r=r.check(N.jwt()):o==="emoji"?r=r.check(N.emoji()):o==="nanoid"?r=r.check(N.nanoid()):o==="cuid"?r=r.check(N.cuid()):o==="cuid2"?r=r.check(N.cuid2()):o==="ulid"?r=r.check(N.ulid()):o==="xid"?r=r.check(N.xid()):o==="ksuid"&&(r=r.check(N.ksuid()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),i=r;break}case"number":case"integer":{let r=n==="integer"?N.number().int():N.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),i=r;break}case"boolean":{i=N.boolean();break}case"null":{i=N.null();break}case"object":{let r={},o=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?dt(e.additionalProperties,t):void 0;for(let[d,f]of Object.entries(o)){let g=dt(f,t);je(r,d,s.has(d)?g:g.optional())}if(e.patternProperties){let d=e.patternProperties,f=Object.keys(d),g=[];for(let h of f){let E=dt(d[h],t),m=N.string().regex(new RegExp(h));g.push(N.looseRecord(m,E))}let p=[];if(Object.keys(r).length>0&&p.push(N.object(r).passthrough()),p.push(...g),p.length===0)i=N.object({}).passthrough();else if(p.length===1)i=p[0];else{let h=N.intersection(p[0],p[1]);for(let E=2;E<p.length;E++)h=N.intersection(h,p[E]);i=h}if(e.additionalProperties===!1){let h=Object.keys(r),E=f.map(C=>new RegExp(C)),m=i;i=i.check(C=>{if(!Xt(C.value))return;let v=[];for(let b of Object.keys(C.value))h.includes(b)||E.some($=>$.test(b))||v.push(b);v.length&&C.issues.push({code:"unrecognized_keys",keys:v,input:C.value,inst:m})})}}else{let d=N.object(r);e.additionalProperties===!1?i=d.strict():a?i=d.catchall(a):i=d.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,A=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(c||A!==void 0||l!==void 0){let d;if(c){let f=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=dt(f,t)}i=$8(i,{keySchema:d,minProperties:A,maxProperties:l})}break}case"array":{let r=e.prefixItems,o=e.items;if(r&&Array.isArray(r)){let s=typeof e.minItems=="number"?e.minItems:0,a=r.map(d=>dt(d,t)),c=F$(a,s),A=Array.isArray(o)?void 0:L$(o,t),l=N.tuple(c);i=A?l.rest(A):l,typeof e.minItems=="number"&&(i=i.check(N.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(N.maxLength(e.maxItems)))}else if(Array.isArray(o)){let s=typeof e.minItems=="number"?e.minItems:0,a=o.map(d=>dt(d,t)),c=F$(a,s),A=L$(e.additionalItems,t),l=N.tuple(c);i=A?l.rest(A):l,typeof e.minItems=="number"&&(i=i.check(N.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(N.maxLength(e.maxItems)))}else if(o!==void 0){let s=dt(o,t),a=N.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),i=a}else i=N.array(N.any());(e.uniqueItems===!0||e.contains!==void 0)&&(i=L8(i,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?dt(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${n}`)}return i}function dt(e,t){if(typeof e=="boolean")return e?N.any():N.never();let n=P$(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(A=>dt(A,t)),c=N.union(a);n=i?N.intersection(n,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(A=>dt(A,t)),c=N.xor(a);n=i?N.intersection(n,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=i?n:N.any();else{let a=i?n:dt(e.allOf[0],t),c=i?0:1;for(let A=c;A<e.allOf.length;A++)a=N.intersection(a,dt(e.allOf[A],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=N.nullable(n)),e.readOnly===!0&&(n=N.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let r={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of o)a in e&&(r[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(r[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!dA(e.propertyNames)&&(r.propertyNames=e.propertyNames);for(let a of["minProperties","maxProperties"])e[a]!==void 0&&(r[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!dA(e.contains)&&(r.contains=e.contains);for(let a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(r[a]=e[a])}for(let a of Object.keys(e))_8.has(a)||je(r,a,e[a]);return Object.keys(r).length>0&&t.registry.add(n,r),e.description&&(n=n.describe(e.description)),n}function O$(e,t){if(typeof e=="boolean")return e?N.any():N.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=N8(n,t?.defaultTarget),r=n.$defs||n.definitions||{},o={version:i,defs:r,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??He};return dt(n,o)}var z$=Symbol("z.visit/resolving");function fA(e,t){let n=typeof t=="function"?t:(s,a)=>{let c=t[s._zod.def.type];return c?c(s,a):s},i=new Map;function r(s){let a=i.get(s);if(a===z$)return new Oc({type:"lazy",getter:()=>i.get(s)});if(a!==void 0)return a;i.set(s,z$);let c=o(s),A=n(c,c!==s);return i.set(s,A),A}function o(s){let a=s._zod.def,c=a.type;switch(c){case"object":{let A=a.shape,l=Object.keys(A),d=!1,f={};for(let p of l){let h=r(A[p]);h!==A[p]&&(d=!0),f[p]=h}let g=a.catchall;return a.catchall&&(g=r(a.catchall),g!==a.catchall&&(d=!0)),d?fe(s,{...a,shape:f,catchall:g}):s}case"array":{let A=r(a.element);return A===a.element?s:fe(s,{...a,element:A})}case"tuple":{let A=a.items,l=!1,d=[];for(let g of A){let p=r(g);p!==g&&(l=!0),d.push(p)}let f=a.rest;return a.rest&&(f=r(a.rest),f!==a.rest&&(l=!0)),l?fe(s,{...a,items:d,rest:f}):s}case"record":case"map":{let A=r(a.keyType),l=r(a.valueType);return A===a.keyType&&l===a.valueType?s:fe(s,{...a,keyType:A,valueType:l})}case"set":{let A=r(a.valueType);return A===a.valueType?s:fe(s,{...a,valueType:A})}case"union":{let A=a.options,l=!1,d=[];for(let f of A){let g=r(f);g!==f&&(l=!0),d.push(g)}return l?fe(s,{...a,options:d}):s}case"intersection":{let A=r(a.left),l=r(a.right);return A===a.left&&l===a.right?s:fe(s,{...a,left:A,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let A=r(a.innerType);return A===a.innerType?s:fe(s,{...a,innerType:A})}case"pipe":{let A=r(a.in),l=r(a.out);return A===a.in&&l===a.out?s:fe(s,{...a,in:A,out:l})}case"function":{let A=r(a.input),l=r(a.output);return A===a.input&&l===a.output?s:fe(s,{...a,input:A,output:l})}case"lazy":{let A=a.getter,{_cachedInner:l,...d}=a;return fe(s,{...d,getter:()=>r(A())})}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":return s;default:return s}}return r(e)}function G$(e){return fA(e,{object:t=>t.partial(),union:t=>{let n=t._zod.def;return n.discriminator===void 0?t:ta(n.options)}})}function O8(e,t){if(!t?.length)return e;let n=e._zod.def;return fe(e,Er(n,{checks:[...n.checks??[],...t]}),{parent:!0})}function V$(e){return O8(e.out,e.checks)}function z8(e){return e.in._zod.traits.has("$ZodTransform")?V$(e):e.in}function J$(e){return fA(e,{pipe:t=>z8(t._zod.def),default:(t,n)=>n?oo(t._zod.def.innerType):t,catch:(t,n)=>n?t._zod.def.innerType:t})}function Y$(e){return fA(e,{pipe:t=>V$(t._zod.def),prefault:(t,n)=>n?t._zod.def.innerType:t})}var DQ={};Qr(DQ,{bigint:()=>Y8,boolean:()=>J8,date:()=>j8,number:()=>V8,string:()=>G8});function G8(e){return Xy(Zs,e)}function V8(e){return oC(Ks,e)}function J8(e){return dC(Xs,e)}function Y8(e){return gC(ea,e)}function j8(e){return wC(nA,e)}var j$=require("async_hooks");var Ase=new j$.AsyncLocalStorage;var kse=new Set(Object.values(ca));var Sse=u.object({checks:u.array(u.object({repository:u.string().optional(),name:u.string().min(1),headSha:u.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:u.string().default("completed"),conclusion:u.string().nullable().optional(),url:u.string().optional(),summary:u.string().optional()}))});var K8=["generate-unit","native-run"],Dse=["preflight","plan","write",...K8,"report","deliver"];var q$=(i=>(i.Unit="unit",i.Integration="integration",i.E2e="e2e",i))(q$||{}),X8=Object.values(q$);var Ose=new RegExp("(^|/)("+["test_[^/]+\\.py","[^/]+_test\\.py","[^/]+\\.(spec|test)\\.[cm]?[jt]sx?","[^/]+\\.e2e-(spec|test)\\.[cm]?[jt]sx?","[^/]+_test\\.go","[^/]+Tests?\\.(java|kts?)","[^/]+_(test|spec)\\.rb","[^/]+\\.feature","[^/]+Tests?\\.cs","[^/]+_test\\.rs","tests/[^/]+\\.rs","[^/]+Test\\.php","[^/]+(Test|Spec|Suite)\\.scala","[^/]+Tests?\\.swift","[^/]+_test\\.exs","[^/]+_test\\.dart","[^/]+_test\\.(c|cc|cpp|cxx)","test_[^/]+\\.(c|cc|cpp|cxx)","[^/]+(Spec|Test)\\.groovy"].join("|")+")$","i");var W$=(n=>(n.Full="full",n.Static="static",n))(W$||{}),Z$=(i=>(i.Contract="contract",i.Integration="integration",i.Ui="ui",i))(Z$||{}),_Q=(o=>(o.OwnSurface="own_surface",o.StateReadBack="state_read_back",o.Referential="referential",o.Lifecycle="lifecycle",o.Boundaries="boundaries",o))(_Q||{}),K$=(r=>(r.Update="update",r.Regenerate="regenerate",r.Delete="delete",r.Verify="verify",r))(K$||{}),X$=(A=>(A.Equals="equals",A.NotEquals="not_equals",A.GreaterThan="greater_than",A.LessThan="less_than",A.Contains="contains",A.NotContains="not_contains",A.Matches="matches",A.Absent="absent",A.Present="present",A))(X$||{});var Pt=u.string().trim().min(1),tX=u.object({subject:Pt.describe('what the test READS: a response field path, the literal "status", or the on-screen text for a ui case \u2014 the FINAL read in a multi-step case'),comparator:u.nativeEnum(X$),value:u.union([u.string(),u.number(),u.boolean(),u.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),rX=u.object({test:Pt.describe("existing test path, relative to its repository"),repository:Pt.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum(K$),evidence:Pt.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:u.array(u.string()).optional().describe("analyze behavior ids this maintenance covers"),staleOnBase:u.boolean().optional().describe("[derived] the plan found the test already wrong on the base branch: it is left as it is and re-run")});var nX=u.object({surface:Pt.describe("a surface from the list, copied verbatim"),axis:u.nativeEnum(_Q)}),iX=u.object({id:Pt.describe("short-slug, unique across generate[]"),type:u.nativeEnum(Z$),target:Pt.describe('"METHOD /path", or a business-flow name'),from_finding:u.string().optional().describe("analyze finding id this case catches"),from_behavior:u.string().optional().describe("analyze behavior id this case pins"),derived_from:nX.optional().describe("the surface \xD7 axis this case pins when no analyze behavior or finding names it \u2014 one of the three is required"),rationale:Pt.describe("why this test matters"),expected_observable:Pt.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:tX.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:Pt.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:u.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),oX=u.object({covered:u.array(u.string()).optional(),abstain:u.string().optional()}).superRefine((e,t)=>{let n=Array.isArray(e.covered),i=typeof e.abstain=="string";if(n===i)return void t.addIssue({code:u.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&e.covered.length===0&&t.addIssue({code:u.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),i&&!e.abstain.trim()&&t.addIssue({code:u.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),sX=u.object({surface:Pt.describe("a surface from the list, copied verbatim"),axes:u.object(Object.fromEntries(Object.values(_Q).map(e=>[e,oX])))}),Hse=u.object({schemaVersion:u.literal(1),mode:u.nativeEnum(W$),maintenance:u.array(rX),generate:u.array(iX),surfaces:u.array(sX).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:u.object({total:u.number().describe("case count"),rationale:Pt}),summary:Pt.describe("one paragraph")});function NQ(e){return e.hostname.toLowerCase().replace(/^\[|\]$/g,"").replace(/\.$/,"")}var eF="the data-safety guard is not available";var pae=M.object({mode:M.string().optional(),entries:M.array(M.object({entityUrl:M.string().optional(),tornDown:M.boolean().optional(),id:M.union([M.string(),M.number()]).optional(),createdAt:M.number().optional(),testExecution:M.string().optional(),readAt:M.array(M.string()).optional(),deleteAnswered:M.boolean().optional(),deleteStatus:M.number().int().optional(),readBack:M.object({status:M.number().int().optional(),end:M.string().optional()}).passthrough().optional()})).optional(),blocks:M.array(M.object({method:M.string().optional(),url:M.string().optional(),rule:M.string().optional(),count:M.number().nonnegative().optional()})).optional(),unparsedCreates:M.array(M.object({url:M.string().optional(),rule:M.string().optional()})).optional()});var hae=M.object({id:M.string().regex(/^(legacy|unknown|session-[0-9a-f-]{36})$/),stage:M.string(),browserUsed:M.boolean()});var mae=M.object({environmentId:M.string().uuid().optional(),environmentAddress:M.string().url().optional(),persistentDataPolicy:M.custom(e=>xl.safeParse(e).success,"invalid persistent-data policy").optional(),components:M.array(M.object({name:M.string().min(1),url:M.string().min(1),repository:M.string().min(1).optional(),expectedRevision:M.string().min(1).optional(),revisionUrl:M.string().url().optional()}).strict()).min(1),dependencies:M.array(M.object({name:M.string().min(1),url:M.string().nullable(),versionUrl:M.string().nullable(),notes:M.string().nullable()}).strict()).default([]),allowMutation:M.boolean().optional(),offLimits:M.array(M.string().min(1)).optional(),allowedEgress:M.array(M.string().min(1)).optional()}).strict();var gA=e=>Array.isArray(e.ledger)?e.ledger:[],uX=5,lX=["classify","shouldCaptureCreateBody","recordResponse","noteEntityResponse","noteRedirect","recordBlock","ensureLedgerWritable","flush"];function AF(e){if(e)try{let t=(0,aF.createRequire)(e)(e),n=t.DataSafetyGuard;return typeof n!="function"||typeof t.parseDataSafetyConfig!="function"||typeof t.blockReason!="function"||!lX.every(i=>typeof n.prototype[i]=="function")?void 0:t}catch{return}}var MQ=class{constructor(t,n){this.ledgerPath=n;this.mode=String(t?.mode??"")}ledgerPath;ledger=[];blocks=new Map;mode;classify(){return"BLOCK_DENYLISTED"}shouldCaptureCreateBody(){return!1}recordResponse(){}noteEntityResponse(){}noteRedirect(){}recordBlock(t){let n=`${t.method} ${t.url} ${t.rule}`,i=this.blocks.get(n);i?i.count+=1:this.blocks.set(n,{method:t.method,url:t.url,rule:t.rule,count:1}),this.flush()}ensureLedgerWritable(){this.flush()}flush(){tt.writeFileSync(this.ledgerPath,JSON.stringify({mode:this.mode,entries:[],blocks:[...this.blocks.values()]},null,2),{mode:384})}},uF={DataSafetyGuard:MQ,parseDataSafetyConfig:e=>e,blockReason:()=>`${eF}, so Testbot sends no request to the shared environment`},tF=new Set(["GET","HEAD","OPTIONS"]),dX=new Set(["api.anthropic.com:443","github.com:443","api.github.com:443","raw.githubusercontent.com:443","objects.githubusercontent.com:443","codeload.github.com:443","release-assets.githubusercontent.com:443","registry.npmjs.org:443","pypi.org:443","pypi.python.org:443","files.pythonhosted.org:443","cdn.playwright.dev:443","playwright.download.prss.microsoft.com:443"]),fX="storage.googleapis.com",lF=`${fX}:443`,gX=/^\/chrome-for-testing-public\/\d+\.\d+\.\d+\.\d+\/[a-z0-9-]+\/chrome(?:-headless-shell)?-[a-z0-9-]+\.zip$/;function UQ(e){return e.protocol==="https:"&&pA(e)===lF}var LQ=new Le.BlockList;for(let[e,t]of[["0.0.0.0",8],["10.0.0.0",8],["100.64.0.0",10],["127.0.0.0",8],["169.254.0.0",16],["172.16.0.0",12],["192.168.0.0",16],["198.18.0.0",15],["224.0.0.0",4],["240.0.0.0",4]])LQ.addSubnet(e,t,"ipv4");for(let[e,t]of[["::",128],["::1",128],["fc00::",7],["fe80::",10],["ff00::",8]])LQ.addSubnet(e,t,"ipv6");var Jf=64*1024*1024,Yf=3e3,pX=[250,750],dF=1e4,Yae=Yf+dF+Yf,hX=8;var mX=500,IX=/^(content-|if-|expect$|x-http-method|x-method-override$)/,EX=/^(_method|x-http-method(-override)?|x-method-override)$/i;function yX(e,t,n,i){return e===410||e===404&&(t||n&&i)}function rF(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,"").split("/");if(n.length<2||!n.at(-1))return;let i=[...new Set(t.searchParams.keys())].sort();return`${t.origin}${n.slice(0,-1).join("/")}/*${i.length?`?${i.join("&")}`:""}`}catch{return}}var fF=e=>e!==void 0&&e>=200&&e<300;function CX(e){let t=0,n=[];return async i=>{t>=e?await new Promise(r=>n.push(r)):t++;try{return await i()}finally{let r=n.shift();r?r():t--}}}function BX(e,t){return fF(e.responseStatus)&&!!e.entityUrl&&nr(e.entityUrl)===t}function QX(e){let t=new URL(e);for(let n of[...t.searchParams.keys()])EX.test(n)&&t.searchParams.delete(n);return t}function rr(e,t,n,i){let o=`${[n==="blocked"?"Blocked by data safety":"Data safety could not check or record this request",i].filter(Boolean).join(": ")}. Do not retry it.
|
|
188
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){o(s);continue}if(e.external){let A=e.external.registry.get(s[0])?.id;if(t!==s[0]&&A){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}a.count>1&&e.reused==="ref"&&o(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function iT(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let i of t){if(!i||typeof i!="object")return;iT(i);let r=Object.keys(i);if(r.length!==1||r[0]!=="type")return;let o=i.type;for(let s of Array.isArray(o)?o:[o]){if(typeof s!="string")return;n.includes(s)||n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var oT=new Set(["type","properties","required","additionalProperties"]),rT=["oneOf","anyOf"];function nT(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function TC(e){let t=[];for(let o of e){if(typeof o!="object"||o.type!=="object")return null;for(let s in o)if(!oT.has(s))return null;t.push(o)}let n={},i=new Set;for(let o of t){for(let s in o.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let A of t){let l=A.properties?.[s]??nT(A);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:TC(a)??{allOf:a};je(n,s,c)}for(let s of o.required??[])i.add(s)}let r={type:"object",properties:n};if(i.size&&(r.required=[...i]),t.every(o=>o.additionalProperties===!1))r.additionalProperties=!1;else{let o=[];for(let s of t){let a=nT(s);a&&!o.some(c=>JSON.stringify(c)===JSON.stringify(a))&&o.push(a)}o.length===1?r.additionalProperties=o[0]:o.length>1&&(r.additionalProperties={allOf:o})}return r}function h8(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let r of oT)if(r in e)return;let n=t.filter(r=>rT.some(o=>Array.isArray(r[o]))),i=null;if(!n.length)i=TC(t);else{let r=n[0],o=rT.find(c=>Array.isArray(r[c]));if(Object.keys(r).length!==1)return;let s=t.filter(c=>c!==r),a=r[o].map(c=>TC([...s,c]));if(a.some(c=>!c))return;i={[o]:a}}i&&(delete e.allOf,Kc(e,i))}function Yn(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=a=>{let c=e.seen.get(a);if(c.ref===null)return;let A=c.def??c.schema,l={...A},d=c.ref;if(c.ref=null,d){i(d);let g=e.seen.get(d),p=g.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(A.allOf=A.allOf??[],A.allOf.push(p)):Kc(A,p),Kc(A,l),a._zod.parent===d)for(let E in A)E==="$ref"||E==="allOf"||E in l||delete A[E];if(p.$ref&&g.def)for(let E in A)E==="$ref"||E==="allOf"||E in g.def&&JSON.stringify(A[E])===JSON.stringify(g.def[E])&&delete A[E]}let f=a._zod.parent;if(f&&f!==d){i(f);let g=e.seen.get(f);if(g?.schema.$ref&&(A.$ref=g.schema.$ref,g.def))for(let p in A)p==="$ref"||p==="allOf"||p in g.def&&JSON.stringify(A[p])===JSON.stringify(g.def[p])&&delete A[p]}e.override({zodSchema:a,jsonSchema:A,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())i(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())iT(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let A of[c.schema,c.def]){let l=A?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(A):a.set(l,[A])}for(let c of e.intersections)for(let A of a.get(c)??[])h8(A)}}let r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(a)}Kc(r,n.defId?n.schema:n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&r.id===o&&delete r.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,je(s,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?r.$defs=s:r.definitions=s);try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ys(t,"input",e.processors),output:Ys(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function lt(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return lt(i.element,n);if(i.type==="set")return lt(i.valueType,n);if(i.type==="lazy")return lt(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return lt(i.innerType,n);if(i.type==="intersection")return lt(i.left,n)||lt(i.right,n);if(i.type==="record"||i.type==="map")return lt(i.keyType,n)||lt(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:lt(i.in,n)||lt(i.out,n);if(i.type==="object"){for(let r in i.shape)if(lt(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(lt(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(lt(r,n))return!0;return!!(i.rest&<(i.rest,n))}return!1}var $C=(e,t={})=>n=>{let i=Vn({...n,processors:t});return pe(e,i),Jn(i,e),Yn(i,e)},Ys=(e,t,n={})=>i=>{let{libraryOptions:r,target:o}=i??{},s=Vn({...r??{},target:o,io:t,processors:n});return pe(e,s),Jn(s,e),Yn(s,e)};var js=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Hs=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},sT=(e,t)=>{js(e,"minimum",t),Hs(e,"maximum",t)},uT=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},lT=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},dT=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},fT=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},aT=(e,t)=>js(e,"minimum",t.minimum),cT=(e,t)=>Hs(e,"maximum",t.maximum),AT=e=>(t,n)=>{fT(t,n.format);let[i,r]=e[n.format];js(t,"minimum",i),Hs(t,"maximum",r)},m8={greater_than:(e,t)=>js(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Hs(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>uT(e,t.value),number_format:AT(Ec),bigint_format:AT(yc),min_length:aT,max_length:cT,length_equals:(e,t)=>sT(e,t.length),min_size:aT,max_size:cT,size_equals:(e,t)=>sT(e,t.size),string_format:(e,t)=>{fT(e,t.format),t.pattern&&lT(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>dT(e,t.mime)};function Me(e){let t={},n=e._zod.def,i=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let o of i)m8[o._zod.def.check]?.(t,o._zod.def);let r=e._zod.bag;r.minimum!==void 0&&js(t,"minimum",r.minimum),r.exclusiveMinimum!==void 0&&js(t,"exclusiveMinimum",r.exclusiveMinimum),r.maximum!==void 0&&Hs(t,"maximum",r.maximum),r.exclusiveMaximum!==void 0&&Hs(t,"exclusiveMaximum",r.exclusiveMaximum),r.multipleOf!==void 0&&uT(t,r.multipleOf),r.format!==void 0&&(t.format??(t.format=r.format),r.format.includes("int")&&(t.isInt=!0)),r.mime&&dT(t,r.mime);for(let o of r.patterns??[])lT(t,o);return t}var I8={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},E8=new Map([[pd,zI],[Fc,GI]]),gT=e=>E8.get(e)??e,LC=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:o,maximum:s,format:a,patterns:c,contentEncoding:A,laxFormat:l}=Me(e);if(typeof o=="number"&&(r.minLength=o),typeof s=="number"&&(r.maxLength=s),a&&(r.format=I8[a]??a,r.format===""&&delete r.format,(a==="time"||l)&&delete r.format),A&&(r.contentEncoding=A),c&&c.size>0){let d=[...c].map(gT);d.length===1?r.pattern=d[0].source:d.length>1&&(r.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},PC=(e,t,n,i)=>{let r=n,{minimum:o,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:A,isInt:l}=Me(e);r.type=l?"integer":"number";let d=typeof A=="number"&&A>=(o??Number.NEGATIVE_INFINITY),f=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(d?g?(r.minimum=A,r.exclusiveMinimum=!0):r.exclusiveMinimum=A:typeof o=="number"&&(r.minimum=o),f?g?(r.maximum=c,r.exclusiveMaximum=!0):r.exclusiveMaximum=c:typeof s=="number"&&(r.maximum=s),a){let p=new Set;for(let m of a)Number.isFinite(m)&&m!==0?p.add(Math.abs(m)):Fe(e,t,r,i,`A multipleOf divisor of ${m} cannot be represented in JSON Schema`);let[h,...E]=p;h!==void 0&&(r.multipleOf=h),E.length&&(r.allOf=[...r.allOf??[],...E.map(m=>({multipleOf:m}))])}},OC=(e,t,n,i)=>{n.type="boolean"},zC=(e,t,n,i)=>{Fe(e,t,n,i,"BigInt cannot be represented in JSON Schema")},GC=(e,t,n,i)=>{Fe(e,t,n,i,"Symbols cannot be represented in JSON Schema")},VC=(e,t,n,i)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},JC=(e,t,n,i)=>{Fe(e,t,n,i,"Undefined cannot be represented in JSON Schema")},YC=(e,t,n,i)=>{Fe(e,t,n,i,"Void cannot be represented in JSON Schema")},jC=(e,t,n,i)=>{n.not={}},HC=(e,t,n,i)=>{},qC=(e,t,n,i)=>{},WC=(e,t,n,i)=>{Fe(e,t,n,i,"Date cannot be represented in JSON Schema")},ZC=(e,t,n,i)=>{let r=e._zod.def,o=Is(r.entries);if(o.length===0){n.not={};return}o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),n.enum=o},KC=(e,t,n,i)=>{let r=e._zod.def;if(r.values.length===0){n.not={};return}let o=[];for(let s of r.values)if(s===void 0){if(Fe(e,t,n,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(Fe(e,t,n,i,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else o.every(s=>typeof s=="number")&&(n.type="number"),o.every(s=>typeof s=="string")&&(n.type="string"),o.every(s=>typeof s=="boolean")&&(n.type="boolean"),o.every(s=>s===null)&&(n.type="null"),n.enum=o},XC=(e,t,n,i)=>{Fe(e,t,n,i,"NaN cannot be represented in JSON Schema")},eB=(e,t,n,i)=>{let r=n,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=o.source},tB=(e,t,n,i)=>{let r=n;r.type="string",r.format="binary",r.contentEncoding="binary";let{minimum:o,maximum:s,mime:a}=Me(e);o!==void 0&&(r.minLength=o),s!==void 0&&(r.maxLength=s),a&&(a.length===0?r.not={}:a.length===1?r.contentMediaType=a[0]:r.anyOf=a.map(c=>({contentMediaType:c})))},rB=(e,t,n,i)=>{n.type="boolean"},nB=(e,t,n,i)=>{Fe(e,t,n,i,"Custom types cannot be represented in JSON Schema")},iB=(e,t,n,i)=>{Fe(e,t,n,i,"Function types cannot be represented in JSON Schema")},oB=(e,t,n,i)=>{Fe(e,t,n,i,"Transforms cannot be represented in JSON Schema")},sB=(e,t,n,i)=>{Fe(e,t,n,i,"Map cannot be represented in JSON Schema")},aB=(e,t,n,i)=>{Fe(e,t,n,i,"Set cannot be represented in JSON Schema")},cB=(e,t,n,i)=>{let r=n,o=e._zod.def,{minimum:s,maximum:a}=Me(e);typeof s=="number"&&(r.minItems=s),typeof a=="number"&&(r.maxItems=a),r.type="array",r.items=pe(o.element,t,{...i,path:[...i.path,"items"]})};function Xc(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Xc(t.out):t.type==="catch"?Xc(t.innerType):e._zod.optin}var AB=(e,t,n,i)=>{let r=n,o=e._zod.def,s=o.shape;if(Object.getOwnPropertySymbols(s).length&&Fe(e,t,r,i,"Symbol keys cannot be represented in JSON Schema"))return;r.type="object",r.properties={};for(let A in s)je(r.properties,A,pe(s[A],t,{...i,path:[...i.path,"properties",A]}));let c=[];for(let A of Object.keys(s)){let l=o.shape[A];(t.io==="input"?Xc(l)===void 0:l._zod.optout===void 0)&&c.push(A)}c.length>0&&(r.required=c),o.catchall?._zod.def.type==="never"?r.additionalProperties=!1:o.catchall?o.catchall&&(r.additionalProperties=pe(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},ff=(e,t,n,i)=>{let r=e._zod.def,o=r.inclusive===!1,s=r.options.map((a,c)=>pe(a,t,{...i,path:[...i.path,o?"oneOf":"anyOf",c]}));o?n.oneOf=s:n.anyOf=s},uB=(e,t,n,i)=>{let r=e._zod.def,o=pe(r.left,t,{...i,path:[...i.path,"allOf",0]}),s=pe(r.right,t,{...i,path:[...i.path,"allOf",1]}),a=A=>"allOf"in A&&Object.keys(A).length===1,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},lB=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((h,E)=>pe(h,t,{...i,path:[...i.path,s,E]})),A=o.rest?pe(o.rest,t,{...i,path:[...i.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,l=o.items.length;for(;l>0;){let h=o.items[l-1];if(!(t.io==="input"?Xc(h)!==void 0:h._zod.optout==="optional"))break;l--}let d=o.items.length,f=!o.rest;t.target==="draft-2020-12"?(r.prefixItems=c,f?r.items=!1:A&&(r.items=A),l>0&&(r.minItems=l),f&&(r.maxItems=d)):t.target==="openapi-3.0"?(r.items={anyOf:c},A&&r.items.anyOf.push(A),l>0&&(r.minItems=l),f&&(r.maxItems=d)):(r.items=c,f?r.additionalItems=!1:A&&(r.additionalItems=A),l>0&&(r.minItems=l),f&&(r.maxItems=d));let{minimum:g,maximum:p}=Me(e);typeof g=="number"&&(r.minItems=g),typeof p=="number"&&(r.maxItems=p)};function FC(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let p=e.get(t)?.def;if(!p)return t;let h=FC(e,p,n);return h===p?t:h}for(let p of["anyOf","oneOf"]){let h=t[p];if(!Array.isArray(h))continue;let E=h.map(m=>FC(e,m,n));E.some((m,C)=>m!==h[C])&&(t={...t,[p]:E})}let i=Array.isArray(t.type)?t.type:[t.type],r=!i.includes("string")&&i.some(p=>p==="number"||p==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!r&&!o?.some(p=>typeof p=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:A,multipleOf:l,format:d,id:f,...g}=t;return g.enum?g.enum=g.enum.map(p=>typeof p=="number"?String(p):p):typeof g.const=="number"&&(g.const=String(g.const)),r&&(g.type="string",o||(g.pattern=(i.includes("number")?ln:Rc).source)),g}var MC=new WeakMap;function y8(e){let t=new Map;for(let i of e.seen.values())i.def&&!t.has(i.schema)&&t.set(i.schema,i);let n=new Map;for(let i of MC.get(e)??[]){let r=e.seen.get(i),o=(r?.def??r?.schema)?.propertyNames;if(!o||o===!0||n.has(o))continue;let s=FC(t,o,new Set);s!==o&&n.set(o,s)}if(n.size)for(let i of e.seen.values())for(let r of[i.schema,i.def]){let o=r&&n.get(r.propertyNames);o&&(r.propertyNames=o)}}var dB=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="object";let s=o.keyType,a=Me(s).patterns;if(o.mode==="loose"&&a&&a.size>0){let l=pe(o.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let d of a)je(r.patternProperties,gT(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){r.propertyNames=pe(o.keyType,t,{...i,path:[...i.path,"propertyNames"]});let l=MC.get(t);l||(l=[],MC.set(t,l),t.deferred.push(()=>y8(t))),l.push(e)}r.additionalProperties=pe(o.valueType,t,{...i,path:[...i.path,"additionalProperties"]})}let c=s._zod.values,A=t.io==="input"&&Xc(o.valueType)!==void 0;if(c&&!o.partial&&!A){let l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(r.required=l.map(String))}},fB=(e,t,n,i)=>{let r=e._zod.def,o=pe(r.innerType,t,i),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=r.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},gB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},pB=Symbol();function pT(e,t,n,i,r){let o=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(o=!0,null));return o?(Fe(t,n,i,r,"BigInt defaults cannot be represented in JSON Schema"),pB):JSON.parse(s)}var hB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let s=pT(r.defaultValue,e,t,n,i);s!==pB&&(n.default=s)},mB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);if(o.ref=r.innerType,t.io!=="input")return;let s=pT(r.defaultValue,e,t,n,i);s!==pB&&(n._prefault=s)},IB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let s;try{s=r.catchValue(void 0)}catch{Fe(e,t,n,i,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},EB=(e,t,n,i)=>{let r=e._zod.def,o=r.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?o?r.out:r.in:r.out;pe(s,t,i);let a=t.seen.get(e);a.ref=s},yB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,n.readOnly=!0},CB=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},gf=(e,t,n,i)=>{let r=e._zod.def;pe(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},BB=(e,t,n,i)=>{let r=e._zod.innerType;pe(r,t,i);let o=t.seen.get(e);o.ref=r},df={string:LC,number:PC,boolean:OC,bigint:zC,symbol:GC,null:VC,undefined:JC,void:YC,never:jC,any:HC,unknown:qC,date:WC,enum:ZC,literal:KC,nan:XC,template_literal:eB,file:tB,success:rB,custom:nB,function:iB,transform:oB,map:sB,set:aB,array:cB,object:AB,union:ff,intersection:uB,tuple:lB,record:dB,nullable:fB,nonoptional:gB,default:hB,prefault:mB,catch:IB,pipe:EB,readonly:yB,promise:CB,optional:gf,lazy:BB};function pf(e,t){if("_idmap"in e){let i=e,r=Vn({...t,processors:df}),o={};for(let c of i._idmap.entries()){let[A,l]=c;pe(l,r)}let s={},a={registry:i,uri:t?.uri,defs:o};r.external=a;for(let c of i._idmap.entries()){let[A,l]=c;Jn(r,l),je(s,A,Yn(r,l))}if(Object.keys(o).length>0){let c=r.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:o}}return{schemas:s}}let n=Vn({...t,processors:df});return pe(e,n),Jn(n,e),Yn(n,e)}var hf=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=Vn({processors:df,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return pe(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Jn(this.ctx,t);let i=Yn(this.ctx,t),{"~standard":r,...o}=i;return o}};var hT={};var ra={};Qr(ra,{ZodAny:()=>VB,ZodArray:()=>HB,ZodBase64:()=>Tf,ZodBase64URL:()=>$f,ZodBigInt:()=>ea,ZodBigIntFormat:()=>Lf,ZodBoolean:()=>Xs,ZodCIDRv4:()=>Nf,ZodCIDRv6:()=>Uf,ZodCUID:()=>bf,ZodCUID2:()=>kf,ZodCatch:()=>pQ,ZodCodec:()=>AA,ZodCreditCard:()=>$B,ZodCustom:()=>uA,ZodCustomStringFormat:()=>ao,ZodDate:()=>nA,ZodDefault:()=>AQ,ZodDiscriminatedUnion:()=>WB,ZodE164:()=>Ff,ZodEmail:()=>Bf,ZodEmoji:()=>vf,ZodEnum:()=>Ws,ZodExactOptional:()=>Gf,ZodFile:()=>oQ,ZodFunction:()=>wQ,ZodGUID:()=>Qf,ZodIBAN:()=>FB,ZodIPv4:()=>Df,ZodIPv6:()=>_f,ZodISODate:()=>Hn,ZodISODateTime:()=>jn,ZodISODuration:()=>Wn,ZodISOTime:()=>qn,ZodInstanceOf:()=>SQ,ZodIntersection:()=>ZB,ZodJWT:()=>Mf,ZodKSUID:()=>Rf,ZodLazy:()=>BQ,ZodLiteral:()=>iQ,ZodMAC:()=>TB,ZodMap:()=>rQ,ZodNaN:()=>mQ,ZodNanoID:()=>wf,ZodNever:()=>YB,ZodNonOptional:()=>Vf,ZodNull:()=>zB,ZodNullable:()=>cQ,ZodNumber:()=>Ks,ZodNumberFormat:()=>co,ZodObject:()=>oA,ZodOptional:()=>aA,ZodPipe:()=>cA,ZodPrefault:()=>lQ,ZodPreprocess:()=>IQ,ZodPromise:()=>vQ,ZodReadonly:()=>EQ,ZodRecord:()=>qs,ZodSet:()=>nQ,ZodString:()=>Zs,ZodStringFormat:()=>me,ZodSuccess:()=>gQ,ZodSymbol:()=>PB,ZodTemplateLiteral:()=>CQ,ZodTransform:()=>sQ,ZodTuple:()=>XB,ZodType:()=>ee,ZodULID:()=>Sf,ZodURL:()=>rA,ZodUUID:()=>Vr,ZodUndefined:()=>OB,ZodUnion:()=>sA,ZodUnknown:()=>JB,ZodVoid:()=>jB,ZodXID:()=>xf,ZodXor:()=>qB,_ZodString:()=>Cf,_default:()=>uQ,_function:()=>S$,any:()=>o$,array:()=>iA,base64:()=>LT,base64url:()=>PT,bigint:()=>e$,boolean:()=>LB,catch:()=>hQ,check:()=>x$,cidrv4:()=>FT,cidrv6:()=>MT,codec:()=>v$,creditCard:()=>zT,cuid:()=>xT,cuid2:()=>RT,currencyCode:()=>HT,custom:()=>R$,date:()=>a$,describe:()=>D$,discriminatedUnion:()=>f$,e164:()=>OT,email:()=>ET,emoji:()=>kT,enum:()=>Of,exactOptional:()=>aQ,file:()=>y$,float32:()=>WT,float64:()=>ZT,function:()=>S$,guid:()=>yT,hash:()=>qT,hex:()=>jT,hostname:()=>YT,httpUrl:()=>bT,iban:()=>GT,instanceof:()=>N$,int:()=>Ef,int32:()=>KT,int64:()=>t$,intersection:()=>KB,invertCodec:()=>w$,ipv4:()=>UT,ipv6:()=>$T,json:()=>T$,jwt:()=>VT,keyof:()=>c$,ksuid:()=>NT,lazy:()=>QQ,literal:()=>E$,looseObject:()=>l$,looseRecord:()=>p$,mac:()=>TT,map:()=>h$,meta:()=>_$,nan:()=>Q$,nanoid:()=>ST,nativeEnum:()=>I$,never:()=>Pf,nonoptional:()=>fQ,null:()=>GB,nullable:()=>tA,nullish:()=>C$,number:()=>MB,object:()=>A$,optional:()=>oo,partialRecord:()=>g$,pipe:()=>yf,prefault:()=>dQ,preprocess:()=>$$,promise:()=>k$,readonly:()=>yQ,record:()=>tQ,refine:()=>bQ,set:()=>m$,strictObject:()=>u$,string:()=>eA,stringFormat:()=>JT,stringbool:()=>U$,success:()=>B$,superRefine:()=>kQ,symbol:()=>n$,templateLiteral:()=>b$,transform:()=>zf,tuple:()=>eQ,uint32:()=>XT,uint64:()=>r$,ulid:()=>DT,undefined:()=>i$,union:()=>ta,unknown:()=>io,url:()=>wT,uuid:()=>CT,uuidv4:()=>BT,uuidv6:()=>QT,uuidv7:()=>vT,void:()=>s$,xid:()=>_T,xor:()=>d$});var mf={};Qr(mf,{endsWith:()=>Ms,gt:()=>zr,gte:()=>Lt,includes:()=>$s,length:()=>ro,lowercase:()=>Us,lt:()=>Or,lte:()=>Mt,maxLength:()=>to,maxSize:()=>Gn,mime:()=>Ps,minLength:()=>dn,minSize:()=>Gr,multipleOf:()=>zn,negative:()=>cf,nonnegative:()=>uf,nonpositive:()=>Af,normalize:()=>Os,overwrite:()=>Cr,positive:()=>af,properties:()=>Ls,property:()=>lf,regex:()=>Ns,size:()=>eo,slugify:()=>Js,startsWith:()=>Fs,toLowerCase:()=>Gs,toUpperCase:()=>Vs,trim:()=>zs,uppercase:()=>Ts});var mT=new WeakSet([Object.prototype,Error.prototype]);function If(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let i=n(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}var IT=(e,t)=>{BI.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);mT.has(n)||(mT.add(n),If(n,"format",i=>r=>bc(i,r)),If(n,"flatten",i=>r=>wc(i,r)),If(n,"addIssue",i=>r=>{i.issues.push(r),i.message=JSON.stringify(i.issues,Es,2)}),If(n,"addIssues",i=>r=>{i.issues.push(...r),i.message=JSON.stringify(i.issues,Es,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},B8=I("ZodError",IT),wt=I("ZodError",IT,void 0,{Parent:Error});var QB=vs(wt),vB=ws(wt),wB=bs(wt),bB=ks(wt),kB=Yl(wt),SB=jl(wt),xB=Hl(wt),RB=ql(wt),DB=Wl(wt),_B=Zl(wt),NB=Kl(wt),UB=Xl(wt);function v8(){ze.localeError||De(Dd())}function so(){ze.memoizer||De({memoizer:Vc()})}var ee=I("ZodType",(e,t)=>(v8(),Z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(B.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return fe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(bQ(e,t))},superRefine(e,t){return this.check(kQ(e,t))},overwrite(e){return this.check(Cr(e))},optional(){return oo(this)},exactOptional(){return aQ(this)},nullable(){return tA(this)},nullish(){return oo(tA(this))},nonoptional(e){return fQ(this,e)},array(){return iA(this)},or(e){return ta([this,e])},and(e){return KB(this,e)},transform(e){return yf(this,zf(e))},default(e){return uQ(this,e)},prefault(e){return dQ(this,e)},catch(e){return hQ(this,e)},pipe(e){return yf(this,e)},readonly(){return yQ(this)},describe(e){let t=this.clone();return He.add(t,{description:e}),t},meta(...e){if(e.length===0)return He.get(this);let t=this.clone();return He.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 B.hide(this,"~standard",{...ud(this),jsonSchema:{input:Ys(this,"input"),output:Ys(this,"output")}})},set"~standard"(e){B.own(this,"~standard",e)},parse:function e(t,n){return QB(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await vB(this,t,n,{callee:e})},safeParse(e,t){return wB(this,e,t)},async safeParseAsync(e,t){return bB(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){B.own(this,"spa",e)},validate(e,t){return kc(this,e,t)},validateAsync(e,t){return Sc(this,e,t)},encode:function e(t,n){return kB(this,t,n,{callee:e})},decode:function e(t,n){return SB(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await xB(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await RB(this,t,n,{callee:e})},safeEncode(e,t){return DB(this,e,t)},safeDecode(e,t){return _B(this,e,t)},async safeEncodeAsync(e,t){return NB(this,e,t)},async safeDecodeAsync(e,t){return UB(this,e,t)},toJSONSchema(e){return $C(this,{})(e)},get description(){return He.get(this)?.description},get _def(){return this._zod.def}}),Cf=I("_ZodString",(e,t)=>{Wi.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>LC(e,n,i,r)},B.derived({format:e=>Me(e).format??null,minLength:e=>Me(e).minimum??null,maxLength:e=>Me(e).maximum??null},{regex(...e){return this.check(Ns(...e))},includes(...e){return this.check($s(...e))},startsWith(...e){return this.check(Fs(...e))},endsWith(...e){return this.check(Ms(...e))},min(...e){return this.check(dn(...e))},max(...e){return this.check(to(...e))},length(...e){return this.check(ro(...e))},nonempty(...e){return this.check(dn(1,...e))},lowercase(e){return this.check(Us(e))},uppercase(e){return this.check(Ts(e))},trim(){return this.check(zs())},normalize(...e){return this.check(Os(...e))},toLowerCase(){return this.check(Gs())},toUpperCase(){return this.check(Vs())},slugify(){return this.check(Js())}})),Zs=I("ZodString",(e,t)=>{Wi.init(e,t),Cf.init(e,t)},{email(e){return this.check(Ld(Bf,e))},url(e){return this.check(jc(rA,e))},jwt(e){return this.check(sf(Mf,e))},emoji(e){return this.check(Jd(vf,e))},guid(e){return this.check(Pd(Qf,e))},uuid(e){return this.check(Od(Vr,e))},uuidv4(e){return this.check(zd(Vr,e))},uuidv6(e){return this.check(Gd(Vr,e))},uuidv7(e){return this.check(Vd(Vr,e))},nanoid(e){return this.check(Yd(wf,e))},cuid(e){return this.check(jd(bf,e))},cuid2(e){return this.check(Hd(kf,e))},ulid(e){return this.check(qd(Sf,e))},base64(e){return this.check(rf(Tf,e))},base64url(e){return this.check(nf($f,e))},xid(e){return this.check(Wd(xf,e))},ksuid(e){return this.check(Zd(Rf,e))},ipv4(e){return this.check(Kd(Df,e))},ipv6(e){return this.check(Xd(_f,e))},cidrv4(e){return this.check(ef(Nf,e))},cidrv6(e){return this.check(tf(Uf,e))},e164(e){return this.check(of(Ff,e))},datetime(e){return this.check(Hc(jn,e))},date(e){return this.check(qc(Hn,e))},time(e){return this.check(Wc(qn,e))},duration(e){return this.check(Zc(Wn,e))}});function eA(e){return Ky(Zs,e)}var me=I("ZodStringFormat",(e,t)=>{ge.init(e,t),Cf.init(e,t)}),jn=I("ZodISODateTime",(e,t)=>{zE.init(e,t),me.init(e,t)}),Hn=I("ZodISODate",(e,t)=>{GE.init(e,t),me.init(e,t)}),qn=I("ZodISOTime",(e,t)=>{VE.init(e,t),me.init(e,t)}),Wn=I("ZodISODuration",(e,t)=>{JE.init(e,t),me.init(e,t)}),Bf=I("ZodEmail",(e,t)=>{DE.init(e,t),me.init(e,t)});function ET(e){return Ld(Bf,e)}var Qf=I("ZodGUID",(e,t)=>{xE.init(e,t),me.init(e,t)});function yT(e){return Pd(Qf,e)}var Vr=I("ZodUUID",(e,t)=>{RE.init(e,t),me.init(e,t)});function CT(e){return Od(Vr,e)}function BT(e){return zd(Vr,e)}function QT(e){return Gd(Vr,e)}function vT(e){return Vd(Vr,e)}var rA=I("ZodURL",(e,t)=>{UE.init(e,t),me.init(e,t)});function wT(e){return jc(rA,e)}function bT(e){return jc(rA,{protocol:xc,hostname:JI,...B.normalizeParams(e)})}var vf=I("ZodEmoji",(e,t)=>{TE.init(e,t),me.init(e,t)});function kT(e){return Jd(vf,e)}var wf=I("ZodNanoID",(e,t)=>{$E.init(e,t),me.init(e,t)});function ST(e){return Yd(wf,e)}var bf=I("ZodCUID",(e,t)=>{FE.init(e,t),me.init(e,t)});function xT(e){return jd(bf,e)}var kf=I("ZodCUID2",(e,t)=>{ME.init(e,t),me.init(e,t)});function RT(e){return Hd(kf,e)}var Sf=I("ZodULID",(e,t)=>{LE.init(e,t),me.init(e,t)});function DT(e){return qd(Sf,e)}var xf=I("ZodXID",(e,t)=>{PE.init(e,t),me.init(e,t)});function _T(e){return Wd(xf,e)}var Rf=I("ZodKSUID",(e,t)=>{OE.init(e,t),me.init(e,t)});function NT(e){return Zd(Rf,e)}var Df=I("ZodIPv4",(e,t)=>{YE.init(e,t),me.init(e,t)});function UT(e){return Kd(Df,e)}var TB=I("ZodMAC",(e,t)=>{HE.init(e,t),me.init(e,t)});function TT(e){return eC(TB,e)}var _f=I("ZodIPv6",(e,t)=>{jE.init(e,t),me.init(e,t)});function $T(e){return Xd(_f,e)}var Nf=I("ZodCIDRv4",(e,t)=>{qE.init(e,t),me.init(e,t)});function FT(e){return ef(Nf,e)}var Uf=I("ZodCIDRv6",(e,t)=>{WE.init(e,t),me.init(e,t)});function MT(e){return tf(Uf,e)}var Tf=I("ZodBase64",(e,t)=>{ZE.init(e,t),me.init(e,t)});function LT(e){return rf(Tf,e)}var $f=I("ZodBase64URL",(e,t)=>{KE.init(e,t),me.init(e,t)});function PT(e){return nf($f,e)}var Ff=I("ZodE164",(e,t)=>{XE.init(e,t),me.init(e,t)});function OT(e){return of(Ff,e)}var $B=I("ZodCreditCard",(e,t)=>{ey.init(e,t),me.init(e,t)});function zT(e){return tC($B,e)}var FB=I("ZodIBAN",(e,t)=>{ty.init(e,t),me.init(e,t)});function GT(e){return rC(FB,e)}var Mf=I("ZodJWT",(e,t)=>{ry.init(e,t),me.init(e,t)});function VT(e){return sf(Mf,e)}var ao=I("ZodCustomStringFormat",(e,t)=>{ny.init(e,t),me.init(e,t)});function JT(e,t,n={}){return no(ao,e,t,n)}function YT(e){return no(ao,"hostname",VI,e)}function jT(e){return no(ao,"hex",oE,e)}function HT(e){return no(ao,"currency_code",jI,e)}function qT(e,t){let n=t?.enc??"hex",i=`${e}_${n}`,r=tr[i];if(!r)throw new Error(`Unrecognized hash format: ${i}`);return no(ao,i,r,t)}var Ks=I("ZodNumber",(e,t)=>{yd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>PC(e,n,i,r),e.isFinite=!0},B.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Me(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Me(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:n}=Me(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Me(e).format??null},{gt(e,t){return this.check(zr(e,t))},gte(e,t){return this.check(Lt(e,t))},min(e,t){return this.check(Lt(e,t))},lt(e,t){return this.check(Or(e,t))},lte(e,t){return this.check(Mt(e,t))},max(e,t){return this.check(Mt(e,t))},int(e){return this.check(Ef(e))},safe(e){return this.check(Ef(e))},positive(e){return this.check(zr(0,e))},nonnegative(e){return this.check(Lt(0,e))},negative(e){return this.check(Or(0,e))},nonpositive(e){return this.check(Mt(0,e))},multipleOf(e,t){return this.check(zn(e,t))},step(e,t){return this.check(zn(e,t))},finite(){return this}}));function MB(e){return iC(Ks,e)}var co=I("ZodNumberFormat",(e,t)=>{iy.init(e,t),Ks.init(e,t)});function Ef(e){return sC(co,e)}function WT(e){return aC(co,e)}function ZT(e){return cC(co,e)}function KT(e){return AC(co,e)}function XT(e){return uC(co,e)}var Xs=I("ZodBoolean",(e,t)=>{Mc.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>OC(e,n,i,r)});function LB(e){return lC(Xs,e)}var ea=I("ZodBigInt",(e,t)=>{Cd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>zC(e,n,i,r)},B.derived({minValue:e=>Me(e).minimum??null,maxValue:e=>Me(e).maximum??null,format:e=>Me(e).format??null},{gte(e,t){return this.check(Lt(e,t))},min(e,t){return this.check(Lt(e,t))},gt(e,t){return this.check(zr(e,t))},lt(e,t){return this.check(Or(e,t))},lte(e,t){return this.check(Mt(e,t))},max(e,t){return this.check(Mt(e,t))},positive(e){return this.check(zr(BigInt(0),e))},negative(e){return this.check(Or(BigInt(0),e))},nonpositive(e){return this.check(Mt(BigInt(0),e))},nonnegative(e){return this.check(Lt(BigInt(0),e))},multipleOf(e,t){return this.check(zn(e,t))}}));function e$(e){return fC(ea,e)}var Lf=I("ZodBigIntFormat",(e,t)=>{oy.init(e,t),ea.init(e,t)});function t$(e){return pC(Lf,e)}function r$(e){return hC(Lf,e)}var PB=I("ZodSymbol",(e,t)=>{sy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>GC(e,n,i,r)});function n$(e){return mC(PB,e)}var OB=I("ZodUndefined",(e,t)=>{ay.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>JC(e,n,i,r)});function i$(e){return IC(OB,e)}var zB=I("ZodNull",(e,t)=>{cy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>VC(e,n,i,r)});function GB(e){return EC(zB,e)}var VB=I("ZodAny",(e,t)=>{Ay.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>HC(e,n,i,r)});function o$(){return yC(VB)}var JB=I("ZodUnknown",(e,t)=>{uy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>qC(e,n,i,r)});function io(){return CC(JB)}var YB=I("ZodNever",(e,t)=>{ly.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>jC(e,n,i,r)});function Pf(e){return BC(YB,e)}var jB=I("ZodVoid",(e,t)=>{dy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>YC(e,n,i,r)});function s$(e){return QC(jB,e)}var nA=I("ZodDate",(e,t)=>{fy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>WC(e,n,i,r),e.min=(n,i)=>e.check(Lt(n,i)),e.max=(n,i)=>e.check(Mt(n,i))},B.derived({minDate:e=>{let{minimum:t}=Me(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=Me(e);return t?new Date(t):null}},{}));function a$(e){return vC(nA,e)}var HB=I("ZodArray",(e,t)=>{so(),py.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>cB(e,n,i,r),e.element=t.element},{min(e,t){return this.check(dn(e,t))},nonempty(e){return this.check(dn(1,e))},max(e,t){return this.check(to(e,t))},length(e,t){return this.check(ro(e,t))},unwrap(){return this.element}});function iA(e,t){return kC(HB,e,t)}function c$(e){let t=e._zod.def.shape;return Of(Object.keys(t))}var oA=I("ZodObject",(e,t)=>{so(),hy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>AB(e,n,i,r),B.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Of(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(B.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(B.mergeDefs(this._zod.def,{catchall:io()}))},loose(){return this.clone(B.mergeDefs(this._zod.def,{catchall:io()}))},strict(){return this.clone(B.mergeDefs(this._zod.def,{catchall:Pf()}))},strip(){return this.clone(B.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return B.extend(this,e)},safeExtend(e){return B.safeExtend(this,e)},merge(e){return B.merge(this,e)},pick(e){return B.pick(this,e)},omit(e){return B.omit(this,e)},partial(...e){return B.partial(aA,this,e[0])},exactPartial(...e){return B.partial(Gf,this,e[0],"exactPartial")},required(...e){return B.required(Vf,this,e[0])}});function A$(e,t){let n={type:"object",shape:e??{},...B.normalizeParams(t)};return new oA(n)}function u$(e,t){return new oA({type:"object",shape:e,catchall:Pf(),...B.normalizeParams(t)})}function l$(e,t){return new oA({type:"object",shape:e,catchall:io(),...B.normalizeParams(t)})}var sA=I("ZodUnion",(e,t)=>{Lc.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ff(e,n,i,r),e.options=t.options});function ta(e,t){return new sA({type:"union",options:e,...B.normalizeParams(t)})}var qB=I("ZodXor",(e,t)=>{sA.init(e,t),my.init(e,t),e._zod.processJSONSchema=(n,i,r)=>ff(e,n,i,r),e.options=t.options});function d$(e,t){return new qB({type:"union",options:e,inclusive:!1,...B.normalizeParams(t)})}var WB=I("ZodDiscriminatedUnion",(e,t)=>{sA.init(e,t),Ey.init(e,t)});function f$(e,t,n){return new WB({type:"union",options:t,discriminator:e,...B.normalizeParams(n)})}var ZB=I("ZodIntersection",(e,t)=>{yy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>uB(e,n,i,r)});function KB(e,t){return new ZB({type:"intersection",left:e,right:t})}var XB=I("ZodTuple",(e,t)=>{so(),Bd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>lB(e,n,i,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new aA({type:"optional",innerType:t}))})}});function eQ(e,t,n){let i=t instanceof Z,r=i?n:t,o=i?t:null;return new XB({type:"tuple",items:e,rest:o,...B.normalizeParams(r)})}var qs=I("ZodRecord",(e,t)=>{so(),Cy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>dB(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function tQ(e,t,n){return!t||!t._zod?new qs({type:"record",keyType:eA(),valueType:e,...B.normalizeParams(t)}):new qs({type:"record",keyType:e,valueType:t,...B.normalizeParams(n)})}function g$(e,t,n){return new qs({type:"record",keyType:e,valueType:t,...B.normalizeParams(n),partial:!0})}function p$(e,t,n){return new qs({type:"record",keyType:e,valueType:t,mode:"loose",...B.normalizeParams(n)})}var rQ=I("ZodMap",(e,t)=>{so(),By.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>sB(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(Gr(...n)),e.nonempty=n=>e.check(Gr(1,n)),e.max=(...n)=>e.check(Gn(...n)),e.size=(...n)=>e.check(eo(...n))});function h$(e,t,n){return new rQ({type:"map",keyType:e,valueType:t,...B.normalizeParams(n)})}var nQ=I("ZodSet",(e,t)=>{so(),Qy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>aB(e,n,i,r),e.min=(...n)=>e.check(Gr(...n)),e.nonempty=n=>e.check(Gr(1,n)),e.max=(...n)=>e.check(Gn(...n)),e.size=(...n)=>e.check(eo(...n))});function m$(e,t){return new nQ({type:"set",valueType:e,...B.normalizeParams(t)})}var Ws=I("ZodEnum",(e,t)=>{vy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(i,r,o)=>ZC(e,i,r,o),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let o={};for(let s of i)if(n.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Ws({...t,checks:[],...B.normalizeParams(r),entries:o})},e.exclude=(i,r)=>{let o={...t.entries};for(let s of i)if(n.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new Ws({...t,checks:[],...B.normalizeParams(r),entries:o})}});function Of(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Ws({type:"enum",entries:n,...B.normalizeParams(t)})}function I$(e,t){return new Ws({type:"enum",entries:e,...B.normalizeParams(t)})}var iQ=I("ZodLiteral",(e,t)=>{wy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>KC(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function E$(e,t){return new iQ({type:"literal",values:Array.isArray(e)?e:[e],...B.normalizeParams(t)})}var oQ=I("ZodFile",(e,t)=>{by.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>tB(e,n,i,r),e.min=(n,i)=>e.check(Gr(n,i)),e.max=(n,i)=>e.check(Gn(n,i)),e.mime=(n,i)=>e.check(Ps(Array.isArray(n)?n:[n],i))});function y$(e){return SC(oQ,e)}var sQ=I("ZodTransform",(e,t)=>{so(),ky.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>oB(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Pn(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(B.issue(o,n.value,t));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=e),n.issues.push(B.issue(s))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(o=>(n.value=o,n)):(n.value=r,n)}});function zf(e){return new sQ({type:"transform",transform:e})}var aA=I("ZodOptional",(e,t)=>{Qd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>gf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function oo(e){return new aA({type:"optional",innerType:e})}var Gf=I("ZodExactOptional",(e,t)=>{Sy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>gf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function aQ(e){return new Gf({type:"optional",innerType:e})}var cQ=I("ZodNullable",(e,t)=>{xy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>fB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function tA(e){return new cQ({type:"nullable",innerType:e})}function C$(e){return oo(tA(e))}var AQ=I("ZodDefault",(e,t)=>{Ry.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>hB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function uQ(e,t){return new AQ({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():B.shallowClone(t)}})}var lQ=I("ZodPrefault",(e,t)=>{Dy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>mB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function dQ(e,t){return new lQ({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():B.shallowClone(t)}})}var Vf=I("ZodNonOptional",(e,t)=>{_y.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>gB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function fQ(e,t){return new Vf({type:"nonoptional",innerType:e,...B.normalizeParams(t)})}var gQ=I("ZodSuccess",(e,t)=>{Ny.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>rB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function B$(e){return new gQ({type:"success",innerType:e})}var pQ=I("ZodCatch",(e,t)=>{Uy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>IB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function hQ(e,t){return new pQ({type:"catch",innerType:e,catchValue:typeof t=="function"?t:B.constantCatch(t)})}var mQ=I("ZodNaN",(e,t)=>{Ty.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>XC(e,n,i,r)});function Q$(e){return bC(mQ,e)}var cA=I("ZodPipe",(e,t)=>{vd.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>EB(e,n,i,r),e.in=t.in,e.out=t.out});function yf(e,t){return new cA({type:"pipe",in:e,out:t})}var AA=I("ZodCodec",(e,t)=>{cA.init(e,t),Pc.init(e,t)});function v$(e,t,n){return new AA({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function w$(e){let t=e._zod.def;return new AA({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var IQ=I("ZodPreprocess",(e,t)=>{cA.init(e,t),$y.init(e,t)}),EQ=I("ZodReadonly",(e,t)=>{Fy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>yB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function yQ(e){return new EQ({type:"readonly",innerType:e})}var CQ=I("ZodTemplateLiteral",(e,t)=>{My.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>eB(e,n,i,r)});function b$(e,t){return new CQ({type:"template_literal",parts:e,...B.normalizeParams(t)})}var BQ=I("ZodLazy",(e,t)=>{Oc.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>BB(e,n,i,r),e.unwrap=()=>e._zod.def.getter()});function QQ(e){return new BQ({type:"lazy",getter:e})}var vQ=I("ZodPromise",(e,t)=>{Py.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>CB(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function k$(e){return new vQ({type:"promise",innerType:e})}var wQ=I("ZodFunction",(e,t)=>{Ly.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>iB(e,n,i,r)});function S$(e){return new wQ({type:"function",input:Array.isArray(e?.input)?eQ(e?.input):e?.input??iA(io()),output:e?.output??io()})}var uA=I("ZodCustom",(e,t)=>{Oy.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,i,r)=>nB(e,n,i,r)});function x$(e){let t=new ye({check:"custom"});return t._zod.check=e,t}function R$(e,t){return xC(uA,e??(()=>!0),t)}function bQ(e,t={}){return RC(uA,e,t)}function kQ(e,t){return DC(e,t)}var D$=_C,_$=NC,SQ=I("ZodInstanceOf",(e,t)=>{uA.init(e,t)},{properties(e,t){return this.check(Ls(e,t))}});function N$(e,t={}){let n=new SQ({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...B.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:n,path:[...n._zod.def.path??[]]})},n}var U$=(...e)=>UC({Codec:AA,Boolean:Xs,String:Zs},...e);function T$(e){let t=QQ(()=>ta([eA(e),MB(),LB(),GB(),iA(t),tQ(eA(),t)]));return t}function $$(e,t){return new IQ({type:"pipe",in:zf(e),out:t})}var w8={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function b8(e){De({customError:e})}function k8(){return De().customError}var xQ;xQ||(xQ={});var lA={};Qr(lA,{ZodISODate:()=>Hn,ZodISODateTime:()=>jn,ZodISODuration:()=>Wn,ZodISOTime:()=>qn,date:()=>x8,datetime:()=>S8,duration:()=>D8,time:()=>R8});function S8(e){return Hc(jn,e)}function x8(e){return qc(Hn,e)}function R8(e){return Wc(qn,e)}function D8(e){return Zc(Wn,e)}var N={...ra,...mf,iso:lA},_8=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function N8(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function F$(e,t){return e.map((n,i)=>i<t?n:n.optional())}function U8(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function T8(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===i){let r=n[1]===void 0?void 0:U8(n[1]);if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}function $8(e,t){return N.transform(i=>i).check(i=>{let r=i.value;if(typeof r!="object"||r===null||Array.isArray(r))return;let o=Object.getOwnPropertyNames(r);if(t.minProperties!==void 0&&o.length<t.minProperties&&i.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:r,inst:e,continue:!0}),t.maxProperties!==void 0&&o.length>t.maxProperties&&i.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:r,inst:e,continue:!0}),t.keySchema)for(let s of o){let a=t.keySchema.safeParse(s);a.success||i.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function RQ(e,t){if(e===null)return"z";let n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;let i=String(e);return`${n[0]}${i.length}:${i}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let o=[];for(let s of e){let a=RQ(s,t);if(a===null)return null;o.push(a)}return`a${o.length}:[${o.join(",")}]`}let i=Object.keys(e).sort(),r=[];for(let o of i){let s=RQ(e[o],t);if(s===null)return null;r.push(`${o.length}:${o}=${s}`)}return`o${r.length}:{${r.join(",")}}`}finally{t.delete(e)}}var F8=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),M8=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function dA(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(dA):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,n])=>F8.has(t)?dA(n):!M8.has(t)||typeof n!="object"||n===null?!1:Object.values(n).some(dA))}function M$(e){return e===1?"element":"elements"}function L8(e,t){return N.transform(i=>i).check(i=>{let r=i.value;if(Array.isArray(r)){if(t.uniqueItems===!0){let o=new Map;for(let s=0;s<r.length;s++){let a=RQ(r[s],new Set);if(a===null)continue;let c=o.get(a);if(c===void 0){o.set(a,s);continue}i.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:r,path:[s],continue:!0})}}if(t.containsSchema){let o=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of r)if(t.containsSchema.safeParse(c).success&&++a>=s)break;a<o&&i.issues.push({code:"custom",message:`Array must contain at least ${o} matching ${M$(o)}; found ${a}`,input:r,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&i.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${M$(t.maxContains)}`,input:r,continue:!0})}}}).pipe(e)}function L$(e,t){if(e!==!1)return e===void 0||e===!0?N.any():dt(e,t)}var P8=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function P$(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return N.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return N.lazy(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);let o=T8(r,t),s=dt(o,t);return t.refs.set(r,s),t.processing.delete(r),s}if(e.enum!==void 0){let r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return N.null();if(r.length===0)return N.never();if(r.length===1)return N.literal(r[0]);if(r.every(s=>typeof s=="string"))return N.enum(r);let o=r.map(s=>N.literal(s));return o.length<2?o[0]:N.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return N.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(o=>{let s={...e,type:o};return P$(s,t)});return r.length===0?N.never():r.length===1?r[0]:N.union(r)}if(!n)return N.any();let i;switch(n){case"string":{let r=N.string();if(e.format){let o=e.format;o==="email"?r=r.check(N.email()):o==="uri"||o==="uri-reference"?r=r.check(N.url()):o==="uuid"||o==="guid"?r=r.check(N.uuid()):o==="date-time"?r=r.check(N.iso.datetime({offset:!0})):o==="date"?r=r.check(N.iso.date()):o==="time"?r=r.check(N.regex(P8)):o==="duration"?r=r.check(N.iso.duration()):o==="hostname"?r=r.check(N.hostname()):o==="ipv4"?r=r.check(N.ipv4()):o==="ipv6"?r=r.check(N.ipv6()):o==="mac"?r=r.check(N.mac()):o==="cidr"?r=r.check(N.cidrv4()):o==="cidr-v6"?r=r.check(N.cidrv6()):o==="base64"?r=r.check(N.base64()):o==="base64url"?r=r.check(N.base64url()):o==="e164"?r=r.check(N.e164()):o==="credit_card"?r=r.check(N.creditCard()):o==="iban"?r=r.check(N.iban()):o==="jwt"?r=r.check(N.jwt()):o==="emoji"?r=r.check(N.emoji()):o==="nanoid"?r=r.check(N.nanoid()):o==="cuid"?r=r.check(N.cuid()):o==="cuid2"?r=r.check(N.cuid2()):o==="ulid"?r=r.check(N.ulid()):o==="xid"?r=r.check(N.xid()):o==="ksuid"&&(r=r.check(N.ksuid()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),i=r;break}case"number":case"integer":{let r=n==="integer"?N.number().int():N.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),i=r;break}case"boolean":{i=N.boolean();break}case"null":{i=N.null();break}case"object":{let r={},o=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?dt(e.additionalProperties,t):void 0;for(let[d,f]of Object.entries(o)){let g=dt(f,t);je(r,d,s.has(d)?g:g.optional())}if(e.patternProperties){let d=e.patternProperties,f=Object.keys(d),g=[];for(let h of f){let E=dt(d[h],t),m=N.string().regex(new RegExp(h));g.push(N.looseRecord(m,E))}let p=[];if(Object.keys(r).length>0&&p.push(N.object(r).passthrough()),p.push(...g),p.length===0)i=N.object({}).passthrough();else if(p.length===1)i=p[0];else{let h=N.intersection(p[0],p[1]);for(let E=2;E<p.length;E++)h=N.intersection(h,p[E]);i=h}if(e.additionalProperties===!1){let h=Object.keys(r),E=f.map(C=>new RegExp(C)),m=i;i=i.check(C=>{if(!Xt(C.value))return;let v=[];for(let b of Object.keys(C.value))h.includes(b)||E.some($=>$.test(b))||v.push(b);v.length&&C.issues.push({code:"unrecognized_keys",keys:v,input:C.value,inst:m})})}}else{let d=N.object(r);e.additionalProperties===!1?i=d.strict():a?i=d.catchall(a):i=d.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,A=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(c||A!==void 0||l!==void 0){let d;if(c){let f=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=dt(f,t)}i=$8(i,{keySchema:d,minProperties:A,maxProperties:l})}break}case"array":{let r=e.prefixItems,o=e.items;if(r&&Array.isArray(r)){let s=typeof e.minItems=="number"?e.minItems:0,a=r.map(d=>dt(d,t)),c=F$(a,s),A=Array.isArray(o)?void 0:L$(o,t),l=N.tuple(c);i=A?l.rest(A):l,typeof e.minItems=="number"&&(i=i.check(N.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(N.maxLength(e.maxItems)))}else if(Array.isArray(o)){let s=typeof e.minItems=="number"?e.minItems:0,a=o.map(d=>dt(d,t)),c=F$(a,s),A=L$(e.additionalItems,t),l=N.tuple(c);i=A?l.rest(A):l,typeof e.minItems=="number"&&(i=i.check(N.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(N.maxLength(e.maxItems)))}else if(o!==void 0){let s=dt(o,t),a=N.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),i=a}else i=N.array(N.any());(e.uniqueItems===!0||e.contains!==void 0)&&(i=L8(i,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?dt(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${n}`)}return i}function dt(e,t){if(typeof e=="boolean")return e?N.any():N.never();let n=P$(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(A=>dt(A,t)),c=N.union(a);n=i?N.intersection(n,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(A=>dt(A,t)),c=N.xor(a);n=i?N.intersection(n,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=i?n:N.any();else{let a=i?n:dt(e.allOf[0],t),c=i?0:1;for(let A=c;A<e.allOf.length;A++)a=N.intersection(a,dt(e.allOf[A],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=N.nullable(n)),e.readOnly===!0&&(n=N.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let r={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of o)a in e&&(r[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(r[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!dA(e.propertyNames)&&(r.propertyNames=e.propertyNames);for(let a of["minProperties","maxProperties"])e[a]!==void 0&&(r[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!dA(e.contains)&&(r.contains=e.contains);for(let a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(r[a]=e[a])}for(let a of Object.keys(e))_8.has(a)||je(r,a,e[a]);return Object.keys(r).length>0&&t.registry.add(n,r),e.description&&(n=n.describe(e.description)),n}function O$(e,t){if(typeof e=="boolean")return e?N.any():N.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=N8(n,t?.defaultTarget),r=n.$defs||n.definitions||{},o={version:i,defs:r,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??He};return dt(n,o)}var z$=Symbol("z.visit/resolving");function fA(e,t){let n=typeof t=="function"?t:(s,a)=>{let c=t[s._zod.def.type];return c?c(s,a):s},i=new Map;function r(s){let a=i.get(s);if(a===z$)return new Oc({type:"lazy",getter:()=>i.get(s)});if(a!==void 0)return a;i.set(s,z$);let c=o(s),A=n(c,c!==s);return i.set(s,A),A}function o(s){let a=s._zod.def,c=a.type;switch(c){case"object":{let A=a.shape,l=Object.keys(A),d=!1,f={};for(let p of l){let h=r(A[p]);h!==A[p]&&(d=!0),f[p]=h}let g=a.catchall;return a.catchall&&(g=r(a.catchall),g!==a.catchall&&(d=!0)),d?fe(s,{...a,shape:f,catchall:g}):s}case"array":{let A=r(a.element);return A===a.element?s:fe(s,{...a,element:A})}case"tuple":{let A=a.items,l=!1,d=[];for(let g of A){let p=r(g);p!==g&&(l=!0),d.push(p)}let f=a.rest;return a.rest&&(f=r(a.rest),f!==a.rest&&(l=!0)),l?fe(s,{...a,items:d,rest:f}):s}case"record":case"map":{let A=r(a.keyType),l=r(a.valueType);return A===a.keyType&&l===a.valueType?s:fe(s,{...a,keyType:A,valueType:l})}case"set":{let A=r(a.valueType);return A===a.valueType?s:fe(s,{...a,valueType:A})}case"union":{let A=a.options,l=!1,d=[];for(let f of A){let g=r(f);g!==f&&(l=!0),d.push(g)}return l?fe(s,{...a,options:d}):s}case"intersection":{let A=r(a.left),l=r(a.right);return A===a.left&&l===a.right?s:fe(s,{...a,left:A,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let A=r(a.innerType);return A===a.innerType?s:fe(s,{...a,innerType:A})}case"pipe":{let A=r(a.in),l=r(a.out);return A===a.in&&l===a.out?s:fe(s,{...a,in:A,out:l})}case"function":{let A=r(a.input),l=r(a.output);return A===a.input&&l===a.output?s:fe(s,{...a,input:A,output:l})}case"lazy":{let A=a.getter,{_cachedInner:l,...d}=a;return fe(s,{...d,getter:()=>r(A())})}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":return s;default:return s}}return r(e)}function G$(e){return fA(e,{object:t=>t.partial(),union:t=>{let n=t._zod.def;return n.discriminator===void 0?t:ta(n.options)}})}function O8(e,t){if(!t?.length)return e;let n=e._zod.def;return fe(e,Er(n,{checks:[...n.checks??[],...t]}),{parent:!0})}function V$(e){return O8(e.out,e.checks)}function z8(e){return e.in._zod.traits.has("$ZodTransform")?V$(e):e.in}function J$(e){return fA(e,{pipe:t=>z8(t._zod.def),default:(t,n)=>n?oo(t._zod.def.innerType):t,catch:(t,n)=>n?t._zod.def.innerType:t})}function Y$(e){return fA(e,{pipe:t=>V$(t._zod.def),prefault:(t,n)=>n?t._zod.def.innerType:t})}var DQ={};Qr(DQ,{bigint:()=>Y8,boolean:()=>J8,date:()=>j8,number:()=>V8,string:()=>G8});function G8(e){return Xy(Zs,e)}function V8(e){return oC(Ks,e)}function J8(e){return dC(Xs,e)}function Y8(e){return gC(ea,e)}function j8(e){return wC(nA,e)}var j$=require("async_hooks");var Ase=new j$.AsyncLocalStorage;var kse=new Set(Object.values(ca));var Sse=u.object({checks:u.array(u.object({repository:u.string().optional(),name:u.string().min(1),headSha:u.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:u.string().default("completed"),conclusion:u.string().nullable().optional(),url:u.string().optional(),summary:u.string().optional()}))});var K8=["generate-unit","native-run"],Dse=["preflight","plan","write",...K8,"report","deliver"];var q$=(i=>(i.Unit="unit",i.Integration="integration",i.E2e="e2e",i))(q$||{}),X8=Object.values(q$);var Ose=new RegExp("(^|/)("+["test_[^/]+\\.py","[^/]+_test\\.py","[^/]+\\.(spec|test)\\.[cm]?[jt]sx?","[^/]+\\.e2e-(spec|test)\\.[cm]?[jt]sx?","[^/]+_test\\.go","[^/]+Tests?\\.(java|kts?)","[^/]+_(test|spec)\\.rb","[^/]+\\.feature","[^/]+Tests?\\.cs","[^/]+_test\\.rs","tests/[^/]+\\.rs","[^/]+Test\\.php","[^/]+(Test|Spec|Suite)\\.scala","[^/]+Tests?\\.swift","[^/]+_test\\.exs","[^/]+_test\\.dart","[^/]+_test\\.(c|cc|cpp|cxx)","test_[^/]+\\.(c|cc|cpp|cxx)","[^/]+(Spec|Test)\\.groovy"].join("|")+")$","i");var W$=(n=>(n.Full="full",n.Static="static",n))(W$||{}),Z$=(i=>(i.Contract="contract",i.Integration="integration",i.Ui="ui",i))(Z$||{}),_Q=(o=>(o.OwnSurface="own_surface",o.StateReadBack="state_read_back",o.Referential="referential",o.Lifecycle="lifecycle",o.Boundaries="boundaries",o))(_Q||{}),K$=(r=>(r.Update="update",r.Regenerate="regenerate",r.Delete="delete",r.Verify="verify",r))(K$||{}),X$=(A=>(A.Equals="equals",A.NotEquals="not_equals",A.GreaterThan="greater_than",A.LessThan="less_than",A.Contains="contains",A.NotContains="not_contains",A.Matches="matches",A.Absent="absent",A.Present="present",A))(X$||{});var Pt=u.string().trim().min(1),tX=u.object({subject:Pt.describe('what the test READS: a response field path, the literal "status", or the on-screen text for a ui case \u2014 the FINAL read in a multi-step case'),comparator:u.nativeEnum(X$),value:u.union([u.string(),u.number(),u.boolean(),u.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),rX=u.object({test:Pt.describe("existing test path, relative to its repository"),repository:Pt.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum(K$),evidence:Pt.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:u.array(u.string()).optional().describe("analyze behavior ids this maintenance covers"),staleOnBase:u.boolean().optional().describe("[derived] the plan found the test already wrong on the base branch: it is left as it is and re-run")});var nX=u.object({surface:Pt.describe("a surface from the list, copied verbatim"),axis:u.nativeEnum(_Q)}),iX=u.object({id:Pt.describe("short-slug, unique across generate[]"),type:u.nativeEnum(Z$),target:Pt.describe('"METHOD /path", or a business-flow name'),from_finding:u.string().optional().describe("analyze finding id this case catches"),from_behavior:u.string().optional().describe("analyze behavior id this case pins"),derived_from:nX.optional().describe("the surface \xD7 axis this case pins when no analyze behavior or finding names it \u2014 one of the three is required"),rationale:Pt.describe("why this test matters"),expected_observable:Pt.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:tX.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:Pt.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:u.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),oX=u.object({covered:u.array(u.string()).optional(),abstain:u.string().optional()}).superRefine((e,t)=>{let n=Array.isArray(e.covered),i=typeof e.abstain=="string";if(n===i)return void t.addIssue({code:u.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&e.covered.length===0&&t.addIssue({code:u.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),i&&!e.abstain.trim()&&t.addIssue({code:u.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),sX=u.object({surface:Pt.describe("a surface from the list, copied verbatim"),axes:u.object(Object.fromEntries(Object.values(_Q).map(e=>[e,oX])))}),Hse=u.object({schemaVersion:u.literal(1),mode:u.nativeEnum(W$),maintenance:u.array(rX),generate:u.array(iX),surfaces:u.array(sX).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:u.object({total:u.number().describe("case count"),rationale:Pt}),summary:Pt.describe("one paragraph")});function NQ(e){return e.hostname.toLowerCase().replace(/^\[|\]$/g,"").replace(/\.$/,"")}var eF="the data-safety guard is not available";var pae=M.object({mode:M.string().optional(),entries:M.array(M.object({entityUrl:M.string().optional(),tornDown:M.boolean().optional(),id:M.union([M.string(),M.number()]).optional(),createdAt:M.number().optional(),testExecution:M.string().optional(),readAt:M.array(M.string()).optional(),deleteAnswered:M.boolean().optional(),deleteStatus:M.number().int().optional(),readBack:M.object({status:M.number().int().optional(),end:M.string().optional()}).passthrough().optional()})).optional(),blocks:M.array(M.object({method:M.string().optional(),url:M.string().optional(),rule:M.string().optional(),count:M.number().nonnegative().optional()})).optional(),unparsedCreates:M.array(M.object({url:M.string().optional(),rule:M.string().optional()})).optional()});var hae=M.object({id:M.string().regex(/^(legacy|unknown|session-[0-9a-f-]{36})$/),stage:M.string(),browserUsed:M.boolean()});var mae=M.object({environmentId:M.string().uuid().optional(),environmentAddress:M.string().url().optional(),persistentDataPolicy:M.custom(e=>xl.safeParse(e).success,"invalid persistent-data policy").optional(),components:M.array(M.object({name:M.string().min(1),url:M.string().min(1),repository:M.string().min(1).optional(),expectedRevision:M.string().min(1).optional(),revisionUrl:M.string().url().optional()}).strict()).min(1),dependencies:M.array(M.object({name:M.string().min(1),url:M.string().nullable(),versionUrl:M.string().nullable(),notes:M.string().nullable()}).strict()).default([]),allowMutation:M.boolean().optional(),offLimits:M.array(M.string().min(1)).optional(),allowedEgress:M.array(M.string().min(1)).optional()}).strict();var gA=e=>Array.isArray(e.ledger)?e.ledger:[],uX=5,lX=["classify","shouldCaptureCreateBody","recordResponse","noteEntityResponse","noteRedirect","recordBlock","ensureLedgerWritable","flush"];function AF(e){if(e)try{let t=(0,aF.createRequire)(e)(e),n=t.DataSafetyGuard;return typeof n!="function"||typeof t.parseDataSafetyConfig!="function"||typeof t.blockReason!="function"||!lX.every(i=>typeof n.prototype[i]=="function")?void 0:t}catch{return}}var MQ=class{constructor(t,n){this.ledgerPath=n;this.mode=String(t?.mode??"")}ledgerPath;ledger=[];blocks=new Map;mode;classify(){return"BLOCK_DENYLISTED"}shouldCaptureCreateBody(){return!1}recordResponse(){}noteEntityResponse(){}noteRedirect(){}recordBlock(t){let n=`${t.method} ${t.url} ${t.rule}`,i=this.blocks.get(n);i?i.count+=1:this.blocks.set(n,{method:t.method,url:t.url,rule:t.rule,count:1}),this.flush()}ensureLedgerWritable(){this.flush()}flush(){tt.writeFileSync(this.ledgerPath,JSON.stringify({mode:this.mode,entries:[],blocks:[...this.blocks.values()]},null,2),{mode:384})}},uF={DataSafetyGuard:MQ,parseDataSafetyConfig:e=>e,blockReason:()=>`${eF}, so Testbot sends no request to the shared environment`},tF=new Set(["GET","HEAD","OPTIONS"]),dX=new Set(["api.anthropic.com:443","github.com:443","api.github.com:443","raw.githubusercontent.com:443","objects.githubusercontent.com:443","codeload.github.com:443","release-assets.githubusercontent.com:443","registry.npmjs.org:443","pypi.org:443","pypi.python.org:443","files.pythonhosted.org:443","cdn.playwright.dev:443","playwright.download.prss.microsoft.com:443"]),fX="storage.googleapis.com",lF=`${fX}:443`,gX=/^\/chrome-for-testing-public\/\d+\.\d+\.\d+\.\d+\/[a-z0-9-]+\/chrome(?:-headless-shell)?-[a-z0-9-]+\.zip$/;function UQ(e){return e.protocol==="https:"&&pA(e)===lF}var LQ=new Le.BlockList;for(let[e,t]of[["0.0.0.0",8],["10.0.0.0",8],["100.64.0.0",10],["127.0.0.0",8],["169.254.0.0",16],["172.16.0.0",12],["192.168.0.0",16],["198.18.0.0",15],["224.0.0.0",4],["240.0.0.0",4]])LQ.addSubnet(e,t,"ipv4");for(let[e,t]of[["::",128],["::1",128],["fc00::",7],["fe80::",10],["ff00::",8]])LQ.addSubnet(e,t,"ipv6");var Jf=64*1024*1024,Yf=3e3,pX=[250,750],dF=1e4,jae=Yf+dF+Yf,hX=8;var mX=500,IX=/^(content-|if-|expect$|x-http-method|x-method-override$)/,EX=/^(_method|x-http-method(-override)?|x-method-override)$/i;function yX(e,t,n,i){return e===410||e===404&&(t||n&&i)}function rF(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,"").split("/");if(n.length<2||!n.at(-1))return;let i=[...new Set(t.searchParams.keys())].sort();return`${t.origin}${n.slice(0,-1).join("/")}/*${i.length?`?${i.join("&")}`:""}`}catch{return}}var fF=e=>e!==void 0&&e>=200&&e<300;function CX(e){let t=0,n=[];return async i=>{t>=e?await new Promise(r=>n.push(r)):t++;try{return await i()}finally{let r=n.shift();r?r():t--}}}function BX(e,t){return fF(e.responseStatus)&&!!e.entityUrl&&nr(e.entityUrl)===t}function QX(e){let t=new URL(e);for(let n of[...t.searchParams.keys()])EX.test(n)&&t.searchParams.delete(n);return t}function rr(e,t,n,i){let o=`${[n==="blocked"?"Blocked by data safety":"Data safety could not check or record this request",i].filter(Boolean).join(": ")}. Do not retry it.
|
|
189
189
|
`,s={"content-type":"text/plain; charset=utf-8","x-skyramp-data-safety":n};if(e instanceof Zn.ServerResponse){e.writeHead(t,s).end(o);return}let a=Object.entries({...s,connection:"close"}).map(([c,A])=>`${c}: ${A}`);e.end(`HTTP/1.1 ${t} ${Zn.STATUS_CODES[t]??""}\r
|
|
190
190
|
${a.join(`\r
|
|
191
191
|
`)}\r
|