@oss-autopilot/core 3.29.1 → 3.29.2

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.
@@ -55,7 +55,7 @@ ${c}`:c:"",p=Function,d=`return (input) => {
55
55
  ${c}
56
56
  }`,m;try{m=new p(...i,d)(...a)}catch(f){throw new ye(`this schema (generated code failed to evaluate: ${f.message})`)}return t?.debug&&(m.code=l),m}function Q(e,t){for(let[n,s]of e.constants)if(s===t)return n;let r=`c${e.constantCounter++}`;return e.constants.set(r,t),r}function re(e){return`v${e.varCounter++}`}function lD(e,t){let r=e._zod.run({value:t,issues:[]},{});if(r&&typeof r.then=="function")return Vt;let n=r;return n.issues.length===0?n.value:Vt}function wt(e,t,r,n,s=!0){let o=e.content.length,i=t.constants.size,a=t.constantCounter,c=t.varCounter;try{return Ue(e,t,r,n,s)}catch(l){if(!(l instanceof ye)||!l.islandable)throw l;if(e.content.length=o,t.constants.size>i){let p=Array.from(t.constants.keys()).slice(i);for(let d of p)t.constants.delete(d)}return t.constantCounter=a,t.varCounter=c,pD(e,t,r,n)}}function pD(e,t,r,n){let s=Q(t,r),o=Q(t,lD),i=re(t);return e.write(`const ${i} = ${o}(${s}, ${n});`),e.write(`if (${i} === INVALID) return INVALID;`),i}function mD(e,t,r,n){let s=r._zod.def.checks;if(!s||s.length===0)return n;let o=n;for(let i of s){let a=i._zod.def;if(a.when&&!dD.has(a.check))throw new ye('check with a custom "when" condition');switch(a.check){case"greater_than":fD(e,t,a,o);break;case"less_than":gD(e,t,a,o);break;case"multiple_of":hD(e,t,a,o);break;case"number_format":dv(e,a,o);break;case"min_length":{let c=us(a.minimum,"min_length"),l=ih(e,t,o,`${o}.length >= ${c} && ${o}.length < ${a.minimum*2}`);e.write(`if (${l} < ${c}) return INVALID;`);break}case"max_length":{let c=us(a.maximum,"max_length"),l=ih(e,t,o,`${o}.length > ${c}`);e.write(`if (${l} > ${c}) return INVALID;`);break}case"length_equals":{let c=us(a.length,"length_equals"),l=ih(e,t,o,`${o}.length >= ${c} && ${o}.length <= ${a.length*2}`);e.write(`if (${l} !== ${c}) return INVALID;`);break}case"min_size":e.write(`if (${o}.size < ${us(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${o}.size > ${us(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${o}.size !== ${us(a.size,"size_equals")}) return INVALID;`);break;case"string_format":o=mv(e,t,a,o);break;case"custom":o=RD(e,t,i,o);break;case"bigint_format":yD(e,a,o);break;case"mime_type":bD(e,t,a,o);break;case"property":wD(e,t,a,o);break;case"overwrite":{let c=re(t);_D(e,t,i,o,c),o=c;break}default:throw new ye(`check type ${a.check}`)}}return o}function ih(e,t,r,n){let s=Q(t,os),o=re(t);return e.write(`const ${o} = typeof ${r} === "string" && ${n} ? ${s}(${r}) : ${r}.length;`),o}function us(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new ye(`${t} bound of type ${typeof e}`);return`${e}`}function pv(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new ye("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new ye("comparison check with Invalid Date bound");return Q(e,t)}throw new ye(`comparison check bound of type ${typeof t}`)}function fD(e,t,r,n){let s=r.inclusive?"<":"<=";e.write(`if (${n} ${s} ${pv(t,r.value)}) return INVALID;`)}function gD(e,t,r,n){let s=r.inclusive?">":">=";e.write(`if (${n} ${s} ${pv(t,r.value)}) return INVALID;`)}function hD(e,t,r,n){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new ye("multiple_of check with a zero divisor");e.write(`if (${n} % ${r.value}n !== 0n) return INVALID;`)}else{let s=Q(t,na);e.write(`if (${s}(${n}, ${us(r.value,"multiple_of")}) !== 0) return INVALID;`)}}function dv(e,t,r){let n=t.format;switch(n){case"safeint":e.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new ye(`number format ${n}`)}}function yD(e,t,r){let n=t.format;if(n)switch(n){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new ye(`bigint format ${n}`)}}function bD(e,t,r,n){let s=r.mime;if(s&&s.length>0){let o=Q(t,new Set(s));e.write(`if (!${o}.has(${n}.type)) return INVALID;`)}}function wD(e,t,r,n){let s=`${n}[${JSON.stringify(r.property)}]`;Ue(e,t,r.schema,s)}function _D(e,t,r,n,s){let o=r._zod.def.tx;if(!o)throw new ye("overwrite check without a transform function");if(ds(o))throw new pr("z.compile: async overwrite transforms are not supported");let i=Q(t,o);e.write(`const ${s} = ${i}(${n});`)}function ah(){throw new Ot}function lh(e){this.issues.push(e)}function RD(e,t,r,n){let s=r._zod.def;if(s.fn){if(ds(s.fn))throw new pr("z.compile: async .refine() predicates are not supported");let o=Q(t,s.fn),i=Q(t,ah),a=re(t);return e.write(`const ${a} = ${o}(${n});`),e.write(`if (${a} instanceof Promise) ${i}();`),e.write(`if (!${a}) return INVALID;`),n}if(r._zod.check){if(ds(r._zod.check))throw new pr("z.compile: async .superRefine() / check functions are not supported");let o=r._zod.check,a=Q(t,l=>{let p={value:l,issues:[],addIssue:lh};return o(p)instanceof Promise&&ah(),p.issues.length===0?p.value:Vt}),c=re(t);return e.write(`const ${c} = ${a}(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new ye("custom check without a predicate or check function")}function mv(e,t,r,n){let s=r.format;if(s==="base64"){let c=Q(t,ga);return e.write(`if (!${c}(${n})) return INVALID;`),n}if(s==="base64url"){let c=Q(t,ju);return e.write(`if (!${c}(${n})) return INVALID;`),n}if(s==="jwt"){let c=Q(t,Hu),l=Q(t,r.alg??null);return e.write(`if (!${c}(${n}, ${l})) return INVALID;`),n}if(s==="ipv6"){let c=Q(t,fa);return e.write(`if (!${c}(${n})) return INVALID;`),n}if(s==="cidrv6"){let c=Q(t,Uu);return e.write(`if (!${c}(${n})) return INVALID;`),n}if(s==="credit_card"){let c=Q(t,zu);return e.write(`if (!${c}(${n})) return INVALID;`),n}let o=r;if(s==="url"||s==="httpurl"||o.normalize||o.hostname!==void 0||o.protocol!==void 0){let c=Q(t,Fu),l=Q(t,r),p=re(t),d=re(t);if(e.write(`const ${p} = ${n}.trim();`),e.write(`const ${d} = ${c}(${p}, ${l});`),e.write(`if (typeof ${d} === "number") return INVALID;`),o.hostname!==void 0){let g=Q(t,Gu);e.write(`if (!${g}(${d}, ${l}.hostname)) return INVALID;`)}if(o.protocol!==void 0){let g=Q(t,Nu);e.write(`if (!${g}(${d}, ${l}.protocol)) return INVALID;`)}let m=re(t),f=o.normalize?`${d}.href`:`${Q(t,Mu)}(${p})`;return e.write(`const ${m} = ${f};`),m}let i=r.fn;if(i){if(ds(i))throw new ye(`async string format ${s}`);let c=Q(t,i);return e.write(`if (!${c}(${n})) return INVALID;`),n}if(SD.has(s)&&r.pattern){let c=Q(t,r.pattern);return e.write(`${c}.lastIndex = 0;`),e.write(`if (!${c}.test(${n})) return INVALID;`),n}let a=r.format;switch(a){case"regex":throw new ye("regex format without a pattern");case"lowercase":e.write(`if (${n} !== ${n}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${n} !== ${n}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${n}.includes(${Tt(r.includes)})) return INVALID;`);break;case"starts_with":{let c=r.prefix;e.write(`if (${n}.slice(0, ${c.length}) !== ${Tt(c)}) return INVALID;`);break}case"ends_with":{let c=r.suffix;e.write(`if (${n}.slice(-${c.length}) !== ${Tt(c)}) return INVALID;`);break}default:throw new ye(`string format ${a}`)}return n}function Ue(e,t,r,n,s=!0){let o=r._zod.def,i=o.type;if(o.coerce)throw new ye(`coercion (z.coerce.${i}())`);let a=s||!!o.checks?.length,c;switch(i){case"string":c=vD(e,t,r,n);break;case"number":c=kD(e,r,n);break;case"boolean":c=ED(e,n);break;case"bigint":c=PD(e,r,n);break;case"symbol":c=CD(e,n);break;case"undefined":c=TD(e,n);break;case"null":c=$D(e,n);break;case"any":case"unknown":c=n;break;case"never":e.write("return INVALID;"),c=n;break;case"void":c=AD(e,n);break;case"nan":c=OD(e,n);break;case"date":c=xD(e,n);break;case"object":c=ID(e,t,r,n,a);break;case"optional":c=DD(e,t,r,n,a);break;case"nullable":c=MD(e,t,r,n,a);break;case"array":c=GD(e,t,r,n,a);break;case"literal":c=ND(e,t,r,n);break;case"enum":c=UD(e,t,r,n);break;case"readonly":{let l=uv(e,t,r,n),p=re(t);e.write(`const ${p} = Object.freeze(${l});`),c=p;break}case"success":uv(e,t,r,n),c="true";break;case"default":case"prefault":c=jD(e,t,r,n);break;case"nonoptional":c=zD(e,t,r,n);break;case"tuple":c=HD(e,t,r,n);break;case"union":c=VD(e,t,r,n);break;case"intersection":c=qD(e,t,r,n);break;case"record":c=ZD(e,t,r,n);break;case"map":c=KD(e,t,r,n);break;case"set":c=YD(e,t,r,n);break;case"file":c=QD(e,n);break;case"template_literal":c=XD(e,t,r,n);break;case"lazy":c=eL(e,t,r,n);break;case"pipe":c=tL(e,t,r,n);break;case"custom":c=rL(e,t,r,n);break;case"transform":c=oL(e,t,r,n);break;case"catch":c=sL(e,t,r,n);break;default:throw new ye(`schema type ${i}`)}return c===null?null:mD(e,t,r,c)}function vD(e,t,r,n){e.write(`if (typeof ${n} !== "string") return INVALID;`);let s=r._zod.def;return s.format===void 0?n:mv(e,t,s,n)}function kD(e,t,r){e.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let n=t._zod.def;return n.check==="number_format"&&n.format&&dv(e,{format:n.format},r),r}function ED(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function PD(e,t,r){e.write(`if (typeof ${r} !== "bigint") return INVALID;`);let n=t._zod.def;if(n.format)switch(n.format){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}function CD(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function TD(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function $D(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function AD(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function OD(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function xD(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function ID(e,t,r,n,s=!0){let o=r._zod.def;e.write(`if (typeof ${n} !== "object" || ${n} === null || Array.isArray(${n})) return INVALID;`);let i=o.shape,a=Object.keys(i),c=Object.getOwnPropertySymbols(i),l=c.length?[...a,...c]:a,p=R=>typeof R=="symbol"?Q(t,R):Tt(R),d=R=>typeof R=="symbol"?`[${p(R)}]`:Tt(R),m=i;if(a.includes("__proto__"))throw new ye('object shape key "__proto__"');let f=new Map;for(let R of l){let y=m[R],S=p(R),E=re(t);if(e.write(`const ${E} = ${n}[${S}];`),y._zod.optin!==void 0){let D=re(t);e.write(`let ${D} = (() => {`),e.indented(P=>{let k=wt(P,t,y,E);P.write(`return ${k};`)}),e.write("})();"),y._zod.optout==="optional"?(e.write(`if (${D} === INVALID) {`),e.indented(P=>{P.write(`if (${S} in ${n}) return INVALID;`),P.write(`${D} = undefined;`)}),e.write("}")):e.write(`if (${D} === INVALID) return INVALID;`),f.set(R,D)}else{FD(y)&&e.write(`if (!(${S} in ${n})) return INVALID;`);let D=wt(e,t,y,E,s);D!==null&&f.set(R,D)}}let g=o.catchall,h="none";if(g){let R=g._zod.def.type;if(R==="never"){let y=a.map(S=>`k !== ${Tt(S)}`).join(" && ")||"true";e.write(`for (const k in ${n}) {`),e.indented(S=>{S.write(`if (${y}) return INVALID;`)}),e.write("}")}else(R==="unknown"||R==="any")&&!g._zod.def.checks?.length?h="passthrough":h="schema"}let w=re(t),v=l.some(R=>ps(m[R])||ch(m[R]));if(!s){if(h==="schema"){let R=a.length>0?Q(t,new Set(a)):null;e.write(`for (const k in ${n}) {`),e.indented(y=>{y.write('if (k === "__proto__") continue;'),R&&y.write(`if (${R}.has(k)) continue;`);let S=re(t);y.write(`const ${S} = ${n}[k];`),wt(y,t,g,S,!1)}),e.write("}")}return null}if(v){e.write(`const ${w} = {};`);for(let R of l){let y=p(R),S=f.get(R);ch(m[R])?e.write(`if (${y} in ${n}) ${w}[${y}] = ${S};`):ps(m[R])?e.write(`if (${S} !== undefined || ${y} in ${n}) ${w}[${y}] = ${S};`):e.write(`${w}[${y}] = ${S};`)}}else{let R=l.map(y=>`${d(y)}: ${f.get(y)}`).join(", ");e.write(`const ${w} = { ${R} };`)}if(h!=="none"){let R=a.length>0?Q(t,new Set(a)):null;e.write(`for (const k in ${n}) {`),e.indented(y=>{if(y.write('if (k === "__proto__") continue;'),R&&y.write(`if (${R}.has(k)) continue;`),h==="passthrough")y.write(`${w}[k] = ${n}[k];`);else{let S=re(t);y.write(`const ${S} = ${n}[k];`);let E=wt(y,t,g,S);y.write(`${w}[k] = ${E};`)}}),e.write("}")}return w}function DD(e,t,r,n,s=!0){let o=r._zod.def;if(LD(r))return Ue(e,t,o.innerType,n,s);if(o.innerType._zod.optin==="defaulted"){let a=re(t),c=re(t);return e.write(`let ${a};`),e.write(`if (${n} === undefined) {`),e.indented(l=>{l.write(`const ${c} = (() => {`),l.indented(p=>{let d=Ue(p,t,o.innerType,n);p.write(`return ${d};`)}),l.write("})();"),l.write(`if (${c} !== INVALID) ${a} = ${c};`)}),e.write("} else {"),e.indented(l=>{let p=Ue(l,t,o.innerType,n);l.write(`${a} = ${p};`)}),e.write("}"),a}let i=s?re(t):null;return i&&e.write(`let ${i};`),e.write(`if (${n} !== undefined) {`),e.indented(a=>{let c=Ue(a,t,o.innerType,n,s);i&&c!==null&&a.write(`${i} = ${c};`)}),e.write("}"),i}function LD(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function FD(e){return e._zod.optin===void 0&&ls(e)}function ls(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?ls(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?ls(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(ls):!0;case"intersection":return!t.left||!t.right?!0:ls(t.left)&&ls(t.right);case"pipe":return t.in?ls(t.in):!0;default:return!0}}function ch(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function ps(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?ps(t.innerType):!0;case"union":return t.options?t.options.some(ps):!0;case"intersection":return!t.left||!t.right||ps(t.left)||ps(t.right);case"pipe":return t.out?ps(t.out):!0;default:return!0}}function MD(e,t,r,n,s=!0){let o=r._zod.def,i=s?re(t):null;return i&&e.write(`let ${i} = null;`),e.write(`if (${n} !== null) {`),e.indented(a=>{let c=Ue(a,t,o.innerType,n,s);i&&c!==null&&a.write(`${i} = ${c};`)}),e.write("}"),i}function GD(e,t,r,n,s=!0){let o=r._zod.def;e.write(`if (!Array.isArray(${n})) return INVALID;`);let i=s?re(t):null,a=re(t),c=re(t);return i&&e.write(`const ${i} = new Array(${n}.length);`),e.write(`for (let ${a} = 0; ${a} < ${n}.length; ${a}++) {`),e.indented(l=>{l.write(`const ${c} = ${n}[${a}];`);let p=wt(l,t,o.element,c,s);i&&p!==null&&l.write(`${i}[${a}] = ${p};`)}),e.write("}"),i}function ND(e,t,r,n){let o=r._zod.def.values;if(o.length!==1){let a=Q(t,new Set(o));return e.write(`if (!${a}.has(${n})) return INVALID;`),n}let i=o[0];if(typeof i=="number"&&Number.isNaN(i)){let a=Q(t,new Set(o));return e.write(`if (!${a}.has(${n})) return INVALID;`),n}if(typeof i=="string")e.write(`if (${n} !== ${Tt(i)}) return INVALID;`);else if(typeof i=="number"||typeof i=="boolean")e.write(`if (${n} !== ${i}) return INVALID;`);else if(i===null)e.write(`if (${n} !== null) return INVALID;`);else if(i===void 0)e.write(`if (${n} !== undefined) return INVALID;`);else if(typeof i=="bigint")e.write(`if (${n} !== ${i}n) return INVALID;`);else throw new ye(`literal type ${typeof i}`);return n}function UD(e,t,r,n){let s=r._zod.values;if(!s)throw new ye("enum schema without enumerated values");let o=Q(t,s);return e.write(`if (!${o}.has(${n})) return INVALID;`),n}function uv(e,t,r,n){let s=r._zod.def;return Ue(e,t,s.innerType,n)}function jD(e,t,r,n){let s=r._zod.def,i=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!i)return Ue(e,t,s.innerType,n);let c=Q(t,i),l=re(t);return e.write(`let ${l} = ${n};`),e.write(`if (${n} === undefined) ${l} = ${c}();`),Ue(e,t,s.innerType,l)}let a=re(t);if(i){let c=Q(t,i),l=Q(t,sa);e.write(`let ${a};`),e.write(`if (${n} === undefined) {`),e.indented(p=>{p.write(`${a} = ${l}(${c}());`)}),e.write("} else {"),e.indented(p=>{let d=Ue(p,t,s.innerType,n);p.write(`${a} = ${d} === undefined ? ${l}(${c}()) : ${d};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${n} !== undefined) {`),e.indented(c=>{let l=Ue(c,t,s.innerType,n);c.write(`${a} = ${l};`)}),e.write("}");return a}function zD(e,t,r,n){let s=r._zod.def,o=Ue(e,t,s.innerType,n),i=re(t);return e.write(`const ${i} = ${o};`),e.write(`if (${i} === undefined) return INVALID;`),i}function HD(e,t,r,n){let s=r._zod.def,o=s.items,i=s.rest;e.write(`if (!Array.isArray(${n})) return INVALID;`);let a=lv(o,"optin"),c=lv(o,"optout");i?e.write(`if (${n}.length < ${a}) return INVALID;`):e.write(`if (${n}.length < ${a} || ${n}.length > ${o.length}) return INVALID;`);let l=re(t);e.write(`const ${l} = [];`);for(let p=0;p<o.length;p++){let d=o[p];if(p>=c)e.write(`if (${l}.length === ${p}) {`),e.indented(m=>{m.write(`if (${p} < ${n}.length) {`),m.indented(f=>{let g=re(t);f.write(`const ${g} = ${n}[${p}];`);let h=wt(f,t,d,g);f.write(`${l}[${p}] = ${h};`)}),m.write("} else {"),m.indented(f=>{if(ch(d)){f.write(`${l}.length = ${p};`);return}let g=re(t),h=re(t);f.write(`const ${g} = undefined;`),f.write(`const ${h} = (() => {`),f.indented(w=>{let v=wt(w,t,d,g);w.write(`return ${v};`)}),f.write("})();"),f.write(`if (${h} === INVALID || ${h} === undefined) ${l}.length = ${p};`),f.write(`else ${l}[${p}] = ${h};`)}),m.write("}")}),e.write("}");else{let m=re(t);e.write(`const ${m} = ${n}[${p}];`);let f=wt(e,t,d,m);e.write(`${l}[${p}] = ${f};`)}}if(i){let p=re(t),d=re(t);e.write(`for (let ${p} = ${o.length}; ${p} < ${n}.length; ${p}++) {`),e.indented(m=>{m.write(`const ${d} = ${n}[${p}];`);let f=wt(m,t,i,d);m.write(`${l}[${p}] = ${f};`)}),e.write("}")}return l}function lv(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function VD(e,t,r,n){let s=r._zod.def,o=s.options;if(s.discriminator)return BD(e,t,s,n);if(s.inclusive===!1)throw new ye("exclusive unions (z.xor)");if(o.length===0)return e.write("return INVALID;"),n;if(o.length===1)return Ue(e,t,o[0],n);if(o.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(o.flatMap(p=>p._zod.def.values)),l=Q(t,c);return e.write(`if (!${l}.has(${n})) return INVALID;`),n}let a=re(t);e.write(`let ${a};`);for(let c=0;c<o.length;c++){let l=o[c];c===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(p=>{let d=Ue(p,t,l,n);p.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function BD(e,t,r,n){if(r.unionFallback)throw new ye("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),n;let s=re(t),o=re(t);e.write(`const ${s} = ${n}?.[${Tt(r.discriminator)}];`),e.write(`let ${o};`);let i=!0,a=new Set;for(let c of r.options){let l=c._zod.propValues?.[r.discriminator];if(!l||l.size===0)throw new ye("discriminated union option without static discriminator values");for(let m of l){if(a.has(m))throw new ye(`duplicate discriminator value ${String(m)}`);a.add(m)}let p=Array.from(l,m=>WD(t,s,m)),d=i?"if":"else if";e.write(`${d} (${p.join(" || ")}) {`),e.indented(m=>{let f=Ue(m,t,c,n);m.write(`${o} = ${f};`)}),e.write("}"),i=!1}return e.write("else { return INVALID; }"),o}function WD(e,t,r){if(typeof r=="string")return`${t} === ${Tt(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r=="boolean")return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r=="bigint")return`${t} === ${r}n`;if(typeof r=="symbol"){let n=Q(e,r);return`${t} === ${n}`}throw new ye(`literal discriminator value ${String(r)}`)}function qD(e,t,r,n){let s=r._zod.def,o=wt(e,t,s.left,n),i=wt(e,t,s.right,n),a=Q(t,vo),c=re(t);return e.write(`const ${c} = ${a}(${o}, ${i});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function ZD(e,t,r,n){let s=r._zod.def,o=Q(t,rr);e.write(`if (!${o}(${n})) return INVALID;`);let i=re(t),a=re(t),c=re(t);e.write(`const ${i} = {};`);let l=s,p=l.partial?void 0:s.keyType._zod.values;if(p){let g=[];for(let w of p){if(!(typeof w=="string"||typeof w=="number"||typeof w=="symbol"))throw new ye(`record key value ${String(w)}`);let v=typeof w=="number"?w.toString():w;if(v==="__proto__")throw new ye('record key "__proto__"');g.push(v);let R=Q(t,w),y=Ue(e,t,s.keyType,R),S=re(t);e.write(`const ${S} = ${n}[${JD(t,v)}];`);let E=wt(e,t,s.valueType,S);e.write(`${i}[${y}] = ${E};`)}let h=Q(t,new Set(g));return e.write(`for (const ${a} in ${n}) {`),e.indented(w=>{w.write(`if (${h}.has(${a})) continue;`),l.mode==="loose"?w.write(`if (${a} !== "__proto__") ${i}[${a}] = ${n}[${a}];`):w.write("return INVALID;")}),e.write("}"),i}let d=s.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let g=s.mode==="loose",h=Q(t,rl(s.keyType)),w=Q(t,vn),v=Q(t,Object.prototype.propertyIsEnumerable),R=re(t);return e.write(`for (const ${a} of Reflect.ownKeys(${n})) {`),e.indented(y=>{y.write(`if (${a} === "__proto__") continue;`),y.write(`if (!${v}.call(${n}, ${a})) continue;`),y.write(`let ${R} = ${h}(${a});`),y.write(`if (${R} === INVALID && typeof ${a} === "string" && ${w}.test(${a})) ${R} = ${h}(Number(${a}));`),g?y.write(`if (${R} === INVALID) { ${i}[${a}] = ${n}[${a}]; continue; }`):y.write(`if (${R} === INVALID) return INVALID;`),y.write(`if (${R} === "__proto__") continue;`);let S=re(t);y.write(`const ${S} = ${n}[${a}];`);let E=wt(y,t,s.valueType,S);y.write(`${i}[${R}] = ${E};`)}),e.write("}"),i}let f=Q(t,Object.prototype.propertyIsEnumerable);return e.write(`for (const ${a} of Reflect.ownKeys(${n})) {`),e.indented(g=>{g.write(`if (${a} === "__proto__") continue;`),g.write(`if (!${f}.call(${n}, ${a})) continue;`),g.write(`if (typeof ${a} !== "string") return INVALID;`),g.write(`const ${c} = ${n}[${a}];`);let h=wt(g,t,s.valueType,c);g.write(`${i}[${a}] = ${h};`)}),e.write("}"),i}function JD(e,t){return typeof t=="string"?Tt(t):Q(e,t)}function KD(e,t,r,n){let s=r._zod.def;e.write(`if (!(${n} instanceof Map)) return INVALID;`);let o=re(t),i=re(t),a=re(t);return e.write(`const ${o} = new Map();`),e.write(`for (const [${i}, ${a}] of ${n}) {`),e.indented(c=>{let l=Ue(c,t,s.keyType,i),p=Ue(c,t,s.valueType,a);c.write(`${o}.set(${l}, ${p});`)}),e.write("}"),o}function YD(e,t,r,n){let s=r._zod.def;e.write(`if (!(${n} instanceof Set)) return INVALID;`);let o=re(t),i=re(t);return e.write(`const ${o} = new Set();`),e.write(`for (const ${i} of ${n}) {`),e.indented(a=>{let c=Ue(a,t,s.valueType,i);a.write(`${o}.add(${c});`)}),e.write("}"),o}function QD(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function XD(e,t,r,n){e.write(`if (typeof ${n} !== "string") return INVALID;`);let s=r._zod.pattern;if(s){let o=Q(t,s);e.write(`${o}.lastIndex = 0;`),e.write(`if (!${o}.test(${n})) return INVALID;`)}return n}function eL(e,t,r,n){let s=r._zod.def,o=Q(t,s.getter),i=Q(t,{parser:null});e.write(`if (!${i}.parser) {`),e.indented(c=>{c.write(`const inner = ${o}();`),c.write(`${i}.parser = function(input) {`),c.indented(l=>{l.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),l.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),e.write("}");let a=re(t);return e.write(`const ${a} = ${i}.parser(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function tL(e,t,r,n){let s=r._zod.def,o=Ue(e,t,s.in,n);if(s.transform){if(ds(s.transform))throw new pr("z.compile: async transforms in pipes are not supported");let i=s.transform,c=Q(t,p=>{let d={value:p,issues:[],addIssue:lh},m=i(p,d);return m instanceof Promise?Vt:d.issues.length===0?m:Vt}),l=re(t);return e.write(`const ${l} = ${c}(${o});`),e.write(`if (${l} === INVALID) return INVALID;`),Ue(e,t,s.out,l)}else return Ue(e,t,s.out,o)}function ds(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function rL(e,t,r,n){let s=r._zod.def;if(s.fn){if(ds(s.fn))throw new pr("z.compile: async custom predicates are not supported");let o=Q(t,s.fn),i=Q(t,ah),a=re(t);e.write(`const ${a} = ${o}(${n});`),e.write(`if (${a} instanceof Promise) ${i}();`),e.write(`if (!${a}) return INVALID;`)}else throw new ye("custom schema without a predicate function");return n}function nL(e,t,r){let n=e._zod.run({value:r,issues:[]},{});if(n&&typeof n.then=="function")return Vt;let s=n;return s.issues.length===0?s.value:t()}function sL(e,t,r,n){let s=r._zod.def;if(!s.catchValue[pu])throw new ye("catch with a callback (only a constant catch value compiles)",!1);let o=re(t);e.write(`let ${o} = (() => {`),e.indented(l=>{let p=wt(l,t,s.innerType,n);l.write(`return ${p};`)}),e.write("})();");let i=Q(t,s.innerType),a=Q(t,s.catchValue),c=Q(t,nL);return e.write(`if (${o} === INVALID) {`),e.indented(l=>{l.write(`${o} = ${c}(${i}, ${a}, ${n});`),l.write(`if (${o} === INVALID) return INVALID;`)}),e.write("}"),o}function oL(e,t,r,n){let s=r._zod.def;if(s.transform){if(ds(s.transform))throw new pr("z.compile: async transforms are not supported");let o=s.transform,a=Q(t,l=>{let p={value:l,issues:[],addIssue:lh},d=o(l,p);return d instanceof Promise?Vt:p.issues.length===0?d:Vt}),c=re(t);return e.write(`const ${c} = ${a}(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return n}var Vt,cv,pr,ye,dD,SD,fv=C(()=>{Rn();Au();th();Ro();_a();Je();Vt=Symbol.for("zod.compile.invalid"),cv=Symbol.for("zod.compile.fallback"),pr=class extends Error{constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},ye=class extends Error{constructor(t,r=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=r}};dD=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);SD=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 ph(e,t){return new e({type:"string",...N(t)})}function dh(e,t){return new e({type:"string",coerce:!0,...N(t)})}function nl(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...N(t)})}function sl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...N(t)})}function ol(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...N(t)})}function il(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...N(t)})}function al(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...N(t)})}function cl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...N(t)})}function ka(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...N(t)})}function ul(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...N(t)})}function ll(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...N(t)})}function pl(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...N(t)})}function dl(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...N(t)})}function ml(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...N(t)})}function fl(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...N(t)})}function gl(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...N(t)})}function hl(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...N(t)})}function yl(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...N(t)})}function mh(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...N(t)})}function bl(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...N(t)})}function wl(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...N(t)})}function _l(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...N(t)})}function Rl(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...N(t)})}function Sl(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...N(t)})}function fh(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...N(t)})}function vl(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...N(t)})}function Ea(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...N(t)})}function Pa(e,t){return new e({type:"string",format:"date",check:"string_format",...N(t)})}function Ca(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...N(t)})}function Ta(e,t){return new e({type:"string",format:"duration",check:"string_format",...N(t)})}function hh(e,t){return new e({type:"number",checks:[],...N(t)})}function yh(e,t){return new e({type:"number",coerce:!0,checks:[],...N(t)})}function bh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...N(t)})}function wh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...N(t)})}function _h(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...N(t)})}function Rh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...N(t)})}function Sh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...N(t)})}function vh(e,t){return new e({type:"boolean",...N(t)})}function kh(e,t){return new e({type:"boolean",coerce:!0,...N(t)})}function Eh(e,t){return new e({type:"bigint",...N(t)})}function Ph(e,t){return new e({type:"bigint",coerce:!0,...N(t)})}function Ch(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...N(t)})}function Th(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...N(t)})}function $h(e,t){return new e({type:"symbol",...N(t)})}function Ah(e,t){return new e({type:"undefined",...N(t)})}function Oh(e,t){return new e({type:"null",...N(t)})}function xh(e){return new e({type:"any"})}function Ih(e){return new e({type:"unknown"})}function Dh(e,t){return new e({type:"never",...N(t)})}function Lh(e,t){return new e({type:"void",...N(t)})}function Fh(e,t){return new e({type:"date",...N(t)})}function Mh(e,t){return new e({type:"date",coerce:!0,...N(t)})}function Gh(e,t){return new e({type:"nan",...N(t)})}function kr(e,t){return new Pu({check:"less_than",...N(t),value:e,inclusive:!1})}function Bt(e,t){return new Pu({check:"less_than",...N(t),value:e,inclusive:!0})}function Er(e,t){return new Cu({check:"greater_than",...N(t),value:e,inclusive:!1})}function Wt(e,t){return new Cu({check:"greater_than",...N(t),value:e,inclusive:!0})}function kl(e){return Er(0,e)}function El(e){return kr(0,e)}function Pl(e){return Bt(0,e)}function Cl(e){return Wt(0,e)}function kn(e,t){return new _f({check:"multiple_of",...N(t),value:e})}function En(e,t){return new vf({check:"max_size",...N(t),maximum:e})}function Pr(e,t){return new kf({check:"min_size",...N(t),minimum:e})}function ms(e,t){return new Ef({check:"size_equals",...N(t),size:e})}function fs(e,t){return new Pf({check:"max_length",...N(t),maximum:e})}function Jr(e,t){return new Cf({check:"min_length",...N(t),minimum:e})}function gs(e,t){return new Tf({check:"length_equals",...N(t),length:e})}function ko(e,t){return new $f({check:"string_format",format:"regex",...N(t),pattern:e})}function Eo(e){return new Af({check:"string_format",format:"lowercase",...N(e)})}function Po(e){return new Of({check:"string_format",format:"uppercase",...N(e)})}function Co(e,t){return new xf({check:"string_format",format:"includes",...N(t),includes:e})}function To(e,t){return new If({check:"string_format",format:"starts_with",...N(t),prefix:e})}function $o(e,t){return new Df({check:"string_format",format:"ends_with",...N(t),suffix:e})}function Tl(e,t,r){return new Tu({check:"property",property:e,schema:t,...N(r)})}function $l(e){return Object.entries(e).map(([t,r])=>new Tu({check:"property",property:t,schema:r}))}function Ao(e,t){return new Lf({check:"mime_type",mime:e,...N(t)})}function dr(e){return new Ff({check:"overwrite",tx:e})}function Oo(e){return dr(t=>t.normalize(e))}function xo(){return dr(e=>e.trim())}function Io(){return dr(e=>e.toLowerCase())}function Do(){return dr(e=>e.toUpperCase())}function Lo(){return dr(e=>hm(e))}function Nh(e,t,r){return new e({type:"array",element:t,...N(r)})}function iL(e,t,r){return new e({type:"union",options:t,...N(r)})}function aL(e,t,r){return new e({type:"union",options:t,inclusive:!1,...N(r)})}function cL(e,t,r,n){return new e({type:"union",options:r,discriminator:t,...N(n)})}function uL(e,t,r){return new e({type:"intersection",left:t,right:r})}function lL(e,t,r,n){let s=r instanceof oe,o=s?n:r,i=s?r:null;return new e({type:"tuple",items:t,rest:i,...N(o)})}function pL(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,...N(n)})}function dL(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,...N(n)})}function mL(e,t,r){return new e({type:"set",valueType:t,...N(r)})}function fL(e,t,r){let n=Array.isArray(t)?Object.fromEntries(t.map(s=>[s,s])):t;return new e({type:"enum",entries:n,...N(r)})}function gL(e,t,r){return new e({type:"enum",entries:t,...N(r)})}function hL(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...N(r)})}function Uh(e,t){return new e({type:"file",...N(t)})}function yL(e,t){return new e({type:"transform",transform:t})}function bL(e,t){return new e({type:"optional",innerType:t})}function wL(e,t){return new e({type:"nullable",innerType:t})}function _L(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():sa(r)}})}function RL(e,t,r){return new e({type:"nonoptional",innerType:t,...N(r)})}function SL(e,t){return new e({type:"success",innerType:t})}function vL(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:Pm(r)})}function kL(e,t,r){return new e({type:"pipe",in:t,out:r})}function EL(e,t){return new e({type:"readonly",innerType:t})}function PL(e,t,r){return new e({type:"template_literal",parts:t,...N(r)})}function CL(e,t){return new e({type:"lazy",getter:t})}function TL(e,t){return new e({type:"promise",innerType:t})}function jh(e,t,r){let n=N(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function zh(e,t,r){return new e({type:"custom",check:"custom",fn:t,...N(r)})}function Hh(e,t){let r=gv(n=>(n.addIssue=s=>{if(typeof s=="string")n.issues.push(ho(s,n.value,r._zod.def));else{let o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=n.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),n.issues.push(ho(o))}},e(n.value,n)),t);return r}function gv(e,t){let r=new xe({check:"custom",...N(t)});return r._zod.check=e,r}function Vh(e){let t=new xe({check:"describe"});return t._zod.onattach=[r=>{let n=ct.get(r)??{};ct.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function Bh(e){let t=new xe({check:"meta"});return t._zod.onattach=[r=>{let n=ct.get(r)??{};ct.add(r,{...n,...e})}],t._zod.check=()=>{},t}function Wh(e,t){let r=N(t),n=r.truthy??["true","1","yes","on","y","enabled"],s=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(f=>typeof f=="string"?f.toLowerCase():f),s=s.map(f=>typeof f=="string"?f.toLowerCase():f));let o=new Set(n),i=new Set(s),a=e.Codec??ba,c=e.Boolean??ha,l=e.String??cs,p=new l({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),m=new a({type:"pipe",in:p,out:d,transform:((f,g)=>{let h=f;return r.case!=="sensitive"&&(h=h.toLowerCase()),o.has(h)?!0:i.has(h)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...i],input:g.value,inst:m,continue:!1}),{})}),reverseTransform:((f,g)=>f===!0?n[0]||"true":s[0]||"false"),error:r.error});return m._zod.bag.truthy=n,m._zod.bag.falsy=s,m._zod.bag.case=r.case??"insensitive",m}function Fo(e,t,r,n={}){let s=N(n),o={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:a=>r.test(a),...s};return r instanceof RegExp&&(o.pattern=r),new e(o)}var gh,hv=C(()=>{$u();va();_a();Je();gh={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function $a(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&je(e,n,r[n]);return e}function Pn(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??ct,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 Ke(e,t,r,n,s){let o=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:s}):t.unrepresentable;if(o==="any")return!1;if(o===void 0||o==="throw")throw new Error(s);return Object.assign(r,o),!0}function Ce(e,t,r={path:[],schemaPath:[]}){var n;let s=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let p={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,p);else{let m=i.schema,f=t.processors[s.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);f(e,t,m,p)}let d=e._zod.parent;d&&(i.ref||(i.ref=d),Ce(d,t,p),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&$a(i.schema,c),t.io==="input"&&_t(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function yv(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Cn(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let s=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,m=e.external.uri??(g=>g);if(d)return{ref:m(d)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${yv(f)}`}}let c="#",l=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let p=i[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:l+yv(p)}},o=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:l}=s(i);a.def={...a.schema},l&&(a.defId=l);let p=a.schema;for(let d in p)delete p[d];p.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
57
57
 
58
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){o(i);continue}if(e.external){let l=e.external.registry.get(i[0])?.id;if(t!==i[0]&&l){o(i);continue}}if(e.metadataRegistry.get(i[0])?.id){o(i);continue}if(a.cycle){o(i);continue}if(a.count>1&&e.reused==="ref"){o(i);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function _v(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;_v(n);let s=Object.keys(n);if(s.length!==1||s[0]!=="type")return;let o=n.type;for(let i of Array.isArray(o)?o:[o]){if(typeof i!="string")return;r.includes(i)||r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}function wv(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function qh(e){let t=[];for(let o of e){if(typeof o!="object"||o.type!=="object")return null;for(let i in o)if(!Rv.has(i))return null;t.push(o)}let r={},n=new Set;for(let o of t){for(let i in o.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let l of t){let p=l.properties?.[i]??wv(l);p!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(p))||a.push(p))}let c=a.length===1?a[0]:qh(a)??{allOf:a};je(r,i,c)}for(let i of o.required??[])n.add(i)}let s={type:"object",properties:r};if(n.size&&(s.required=[...n]),t.every(o=>o.additionalProperties===!1))s.additionalProperties=!1;else{let o=[];for(let i of t){let a=wv(i);a&&!o.some(c=>JSON.stringify(c)===JSON.stringify(a))&&o.push(a)}o.length===1?s.additionalProperties=o[0]:o.length>1&&(s.additionalProperties={allOf:o})}return s}function $L(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let s of Rv)if(s in e)return;let r=t.filter(s=>bv.some(o=>Array.isArray(s[o]))),n=null;if(!r.length)n=qh(t);else{let s=r[0],o=bv.find(c=>Array.isArray(s[c]));if(Object.keys(s).length!==1)return;let i=t.filter(c=>c!==s),a=s[o].map(c=>qh([...i,c]));if(a.some(c=>!c))return;n={[o]:a}}n&&(delete e.allOf,$a(e,n))}function Tn(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,p={...l},d=c.ref;if(c.ref=null,d){n(d);let f=e.seen.get(d),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(g)):$a(l,g),$a(l,p),a._zod.parent===d)for(let w in l)w==="$ref"||w==="allOf"||w in p||delete l[w];if(g.$ref&&f.def)for(let w in l)w==="$ref"||w==="allOf"||w in f.def&&JSON.stringify(l[w])===JSON.stringify(f.def[w])&&delete l[w]}let m=a._zod.parent;if(m&&m!==d){n(m);let f=e.seen.get(m);if(f?.schema.$ref&&(l.$ref=f.schema.$ref,f.def))for(let g in l)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(l[g])===JSON.stringify(f.def[g])&&delete l[g]}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())_v(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 l of[c.schema,c.def]){let p=l?.allOf;if(!Array.isArray(p))continue;let d=a.get(p);d?d.push(l):a.set(p,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])$L(l)}}let s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$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");s.$id=e.external.uri(a)}$a(s,r.defId?r.schema:r.def??r.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&s.id===o&&delete s.id;let i=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(i,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?s.$defs=i:s.definitions=i);try{let a=JSON.parse(JSON.stringify(s));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Mo(t,"input",e.processors),output:Mo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function _t(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return _t(n.element,r);if(n.type==="set")return _t(n.valueType,r);if(n.type==="lazy")return _t(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return _t(n.innerType,r);if(n.type==="intersection")return _t(n.left,r)||_t(n.right,r);if(n.type==="record"||n.type==="map")return _t(n.keyType,r)||_t(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:_t(n.in,r)||_t(n.out,r);if(n.type==="object"){for(let s in n.shape)if(_t(n.shape[s],r))return!0;return!1}if(n.type==="union"){for(let s of n.options)if(_t(s,r))return!0;return!1}if(n.type==="tuple"){for(let s of n.items)if(_t(s,r))return!0;return!!(n.rest&&_t(n.rest,r))}return!1}var Rv,bv,Zh,Mo,Aa=C(()=>{va();Je();Rv=new Set(["type","properties","required","additionalProperties"]),bv=["oneOf","anyOf"];Zh=(e,t={})=>r=>{let n=Pn({...r,processors:t});return Ce(e,n),Cn(n,e),Tn(n,e)},Mo=(e,t,r={})=>n=>{let{libraryOptions:s,target:o}=n??{},i=Pn({...s??{},target:o,io:t,processors:r});return Ce(e,i),Cn(i,e),Tn(i,e)}});function Oa(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Oa(t.out):t.type==="catch"?Oa(t.innerType):e._zod.optin}function Jh(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let h=Jh(e,g,r);return h===g?t:h}for(let g of["anyOf","oneOf"]){let h=t[g];if(!Array.isArray(h))continue;let w=h.map(v=>Jh(e,v,r));w.some((v,R)=>v!==h[R])&&(t={...t,[g]:w})}let n=Array.isArray(t.type)?t.type:[t.type],s=!n.includes("string")&&n.some(g=>g==="number"||g==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!s&&!o?.some(g=>typeof g=="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:p,format:d,id:m,...f}=t;return f.enum?f.enum=f.enum.map(g=>typeof g=="number"?String(g):g):typeof f.const=="number"&&(f.const=String(f.const)),s&&(f.type="string",o||(f.pattern=(n.includes("number")?vn:pa).source)),f}function OL(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of Kh.get(e)??[]){let s=e.seen.get(n),o=(s?.def??s?.schema)?.propertyNames;if(!o||o===!0||r.has(o))continue;let i=Jh(t,o,new Set);i!==o&&r.set(o,i)}if(r.size)for(let n of e.seen.values())for(let s of[n.schema,n.def]){let o=s&&r.get(s.propertyNames);o&&(s.propertyNames=o)}}function Sv(e,t,r,n,s){let o=!1,i=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(o=!0,null));return o?(Ke(t,r,n,s,"BigInt defaults cannot be represented in JSON Schema"),Cy):JSON.parse(i)}function Il(e,t){if("_idmap"in e){let n=e,s=Pn({...t,processors:Al}),o={};for(let c of n._idmap.entries()){let[l,p]=c;Ce(p,s)}let i={},a={registry:n,uri:t?.uri,defs:o};s.external=a;for(let c of n._idmap.entries()){let[l,p]=c;Cn(s,p),je(i,l,Tn(s,p))}if(Object.keys(o).length>0){let c=s.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:o}}return{schemas:i}}let r=Pn({...t,processors:Al});return Ce(e,r),Cn(r,e),Tn(r,e)}var AL,Yh,Qh,Xh,ey,ty,ry,ny,sy,oy,iy,ay,cy,uy,ly,py,dy,my,fy,gy,hy,yy,by,wy,_y,Ry,Ol,Sy,vy,Kh,ky,Ey,Py,Cy,Ty,$y,Ay,Oy,xy,Iy,xl,Dy,Al,xa=C(()=>{Ro();Aa();Je();AL={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Yh=(e,t,r,n)=>{let s=r;s.type="string";let{minimum:o,maximum:i,format:a,patterns:c,contentEncoding:l,laxFormat:p}=e._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof i=="number"&&(s.maxLength=i),a&&(s.format=AL[a]??a,s.format===""&&delete s.format,(a==="time"||p)&&delete s.format),l&&(s.contentEncoding=l),c&&c.size>0){let d=[...c];d.length===1?s.pattern=d[0].source:d.length>1&&(s.allOf=[...d.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Qh=(e,t,r,n)=>{let s=r,{minimum:o,maximum:i,format:a,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:p}=e._zod.bag;typeof a=="string"&&a.includes("int")?s.type="integer":s.type="number";let d=typeof p=="number"&&p>=(o??Number.NEGATIVE_INFINITY),m=typeof l=="number"&&l<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";d?f?(s.minimum=p,s.exclusiveMinimum=!0):s.exclusiveMinimum=p:typeof o=="number"&&(s.minimum=o),m?f?(s.maximum=l,s.exclusiveMaximum=!0):s.exclusiveMaximum=l:typeof i=="number"&&(s.maximum=i),typeof c=="number"&&(Number.isFinite(c)&&c!==0?s.multipleOf=Math.abs(c):Ke(e,t,s,n,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))},Xh=(e,t,r,n)=>{r.type="boolean"},ey=(e,t,r,n)=>{Ke(e,t,r,n,"BigInt cannot be represented in JSON Schema")},ty=(e,t,r,n)=>{Ke(e,t,r,n,"Symbols cannot be represented in JSON Schema")},ry=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},ny=(e,t,r,n)=>{Ke(e,t,r,n,"Undefined cannot be represented in JSON Schema")},sy=(e,t,r,n)=>{Ke(e,t,r,n,"Void cannot be represented in JSON Schema")},oy=(e,t,r,n)=>{r.not={}},iy=(e,t,r,n)=>{},ay=(e,t,r,n)=>{},cy=(e,t,r,n)=>{Ke(e,t,r,n,"Date cannot be represented in JSON Schema")},uy=(e,t,r,n)=>{let s=e._zod.def,o=ta(s.entries);if(o.length===0){r.not={};return}o.every(i=>typeof i=="number")&&(r.type="number"),o.every(i=>typeof i=="string")&&(r.type="string"),r.enum=o},ly=(e,t,r,n)=>{let s=e._zod.def;if(s.values.length===0){r.not={};return}let o=[];for(let i of s.values)if(i===void 0){if(Ke(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(Ke(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(i))}else o.push(i);if(o.length!==0)if(o.length===1){let i=o[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else o.every(i=>typeof i=="number")&&(r.type="number"),o.every(i=>typeof i=="string")&&(r.type="string"),o.every(i=>typeof i=="boolean")&&(r.type="boolean"),o.every(i=>i===null)&&(r.type="null"),r.enum=o},py=(e,t,r,n)=>{Ke(e,t,r,n,"NaN cannot be represented in JSON Schema")},dy=(e,t,r,n)=>{let s=r,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");s.type="string",s.pattern=o.source},my=(e,t,r,n)=>{let s=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:c}=e._zod.bag;i!==void 0&&(o.minLength=i),a!==void 0&&(o.maxLength=a),c?c.length===1?(o.contentMediaType=c[0],Object.assign(s,o)):(Object.assign(s,o),s.anyOf=c.map(l=>({contentMediaType:l}))):Object.assign(s,o)},fy=(e,t,r,n)=>{r.type="boolean"},gy=(e,t,r,n)=>{Ke(e,t,r,n,"Custom types cannot be represented in JSON Schema")},hy=(e,t,r,n)=>{Ke(e,t,r,n,"Function types cannot be represented in JSON Schema")},yy=(e,t,r,n)=>{Ke(e,t,r,n,"Transforms cannot be represented in JSON Schema")},by=(e,t,r,n)=>{Ke(e,t,r,n,"Map cannot be represented in JSON Schema")},wy=(e,t,r,n)=>{Ke(e,t,r,n,"Set cannot be represented in JSON Schema")},_y=(e,t,r,n)=>{let s=r,o=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(s.minItems=i),typeof a=="number"&&(s.maxItems=a),s.type="array",s.items=Ce(o.element,t,{...n,path:[...n.path,"items"]})};Ry=(e,t,r,n)=>{let s=r,o=e._zod.def,i=o.shape;if(Object.getOwnPropertySymbols(i).length&&Ke(e,t,s,n,"Symbol keys cannot be represented in JSON Schema"))return;s.type="object",s.properties={};for(let p in i)je(s.properties,p,Ce(i[p],t,{...n,path:[...n.path,"properties",p]}));let c=new Set(Object.keys(i)),l=new Set([...c].filter(p=>{let d=o.shape[p];return t.io==="input"?Oa(d)===void 0:d._zod.optout===void 0}));l.size>0&&(s.required=Array.from(l)),o.catchall?._zod.def.type==="never"?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=Ce(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},Ol=(e,t,r,n)=>{let s=e._zod.def,o=s.inclusive===!1,i=s.options.map((a,c)=>Ce(a,t,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=i:r.anyOf=i},Sy=(e,t,r,n)=>{let s=e._zod.def,o=Ce(s.left,t,{...n,path:[...n.path,"allOf",0]}),i=Ce(s.right,t,{...n,path:[...n.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(o)?o.allOf:[o],...a(i)?i.allOf:[i]];r.allOf=c,t.intersections.push(c)},vy=(e,t,r,n)=>{let s=r,o=e._zod.def;s.type="array";let i=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,w)=>Ce(h,t,{...n,path:[...n.path,i,w]})),l=o.rest?Ce(o.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,p=o.items.length;for(;p>0;){let h=o.items[p-1];if(!(t.io==="input"?Oa(h)!==void 0:h._zod.optout==="optional"))break;p--}let d=o.items.length,m=!o.rest;t.target==="draft-2020-12"?(s.prefixItems=c,m?s.items=!1:l&&(s.items=l),p>0&&(s.minItems=p),m&&(s.maxItems=d)):t.target==="openapi-3.0"?(s.items={anyOf:c},l&&s.items.anyOf.push(l),p>0&&(s.minItems=p),m&&(s.maxItems=d)):(s.items=c,m?s.additionalItems=!1:l&&(s.additionalItems=l),p>0&&(s.minItems=p),m&&(s.maxItems=d));let{minimum:f,maximum:g}=e._zod.bag;typeof f=="number"&&(s.minItems=f),typeof g=="number"&&(s.maxItems=g)};Kh=new WeakMap;ky=(e,t,r,n)=>{let s=r,o=e._zod.def;s.type="object";let i=o.keyType,c=i._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){let d=Ce(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});s.patternProperties={};for(let m of c)je(s.patternProperties,m.source,d)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){s.propertyNames=Ce(o.keyType,t,{...n,path:[...n.path,"propertyNames"]});let d=Kh.get(t);d||(d=[],Kh.set(t,d),t.deferred.push(()=>OL(t))),d.push(e)}s.additionalProperties=Ce(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let l=i._zod.values,p=t.io==="input"&&Oa(o.valueType)!==void 0;if(l&&!o.partial&&!p){let d=[...l].filter(m=>typeof m=="string"||typeof m=="number");d.length>0&&(s.required=d.map(String))}},Ey=(e,t,r,n)=>{let s=e._zod.def,o=Ce(s.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=s.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},Py=(e,t,r,n)=>{let s=e._zod.def;Ce(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType},Cy=Symbol();Ty=(e,t,r,n)=>{let s=e._zod.def;Ce(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType;let i=Sv(s.defaultValue,e,t,r,n);i!==Cy&&(r.default=i)},$y=(e,t,r,n)=>{let s=e._zod.def;Ce(s.innerType,t,n);let o=t.seen.get(e);if(o.ref=s.innerType,t.io!=="input")return;let i=Sv(s.defaultValue,e,t,r,n);i!==Cy&&(r._prefault=i)},Ay=(e,t,r,n)=>{let s=e._zod.def;Ce(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType;let i;try{i=s.catchValue(void 0)}catch{Ke(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},Oy=(e,t,r,n)=>{let s=e._zod.def,o=s.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?o?s.out:s.in:s.out;Ce(i,t,n);let a=t.seen.get(e);a.ref=i},xy=(e,t,r,n)=>{let s=e._zod.def;Ce(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType,r.readOnly=!0},Iy=(e,t,r,n)=>{let s=e._zod.def;Ce(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType},xl=(e,t,r,n)=>{let s=e._zod.def;Ce(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType},Dy=(e,t,r,n)=>{let s=e._zod.innerType;Ce(s,t,n);let o=t.seen.get(e);o.ref=s},Al={string:Yh,number:Qh,boolean:Xh,bigint:ey,symbol:ty,null:ry,undefined:ny,void:sy,never:oy,any:iy,unknown:ay,date:cy,enum:uy,literal:ly,nan:py,template_literal:dy,file:my,success:fy,custom:gy,function:hy,transform:yy,map:by,set:wy,array:_y,object:Ry,union:Ol,intersection:Sy,tuple:vy,record:ky,nullable:Ey,nonoptional:Py,default:Ty,prefault:$y,catch:Ay,pipe:Oy,readonly:xy,promise:Iy,optional:xl,lazy:Dy}});var Dl,vv=C(()=>{xa();Aa();Dl=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 r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Pn({processors:Al,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return Ce(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Cn(this.ctx,t);let n=Tn(this.ctx,t),{"~standard":s,...o}=n;return o}}});var kv={};var Ev=C(()=>{});var Kr={};ne(Kr,{$ZodAny:()=>wg,$ZodArray:()=>kg,$ZodAsyncError:()=>Ot,$ZodBase64:()=>cg,$ZodBase64URL:()=>ug,$ZodBigInt:()=>Bu,$ZodBigIntFormat:()=>gg,$ZodBoolean:()=>ha,$ZodCIDRv4:()=>ig,$ZodCIDRv6:()=>ag,$ZodCUID:()=>Zf,$ZodCUID2:()=>Jf,$ZodCatch:()=>Hg,$ZodCheck:()=>xe,$ZodCheckBigIntFormat:()=>Sf,$ZodCheckEndsWith:()=>Df,$ZodCheckGreaterThan:()=>Cu,$ZodCheckIncludes:()=>xf,$ZodCheckLengthEquals:()=>Tf,$ZodCheckLessThan:()=>Pu,$ZodCheckLowerCase:()=>Af,$ZodCheckMaxLength:()=>Pf,$ZodCheckMaxSize:()=>vf,$ZodCheckMimeType:()=>Lf,$ZodCheckMinLength:()=>Cf,$ZodCheckMinSize:()=>kf,$ZodCheckMultipleOf:()=>_f,$ZodCheckNumberFormat:()=>Rf,$ZodCheckOverwrite:()=>Ff,$ZodCheckProperty:()=>Tu,$ZodCheckRegex:()=>$f,$ZodCheckSizeEquals:()=>Ef,$ZodCheckStartsWith:()=>If,$ZodCheckStringFormat:()=>So,$ZodCheckUpperCase:()=>Of,$ZodCodec:()=>ba,$ZodCreditCard:()=>pg,$ZodCustom:()=>Kg,$ZodCustomStringFormat:()=>mg,$ZodCyclicError:()=>Yu,$ZodDate:()=>vg,$ZodDefault:()=>Ng,$ZodDiscriminatedUnion:()=>Tg,$ZodE164:()=>lg,$ZodEmail:()=>zf,$ZodEmoji:()=>Wf,$ZodEncodeError:()=>Sn,$ZodEnum:()=>Ig,$ZodError:()=>ca,$ZodExactOptional:()=>Mg,$ZodFile:()=>Lg,$ZodFunction:()=>Zg,$ZodGUID:()=>Uf,$ZodIPv4:()=>ng,$ZodIPv6:()=>sg,$ZodISODate:()=>eg,$ZodISODateTime:()=>Xf,$ZodISODuration:()=>rg,$ZodISOTime:()=>tg,$ZodIntersection:()=>$g,$ZodJWT:()=>dg,$ZodKSUID:()=>Qf,$ZodLazy:()=>wa,$ZodLiteral:()=>Dg,$ZodMAC:()=>og,$ZodMap:()=>Og,$ZodNaN:()=>Vg,$ZodNanoID:()=>qf,$ZodNever:()=>Rg,$ZodNonOptional:()=>jg,$ZodNull:()=>bg,$ZodNullable:()=>Gg,$ZodNumber:()=>Vu,$ZodNumberFormat:()=>fg,$ZodObject:()=>nv,$ZodObjectJIT:()=>Eg,$ZodOptional:()=>qu,$ZodPipe:()=>Zu,$ZodPrefault:()=>Ug,$ZodPreprocess:()=>Bg,$ZodPromise:()=>Jg,$ZodReadonly:()=>Wg,$ZodRealError:()=>xt,$ZodRecord:()=>Ag,$ZodRegistry:()=>el,$ZodSet:()=>xg,$ZodString:()=>cs,$ZodStringFormat:()=>$e,$ZodSuccess:()=>zg,$ZodSymbol:()=>hg,$ZodTemplateLiteral:()=>qg,$ZodTransform:()=>Fg,$ZodTuple:()=>Wu,$ZodType:()=>oe,$ZodULID:()=>Kf,$ZodURL:()=>Bf,$ZodUUID:()=>jf,$ZodUndefined:()=>yg,$ZodUnion:()=>ya,$ZodUnknown:()=>_g,$ZodVoid:()=>Sg,$ZodXID:()=>Yf,$ZodXor:()=>Pg,$brand:()=>$m,$constructor:()=>T,$input:()=>oh,$output:()=>sh,Doc:()=>as,INVALID:()=>Vt,JSONSchema:()=>kv,JSONSchemaGenerator:()=>Dl,NEVER:()=>Tm,TimePrecision:()=>gh,URL_BAD_FORMAT:()=>Hf,URL_UNPARSEABLE:()=>Vf,ZodCompileAsyncError:()=>pr,ZodCompileUnsupportedError:()=>ye,_any:()=>xh,_array:()=>Nh,_base64:()=>_l,_base64url:()=>Rl,_bigint:()=>Eh,_boolean:()=>vh,_catch:()=>vL,_check:()=>gv,_cidrv4:()=>bl,_cidrv6:()=>wl,_coercedBigint:()=>Ph,_coercedBoolean:()=>kh,_coercedDate:()=>Mh,_coercedNumber:()=>yh,_coercedString:()=>dh,_creditCard:()=>fh,_cuid:()=>pl,_cuid2:()=>dl,_custom:()=>jh,_date:()=>Fh,_decode:()=>hu,_decodeAsync:()=>bu,_default:()=>_L,_discriminatedUnion:()=>cL,_e164:()=>Sl,_email:()=>nl,_emoji:()=>ul,_encode:()=>gu,_encodeAsync:()=>yu,_endsWith:()=>$o,_enum:()=>fL,_file:()=>Uh,_float32:()=>wh,_float64:()=>_h,_gt:()=>Er,_gte:()=>Wt,_guid:()=>sl,_includes:()=>Co,_int:()=>bh,_int32:()=>Rh,_int64:()=>Ch,_intersection:()=>uL,_ipv4:()=>hl,_ipv6:()=>yl,_isoDate:()=>Pa,_isoDateTime:()=>Ea,_isoDuration:()=>Ta,_isoTime:()=>Ca,_jwt:()=>vl,_ksuid:()=>gl,_lazy:()=>CL,_length:()=>gs,_literal:()=>hL,_lowercase:()=>Eo,_lt:()=>kr,_lte:()=>Bt,_mac:()=>mh,_map:()=>dL,_max:()=>Bt,_maxLength:()=>fs,_maxSize:()=>En,_mime:()=>Ao,_min:()=>Wt,_minLength:()=>Jr,_minSize:()=>Pr,_multipleOf:()=>kn,_nan:()=>Gh,_nanoid:()=>ll,_nativeEnum:()=>gL,_negative:()=>El,_never:()=>Dh,_nonnegative:()=>Cl,_nonoptional:()=>RL,_nonpositive:()=>Pl,_normalize:()=>Oo,_null:()=>Oh,_nullable:()=>wL,_number:()=>hh,_optional:()=>bL,_overwrite:()=>dr,_parse:()=>yo,_parseAsync:()=>bo,_pipe:()=>kL,_positive:()=>kl,_promise:()=>TL,_properties:()=>$l,_property:()=>Tl,_readonly:()=>EL,_record:()=>pL,_refine:()=>zh,_regex:()=>ko,_safeDecode:()=>_u,_safeDecodeAsync:()=>Su,_safeEncode:()=>wu,_safeEncodeAsync:()=>Ru,_safeParse:()=>wo,_safeParseAsync:()=>_o,_set:()=>mL,_size:()=>ms,_slugify:()=>Lo,_startsWith:()=>To,_string:()=>ph,_stringFormat:()=>Fo,_stringbool:()=>Wh,_success:()=>SL,_superRefine:()=>Hh,_symbol:()=>$h,_templateLiteral:()=>PL,_toLowerCase:()=>Io,_toUpperCase:()=>Do,_transform:()=>yL,_trim:()=>xo,_tuple:()=>lL,_uint32:()=>Sh,_uint64:()=>Th,_ulid:()=>ml,_undefined:()=>Ah,_union:()=>iL,_unknown:()=>Ih,_uppercase:()=>Po,_url:()=>ka,_uuid:()=>ol,_uuidv4:()=>il,_uuidv6:()=>al,_uuidv7:()=>cl,_void:()=>Lh,_xid:()=>fl,_xor:()=>aL,clone:()=>Pe,compile:()=>uh,compileFn:()=>rl,config:()=>ze,createStandardJSONSchemaMethod:()=>Mo,createToJSONSchemaMethod:()=>Zh,decode:()=>b0,decodeAsync:()=>_0,describe:()=>Vh,encode:()=>y0,encodeAsync:()=>w0,extractDefs:()=>Cn,finalize:()=>Tn,flattenError:()=>ua,formatError:()=>la,getDiscriminatedOption:()=>Cg,globalConfig:()=>ot,globalRegistry:()=>ct,handleUnrepresentable:()=>Ke,initializeContext:()=>Pn,isBackEdge:()=>Qu,isRecursiveSchema:()=>eh,isValidBase64:()=>ga,isValidBase64URL:()=>ju,isValidCIDRv6:()=>Uu,isValidCreditCard:()=>zu,isValidIPv6:()=>fa,isValidJWT:()=>Hu,locales:()=>Sa,memoizer:()=>Ra,mergeValues:()=>vo,meta:()=>Bh,parse:()=>mu,parseAsync:()=>fu,parseURLObject:()=>Fu,prettifyError:()=>Dm,process:()=>Ce,regexes:()=>bt,registry:()=>tl,safeDecode:()=>S0,safeDecodeAsync:()=>k0,safeEncode:()=>R0,safeEncodeAsync:()=>v0,safeParse:()=>Fm,safeParseAsync:()=>Mm,standardProps:()=>Lu,stripTabAndNewline:()=>Mu,toDotPath:()=>DS,toJSONSchema:()=>Il,toZod:()=>ea,treeifyError:()=>Im,urlHostnameOk:()=>Gu,urlProtocolOk:()=>Nu,util:()=>Y,validate:()=>Gm,validateAsync:()=>Nm,version:()=>Mf});var qt=C(()=>{Rn();Um();Lm();_a();th();$u();Gf();Je();Je();Ro();nh();va();Au();fv();hv();Aa();xa();vv();Ev()});var Ll={};ne(Ll,{endsWith:()=>$o,gt:()=>Er,gte:()=>Wt,includes:()=>Co,length:()=>gs,lowercase:()=>Eo,lt:()=>kr,lte:()=>Bt,maxLength:()=>fs,maxSize:()=>En,mime:()=>Ao,minLength:()=>Jr,minSize:()=>Pr,multipleOf:()=>kn,negative:()=>El,nonnegative:()=>Cl,nonpositive:()=>Pl,normalize:()=>Oo,overwrite:()=>dr,positive:()=>kl,properties:()=>$l,property:()=>Tl,regex:()=>ko,size:()=>ms,slugify:()=>Lo,startsWith:()=>To,toLowerCase:()=>Io,toUpperCase:()=>Do,trim:()=>xo,uppercase:()=>Po});var Fl=C(()=>{qt()});function Ml(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Pv,Cv,IL,It,Ly=C(()=>{qt();qt();Je();Pv=new WeakSet([Object.prototype,Error.prototype]);Cv=(e,t)=>{ca.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Pv.has(r)||(Pv.add(r),Ml(r,"format",n=>s=>la(n,s)),Ml(r,"flatten",n=>s=>ua(n,s)),Ml(r,"addIssue",n=>s=>{n.issues.push(s),n.message=JSON.stringify(n.issues,fo,2)}),Ml(r,"addIssues",n=>s=>{n.issues.push(...s),n.message=JSON.stringify(n.issues,fo,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},IL=T("ZodError",Cv),It=T("ZodError",Cv,void 0,{Parent:Error})});var Fy,My,Gy,Ny,Uy,jy,zy,Hy,Vy,By,Wy,qy,Zy=C(()=>{qt();Ly();qt();Fy=yo(It),My=bo(It),Gy=wo(It),Ny=_o(It),Uy=gu(It),jy=hu(It),zy=yu(It),Hy=bu(It),Vy=wu(It),By=_u(It),Wy=Ru(It),qy=Su(It)});var Wo={};ne(Wo,{ZodAny:()=>nb,ZodArray:()=>ab,ZodBase64:()=>ep,ZodBase64URL:()=>tp,ZodBigInt:()=>Vo,ZodBigIntFormat:()=>sp,ZodBoolean:()=>Ho,ZodCIDRv4:()=>Ql,ZodCIDRv6:()=>Xl,ZodCUID:()=>Bl,ZodCUID2:()=>Wl,ZodCatch:()=>Tb,ZodCodec:()=>za,ZodCreditCard:()=>Ky,ZodCustom:()=>Ha,ZodCustomStringFormat:()=>jo,ZodDate:()=>Fa,ZodDefault:()=>Sb,ZodDiscriminatedUnion:()=>ub,ZodE164:()=>rp,ZodEmail:()=>jl,ZodEmoji:()=>Hl,ZodEnum:()=>No,ZodExactOptional:()=>cp,ZodFile:()=>bb,ZodFunction:()=>Gb,ZodGUID:()=>zl,ZodIPv4:()=>Kl,ZodIPv6:()=>Yl,ZodISODate:()=>An,ZodISODateTime:()=>$n,ZodISODuration:()=>xn,ZodISOTime:()=>On,ZodIntersection:()=>lb,ZodJWT:()=>np,ZodKSUID:()=>Jl,ZodLazy:()=>Lb,ZodLiteral:()=>yb,ZodMAC:()=>Jy,ZodMap:()=>gb,ZodNaN:()=>Ab,ZodNanoID:()=>Vl,ZodNever:()=>ob,ZodNonOptional:()=>up,ZodNull:()=>tb,ZodNullable:()=>Rb,ZodNumber:()=>zo,ZodNumberFormat:()=>ws,ZodObject:()=>Ga,ZodOptional:()=>Ua,ZodPipe:()=>ja,ZodPrefault:()=>kb,ZodPreprocess:()=>Ob,ZodPromise:()=>Mb,ZodReadonly:()=>xb,ZodRecord:()=>Go,ZodSet:()=>hb,ZodString:()=>Uo,ZodStringFormat:()=>Oe,ZodSuccess:()=>Cb,ZodSymbol:()=>Xy,ZodTemplateLiteral:()=>Db,ZodTransform:()=>wb,ZodTuple:()=>db,ZodType:()=>le,ZodULID:()=>ql,ZodURL:()=>La,ZodUUID:()=>Cr,ZodUndefined:()=>eb,ZodUnion:()=>Na,ZodUnknown:()=>sb,ZodVoid:()=>ib,ZodXID:()=>Zl,ZodXor:()=>cb,_ZodString:()=>Ul,_default:()=>vb,_function:()=>Lk,any:()=>dk,array:()=>Ma,base64:()=>Zv,base64url:()=>Jv,bigint:()=>ak,boolean:()=>Qy,catch:()=>$b,check:()=>Fk,cidrv4:()=>Wv,cidrv6:()=>qv,codec:()=>Ok,creditCard:()=>Yv,cuid:()=>Gv,cuid2:()=>Nv,custom:()=>Mk,date:()=>fk,describe:()=>Gk,discriminatedUnion:()=>_k,e164:()=>Kv,email:()=>Tv,emoji:()=>Fv,enum:()=>ip,exactOptional:()=>_b,file:()=>Ck,float32:()=>nk,float64:()=>sk,function:()=>Lk,guid:()=>$v,hash:()=>rk,hex:()=>tk,hostname:()=>ek,httpUrl:()=>Lv,instanceof:()=>Uk,int:()=>Gl,int32:()=>ok,int64:()=>ck,intersection:()=>pb,invertCodec:()=>xk,ipv4:()=>Hv,ipv6:()=>Bv,json:()=>zk,jwt:()=>Qv,keyof:()=>gk,ksuid:()=>zv,lazy:()=>Fb,literal:()=>Pk,looseObject:()=>bk,looseRecord:()=>Sk,mac:()=>Vv,map:()=>vk,meta:()=>Nk,nan:()=>Ak,nanoid:()=>Mv,nativeEnum:()=>Ek,never:()=>op,nonoptional:()=>Pb,null:()=>rb,nullable:()=>Da,nullish:()=>Tk,number:()=>Yy,object:()=>hk,optional:()=>ys,partialRecord:()=>Rk,pipe:()=>Nl,prefault:()=>Eb,preprocess:()=>Hk,promise:()=>Dk,readonly:()=>Ib,record:()=>fb,refine:()=>Nb,set:()=>kk,strictObject:()=>yk,string:()=>Ia,stringFormat:()=>Xv,stringbool:()=>jk,success:()=>$k,superRefine:()=>Ub,symbol:()=>lk,templateLiteral:()=>Ik,transform:()=>ap,tuple:()=>mb,uint32:()=>ik,uint64:()=>uk,ulid:()=>Uv,undefined:()=>pk,union:()=>Bo,unknown:()=>hs,url:()=>Dv,uuid:()=>Av,uuidv4:()=>Ov,uuidv6:()=>xv,uuidv7:()=>Iv,void:()=>mk,xid:()=>jv,xor:()=>wk});function LL(){ot.localeError||ze(Xu())}function bs(){ot.memoizer||ze({memoizer:Ra()})}function Ia(e){return ph(Uo,e)}function Tv(e){return nl(jl,e)}function $v(e){return sl(zl,e)}function Av(e){return ol(Cr,e)}function Ov(e){return il(Cr,e)}function xv(e){return al(Cr,e)}function Iv(e){return cl(Cr,e)}function Dv(e){return ka(La,e)}function Lv(e){return ka(La,{protocol:bt.httpProtocol,hostname:bt.domain,...Y.normalizeParams(e)})}function Fv(e){return ul(Hl,e)}function Mv(e){return ll(Vl,e)}function Gv(e){return pl(Bl,e)}function Nv(e){return dl(Wl,e)}function Uv(e){return ml(ql,e)}function jv(e){return fl(Zl,e)}function zv(e){return gl(Jl,e)}function Hv(e){return hl(Kl,e)}function Vv(e){return mh(Jy,e)}function Bv(e){return yl(Yl,e)}function Wv(e){return bl(Ql,e)}function qv(e){return wl(Xl,e)}function Zv(e){return _l(ep,e)}function Jv(e){return Rl(tp,e)}function Kv(e){return Sl(rp,e)}function Yv(e){return fh(Ky,e)}function Qv(e){return vl(np,e)}function Xv(e,t,r={}){return Fo(jo,e,t,r)}function ek(e){return Fo(jo,"hostname",bt.hostname,e)}function tk(e){return Fo(jo,"hex",bt.hex,e)}function rk(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,s=bt[n];if(!s)throw new Error(`Unrecognized hash format: ${n}`);return Fo(jo,n,s,t)}function Yy(e){return hh(zo,e)}function Gl(e){return bh(ws,e)}function nk(e){return wh(ws,e)}function sk(e){return _h(ws,e)}function ok(e){return Rh(ws,e)}function ik(e){return Sh(ws,e)}function Qy(e){return vh(Ho,e)}function ak(e){return Eh(Vo,e)}function ck(e){return Ch(sp,e)}function uk(e){return Th(sp,e)}function lk(e){return $h(Xy,e)}function pk(e){return Ah(eb,e)}function rb(e){return Oh(tb,e)}function dk(){return xh(nb)}function hs(){return Ih(sb)}function op(e){return Dh(ob,e)}function mk(e){return Lh(ib,e)}function fk(e){return Fh(Fa,e)}function Ma(e,t){return Nh(ab,e,t)}function gk(e){let t=e._zod.def.shape;return ip(Object.keys(t))}function hk(e,t){let r={type:"object",shape:e??{},...Y.normalizeParams(t)};return new Ga(r)}function yk(e,t){return new Ga({type:"object",shape:e,catchall:op(),...Y.normalizeParams(t)})}function bk(e,t){return new Ga({type:"object",shape:e,catchall:hs(),...Y.normalizeParams(t)})}function Bo(e,t){return new Na({type:"union",options:e,...Y.normalizeParams(t)})}function wk(e,t){return new cb({type:"union",options:e,inclusive:!1,...Y.normalizeParams(t)})}function _k(e,t,r){return new ub({type:"union",options:t,discriminator:e,...Y.normalizeParams(r)})}function pb(e,t){return new lb({type:"intersection",left:e,right:t})}function mb(e,t,r){let n=t instanceof oe,s=n?r:t,o=n?t:null;return new db({type:"tuple",items:e,rest:o,...Y.normalizeParams(s)})}function fb(e,t,r){return!t||!t._zod?new Go({type:"record",keyType:Ia(),valueType:e,...Y.normalizeParams(t)}):new Go({type:"record",keyType:e,valueType:t,...Y.normalizeParams(r)})}function Rk(e,t,r){return new Go({type:"record",keyType:e,valueType:t,...Y.normalizeParams(r),partial:!0})}function Sk(e,t,r){return new Go({type:"record",keyType:e,valueType:t,mode:"loose",...Y.normalizeParams(r)})}function vk(e,t,r){return new gb({type:"map",keyType:e,valueType:t,...Y.normalizeParams(r)})}function kk(e,t){return new hb({type:"set",valueType:e,...Y.normalizeParams(t)})}function ip(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new No({type:"enum",entries:r,...Y.normalizeParams(t)})}function Ek(e,t){return new No({type:"enum",entries:e,...Y.normalizeParams(t)})}function Pk(e,t){return new yb({type:"literal",values:Array.isArray(e)?e:[e],...Y.normalizeParams(t)})}function Ck(e){return Uh(bb,e)}function ap(e){return new wb({type:"transform",transform:e})}function ys(e){return new Ua({type:"optional",innerType:e})}function _b(e){return new cp({type:"optional",innerType:e})}function Da(e){return new Rb({type:"nullable",innerType:e})}function Tk(e){return ys(Da(e))}function vb(e,t){return new Sb({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Y.shallowClone(t)}})}function Eb(e,t){return new kb({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Y.shallowClone(t)}})}function Pb(e,t){return new up({type:"nonoptional",innerType:e,...Y.normalizeParams(t)})}function $k(e){return new Cb({type:"success",innerType:e})}function $b(e,t){return new Tb({type:"catch",innerType:e,catchValue:typeof t=="function"?t:Y.constantCatch(t)})}function Ak(e){return Gh(Ab,e)}function Nl(e,t){return new ja({type:"pipe",in:e,out:t})}function Ok(e,t,r){return new za({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function xk(e){let t=e._zod.def;return new za({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}function Ib(e){return new xb({type:"readonly",innerType:e})}function Ik(e,t){return new Db({type:"template_literal",parts:e,...Y.normalizeParams(t)})}function Fb(e){return new Lb({type:"lazy",getter:e})}function Dk(e){return new Mb({type:"promise",innerType:e})}function Lk(e){return new Gb({type:"function",input:Array.isArray(e?.input)?mb(e?.input):e?.input??Ma(hs()),output:e?.output??hs()})}function Fk(e){let t=new xe({check:"custom"});return t._zod.check=e,t}function Mk(e,t){return jh(Ha,e??(()=>!0),t)}function Nb(e,t={}){return zh(Ha,e,t)}function Ub(e,t){return Hh(e,t)}function Uk(e,t={}){let r=new Ha({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...Y.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}function zk(e){let t=Fb(()=>Bo([Ia(e),Yy(),Qy(),rb(),Ma(t),fb(Ia(),t)]));return t}function Hk(e,t){return new Ob({type:"pipe",in:ap(e),out:t})}var le,Ul,Uo,Oe,$n,An,On,xn,jl,zl,Cr,La,Hl,Vl,Bl,Wl,ql,Zl,Jl,Kl,Jy,Yl,Ql,Xl,ep,tp,rp,Ky,np,jo,zo,ws,Ho,Vo,sp,Xy,eb,tb,nb,sb,ob,ib,Fa,ab,Ga,Na,cb,ub,lb,db,Go,gb,hb,No,yb,bb,wb,Ua,cp,Rb,Sb,kb,up,Cb,Tb,Ab,ja,za,Ob,xb,Db,Lb,Mb,Gb,Ha,Gk,Nk,jk,In=C(()=>{qt();qt();xa();Aa();rh();Fl();Zy();le=T("ZodType",(e,t)=>(LL(),oe.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Y.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Pe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Nb(e,t))},superRefine(e,t){return this.check(Ub(e,t))},overwrite(e){return this.check(dr(e))},optional(){return ys(this)},exactOptional(){return _b(this)},nullable(){return Da(this)},nullish(){return ys(Da(this))},nonoptional(e){return Pb(this,e)},array(){return Ma(this)},or(e){return Bo([this,e])},and(e){return pb(this,e)},transform(e){return Nl(this,ap(e))},default(e){return vb(this,e)},prefault(e){return Eb(this,e)},catch(e){return $b(this,e)},pipe(e){return Nl(this,e)},readonly(){return Ib(this)},describe(e){let t=this.clone();return ct.add(t,{description:e}),t},meta(...e){if(e.length===0)return ct.get(this);let t=this.clone();return ct.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 Y.hide(this,"~standard",{...Lu(this),jsonSchema:{input:Mo(this,"input"),output:Mo(this,"output")}})},set"~standard"(e){Y.own(this,"~standard",e)},parse:function e(t,r){return Fy(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await My(this,t,r,{callee:e})},safeParse(e,t){return Gy(this,e,t)},async safeParseAsync(e,t){return Ny(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Y.own(this,"spa",e)},encode:function e(t,r){return Uy(this,t,r,{callee:e})},decode:function e(t,r){return jy(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await zy(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Hy(this,t,r,{callee:e})},safeEncode(e,t){return Vy(this,e,t)},safeDecode(e,t){return By(this,e,t)},async safeEncodeAsync(e,t){return Wy(this,e,t)},async safeDecodeAsync(e,t){return qy(this,e,t)},toJSONSchema(e){return Zh(this,{})(e)},get description(){return ct.get(this)?.description},get _def(){return this._zod.def}}),Ul=T("_ZodString",(e,t)=>{cs.init(e,t),le.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Yh(e,n,s,o);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null},{regex(...e){return this.check(ko(...e))},includes(...e){return this.check(Co(...e))},startsWith(...e){return this.check(To(...e))},endsWith(...e){return this.check($o(...e))},min(...e){return this.check(Jr(...e))},max(...e){return this.check(fs(...e))},length(...e){return this.check(gs(...e))},nonempty(...e){return this.check(Jr(1,...e))},lowercase(e){return this.check(Eo(e))},uppercase(e){return this.check(Po(e))},trim(){return this.check(xo())},normalize(...e){return this.check(Oo(...e))},toLowerCase(){return this.check(Io())},toUpperCase(){return this.check(Do())},slugify(){return this.check(Lo())}}),Uo=T("ZodString",(e,t)=>{cs.init(e,t),Ul.init(e,t)},{email(e){return this.check(nl(jl,e))},url(e){return this.check(ka(La,e))},jwt(e){return this.check(vl(np,e))},emoji(e){return this.check(ul(Hl,e))},guid(e){return this.check(sl(zl,e))},uuid(e){return this.check(ol(Cr,e))},uuidv4(e){return this.check(il(Cr,e))},uuidv6(e){return this.check(al(Cr,e))},uuidv7(e){return this.check(cl(Cr,e))},nanoid(e){return this.check(ll(Vl,e))},cuid(e){return this.check(pl(Bl,e))},cuid2(e){return this.check(dl(Wl,e))},ulid(e){return this.check(ml(ql,e))},base64(e){return this.check(_l(ep,e))},base64url(e){return this.check(Rl(tp,e))},xid(e){return this.check(fl(Zl,e))},ksuid(e){return this.check(gl(Jl,e))},ipv4(e){return this.check(hl(Kl,e))},ipv6(e){return this.check(yl(Yl,e))},cidrv4(e){return this.check(bl(Ql,e))},cidrv6(e){return this.check(wl(Xl,e))},e164(e){return this.check(Sl(rp,e))},datetime(e){return this.check(Ea($n,e))},date(e){return this.check(Pa(An,e))},time(e){return this.check(Ca(On,e))},duration(e){return this.check(Ta(xn,e))}});Oe=T("ZodStringFormat",(e,t)=>{$e.init(e,t),Ul.init(e,t)}),$n=T("ZodISODateTime",(e,t)=>{Xf.init(e,t),Oe.init(e,t)}),An=T("ZodISODate",(e,t)=>{eg.init(e,t),Oe.init(e,t)}),On=T("ZodISOTime",(e,t)=>{tg.init(e,t),Oe.init(e,t)}),xn=T("ZodISODuration",(e,t)=>{rg.init(e,t),Oe.init(e,t)}),jl=T("ZodEmail",(e,t)=>{zf.init(e,t),Oe.init(e,t)});zl=T("ZodGUID",(e,t)=>{Uf.init(e,t),Oe.init(e,t)});Cr=T("ZodUUID",(e,t)=>{jf.init(e,t),Oe.init(e,t)});La=T("ZodURL",(e,t)=>{Bf.init(e,t),Oe.init(e,t)});Hl=T("ZodEmoji",(e,t)=>{Wf.init(e,t),Oe.init(e,t)});Vl=T("ZodNanoID",(e,t)=>{qf.init(e,t),Oe.init(e,t)});Bl=T("ZodCUID",(e,t)=>{Zf.init(e,t),Oe.init(e,t)});Wl=T("ZodCUID2",(e,t)=>{Jf.init(e,t),Oe.init(e,t)});ql=T("ZodULID",(e,t)=>{Kf.init(e,t),Oe.init(e,t)});Zl=T("ZodXID",(e,t)=>{Yf.init(e,t),Oe.init(e,t)});Jl=T("ZodKSUID",(e,t)=>{Qf.init(e,t),Oe.init(e,t)});Kl=T("ZodIPv4",(e,t)=>{ng.init(e,t),Oe.init(e,t)});Jy=T("ZodMAC",(e,t)=>{og.init(e,t),Oe.init(e,t)});Yl=T("ZodIPv6",(e,t)=>{sg.init(e,t),Oe.init(e,t)});Ql=T("ZodCIDRv4",(e,t)=>{ig.init(e,t),Oe.init(e,t)});Xl=T("ZodCIDRv6",(e,t)=>{ag.init(e,t),Oe.init(e,t)});ep=T("ZodBase64",(e,t)=>{cg.init(e,t),Oe.init(e,t)});tp=T("ZodBase64URL",(e,t)=>{ug.init(e,t),Oe.init(e,t)});rp=T("ZodE164",(e,t)=>{lg.init(e,t),Oe.init(e,t)});Ky=T("ZodCreditCard",(e,t)=>{pg.init(e,t),Oe.init(e,t)});np=T("ZodJWT",(e,t)=>{dg.init(e,t),Oe.init(e,t)});jo=T("ZodCustomStringFormat",(e,t)=>{mg.init(e,t),Oe.init(e,t)});zo=T("ZodNumber",(e,t)=>{Vu.init(e,t),le.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Qh(e,n,s,o);let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null},{gt(e,t){return this.check(Er(e,t))},gte(e,t){return this.check(Wt(e,t))},min(e,t){return this.check(Wt(e,t))},lt(e,t){return this.check(kr(e,t))},lte(e,t){return this.check(Bt(e,t))},max(e,t){return this.check(Bt(e,t))},int(e){return this.check(Gl(e))},safe(e){return this.check(Gl(e))},positive(e){return this.check(Er(0,e))},nonnegative(e){return this.check(Wt(0,e))},negative(e){return this.check(kr(0,e))},nonpositive(e){return this.check(Bt(0,e))},multipleOf(e,t){return this.check(kn(e,t))},step(e,t){return this.check(kn(e,t))},finite(){return this}});ws=T("ZodNumberFormat",(e,t)=>{fg.init(e,t),zo.init(e,t)});Ho=T("ZodBoolean",(e,t)=>{ha.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Xh(e,r,n,s)});Vo=T("ZodBigInt",(e,t)=>{Bu.init(e,t),le.init(e,t),e._zod.processJSONSchema=(n,s,o)=>ey(e,n,s,o);let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null},{gte(e,t){return this.check(Wt(e,t))},min(e,t){return this.check(Wt(e,t))},gt(e,t){return this.check(Er(e,t))},lt(e,t){return this.check(kr(e,t))},lte(e,t){return this.check(Bt(e,t))},max(e,t){return this.check(Bt(e,t))},positive(e){return this.check(Er(BigInt(0),e))},negative(e){return this.check(kr(BigInt(0),e))},nonpositive(e){return this.check(Bt(BigInt(0),e))},nonnegative(e){return this.check(Wt(BigInt(0),e))},multipleOf(e,t){return this.check(kn(e,t))}});sp=T("ZodBigIntFormat",(e,t)=>{gg.init(e,t),Vo.init(e,t)});Xy=T("ZodSymbol",(e,t)=>{hg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ty(e,r,n,s)});eb=T("ZodUndefined",(e,t)=>{yg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ny(e,r,n,s)});tb=T("ZodNull",(e,t)=>{bg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ry(e,r,n,s)});nb=T("ZodAny",(e,t)=>{wg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>iy(e,r,n,s)});sb=T("ZodUnknown",(e,t)=>{_g.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ay(e,r,n,s)});ob=T("ZodNever",(e,t)=>{Rg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>oy(e,r,n,s)});ib=T("ZodVoid",(e,t)=>{Sg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>sy(e,r,n,s)});Fa=T("ZodDate",(e,t)=>{vg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(n,s,o)=>cy(e,n,s,o),e.min=(n,s)=>e.check(Wt(n,s)),e.max=(n,s)=>e.check(Bt(n,s));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});ab=T("ZodArray",(e,t)=>{bs(),kg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>_y(e,r,n,s),e.element=t.element},{min(e,t){return this.check(Jr(e,t))},nonempty(e){return this.check(Jr(1,e))},max(e,t){return this.check(fs(e,t))},length(e,t){return this.check(gs(e,t))},unwrap(){return this.element}});Ga=T("ZodObject",(e,t)=>{bs(),Eg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ry(e,r,n,s),Y.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return ip(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:hs()})},loose(){return this.clone({...this._zod.def,catchall:hs()})},strict(){return this.clone({...this._zod.def,catchall:op()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Y.extend(this,e)},safeExtend(e){return Y.safeExtend(this,e)},merge(e){return Y.merge(this,e)},pick(e){return Y.pick(this,e)},omit(e){return Y.omit(this,e)},partial(...e){return Y.partial(Ua,this,e[0])},exactPartial(...e){return Y.partial(cp,this,e[0],"exactPartial")},required(...e){return Y.required(up,this,e[0])}});Na=T("ZodUnion",(e,t)=>{ya.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ol(e,r,n,s),e.options=t.options});cb=T("ZodXor",(e,t)=>{Na.init(e,t),Pg.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ol(e,r,n,s),e.options=t.options});ub=T("ZodDiscriminatedUnion",(e,t)=>{Na.init(e,t),Tg.init(e,t)});lb=T("ZodIntersection",(e,t)=>{$g.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Sy(e,r,n,s)});db=T("ZodTuple",(e,t)=>{bs(),Wu.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>vy(e,r,n,s)},{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 Ua({type:"optional",innerType:t}))})}});Go=T("ZodRecord",(e,t)=>{bs(),Ag.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ky(e,r,n,s),e.keyType=t.keyType,e.valueType=t.valueType});gb=T("ZodMap",(e,t)=>{bs(),Og.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>by(e,r,n,s),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Pr(...r)),e.nonempty=r=>e.check(Pr(1,r)),e.max=(...r)=>e.check(En(...r)),e.size=(...r)=>e.check(ms(...r))});hb=T("ZodSet",(e,t)=>{bs(),xg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>wy(e,r,n,s),e.min=(...r)=>e.check(Pr(...r)),e.nonempty=r=>e.check(Pr(1,r)),e.max=(...r)=>e.check(En(...r)),e.size=(...r)=>e.check(ms(...r))});No=T("ZodEnum",(e,t)=>{Ig.init(e,t),le.init(e,t),e._zod.processJSONSchema=(n,s,o)=>uy(e,n,s,o),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,s)=>{let o={};for(let i of n)if(r.has(i))o[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new No({...t,checks:[],...Y.normalizeParams(s),entries:o})},e.exclude=(n,s)=>{let o={...t.entries};for(let i of n)if(r.has(i))delete o[i];else throw new Error(`Key ${i} not found in enum`);return new No({...t,checks:[],...Y.normalizeParams(s),entries:o})}});yb=T("ZodLiteral",(e,t)=>{Dg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ly(e,r,n,s),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]}})});bb=T("ZodFile",(e,t)=>{Lg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>my(e,r,n,s),e.min=(r,n)=>e.check(Pr(r,n)),e.max=(r,n)=>e.check(En(r,n)),e.mime=(r,n)=>e.check(Ao(Array.isArray(r)?r:[r],n))});wb=T("ZodTransform",(e,t)=>{bs(),Fg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>yy(e,r,n,s),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Sn(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(Y.issue(o,r.value,t));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Y.issue(i))}};let s=t.transform(r.value,r);return s instanceof Promise?s.then(o=>(r.value=o,r)):(r.value=s,r)}});Ua=T("ZodOptional",(e,t)=>{qu.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>xl(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});cp=T("ZodExactOptional",(e,t)=>{Mg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>xl(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});Rb=T("ZodNullable",(e,t)=>{Gg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ey(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});Sb=T("ZodDefault",(e,t)=>{Ng.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ty(e,r,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});kb=T("ZodPrefault",(e,t)=>{Ug.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>$y(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});up=T("ZodNonOptional",(e,t)=>{jg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Py(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});Cb=T("ZodSuccess",(e,t)=>{zg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>fy(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});Tb=T("ZodCatch",(e,t)=>{Hg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ay(e,r,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});Ab=T("ZodNaN",(e,t)=>{Vg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>py(e,r,n,s)});ja=T("ZodPipe",(e,t)=>{Zu.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Oy(e,r,n,s),e.in=t.in,e.out=t.out});za=T("ZodCodec",(e,t)=>{ja.init(e,t),ba.init(e,t)});Ob=T("ZodPreprocess",(e,t)=>{ja.init(e,t),Bg.init(e,t)}),xb=T("ZodReadonly",(e,t)=>{Wg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>xy(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});Db=T("ZodTemplateLiteral",(e,t)=>{qg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>dy(e,r,n,s)});Lb=T("ZodLazy",(e,t)=>{wa.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Dy(e,r,n,s),e.unwrap=()=>e._zod.def.getter()});Mb=T("ZodPromise",(e,t)=>{Jg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Iy(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});Gb=T("ZodFunction",(e,t)=>{Zg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>hy(e,r,n,s)});Ha=T("ZodCustom",(e,t)=>{Kg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>gy(e,r,n,s)});Gk=Vh,Nk=Bh;jk=(...e)=>Wh({Codec:za,Boolean:Ho,String:Uo},...e)});function ML(e){ze({customError:e})}function GL(){return ze().customError}var FL,jb,Vk=C(()=>{qt();FL={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"};jb||(jb={})});var Va={};ne(Va,{ZodISODate:()=>An,ZodISODateTime:()=>$n,ZodISODuration:()=>xn,ZodISOTime:()=>On,date:()=>UL,datetime:()=>NL,duration:()=>zL,time:()=>jL});function NL(e){return Ea($n,e)}function UL(e){return Pa(An,e)}function jL(e){return Ca(On,e)}function zL(e){return Ta(xn,e)}var lp=C(()=>{qt();In();In()});function VL(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function Bk(e,t){return e.map((r,n)=>n<t?r:r.optional())}function BL(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function WL(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let n=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let s=r[1]===void 0?void 0:BL(r[1]);if(!s||!t.defs[s])throw new Error(`Reference not found: ${e}`);return t.defs[s]}throw new Error(`Reference not found: ${e}`)}function qL(e,t){return V.transform(n=>n).check(n=>{let s=n.value;if(!(typeof s!="object"||s===null||Array.isArray(s)))for(let o of Object.getOwnPropertyNames(s)){let i=t.safeParse(o);i.success||n.issues.push({code:"invalid_key",origin:"record",issues:i.error.issues,input:o,path:[o],continue:!0})}}).pipe(e)}function Wk(e,t){if(e!==!1)return e===void 0||e===!0?V.any():Dt(e,t)}function qk(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return V.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 s=e.$ref;if(t.refs.has(s))return t.refs.get(s);if(t.processing.has(s))return V.lazy(()=>{if(!t.refs.has(s))throw new Error(`Circular reference not resolved: ${s}`);return t.refs.get(s)});t.processing.add(s);let o=WL(s,t),i=Dt(o,t);return t.refs.set(s,i),t.processing.delete(s),i}if(e.enum!==void 0){let s=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&s.length===1&&s[0]===null)return V.null();if(s.length===0)return V.never();if(s.length===1)return V.literal(s[0]);if(s.every(i=>typeof i=="string"))return V.enum(s);let o=s.map(i=>V.literal(i));return o.length<2?o[0]:V.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return V.literal(e.const);let r=e.type;if(Array.isArray(r)){let s=r.map(o=>{let i={...e,type:o};return qk(i,t)});return s.length===0?V.never():s.length===1?s[0]:V.union(s)}if(!r)return V.any();let n;switch(r){case"string":{let s=V.string();if(e.format){let o=e.format;o==="email"?s=s.check(V.email()):o==="uri"||o==="uri-reference"?s=s.check(V.url()):o==="uuid"||o==="guid"?s=s.check(V.uuid()):o==="date-time"?s=s.check(V.iso.datetime({offset:!0})):o==="date"?s=s.check(V.iso.date()):o==="time"?s=s.check(V.regex(ZL)):o==="duration"?s=s.check(V.iso.duration()):o==="hostname"?s=s.check(V.hostname()):o==="ipv4"?s=s.check(V.ipv4()):o==="ipv6"?s=s.check(V.ipv6()):o==="mac"?s=s.check(V.mac()):o==="cidr"?s=s.check(V.cidrv4()):o==="cidr-v6"?s=s.check(V.cidrv6()):o==="base64"?s=s.check(V.base64()):o==="base64url"?s=s.check(V.base64url()):o==="e164"?s=s.check(V.e164()):o==="credit_card"?s=s.check(V.creditCard()):o==="jwt"?s=s.check(V.jwt()):o==="emoji"?s=s.check(V.emoji()):o==="nanoid"?s=s.check(V.nanoid()):o==="cuid"?s=s.check(V.cuid()):o==="cuid2"?s=s.check(V.cuid2()):o==="ulid"?s=s.check(V.ulid()):o==="xid"?s=s.check(V.xid()):o==="ksuid"&&(s=s.check(V.ksuid()))}typeof e.minLength=="number"&&(s=s.min(e.minLength)),typeof e.maxLength=="number"&&(s=s.max(e.maxLength)),e.pattern&&(s=s.regex(new RegExp(e.pattern))),n=s;break}case"number":case"integer":{let s=r==="integer"?V.number().int():V.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(s=s.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(s=s.max(e.maximum)),typeof e.exclusiveMinimum=="number"?s=s.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(s=s.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?s=s.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(s=s.lt(e.maximum)),typeof e.multipleOf=="number"&&(s=s.multipleOf(e.multipleOf)),n=s;break}case"boolean":{n=V.boolean();break}case"null":{n=V.null();break}case"object":{let s={},o=e.properties||{},i=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?Dt(e.additionalProperties,t):void 0;for(let[c,l]of Object.entries(o)){let p=Dt(l,t);je(s,c,i.has(c)?p:p.optional())}if(e.patternProperties){let c=e.patternProperties,l=Object.keys(c),p=[];for(let m of l){let f=Dt(c[m],t),g=V.string().regex(new RegExp(m));p.push(V.looseRecord(g,f))}let d=[];if(Object.keys(s).length>0&&d.push(V.object(s).passthrough()),d.push(...p),d.length===0)n=V.object({}).passthrough();else if(d.length===1)n=d[0];else{let m=V.intersection(d[0],d[1]);for(let f=2;f<d.length;f++)m=V.intersection(m,d[f]);n=m}if(e.additionalProperties===!1){let m=Object.keys(s),f=l.map(h=>new RegExp(h)),g=n;n=n.check(h=>{if(!rr(h.value))return;let w=[];for(let v of Object.keys(h.value))m.includes(v)||f.some(R=>R.test(v))||w.push(v);w.length&&h.issues.push({code:"unrecognized_keys",keys:w,input:h.value,inst:g})})}}else{let c=V.object(s);e.additionalProperties===!1?n=c.strict():a?n=c.catchall(a):n=c.passthrough()}if(e.propertyNames!==void 0&&e.propertyNames!==!0){let c=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;n=qL(n,Dt(c,t))}break}case"array":{let s=e.prefixItems,o=e.items;if(s&&Array.isArray(s)){let i=typeof e.minItems=="number"?e.minItems:0,a=s.map(d=>Dt(d,t)),c=Bk(a,i),l=Array.isArray(o)?void 0:Wk(o,t),p=V.tuple(c);n=l?p.rest(l):p,typeof e.minItems=="number"&&(n=n.check(V.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(V.maxLength(e.maxItems)))}else if(Array.isArray(o)){let i=typeof e.minItems=="number"?e.minItems:0,a=o.map(d=>Dt(d,t)),c=Bk(a,i),l=Wk(e.additionalItems,t),p=V.tuple(c);n=l?p.rest(l):p,typeof e.minItems=="number"&&(n=n.check(V.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(V.maxLength(e.maxItems)))}else if(o!==void 0){let i=Dt(o,t),a=V.array(i);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),n=a}else n=V.array(V.any());break}default:throw new Error(`Unsupported type: ${r}`)}return n}function Dt(e,t){if(typeof e=="boolean")return e?V.any():V.never();let r=qk(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(l=>Dt(l,t)),c=V.union(a);r=n?V.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(l=>Dt(l,t)),c=V.xor(a);r=n?V.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:V.any();else{let a=n?r:Dt(e.allOf[0],t),c=n?0:1;for(let l=c;l<e.allOf.length;l++)a=V.intersection(a,Dt(e.allOf[l],t));r=a}e.nullable===!0&&t.version==="openapi-3.0"&&(r=V.nullable(r)),e.readOnly===!0&&(r=V.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let s={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of o)a in e&&(s[a]=e[a]);let i=["contentEncoding","contentMediaType","contentSchema"];for(let a of i)a in e&&(s[a]=e[a]);e.propertyNames!==void 0&&e.type==="object"&&e.$ref===void 0&&(s.propertyNames=e.propertyNames);for(let a of Object.keys(e))HL.has(a)||je(s,a,e[a]);return Object.keys(s).length>0&&t.registry.add(r,s),e.description&&(r=r.describe(e.description)),r}function Zk(e,t){if(typeof e=="boolean")return e?V.any():V.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=VL(r,t?.defaultTarget),s=r.$defs||r.definitions||{},o={version:n,defs:s,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??ct};return Dt(r,o)}var V,HL,ZL,Jk=C(()=>{va();Je();Fl();lp();In();V={...Wo,...Ll,iso:Va},HL=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"]);ZL=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/});function Ba(e,t){let r=typeof t=="function"?t:(i,a)=>{let c=t[i._zod.def.type];return c?c(i,a):i},n=new Map;function s(i){let a=n.get(i);if(a===Kk)return new wa({type:"lazy",getter:()=>n.get(i)});if(a!==void 0)return a;n.set(i,Kk);let c=o(i),l=r(c,c!==i);return n.set(i,l),l}function o(i){let a=i._zod.def,c=a.type;switch(c){case"object":{let l=a.shape,p=Object.keys(l),d=!1,m={};for(let g of p){let h=s(l[g]);h!==l[g]&&(d=!0),m[g]=h}let f=a.catchall;return a.catchall&&(f=s(a.catchall),f!==a.catchall&&(d=!0)),d?Pe(i,{...a,shape:m,catchall:f}):i}case"array":{let l=s(a.element);return l===a.element?i:Pe(i,{...a,element:l})}case"tuple":{let l=a.items,p=!1,d=[];for(let f of l){let g=s(f);g!==f&&(p=!0),d.push(g)}let m=a.rest;return a.rest&&(m=s(a.rest),m!==a.rest&&(p=!0)),p?Pe(i,{...a,items:d,rest:m}):i}case"record":case"map":{let l=s(a.keyType),p=s(a.valueType);return l===a.keyType&&p===a.valueType?i:Pe(i,{...a,keyType:l,valueType:p})}case"set":{let l=s(a.valueType);return l===a.valueType?i:Pe(i,{...a,valueType:l})}case"union":{let l=a.options,p=!1,d=[];for(let m of l){let f=s(m);f!==m&&(p=!0),d.push(f)}return p?Pe(i,{...a,options:d}):i}case"intersection":{let l=s(a.left),p=s(a.right);return l===a.left&&p===a.right?i:Pe(i,{...a,left:l,right:p})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let l=s(a.innerType);return l===a.innerType?i:Pe(i,{...a,innerType:l})}case"pipe":{let l=s(a.in),p=s(a.out);return l===a.in&&p===a.out?i:Pe(i,{...a,in:l,out:p})}case"function":{let l=s(a.input),p=s(a.output);return l===a.input&&p===a.output?i:Pe(i,{...a,input:l,output:p})}case"lazy":{let l=a.getter,{_cachedInner:p,...d}=a;return Pe(i,{...d,getter:()=>s(l())})}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 i;default:return i}}return s(e)}var Kk,zb=C(()=>{_a();Je();Kk=Symbol("z.visit/resolving")});function Yk(e){return Ba(e,{object:t=>t.partial(),union:t=>{let r=t._zod.def;return r.discriminator===void 0?t:Bo(r.options)}})}var Qk=C(()=>{zb();In()});function JL(e,t){if(!t?.length)return e;let r=e._zod.def;return Pe(e,lr(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function Xk(e){return JL(e.out,e.checks)}function KL(e){return e.in._zod.traits.has("$ZodTransform")?Xk(e):e.in}function eE(e){return Ba(e,{pipe:t=>KL(t._zod.def),default:(t,r)=>r?ys(t._zod.def.innerType):t,catch:(t,r)=>r?t._zod.def.innerType:t})}function tE(e){return Ba(e,{pipe:t=>Xk(t._zod.def),prefault:(t,r)=>r?t._zod.def.innerType:t})}var rE=C(()=>{Je();zb();In()});var Hb={};ne(Hb,{bigint:()=>eF,boolean:()=>XL,date:()=>tF,number:()=>QL,string:()=>YL});function YL(e){return dh(Uo,e)}function QL(e){return yh(zo,e)}function XL(e){return kh(Ho,e)}function eF(e){return Ph(Vo,e)}function tF(e){return Mh(Fa,e)}var nE=C(()=>{qt();In()});var u={};ne(u,{$brand:()=>$m,$input:()=>oh,$output:()=>sh,NEVER:()=>Tm,TimePrecision:()=>gh,ZodAny:()=>nb,ZodArray:()=>ab,ZodBase64:()=>ep,ZodBase64URL:()=>tp,ZodBigInt:()=>Vo,ZodBigIntFormat:()=>sp,ZodBoolean:()=>Ho,ZodCIDRv4:()=>Ql,ZodCIDRv6:()=>Xl,ZodCUID:()=>Bl,ZodCUID2:()=>Wl,ZodCatch:()=>Tb,ZodCodec:()=>za,ZodCompileAsyncError:()=>pr,ZodCompileUnsupportedError:()=>ye,ZodCreditCard:()=>Ky,ZodCustom:()=>Ha,ZodCustomStringFormat:()=>jo,ZodDate:()=>Fa,ZodDefault:()=>Sb,ZodDiscriminatedUnion:()=>ub,ZodE164:()=>rp,ZodEmail:()=>jl,ZodEmoji:()=>Hl,ZodEnum:()=>No,ZodError:()=>IL,ZodExactOptional:()=>cp,ZodFile:()=>bb,ZodFirstPartyTypeKind:()=>jb,ZodFunction:()=>Gb,ZodGUID:()=>zl,ZodIPv4:()=>Kl,ZodIPv6:()=>Yl,ZodISODate:()=>An,ZodISODateTime:()=>$n,ZodISODuration:()=>xn,ZodISOTime:()=>On,ZodIntersection:()=>lb,ZodIssueCode:()=>FL,ZodJWT:()=>np,ZodKSUID:()=>Jl,ZodLazy:()=>Lb,ZodLiteral:()=>yb,ZodMAC:()=>Jy,ZodMap:()=>gb,ZodNaN:()=>Ab,ZodNanoID:()=>Vl,ZodNever:()=>ob,ZodNonOptional:()=>up,ZodNull:()=>tb,ZodNullable:()=>Rb,ZodNumber:()=>zo,ZodNumberFormat:()=>ws,ZodObject:()=>Ga,ZodOptional:()=>Ua,ZodPipe:()=>ja,ZodPrefault:()=>kb,ZodPreprocess:()=>Ob,ZodPromise:()=>Mb,ZodReadonly:()=>xb,ZodRealError:()=>It,ZodRecord:()=>Go,ZodSet:()=>hb,ZodString:()=>Uo,ZodStringFormat:()=>Oe,ZodSuccess:()=>Cb,ZodSymbol:()=>Xy,ZodTemplateLiteral:()=>Db,ZodTransform:()=>wb,ZodTuple:()=>db,ZodType:()=>le,ZodULID:()=>ql,ZodURL:()=>La,ZodUUID:()=>Cr,ZodUndefined:()=>eb,ZodUnion:()=>Na,ZodUnknown:()=>sb,ZodVoid:()=>ib,ZodXID:()=>Zl,ZodXor:()=>cb,_ZodString:()=>Ul,_default:()=>vb,_function:()=>Lk,any:()=>dk,array:()=>Ma,base64:()=>Zv,base64url:()=>Jv,bigint:()=>ak,boolean:()=>Qy,catch:()=>$b,check:()=>Fk,cidrv4:()=>Wv,cidrv6:()=>qv,clone:()=>Pe,codec:()=>Ok,coerce:()=>Hb,compile:()=>uh,config:()=>ze,core:()=>Kr,creditCard:()=>Yv,cuid:()=>Gv,cuid2:()=>Nv,custom:()=>Mk,date:()=>fk,decode:()=>jy,decodeAsync:()=>Hy,deepPartial:()=>Yk,describe:()=>Gk,discriminatedUnion:()=>_k,e164:()=>Kv,email:()=>Tv,emoji:()=>Fv,encode:()=>Uy,encodeAsync:()=>zy,endsWith:()=>$o,enum:()=>ip,exactOptional:()=>_b,file:()=>Ck,flattenError:()=>ua,float32:()=>nk,float64:()=>sk,formatError:()=>la,fromJSONSchema:()=>Zk,function:()=>Lk,getDiscriminatedOption:()=>Cg,getErrorMap:()=>GL,globalRegistry:()=>ct,gt:()=>Er,gte:()=>Wt,guid:()=>$v,hash:()=>rk,hex:()=>tk,hostname:()=>ek,httpUrl:()=>Lv,includes:()=>Co,input:()=>eE,instanceof:()=>Uk,int:()=>Gl,int32:()=>ok,int64:()=>ck,intersection:()=>pb,invertCodec:()=>xk,ipv4:()=>Hv,ipv6:()=>Bv,iso:()=>Va,json:()=>zk,jwt:()=>Qv,keyof:()=>gk,ksuid:()=>zv,lazy:()=>Fb,length:()=>gs,literal:()=>Pk,locales:()=>Sa,looseObject:()=>bk,looseRecord:()=>Sk,lowercase:()=>Eo,lt:()=>kr,lte:()=>Bt,mac:()=>Vv,map:()=>vk,maxLength:()=>fs,maxSize:()=>En,memoizer:()=>Ra,meta:()=>Nk,mime:()=>Ao,minLength:()=>Jr,minSize:()=>Pr,multipleOf:()=>kn,nan:()=>Ak,nanoid:()=>Mv,nativeEnum:()=>Ek,negative:()=>El,never:()=>op,nonnegative:()=>Cl,nonoptional:()=>Pb,nonpositive:()=>Pl,normalize:()=>Oo,null:()=>rb,nullable:()=>Da,nullish:()=>Tk,number:()=>Yy,object:()=>hk,optional:()=>ys,output:()=>tE,overwrite:()=>dr,parse:()=>Fy,parseAsync:()=>My,partialRecord:()=>Rk,pipe:()=>Nl,positive:()=>kl,prefault:()=>Eb,preprocess:()=>Hk,prettifyError:()=>Dm,promise:()=>Dk,properties:()=>$l,property:()=>Tl,readonly:()=>Ib,record:()=>fb,refine:()=>Nb,regex:()=>ko,regexes:()=>bt,registry:()=>tl,safeDecode:()=>By,safeDecodeAsync:()=>qy,safeEncode:()=>Vy,safeEncodeAsync:()=>Wy,safeParse:()=>Gy,safeParseAsync:()=>Ny,set:()=>kk,setErrorMap:()=>ML,size:()=>ms,slugify:()=>Lo,startsWith:()=>To,strictObject:()=>yk,string:()=>Ia,stringFormat:()=>Xv,stringbool:()=>jk,success:()=>$k,superRefine:()=>Ub,symbol:()=>lk,templateLiteral:()=>Ik,toJSONSchema:()=>Il,toLowerCase:()=>Io,toUpperCase:()=>Do,toZod:()=>ea,transform:()=>ap,treeifyError:()=>Im,trim:()=>xo,tuple:()=>mb,uint32:()=>ik,uint64:()=>uk,ulid:()=>Uv,undefined:()=>pk,union:()=>Bo,unknown:()=>hs,uppercase:()=>Po,url:()=>Dv,util:()=>Y,uuid:()=>Av,uuidv4:()=>Ov,uuidv6:()=>xv,uuidv7:()=>Iv,validate:()=>Gm,validateAsync:()=>Nm,void:()=>mk,xid:()=>jv,xor:()=>wk});var Vb=C(()=>{qt();In();Fl();Ly();Zy();Vk();qt();xa();Jk();Qk();rE();nh();lp();lp();nE()});var Wa=C(()=>{Vb();Vb()});var rF,Wb,qb,Zb,Jb,nF,sF,oF,iF,aF,cF,uF,lF,pF,dF,sE,mF,pp,fF,gF,hF,yF,bF,Bb,wF,_F,RF,SF,Kb,Yb,Lt,Dn=C(()=>{"use strict";Wa();rF=u.enum(["candidate","claimed","in_progress","pr_submitted"]),Wb=u.enum(["needs_addressing","waiting_on_maintainer"]),qb=u.enum(["nonprofit","devtools","infrastructure","web-frameworks","data-ml","education"]),Zb=u.enum(["beginner","intermediate","advanced"]),Jb=u.enum(["inline","sourcetree","vscode","custom"]),nF=u.object({hasActiveMaintainers:u.boolean(),isResponsive:u.boolean(),hasHostileComments:u.boolean()}),sF=u.object({repo:u.string(),score:u.number(),mergedPRCount:u.number(),closedWithoutMergeCount:u.number(),avgResponseDays:u.number().nullable(),lastMergedAt:u.string().optional(),lastEvaluatedAt:u.string(),signals:nF,stargazersCount:u.number().optional(),language:u.string().nullable().optional()}),oF=u.object({url:u.string(),title:u.string(),mergedAt:u.string(),openedAt:u.string().optional(),firstMaintainerResponseAt:u.string().optional(),commentsFetchedAt:u.string().datetime().optional(),learningsExtractedAt:u.string().datetime().optional()}),iF=u.object({url:u.string(),title:u.string(),closedAt:u.string(),openedAt:u.string().optional(),firstMaintainerResponseAt:u.string().optional(),commentsFetchedAt:u.string().datetime().optional(),learningsExtractedAt:u.string().datetime().optional()}),aF=u.object({url:u.string(),repo:u.string(),analyzedAt:u.string()}),cF=u.object({tier:u.enum(["light_check_in","direct_check_in","final_check_in"]),timestamp:u.string().datetime(),draftPath:u.string().optional()}),uF=u.object({workflowName:u.enum(["draft-first","work-through-issues","pre-commit-review"]),currentStep:u.string(),branchName:u.string().optional(),issueContext:u.object({title:u.string(),url:u.string()}).optional(),completedSteps:u.array(u.string()).default([]),stepData:u.record(u.string(),u.unknown()).default({}),lastUpdatedAt:u.string().datetime()}),lF=u.object({branchNamingConvention:u.string().optional(),commitMessageFormat:u.string().optional(),prTitleFormat:u.string().optional(),requiredChecks:u.array(u.string()).optional(),testFramework:u.string().optional(),testCoverageRequired:u.boolean().optional(),testFileNaming:u.string().optional(),linter:u.string().optional(),formatter:u.string().optional(),styleGuideUrl:u.string().optional(),issueClaimProcess:u.string().optional(),reviewProcess:u.string().optional(),claRequired:u.boolean().optional(),rawContent:u.string().optional()}),pF=u.object({passedAllChecks:u.boolean(),checks:u.object({noExistingPR:u.boolean(),notClaimed:u.boolean(),projectActive:u.boolean(),clearRequirements:u.boolean(),contributionGuidelinesFound:u.boolean()}),contributionGuidelines:lF.optional(),notes:u.array(u.string())}),dF=u.object({id:u.number(),url:u.string(),repo:u.string(),number:u.number(),title:u.string(),status:rF,labels:u.array(u.string()),createdAt:u.string(),updatedAt:u.string(),vetted:u.boolean(),vettingResult:pF.optional()}),sE=u.object({number:u.number(),url:u.string(),title:u.string(),repo:u.string(),daysSinceActivity:u.number(),status:Wb}),mF=u.object({status:Wb,setAt:u.string(),lastActivityAt:u.string()}),pp=u.object({setupComplete:u.boolean().default(!1),setupCompletedAt:u.string().optional(),persistence:u.enum(["local","gist"]).default("local"),maxActivePRs:u.number().default(10),dormantThresholdDays:u.number().default(30),approachingDormantDays:u.number().default(25),maxIssueAgeDays:u.number().default(90),skipBroadWhenSufficientResults:u.number().min(0).default(8),languages:u.array(u.string()).default(["typescript","javascript"]),labels:u.array(u.string()).default(["good first issue","help wanted"]),scope:u.array(Zb).optional(),excludeRepos:u.array(u.string()).default([]),excludeOrgs:u.array(u.string()).optional(),avoidRepos:u.array(u.string()).default([]),boostIssueTypes:u.array(u.string()).default([]),trustedProjects:u.array(u.string()).default([]),githubUsername:u.string().default(""),minRepoScoreThreshold:u.number().default(4),starredRepos:u.array(u.string()).default([]),starredReposLastFetched:u.string().optional(),squashByDefault:u.union([u.boolean(),u.literal("ask")]).default(!0),localRepoScanPaths:u.array(u.string()).optional(),minStars:u.number().default(50),includeDocIssues:u.boolean().default(!0),aiPolicyBlocklist:u.array(u.string()).default(["matplotlib/matplotlib"]),shelvedPRUrls:u.array(u.string()).default([]),dismissedIssues:u.record(u.string(),u.string()).default({}),statusOverrides:u.record(u.string(),mF).optional(),issueListPath:u.string().optional(),skippedIssuesPath:u.string().optional(),projectCategories:u.array(qb).default([]),preferredOrgs:u.array(u.string()).default([]),diffTool:Jb.default("inline"),diffToolCustomCommand:u.string().optional(),autoExtractLearnings:u.boolean().default(!0),autoFormatBeforePush:u.boolean().default(!1),trustOwnRepoWrites:u.boolean().default(!1),healthCheckFreshnessMinutes:u.number().int().positive().default(30),reviewMaxPasses:u.number().int().positive().optional(),slmTriageModel:u.string().default(""),slmTriageHost:u.string().default("")}),fF=u.object({repos:u.record(u.string(),u.object({path:u.string(),exists:u.boolean(),currentBranch:u.string().nullable()})),scanPaths:u.array(u.string()),cachedAt:u.string()}),gF=u.object({url:u.string(),repo:u.string(),number:u.number(),title:u.string(),closedAt:u.string(),closedBy:u.string().optional(),openedAt:u.string().optional()}),hF=u.object({url:u.string(),repo:u.string(),number:u.number(),title:u.string(),mergedAt:u.string(),openedAt:u.string().optional()}),yF=u.object({totalActivePRs:u.number(),totalNeedingAttention:u.number(),totalMergedAllTime:u.number(),mergeRate:u.number()}),bF=u.object({url:u.string(),repo:u.string(),number:u.number(),status:Wb}).passthrough(),Bb=u.array(bF),wF=u.object({generatedAt:u.string(),openPRs:Bb,needsAddressingPRs:Bb,waitingOnMaintainerPRs:Bb,recentlyClosedPRs:u.array(gF),recentlyMergedPRs:u.array(hF),shelvedPRs:u.array(sE),autoUnshelvedPRs:u.array(sE),summary:yF}),_F=u.object({url:u.string(),lastSeenAt:u.string()}),RF=u.object({url:u.string(),branch:u.string(),worktree:u.string().optional(),note:u.string().optional(),recordedAt:u.string(),pushedRef:u.string().optional(),pushedAt:u.string().optional(),compareUrl:u.string().optional(),pushProblem:u.string().optional()}),SF=u.object({url:u.string(),attemptedAt:u.string(),outcome:u.enum(["prepared","blocked"]),note:u.string().optional()}),Kb=u.object({runAt:u.string(),reportPath:u.string(),prepareCount:u.number().int().nonnegative(),judgmentCount:u.number().int().nonnegative(),prepared:u.array(RF).default([]),implementUrl:u.string().optional(),implementAttempts:u.array(SF).optional()}),Yb=u.object({languageOffset:u.number().int().nonnegative().default(0),phase0Offset:u.number().int().nonnegative().default(0),starredOffset:u.number().int().nonnegative().default(0),maintainedOffset:u.number().int().nonnegative().default(0),strategyOffset:u.number().int().nonnegative().default(0),lastRotatedAt:u.string().optional()}),Lt=u.object({version:u.literal(4),gistId:u.string().optional(),repoScores:u.record(u.string(),sF).default({}),config:pp.default(()=>pp.parse({})),lastRunAt:u.string().default(()=>new Date().toISOString()),lastDigestAt:u.string().optional(),lastStrategyAt:u.string().optional(),lastDigest:wF.optional(),monthlyMergedCounts:u.record(u.string(),u.number()).optional(),monthlyClosedCounts:u.record(u.string(),u.number()).optional(),monthlyOpenedCounts:u.record(u.string(),u.number()).optional(),localRepoCache:fF.optional(),mergedPRs:u.array(oF).optional(),closedPRs:u.array(iF).optional(),analyzedIssueConversations:u.array(aF).optional(),activeIssues:u.array(dF).default([]),prFollowUpHistory:u.record(u.string(),u.array(cF)).optional(),workflowState:uF.optional(),searchSeen:u.array(_F).default([]),lastOvernight:Kb.optional(),searchRotation:Yb.optional()})});function sr(){let e=Ft.join(Qb.homedir(),".oss-autopilot");return Rt.existsSync(e)||Rt.mkdirSync(e,{recursive:!0,mode:448}),e}function St(){return Ft.join(sr(),"state.json")}function oE(){return Ft.join(process.cwd(),"data","state.json")}function iE(){return Ft.join(process.cwd(),"data","backups")}function _s(){let e=Ft.join(sr(),"backups");return Rt.existsSync(e)||Rt.mkdirSync(e,{recursive:!0,mode:448}),e}function dp(){let e=Ft.join(sr(),"cache");return Rt.existsSync(e)||Rt.mkdirSync(e,{recursive:!0,mode:448}),e}function qo(){let e=Ft.join(sr(),"reports");return Rt.existsSync(e)||Rt.mkdirSync(e,{recursive:!0,mode:448}),e}function Rs(){return Ft.join(sr(),"gist-id")}function Ln(){return Ft.join(sr(),"state-cache.json")}function mp(){let e=Ft.join(Qb.homedir(),".oss-autopilot","state.json");return Rt.existsSync(e)}function Tr(){return"3.29.1"}var Rt,Ft,Qb,Yr=C(()=>{"use strict";Rt=H(require("node:fs"),1),Ft=H(require("node:path"),1),Qb=H(require("node:os"),1)});function gp(){fp=!0}function aE(){return fp}function I(e,t,...r){if(!fp)return;let n=new Date().toISOString();console.error(`[${n}] [DEBUG] [${e}] ${t}`,...r)}function cE(e,t,...r){let n=new Date().toISOString();console.error(`[${n}] [INFO] [${e}] ${t}`,...r)}function _(e,t,...r){let n=new Date().toISOString();console.error(`[${n}] [WARN] [${e}] ${t}`,...r)}async function hp(e,t,r){if(!fp)return r();let n=performance.now();try{let s=await r(),o=(performance.now()-n).toFixed(0);return I(e,`${t} completed in ${o}ms`),s}catch(s){let o=(performance.now()-n).toFixed(0);throw I(e,`${t} failed after ${o}ms`),s}}var fp,de=C(()=>{"use strict";fp=!1});function Za(e){if(process.env[yp]!==void 0)throw new Ge(`Refusing to ${e} during an unattended run (${yp} is set). Run it yourself in an interactive session.`)}function A(e){return e instanceof Error?e.message:String(e)}function Ye(e){if(e&&typeof e=="object"&&"status"in e){let t=e.status;return typeof t=="number"&&Number.isFinite(t)?t:void 0}}function Mt(e){let t=Ye(e);return t===429?!0:t===403?A(e).toLowerCase().includes("rate limit"):!1}function uE(e){if(Ye(e)!==422)return!1;let t=e?.response?.data,r=t&&typeof t=="object"?t.errors:void 0;return Array.isArray(r)?r.some(n=>{if(!n||typeof n!="object")return!1;let s=n;return s.resource!=="Search"||s.code!=="invalid"?!1:typeof s.message=="string"?Xb.test(s.message):Xb.test(A(e))}):Xb.test(A(e))}function Le(e){let t=Ye(e);if(t===401||t===429)return!0;if(t===403){let r=A(e).toLowerCase();return r.includes("rate limit")||r.includes("abuse detection")}return!1}function lE(e){if(!e||typeof e!="object")return!1;let t=Ye(e);if(typeof t=="number"&&t>=500&&t<600)return!0;let r=e.code;if(typeof r=="string"&&(r==="ECONNRESET"||r==="ETIMEDOUT"||r==="ENETUNREACH"||r==="ENOTFOUND"||r==="ECONNREFUSED"||r==="EAI_AGAIN"))return!0;let n=e.name;return typeof n=="string"&&(n==="AbortError"||n==="TimeoutError")}function pE(e){return t=>{if(Le(t))throw t;return _(e.module,`Failed to ${e.label}: ${A(t)}`),e.fallback}}function bp(e){if(e instanceof Ge)return"CONFIGURATION";if(e instanceof W)return"VALIDATION";if(e instanceof mr||e instanceof $r)return"CONCURRENCY";let t=Ye(e);if(t===401)return"AUTH_REQUIRED";if(t===403){let n=A(e).toLowerCase();return n.includes("rate limit")||n.includes("abuse detection")?"RATE_LIMITED":"AUTH_REQUIRED"}if(t===404)return"NOT_FOUND";if(t===429)return"RATE_LIMITED";let r=A(e).toLowerCase();return r.includes("enotfound")||r.includes("econnrefused")||r.includes("econnreset")||r.includes("etimedout")||r.includes("fetch failed")?"NETWORK":r.includes("state")&&(r.includes("corrupt")||r.includes("invalid"))?"STATE_CORRUPTED":"UNKNOWN"}var or,Ge,yp,W,Zo,qa,mr,$r,Xb,ie=C(()=>{"use strict";de();or=class extends Error{constructor(r,n){super(r);this.code=n;this.name="OssAutopilotError"}code},Ge=class extends or{constructor(t){super(t,"CONFIGURATION_ERROR"),this.name="ConfigurationError"}},yp="OSS_AUTOPILOT_UNATTENDED";W=class extends or{constructor(t){super(t,"VALIDATION_ERROR"),this.name="ValidationError"}},Zo=class extends Ge{constructor(t){super(t??'Your GitHub token does not have Gist permissions. Run `gh auth refresh -s gist` to add the required scope, or create a token with the "gist" scope.'),this.name="GistPermissionError"}},qa=class extends Ge{constructor(r,n,s){let o=s instanceof Error?s.message:String(s),i=n?`
58
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){o(i);continue}if(e.external){let l=e.external.registry.get(i[0])?.id;if(t!==i[0]&&l){o(i);continue}}if(e.metadataRegistry.get(i[0])?.id){o(i);continue}if(a.cycle){o(i);continue}if(a.count>1&&e.reused==="ref"){o(i);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function _v(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;_v(n);let s=Object.keys(n);if(s.length!==1||s[0]!=="type")return;let o=n.type;for(let i of Array.isArray(o)?o:[o]){if(typeof i!="string")return;r.includes(i)||r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}function wv(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function qh(e){let t=[];for(let o of e){if(typeof o!="object"||o.type!=="object")return null;for(let i in o)if(!Rv.has(i))return null;t.push(o)}let r={},n=new Set;for(let o of t){for(let i in o.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let l of t){let p=l.properties?.[i]??wv(l);p!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(p))||a.push(p))}let c=a.length===1?a[0]:qh(a)??{allOf:a};je(r,i,c)}for(let i of o.required??[])n.add(i)}let s={type:"object",properties:r};if(n.size&&(s.required=[...n]),t.every(o=>o.additionalProperties===!1))s.additionalProperties=!1;else{let o=[];for(let i of t){let a=wv(i);a&&!o.some(c=>JSON.stringify(c)===JSON.stringify(a))&&o.push(a)}o.length===1?s.additionalProperties=o[0]:o.length>1&&(s.additionalProperties={allOf:o})}return s}function $L(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let s of Rv)if(s in e)return;let r=t.filter(s=>bv.some(o=>Array.isArray(s[o]))),n=null;if(!r.length)n=qh(t);else{let s=r[0],o=bv.find(c=>Array.isArray(s[c]));if(Object.keys(s).length!==1)return;let i=t.filter(c=>c!==s),a=s[o].map(c=>qh([...i,c]));if(a.some(c=>!c))return;n={[o]:a}}n&&(delete e.allOf,$a(e,n))}function Tn(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,p={...l},d=c.ref;if(c.ref=null,d){n(d);let f=e.seen.get(d),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(g)):$a(l,g),$a(l,p),a._zod.parent===d)for(let w in l)w==="$ref"||w==="allOf"||w in p||delete l[w];if(g.$ref&&f.def)for(let w in l)w==="$ref"||w==="allOf"||w in f.def&&JSON.stringify(l[w])===JSON.stringify(f.def[w])&&delete l[w]}let m=a._zod.parent;if(m&&m!==d){n(m);let f=e.seen.get(m);if(f?.schema.$ref&&(l.$ref=f.schema.$ref,f.def))for(let g in l)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(l[g])===JSON.stringify(f.def[g])&&delete l[g]}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())_v(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 l of[c.schema,c.def]){let p=l?.allOf;if(!Array.isArray(p))continue;let d=a.get(p);d?d.push(l):a.set(p,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])$L(l)}}let s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$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");s.$id=e.external.uri(a)}$a(s,r.defId?r.schema:r.def??r.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&s.id===o&&delete s.id;let i=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(i,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?s.$defs=i:s.definitions=i);try{let a=JSON.parse(JSON.stringify(s));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Mo(t,"input",e.processors),output:Mo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function _t(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return _t(n.element,r);if(n.type==="set")return _t(n.valueType,r);if(n.type==="lazy")return _t(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return _t(n.innerType,r);if(n.type==="intersection")return _t(n.left,r)||_t(n.right,r);if(n.type==="record"||n.type==="map")return _t(n.keyType,r)||_t(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:_t(n.in,r)||_t(n.out,r);if(n.type==="object"){for(let s in n.shape)if(_t(n.shape[s],r))return!0;return!1}if(n.type==="union"){for(let s of n.options)if(_t(s,r))return!0;return!1}if(n.type==="tuple"){for(let s of n.items)if(_t(s,r))return!0;return!!(n.rest&&_t(n.rest,r))}return!1}var Rv,bv,Zh,Mo,Aa=C(()=>{va();Je();Rv=new Set(["type","properties","required","additionalProperties"]),bv=["oneOf","anyOf"];Zh=(e,t={})=>r=>{let n=Pn({...r,processors:t});return Ce(e,n),Cn(n,e),Tn(n,e)},Mo=(e,t,r={})=>n=>{let{libraryOptions:s,target:o}=n??{},i=Pn({...s??{},target:o,io:t,processors:r});return Ce(e,i),Cn(i,e),Tn(i,e)}});function Oa(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Oa(t.out):t.type==="catch"?Oa(t.innerType):e._zod.optin}function Jh(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let h=Jh(e,g,r);return h===g?t:h}for(let g of["anyOf","oneOf"]){let h=t[g];if(!Array.isArray(h))continue;let w=h.map(v=>Jh(e,v,r));w.some((v,R)=>v!==h[R])&&(t={...t,[g]:w})}let n=Array.isArray(t.type)?t.type:[t.type],s=!n.includes("string")&&n.some(g=>g==="number"||g==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!s&&!o?.some(g=>typeof g=="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:p,format:d,id:m,...f}=t;return f.enum?f.enum=f.enum.map(g=>typeof g=="number"?String(g):g):typeof f.const=="number"&&(f.const=String(f.const)),s&&(f.type="string",o||(f.pattern=(n.includes("number")?vn:pa).source)),f}function OL(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of Kh.get(e)??[]){let s=e.seen.get(n),o=(s?.def??s?.schema)?.propertyNames;if(!o||o===!0||r.has(o))continue;let i=Jh(t,o,new Set);i!==o&&r.set(o,i)}if(r.size)for(let n of e.seen.values())for(let s of[n.schema,n.def]){let o=s&&r.get(s.propertyNames);o&&(s.propertyNames=o)}}function Sv(e,t,r,n,s){let o=!1,i=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(o=!0,null));return o?(Ke(t,r,n,s,"BigInt defaults cannot be represented in JSON Schema"),Cy):JSON.parse(i)}function Il(e,t){if("_idmap"in e){let n=e,s=Pn({...t,processors:Al}),o={};for(let c of n._idmap.entries()){let[l,p]=c;Ce(p,s)}let i={},a={registry:n,uri:t?.uri,defs:o};s.external=a;for(let c of n._idmap.entries()){let[l,p]=c;Cn(s,p),je(i,l,Tn(s,p))}if(Object.keys(o).length>0){let c=s.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:o}}return{schemas:i}}let r=Pn({...t,processors:Al});return Ce(e,r),Cn(r,e),Tn(r,e)}var AL,Yh,Qh,Xh,ey,ty,ry,ny,sy,oy,iy,ay,cy,uy,ly,py,dy,my,fy,gy,hy,yy,by,wy,_y,Ry,Ol,Sy,vy,Kh,ky,Ey,Py,Cy,Ty,$y,Ay,Oy,xy,Iy,xl,Dy,Al,xa=C(()=>{Ro();Aa();Je();AL={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Yh=(e,t,r,n)=>{let s=r;s.type="string";let{minimum:o,maximum:i,format:a,patterns:c,contentEncoding:l,laxFormat:p}=e._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof i=="number"&&(s.maxLength=i),a&&(s.format=AL[a]??a,s.format===""&&delete s.format,(a==="time"||p)&&delete s.format),l&&(s.contentEncoding=l),c&&c.size>0){let d=[...c];d.length===1?s.pattern=d[0].source:d.length>1&&(s.allOf=[...d.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Qh=(e,t,r,n)=>{let s=r,{minimum:o,maximum:i,format:a,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:p}=e._zod.bag;typeof a=="string"&&a.includes("int")?s.type="integer":s.type="number";let d=typeof p=="number"&&p>=(o??Number.NEGATIVE_INFINITY),m=typeof l=="number"&&l<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";d?f?(s.minimum=p,s.exclusiveMinimum=!0):s.exclusiveMinimum=p:typeof o=="number"&&(s.minimum=o),m?f?(s.maximum=l,s.exclusiveMaximum=!0):s.exclusiveMaximum=l:typeof i=="number"&&(s.maximum=i),typeof c=="number"&&(Number.isFinite(c)&&c!==0?s.multipleOf=Math.abs(c):Ke(e,t,s,n,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))},Xh=(e,t,r,n)=>{r.type="boolean"},ey=(e,t,r,n)=>{Ke(e,t,r,n,"BigInt cannot be represented in JSON Schema")},ty=(e,t,r,n)=>{Ke(e,t,r,n,"Symbols cannot be represented in JSON Schema")},ry=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},ny=(e,t,r,n)=>{Ke(e,t,r,n,"Undefined cannot be represented in JSON Schema")},sy=(e,t,r,n)=>{Ke(e,t,r,n,"Void cannot be represented in JSON Schema")},oy=(e,t,r,n)=>{r.not={}},iy=(e,t,r,n)=>{},ay=(e,t,r,n)=>{},cy=(e,t,r,n)=>{Ke(e,t,r,n,"Date cannot be represented in JSON Schema")},uy=(e,t,r,n)=>{let s=e._zod.def,o=ta(s.entries);if(o.length===0){r.not={};return}o.every(i=>typeof i=="number")&&(r.type="number"),o.every(i=>typeof i=="string")&&(r.type="string"),r.enum=o},ly=(e,t,r,n)=>{let s=e._zod.def;if(s.values.length===0){r.not={};return}let o=[];for(let i of s.values)if(i===void 0){if(Ke(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(Ke(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(i))}else o.push(i);if(o.length!==0)if(o.length===1){let i=o[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else o.every(i=>typeof i=="number")&&(r.type="number"),o.every(i=>typeof i=="string")&&(r.type="string"),o.every(i=>typeof i=="boolean")&&(r.type="boolean"),o.every(i=>i===null)&&(r.type="null"),r.enum=o},py=(e,t,r,n)=>{Ke(e,t,r,n,"NaN cannot be represented in JSON Schema")},dy=(e,t,r,n)=>{let s=r,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");s.type="string",s.pattern=o.source},my=(e,t,r,n)=>{let s=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:c}=e._zod.bag;i!==void 0&&(o.minLength=i),a!==void 0&&(o.maxLength=a),c?c.length===1?(o.contentMediaType=c[0],Object.assign(s,o)):(Object.assign(s,o),s.anyOf=c.map(l=>({contentMediaType:l}))):Object.assign(s,o)},fy=(e,t,r,n)=>{r.type="boolean"},gy=(e,t,r,n)=>{Ke(e,t,r,n,"Custom types cannot be represented in JSON Schema")},hy=(e,t,r,n)=>{Ke(e,t,r,n,"Function types cannot be represented in JSON Schema")},yy=(e,t,r,n)=>{Ke(e,t,r,n,"Transforms cannot be represented in JSON Schema")},by=(e,t,r,n)=>{Ke(e,t,r,n,"Map cannot be represented in JSON Schema")},wy=(e,t,r,n)=>{Ke(e,t,r,n,"Set cannot be represented in JSON Schema")},_y=(e,t,r,n)=>{let s=r,o=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(s.minItems=i),typeof a=="number"&&(s.maxItems=a),s.type="array",s.items=Ce(o.element,t,{...n,path:[...n.path,"items"]})};Ry=(e,t,r,n)=>{let s=r,o=e._zod.def,i=o.shape;if(Object.getOwnPropertySymbols(i).length&&Ke(e,t,s,n,"Symbol keys cannot be represented in JSON Schema"))return;s.type="object",s.properties={};for(let p in i)je(s.properties,p,Ce(i[p],t,{...n,path:[...n.path,"properties",p]}));let c=new Set(Object.keys(i)),l=new Set([...c].filter(p=>{let d=o.shape[p];return t.io==="input"?Oa(d)===void 0:d._zod.optout===void 0}));l.size>0&&(s.required=Array.from(l)),o.catchall?._zod.def.type==="never"?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=Ce(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},Ol=(e,t,r,n)=>{let s=e._zod.def,o=s.inclusive===!1,i=s.options.map((a,c)=>Ce(a,t,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=i:r.anyOf=i},Sy=(e,t,r,n)=>{let s=e._zod.def,o=Ce(s.left,t,{...n,path:[...n.path,"allOf",0]}),i=Ce(s.right,t,{...n,path:[...n.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(o)?o.allOf:[o],...a(i)?i.allOf:[i]];r.allOf=c,t.intersections.push(c)},vy=(e,t,r,n)=>{let s=r,o=e._zod.def;s.type="array";let i=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,w)=>Ce(h,t,{...n,path:[...n.path,i,w]})),l=o.rest?Ce(o.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,p=o.items.length;for(;p>0;){let h=o.items[p-1];if(!(t.io==="input"?Oa(h)!==void 0:h._zod.optout==="optional"))break;p--}let d=o.items.length,m=!o.rest;t.target==="draft-2020-12"?(s.prefixItems=c,m?s.items=!1:l&&(s.items=l),p>0&&(s.minItems=p),m&&(s.maxItems=d)):t.target==="openapi-3.0"?(s.items={anyOf:c},l&&s.items.anyOf.push(l),p>0&&(s.minItems=p),m&&(s.maxItems=d)):(s.items=c,m?s.additionalItems=!1:l&&(s.additionalItems=l),p>0&&(s.minItems=p),m&&(s.maxItems=d));let{minimum:f,maximum:g}=e._zod.bag;typeof f=="number"&&(s.minItems=f),typeof g=="number"&&(s.maxItems=g)};Kh=new WeakMap;ky=(e,t,r,n)=>{let s=r,o=e._zod.def;s.type="object";let i=o.keyType,c=i._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){let d=Ce(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});s.patternProperties={};for(let m of c)je(s.patternProperties,m.source,d)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){s.propertyNames=Ce(o.keyType,t,{...n,path:[...n.path,"propertyNames"]});let d=Kh.get(t);d||(d=[],Kh.set(t,d),t.deferred.push(()=>OL(t))),d.push(e)}s.additionalProperties=Ce(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let l=i._zod.values,p=t.io==="input"&&Oa(o.valueType)!==void 0;if(l&&!o.partial&&!p){let d=[...l].filter(m=>typeof m=="string"||typeof m=="number");d.length>0&&(s.required=d.map(String))}},Ey=(e,t,r,n)=>{let s=e._zod.def,o=Ce(s.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=s.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},Py=(e,t,r,n)=>{let s=e._zod.def;Ce(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType},Cy=Symbol();Ty=(e,t,r,n)=>{let s=e._zod.def;Ce(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType;let i=Sv(s.defaultValue,e,t,r,n);i!==Cy&&(r.default=i)},$y=(e,t,r,n)=>{let s=e._zod.def;Ce(s.innerType,t,n);let o=t.seen.get(e);if(o.ref=s.innerType,t.io!=="input")return;let i=Sv(s.defaultValue,e,t,r,n);i!==Cy&&(r._prefault=i)},Ay=(e,t,r,n)=>{let s=e._zod.def;Ce(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType;let i;try{i=s.catchValue(void 0)}catch{Ke(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},Oy=(e,t,r,n)=>{let s=e._zod.def,o=s.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?o?s.out:s.in:s.out;Ce(i,t,n);let a=t.seen.get(e);a.ref=i},xy=(e,t,r,n)=>{let s=e._zod.def;Ce(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType,r.readOnly=!0},Iy=(e,t,r,n)=>{let s=e._zod.def;Ce(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType},xl=(e,t,r,n)=>{let s=e._zod.def;Ce(s.innerType,t,n);let o=t.seen.get(e);o.ref=s.innerType},Dy=(e,t,r,n)=>{let s=e._zod.innerType;Ce(s,t,n);let o=t.seen.get(e);o.ref=s},Al={string:Yh,number:Qh,boolean:Xh,bigint:ey,symbol:ty,null:ry,undefined:ny,void:sy,never:oy,any:iy,unknown:ay,date:cy,enum:uy,literal:ly,nan:py,template_literal:dy,file:my,success:fy,custom:gy,function:hy,transform:yy,map:by,set:wy,array:_y,object:Ry,union:Ol,intersection:Sy,tuple:vy,record:ky,nullable:Ey,nonoptional:Py,default:Ty,prefault:$y,catch:Ay,pipe:Oy,readonly:xy,promise:Iy,optional:xl,lazy:Dy}});var Dl,vv=C(()=>{xa();Aa();Dl=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 r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Pn({processors:Al,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return Ce(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Cn(this.ctx,t);let n=Tn(this.ctx,t),{"~standard":s,...o}=n;return o}}});var kv={};var Ev=C(()=>{});var Kr={};ne(Kr,{$ZodAny:()=>wg,$ZodArray:()=>kg,$ZodAsyncError:()=>Ot,$ZodBase64:()=>cg,$ZodBase64URL:()=>ug,$ZodBigInt:()=>Bu,$ZodBigIntFormat:()=>gg,$ZodBoolean:()=>ha,$ZodCIDRv4:()=>ig,$ZodCIDRv6:()=>ag,$ZodCUID:()=>Zf,$ZodCUID2:()=>Jf,$ZodCatch:()=>Hg,$ZodCheck:()=>xe,$ZodCheckBigIntFormat:()=>Sf,$ZodCheckEndsWith:()=>Df,$ZodCheckGreaterThan:()=>Cu,$ZodCheckIncludes:()=>xf,$ZodCheckLengthEquals:()=>Tf,$ZodCheckLessThan:()=>Pu,$ZodCheckLowerCase:()=>Af,$ZodCheckMaxLength:()=>Pf,$ZodCheckMaxSize:()=>vf,$ZodCheckMimeType:()=>Lf,$ZodCheckMinLength:()=>Cf,$ZodCheckMinSize:()=>kf,$ZodCheckMultipleOf:()=>_f,$ZodCheckNumberFormat:()=>Rf,$ZodCheckOverwrite:()=>Ff,$ZodCheckProperty:()=>Tu,$ZodCheckRegex:()=>$f,$ZodCheckSizeEquals:()=>Ef,$ZodCheckStartsWith:()=>If,$ZodCheckStringFormat:()=>So,$ZodCheckUpperCase:()=>Of,$ZodCodec:()=>ba,$ZodCreditCard:()=>pg,$ZodCustom:()=>Kg,$ZodCustomStringFormat:()=>mg,$ZodCyclicError:()=>Yu,$ZodDate:()=>vg,$ZodDefault:()=>Ng,$ZodDiscriminatedUnion:()=>Tg,$ZodE164:()=>lg,$ZodEmail:()=>zf,$ZodEmoji:()=>Wf,$ZodEncodeError:()=>Sn,$ZodEnum:()=>Ig,$ZodError:()=>ca,$ZodExactOptional:()=>Mg,$ZodFile:()=>Lg,$ZodFunction:()=>Zg,$ZodGUID:()=>Uf,$ZodIPv4:()=>ng,$ZodIPv6:()=>sg,$ZodISODate:()=>eg,$ZodISODateTime:()=>Xf,$ZodISODuration:()=>rg,$ZodISOTime:()=>tg,$ZodIntersection:()=>$g,$ZodJWT:()=>dg,$ZodKSUID:()=>Qf,$ZodLazy:()=>wa,$ZodLiteral:()=>Dg,$ZodMAC:()=>og,$ZodMap:()=>Og,$ZodNaN:()=>Vg,$ZodNanoID:()=>qf,$ZodNever:()=>Rg,$ZodNonOptional:()=>jg,$ZodNull:()=>bg,$ZodNullable:()=>Gg,$ZodNumber:()=>Vu,$ZodNumberFormat:()=>fg,$ZodObject:()=>nv,$ZodObjectJIT:()=>Eg,$ZodOptional:()=>qu,$ZodPipe:()=>Zu,$ZodPrefault:()=>Ug,$ZodPreprocess:()=>Bg,$ZodPromise:()=>Jg,$ZodReadonly:()=>Wg,$ZodRealError:()=>xt,$ZodRecord:()=>Ag,$ZodRegistry:()=>el,$ZodSet:()=>xg,$ZodString:()=>cs,$ZodStringFormat:()=>$e,$ZodSuccess:()=>zg,$ZodSymbol:()=>hg,$ZodTemplateLiteral:()=>qg,$ZodTransform:()=>Fg,$ZodTuple:()=>Wu,$ZodType:()=>oe,$ZodULID:()=>Kf,$ZodURL:()=>Bf,$ZodUUID:()=>jf,$ZodUndefined:()=>yg,$ZodUnion:()=>ya,$ZodUnknown:()=>_g,$ZodVoid:()=>Sg,$ZodXID:()=>Yf,$ZodXor:()=>Pg,$brand:()=>$m,$constructor:()=>T,$input:()=>oh,$output:()=>sh,Doc:()=>as,INVALID:()=>Vt,JSONSchema:()=>kv,JSONSchemaGenerator:()=>Dl,NEVER:()=>Tm,TimePrecision:()=>gh,URL_BAD_FORMAT:()=>Hf,URL_UNPARSEABLE:()=>Vf,ZodCompileAsyncError:()=>pr,ZodCompileUnsupportedError:()=>ye,_any:()=>xh,_array:()=>Nh,_base64:()=>_l,_base64url:()=>Rl,_bigint:()=>Eh,_boolean:()=>vh,_catch:()=>vL,_check:()=>gv,_cidrv4:()=>bl,_cidrv6:()=>wl,_coercedBigint:()=>Ph,_coercedBoolean:()=>kh,_coercedDate:()=>Mh,_coercedNumber:()=>yh,_coercedString:()=>dh,_creditCard:()=>fh,_cuid:()=>pl,_cuid2:()=>dl,_custom:()=>jh,_date:()=>Fh,_decode:()=>hu,_decodeAsync:()=>bu,_default:()=>_L,_discriminatedUnion:()=>cL,_e164:()=>Sl,_email:()=>nl,_emoji:()=>ul,_encode:()=>gu,_encodeAsync:()=>yu,_endsWith:()=>$o,_enum:()=>fL,_file:()=>Uh,_float32:()=>wh,_float64:()=>_h,_gt:()=>Er,_gte:()=>Wt,_guid:()=>sl,_includes:()=>Co,_int:()=>bh,_int32:()=>Rh,_int64:()=>Ch,_intersection:()=>uL,_ipv4:()=>hl,_ipv6:()=>yl,_isoDate:()=>Pa,_isoDateTime:()=>Ea,_isoDuration:()=>Ta,_isoTime:()=>Ca,_jwt:()=>vl,_ksuid:()=>gl,_lazy:()=>CL,_length:()=>gs,_literal:()=>hL,_lowercase:()=>Eo,_lt:()=>kr,_lte:()=>Bt,_mac:()=>mh,_map:()=>dL,_max:()=>Bt,_maxLength:()=>fs,_maxSize:()=>En,_mime:()=>Ao,_min:()=>Wt,_minLength:()=>Jr,_minSize:()=>Pr,_multipleOf:()=>kn,_nan:()=>Gh,_nanoid:()=>ll,_nativeEnum:()=>gL,_negative:()=>El,_never:()=>Dh,_nonnegative:()=>Cl,_nonoptional:()=>RL,_nonpositive:()=>Pl,_normalize:()=>Oo,_null:()=>Oh,_nullable:()=>wL,_number:()=>hh,_optional:()=>bL,_overwrite:()=>dr,_parse:()=>yo,_parseAsync:()=>bo,_pipe:()=>kL,_positive:()=>kl,_promise:()=>TL,_properties:()=>$l,_property:()=>Tl,_readonly:()=>EL,_record:()=>pL,_refine:()=>zh,_regex:()=>ko,_safeDecode:()=>_u,_safeDecodeAsync:()=>Su,_safeEncode:()=>wu,_safeEncodeAsync:()=>Ru,_safeParse:()=>wo,_safeParseAsync:()=>_o,_set:()=>mL,_size:()=>ms,_slugify:()=>Lo,_startsWith:()=>To,_string:()=>ph,_stringFormat:()=>Fo,_stringbool:()=>Wh,_success:()=>SL,_superRefine:()=>Hh,_symbol:()=>$h,_templateLiteral:()=>PL,_toLowerCase:()=>Io,_toUpperCase:()=>Do,_transform:()=>yL,_trim:()=>xo,_tuple:()=>lL,_uint32:()=>Sh,_uint64:()=>Th,_ulid:()=>ml,_undefined:()=>Ah,_union:()=>iL,_unknown:()=>Ih,_uppercase:()=>Po,_url:()=>ka,_uuid:()=>ol,_uuidv4:()=>il,_uuidv6:()=>al,_uuidv7:()=>cl,_void:()=>Lh,_xid:()=>fl,_xor:()=>aL,clone:()=>Pe,compile:()=>uh,compileFn:()=>rl,config:()=>ze,createStandardJSONSchemaMethod:()=>Mo,createToJSONSchemaMethod:()=>Zh,decode:()=>b0,decodeAsync:()=>_0,describe:()=>Vh,encode:()=>y0,encodeAsync:()=>w0,extractDefs:()=>Cn,finalize:()=>Tn,flattenError:()=>ua,formatError:()=>la,getDiscriminatedOption:()=>Cg,globalConfig:()=>ot,globalRegistry:()=>ct,handleUnrepresentable:()=>Ke,initializeContext:()=>Pn,isBackEdge:()=>Qu,isRecursiveSchema:()=>eh,isValidBase64:()=>ga,isValidBase64URL:()=>ju,isValidCIDRv6:()=>Uu,isValidCreditCard:()=>zu,isValidIPv6:()=>fa,isValidJWT:()=>Hu,locales:()=>Sa,memoizer:()=>Ra,mergeValues:()=>vo,meta:()=>Bh,parse:()=>mu,parseAsync:()=>fu,parseURLObject:()=>Fu,prettifyError:()=>Dm,process:()=>Ce,regexes:()=>bt,registry:()=>tl,safeDecode:()=>S0,safeDecodeAsync:()=>k0,safeEncode:()=>R0,safeEncodeAsync:()=>v0,safeParse:()=>Fm,safeParseAsync:()=>Mm,standardProps:()=>Lu,stripTabAndNewline:()=>Mu,toDotPath:()=>DS,toJSONSchema:()=>Il,toZod:()=>ea,treeifyError:()=>Im,urlHostnameOk:()=>Gu,urlProtocolOk:()=>Nu,util:()=>Y,validate:()=>Gm,validateAsync:()=>Nm,version:()=>Mf});var qt=C(()=>{Rn();Um();Lm();_a();th();$u();Gf();Je();Je();Ro();nh();va();Au();fv();hv();Aa();xa();vv();Ev()});var Ll={};ne(Ll,{endsWith:()=>$o,gt:()=>Er,gte:()=>Wt,includes:()=>Co,length:()=>gs,lowercase:()=>Eo,lt:()=>kr,lte:()=>Bt,maxLength:()=>fs,maxSize:()=>En,mime:()=>Ao,minLength:()=>Jr,minSize:()=>Pr,multipleOf:()=>kn,negative:()=>El,nonnegative:()=>Cl,nonpositive:()=>Pl,normalize:()=>Oo,overwrite:()=>dr,positive:()=>kl,properties:()=>$l,property:()=>Tl,regex:()=>ko,size:()=>ms,slugify:()=>Lo,startsWith:()=>To,toLowerCase:()=>Io,toUpperCase:()=>Do,trim:()=>xo,uppercase:()=>Po});var Fl=C(()=>{qt()});function Ml(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Pv,Cv,IL,It,Ly=C(()=>{qt();qt();Je();Pv=new WeakSet([Object.prototype,Error.prototype]);Cv=(e,t)=>{ca.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Pv.has(r)||(Pv.add(r),Ml(r,"format",n=>s=>la(n,s)),Ml(r,"flatten",n=>s=>ua(n,s)),Ml(r,"addIssue",n=>s=>{n.issues.push(s),n.message=JSON.stringify(n.issues,fo,2)}),Ml(r,"addIssues",n=>s=>{n.issues.push(...s),n.message=JSON.stringify(n.issues,fo,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},IL=T("ZodError",Cv),It=T("ZodError",Cv,void 0,{Parent:Error})});var Fy,My,Gy,Ny,Uy,jy,zy,Hy,Vy,By,Wy,qy,Zy=C(()=>{qt();Ly();qt();Fy=yo(It),My=bo(It),Gy=wo(It),Ny=_o(It),Uy=gu(It),jy=hu(It),zy=yu(It),Hy=bu(It),Vy=wu(It),By=_u(It),Wy=Ru(It),qy=Su(It)});var Wo={};ne(Wo,{ZodAny:()=>nb,ZodArray:()=>ab,ZodBase64:()=>ep,ZodBase64URL:()=>tp,ZodBigInt:()=>Vo,ZodBigIntFormat:()=>sp,ZodBoolean:()=>Ho,ZodCIDRv4:()=>Ql,ZodCIDRv6:()=>Xl,ZodCUID:()=>Bl,ZodCUID2:()=>Wl,ZodCatch:()=>Tb,ZodCodec:()=>za,ZodCreditCard:()=>Ky,ZodCustom:()=>Ha,ZodCustomStringFormat:()=>jo,ZodDate:()=>Fa,ZodDefault:()=>Sb,ZodDiscriminatedUnion:()=>ub,ZodE164:()=>rp,ZodEmail:()=>jl,ZodEmoji:()=>Hl,ZodEnum:()=>No,ZodExactOptional:()=>cp,ZodFile:()=>bb,ZodFunction:()=>Gb,ZodGUID:()=>zl,ZodIPv4:()=>Kl,ZodIPv6:()=>Yl,ZodISODate:()=>An,ZodISODateTime:()=>$n,ZodISODuration:()=>xn,ZodISOTime:()=>On,ZodIntersection:()=>lb,ZodJWT:()=>np,ZodKSUID:()=>Jl,ZodLazy:()=>Lb,ZodLiteral:()=>yb,ZodMAC:()=>Jy,ZodMap:()=>gb,ZodNaN:()=>Ab,ZodNanoID:()=>Vl,ZodNever:()=>ob,ZodNonOptional:()=>up,ZodNull:()=>tb,ZodNullable:()=>Rb,ZodNumber:()=>zo,ZodNumberFormat:()=>ws,ZodObject:()=>Ga,ZodOptional:()=>Ua,ZodPipe:()=>ja,ZodPrefault:()=>kb,ZodPreprocess:()=>Ob,ZodPromise:()=>Mb,ZodReadonly:()=>xb,ZodRecord:()=>Go,ZodSet:()=>hb,ZodString:()=>Uo,ZodStringFormat:()=>Oe,ZodSuccess:()=>Cb,ZodSymbol:()=>Xy,ZodTemplateLiteral:()=>Db,ZodTransform:()=>wb,ZodTuple:()=>db,ZodType:()=>le,ZodULID:()=>ql,ZodURL:()=>La,ZodUUID:()=>Cr,ZodUndefined:()=>eb,ZodUnion:()=>Na,ZodUnknown:()=>sb,ZodVoid:()=>ib,ZodXID:()=>Zl,ZodXor:()=>cb,_ZodString:()=>Ul,_default:()=>vb,_function:()=>Lk,any:()=>dk,array:()=>Ma,base64:()=>Zv,base64url:()=>Jv,bigint:()=>ak,boolean:()=>Qy,catch:()=>$b,check:()=>Fk,cidrv4:()=>Wv,cidrv6:()=>qv,codec:()=>Ok,creditCard:()=>Yv,cuid:()=>Gv,cuid2:()=>Nv,custom:()=>Mk,date:()=>fk,describe:()=>Gk,discriminatedUnion:()=>_k,e164:()=>Kv,email:()=>Tv,emoji:()=>Fv,enum:()=>ip,exactOptional:()=>_b,file:()=>Ck,float32:()=>nk,float64:()=>sk,function:()=>Lk,guid:()=>$v,hash:()=>rk,hex:()=>tk,hostname:()=>ek,httpUrl:()=>Lv,instanceof:()=>Uk,int:()=>Gl,int32:()=>ok,int64:()=>ck,intersection:()=>pb,invertCodec:()=>xk,ipv4:()=>Hv,ipv6:()=>Bv,json:()=>zk,jwt:()=>Qv,keyof:()=>gk,ksuid:()=>zv,lazy:()=>Fb,literal:()=>Pk,looseObject:()=>bk,looseRecord:()=>Sk,mac:()=>Vv,map:()=>vk,meta:()=>Nk,nan:()=>Ak,nanoid:()=>Mv,nativeEnum:()=>Ek,never:()=>op,nonoptional:()=>Pb,null:()=>rb,nullable:()=>Da,nullish:()=>Tk,number:()=>Yy,object:()=>hk,optional:()=>ys,partialRecord:()=>Rk,pipe:()=>Nl,prefault:()=>Eb,preprocess:()=>Hk,promise:()=>Dk,readonly:()=>Ib,record:()=>fb,refine:()=>Nb,set:()=>kk,strictObject:()=>yk,string:()=>Ia,stringFormat:()=>Xv,stringbool:()=>jk,success:()=>$k,superRefine:()=>Ub,symbol:()=>lk,templateLiteral:()=>Ik,transform:()=>ap,tuple:()=>mb,uint32:()=>ik,uint64:()=>uk,ulid:()=>Uv,undefined:()=>pk,union:()=>Bo,unknown:()=>hs,url:()=>Dv,uuid:()=>Av,uuidv4:()=>Ov,uuidv6:()=>xv,uuidv7:()=>Iv,void:()=>mk,xid:()=>jv,xor:()=>wk});function LL(){ot.localeError||ze(Xu())}function bs(){ot.memoizer||ze({memoizer:Ra()})}function Ia(e){return ph(Uo,e)}function Tv(e){return nl(jl,e)}function $v(e){return sl(zl,e)}function Av(e){return ol(Cr,e)}function Ov(e){return il(Cr,e)}function xv(e){return al(Cr,e)}function Iv(e){return cl(Cr,e)}function Dv(e){return ka(La,e)}function Lv(e){return ka(La,{protocol:bt.httpProtocol,hostname:bt.domain,...Y.normalizeParams(e)})}function Fv(e){return ul(Hl,e)}function Mv(e){return ll(Vl,e)}function Gv(e){return pl(Bl,e)}function Nv(e){return dl(Wl,e)}function Uv(e){return ml(ql,e)}function jv(e){return fl(Zl,e)}function zv(e){return gl(Jl,e)}function Hv(e){return hl(Kl,e)}function Vv(e){return mh(Jy,e)}function Bv(e){return yl(Yl,e)}function Wv(e){return bl(Ql,e)}function qv(e){return wl(Xl,e)}function Zv(e){return _l(ep,e)}function Jv(e){return Rl(tp,e)}function Kv(e){return Sl(rp,e)}function Yv(e){return fh(Ky,e)}function Qv(e){return vl(np,e)}function Xv(e,t,r={}){return Fo(jo,e,t,r)}function ek(e){return Fo(jo,"hostname",bt.hostname,e)}function tk(e){return Fo(jo,"hex",bt.hex,e)}function rk(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,s=bt[n];if(!s)throw new Error(`Unrecognized hash format: ${n}`);return Fo(jo,n,s,t)}function Yy(e){return hh(zo,e)}function Gl(e){return bh(ws,e)}function nk(e){return wh(ws,e)}function sk(e){return _h(ws,e)}function ok(e){return Rh(ws,e)}function ik(e){return Sh(ws,e)}function Qy(e){return vh(Ho,e)}function ak(e){return Eh(Vo,e)}function ck(e){return Ch(sp,e)}function uk(e){return Th(sp,e)}function lk(e){return $h(Xy,e)}function pk(e){return Ah(eb,e)}function rb(e){return Oh(tb,e)}function dk(){return xh(nb)}function hs(){return Ih(sb)}function op(e){return Dh(ob,e)}function mk(e){return Lh(ib,e)}function fk(e){return Fh(Fa,e)}function Ma(e,t){return Nh(ab,e,t)}function gk(e){let t=e._zod.def.shape;return ip(Object.keys(t))}function hk(e,t){let r={type:"object",shape:e??{},...Y.normalizeParams(t)};return new Ga(r)}function yk(e,t){return new Ga({type:"object",shape:e,catchall:op(),...Y.normalizeParams(t)})}function bk(e,t){return new Ga({type:"object",shape:e,catchall:hs(),...Y.normalizeParams(t)})}function Bo(e,t){return new Na({type:"union",options:e,...Y.normalizeParams(t)})}function wk(e,t){return new cb({type:"union",options:e,inclusive:!1,...Y.normalizeParams(t)})}function _k(e,t,r){return new ub({type:"union",options:t,discriminator:e,...Y.normalizeParams(r)})}function pb(e,t){return new lb({type:"intersection",left:e,right:t})}function mb(e,t,r){let n=t instanceof oe,s=n?r:t,o=n?t:null;return new db({type:"tuple",items:e,rest:o,...Y.normalizeParams(s)})}function fb(e,t,r){return!t||!t._zod?new Go({type:"record",keyType:Ia(),valueType:e,...Y.normalizeParams(t)}):new Go({type:"record",keyType:e,valueType:t,...Y.normalizeParams(r)})}function Rk(e,t,r){return new Go({type:"record",keyType:e,valueType:t,...Y.normalizeParams(r),partial:!0})}function Sk(e,t,r){return new Go({type:"record",keyType:e,valueType:t,mode:"loose",...Y.normalizeParams(r)})}function vk(e,t,r){return new gb({type:"map",keyType:e,valueType:t,...Y.normalizeParams(r)})}function kk(e,t){return new hb({type:"set",valueType:e,...Y.normalizeParams(t)})}function ip(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new No({type:"enum",entries:r,...Y.normalizeParams(t)})}function Ek(e,t){return new No({type:"enum",entries:e,...Y.normalizeParams(t)})}function Pk(e,t){return new yb({type:"literal",values:Array.isArray(e)?e:[e],...Y.normalizeParams(t)})}function Ck(e){return Uh(bb,e)}function ap(e){return new wb({type:"transform",transform:e})}function ys(e){return new Ua({type:"optional",innerType:e})}function _b(e){return new cp({type:"optional",innerType:e})}function Da(e){return new Rb({type:"nullable",innerType:e})}function Tk(e){return ys(Da(e))}function vb(e,t){return new Sb({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Y.shallowClone(t)}})}function Eb(e,t){return new kb({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Y.shallowClone(t)}})}function Pb(e,t){return new up({type:"nonoptional",innerType:e,...Y.normalizeParams(t)})}function $k(e){return new Cb({type:"success",innerType:e})}function $b(e,t){return new Tb({type:"catch",innerType:e,catchValue:typeof t=="function"?t:Y.constantCatch(t)})}function Ak(e){return Gh(Ab,e)}function Nl(e,t){return new ja({type:"pipe",in:e,out:t})}function Ok(e,t,r){return new za({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function xk(e){let t=e._zod.def;return new za({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}function Ib(e){return new xb({type:"readonly",innerType:e})}function Ik(e,t){return new Db({type:"template_literal",parts:e,...Y.normalizeParams(t)})}function Fb(e){return new Lb({type:"lazy",getter:e})}function Dk(e){return new Mb({type:"promise",innerType:e})}function Lk(e){return new Gb({type:"function",input:Array.isArray(e?.input)?mb(e?.input):e?.input??Ma(hs()),output:e?.output??hs()})}function Fk(e){let t=new xe({check:"custom"});return t._zod.check=e,t}function Mk(e,t){return jh(Ha,e??(()=>!0),t)}function Nb(e,t={}){return zh(Ha,e,t)}function Ub(e,t){return Hh(e,t)}function Uk(e,t={}){let r=new Ha({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...Y.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}function zk(e){let t=Fb(()=>Bo([Ia(e),Yy(),Qy(),rb(),Ma(t),fb(Ia(),t)]));return t}function Hk(e,t){return new Ob({type:"pipe",in:ap(e),out:t})}var le,Ul,Uo,Oe,$n,An,On,xn,jl,zl,Cr,La,Hl,Vl,Bl,Wl,ql,Zl,Jl,Kl,Jy,Yl,Ql,Xl,ep,tp,rp,Ky,np,jo,zo,ws,Ho,Vo,sp,Xy,eb,tb,nb,sb,ob,ib,Fa,ab,Ga,Na,cb,ub,lb,db,Go,gb,hb,No,yb,bb,wb,Ua,cp,Rb,Sb,kb,up,Cb,Tb,Ab,ja,za,Ob,xb,Db,Lb,Mb,Gb,Ha,Gk,Nk,jk,In=C(()=>{qt();qt();xa();Aa();rh();Fl();Zy();le=T("ZodType",(e,t)=>(LL(),oe.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Y.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Pe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Nb(e,t))},superRefine(e,t){return this.check(Ub(e,t))},overwrite(e){return this.check(dr(e))},optional(){return ys(this)},exactOptional(){return _b(this)},nullable(){return Da(this)},nullish(){return ys(Da(this))},nonoptional(e){return Pb(this,e)},array(){return Ma(this)},or(e){return Bo([this,e])},and(e){return pb(this,e)},transform(e){return Nl(this,ap(e))},default(e){return vb(this,e)},prefault(e){return Eb(this,e)},catch(e){return $b(this,e)},pipe(e){return Nl(this,e)},readonly(){return Ib(this)},describe(e){let t=this.clone();return ct.add(t,{description:e}),t},meta(...e){if(e.length===0)return ct.get(this);let t=this.clone();return ct.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 Y.hide(this,"~standard",{...Lu(this),jsonSchema:{input:Mo(this,"input"),output:Mo(this,"output")}})},set"~standard"(e){Y.own(this,"~standard",e)},parse:function e(t,r){return Fy(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await My(this,t,r,{callee:e})},safeParse(e,t){return Gy(this,e,t)},async safeParseAsync(e,t){return Ny(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Y.own(this,"spa",e)},encode:function e(t,r){return Uy(this,t,r,{callee:e})},decode:function e(t,r){return jy(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await zy(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Hy(this,t,r,{callee:e})},safeEncode(e,t){return Vy(this,e,t)},safeDecode(e,t){return By(this,e,t)},async safeEncodeAsync(e,t){return Wy(this,e,t)},async safeDecodeAsync(e,t){return qy(this,e,t)},toJSONSchema(e){return Zh(this,{})(e)},get description(){return ct.get(this)?.description},get _def(){return this._zod.def}}),Ul=T("_ZodString",(e,t)=>{cs.init(e,t),le.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Yh(e,n,s,o);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null},{regex(...e){return this.check(ko(...e))},includes(...e){return this.check(Co(...e))},startsWith(...e){return this.check(To(...e))},endsWith(...e){return this.check($o(...e))},min(...e){return this.check(Jr(...e))},max(...e){return this.check(fs(...e))},length(...e){return this.check(gs(...e))},nonempty(...e){return this.check(Jr(1,...e))},lowercase(e){return this.check(Eo(e))},uppercase(e){return this.check(Po(e))},trim(){return this.check(xo())},normalize(...e){return this.check(Oo(...e))},toLowerCase(){return this.check(Io())},toUpperCase(){return this.check(Do())},slugify(){return this.check(Lo())}}),Uo=T("ZodString",(e,t)=>{cs.init(e,t),Ul.init(e,t)},{email(e){return this.check(nl(jl,e))},url(e){return this.check(ka(La,e))},jwt(e){return this.check(vl(np,e))},emoji(e){return this.check(ul(Hl,e))},guid(e){return this.check(sl(zl,e))},uuid(e){return this.check(ol(Cr,e))},uuidv4(e){return this.check(il(Cr,e))},uuidv6(e){return this.check(al(Cr,e))},uuidv7(e){return this.check(cl(Cr,e))},nanoid(e){return this.check(ll(Vl,e))},cuid(e){return this.check(pl(Bl,e))},cuid2(e){return this.check(dl(Wl,e))},ulid(e){return this.check(ml(ql,e))},base64(e){return this.check(_l(ep,e))},base64url(e){return this.check(Rl(tp,e))},xid(e){return this.check(fl(Zl,e))},ksuid(e){return this.check(gl(Jl,e))},ipv4(e){return this.check(hl(Kl,e))},ipv6(e){return this.check(yl(Yl,e))},cidrv4(e){return this.check(bl(Ql,e))},cidrv6(e){return this.check(wl(Xl,e))},e164(e){return this.check(Sl(rp,e))},datetime(e){return this.check(Ea($n,e))},date(e){return this.check(Pa(An,e))},time(e){return this.check(Ca(On,e))},duration(e){return this.check(Ta(xn,e))}});Oe=T("ZodStringFormat",(e,t)=>{$e.init(e,t),Ul.init(e,t)}),$n=T("ZodISODateTime",(e,t)=>{Xf.init(e,t),Oe.init(e,t)}),An=T("ZodISODate",(e,t)=>{eg.init(e,t),Oe.init(e,t)}),On=T("ZodISOTime",(e,t)=>{tg.init(e,t),Oe.init(e,t)}),xn=T("ZodISODuration",(e,t)=>{rg.init(e,t),Oe.init(e,t)}),jl=T("ZodEmail",(e,t)=>{zf.init(e,t),Oe.init(e,t)});zl=T("ZodGUID",(e,t)=>{Uf.init(e,t),Oe.init(e,t)});Cr=T("ZodUUID",(e,t)=>{jf.init(e,t),Oe.init(e,t)});La=T("ZodURL",(e,t)=>{Bf.init(e,t),Oe.init(e,t)});Hl=T("ZodEmoji",(e,t)=>{Wf.init(e,t),Oe.init(e,t)});Vl=T("ZodNanoID",(e,t)=>{qf.init(e,t),Oe.init(e,t)});Bl=T("ZodCUID",(e,t)=>{Zf.init(e,t),Oe.init(e,t)});Wl=T("ZodCUID2",(e,t)=>{Jf.init(e,t),Oe.init(e,t)});ql=T("ZodULID",(e,t)=>{Kf.init(e,t),Oe.init(e,t)});Zl=T("ZodXID",(e,t)=>{Yf.init(e,t),Oe.init(e,t)});Jl=T("ZodKSUID",(e,t)=>{Qf.init(e,t),Oe.init(e,t)});Kl=T("ZodIPv4",(e,t)=>{ng.init(e,t),Oe.init(e,t)});Jy=T("ZodMAC",(e,t)=>{og.init(e,t),Oe.init(e,t)});Yl=T("ZodIPv6",(e,t)=>{sg.init(e,t),Oe.init(e,t)});Ql=T("ZodCIDRv4",(e,t)=>{ig.init(e,t),Oe.init(e,t)});Xl=T("ZodCIDRv6",(e,t)=>{ag.init(e,t),Oe.init(e,t)});ep=T("ZodBase64",(e,t)=>{cg.init(e,t),Oe.init(e,t)});tp=T("ZodBase64URL",(e,t)=>{ug.init(e,t),Oe.init(e,t)});rp=T("ZodE164",(e,t)=>{lg.init(e,t),Oe.init(e,t)});Ky=T("ZodCreditCard",(e,t)=>{pg.init(e,t),Oe.init(e,t)});np=T("ZodJWT",(e,t)=>{dg.init(e,t),Oe.init(e,t)});jo=T("ZodCustomStringFormat",(e,t)=>{mg.init(e,t),Oe.init(e,t)});zo=T("ZodNumber",(e,t)=>{Vu.init(e,t),le.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Qh(e,n,s,o);let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null},{gt(e,t){return this.check(Er(e,t))},gte(e,t){return this.check(Wt(e,t))},min(e,t){return this.check(Wt(e,t))},lt(e,t){return this.check(kr(e,t))},lte(e,t){return this.check(Bt(e,t))},max(e,t){return this.check(Bt(e,t))},int(e){return this.check(Gl(e))},safe(e){return this.check(Gl(e))},positive(e){return this.check(Er(0,e))},nonnegative(e){return this.check(Wt(0,e))},negative(e){return this.check(kr(0,e))},nonpositive(e){return this.check(Bt(0,e))},multipleOf(e,t){return this.check(kn(e,t))},step(e,t){return this.check(kn(e,t))},finite(){return this}});ws=T("ZodNumberFormat",(e,t)=>{fg.init(e,t),zo.init(e,t)});Ho=T("ZodBoolean",(e,t)=>{ha.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Xh(e,r,n,s)});Vo=T("ZodBigInt",(e,t)=>{Bu.init(e,t),le.init(e,t),e._zod.processJSONSchema=(n,s,o)=>ey(e,n,s,o);let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null},{gte(e,t){return this.check(Wt(e,t))},min(e,t){return this.check(Wt(e,t))},gt(e,t){return this.check(Er(e,t))},lt(e,t){return this.check(kr(e,t))},lte(e,t){return this.check(Bt(e,t))},max(e,t){return this.check(Bt(e,t))},positive(e){return this.check(Er(BigInt(0),e))},negative(e){return this.check(kr(BigInt(0),e))},nonpositive(e){return this.check(Bt(BigInt(0),e))},nonnegative(e){return this.check(Wt(BigInt(0),e))},multipleOf(e,t){return this.check(kn(e,t))}});sp=T("ZodBigIntFormat",(e,t)=>{gg.init(e,t),Vo.init(e,t)});Xy=T("ZodSymbol",(e,t)=>{hg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ty(e,r,n,s)});eb=T("ZodUndefined",(e,t)=>{yg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ny(e,r,n,s)});tb=T("ZodNull",(e,t)=>{bg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ry(e,r,n,s)});nb=T("ZodAny",(e,t)=>{wg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>iy(e,r,n,s)});sb=T("ZodUnknown",(e,t)=>{_g.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ay(e,r,n,s)});ob=T("ZodNever",(e,t)=>{Rg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>oy(e,r,n,s)});ib=T("ZodVoid",(e,t)=>{Sg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>sy(e,r,n,s)});Fa=T("ZodDate",(e,t)=>{vg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(n,s,o)=>cy(e,n,s,o),e.min=(n,s)=>e.check(Wt(n,s)),e.max=(n,s)=>e.check(Bt(n,s));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});ab=T("ZodArray",(e,t)=>{bs(),kg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>_y(e,r,n,s),e.element=t.element},{min(e,t){return this.check(Jr(e,t))},nonempty(e){return this.check(Jr(1,e))},max(e,t){return this.check(fs(e,t))},length(e,t){return this.check(gs(e,t))},unwrap(){return this.element}});Ga=T("ZodObject",(e,t)=>{bs(),Eg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ry(e,r,n,s),Y.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return ip(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:hs()})},loose(){return this.clone({...this._zod.def,catchall:hs()})},strict(){return this.clone({...this._zod.def,catchall:op()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Y.extend(this,e)},safeExtend(e){return Y.safeExtend(this,e)},merge(e){return Y.merge(this,e)},pick(e){return Y.pick(this,e)},omit(e){return Y.omit(this,e)},partial(...e){return Y.partial(Ua,this,e[0])},exactPartial(...e){return Y.partial(cp,this,e[0],"exactPartial")},required(...e){return Y.required(up,this,e[0])}});Na=T("ZodUnion",(e,t)=>{ya.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ol(e,r,n,s),e.options=t.options});cb=T("ZodXor",(e,t)=>{Na.init(e,t),Pg.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ol(e,r,n,s),e.options=t.options});ub=T("ZodDiscriminatedUnion",(e,t)=>{Na.init(e,t),Tg.init(e,t)});lb=T("ZodIntersection",(e,t)=>{$g.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Sy(e,r,n,s)});db=T("ZodTuple",(e,t)=>{bs(),Wu.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>vy(e,r,n,s)},{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 Ua({type:"optional",innerType:t}))})}});Go=T("ZodRecord",(e,t)=>{bs(),Ag.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ky(e,r,n,s),e.keyType=t.keyType,e.valueType=t.valueType});gb=T("ZodMap",(e,t)=>{bs(),Og.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>by(e,r,n,s),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Pr(...r)),e.nonempty=r=>e.check(Pr(1,r)),e.max=(...r)=>e.check(En(...r)),e.size=(...r)=>e.check(ms(...r))});hb=T("ZodSet",(e,t)=>{bs(),xg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>wy(e,r,n,s),e.min=(...r)=>e.check(Pr(...r)),e.nonempty=r=>e.check(Pr(1,r)),e.max=(...r)=>e.check(En(...r)),e.size=(...r)=>e.check(ms(...r))});No=T("ZodEnum",(e,t)=>{Ig.init(e,t),le.init(e,t),e._zod.processJSONSchema=(n,s,o)=>uy(e,n,s,o),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,s)=>{let o={};for(let i of n)if(r.has(i))o[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new No({...t,checks:[],...Y.normalizeParams(s),entries:o})},e.exclude=(n,s)=>{let o={...t.entries};for(let i of n)if(r.has(i))delete o[i];else throw new Error(`Key ${i} not found in enum`);return new No({...t,checks:[],...Y.normalizeParams(s),entries:o})}});yb=T("ZodLiteral",(e,t)=>{Dg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ly(e,r,n,s),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]}})});bb=T("ZodFile",(e,t)=>{Lg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>my(e,r,n,s),e.min=(r,n)=>e.check(Pr(r,n)),e.max=(r,n)=>e.check(En(r,n)),e.mime=(r,n)=>e.check(Ao(Array.isArray(r)?r:[r],n))});wb=T("ZodTransform",(e,t)=>{bs(),Fg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>yy(e,r,n,s),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Sn(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(Y.issue(o,r.value,t));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Y.issue(i))}};let s=t.transform(r.value,r);return s instanceof Promise?s.then(o=>(r.value=o,r)):(r.value=s,r)}});Ua=T("ZodOptional",(e,t)=>{qu.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>xl(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});cp=T("ZodExactOptional",(e,t)=>{Mg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>xl(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});Rb=T("ZodNullable",(e,t)=>{Gg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ey(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});Sb=T("ZodDefault",(e,t)=>{Ng.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ty(e,r,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});kb=T("ZodPrefault",(e,t)=>{Ug.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>$y(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});up=T("ZodNonOptional",(e,t)=>{jg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Py(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});Cb=T("ZodSuccess",(e,t)=>{zg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>fy(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});Tb=T("ZodCatch",(e,t)=>{Hg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Ay(e,r,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});Ab=T("ZodNaN",(e,t)=>{Vg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>py(e,r,n,s)});ja=T("ZodPipe",(e,t)=>{Zu.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Oy(e,r,n,s),e.in=t.in,e.out=t.out});za=T("ZodCodec",(e,t)=>{ja.init(e,t),ba.init(e,t)});Ob=T("ZodPreprocess",(e,t)=>{ja.init(e,t),Bg.init(e,t)}),xb=T("ZodReadonly",(e,t)=>{Wg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>xy(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});Db=T("ZodTemplateLiteral",(e,t)=>{qg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>dy(e,r,n,s)});Lb=T("ZodLazy",(e,t)=>{wa.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Dy(e,r,n,s),e.unwrap=()=>e._zod.def.getter()});Mb=T("ZodPromise",(e,t)=>{Jg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>Iy(e,r,n,s),e.unwrap=()=>e._zod.def.innerType});Gb=T("ZodFunction",(e,t)=>{Zg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>hy(e,r,n,s)});Ha=T("ZodCustom",(e,t)=>{Kg.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,s)=>gy(e,r,n,s)});Gk=Vh,Nk=Bh;jk=(...e)=>Wh({Codec:za,Boolean:Ho,String:Uo},...e)});function ML(e){ze({customError:e})}function GL(){return ze().customError}var FL,jb,Vk=C(()=>{qt();FL={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"};jb||(jb={})});var Va={};ne(Va,{ZodISODate:()=>An,ZodISODateTime:()=>$n,ZodISODuration:()=>xn,ZodISOTime:()=>On,date:()=>UL,datetime:()=>NL,duration:()=>zL,time:()=>jL});function NL(e){return Ea($n,e)}function UL(e){return Pa(An,e)}function jL(e){return Ca(On,e)}function zL(e){return Ta(xn,e)}var lp=C(()=>{qt();In();In()});function VL(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function Bk(e,t){return e.map((r,n)=>n<t?r:r.optional())}function BL(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function WL(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let n=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let s=r[1]===void 0?void 0:BL(r[1]);if(!s||!t.defs[s])throw new Error(`Reference not found: ${e}`);return t.defs[s]}throw new Error(`Reference not found: ${e}`)}function qL(e,t){return V.transform(n=>n).check(n=>{let s=n.value;if(!(typeof s!="object"||s===null||Array.isArray(s)))for(let o of Object.getOwnPropertyNames(s)){let i=t.safeParse(o);i.success||n.issues.push({code:"invalid_key",origin:"record",issues:i.error.issues,input:o,path:[o],continue:!0})}}).pipe(e)}function Wk(e,t){if(e!==!1)return e===void 0||e===!0?V.any():Dt(e,t)}function qk(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return V.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 s=e.$ref;if(t.refs.has(s))return t.refs.get(s);if(t.processing.has(s))return V.lazy(()=>{if(!t.refs.has(s))throw new Error(`Circular reference not resolved: ${s}`);return t.refs.get(s)});t.processing.add(s);let o=WL(s,t),i=Dt(o,t);return t.refs.set(s,i),t.processing.delete(s),i}if(e.enum!==void 0){let s=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&s.length===1&&s[0]===null)return V.null();if(s.length===0)return V.never();if(s.length===1)return V.literal(s[0]);if(s.every(i=>typeof i=="string"))return V.enum(s);let o=s.map(i=>V.literal(i));return o.length<2?o[0]:V.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return V.literal(e.const);let r=e.type;if(Array.isArray(r)){let s=r.map(o=>{let i={...e,type:o};return qk(i,t)});return s.length===0?V.never():s.length===1?s[0]:V.union(s)}if(!r)return V.any();let n;switch(r){case"string":{let s=V.string();if(e.format){let o=e.format;o==="email"?s=s.check(V.email()):o==="uri"||o==="uri-reference"?s=s.check(V.url()):o==="uuid"||o==="guid"?s=s.check(V.uuid()):o==="date-time"?s=s.check(V.iso.datetime({offset:!0})):o==="date"?s=s.check(V.iso.date()):o==="time"?s=s.check(V.regex(ZL)):o==="duration"?s=s.check(V.iso.duration()):o==="hostname"?s=s.check(V.hostname()):o==="ipv4"?s=s.check(V.ipv4()):o==="ipv6"?s=s.check(V.ipv6()):o==="mac"?s=s.check(V.mac()):o==="cidr"?s=s.check(V.cidrv4()):o==="cidr-v6"?s=s.check(V.cidrv6()):o==="base64"?s=s.check(V.base64()):o==="base64url"?s=s.check(V.base64url()):o==="e164"?s=s.check(V.e164()):o==="credit_card"?s=s.check(V.creditCard()):o==="jwt"?s=s.check(V.jwt()):o==="emoji"?s=s.check(V.emoji()):o==="nanoid"?s=s.check(V.nanoid()):o==="cuid"?s=s.check(V.cuid()):o==="cuid2"?s=s.check(V.cuid2()):o==="ulid"?s=s.check(V.ulid()):o==="xid"?s=s.check(V.xid()):o==="ksuid"&&(s=s.check(V.ksuid()))}typeof e.minLength=="number"&&(s=s.min(e.minLength)),typeof e.maxLength=="number"&&(s=s.max(e.maxLength)),e.pattern&&(s=s.regex(new RegExp(e.pattern))),n=s;break}case"number":case"integer":{let s=r==="integer"?V.number().int():V.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(s=s.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(s=s.max(e.maximum)),typeof e.exclusiveMinimum=="number"?s=s.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(s=s.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?s=s.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(s=s.lt(e.maximum)),typeof e.multipleOf=="number"&&(s=s.multipleOf(e.multipleOf)),n=s;break}case"boolean":{n=V.boolean();break}case"null":{n=V.null();break}case"object":{let s={},o=e.properties||{},i=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?Dt(e.additionalProperties,t):void 0;for(let[c,l]of Object.entries(o)){let p=Dt(l,t);je(s,c,i.has(c)?p:p.optional())}if(e.patternProperties){let c=e.patternProperties,l=Object.keys(c),p=[];for(let m of l){let f=Dt(c[m],t),g=V.string().regex(new RegExp(m));p.push(V.looseRecord(g,f))}let d=[];if(Object.keys(s).length>0&&d.push(V.object(s).passthrough()),d.push(...p),d.length===0)n=V.object({}).passthrough();else if(d.length===1)n=d[0];else{let m=V.intersection(d[0],d[1]);for(let f=2;f<d.length;f++)m=V.intersection(m,d[f]);n=m}if(e.additionalProperties===!1){let m=Object.keys(s),f=l.map(h=>new RegExp(h)),g=n;n=n.check(h=>{if(!rr(h.value))return;let w=[];for(let v of Object.keys(h.value))m.includes(v)||f.some(R=>R.test(v))||w.push(v);w.length&&h.issues.push({code:"unrecognized_keys",keys:w,input:h.value,inst:g})})}}else{let c=V.object(s);e.additionalProperties===!1?n=c.strict():a?n=c.catchall(a):n=c.passthrough()}if(e.propertyNames!==void 0&&e.propertyNames!==!0){let c=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;n=qL(n,Dt(c,t))}break}case"array":{let s=e.prefixItems,o=e.items;if(s&&Array.isArray(s)){let i=typeof e.minItems=="number"?e.minItems:0,a=s.map(d=>Dt(d,t)),c=Bk(a,i),l=Array.isArray(o)?void 0:Wk(o,t),p=V.tuple(c);n=l?p.rest(l):p,typeof e.minItems=="number"&&(n=n.check(V.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(V.maxLength(e.maxItems)))}else if(Array.isArray(o)){let i=typeof e.minItems=="number"?e.minItems:0,a=o.map(d=>Dt(d,t)),c=Bk(a,i),l=Wk(e.additionalItems,t),p=V.tuple(c);n=l?p.rest(l):p,typeof e.minItems=="number"&&(n=n.check(V.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(V.maxLength(e.maxItems)))}else if(o!==void 0){let i=Dt(o,t),a=V.array(i);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),n=a}else n=V.array(V.any());break}default:throw new Error(`Unsupported type: ${r}`)}return n}function Dt(e,t){if(typeof e=="boolean")return e?V.any():V.never();let r=qk(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(l=>Dt(l,t)),c=V.union(a);r=n?V.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(l=>Dt(l,t)),c=V.xor(a);r=n?V.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:V.any();else{let a=n?r:Dt(e.allOf[0],t),c=n?0:1;for(let l=c;l<e.allOf.length;l++)a=V.intersection(a,Dt(e.allOf[l],t));r=a}e.nullable===!0&&t.version==="openapi-3.0"&&(r=V.nullable(r)),e.readOnly===!0&&(r=V.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let s={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of o)a in e&&(s[a]=e[a]);let i=["contentEncoding","contentMediaType","contentSchema"];for(let a of i)a in e&&(s[a]=e[a]);e.propertyNames!==void 0&&e.type==="object"&&e.$ref===void 0&&(s.propertyNames=e.propertyNames);for(let a of Object.keys(e))HL.has(a)||je(s,a,e[a]);return Object.keys(s).length>0&&t.registry.add(r,s),e.description&&(r=r.describe(e.description)),r}function Zk(e,t){if(typeof e=="boolean")return e?V.any():V.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=VL(r,t?.defaultTarget),s=r.$defs||r.definitions||{},o={version:n,defs:s,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??ct};return Dt(r,o)}var V,HL,ZL,Jk=C(()=>{va();Je();Fl();lp();In();V={...Wo,...Ll,iso:Va},HL=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"]);ZL=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/});function Ba(e,t){let r=typeof t=="function"?t:(i,a)=>{let c=t[i._zod.def.type];return c?c(i,a):i},n=new Map;function s(i){let a=n.get(i);if(a===Kk)return new wa({type:"lazy",getter:()=>n.get(i)});if(a!==void 0)return a;n.set(i,Kk);let c=o(i),l=r(c,c!==i);return n.set(i,l),l}function o(i){let a=i._zod.def,c=a.type;switch(c){case"object":{let l=a.shape,p=Object.keys(l),d=!1,m={};for(let g of p){let h=s(l[g]);h!==l[g]&&(d=!0),m[g]=h}let f=a.catchall;return a.catchall&&(f=s(a.catchall),f!==a.catchall&&(d=!0)),d?Pe(i,{...a,shape:m,catchall:f}):i}case"array":{let l=s(a.element);return l===a.element?i:Pe(i,{...a,element:l})}case"tuple":{let l=a.items,p=!1,d=[];for(let f of l){let g=s(f);g!==f&&(p=!0),d.push(g)}let m=a.rest;return a.rest&&(m=s(a.rest),m!==a.rest&&(p=!0)),p?Pe(i,{...a,items:d,rest:m}):i}case"record":case"map":{let l=s(a.keyType),p=s(a.valueType);return l===a.keyType&&p===a.valueType?i:Pe(i,{...a,keyType:l,valueType:p})}case"set":{let l=s(a.valueType);return l===a.valueType?i:Pe(i,{...a,valueType:l})}case"union":{let l=a.options,p=!1,d=[];for(let m of l){let f=s(m);f!==m&&(p=!0),d.push(f)}return p?Pe(i,{...a,options:d}):i}case"intersection":{let l=s(a.left),p=s(a.right);return l===a.left&&p===a.right?i:Pe(i,{...a,left:l,right:p})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let l=s(a.innerType);return l===a.innerType?i:Pe(i,{...a,innerType:l})}case"pipe":{let l=s(a.in),p=s(a.out);return l===a.in&&p===a.out?i:Pe(i,{...a,in:l,out:p})}case"function":{let l=s(a.input),p=s(a.output);return l===a.input&&p===a.output?i:Pe(i,{...a,input:l,output:p})}case"lazy":{let l=a.getter,{_cachedInner:p,...d}=a;return Pe(i,{...d,getter:()=>s(l())})}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 i;default:return i}}return s(e)}var Kk,zb=C(()=>{_a();Je();Kk=Symbol("z.visit/resolving")});function Yk(e){return Ba(e,{object:t=>t.partial(),union:t=>{let r=t._zod.def;return r.discriminator===void 0?t:Bo(r.options)}})}var Qk=C(()=>{zb();In()});function JL(e,t){if(!t?.length)return e;let r=e._zod.def;return Pe(e,lr(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function Xk(e){return JL(e.out,e.checks)}function KL(e){return e.in._zod.traits.has("$ZodTransform")?Xk(e):e.in}function eE(e){return Ba(e,{pipe:t=>KL(t._zod.def),default:(t,r)=>r?ys(t._zod.def.innerType):t,catch:(t,r)=>r?t._zod.def.innerType:t})}function tE(e){return Ba(e,{pipe:t=>Xk(t._zod.def),prefault:(t,r)=>r?t._zod.def.innerType:t})}var rE=C(()=>{Je();zb();In()});var Hb={};ne(Hb,{bigint:()=>eF,boolean:()=>XL,date:()=>tF,number:()=>QL,string:()=>YL});function YL(e){return dh(Uo,e)}function QL(e){return yh(zo,e)}function XL(e){return kh(Ho,e)}function eF(e){return Ph(Vo,e)}function tF(e){return Mh(Fa,e)}var nE=C(()=>{qt();In()});var u={};ne(u,{$brand:()=>$m,$input:()=>oh,$output:()=>sh,NEVER:()=>Tm,TimePrecision:()=>gh,ZodAny:()=>nb,ZodArray:()=>ab,ZodBase64:()=>ep,ZodBase64URL:()=>tp,ZodBigInt:()=>Vo,ZodBigIntFormat:()=>sp,ZodBoolean:()=>Ho,ZodCIDRv4:()=>Ql,ZodCIDRv6:()=>Xl,ZodCUID:()=>Bl,ZodCUID2:()=>Wl,ZodCatch:()=>Tb,ZodCodec:()=>za,ZodCompileAsyncError:()=>pr,ZodCompileUnsupportedError:()=>ye,ZodCreditCard:()=>Ky,ZodCustom:()=>Ha,ZodCustomStringFormat:()=>jo,ZodDate:()=>Fa,ZodDefault:()=>Sb,ZodDiscriminatedUnion:()=>ub,ZodE164:()=>rp,ZodEmail:()=>jl,ZodEmoji:()=>Hl,ZodEnum:()=>No,ZodError:()=>IL,ZodExactOptional:()=>cp,ZodFile:()=>bb,ZodFirstPartyTypeKind:()=>jb,ZodFunction:()=>Gb,ZodGUID:()=>zl,ZodIPv4:()=>Kl,ZodIPv6:()=>Yl,ZodISODate:()=>An,ZodISODateTime:()=>$n,ZodISODuration:()=>xn,ZodISOTime:()=>On,ZodIntersection:()=>lb,ZodIssueCode:()=>FL,ZodJWT:()=>np,ZodKSUID:()=>Jl,ZodLazy:()=>Lb,ZodLiteral:()=>yb,ZodMAC:()=>Jy,ZodMap:()=>gb,ZodNaN:()=>Ab,ZodNanoID:()=>Vl,ZodNever:()=>ob,ZodNonOptional:()=>up,ZodNull:()=>tb,ZodNullable:()=>Rb,ZodNumber:()=>zo,ZodNumberFormat:()=>ws,ZodObject:()=>Ga,ZodOptional:()=>Ua,ZodPipe:()=>ja,ZodPrefault:()=>kb,ZodPreprocess:()=>Ob,ZodPromise:()=>Mb,ZodReadonly:()=>xb,ZodRealError:()=>It,ZodRecord:()=>Go,ZodSet:()=>hb,ZodString:()=>Uo,ZodStringFormat:()=>Oe,ZodSuccess:()=>Cb,ZodSymbol:()=>Xy,ZodTemplateLiteral:()=>Db,ZodTransform:()=>wb,ZodTuple:()=>db,ZodType:()=>le,ZodULID:()=>ql,ZodURL:()=>La,ZodUUID:()=>Cr,ZodUndefined:()=>eb,ZodUnion:()=>Na,ZodUnknown:()=>sb,ZodVoid:()=>ib,ZodXID:()=>Zl,ZodXor:()=>cb,_ZodString:()=>Ul,_default:()=>vb,_function:()=>Lk,any:()=>dk,array:()=>Ma,base64:()=>Zv,base64url:()=>Jv,bigint:()=>ak,boolean:()=>Qy,catch:()=>$b,check:()=>Fk,cidrv4:()=>Wv,cidrv6:()=>qv,clone:()=>Pe,codec:()=>Ok,coerce:()=>Hb,compile:()=>uh,config:()=>ze,core:()=>Kr,creditCard:()=>Yv,cuid:()=>Gv,cuid2:()=>Nv,custom:()=>Mk,date:()=>fk,decode:()=>jy,decodeAsync:()=>Hy,deepPartial:()=>Yk,describe:()=>Gk,discriminatedUnion:()=>_k,e164:()=>Kv,email:()=>Tv,emoji:()=>Fv,encode:()=>Uy,encodeAsync:()=>zy,endsWith:()=>$o,enum:()=>ip,exactOptional:()=>_b,file:()=>Ck,flattenError:()=>ua,float32:()=>nk,float64:()=>sk,formatError:()=>la,fromJSONSchema:()=>Zk,function:()=>Lk,getDiscriminatedOption:()=>Cg,getErrorMap:()=>GL,globalRegistry:()=>ct,gt:()=>Er,gte:()=>Wt,guid:()=>$v,hash:()=>rk,hex:()=>tk,hostname:()=>ek,httpUrl:()=>Lv,includes:()=>Co,input:()=>eE,instanceof:()=>Uk,int:()=>Gl,int32:()=>ok,int64:()=>ck,intersection:()=>pb,invertCodec:()=>xk,ipv4:()=>Hv,ipv6:()=>Bv,iso:()=>Va,json:()=>zk,jwt:()=>Qv,keyof:()=>gk,ksuid:()=>zv,lazy:()=>Fb,length:()=>gs,literal:()=>Pk,locales:()=>Sa,looseObject:()=>bk,looseRecord:()=>Sk,lowercase:()=>Eo,lt:()=>kr,lte:()=>Bt,mac:()=>Vv,map:()=>vk,maxLength:()=>fs,maxSize:()=>En,memoizer:()=>Ra,meta:()=>Nk,mime:()=>Ao,minLength:()=>Jr,minSize:()=>Pr,multipleOf:()=>kn,nan:()=>Ak,nanoid:()=>Mv,nativeEnum:()=>Ek,negative:()=>El,never:()=>op,nonnegative:()=>Cl,nonoptional:()=>Pb,nonpositive:()=>Pl,normalize:()=>Oo,null:()=>rb,nullable:()=>Da,nullish:()=>Tk,number:()=>Yy,object:()=>hk,optional:()=>ys,output:()=>tE,overwrite:()=>dr,parse:()=>Fy,parseAsync:()=>My,partialRecord:()=>Rk,pipe:()=>Nl,positive:()=>kl,prefault:()=>Eb,preprocess:()=>Hk,prettifyError:()=>Dm,promise:()=>Dk,properties:()=>$l,property:()=>Tl,readonly:()=>Ib,record:()=>fb,refine:()=>Nb,regex:()=>ko,regexes:()=>bt,registry:()=>tl,safeDecode:()=>By,safeDecodeAsync:()=>qy,safeEncode:()=>Vy,safeEncodeAsync:()=>Wy,safeParse:()=>Gy,safeParseAsync:()=>Ny,set:()=>kk,setErrorMap:()=>ML,size:()=>ms,slugify:()=>Lo,startsWith:()=>To,strictObject:()=>yk,string:()=>Ia,stringFormat:()=>Xv,stringbool:()=>jk,success:()=>$k,superRefine:()=>Ub,symbol:()=>lk,templateLiteral:()=>Ik,toJSONSchema:()=>Il,toLowerCase:()=>Io,toUpperCase:()=>Do,toZod:()=>ea,transform:()=>ap,treeifyError:()=>Im,trim:()=>xo,tuple:()=>mb,uint32:()=>ik,uint64:()=>uk,ulid:()=>Uv,undefined:()=>pk,union:()=>Bo,unknown:()=>hs,uppercase:()=>Po,url:()=>Dv,util:()=>Y,uuid:()=>Av,uuidv4:()=>Ov,uuidv6:()=>xv,uuidv7:()=>Iv,validate:()=>Gm,validateAsync:()=>Nm,void:()=>mk,xid:()=>jv,xor:()=>wk});var Vb=C(()=>{qt();In();Fl();Ly();Zy();Vk();qt();xa();Jk();Qk();rE();nh();lp();lp();nE()});var Wa=C(()=>{Vb();Vb()});var rF,Wb,qb,Zb,Jb,nF,sF,oF,iF,aF,cF,uF,lF,pF,dF,sE,mF,pp,fF,gF,hF,yF,bF,Bb,wF,_F,RF,SF,Kb,Yb,Lt,Dn=C(()=>{"use strict";Wa();rF=u.enum(["candidate","claimed","in_progress","pr_submitted"]),Wb=u.enum(["needs_addressing","waiting_on_maintainer"]),qb=u.enum(["nonprofit","devtools","infrastructure","web-frameworks","data-ml","education"]),Zb=u.enum(["beginner","intermediate","advanced"]),Jb=u.enum(["inline","sourcetree","vscode","custom"]),nF=u.object({hasActiveMaintainers:u.boolean(),isResponsive:u.boolean(),hasHostileComments:u.boolean()}),sF=u.object({repo:u.string(),score:u.number(),mergedPRCount:u.number(),closedWithoutMergeCount:u.number(),avgResponseDays:u.number().nullable(),lastMergedAt:u.string().optional(),lastEvaluatedAt:u.string(),signals:nF,stargazersCount:u.number().optional(),language:u.string().nullable().optional()}),oF=u.object({url:u.string(),title:u.string(),mergedAt:u.string(),openedAt:u.string().optional(),firstMaintainerResponseAt:u.string().optional(),commentsFetchedAt:u.string().datetime().optional(),learningsExtractedAt:u.string().datetime().optional()}),iF=u.object({url:u.string(),title:u.string(),closedAt:u.string(),openedAt:u.string().optional(),firstMaintainerResponseAt:u.string().optional(),commentsFetchedAt:u.string().datetime().optional(),learningsExtractedAt:u.string().datetime().optional()}),aF=u.object({url:u.string(),repo:u.string(),analyzedAt:u.string()}),cF=u.object({tier:u.enum(["light_check_in","direct_check_in","final_check_in"]),timestamp:u.string().datetime(),draftPath:u.string().optional()}),uF=u.object({workflowName:u.enum(["draft-first","work-through-issues","pre-commit-review"]),currentStep:u.string(),branchName:u.string().optional(),issueContext:u.object({title:u.string(),url:u.string()}).optional(),completedSteps:u.array(u.string()).default([]),stepData:u.record(u.string(),u.unknown()).default({}),lastUpdatedAt:u.string().datetime()}),lF=u.object({branchNamingConvention:u.string().optional(),commitMessageFormat:u.string().optional(),prTitleFormat:u.string().optional(),requiredChecks:u.array(u.string()).optional(),testFramework:u.string().optional(),testCoverageRequired:u.boolean().optional(),testFileNaming:u.string().optional(),linter:u.string().optional(),formatter:u.string().optional(),styleGuideUrl:u.string().optional(),issueClaimProcess:u.string().optional(),reviewProcess:u.string().optional(),claRequired:u.boolean().optional(),rawContent:u.string().optional()}),pF=u.object({passedAllChecks:u.boolean(),checks:u.object({noExistingPR:u.boolean(),notClaimed:u.boolean(),projectActive:u.boolean(),clearRequirements:u.boolean(),contributionGuidelinesFound:u.boolean()}),contributionGuidelines:lF.optional(),notes:u.array(u.string())}),dF=u.object({id:u.number(),url:u.string(),repo:u.string(),number:u.number(),title:u.string(),status:rF,labels:u.array(u.string()),createdAt:u.string(),updatedAt:u.string(),vetted:u.boolean(),vettingResult:pF.optional()}),sE=u.object({number:u.number(),url:u.string(),title:u.string(),repo:u.string(),daysSinceActivity:u.number(),status:Wb}),mF=u.object({status:Wb,setAt:u.string(),lastActivityAt:u.string()}),pp=u.object({setupComplete:u.boolean().default(!1),setupCompletedAt:u.string().optional(),persistence:u.enum(["local","gist"]).default("local"),maxActivePRs:u.number().default(10),dormantThresholdDays:u.number().default(30),approachingDormantDays:u.number().default(25),maxIssueAgeDays:u.number().default(90),skipBroadWhenSufficientResults:u.number().min(0).default(8),languages:u.array(u.string()).default(["typescript","javascript"]),labels:u.array(u.string()).default(["good first issue","help wanted"]),scope:u.array(Zb).optional(),excludeRepos:u.array(u.string()).default([]),excludeOrgs:u.array(u.string()).optional(),avoidRepos:u.array(u.string()).default([]),boostIssueTypes:u.array(u.string()).default([]),trustedProjects:u.array(u.string()).default([]),githubUsername:u.string().default(""),minRepoScoreThreshold:u.number().default(4),starredRepos:u.array(u.string()).default([]),starredReposLastFetched:u.string().optional(),squashByDefault:u.union([u.boolean(),u.literal("ask")]).default(!0),localRepoScanPaths:u.array(u.string()).optional(),minStars:u.number().default(50),includeDocIssues:u.boolean().default(!0),aiPolicyBlocklist:u.array(u.string()).default(["matplotlib/matplotlib"]),shelvedPRUrls:u.array(u.string()).default([]),dismissedIssues:u.record(u.string(),u.string()).default({}),statusOverrides:u.record(u.string(),mF).optional(),issueListPath:u.string().optional(),skippedIssuesPath:u.string().optional(),projectCategories:u.array(qb).default([]),preferredOrgs:u.array(u.string()).default([]),diffTool:Jb.default("inline"),diffToolCustomCommand:u.string().optional(),autoExtractLearnings:u.boolean().default(!0),autoFormatBeforePush:u.boolean().default(!1),trustOwnRepoWrites:u.boolean().default(!1),healthCheckFreshnessMinutes:u.number().int().positive().default(30),reviewMaxPasses:u.number().int().positive().optional(),slmTriageModel:u.string().default(""),slmTriageHost:u.string().default("")}),fF=u.object({repos:u.record(u.string(),u.object({path:u.string(),exists:u.boolean(),currentBranch:u.string().nullable()})),scanPaths:u.array(u.string()),cachedAt:u.string()}),gF=u.object({url:u.string(),repo:u.string(),number:u.number(),title:u.string(),closedAt:u.string(),closedBy:u.string().optional(),openedAt:u.string().optional()}),hF=u.object({url:u.string(),repo:u.string(),number:u.number(),title:u.string(),mergedAt:u.string(),openedAt:u.string().optional()}),yF=u.object({totalActivePRs:u.number(),totalNeedingAttention:u.number(),totalMergedAllTime:u.number(),mergeRate:u.number()}),bF=u.object({url:u.string(),repo:u.string(),number:u.number(),status:Wb}).passthrough(),Bb=u.array(bF),wF=u.object({generatedAt:u.string(),openPRs:Bb,needsAddressingPRs:Bb,waitingOnMaintainerPRs:Bb,recentlyClosedPRs:u.array(gF),recentlyMergedPRs:u.array(hF),shelvedPRs:u.array(sE),autoUnshelvedPRs:u.array(sE),summary:yF}),_F=u.object({url:u.string(),lastSeenAt:u.string()}),RF=u.object({url:u.string(),branch:u.string(),worktree:u.string().optional(),note:u.string().optional(),recordedAt:u.string(),pushedRef:u.string().optional(),pushedAt:u.string().optional(),compareUrl:u.string().optional(),pushProblem:u.string().optional()}),SF=u.object({url:u.string(),attemptedAt:u.string(),outcome:u.enum(["prepared","blocked"]),note:u.string().optional()}),Kb=u.object({runAt:u.string(),reportPath:u.string(),prepareCount:u.number().int().nonnegative(),judgmentCount:u.number().int().nonnegative(),prepared:u.array(RF).default([]),implementUrl:u.string().optional(),implementAttempts:u.array(SF).optional()}),Yb=u.object({languageOffset:u.number().int().nonnegative().default(0),phase0Offset:u.number().int().nonnegative().default(0),starredOffset:u.number().int().nonnegative().default(0),maintainedOffset:u.number().int().nonnegative().default(0),strategyOffset:u.number().int().nonnegative().default(0),lastRotatedAt:u.string().optional()}),Lt=u.object({version:u.literal(4),gistId:u.string().optional(),repoScores:u.record(u.string(),sF).default({}),config:pp.default(()=>pp.parse({})),lastRunAt:u.string().default(()=>new Date().toISOString()),lastDigestAt:u.string().optional(),lastStrategyAt:u.string().optional(),lastDigest:wF.optional(),monthlyMergedCounts:u.record(u.string(),u.number()).optional(),monthlyClosedCounts:u.record(u.string(),u.number()).optional(),monthlyOpenedCounts:u.record(u.string(),u.number()).optional(),localRepoCache:fF.optional(),mergedPRs:u.array(oF).optional(),closedPRs:u.array(iF).optional(),analyzedIssueConversations:u.array(aF).optional(),activeIssues:u.array(dF).default([]),prFollowUpHistory:u.record(u.string(),u.array(cF)).optional(),workflowState:uF.optional(),searchSeen:u.array(_F).default([]),lastOvernight:Kb.optional(),searchRotation:Yb.optional()})});function sr(){let e=Ft.join(Qb.homedir(),".oss-autopilot");return Rt.existsSync(e)||Rt.mkdirSync(e,{recursive:!0,mode:448}),e}function St(){return Ft.join(sr(),"state.json")}function oE(){return Ft.join(process.cwd(),"data","state.json")}function iE(){return Ft.join(process.cwd(),"data","backups")}function _s(){let e=Ft.join(sr(),"backups");return Rt.existsSync(e)||Rt.mkdirSync(e,{recursive:!0,mode:448}),e}function dp(){let e=Ft.join(sr(),"cache");return Rt.existsSync(e)||Rt.mkdirSync(e,{recursive:!0,mode:448}),e}function qo(){let e=Ft.join(sr(),"reports");return Rt.existsSync(e)||Rt.mkdirSync(e,{recursive:!0,mode:448}),e}function Rs(){return Ft.join(sr(),"gist-id")}function Ln(){return Ft.join(sr(),"state-cache.json")}function mp(){let e=Ft.join(Qb.homedir(),".oss-autopilot","state.json");return Rt.existsSync(e)}function Tr(){return"3.29.2"}var Rt,Ft,Qb,Yr=C(()=>{"use strict";Rt=H(require("node:fs"),1),Ft=H(require("node:path"),1),Qb=H(require("node:os"),1)});function gp(){fp=!0}function aE(){return fp}function I(e,t,...r){if(!fp)return;let n=new Date().toISOString();console.error(`[${n}] [DEBUG] [${e}] ${t}`,...r)}function cE(e,t,...r){let n=new Date().toISOString();console.error(`[${n}] [INFO] [${e}] ${t}`,...r)}function _(e,t,...r){let n=new Date().toISOString();console.error(`[${n}] [WARN] [${e}] ${t}`,...r)}async function hp(e,t,r){if(!fp)return r();let n=performance.now();try{let s=await r(),o=(performance.now()-n).toFixed(0);return I(e,`${t} completed in ${o}ms`),s}catch(s){let o=(performance.now()-n).toFixed(0);throw I(e,`${t} failed after ${o}ms`),s}}var fp,de=C(()=>{"use strict";fp=!1});function Za(e){if(process.env[yp]!==void 0)throw new Ge(`Refusing to ${e} during an unattended run (${yp} is set). Run it yourself in an interactive session.`)}function A(e){return e instanceof Error?e.message:String(e)}function Ye(e){if(e&&typeof e=="object"&&"status"in e){let t=e.status;return typeof t=="number"&&Number.isFinite(t)?t:void 0}}function Mt(e){let t=Ye(e);return t===429?!0:t===403?A(e).toLowerCase().includes("rate limit"):!1}function uE(e){if(Ye(e)!==422)return!1;let t=e?.response?.data,r=t&&typeof t=="object"?t.errors:void 0;return Array.isArray(r)?r.some(n=>{if(!n||typeof n!="object")return!1;let s=n;return s.resource!=="Search"||s.code!=="invalid"?!1:typeof s.message=="string"?Xb.test(s.message):Xb.test(A(e))}):Xb.test(A(e))}function Le(e){let t=Ye(e);if(t===401||t===429)return!0;if(t===403){let r=A(e).toLowerCase();return r.includes("rate limit")||r.includes("abuse detection")}return!1}function lE(e){if(!e||typeof e!="object")return!1;let t=Ye(e);if(typeof t=="number"&&t>=500&&t<600)return!0;let r=e.code;if(typeof r=="string"&&(r==="ECONNRESET"||r==="ETIMEDOUT"||r==="ENETUNREACH"||r==="ENOTFOUND"||r==="ECONNREFUSED"||r==="EAI_AGAIN"))return!0;let n=e.name;return typeof n=="string"&&(n==="AbortError"||n==="TimeoutError")}function pE(e){return t=>{if(Le(t))throw t;return _(e.module,`Failed to ${e.label}: ${A(t)}`),e.fallback}}function bp(e){if(e instanceof Ge)return"CONFIGURATION";if(e instanceof W)return"VALIDATION";if(e instanceof mr||e instanceof $r)return"CONCURRENCY";let t=Ye(e);if(t===401)return"AUTH_REQUIRED";if(t===403){let n=A(e).toLowerCase();return n.includes("rate limit")||n.includes("abuse detection")?"RATE_LIMITED":"AUTH_REQUIRED"}if(t===404)return"NOT_FOUND";if(t===429)return"RATE_LIMITED";let r=A(e).toLowerCase();return r.includes("enotfound")||r.includes("econnrefused")||r.includes("econnreset")||r.includes("etimedout")||r.includes("fetch failed")?"NETWORK":r.includes("state")&&(r.includes("corrupt")||r.includes("invalid"))?"STATE_CORRUPTED":"UNKNOWN"}var or,Ge,yp,W,Zo,qa,mr,$r,Xb,ie=C(()=>{"use strict";de();or=class extends Error{constructor(r,n){super(r);this.code=n;this.name="OssAutopilotError"}code},Ge=class extends or{constructor(t){super(t,"CONFIGURATION_ERROR"),this.name="ConfigurationError"}},yp="OSS_AUTOPILOT_UNATTENDED";W=class extends or{constructor(t){super(t,"VALIDATION_ERROR"),this.name="ValidationError"}},Zo=class extends Ge{constructor(t){super(t??'Your GitHub token does not have Gist permissions. Run `gh auth refresh -s gist` to add the required scope, or create a token with the "gist" scope.'),this.name="GistPermissionError"}},qa=class extends Ge{constructor(r,n,s){let o=s instanceof Error?s.message:String(s),i=n?`
59
59
  Corrupt content preserved at: ${n}
60
60
  Inspect or restore manually, then re-run. Falling back to a fresh state would overwrite your Gist.`:`
61
61
  Could not preserve the rejected content; do not push without inspecting the Gist manually.`;super(`Gist ${r} state.json is corrupt or fails schema validation: ${o}${i}`);this.gistId=r;this.rejectedPath=n;this.cause=s;this.name="GistCorruptError"}gistId;rejectedPath;cause},mr=class extends or{constructor(r,n){super("Another oss-autopilot process wrote state.json concurrently. Re-run the command to retry \u2014 the last write wins and no data was lost from the other process.","CONCURRENCY_ERROR");this.expectedMtimeMs=r;this.actualMtimeMs=n;this.name="ConcurrencyError"}expectedMtimeMs;actualMtimeMs},$r=class extends or{constructor(r,n){super("Another machine pushed to the state Gist while this push was in flight, and the merge attempt also collided. Re-run `oss-autopilot state --sync` to retry \u2014 your local mutations are still in memory.","CONCURRENCY_ERROR");this.expectedEtag=r;this.remoteEtag=n;this.name="GistConcurrencyError"}expectedEtag;remoteEtag};Xb=/users.*do not exist|cannot be searched/i});function kF(e){try{let t=JSON.parse(te.readFileSync(e,"utf8"));return Date.now()-t.timestamp>vF}catch(t){return I(X,"Lock file unreadable or invalid JSON, treating as stale",t),!0}}function fE(e){let t=JSON.stringify({pid:process.pid,timestamp:Date.now()});try{te.writeFileSync(e,t,{flag:"wx"});return}catch(r){I(X,"Lock file already exists, checking staleness",r)}if(!kF(e))throw new Error("State file is locked by another process");try{te.unlinkSync(e)}catch(r){I(X,"Stale lock already removed by another process",r)}try{te.writeFileSync(e,t,{flag:"wx"})}catch(r){throw I(X,"Lock re-acquire failed (race condition)",r),new Error("State file is locked by another process",{cause:r})}}function gE(e){try{JSON.parse(te.readFileSync(e,"utf8")).pid===process.pid&&te.unlinkSync(e)}catch(t){I(X,"Lock file already removed or unreadable during release",t)}}function ir(e,t,r){let n=e+".tmp";te.writeFileSync(n,t,{mode:r??384}),te.renameSync(n,e),r!==void 0&&te.chmodSync(e,r)}function Jo(e){I(X,"Migrating state from v1 to v2 (fresh GitHub fetching)...");let t=e.mergedPRs||[],r=e.closedPRs||[],n={...e.repoScores||{}};for(let o of[...t,...r])n[o.repo]||(n[o.repo]={repo:o.repo,score:5,mergedPRCount:0,closedWithoutMergeCount:0,avgResponseDays:null,lastEvaluatedAt:new Date().toISOString(),signals:{hasActiveMaintainers:!0,isResponsive:!1,hasHostileComments:!1}});let s={version:2,activeIssues:e.activeIssues||[],repoScores:n,config:e.config,lastRunAt:new Date().toISOString()};return I(X,`Migration complete. Preserved ${Object.keys(n).length} repo scores.`),s}function Ko(e){I(X,"Migrating state from v2 to v3 (drop dead fields, add learnings tracking)..."),delete e.events,delete e.dailyActivityCounts;let t=e.config;return t&&(delete t.showHealthCheck,delete t.scoreThreshold),e.version=3,I(X,"v2 to v3 migration complete."),e}function Yo(e){return I(X,"Migrating state from v3 to v4 (add commentsFetchedAt to stored PR records)..."),e.version=4,I(X,"v3 to v4 migration complete (no data transformation required)."),e}function Xr(){return Lt.parse({version:4})}function EF(){let e=St(),t=oE(),r=iE();if(te.existsSync(e)||!te.existsSync(t))return!1;I(X,"Migrating state from ./data/ to ~/.oss-autopilot/...");try{if(sr(),te.copyFileSync(t,e),I(X,`Migrated state file to ${e}`),te.existsSync(r)){let s=_s(),o=te.readdirSync(r).filter(i=>i.startsWith("state-")&&i.endsWith(".json"));for(let i of o){let a=Qr.join(r,i),c=Qr.join(s,i);te.copyFileSync(a,c)}I(X,`Migrated ${o.length} backup files`)}if(te.unlinkSync(t),I(X,"Removed legacy state file"),te.existsSync(r)){let s=te.readdirSync(r);for(let o of s)te.unlinkSync(Qr.join(r,o));te.rmdirSync(r)}let n=Qr.dirname(t);return te.existsSync(n)&&te.readdirSync(n).length===0&&(te.rmdirSync(n),I(X,"Removed empty legacy data directory")),I(X,"Migration complete!"),!0}catch(n){if(_(X,`Failed to migrate state: ${A(n)}`),te.existsSync(e)&&te.existsSync(t))try{te.unlinkSync(e),I(X,"Cleaned up partial migration - removed incomplete new state file")}catch(s){_(X,"Could not clean up partial migration file"),I(X,"Partial migration cleanup failed",s)}return _(X,"To resolve this issue:"),_(X," 1. Ensure you have write permissions to ~/.oss-autopilot/"),_(X," 2. Check available disk space"),_(X," 3. Manually copy ./data/state.json to ~/.oss-autopilot/state.json"),_(X," 4. Or delete ./data/state.json to start fresh"),!1}}function dE(){let e=_s();if(!te.existsSync(e))return null;let t=te.readdirSync(e).filter(r=>r.startsWith("state-")&&r.endsWith(".json")).sort().reverse();for(let r of t){let n=Qr.join(e,r);try{let s=te.readFileSync(n,"utf8"),o=JSON.parse(s);if(typeof o=="object"&&o!==null){let c=o;c.version===1&&(o=Jo(c)),o.version===2&&(o=Ko(o)),o.version===3&&(o=Yo(o))}let i=Lt.safeParse(o);if(i.success){let c=i.data;I(X,`Successfully restored state from backup: ${r}`);let l=Object.keys(c.repoScores).length;I(X,`Restored state v${c.version}: ${l} repo scores`);let p=St();return ir(p,JSON.stringify(c,null,2),384),I(X,"Restored backup written to main state file"),c}let a=i.error.issues.map(c=>`${c.path.join(".")}: ${c.message}`).join("; ");_(X,`Backup ${r} failed schema validation: ${a}`),I(X,`Backup ${r} full validation errors:`,i.error.issues)}catch(s){let o=s instanceof Error?s.message:String(s);_(X,`Backup ${r} is corrupted (${o}), trying next...`),I(X,`Backup ${r} parse failed`,s)}}return null}function mE(e){try{let t=e+".rejected-"+Date.now();return te.copyFileSync(e,t),_(X,`Previous state preserved at: ${t}`),t}catch(t){return _(X,`Could not preserve rejected state file: ${A(t)}`),null}}function wp(){EF();let e=St();try{if(te.existsSync(e)){let t=Ss(e),r=te.readFileSync(e,"utf8"),n=JSON.parse(r),s=!1;if(typeof n=="object"&&n!==null){let c=n;c.version===1&&(n=Jo(c),s=!0),n.version===2&&(n=Ko(n),s=!0),n.version===3&&(n=Yo(n),s=!0)}let o=Lt.safeParse(n);if(!o.success){let c=o.error.issues.map(m=>`${m.path.join(".")}: ${m.message}`).join("; ");_(X,`Invalid state file structure: ${c}`),_(X,"Attempting to restore from backup..."),I(X,"Full validation errors:",o.error.issues);let l=mE(e),p=`Invalid state file structure: ${c}`,d=dE();if(d){let m=Ss(e);return{state:d,mtimeMs:m,recovery:{source:"backup",rejectedPath:l,reason:p}}}return _(X,"No valid backup found, starting fresh"),{state:Xr(),mtimeMs:0,recovery:{source:"fresh",rejectedPath:l,reason:p}}}s&&(ir(e,JSON.stringify(o.data,null,2),384),t=Ss(e),I(X,"Migrated and validated state saved"));let i=o.data;try{let c=!1;if(i.config.dismissedIssues){let l=/\/pull\/\d+$/;for(let p of Object.keys(i.config.dismissedIssues))l.test(p)&&(delete i.config.dismissedIssues[p],c=!0)}c&&(ir(e,JSON.stringify(i,null,2),384),t=Ss(e),_(X,"Cleaned up dismissed PR URLs from persisted state"))}catch(c){_(X,`Failed to clean up removed features from state: ${A(c)}`)}let a=Object.keys(i.repoScores).length;return I(X,`Loaded state v${i.version}: ${a} repo scores tracked`),{state:i,mtimeMs:t}}}catch(t){let r=t?.code;if(r==="EACCES"||r==="EPERM")throw new Error(`Permission denied reading state file (${r}): ${A(t)}. This is an environment problem, not state corruption. Check the ownership and permissions of ~/.oss-autopilot/state.json (e.g. run \`ls -l ~/.oss-autopilot/state.json\` and fix with chown/chmod), then retry.`,{cause:t});_(X,"Error loading state:",t),_(X,"Attempting to restore from backup...");let n=te.existsSync(e)?mE(e):null,s=`Error loading state: ${A(t)}`,o=dE();if(o){let i=Ss(e);return{state:o,mtimeMs:i,recovery:{source:"backup",rejectedPath:n,reason:s}}}return _(X,"No valid backup found, starting fresh"),{state:Xr(),mtimeMs:0,recovery:{source:"fresh",rejectedPath:n,reason:s}}}return I(X,"No existing state found, initializing..."),{state:Xr(),mtimeMs:0}}function Ss(e){try{return te.statSync(e).mtimeMs}catch(t){return I(X,`Could not read state file mtime (reload detection will always trigger): ${A(t)}`),0}}function PF(){let e=_s();try{let t=te.readdirSync(e).filter(r=>r.startsWith("state-")).sort().reverse();for(let r of t.slice(10))try{te.unlinkSync(Qr.join(e,r))}catch(n){_(X,`Could not delete old backup ${r}:`,A(n))}}catch(t){_(X,"Could not clean up backups:",A(t))}}function hE(e,t=null){let r=St(),n=r+".lock",s=_s();fE(n);try{if(t!==null&&t>0&&te.existsSync(r)){let i=Ss(r);if(i!==t)throw new mr(t,i)}try{if(te.existsSync(r)){let i=new Date().toISOString().replace(/[.:]/g,"-"),a=Math.random().toString(36).slice(2,8).padEnd(6,"0"),c=Qr.join(s,`state-${i}-${a}.json`);te.copyFileSync(r,c),te.chmodSync(c,384),PF()}}catch(i){_(X,`Could not create backup before save: ${A(i)}`)}ir(r,JSON.stringify(e,null,2),384);let o=Ss(r);return I(X,"State saved successfully"),o}finally{gE(n)}}function yE(e){try{let t=St();if(te.statSync(t).mtimeMs===e)return null;let n=wp();if(n.recovery)try{n.mtimeMs=te.statSync(t).mtimeMs}catch(s){I(X,"Could not re-read mtime after reload (will retry next cycle)",s)}return n}catch(t){return _(X,`Failed to reload state from disk: ${A(t)}`),null}}var te,Qr,X,vF,Ja=C(()=>{"use strict";te=H(require("node:fs"),1),Qr=H(require("node:path"),1);Dn();Yr();ie();de();X="state",vF=3e4});function Ar(e,t){return e===void 0||e<t}var ew,CF,_p,vs,ks,TF,Fn=C(()=>{"use strict";Dn();ew=pp.parse({}),CF=Lt.parse({version:4}),_p=qb.options,vs=Zb.options,ks=Jb.options,TF={beginner:["good first issue","help wanted","easy","up-for-grabs","first-timers-only","beginner"],intermediate:["enhancement","feature","feature-request","contributions welcome"],advanced:["proposal","RFC","accepted","design"]}});function tw(e,t){return $F.test(e)&&AF.test(t)}function me(e){if(!e.startsWith("https://github.com/"))return null;let t=e.match(/github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/);if(t){let n=t[1],s=t[2];return tw(n,s)?{owner:n,repo:s,number:parseInt(t[3],10),type:"pull"}:null}let r=e.match(/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)/);if(r){let n=r[1],s=r[2];return tw(n,s)?{owner:n,repo:s,number:parseInt(r[3],10),type:"issues"}:null}return null}function Qo(e){if(!e.startsWith("https://github.com/"))return null;let t=e.match(/github\.com\/([^/]+)\/([^/]+)/);if(!t)return null;let r=t[1],n=t[2];return tw(r,n)?{owner:r,repo:n}:null}function Xo(e){let[t,r]=e.split("/");if(!t||!r)throw new Error(`Invalid repo format: expected "owner/repo", got "${e}"`);return{owner:t,repo:r}}function Or(e,t){return e.toLowerCase()===t.toLowerCase()}var $F,AF,Zt=C(()=>{"use strict";$F=/^[\w-]+$/,AF=/^[\w.-]+$/});function jF(e){return{repo:e,score:RE,mergedPRCount:0,closedWithoutMergeCount:0,avgResponseDays:null,lastEvaluatedAt:new Date().toISOString(),signals:{hasActiveMaintainers:!0,isResponsive:!1,hasHostileComments:!1}}}function zF(e){let t=RE;if(e.mergedPRCount>0){let r=Math.min(Math.round(Math.log2(e.mergedPRCount+1)*OF),xF);t+=r}if(t-=Math.min(e.closedWithoutMergeCount,IF),e.lastMergedAt){let r=new Date(e.lastMergedAt);isNaN(r.getTime())?_(Ka,`Invalid lastMergedAt date for ${e.repo}: "${e.lastMergedAt}". Skipping recency bonus.`):Math.floor((Date.now()-r.getTime())/864e5)<=DF&&(t+=LF)}return e.signals.isResponsive&&(t+=FF),e.signals.hasHostileComments&&(t-=MF),Math.max(GF,Math.min(NF,t))}function SE(e,t){return e.repoScores[t]}function bE(e){return JSON.stringify([e.mergedPRCount,e.closedWithoutMergeCount,e.avgResponseDays??null,e.lastMergedAt??null,e.signals.hasActiveMaintainers,e.signals.isResponsive,e.signals.hasHostileComments])}function ei(e,t,r){let n=!e.repoScores[t];n&&(e.repoScores[t]=jF(t));let s=e.repoScores[t],o=bE(s);r.mergedPRCount!==void 0&&(s.mergedPRCount=r.mergedPRCount),r.closedWithoutMergeCount!==void 0&&(s.closedWithoutMergeCount=r.closedWithoutMergeCount),r.avgResponseDays!==void 0&&(s.avgResponseDays=r.avgResponseDays),r.lastMergedAt!==void 0&&(s.lastMergedAt=r.lastMergedAt),r.stargazersCount!==void 0&&(s.stargazersCount=r.stargazersCount),r.language!==void 0&&(s.language=r.language),r.signals&&(s.signals={...s.signals,...r.signals}),s.score=zF(s),(n||bE(s)!==o)&&(s.lastEvaluatedAt=new Date().toISOString()),I(Ka,`Updated repo score for ${t}: ${s.score}/10`)}function vE(e,t){let r=(e.repoScores[t]?.mergedPRCount??0)+1;ei(e,t,{mergedPRCount:r,lastMergedAt:new Date().toISOString()})}function kE(e,t){let r=(e.repoScores[t]?.closedWithoutMergeCount??0)+1;ei(e,t,{closedWithoutMergeCount:r})}function EE(e,t){ei(e,t,{signals:{hasHostileComments:!0}})}function PE(e){return Object.values(e.repoScores).filter(t=>t.mergedPRCount>0).sort((t,r)=>r.mergedPRCount-t.mergedPRCount).map(t=>t.repo)}function CE(e){return Object.values(e.repoScores).filter(t=>t.mergedPRCount===0&&t.closedWithoutMergeCount===0).sort((t,r)=>r.score-t.score).map(t=>t.repo)}function TE(e,t){let r=t??e.config.minRepoScoreThreshold;return Object.values(e.repoScores).filter(n=>n.score>=r).sort((n,s)=>s.score-n.score).map(n=>n.repo)}function $E(e,t){let r=t??e.config.minRepoScoreThreshold,n=Date.now();return Object.values(e.repoScores).filter(s=>{if(s.score>r)return!1;let o=n-new Date(s.lastEvaluatedAt).getTime();return Number.isFinite(o)?o<=UF:(_(Ka,`Invalid lastEvaluatedAt for repo ${s.repo}: "${s.lastEvaluatedAt}", treating as stale`),!1)}).sort((s,o)=>s.score-o.score).map(s=>s.repo)}function wE(e){let t=new Map;for(let r of e){let n=me(r.url);if(!n){_(Ka,`Skipping PR with unparseable URL during reconciliation: "${r.url}"`);continue}let s=`${n.owner}/${n.repo}`;t.set(s,(t.get(s)??0)+1)}return t}function AE(e,t,r){let n=_E(e,wE(t),"mergedPRCount"),s=_E(e,wE(r),"closedWithoutMergeCount");return n||s}function _E(e,t,r){let n=!1;for(let[s,o]of t){let i=e.repoScores[s]?.[r]??0;o>i&&(I(Ka,`Reconciling ${s} ${r}: ${i} \u2192 ${o}`),ei(e,s,{[r]:o}),n=!0)}return n}function OE(e){let t=0,r=0,n=0;for(let i of Object.values(e.repoScores))Ar(i.stargazersCount,e.config.minStars??50)||(n++,t+=i.mergedPRCount,r+=i.closedWithoutMergeCount);let s=t+r,o=s>0?t/s*100:0;return{mergedPRs:t,closedPRs:r,activeIssues:0,trustedProjects:e.config.trustedProjects.length,mergeRate:o.toFixed(1)+"%",totalTracked:n,needsResponse:0}}var Ka,RE,OF,xF,IF,DF,LF,FF,MF,GF,NF,UF,xE=C(()=>{"use strict";Fn();de();Zt();Ka="scoring",RE=5,OF=2,xF=5,IF=3,DF=90,LF=1,FF=1,MF=2,GF=1,NF=10,UF=720*60*60*1e3});function IE(e){return e?e.etag??e.ETag??null:null}function rw(e,t){try{let r=`${Ln()}.rejected-${Date.now()}`;return xr.writeFileSync(r,e,{encoding:"utf8",mode:384}),r}catch(r){return _(Se,`Could not preserve rejected Gist content for ${t}: ${r instanceof Error?r.message:String(r)}`),null}}var xr,Se,nw,en,ti,sw=C(()=>{"use strict";xr=H(require("node:fs"),1);Dn();Ja();Yr();de();ie();Se="gist-store";nw="oss-autopilot-state",en="state.json",ti=class e{gistId=null;cachedFiles=new Map;dirtyFiles=new Set;baselineFiles=new Map;lastFetchedEtag=null;octokit;lastRefreshAt=0;static REFRESH_THROTTLE_MS=3e4;lastRefreshError=null;constructor(t){this.octokit=t}async bootstrap(){try{await this.checkGistScope();let t=this.readLocalGistId();if(t){I(Se,`Found local Gist ID: ${t}`);try{this.gistId=t;let o=await this.fetchAndCache(t);return{gistId:t,state:o,created:!1}}catch(o){if(o instanceof Ge||Mt(o))throw o;_(Se,`Failed to fetch Gist ${t}, will search/create`,o)}}let r=await this.searchForGist();if(r){I(Se,`Found Gist via search: ${r}`),this.gistId=r,this.writeLocalGistId(r);let o=await this.fetchAndCache(r);return{gistId:r,state:o,created:!1}}I(Se,"No existing Gist found, creating new one");let{id:n,state:s}=await this.createGist();return this.writeLocalGistId(n),{gistId:n,state:s,created:!0}}catch(t){if(t instanceof Ge||Mt(t))throw t;this.gistId=null,this.lastFetchedEtag=null,_(Se,"All Gist API paths failed, entering degraded mode",t);let r=Ln(),n=null;try{if(xr.existsSync(r)){n=xr.readFileSync(r,"utf8");let s=JSON.parse(n);if(typeof s=="object"&&s!==null){let i=s;i.version===1&&(s=Jo(i)),s.version===2&&(s=Ko(s)),s.version===3&&(s=Yo(s))}let o=Lt.parse(s);return I(Se,"Loaded state from local cache in degraded mode"),{gistId:"",state:o,created:!1,degraded:!0}}}catch(s){if(n){let o=rw(n,"local-cache");_(Se,`Local state cache failed to parse in degraded mode: ${s instanceof Error?s.message:String(s)}. Corrupt cache preserved at: ${o??"(could not preserve)"}`)}else _(Se,`Failed to read local cache in degraded mode: ${s instanceof Error?s.message:String(s)}`)}return I(Se,"No local cache found, returning fresh state in degraded mode"),{gistId:"",state:Xr(),created:!1,degraded:!0}}}async bootstrapWithMigration(t){try{await this.checkGistScope();let r=this.readLocalGistId();if(r){I(Se,`bootstrapWithMigration: found local Gist ID: ${r}`);try{this.gistId=r;let i=await this.fetchAndCache(r);return{gistId:r,state:i,created:!1,migrated:!1}}catch(i){if(i instanceof Ge||Mt(i))throw i;_(Se,`bootstrapWithMigration: failed to fetch Gist ${r}, will search/create`,i)}}let n=await this.searchForGist();if(n){I(Se,`bootstrapWithMigration: found Gist via search: ${n}`),this.gistId=n,this.writeLocalGistId(n);let i=await this.fetchAndCache(n);return{gistId:n,state:i,created:!1,migrated:!1}}I(Se,"bootstrapWithMigration: no existing Gist found, creating one seeded with local state");let{id:s,state:o}=await this.createGistFromState(t);return this.writeLocalGistId(s),{gistId:s,state:o,created:!0,migrated:!0}}catch(r){if(r instanceof Ge||Mt(r))throw r;this.gistId=null,this.lastFetchedEtag=null,_(Se,"bootstrapWithMigration: all Gist API paths failed, entering degraded mode",r);let n=Ln(),s=null;try{if(xr.existsSync(n)){s=xr.readFileSync(n,"utf8");let o=JSON.parse(s);if(typeof o=="object"&&o!==null){let a=o;a.version===1&&(o=Jo(a)),o.version===2&&(o=Ko(o)),o.version===3&&(o=Yo(o))}let i=Lt.parse(o);return I(Se,"bootstrapWithMigration: loaded state from local cache in degraded mode"),{gistId:"",state:i,created:!1,degraded:!0,migrated:!1}}}catch(o){if(s){let i=rw(s,"local-cache");_(Se,`bootstrapWithMigration: local cache failed to parse: ${o instanceof Error?o.message:String(o)}. Corrupt cache preserved at: ${i??"(could not preserve)"}`)}else _(Se,`bootstrapWithMigration: failed to read local cache: ${o instanceof Error?o.message:String(o)}`)}return I(Se,"bootstrapWithMigration: no local cache found, returning existing state in degraded mode"),{gistId:"",state:t,created:!1,degraded:!0,migrated:!1}}}getGistId(){return this.gistId}markDirty(t){this.dirtyFiles.add(t)}getDocument(t){return this.cachedFiles.get(t)??null}setDocument(t,r){this.cachedFiles.set(t,r),this.markDirty(t)}listDocuments(t){let r=[];for(let n of this.cachedFiles.keys())n.startsWith(t)&&r.push(n);return r}setState(t){this.cachedFiles.set(en,t),this.markDirty(en)}async push(){if(this.dirtyFiles.size===0)return!0;if(this.gistId===null)throw new Error("GistStateStore: cannot push before bootstrap \u2014 gistId is null");let t=()=>{let o={};for(let i of this.dirtyFiles){let a=this.cachedFiles.get(i);a!==void 0&&(o[i]={content:a})}return o},r=async()=>{try{let o={gist_id:this.gistId,files:t()},i=await this.octokit.gists.update(o),a=IE(i.headers);return a&&(this.lastFetchedEtag=a),{ok:!0}}catch(o){return{ok:!1,status:o.status,err:o}}};if(this.dirtyFiles.has(en)){let o={};for(let m of this.dirtyFiles){let f=this.cachedFiles.get(m);f!==void 0&&(o[m]=f)}let i=new Map(this.cachedFiles),a=new Map(this.baselineFiles),c=this.lastFetchedEtag,l=a.get(en),p=()=>{for(let[m,f]of Object.entries(o))this.cachedFiles.set(m,f)};try{await this.fetchAndCache(this.gistId)}catch(m){_(Se,`Pre-write re-read failed: ${m}`),this.cachedFiles.clear();for(let[f,g]of i)this.cachedFiles.set(f,g);throw this.baselineFiles=a,this.lastFetchedEtag=c,p(),m instanceof qa||Mt(m)?m:new $r(c,null)}let d=this.cachedFiles.get(en);if(l!==d)throw _(Se,"state.json changed remotely since our last fetch; surfacing GistConcurrencyError instead of clobbering (#1235, #1510)"),p(),new $r(c,this.lastFetchedEtag);p()}let n=await r();if(!n.ok&&(I(Se,`push failed on first attempt, retrying: ${n.err}`),n=await r(),!n.ok))return _(Se,`push failed after retry, giving up: ${n.err}`),!1;if(this.dirtyFiles.clear(),this.baselineFiles=new Map(this.cachedFiles),this.cachedFiles.get(en))try{let o=this.parseStateFromCache();this.writeLocalStateCache(o)}catch(o){I(Se,`push succeeded but local cache write failed: ${o}`)}return!0}async refreshFromGist(){if(!this.gistId)return{status:"no-gist"};let t=Date.now(),r=t-this.lastRefreshAt;if(r<e.REFRESH_THROTTLE_MS)return{status:"throttled",sinceLastMs:r};this.lastRefreshAt=t;try{return await this.fetchAndCache(this.gistId),this.lastRefreshError=null,{status:"refreshed"}}catch(n){let s=n instanceof Error?n:new Error(String(n));return _(Se,`refreshFromGist failed: ${s.message}`),this.lastRefreshError=s,{status:"error",error:s}}}async checkGistScope(){try{await this.octokit.gists.list({per_page:1,page:1})}catch(t){if(Mt(t))throw t;let r=t.status;throw r===401||r===403?new Zo:t}}async fetchAndCache(t){let r=await this.octokit.gists.get({gist_id:t});this.gistId=t,this.lastFetchedEtag=IE(r.headers),this.cachedFiles.clear();for(let[s,o]of Object.entries(r.data.files))o&&o.content!=null&&this.cachedFiles.set(s,o.content);this.baselineFiles=new Map(this.cachedFiles);let n=this.parseStateFromCache();return this.writeLocalStateCache(n),n}parseStateFromCache(){let t=this.cachedFiles.get(en);if(!t)return I(Se,"No state.json found in Gist, using fresh state"),Xr();try{let r=JSON.parse(t);if(typeof r=="object"&&r!==null){let n=r;n.version===1&&(r=Jo(n)),r.version===2&&(r=Ko(r)),r.version===3&&(r=Yo(r))}return Lt.parse(r)}catch(r){let n=rw(t,this.gistId??"unknown");throw _(Se,`Gist state.json failed to parse \u2014 refusing to overwrite with fresh state. Corrupt content preserved at: ${n??"(could not preserve)"}`),new qa(this.gistId??"unknown",n,r)}}async searchForGist(){try{for(let r=1;r<=10;r++){let{data:n}=await this.octokit.gists.list({per_page:100,page:r});if(n.length===0)break;let s=n.find(o=>o.description===nw);if(s)return s.id}}catch(t){if(Mt(t))throw t;_(Se,"Failed to search Gists by description",t)}return null}async createGist(){let t=Xr(),r=JSON.stringify(t,null,2),{data:n}=await this.octokit.gists.create({description:nw,public:!1,files:{[en]:{content:r}}});this.gistId=n.id,this.cachedFiles.clear();for(let[s,o]of Object.entries(n.files))o&&o.content!=null&&this.cachedFiles.set(s,o.content);return this.baselineFiles=new Map(this.cachedFiles),this.writeLocalStateCache(t),{id:n.id,state:t}}async createGistFromState(t){let r=JSON.stringify(t,null,2),{data:n}=await this.octokit.gists.create({description:nw,public:!1,files:{[en]:{content:r}}});this.gistId=n.id,this.cachedFiles.clear();for(let[s,o]of Object.entries(n.files))o&&o.content!=null&&this.cachedFiles.set(s,o.content);return this.baselineFiles=new Map(this.cachedFiles),this.writeLocalStateCache(t),{id:n.id,state:t}}readLocalGistId(){try{let t=Rs();if(xr.existsSync(t))return xr.readFileSync(t,"utf8").trim()||null}catch(t){I(Se,"Could not read local Gist ID file",t)}return null}writeLocalGistId(t){try{let r=Rs();ir(r,t,384),I(Se,`Wrote Gist ID to ${r}`)}catch(r){_(Se,`Failed to write local Gist ID file: ${r}`)}}writeLocalStateCache(t){try{let r=Ln();ir(r,JSON.stringify(t,null,2),384),I(Se,`Wrote state cache to ${r}`)}catch(r){_(Se,`Failed to write local state cache: ${r}`)}}}});function Qa(e){if(!e.includes("/"))throw new or(`Invalid repo identifier "${e}". Expected "owner/repo" format.`,"INVALID_REPO_ID");let[t,r]=e.split("/");return`${ri}${t}--${r}${ow}`}function iw(e){if(!e.startsWith(ri)||!e.endsWith(ow))return null;let t=e.slice(ri.length,e.length-ow.length),r=t.indexOf("--");if(r===-1)return null;let n=t.slice(0,r),s=t.slice(r+2);return!n||!s?null:`${n}/${s}`}function DE(e,t){if(!e)return null;let r=e.getDocument(Qa(t));return r===null||r===""?null:r}function LE(e,t,r){if(!e)throw new Mn;let n=Buffer.byteLength(r,"utf8");if(n>Rp)throw new Ya(n);e.setDocument(Qa(t),r)}function FE(e,t){if(!e)throw new Mn;e.setDocument(Qa(t),"")}function ME(e){if(!e)return[];let t=e.listDocuments(ri),r=[];for(let n of t){let s=iw(n);if(!s)continue;let o=e.getDocument(n);o===null||o===""||r.push(s)}return r.sort()}var ri,Rp,ow,Mn,Ya,aw=C(()=>{"use strict";ie();ri="guidelines--",Rp=8192,ow=".md";Mn=class extends or{constructor(t){super(t??"Per-repo guidelines require Gist persistence. Run `oss-autopilot setup` to enable Gist sync, then retry.","GUIDELINES_NOT_AVAILABLE"),this.name="GuidelinesNotAvailableError"}},Ya=class extends or{constructor(t,r=Rp){super(`Guidelines content is ${t} bytes, exceeding the ${r}-byte cap. Trim or split across categories.`,"GUIDELINES_TOO_LARGE"),this.name="GuidelinesTooLargeError"}}});function ni(e,t={}){return`Gist persistence is configured but ${typeof e=="string"?BF[e]:e.reason}; writes are LOCAL-ONLY and may be overwritten by the next successful Gist sync.${t.retryHint?` ${t.retryHint}`:""}`}var BF,cw=C(()=>{"use strict";BF={"no-token":"no GitHub token was available","state-unreadable":"the state file could not be read","init-fallback":"initialization hit a transient network failure","configured-but-local":"this process is running local-only (Gist init has not succeeded)","bootstrap-degraded":"the Gist bootstrap fell back to the local cache (reads may be stale and pushes are failing)"}});function Gn(){return typeof navigator=="object"&&"userAgent"in navigator?navigator.userAgent:typeof process=="object"&&process.version!==void 0?`Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`:"<environment undetectable>"}var Xa=C(()=>{});function Sp(e,t,r,n){if(typeof r!="function")throw new Error("method for before hook must be a function");return n||(n={}),Array.isArray(t)?t.reverse().reduce((s,o)=>Sp.bind(null,e,o,s,n),r)():Promise.resolve().then(()=>e.registry[t]?e.registry[t].reduce((s,o)=>o.hook.bind(null,s,n),r)():r(n))}var GE=C(()=>{});function NE(e,t,r,n){let s=n;e.registry[r]||(e.registry[r]=[]),t==="before"&&(n=(o,i)=>Promise.resolve().then(s.bind(null,i)).then(o.bind(null,i))),t==="after"&&(n=(o,i)=>{let a;return Promise.resolve().then(o.bind(null,i)).then(c=>(a=c,s(a,i))).then(()=>a)}),t==="error"&&(n=(o,i)=>Promise.resolve().then(o.bind(null,i)).catch(a=>s(a,i))),e.registry[r].push({hook:n,orig:s})}var UE=C(()=>{});function jE(e,t,r){if(!e.registry[t])return;let n=e.registry[t].map(s=>s.orig).indexOf(r);n!==-1&&e.registry[t].splice(n,1)}var zE=C(()=>{});function BE(e,t,r){let n=VE(jE,null).apply(null,r?[t,r]:[t]);e.api={remove:n},e.remove=n,["before","error","after","wrap"].forEach(s=>{let o=r?[t,s,r]:[t,s];e[s]=e.api[s]=VE(NE,null).apply(null,o)})}function WF(){let e=Symbol("Singular"),t={registry:{}},r=Sp.bind(null,t,e);return BE(r,t,e),r}function qF(){let e={registry:{}},t=Sp.bind(null,e);return BE(t,e),t}var HE,VE,WE,qE=C(()=>{GE();UE();zE();HE=Function.bind,VE=HE.bind(HE);WE={Singular:WF,Collection:qF}});function YF(e){return e?Object.keys(e).reduce((t,r)=>(t[r.toLowerCase()]=e[r],t),{}):{}}function QF(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}function KE(e,t){let r=Object.assign({},e);return Object.keys(t).forEach(n=>{QF(t[n])?n in e?r[n]=KE(e[n],t[n]):Object.assign(r,{[n]:t[n]}):Object.assign(r,{[n]:t[n]})}),r}function ZE(e){for(let t in e)e[t]===void 0&&delete e[t];return e}function lw(e,t,r){if(typeof t=="string"){let[s,o]=t.split(" ");r=Object.assign(o?{method:s,url:o}:{url:s},r)}else r=Object.assign({},t);r.headers=YF(r.headers),ZE(r),ZE(r.headers);let n=KE(e||{},r);return r.url==="/graphql"&&(e&&e.mediaType.previews?.length&&(n.mediaType.previews=e.mediaType.previews.filter(s=>!n.mediaType.previews.includes(s)).concat(n.mediaType.previews)),n.mediaType.previews=(n.mediaType.previews||[]).map(s=>s.replace(/-preview/,""))),n}function XF(e,t){let r=/\?/.test(e)?"&":"?",n=Object.keys(t);return n.length===0?e:e+r+n.map(s=>s==="q"?"q="+t.q.split("+").map(encodeURIComponent).join("+"):`${s}=${encodeURIComponent(t[s])}`).join("&")}function tM(e){return e.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g,"").split(/,/)}function rM(e){let t=e.match(eM);return t?t.map(tM).reduce((r,n)=>r.concat(n),[]):[]}function JE(e,t){let r={__proto__:null};for(let n of Object.keys(e))t.indexOf(n)===-1&&(r[n]=e[n]);return r}function YE(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t).replace(/%5B/g,"[").replace(/%5D/g,"]")),t}).join("")}function oi(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function ec(e,t,r){return t=e==="+"||e==="#"?YE(t):oi(t),r?oi(r)+"="+t:t}function si(e){return e!=null}function uw(e){return e===";"||e==="&"||e==="?"}function nM(e,t,r,n){var s=e[r],o=[];if(si(s)&&s!=="")if(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||typeof s=="boolean")s=s.toString(),n&&n!=="*"&&(s=s.substring(0,parseInt(n,10))),o.push(ec(t,s,uw(t)?r:""));else if(n==="*")Array.isArray(s)?s.filter(si).forEach(function(i){o.push(ec(t,i,uw(t)?r:""))}):Object.keys(s).forEach(function(i){si(s[i])&&o.push(ec(t,s[i],i))});else{let i=[];Array.isArray(s)?s.filter(si).forEach(function(a){i.push(ec(t,a))}):Object.keys(s).forEach(function(a){si(s[a])&&(i.push(oi(a)),i.push(ec(t,s[a].toString())))}),uw(t)?o.push(oi(r)+"="+i.join(",")):i.length!==0&&o.push(i.join(","))}else t===";"?si(s)&&o.push(oi(r)):s===""&&(t==="&"||t==="?")?o.push(oi(r)+"="):s===""&&o.push("");return o}function sM(e){return{expand:oM.bind(null,e)}}function oM(e,t){var r=["+","#",".","/",";","?","&"];return e=e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(n,s,o){if(s){let a="",c=[];if(r.indexOf(s.charAt(0))!==-1&&(a=s.charAt(0),s=s.substr(1)),s.split(/,/g).forEach(function(l){var p=/([^:\*]*)(?::(\d+)|(\*))?/.exec(l);c.push(nM(t,a,p[1],p[2]||p[3]))}),a&&a!=="+"){var i=",";return a==="?"?i="&":a!=="#"&&(i=a),(c.length!==0?a:"")+c.join(i)}else return c.join(",")}else return YE(o)}),e==="/"?e:e.replace(/\/$/,"")}function QE(e){let t=e.method.toUpperCase(),r=(e.url||"/").replace(/:([a-z]\w+)/g,"{$1}"),n=Object.assign({},e.headers),s,o=JE(e,["method","baseUrl","url","headers","request","mediaType"]),i=rM(r);r=sM(r).expand(o),/^http/.test(r)||(r=e.baseUrl+r);let a=Object.keys(e).filter(p=>i.includes(p)).concat("baseUrl"),c=JE(o,a);if(!/application\/octet-stream/i.test(n.accept)&&(e.mediaType.format&&(n.accept=n.accept.split(/,/).map(p=>p.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`)).join(",")),r.endsWith("/graphql")&&e.mediaType.previews?.length)){let p=n.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g)||[];n.accept=p.concat(e.mediaType.previews).map(d=>{let m=e.mediaType.format?`.${e.mediaType.format}`:"+json";return`application/vnd.github.${d}-preview${m}`}).join(",")}return["GET","HEAD"].includes(t)?r=XF(r,c):"data"in c?s=c.data:Object.keys(c).length&&(s=c),!n["content-type"]&&typeof s<"u"&&(n["content-type"]="application/json; charset=utf-8"),["PATCH","PUT"].includes(t)&&typeof s>"u"&&(s=""),Object.assign({method:t,url:r,headers:n},typeof s<"u"?{body:s}:null,e.request?{request:e.request}:null)}function iM(e,t,r){return QE(lw(e,t,r))}function XE(e,t){let r=lw(e,t),n=iM.bind(null,r);return Object.assign(n,{DEFAULTS:r,defaults:XE.bind(null,r),merge:lw.bind(null,r),parse:QE})}var ZF,JF,KF,eM,eP,tP=C(()=>{Xa();ZF="0.0.0-development",JF=`octokit-endpoint.js/${ZF} ${Gn()}`,KF={method:"GET",baseUrl:"https://api.github.com",headers:{accept:"application/vnd.github.v3+json","user-agent":JF},mediaType:{format:""}};eM=/\{[^{}}]+\}/g;eP=XE(null,KF)});var oP=_S((Wq,tc)=>{"use strict";var Ep=function(){};Ep.prototype=Object.create(null);var vp=/; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu,kp=/\\([\v\u0020-\u00ff])/gu,rP=/^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u,Es={type:"",parameters:new Ep};Object.freeze(Es.parameters);Object.freeze(Es);function nP(e){if(typeof e!="string")throw new TypeError("argument header is required and must be a string");let t=e.indexOf(";"),r=t!==-1?e.slice(0,t).trim():e.trim();if(rP.test(r)===!1)throw new TypeError("invalid media type");let n={type:r.toLowerCase(),parameters:new Ep};if(t===-1)return n;let s,o,i;for(vp.lastIndex=t;o=vp.exec(e);){if(o.index!==t)throw new TypeError("invalid parameter format");t+=o[0].length,s=o[1].toLowerCase(),i=o[2],i[0]==='"'&&(i=i.slice(1,i.length-1),kp.test(i)&&(i=i.replace(kp,"$1"))),n.parameters[s]=i}if(t!==e.length)throw new TypeError("invalid parameter format");return n}function sP(e){if(typeof e!="string")return Es;let t=e.indexOf(";"),r=t!==-1?e.slice(0,t).trim():e.trim();if(rP.test(r)===!1)return Es;let n={type:r.toLowerCase(),parameters:new Ep};if(t===-1)return n;let s,o,i;for(vp.lastIndex=t;o=vp.exec(e);){if(o.index!==t)return Es;t+=o[0].length,s=o[1].toLowerCase(),i=o[2],i[0]==='"'&&(i=i.slice(1,i.length-1),kp.test(i)&&(i=i.replace(kp,"$1"))),n.parameters[s]=i}return t!==e.length?Es:n}tc.exports.default={parse:nP,safeParse:sP};tc.exports.parse=nP;tc.exports.safeParse=sP;tc.exports.defaultContentType=Es});var aM,cP,pw,iP,cM,uM,lM,uP,pM,dM,mM,lP,aP,fM,gM,pP,dP=C(()=>{aM=/^-?\d+$/,cP=/^-?\d+n+$/,pw=JSON.stringify,iP=JSON.parse,cM=/^-?\d+n$/,uM=/([\[:])?"(-?\d+)n"($|([\\n]|\s)*(\s|[\\n])*[,\}\]])/g,lM=/([\[:])?("-?\d+n+)n("$|"([\\n]|\s)*(\s|[\\n])*[,\}\]])/g,uP=(e,t,r)=>"rawJSON"in JSON?pw(e,(i,a)=>typeof a=="bigint"?JSON.rawJSON(a.toString()):typeof t=="function"?t(i,a):(Array.isArray(t)&&t.includes(i),a),r):e?pw(e,(i,a)=>typeof a=="string"&&!!a.match(cP)||typeof a=="bigint"?a.toString()+"n":typeof t=="function"?t(i,a):(Array.isArray(t)&&t.includes(i),a),r).replace(uM,"$1$2$3").replace(lM,"$1$2$3"):pw(e,t,r),pM=()=>JSON.parse("1",(e,t,r)=>!!r&&r.source==="1"),dM=(e,t,r,n)=>typeof t=="string"&&t.match(cM)?BigInt(t.slice(0,-1)):typeof t=="string"&&t.match(cP)?t.slice(0,-1):typeof n!="function"?t:n(e,t,r),mM=(e,t)=>JSON.parse(e,(r,n,s)=>{let o=typeof n=="number"&&(n>Number.MAX_SAFE_INTEGER||n<Number.MIN_SAFE_INTEGER),i=s&&aM.test(s.source);return o&&i?BigInt(s.source):typeof t!="function"?n:t(r,n,s)}),lP=Number.MAX_SAFE_INTEGER.toString(),aP=lP.length,fM=/"(?:\\.|[^"])*"|-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/g,gM=/^"-?\d+n+"$/,pP=(e,t)=>{if(!e)return iP(e,t);if(pM())return mM(e,t);let r=e.replace(fM,(n,s,o,i)=>{let a=n[0]==='"';if(a&&!!n.match(gM))return n.substring(0,n.length-1)+'n"';let l=o||i,p=s&&(s.length<aP||s.length===aP&&s<=lP);return a||l||p?n:'"'+n+'n"'});return iP(r,(n,s,o)=>dM(n,s,o,t))}});var tn,dw=C(()=>{tn=class extends Error{name;status;request;response;constructor(t,r,n){super(t,{cause:n.cause}),this.name="HttpError",this.status=Number.parseInt(r),Number.isNaN(this.status)&&(this.status=0);"response"in n&&(this.response=n.response);let s=Object.assign({},n.request);n.request.headers.authorization&&(s.headers=Object.assign({},n.request.headers,{authorization:n.request.headers.authorization.replace(/(?<! ) .*$/," [REDACTED]")})),s.url=s.url.replace(/\bclient_secret=\w+/g,"client_secret=[REDACTED]").replace(/\baccess_token=\w+/g,"access_token=[REDACTED]"),this.request=s}}});function bM(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}async function fP(e){let t=e.request?.fetch||globalThis.fetch;if(!t)throw new Error("fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing");let r=e.request?.log||console,n=e.request?.parseSuccessResponseBody!==!1,s=bM(e.body)||Array.isArray(e.body)?uP(e.body):e.body,o=Object.fromEntries(Object.entries(e.headers).map(([d,m])=>[d,String(m)])),i;try{i=await t(e.url,{method:e.method,body:s,redirect:e.request?.redirect,headers:o,signal:e.request?.signal,...e.body&&{duplex:"half"}})}catch(d){let m="Unknown Error";if(d instanceof Error){if(d.name==="AbortError")throw d.status=500,d;m=d.message,d.name==="TypeError"&&"cause"in d&&(d.cause instanceof Error?m=d.cause.message:typeof d.cause=="string"&&(m=d.cause))}let f=new tn(m,500,{request:e});throw f.cause=d,f}let a=i.status,c=i.url,l={};for(let[d,m]of i.headers)l[d]=m;let p={url:c,status:a,headers:l,data:""};if("deprecation"in l){let d=l.link&&l.link.match(/<([^<>]+)>; rel="deprecation"/),m=d&&d.pop();r.warn(`[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${l.sunset}${m?`. See ${m}`:""}`)}if(a===204||a===205)return p;if(e.method==="HEAD"){if(a<400)return p;throw new tn(i.statusText,a,{response:p,request:e})}if(a===304)throw p.data=await mw(i),new tn("Not modified",a,{response:p,request:e});if(a>=400)throw p.data=await mw(i),new tn(_M(p.data),a,{response:p,request:e});return p.data=n?await mw(i):i.body,p}async function mw(e){let t=e.headers.get("content-type");if(!t)return e.text().catch(mP);let r=(0,gP.safeParse)(t);if(wM(r)){let n="";try{return n=await e.text(),pP(n)}catch{return n}}else return r.type.startsWith("text/")||r.parameters.charset?.toLowerCase()==="utf-8"?e.text().catch(mP):e.arrayBuffer().catch(()=>new ArrayBuffer(0))}function wM(e){return e.type==="application/json"||e.type==="application/scim+json"}function _M(e){if(typeof e=="string")return e;if(e instanceof ArrayBuffer)return"Unknown error";if("message"in e){let t="documentation_url"in e?` - ${e.documentation_url}`:"";return Array.isArray(e.errors)?`${e.message}: ${e.errors.map(r=>JSON.stringify(r)).join(", ")}${t}`:`${e.message}${t}`}return`Unknown error: ${JSON.stringify(e)}`}function fw(e,t){let r=e.defaults(t);return Object.assign(function(s,o){let i=r.merge(s,o);if(!i.request||!i.request.hook)return fP(r.parse(i));let a=(c,l)=>fP(r.parse(r.merge(c,l)));return Object.assign(a,{endpoint:r,defaults:fw.bind(null,r)}),i.request.hook(a,i)},{endpoint:r,defaults:fw.bind(null,r)})}var gP,hM,yM,mP,rc,gw=C(()=>{tP();Xa();gP=H(oP(),1);dP();dw();hM="10.0.8",yM={headers:{"user-agent":`octokit-request.js/${hM} ${Gn()}`}};mP=()=>"";rc=fw(eP,yM);});function SM(e){return`Request failed due to following response errors:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oss-autopilot/core",
3
- "version": "3.29.1",
3
+ "version": "3.29.2",
4
4
  "description": "CLI and core library for managing open source contributions",
5
5
  "type": "module",
6
6
  "bin": {