From a002c6351a961d4f1eb1b0dcbac4eba036052ec0 Mon Sep 17 00:00:00 2001 From: LE VAN THANH Date: Sat, 26 Jul 2025 05:10:45 +0700 Subject: [PATCH 01/40] any type for OUTResultMaybeData --- esbuild_out/scripts/templates/useFn.template.tsx | 2 +- src/commands/make_docs/scripts/templates/useFn.template.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/esbuild_out/scripts/templates/useFn.template.tsx b/esbuild_out/scripts/templates/useFn.template.tsx index 4008408..290ffd1 100644 --- a/esbuild_out/scripts/templates/useFn.template.tsx +++ b/esbuild_out/scripts/templates/useFn.template.tsx @@ -30,7 +30,7 @@ export type OUTResultMaybeData = OUTResult extends { data: infer U } ? U : OUTResult extends { docs: infer U2 } ? U2 - : unknown; + : any; export type OUTResultMaybeDataItem = Unpacked type Data = OUTResultMaybeData; diff --git a/src/commands/make_docs/scripts/templates/useFn.template.tsx b/src/commands/make_docs/scripts/templates/useFn.template.tsx index 4008408..290ffd1 100644 --- a/src/commands/make_docs/scripts/templates/useFn.template.tsx +++ b/src/commands/make_docs/scripts/templates/useFn.template.tsx @@ -30,7 +30,7 @@ export type OUTResultMaybeData = OUTResult extends { data: infer U } ? U : OUTResult extends { docs: infer U2 } ? U2 - : unknown; + : any; export type OUTResultMaybeDataItem = Unpacked type Data = OUTResultMaybeData; From 4b591410f749ee28b237bcd0a03de97de75f0643 Mon Sep 17 00:00:00 2001 From: LE VAN THANH Date: Sun, 27 Jul 2025 18:43:55 +0700 Subject: [PATCH 02/40] add Form --- esbuild_out/index.js | 6 +- esbuild_out/scripts/generateUses.script.ts | 12 + .../scripts/templates/InputForm.module.css | 104 ++++++++ esbuild_out/scripts/templates/InputForm.tsx | 227 ++++++++++++++++++ .../scripts/templates/InputFormHelpers.tsx | 59 +++++ .../scripts/templates/useFn.template.tsx | 29 ++- esbuild_out/scripts/writeZodSchemas.script.ts | 4 +- package-lock.json | 41 +++- package.json | 4 +- .../make_docs/scripts/generateUses.script.ts | 12 + .../scripts/templates/InputForm.module.css | 104 ++++++++ .../make_docs/scripts/templates/InputForm.tsx | 227 ++++++++++++++++++ .../scripts/templates/InputFormHelpers.tsx | 59 +++++ .../scripts/templates/useFn.template.tsx | 29 ++- .../scripts/writeZodSchemas.script.ts | 4 +- src/version.ts | 2 +- tsconfig.json | 7 +- 17 files changed, 911 insertions(+), 19 deletions(-) create mode 100644 esbuild_out/scripts/templates/InputForm.module.css create mode 100644 esbuild_out/scripts/templates/InputForm.tsx create mode 100644 esbuild_out/scripts/templates/InputFormHelpers.tsx create mode 100644 src/commands/make_docs/scripts/templates/InputForm.module.css create mode 100644 src/commands/make_docs/scripts/templates/InputForm.tsx create mode 100644 src/commands/make_docs/scripts/templates/InputFormHelpers.tsx diff --git a/esbuild_out/index.js b/esbuild_out/index.js index e860eeb..4202b1b 100755 --- a/esbuild_out/index.js +++ b/esbuild_out/index.js @@ -181,7 +181,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(` `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let a=e.items[e.items.length-2]?.value?.end;if(Array.isArray(a)){Array.prototype.push.apply(a,n.start),a.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent,a=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(a&&n.sep&&!n.value){let l=[];for(let f=0;fe.indent&&(l.length=0);break;default:l.length=0}}l.length>=2&&(o=n.sep.splice(l[1]))}switch(this.type){case"anchor":case"tag":a||n.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):a||n.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ln(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(my(n.key)&&!Ln(n.sep,"newline")){let l=Jr(n.start),f=n.key,d=n.sep;d.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:f,sep:d}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(Ln(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let l=Jr(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||a?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Ln(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let l=this.flowScalar(this.type);a||n.value?(e.items.push({start:o,key:l,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(l):(Object.assign(n,{key:l,sep:[]}),this.onKeyLine=!0);return}default:{let l=this.startBlockValue(e);if(l){if(l.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Ln(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&e.items.push({start:o});this.stack.push(l);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let a=e.items[e.items.length-2]?.value?.end;if(Array.isArray(a)){Array.prototype.push.apply(a,n.start),a.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||Ln(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i&&i.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let a=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:a,sep:[]}):n.sep?this.stack.push(a):Object.assign(n,{key:a,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===e.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let a=wo(i),o=Jr(a);py(e);let l=e.end.splice(1,e.end.length);l.push(this.sourceToken);let f={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:l}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=f}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(` `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(` -`,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=wo(e),i=Jr(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=wo(e),i=Jr(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};gy.Parser=nf});var wy=C(us=>{"use strict";var yy=Uc(),UI=Xi(),os=ns(),HI=Vl(),jI=fe(),KI=tf(),_y=rf();function vy(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new KI.LineCounter||null,prettyErrors:e}}function zI(t,e={}){let{lineCounter:n,prettyErrors:i}=vy(e),a=new _y.Parser(n?.addNewLine),o=new yy.Composer(e),l=Array.from(o.compose(a.parse(t)));if(i&&n)for(let f of l)f.errors.forEach(os.prettifyError(t,n)),f.warnings.forEach(os.prettifyError(t,n));return l.length>0?l:Object.assign([],{empty:!0},o.streamInfo())}function by(t,e={}){let{lineCounter:n,prettyErrors:i}=vy(e),a=new _y.Parser(n?.addNewLine),o=new yy.Composer(e),l=null;for(let f of o.compose(a.parse(t),!0,t.length))if(!l)l=f;else if(l.options.logLevel!=="silent"){l.errors.push(new os.YAMLParseError(f.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(l.errors.forEach(os.prettifyError(t,n)),l.warnings.forEach(os.prettifyError(t,n))),l}function GI(t,e,n){let i;typeof e=="function"?i=e:n===void 0&&e&&typeof e=="object"&&(n=e);let a=by(t,n);if(!a)return null;if(a.warnings.forEach(o=>HI.warn(a.options.logLevel,o)),a.errors.length>0){if(a.options.logLevel!=="silent")throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:i},n))}function ZI(t,e,n){let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let a=Math.round(n);n=a<1?void 0:a>8?{indent:8}:{indent:a}}if(t===void 0){let{keepUndefined:a}=n??e??{};if(!a)return}return jI.isDocument(t)&&!i?t.toString(n):new UI.Document(t,i,n).toString(n)}us.parse=GI;us.parseAllDocuments=zI;us.parseDocument=by;us.stringify=ZI});var af=C(ge=>{"use strict";var YI=Uc(),JI=Xi(),QI=Sc(),sf=ns(),XI=Mi(),qn=fe(),e$=En(),t$=Le(),n$=In(),r$=$n(),i$=vo(),s$=Xc(),a$=tf(),o$=rf(),Oo=wy(),Oy=$i();ge.Composer=YI.Composer;ge.Document=JI.Document;ge.Schema=QI.Schema;ge.YAMLError=sf.YAMLError;ge.YAMLParseError=sf.YAMLParseError;ge.YAMLWarning=sf.YAMLWarning;ge.Alias=XI.Alias;ge.isAlias=qn.isAlias;ge.isCollection=qn.isCollection;ge.isDocument=qn.isDocument;ge.isMap=qn.isMap;ge.isNode=qn.isNode;ge.isPair=qn.isPair;ge.isScalar=qn.isScalar;ge.isSeq=qn.isSeq;ge.Pair=e$.Pair;ge.Scalar=t$.Scalar;ge.YAMLMap=n$.YAMLMap;ge.YAMLSeq=r$.YAMLSeq;ge.CST=i$;ge.Lexer=s$.Lexer;ge.LineCounter=a$.LineCounter;ge.Parser=o$.Parser;ge.parse=Oo.parse;ge.parseAllDocuments=Oo.parseAllDocuments;ge.parseDocument=Oo.parseDocument;ge.stringify=Oo.stringify;ge.visit=Oy.visit;ge.visitAsync=Oy.visitAsync});var So=C((E2,Sy)=>{var u$=Array.isArray;Sy.exports=u$});var Ay=C((N2,xy)=>{var l$=typeof global=="object"&&global&&global.Object===Object&&global;xy.exports=l$});var xo=C((I2,Cy)=>{var c$=Ay(),f$=typeof self=="object"&&self&&self.Object===Object&&self,h$=c$||f$||Function("return this")();Cy.exports=h$});var Ao=C(($2,ky)=>{var d$=xo(),p$=d$.Symbol;ky.exports=p$});var Iy=C((L2,Ny)=>{var Ty=Ao(),Ey=Object.prototype,m$=Ey.hasOwnProperty,g$=Ey.toString,ls=Ty?Ty.toStringTag:void 0;function y$(t){var e=m$.call(t,ls),n=t[ls];try{t[ls]=void 0;var i=!0}catch{}var a=g$.call(t);return i&&(e?t[ls]=n:delete t[ls]),a}Ny.exports=y$});var Ly=C((q2,$y)=>{var _$=Object.prototype,v$=_$.toString;function b$(t){return v$.call(t)}$y.exports=b$});var of=C((P2,My)=>{var qy=Ao(),w$=Iy(),O$=Ly(),S$="[object Null]",x$="[object Undefined]",Py=qy?qy.toStringTag:void 0;function A$(t){return t==null?t===void 0?x$:S$:Py&&Py in Object(t)?w$(t):O$(t)}My.exports=A$});var Dy=C((M2,Ry)=>{function C$(t){return t!=null&&typeof t=="object"}Ry.exports=C$});var Co=C((R2,Fy)=>{var k$=of(),T$=Dy(),E$="[object Symbol]";function N$(t){return typeof t=="symbol"||T$(t)&&k$(t)==E$}Fy.exports=N$});var Vy=C((D2,By)=>{var I$=So(),$$=Co(),L$=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,q$=/^\w*$/;function P$(t,e){if(I$(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||$$(t)?!0:q$.test(t)||!L$.test(t)||e!=null&&t in Object(e)}By.exports=P$});var uf=C((F2,Wy)=>{function M$(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}Wy.exports=M$});var Hy=C((B2,Uy)=>{var R$=of(),D$=uf(),F$="[object AsyncFunction]",B$="[object Function]",V$="[object GeneratorFunction]",W$="[object Proxy]";function U$(t){if(!D$(t))return!1;var e=R$(t);return e==B$||e==V$||e==F$||e==W$}Uy.exports=U$});var Ky=C((V2,jy)=>{var H$=xo(),j$=H$["__core-js_shared__"];jy.exports=j$});var Zy=C((W2,Gy)=>{var lf=Ky(),zy=function(){var t=/[^.]+$/.exec(lf&&lf.keys&&lf.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function K$(t){return!!zy&&zy in t}Gy.exports=K$});var Jy=C((U2,Yy)=>{var z$=Function.prototype,G$=z$.toString;function Z$(t){if(t!=null){try{return G$.call(t)}catch{}try{return t+""}catch{}}return""}Yy.exports=Z$});var Xy=C((H2,Qy)=>{var Y$=Hy(),J$=Zy(),Q$=uf(),X$=Jy(),eL=/[\\^$.*+?()[\]{}|]/g,tL=/^\[object .+?Constructor\]$/,nL=Function.prototype,rL=Object.prototype,iL=nL.toString,sL=rL.hasOwnProperty,aL=RegExp("^"+iL.call(sL).replace(eL,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function oL(t){if(!Q$(t)||J$(t))return!1;var e=Y$(t)?aL:tL;return e.test(X$(t))}Qy.exports=oL});var t_=C((j2,e_)=>{function uL(t,e){return t?.[e]}e_.exports=uL});var cf=C((K2,n_)=>{var lL=Xy(),cL=t_();function fL(t,e){var n=cL(t,e);return lL(n)?n:void 0}n_.exports=fL});var cs=C((z2,r_)=>{var hL=cf(),dL=hL(Object,"create");r_.exports=dL});var a_=C((G2,s_)=>{var i_=cs();function pL(){this.__data__=i_?i_(null):{},this.size=0}s_.exports=pL});var u_=C((Z2,o_)=>{function mL(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}o_.exports=mL});var c_=C((Y2,l_)=>{var gL=cs(),yL="__lodash_hash_undefined__",_L=Object.prototype,vL=_L.hasOwnProperty;function bL(t){var e=this.__data__;if(gL){var n=e[t];return n===yL?void 0:n}return vL.call(e,t)?e[t]:void 0}l_.exports=bL});var h_=C((J2,f_)=>{var wL=cs(),OL=Object.prototype,SL=OL.hasOwnProperty;function xL(t){var e=this.__data__;return wL?e[t]!==void 0:SL.call(e,t)}f_.exports=xL});var p_=C((Q2,d_)=>{var AL=cs(),CL="__lodash_hash_undefined__";function kL(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=AL&&e===void 0?CL:e,this}d_.exports=kL});var g_=C((X2,m_)=>{var TL=a_(),EL=u_(),NL=c_(),IL=h_(),$L=p_();function Qr(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e{function LL(){this.__data__=[],this.size=0}y_.exports=LL});var b_=C((tR,v_)=>{function qL(t,e){return t===e||t!==t&&e!==e}v_.exports=qL});var fs=C((nR,w_)=>{var PL=b_();function ML(t,e){for(var n=t.length;n--;)if(PL(t[n][0],e))return n;return-1}w_.exports=ML});var S_=C((rR,O_)=>{var RL=fs(),DL=Array.prototype,FL=DL.splice;function BL(t){var e=this.__data__,n=RL(e,t);if(n<0)return!1;var i=e.length-1;return n==i?e.pop():FL.call(e,n,1),--this.size,!0}O_.exports=BL});var A_=C((iR,x_)=>{var VL=fs();function WL(t){var e=this.__data__,n=VL(e,t);return n<0?void 0:e[n][1]}x_.exports=WL});var k_=C((sR,C_)=>{var UL=fs();function HL(t){return UL(this.__data__,t)>-1}C_.exports=HL});var E_=C((aR,T_)=>{var jL=fs();function KL(t,e){var n=this.__data__,i=jL(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}T_.exports=KL});var I_=C((oR,N_)=>{var zL=__(),GL=S_(),ZL=A_(),YL=k_(),JL=E_();function Xr(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e{var QL=cf(),XL=xo(),eq=QL(XL,"Map");$_.exports=eq});var M_=C((lR,P_)=>{var q_=g_(),tq=I_(),nq=L_();function rq(){this.size=0,this.__data__={hash:new q_,map:new(nq||tq),string:new q_}}P_.exports=rq});var D_=C((cR,R_)=>{function iq(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}R_.exports=iq});var hs=C((fR,F_)=>{var sq=D_();function aq(t,e){var n=t.__data__;return sq(e)?n[typeof e=="string"?"string":"hash"]:n.map}F_.exports=aq});var V_=C((hR,B_)=>{var oq=hs();function uq(t){var e=oq(this,t).delete(t);return this.size-=e?1:0,e}B_.exports=uq});var U_=C((dR,W_)=>{var lq=hs();function cq(t){return lq(this,t).get(t)}W_.exports=cq});var j_=C((pR,H_)=>{var fq=hs();function hq(t){return fq(this,t).has(t)}H_.exports=hq});var z_=C((mR,K_)=>{var dq=hs();function pq(t,e){var n=dq(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}K_.exports=pq});var Z_=C((gR,G_)=>{var mq=M_(),gq=V_(),yq=U_(),_q=j_(),vq=z_();function ei(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e{var Y_=Z_(),bq="Expected a function";function ff(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(bq);var n=function(){var i=arguments,a=e?e.apply(this,i):i[0],o=n.cache;if(o.has(a))return o.get(a);var l=t.apply(this,i);return n.cache=o.set(a,l)||o,l};return n.cache=new(ff.Cache||Y_),n}ff.Cache=Y_;J_.exports=ff});var ev=C((_R,X_)=>{var wq=Q_(),Oq=500;function Sq(t){var e=wq(t,function(i){return n.size===Oq&&n.clear(),i}),n=e.cache;return e}X_.exports=Sq});var nv=C((vR,tv)=>{var xq=ev(),Aq=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Cq=/\\(\\)?/g,kq=xq(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Aq,function(n,i,a,o){e.push(a?o.replace(Cq,"$1"):i||n)}),e});tv.exports=kq});var iv=C((bR,rv)=>{function Tq(t,e){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n{var sv=Ao(),Eq=iv(),Nq=So(),Iq=Co(),$q=1/0,av=sv?sv.prototype:void 0,ov=av?av.toString:void 0;function uv(t){if(typeof t=="string")return t;if(Nq(t))return Eq(t,uv)+"";if(Iq(t))return ov?ov.call(t):"";var e=t+"";return e=="0"&&1/t==-$q?"-0":e}lv.exports=uv});var hv=C((OR,fv)=>{var Lq=cv();function qq(t){return t==null?"":Lq(t)}fv.exports=qq});var pv=C((SR,dv)=>{var Pq=So(),Mq=Vy(),Rq=nv(),Dq=hv();function Fq(t,e){return Pq(t)?t:Mq(t,e)?[t]:Rq(Dq(t))}dv.exports=Fq});var gv=C((xR,mv)=>{var Bq=Co(),Vq=1/0;function Wq(t){if(typeof t=="string"||Bq(t))return t;var e=t+"";return e=="0"&&1/t==-Vq?"-0":e}mv.exports=Wq});var _v=C((AR,yv)=>{var Uq=pv(),Hq=gv();function jq(t,e){e=Uq(e,t);for(var n=0,i=e.length;t!=null&&n{var Kq=_v();function zq(t,e,n){var i=t==null?void 0:Kq(t,e);return i===void 0?n:i}vv.exports=zq});var aP={};Zd(aP,{program:()=>qo});module.exports=uC(aP);var lp=Ne(up(),1),{program:mP,createCommand:gP,createArgument:yP,createOption:_P,CommanderError:vP,InvalidArgumentError:bP,InvalidOptionArgumentError:wP,Command:ma,Argument:OP,Option:cp,Help:SP}=lp.default;var fp="2.2.3";var Q={};Zd(Q,{BRAND:()=>ZC,DIRTY:()=>jn,EMPTY_PATH:()=>kC,INVALID:()=>G,NEVER:()=>Tk,OK:()=>ze,ParseStatus:()=>Ue,Schema:()=>re,ZodAny:()=>On,ZodArray:()=>rn,ZodBigInt:()=>zn,ZodBoolean:()=>Gn,ZodBranded:()=>ki,ZodCatch:()=>sr,ZodDate:()=>Zn,ZodDefault:()=>ir,ZodDiscriminatedUnion:()=>_a,ZodEffects:()=>St,ZodEnum:()=>nr,ZodError:()=>tt,ZodFirstPartyTypeKind:()=>J,ZodFunction:()=>ba,ZodIntersection:()=>Xn,ZodIssueCode:()=>q,ZodLazy:()=>er,ZodLiteral:()=>tr,ZodMap:()=>Pr,ZodNaN:()=>Rr,ZodNativeEnum:()=>rr,ZodNever:()=>ct,ZodNull:()=>Jn,ZodNullable:()=>Bt,ZodNumber:()=>Kn,ZodObject:()=>Ve,ZodOptional:()=>wt,ZodParsedType:()=>R,ZodPipeline:()=>Ti,ZodPromise:()=>Sn,ZodReadonly:()=>ar,ZodRecord:()=>va,ZodSchema:()=>re,ZodSet:()=>Mr,ZodString:()=>wn,ZodSymbol:()=>Lr,ZodTransformer:()=>St,ZodTuple:()=>Ft,ZodType:()=>re,ZodUndefined:()=>Yn,ZodUnion:()=>Qn,ZodUnknown:()=>nn,ZodVoid:()=>qr,addIssueToContext:()=>P,any:()=>Dr,array:()=>ak,bigint:()=>XC,boolean:()=>Op,coerce:()=>kk,custom:()=>vp,date:()=>ek,datetimeRegex:()=>yp,defaultErrorMap:()=>en,discriminatedUnion:()=>uk,effect:()=>vk,enum:()=>gk,function:()=>dk,getErrorMap:()=>Nr,getParsedType:()=>Dt,instanceof:()=>JC,intersection:()=>lk,isAborted:()=>ga,isAsync:()=>Ir,isDirty:()=>ya,isValid:()=>bn,late:()=>YC,lazy:()=>pk,literal:()=>mk,makeIssue:()=>Ci,map:()=>fk,nan:()=>QC,nativeEnum:()=>yk,never:()=>Ol,null:()=>rk,nullable:()=>wk,number:()=>wp,object:()=>wa,objectUtil:()=>vl,oboolean:()=>Ck,onumber:()=>Ak,optional:()=>bk,ostring:()=>xk,pipeline:()=>Sk,preprocess:()=>Ok,promise:()=>_k,quotelessJson:()=>xC,record:()=>or,set:()=>hk,setErrorMap:()=>CC,strictObject:()=>ok,string:()=>bp,symbol:()=>tk,transformer:()=>vk,tuple:()=>ck,undefined:()=>nk,union:()=>Fr,unknown:()=>ik,util:()=>ue,void:()=>sk});var ue;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function n(a){throw new Error}t.assertNever=n,t.arrayToEnum=a=>{let o={};for(let l of a)o[l]=l;return o},t.getValidEnumValues=a=>{let o=t.objectKeys(a).filter(f=>typeof a[a[f]]!="number"),l={};for(let f of o)l[f]=a[f];return t.objectValues(l)},t.objectValues=a=>t.objectKeys(a).map(function(o){return a[o]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let o=[];for(let l in a)Object.prototype.hasOwnProperty.call(a,l)&&o.push(l);return o},t.find=(a,o)=>{for(let l of a)if(o(l))return l},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function i(a,o=" | "){return a.map(l=>typeof l=="string"?`'${l}'`:l).join(o)}t.joinValues=i,t.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(ue||(ue={}));var vl;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(vl||(vl={}));var R=ue.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Dt=t=>{switch(typeof t){case"undefined":return R.undefined;case"string":return R.string;case"number":return Number.isNaN(t)?R.nan:R.number;case"boolean":return R.boolean;case"function":return R.function;case"bigint":return R.bigint;case"symbol":return R.symbol;case"object":return Array.isArray(t)?R.array:t===null?R.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?R.promise:typeof Map<"u"&&t instanceof Map?R.map:typeof Set<"u"&&t instanceof Set?R.set:typeof Date<"u"&&t instanceof Date?R.date:R.object;default:return R.unknown}};var q=ue.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),xC=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),tt=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(o){return o.message},i={_errors:[]},a=o=>{for(let l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(a);else if(l.code==="invalid_return_type")a(l.returnTypeError);else if(l.code==="invalid_arguments")a(l.argumentsError);else if(l.path.length===0)i._errors.push(n(l));else{let f=i,d=0;for(;dn.message){let n={},i=[];for(let a of this.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(e(a))):i.push(e(a));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}};tt.create=t=>new tt(t);var AC=(t,e)=>{let n;switch(t.code){case q.invalid_type:t.received===R.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case q.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,ue.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:n=`Unrecognized key(s) in object: ${ue.joinValues(t.keys,", ")}`;break;case q.invalid_union:n="Invalid input";break;case q.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ue.joinValues(t.options)}`;break;case q.invalid_enum_value:n=`Invalid enum value. Expected ${ue.joinValues(t.options)}, received '${t.received}'`;break;case q.invalid_arguments:n="Invalid function arguments";break;case q.invalid_return_type:n="Invalid function return type";break;case q.invalid_date:n="Invalid date";break;case q.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:ue.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case q.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case q.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case q.custom:n="Invalid input";break;case q.invalid_intersection_types:n="Intersection results could not be merged";break;case q.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case q.not_finite:n="Number must be finite";break;default:n=e.defaultError,ue.assertNever(t)}return{message:n}},en=AC;var hp=en;function CC(t){hp=t}function Nr(){return hp}var Ci=t=>{let{data:e,path:n,errorMaps:i,issueData:a}=t,o=[...n,...a.path||[]],l={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let f="",d=i.filter(m=>!!m).slice().reverse();for(let m of d)f=m(l,{data:e,defaultError:f}).message;return{...a,path:o,message:f}},kC=[];function P(t,e){let n=Nr(),i=Ci({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===en?void 0:en].filter(a=>!!a)});t.common.issues.push(i)}var Ue=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let i=[];for(let a of n){if(a.status==="aborted")return G;a.status==="dirty"&&e.dirty(),i.push(a.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,n){let i=[];for(let a of n){let o=await a.key,l=await a.value;i.push({key:o,value:l})}return t.mergeObjectSync(e,i)}static mergeObjectSync(e,n){let i={};for(let a of n){let{key:o,value:l}=a;if(o.status==="aborted"||l.status==="aborted")return G;o.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(i[o.value]=l.value)}return{status:e.value,value:i}}},G=Object.freeze({status:"aborted"}),jn=t=>({status:"dirty",value:t}),ze=t=>({status:"valid",value:t}),ga=t=>t.status==="aborted",ya=t=>t.status==="dirty",bn=t=>t.status==="valid",Ir=t=>typeof Promise<"u"&&t instanceof Promise;var W;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(W||(W={}));var Ot=class{constructor(e,n,i,a){this._cachedPath=[],this.parent=e,this.data=n,this._path=i,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},dp=(t,e)=>{if(bn(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new tt(t.common.issues);return this._error=n,this._error}}};function ne(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:i,description:a}=t;if(e&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(l,f)=>{let{message:d}=t;return l.code==="invalid_enum_value"?{message:d??f.defaultError}:typeof f.data>"u"?{message:d??i??f.defaultError}:l.code!=="invalid_type"?{message:f.defaultError}:{message:d??n??f.defaultError}},description:a}}var re=class{get description(){return this._def.description}_getType(e){return Dt(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Dt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ue,ctx:{common:e.parent.common,data:e.data,parsedType:Dt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Ir(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let i=this.safeParse(e,n);if(i.success)return i.data;throw i.error}safeParse(e,n){let i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Dt(e)},a=this._parseSync({data:e,path:i.path,parent:i});return dp(i,a)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Dt(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:n});return bn(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>bn(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){let i=await this.safeParseAsync(e,n);if(i.success)return i.data;throw i.error}async safeParseAsync(e,n){let i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Dt(e)},a=this._parse({data:e,path:i.path,parent:i}),o=await(Ir(a)?a:Promise.resolve(a));return dp(i,o)}refine(e,n){let i=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,o)=>{let l=e(a),f=()=>o.addIssue({code:q.custom,...i(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(d=>d?!0:(f(),!1)):l?!0:(f(),!1)})}refinement(e,n){return this._refinement((i,a)=>e(i)?!0:(a.addIssue(typeof n=="function"?n(i,a):n),!1))}_refinement(e){return new St({schema:this,typeName:J.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return wt.create(this,this._def)}nullable(){return Bt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rn.create(this)}promise(){return Sn.create(this,this._def)}or(e){return Qn.create([this,e],this._def)}and(e){return Xn.create(this,e,this._def)}transform(e){return new St({...ne(this._def),schema:this,typeName:J.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new ir({...ne(this._def),innerType:this,defaultValue:n,typeName:J.ZodDefault})}brand(){return new ki({typeName:J.ZodBranded,type:this,...ne(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new sr({...ne(this._def),innerType:this,catchValue:n,typeName:J.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Ti.create(this,e)}readonly(){return ar.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},TC=/^c[^\s-]{8,}$/i,EC=/^[0-9a-z]+$/,NC=/^[0-9A-HJKMNP-TV-Z]{26}$/i,IC=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,$C=/^[a-z0-9_-]{21}$/i,LC=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qC=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,PC=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,MC="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",bl,RC=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,DC=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,FC=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,BC=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,VC=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,WC=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mp="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",UC=new RegExp(`^${mp}$`);function gp(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function HC(t){return new RegExp(`^${gp(t)}$`)}function yp(t){let e=`${mp}T${gp(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function jC(t,e){return!!((e==="v4"||!e)&&RC.test(t)||(e==="v6"||!e)&&FC.test(t))}function KC(t,e){if(!LC.test(t))return!1;try{let[n]=t.split("."),i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(i));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function zC(t,e){return!!((e==="v4"||!e)&&DC.test(t)||(e==="v6"||!e)&&BC.test(t))}var wn=class t extends re{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==R.string){let o=this._getOrReturnCtx(e);return P(o,{code:q.invalid_type,expected:R.string,received:o.parsedType}),G}let i=new Ue,a;for(let o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:q.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="length"){let l=e.data.length>o.value,f=e.data.lengthe.test(a),{validation:n,code:q.invalid_string,...W.errToObj(i)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...W.errToObj(e)})}url(e){return this._addCheck({kind:"url",...W.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...W.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...W.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...W.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...W.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...W.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...W.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...W.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...W.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...W.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...W.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...W.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...W.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...W.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...W.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...W.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...W.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...W.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...W.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...W.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...W.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...W.errToObj(n)})}nonempty(e){return this.min(1,W.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew wn({checks:[],typeName:J.ZodString,coerce:t?.coerce??!1,...ne(t)});function GC(t,e){let n=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,a=n>i?n:i,o=Number.parseInt(t.toFixed(a).replace(".","")),l=Number.parseInt(e.toFixed(a).replace(".",""));return o%l/10**a}var Kn=class t extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==R.number){let o=this._getOrReturnCtx(e);return P(o,{code:q.invalid_type,expected:R.number,received:o.parsedType}),G}let i,a=new Ue;for(let o of this._def.checks)o.kind==="int"?ue.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{code:q.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),P(i,{code:q.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?GC(e.data,o.value)!==0&&(i=this._getOrReturnCtx(e,i),P(i,{code:q.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{code:q.not_finite,message:o.message}),a.dirty()):ue.assertNever(o);return{status:a.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,W.toString(n))}gt(e,n){return this.setLimit("min",e,!1,W.toString(n))}lte(e,n){return this.setLimit("max",e,!0,W.toString(n))}lt(e,n){return this.setLimit("max",e,!1,W.toString(n))}setLimit(e,n,i,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:W.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:W.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:W.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:W.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:W.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:W.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.valuee.kind==="int"||e.kind==="multipleOf"&&ue.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(e===null||i.valuenew Kn({checks:[],typeName:J.ZodNumber,coerce:t?.coerce||!1,...ne(t)});var zn=class t extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==R.bigint)return this._getInvalidInput(e);let i,a=new Ue;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),P(i,{code:q.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),P(i,{code:q.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):ue.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return P(n,{code:q.invalid_type,expected:R.bigint,received:n.parsedType}),G}gte(e,n){return this.setLimit("min",e,!0,W.toString(n))}gt(e,n){return this.setLimit("min",e,!1,W.toString(n))}lte(e,n){return this.setLimit("max",e,!0,W.toString(n))}lt(e,n){return this.setLimit("max",e,!1,W.toString(n))}setLimit(e,n,i,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:W.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:W.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew zn({checks:[],typeName:J.ZodBigInt,coerce:t?.coerce??!1,...ne(t)});var Gn=class extends re{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==R.boolean){let i=this._getOrReturnCtx(e);return P(i,{code:q.invalid_type,expected:R.boolean,received:i.parsedType}),G}return ze(e.data)}};Gn.create=t=>new Gn({typeName:J.ZodBoolean,coerce:t?.coerce||!1,...ne(t)});var Zn=class t extends re{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==R.date){let o=this._getOrReturnCtx(e);return P(o,{code:q.invalid_type,expected:R.date,received:o.parsedType}),G}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return P(o,{code:q.invalid_date}),G}let i=new Ue,a;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:q.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):ue.assertNever(o);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:W.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:W.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew Zn({checks:[],coerce:t?.coerce||!1,typeName:J.ZodDate,...ne(t)});var Lr=class extends re{_parse(e){if(this._getType(e)!==R.symbol){let i=this._getOrReturnCtx(e);return P(i,{code:q.invalid_type,expected:R.symbol,received:i.parsedType}),G}return ze(e.data)}};Lr.create=t=>new Lr({typeName:J.ZodSymbol,...ne(t)});var Yn=class extends re{_parse(e){if(this._getType(e)!==R.undefined){let i=this._getOrReturnCtx(e);return P(i,{code:q.invalid_type,expected:R.undefined,received:i.parsedType}),G}return ze(e.data)}};Yn.create=t=>new Yn({typeName:J.ZodUndefined,...ne(t)});var Jn=class extends re{_parse(e){if(this._getType(e)!==R.null){let i=this._getOrReturnCtx(e);return P(i,{code:q.invalid_type,expected:R.null,received:i.parsedType}),G}return ze(e.data)}};Jn.create=t=>new Jn({typeName:J.ZodNull,...ne(t)});var On=class extends re{constructor(){super(...arguments),this._any=!0}_parse(e){return ze(e.data)}};On.create=t=>new On({typeName:J.ZodAny,...ne(t)});var nn=class extends re{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ze(e.data)}};nn.create=t=>new nn({typeName:J.ZodUnknown,...ne(t)});var ct=class extends re{_parse(e){let n=this._getOrReturnCtx(e);return P(n,{code:q.invalid_type,expected:R.never,received:n.parsedType}),G}};ct.create=t=>new ct({typeName:J.ZodNever,...ne(t)});var qr=class extends re{_parse(e){if(this._getType(e)!==R.undefined){let i=this._getOrReturnCtx(e);return P(i,{code:q.invalid_type,expected:R.void,received:i.parsedType}),G}return ze(e.data)}};qr.create=t=>new qr({typeName:J.ZodVoid,...ne(t)});var rn=class t extends re{_parse(e){let{ctx:n,status:i}=this._processInputParams(e),a=this._def;if(n.parsedType!==R.array)return P(n,{code:q.invalid_type,expected:R.array,received:n.parsedType}),G;if(a.exactLength!==null){let l=n.data.length>a.exactLength.value,f=n.data.lengtha.maxLength.value&&(P(n,{code:q.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((l,f)=>a.type._parseAsync(new Ot(n,l,n.path,f)))).then(l=>Ue.mergeArray(i,l));let o=[...n.data].map((l,f)=>a.type._parseSync(new Ot(n,l,n.path,f)));return Ue.mergeArray(i,o)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:W.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:W.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:W.toString(n)}})}nonempty(e){return this.min(1,e)}};rn.create=(t,e)=>new rn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:J.ZodArray,...ne(e)});function $r(t){if(t instanceof Ve){let e={};for(let n in t.shape){let i=t.shape[n];e[n]=wt.create($r(i))}return new Ve({...t._def,shape:()=>e})}else return t instanceof rn?new rn({...t._def,type:$r(t.element)}):t instanceof wt?wt.create($r(t.unwrap())):t instanceof Bt?Bt.create($r(t.unwrap())):t instanceof Ft?Ft.create(t.items.map(e=>$r(e))):t}var Ve=class t extends re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=ue.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==R.object){let m=this._getOrReturnCtx(e);return P(m,{code:q.invalid_type,expected:R.object,received:m.parsedType}),G}let{status:i,ctx:a}=this._processInputParams(e),{shape:o,keys:l}=this._getCached(),f=[];if(!(this._def.catchall instanceof ct&&this._def.unknownKeys==="strip"))for(let m in a.data)l.includes(m)||f.push(m);let d=[];for(let m of l){let v=o[m],_=a.data[m];d.push({key:{status:"valid",value:m},value:v._parse(new Ot(a,_,a.path,m)),alwaysSet:m in a.data})}if(this._def.catchall instanceof ct){let m=this._def.unknownKeys;if(m==="passthrough")for(let v of f)d.push({key:{status:"valid",value:v},value:{status:"valid",value:a.data[v]}});else if(m==="strict")f.length>0&&(P(a,{code:q.unrecognized_keys,keys:f}),i.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let m=this._def.catchall;for(let v of f){let _=a.data[v];d.push({key:{status:"valid",value:v},value:m._parse(new Ot(a,_,a.path,v)),alwaysSet:v in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let m=[];for(let v of d){let _=await v.key,O=await v.value;m.push({key:_,value:O,alwaysSet:v.alwaysSet})}return m}).then(m=>Ue.mergeObjectSync(i,m)):Ue.mergeObjectSync(i,d)}get shape(){return this._def.shape()}strict(e){return W.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,i)=>{let a=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:W.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:J.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let i of ue.objectKeys(e))e[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let i of ue.objectKeys(this.shape))e[i]||(n[i]=this.shape[i]);return new t({...this._def,shape:()=>n})}deepPartial(){return $r(this)}partial(e){let n={};for(let i of ue.objectKeys(this.shape)){let a=this.shape[i];e&&!e[i]?n[i]=a:n[i]=a.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let i of ue.objectKeys(this.shape))if(e&&!e[i])n[i]=this.shape[i];else{let o=this.shape[i];for(;o instanceof wt;)o=o._def.innerType;n[i]=o}return new t({...this._def,shape:()=>n})}keyof(){return _p(ue.objectKeys(this.shape))}};Ve.create=(t,e)=>new Ve({shape:()=>t,unknownKeys:"strip",catchall:ct.create(),typeName:J.ZodObject,...ne(e)});Ve.strictCreate=(t,e)=>new Ve({shape:()=>t,unknownKeys:"strict",catchall:ct.create(),typeName:J.ZodObject,...ne(e)});Ve.lazycreate=(t,e)=>new Ve({shape:t,unknownKeys:"strip",catchall:ct.create(),typeName:J.ZodObject,...ne(e)});var Qn=class extends re{_parse(e){let{ctx:n}=this._processInputParams(e),i=this._def.options;function a(o){for(let f of o)if(f.result.status==="valid")return f.result;for(let f of o)if(f.result.status==="dirty")return n.common.issues.push(...f.ctx.common.issues),f.result;let l=o.map(f=>new tt(f.ctx.common.issues));return P(n,{code:q.invalid_union,unionErrors:l}),G}if(n.common.async)return Promise.all(i.map(async o=>{let l={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(a);{let o,l=[];for(let d of i){let m={...n,common:{...n.common,issues:[]},parent:null},v=d._parseSync({data:n.data,path:n.path,parent:m});if(v.status==="valid")return v;v.status==="dirty"&&!o&&(o={result:v,ctx:m}),m.common.issues.length&&l.push(m.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let f=l.map(d=>new tt(d));return P(n,{code:q.invalid_union,unionErrors:f}),G}}get options(){return this._def.options}};Qn.create=(t,e)=>new Qn({options:t,typeName:J.ZodUnion,...ne(e)});var tn=t=>t instanceof er?tn(t.schema):t instanceof St?tn(t.innerType()):t instanceof tr?[t.value]:t instanceof nr?t.options:t instanceof rr?ue.objectValues(t.enum):t instanceof ir?tn(t._def.innerType):t instanceof Yn?[void 0]:t instanceof Jn?[null]:t instanceof wt?[void 0,...tn(t.unwrap())]:t instanceof Bt?[null,...tn(t.unwrap())]:t instanceof ki||t instanceof ar?tn(t.unwrap()):t instanceof sr?tn(t._def.innerType):[],_a=class t extends re{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==R.object)return P(n,{code:q.invalid_type,expected:R.object,received:n.parsedType}),G;let i=this.discriminator,a=n.data[i],o=this.optionsMap.get(a);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(P(n,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),G)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,i){let a=new Map;for(let o of n){let l=tn(o.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let f of l){if(a.has(f))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(f)}`);a.set(f,o)}}return new t({typeName:J.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:a,...ne(i)})}};function wl(t,e){let n=Dt(t),i=Dt(e);if(t===e)return{valid:!0,data:t};if(n===R.object&&i===R.object){let a=ue.objectKeys(e),o=ue.objectKeys(t).filter(f=>a.indexOf(f)!==-1),l={...t,...e};for(let f of o){let d=wl(t[f],e[f]);if(!d.valid)return{valid:!1};l[f]=d.data}return{valid:!0,data:l}}else if(n===R.array&&i===R.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let o=0;o{if(ga(o)||ga(l))return G;let f=wl(o.value,l.value);return f.valid?((ya(o)||ya(l))&&n.dirty(),{status:n.value,value:f.data}):(P(i,{code:q.invalid_intersection_types}),G)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,l])=>a(o,l)):a(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};Xn.create=(t,e,n)=>new Xn({left:t,right:e,typeName:J.ZodIntersection,...ne(n)});var Ft=class t extends re{_parse(e){let{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==R.array)return P(i,{code:q.invalid_type,expected:R.array,received:i.parsedType}),G;if(i.data.lengththis._def.items.length&&(P(i,{code:q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let o=[...i.data].map((l,f)=>{let d=this._def.items[f]||this._def.rest;return d?d._parse(new Ot(i,l,i.path,f)):null}).filter(l=>!!l);return i.common.async?Promise.all(o).then(l=>Ue.mergeArray(n,l)):Ue.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Ft.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ft({items:t,typeName:J.ZodTuple,rest:null,...ne(e)})};var va=class t extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==R.object)return P(i,{code:q.invalid_type,expected:R.object,received:i.parsedType}),G;let a=[],o=this._def.keyType,l=this._def.valueType;for(let f in i.data)a.push({key:o._parse(new Ot(i,f,i.path,f)),value:l._parse(new Ot(i,i.data[f],i.path,f)),alwaysSet:f in i.data});return i.common.async?Ue.mergeObjectAsync(n,a):Ue.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(e,n,i){return n instanceof re?new t({keyType:e,valueType:n,typeName:J.ZodRecord,...ne(i)}):new t({keyType:wn.create(),valueType:e,typeName:J.ZodRecord,...ne(n)})}},Pr=class extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==R.map)return P(i,{code:q.invalid_type,expected:R.map,received:i.parsedType}),G;let a=this._def.keyType,o=this._def.valueType,l=[...i.data.entries()].map(([f,d],m)=>({key:a._parse(new Ot(i,f,i.path,[m,"key"])),value:o._parse(new Ot(i,d,i.path,[m,"value"]))}));if(i.common.async){let f=new Map;return Promise.resolve().then(async()=>{for(let d of l){let m=await d.key,v=await d.value;if(m.status==="aborted"||v.status==="aborted")return G;(m.status==="dirty"||v.status==="dirty")&&n.dirty(),f.set(m.value,v.value)}return{status:n.value,value:f}})}else{let f=new Map;for(let d of l){let m=d.key,v=d.value;if(m.status==="aborted"||v.status==="aborted")return G;(m.status==="dirty"||v.status==="dirty")&&n.dirty(),f.set(m.value,v.value)}return{status:n.value,value:f}}}};Pr.create=(t,e,n)=>new Pr({valueType:e,keyType:t,typeName:J.ZodMap,...ne(n)});var Mr=class t extends re{_parse(e){let{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==R.set)return P(i,{code:q.invalid_type,expected:R.set,received:i.parsedType}),G;let a=this._def;a.minSize!==null&&i.data.sizea.maxSize.value&&(P(i,{code:q.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let o=this._def.valueType;function l(d){let m=new Set;for(let v of d){if(v.status==="aborted")return G;v.status==="dirty"&&n.dirty(),m.add(v.value)}return{status:n.value,value:m}}let f=[...i.data.values()].map((d,m)=>o._parse(new Ot(i,d,i.path,m)));return i.common.async?Promise.all(f).then(d=>l(d)):l(f)}min(e,n){return new t({...this._def,minSize:{value:e,message:W.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:W.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Mr.create=(t,e)=>new Mr({valueType:t,minSize:null,maxSize:null,typeName:J.ZodSet,...ne(e)});var ba=class t extends re{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==R.function)return P(n,{code:q.invalid_type,expected:R.function,received:n.parsedType}),G;function i(f,d){return Ci({data:f,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Nr(),en].filter(m=>!!m),issueData:{code:q.invalid_arguments,argumentsError:d}})}function a(f,d){return Ci({data:f,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Nr(),en].filter(m=>!!m),issueData:{code:q.invalid_return_type,returnTypeError:d}})}let o={errorMap:n.common.contextualErrorMap},l=n.data;if(this._def.returns instanceof Sn){let f=this;return ze(async function(...d){let m=new tt([]),v=await f._def.args.parseAsync(d,o).catch(T=>{throw m.addIssue(i(d,T)),m}),_=await Reflect.apply(l,this,v);return await f._def.returns._def.type.parseAsync(_,o).catch(T=>{throw m.addIssue(a(_,T)),m})})}else{let f=this;return ze(function(...d){let m=f._def.args.safeParse(d,o);if(!m.success)throw new tt([i(d,m.error)]);let v=Reflect.apply(l,this,m.data),_=f._def.returns.safeParse(v,o);if(!_.success)throw new tt([a(v,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Ft.create(e).rest(nn.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,i){return new t({args:e||Ft.create([]).rest(nn.create()),returns:n||nn.create(),typeName:J.ZodFunction,...ne(i)})}},er=class extends re{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};er.create=(t,e)=>new er({getter:t,typeName:J.ZodLazy,...ne(e)});var tr=class extends re{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return P(n,{received:n.data,code:q.invalid_literal,expected:this._def.value}),G}return{status:"valid",value:e.data}}get value(){return this._def.value}};tr.create=(t,e)=>new tr({value:t,typeName:J.ZodLiteral,...ne(e)});function _p(t,e){return new nr({values:t,typeName:J.ZodEnum,...ne(e)})}var nr=class t extends re{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),i=this._def.values;return P(n,{expected:ue.joinValues(i),received:n.parsedType,code:q.invalid_type}),G}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),i=this._def.values;return P(n,{received:n.data,code:q.invalid_enum_value,options:i}),G}return ze(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(i=>!e.includes(i)),{...this._def,...n})}};nr.create=_p;var rr=class extends re{_parse(e){let n=ue.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==R.string&&i.parsedType!==R.number){let a=ue.objectValues(n);return P(i,{expected:ue.joinValues(a),received:i.parsedType,code:q.invalid_type}),G}if(this._cache||(this._cache=new Set(ue.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=ue.objectValues(n);return P(i,{received:i.data,code:q.invalid_enum_value,options:a}),G}return ze(e.data)}get enum(){return this._def.values}};rr.create=(t,e)=>new rr({values:t,typeName:J.ZodNativeEnum,...ne(e)});var Sn=class extends re{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==R.promise&&n.common.async===!1)return P(n,{code:q.invalid_type,expected:R.promise,received:n.parsedType}),G;let i=n.parsedType===R.promise?n.data:Promise.resolve(n.data);return ze(i.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Sn.create=(t,e)=>new Sn({type:t,typeName:J.ZodPromise,...ne(e)});var St=class extends re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===J.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:i}=this._processInputParams(e),a=this._def.effect||null,o={addIssue:l=>{P(i,l),l.fatal?n.abort():n.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let l=a.transform(i.data,o);if(i.common.async)return Promise.resolve(l).then(async f=>{if(n.value==="aborted")return G;let d=await this._def.schema._parseAsync({data:f,path:i.path,parent:i});return d.status==="aborted"?G:d.status==="dirty"?jn(d.value):n.value==="dirty"?jn(d.value):d});{if(n.value==="aborted")return G;let f=this._def.schema._parseSync({data:l,path:i.path,parent:i});return f.status==="aborted"?G:f.status==="dirty"?jn(f.value):n.value==="dirty"?jn(f.value):f}}if(a.type==="refinement"){let l=f=>{let d=a.refinement(f,o);if(i.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return f};if(i.common.async===!1){let f=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return f.status==="aborted"?G:(f.status==="dirty"&&n.dirty(),l(f.value),{status:n.value,value:f.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(f=>f.status==="aborted"?G:(f.status==="dirty"&&n.dirty(),l(f.value).then(()=>({status:n.value,value:f.value}))))}if(a.type==="transform")if(i.common.async===!1){let l=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!bn(l))return G;let f=a.transform(l.value,o);if(f instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:f}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(l=>bn(l)?Promise.resolve(a.transform(l.value,o)).then(f=>({status:n.value,value:f})):G);ue.assertNever(a)}};St.create=(t,e,n)=>new St({schema:t,typeName:J.ZodEffects,effect:e,...ne(n)});St.createWithPreprocess=(t,e,n)=>new St({schema:e,effect:{type:"preprocess",transform:t},typeName:J.ZodEffects,...ne(n)});var wt=class extends re{_parse(e){return this._getType(e)===R.undefined?ze(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};wt.create=(t,e)=>new wt({innerType:t,typeName:J.ZodOptional,...ne(e)});var Bt=class extends re{_parse(e){return this._getType(e)===R.null?ze(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Bt.create=(t,e)=>new Bt({innerType:t,typeName:J.ZodNullable,...ne(e)});var ir=class extends re{_parse(e){let{ctx:n}=this._processInputParams(e),i=n.data;return n.parsedType===R.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};ir.create=(t,e)=>new ir({innerType:t,typeName:J.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ne(e)});var sr=class extends re{_parse(e){let{ctx:n}=this._processInputParams(e),i={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Ir(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new tt(i.common.issues)},input:i.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new tt(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};sr.create=(t,e)=>new sr({innerType:t,typeName:J.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ne(e)});var Rr=class extends re{_parse(e){if(this._getType(e)!==R.nan){let i=this._getOrReturnCtx(e);return P(i,{code:q.invalid_type,expected:R.nan,received:i.parsedType}),G}return{status:"valid",value:e.data}}};Rr.create=t=>new Rr({typeName:J.ZodNaN,...ne(t)});var ZC=Symbol("zod_brand"),ki=class extends re{_parse(e){let{ctx:n}=this._processInputParams(e),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}},Ti=class t extends re{_parse(e){let{status:n,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?G:o.status==="dirty"?(n.dirty(),jn(o.value)):this._def.out._parseAsync({data:o.value,path:i.path,parent:i})})();{let a=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?G:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:i.path,parent:i})}}static create(e,n){return new t({in:e,out:n,typeName:J.ZodPipeline})}},ar=class extends re{_parse(e){let n=this._def.innerType._parse(e),i=a=>(bn(a)&&(a.value=Object.freeze(a.value)),a);return Ir(n)?n.then(a=>i(a)):i(n)}unwrap(){return this._def.innerType}};ar.create=(t,e)=>new ar({innerType:t,typeName:J.ZodReadonly,...ne(e)});function pp(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function vp(t,e={},n){return t?On.create().superRefine((i,a)=>{let o=t(i);if(o instanceof Promise)return o.then(l=>{if(!l){let f=pp(e,i),d=f.fatal??n??!0;a.addIssue({code:"custom",...f,fatal:d})}});if(!o){let l=pp(e,i),f=l.fatal??n??!0;a.addIssue({code:"custom",...l,fatal:f})}}):On.create()}var YC={object:Ve.lazycreate},J;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(J||(J={}));var JC=(t,e={message:`Input not instance of ${t.name}`})=>vp(n=>n instanceof t,e),bp=wn.create,wp=Kn.create,QC=Rr.create,XC=zn.create,Op=Gn.create,ek=Zn.create,tk=Lr.create,nk=Yn.create,rk=Jn.create,Dr=On.create,ik=nn.create,Ol=ct.create,sk=qr.create,ak=rn.create,wa=Ve.create,ok=Ve.strictCreate,Fr=Qn.create,uk=_a.create,lk=Xn.create,ck=Ft.create,or=va.create,fk=Pr.create,hk=Mr.create,dk=ba.create,pk=er.create,mk=tr.create,gk=nr.create,yk=rr.create,_k=Sn.create,vk=St.create,bk=wt.create,wk=Bt.create,Ok=St.createWithPreprocess,Sk=Ti.create,xk=()=>bp().optional(),Ak=()=>wp().optional(),Ck=()=>Op().optional(),kk={string:t=>wn.create({...t,coerce:!0}),number:t=>Kn.create({...t,coerce:!0}),boolean:t=>Gn.create({...t,coerce:!0}),bigint:t=>zn.create({...t,coerce:!0}),date:t=>Zn.create({...t,coerce:!0})};var Tk=G;var xp=Q.object({force:Q.boolean().describe("force overwritten").default(!1).optional()});var Ap=Ne(Oa()),Sa=Ne(require("node:path")),xa="\x1B[39m",Sl="\x1B[31m",Ek="\x1B[32m",Cp="\x1B[33m";var ur=(...t)=>{let e=[];for(let n of t)(0,Ap.isString)(n)&&n.includes("/")&&(n=Sa.relative(Sa.resolve(),n)),e.push(n);console.log(...e)},Ni=(...t)=>{ur("<<\u2705",Ek,...t,xa)},ft=(...t)=>{ur("<<\u{1F534}Error:\u{1F53B}\u{1F53B}",Sl);for(let e of t)e instanceof Error?ur(Sl,e.message):ur(Sl,e);ur(xa)},kp=(...t)=>{ur("- \u{1F7E8}",Cp,...t,xa)},Tp=(...t)=>{ur("\u{1F3C3}\u200D\u2642\uFE0F",Cp,...t,xa)};var Ep=Ne(require("node:process")),Np=Ne(Oa()),Nk=t=>{let e=Object.values(t).filter(l=>l instanceof ma)[0];if(!e)throw new Error("no cmd instance found; make sure add this function: e.g: command.action(thisFn)");let n={},i=e.registeredArguments.map(l=>l.name());for(let l=0;l{let n=Nk(t),i=e.safeParse(n);return i.error&&(Object.entries(i.error.format()).forEach(([a,o])=>{a.startsWith("_")||ft(a,(0,Np.flatten)(Object.values(o)).join(";"))}),Ep.exit(0)),i.data};var l0=Ne(Oa());var c0=Ne(require("node:process")),yf=Ne(require("node:path")),gs=require("node:child_process"),f0=require("node:fs");var Ii=Ne(require("node:path"));var qp=require("node:child_process"),xn=Ne(require("fs")),Pp=require("node:fs");var $p=(t,e)=>t.replace(/\s/g,"").includes(e.replace(/\s/g,""));function Ik(...t){let e=process.cwd();return Ii.resolve(e,...t)}function Lp(t){try{return xn.lstatSync(t).isDirectory()}catch{return!1}}function xl(t,e=!0){return Lp(t)||xn.mkdirSync(t,{recursive:e}),Lp(t)}function $k(t,e,n=!1,i=!0){return xl(Ii.dirname(t))?xn.existsSync(t)&&!n?(kp(`file ${t} already exists; use --force to overwrite`),!1):(xn.writeFileSync(t,e,{encoding:"utf-8"}),i&&(0,qp.execSync)(`npx prettier --write ${t}`),!0):(ft(`can not create ${Ii.dirname(t)} directory`),!1)}function Lk(...t){return Ik("src",...t)}function Aa(t,e,n=!1){let i=Lk(t),a;try{a=(0,Pp.readFileSync)(i,{encoding:"utf-8"}).toString()}catch{a=""}return!$p(a,e)&&$k(i,qk(`${a} +`,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=wo(e),i=Jr(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=wo(e),i=Jr(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};gy.Parser=nf});var wy=C(us=>{"use strict";var yy=Uc(),UI=Xi(),os=ns(),HI=Vl(),jI=fe(),KI=tf(),_y=rf();function vy(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new KI.LineCounter||null,prettyErrors:e}}function zI(t,e={}){let{lineCounter:n,prettyErrors:i}=vy(e),a=new _y.Parser(n?.addNewLine),o=new yy.Composer(e),l=Array.from(o.compose(a.parse(t)));if(i&&n)for(let f of l)f.errors.forEach(os.prettifyError(t,n)),f.warnings.forEach(os.prettifyError(t,n));return l.length>0?l:Object.assign([],{empty:!0},o.streamInfo())}function by(t,e={}){let{lineCounter:n,prettyErrors:i}=vy(e),a=new _y.Parser(n?.addNewLine),o=new yy.Composer(e),l=null;for(let f of o.compose(a.parse(t),!0,t.length))if(!l)l=f;else if(l.options.logLevel!=="silent"){l.errors.push(new os.YAMLParseError(f.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(l.errors.forEach(os.prettifyError(t,n)),l.warnings.forEach(os.prettifyError(t,n))),l}function GI(t,e,n){let i;typeof e=="function"?i=e:n===void 0&&e&&typeof e=="object"&&(n=e);let a=by(t,n);if(!a)return null;if(a.warnings.forEach(o=>HI.warn(a.options.logLevel,o)),a.errors.length>0){if(a.options.logLevel!=="silent")throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:i},n))}function ZI(t,e,n){let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let a=Math.round(n);n=a<1?void 0:a>8?{indent:8}:{indent:a}}if(t===void 0){let{keepUndefined:a}=n??e??{};if(!a)return}return jI.isDocument(t)&&!i?t.toString(n):new UI.Document(t,i,n).toString(n)}us.parse=GI;us.parseAllDocuments=zI;us.parseDocument=by;us.stringify=ZI});var af=C(ge=>{"use strict";var YI=Uc(),JI=Xi(),QI=Sc(),sf=ns(),XI=Mi(),qn=fe(),e$=En(),t$=Le(),n$=In(),r$=$n(),i$=vo(),s$=Xc(),a$=tf(),o$=rf(),Oo=wy(),Oy=$i();ge.Composer=YI.Composer;ge.Document=JI.Document;ge.Schema=QI.Schema;ge.YAMLError=sf.YAMLError;ge.YAMLParseError=sf.YAMLParseError;ge.YAMLWarning=sf.YAMLWarning;ge.Alias=XI.Alias;ge.isAlias=qn.isAlias;ge.isCollection=qn.isCollection;ge.isDocument=qn.isDocument;ge.isMap=qn.isMap;ge.isNode=qn.isNode;ge.isPair=qn.isPair;ge.isScalar=qn.isScalar;ge.isSeq=qn.isSeq;ge.Pair=e$.Pair;ge.Scalar=t$.Scalar;ge.YAMLMap=n$.YAMLMap;ge.YAMLSeq=r$.YAMLSeq;ge.CST=i$;ge.Lexer=s$.Lexer;ge.LineCounter=a$.LineCounter;ge.Parser=o$.Parser;ge.parse=Oo.parse;ge.parseAllDocuments=Oo.parseAllDocuments;ge.parseDocument=Oo.parseDocument;ge.stringify=Oo.stringify;ge.visit=Oy.visit;ge.visitAsync=Oy.visitAsync});var So=C((E2,Sy)=>{var u$=Array.isArray;Sy.exports=u$});var Ay=C((N2,xy)=>{var l$=typeof global=="object"&&global&&global.Object===Object&&global;xy.exports=l$});var xo=C((I2,Cy)=>{var c$=Ay(),f$=typeof self=="object"&&self&&self.Object===Object&&self,h$=c$||f$||Function("return this")();Cy.exports=h$});var Ao=C(($2,ky)=>{var d$=xo(),p$=d$.Symbol;ky.exports=p$});var Iy=C((L2,Ny)=>{var Ty=Ao(),Ey=Object.prototype,m$=Ey.hasOwnProperty,g$=Ey.toString,ls=Ty?Ty.toStringTag:void 0;function y$(t){var e=m$.call(t,ls),n=t[ls];try{t[ls]=void 0;var i=!0}catch{}var a=g$.call(t);return i&&(e?t[ls]=n:delete t[ls]),a}Ny.exports=y$});var Ly=C((q2,$y)=>{var _$=Object.prototype,v$=_$.toString;function b$(t){return v$.call(t)}$y.exports=b$});var of=C((P2,My)=>{var qy=Ao(),w$=Iy(),O$=Ly(),S$="[object Null]",x$="[object Undefined]",Py=qy?qy.toStringTag:void 0;function A$(t){return t==null?t===void 0?x$:S$:Py&&Py in Object(t)?w$(t):O$(t)}My.exports=A$});var Dy=C((M2,Ry)=>{function C$(t){return t!=null&&typeof t=="object"}Ry.exports=C$});var Co=C((R2,Fy)=>{var k$=of(),T$=Dy(),E$="[object Symbol]";function N$(t){return typeof t=="symbol"||T$(t)&&k$(t)==E$}Fy.exports=N$});var Vy=C((D2,By)=>{var I$=So(),$$=Co(),L$=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,q$=/^\w*$/;function P$(t,e){if(I$(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||$$(t)?!0:q$.test(t)||!L$.test(t)||e!=null&&t in Object(e)}By.exports=P$});var uf=C((F2,Wy)=>{function M$(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}Wy.exports=M$});var Hy=C((B2,Uy)=>{var R$=of(),D$=uf(),F$="[object AsyncFunction]",B$="[object Function]",V$="[object GeneratorFunction]",W$="[object Proxy]";function U$(t){if(!D$(t))return!1;var e=R$(t);return e==B$||e==V$||e==F$||e==W$}Uy.exports=U$});var Ky=C((V2,jy)=>{var H$=xo(),j$=H$["__core-js_shared__"];jy.exports=j$});var Zy=C((W2,Gy)=>{var lf=Ky(),zy=function(){var t=/[^.]+$/.exec(lf&&lf.keys&&lf.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function K$(t){return!!zy&&zy in t}Gy.exports=K$});var Jy=C((U2,Yy)=>{var z$=Function.prototype,G$=z$.toString;function Z$(t){if(t!=null){try{return G$.call(t)}catch{}try{return t+""}catch{}}return""}Yy.exports=Z$});var Xy=C((H2,Qy)=>{var Y$=Hy(),J$=Zy(),Q$=uf(),X$=Jy(),eL=/[\\^$.*+?()[\]{}|]/g,tL=/^\[object .+?Constructor\]$/,nL=Function.prototype,rL=Object.prototype,iL=nL.toString,sL=rL.hasOwnProperty,aL=RegExp("^"+iL.call(sL).replace(eL,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function oL(t){if(!Q$(t)||J$(t))return!1;var e=Y$(t)?aL:tL;return e.test(X$(t))}Qy.exports=oL});var t_=C((j2,e_)=>{function uL(t,e){return t?.[e]}e_.exports=uL});var cf=C((K2,n_)=>{var lL=Xy(),cL=t_();function fL(t,e){var n=cL(t,e);return lL(n)?n:void 0}n_.exports=fL});var cs=C((z2,r_)=>{var hL=cf(),dL=hL(Object,"create");r_.exports=dL});var a_=C((G2,s_)=>{var i_=cs();function pL(){this.__data__=i_?i_(null):{},this.size=0}s_.exports=pL});var u_=C((Z2,o_)=>{function mL(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}o_.exports=mL});var c_=C((Y2,l_)=>{var gL=cs(),yL="__lodash_hash_undefined__",_L=Object.prototype,vL=_L.hasOwnProperty;function bL(t){var e=this.__data__;if(gL){var n=e[t];return n===yL?void 0:n}return vL.call(e,t)?e[t]:void 0}l_.exports=bL});var h_=C((J2,f_)=>{var wL=cs(),OL=Object.prototype,SL=OL.hasOwnProperty;function xL(t){var e=this.__data__;return wL?e[t]!==void 0:SL.call(e,t)}f_.exports=xL});var p_=C((Q2,d_)=>{var AL=cs(),CL="__lodash_hash_undefined__";function kL(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=AL&&e===void 0?CL:e,this}d_.exports=kL});var g_=C((X2,m_)=>{var TL=a_(),EL=u_(),NL=c_(),IL=h_(),$L=p_();function Qr(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e{function LL(){this.__data__=[],this.size=0}y_.exports=LL});var b_=C((tR,v_)=>{function qL(t,e){return t===e||t!==t&&e!==e}v_.exports=qL});var fs=C((nR,w_)=>{var PL=b_();function ML(t,e){for(var n=t.length;n--;)if(PL(t[n][0],e))return n;return-1}w_.exports=ML});var S_=C((rR,O_)=>{var RL=fs(),DL=Array.prototype,FL=DL.splice;function BL(t){var e=this.__data__,n=RL(e,t);if(n<0)return!1;var i=e.length-1;return n==i?e.pop():FL.call(e,n,1),--this.size,!0}O_.exports=BL});var A_=C((iR,x_)=>{var VL=fs();function WL(t){var e=this.__data__,n=VL(e,t);return n<0?void 0:e[n][1]}x_.exports=WL});var k_=C((sR,C_)=>{var UL=fs();function HL(t){return UL(this.__data__,t)>-1}C_.exports=HL});var E_=C((aR,T_)=>{var jL=fs();function KL(t,e){var n=this.__data__,i=jL(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}T_.exports=KL});var I_=C((oR,N_)=>{var zL=__(),GL=S_(),ZL=A_(),YL=k_(),JL=E_();function Xr(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e{var QL=cf(),XL=xo(),eq=QL(XL,"Map");$_.exports=eq});var M_=C((lR,P_)=>{var q_=g_(),tq=I_(),nq=L_();function rq(){this.size=0,this.__data__={hash:new q_,map:new(nq||tq),string:new q_}}P_.exports=rq});var D_=C((cR,R_)=>{function iq(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}R_.exports=iq});var hs=C((fR,F_)=>{var sq=D_();function aq(t,e){var n=t.__data__;return sq(e)?n[typeof e=="string"?"string":"hash"]:n.map}F_.exports=aq});var V_=C((hR,B_)=>{var oq=hs();function uq(t){var e=oq(this,t).delete(t);return this.size-=e?1:0,e}B_.exports=uq});var U_=C((dR,W_)=>{var lq=hs();function cq(t){return lq(this,t).get(t)}W_.exports=cq});var j_=C((pR,H_)=>{var fq=hs();function hq(t){return fq(this,t).has(t)}H_.exports=hq});var z_=C((mR,K_)=>{var dq=hs();function pq(t,e){var n=dq(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}K_.exports=pq});var Z_=C((gR,G_)=>{var mq=M_(),gq=V_(),yq=U_(),_q=j_(),vq=z_();function ei(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e{var Y_=Z_(),bq="Expected a function";function ff(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(bq);var n=function(){var i=arguments,a=e?e.apply(this,i):i[0],o=n.cache;if(o.has(a))return o.get(a);var l=t.apply(this,i);return n.cache=o.set(a,l)||o,l};return n.cache=new(ff.Cache||Y_),n}ff.Cache=Y_;J_.exports=ff});var ev=C((_R,X_)=>{var wq=Q_(),Oq=500;function Sq(t){var e=wq(t,function(i){return n.size===Oq&&n.clear(),i}),n=e.cache;return e}X_.exports=Sq});var nv=C((vR,tv)=>{var xq=ev(),Aq=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Cq=/\\(\\)?/g,kq=xq(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Aq,function(n,i,a,o){e.push(a?o.replace(Cq,"$1"):i||n)}),e});tv.exports=kq});var iv=C((bR,rv)=>{function Tq(t,e){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n{var sv=Ao(),Eq=iv(),Nq=So(),Iq=Co(),$q=1/0,av=sv?sv.prototype:void 0,ov=av?av.toString:void 0;function uv(t){if(typeof t=="string")return t;if(Nq(t))return Eq(t,uv)+"";if(Iq(t))return ov?ov.call(t):"";var e=t+"";return e=="0"&&1/t==-$q?"-0":e}lv.exports=uv});var hv=C((OR,fv)=>{var Lq=cv();function qq(t){return t==null?"":Lq(t)}fv.exports=qq});var pv=C((SR,dv)=>{var Pq=So(),Mq=Vy(),Rq=nv(),Dq=hv();function Fq(t,e){return Pq(t)?t:Mq(t,e)?[t]:Rq(Dq(t))}dv.exports=Fq});var gv=C((xR,mv)=>{var Bq=Co(),Vq=1/0;function Wq(t){if(typeof t=="string"||Bq(t))return t;var e=t+"";return e=="0"&&1/t==-Vq?"-0":e}mv.exports=Wq});var _v=C((AR,yv)=>{var Uq=pv(),Hq=gv();function jq(t,e){e=Uq(e,t);for(var n=0,i=e.length;t!=null&&n{var Kq=_v();function zq(t,e,n){var i=t==null?void 0:Kq(t,e);return i===void 0?n:i}vv.exports=zq});var aP={};Zd(aP,{program:()=>qo});module.exports=uC(aP);var lp=Ne(up(),1),{program:mP,createCommand:gP,createArgument:yP,createOption:_P,CommanderError:vP,InvalidArgumentError:bP,InvalidOptionArgumentError:wP,Command:ma,Argument:OP,Option:cp,Help:SP}=lp.default;var fp="2.3.0";var Q={};Zd(Q,{BRAND:()=>ZC,DIRTY:()=>jn,EMPTY_PATH:()=>kC,INVALID:()=>G,NEVER:()=>Tk,OK:()=>ze,ParseStatus:()=>Ue,Schema:()=>re,ZodAny:()=>On,ZodArray:()=>rn,ZodBigInt:()=>zn,ZodBoolean:()=>Gn,ZodBranded:()=>ki,ZodCatch:()=>sr,ZodDate:()=>Zn,ZodDefault:()=>ir,ZodDiscriminatedUnion:()=>_a,ZodEffects:()=>St,ZodEnum:()=>nr,ZodError:()=>tt,ZodFirstPartyTypeKind:()=>J,ZodFunction:()=>ba,ZodIntersection:()=>Xn,ZodIssueCode:()=>q,ZodLazy:()=>er,ZodLiteral:()=>tr,ZodMap:()=>Pr,ZodNaN:()=>Rr,ZodNativeEnum:()=>rr,ZodNever:()=>ct,ZodNull:()=>Jn,ZodNullable:()=>Bt,ZodNumber:()=>Kn,ZodObject:()=>Ve,ZodOptional:()=>wt,ZodParsedType:()=>R,ZodPipeline:()=>Ti,ZodPromise:()=>Sn,ZodReadonly:()=>ar,ZodRecord:()=>va,ZodSchema:()=>re,ZodSet:()=>Mr,ZodString:()=>wn,ZodSymbol:()=>Lr,ZodTransformer:()=>St,ZodTuple:()=>Ft,ZodType:()=>re,ZodUndefined:()=>Yn,ZodUnion:()=>Qn,ZodUnknown:()=>nn,ZodVoid:()=>qr,addIssueToContext:()=>P,any:()=>Dr,array:()=>ak,bigint:()=>XC,boolean:()=>Op,coerce:()=>kk,custom:()=>vp,date:()=>ek,datetimeRegex:()=>yp,defaultErrorMap:()=>en,discriminatedUnion:()=>uk,effect:()=>vk,enum:()=>gk,function:()=>dk,getErrorMap:()=>Nr,getParsedType:()=>Dt,instanceof:()=>JC,intersection:()=>lk,isAborted:()=>ga,isAsync:()=>Ir,isDirty:()=>ya,isValid:()=>bn,late:()=>YC,lazy:()=>pk,literal:()=>mk,makeIssue:()=>Ci,map:()=>fk,nan:()=>QC,nativeEnum:()=>yk,never:()=>Ol,null:()=>rk,nullable:()=>wk,number:()=>wp,object:()=>wa,objectUtil:()=>vl,oboolean:()=>Ck,onumber:()=>Ak,optional:()=>bk,ostring:()=>xk,pipeline:()=>Sk,preprocess:()=>Ok,promise:()=>_k,quotelessJson:()=>xC,record:()=>or,set:()=>hk,setErrorMap:()=>CC,strictObject:()=>ok,string:()=>bp,symbol:()=>tk,transformer:()=>vk,tuple:()=>ck,undefined:()=>nk,union:()=>Fr,unknown:()=>ik,util:()=>ue,void:()=>sk});var ue;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function n(a){throw new Error}t.assertNever=n,t.arrayToEnum=a=>{let o={};for(let l of a)o[l]=l;return o},t.getValidEnumValues=a=>{let o=t.objectKeys(a).filter(f=>typeof a[a[f]]!="number"),l={};for(let f of o)l[f]=a[f];return t.objectValues(l)},t.objectValues=a=>t.objectKeys(a).map(function(o){return a[o]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let o=[];for(let l in a)Object.prototype.hasOwnProperty.call(a,l)&&o.push(l);return o},t.find=(a,o)=>{for(let l of a)if(o(l))return l},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function i(a,o=" | "){return a.map(l=>typeof l=="string"?`'${l}'`:l).join(o)}t.joinValues=i,t.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(ue||(ue={}));var vl;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(vl||(vl={}));var R=ue.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Dt=t=>{switch(typeof t){case"undefined":return R.undefined;case"string":return R.string;case"number":return Number.isNaN(t)?R.nan:R.number;case"boolean":return R.boolean;case"function":return R.function;case"bigint":return R.bigint;case"symbol":return R.symbol;case"object":return Array.isArray(t)?R.array:t===null?R.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?R.promise:typeof Map<"u"&&t instanceof Map?R.map:typeof Set<"u"&&t instanceof Set?R.set:typeof Date<"u"&&t instanceof Date?R.date:R.object;default:return R.unknown}};var q=ue.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),xC=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),tt=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(o){return o.message},i={_errors:[]},a=o=>{for(let l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(a);else if(l.code==="invalid_return_type")a(l.returnTypeError);else if(l.code==="invalid_arguments")a(l.argumentsError);else if(l.path.length===0)i._errors.push(n(l));else{let f=i,d=0;for(;dn.message){let n={},i=[];for(let a of this.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(e(a))):i.push(e(a));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}};tt.create=t=>new tt(t);var AC=(t,e)=>{let n;switch(t.code){case q.invalid_type:t.received===R.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case q.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,ue.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:n=`Unrecognized key(s) in object: ${ue.joinValues(t.keys,", ")}`;break;case q.invalid_union:n="Invalid input";break;case q.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ue.joinValues(t.options)}`;break;case q.invalid_enum_value:n=`Invalid enum value. Expected ${ue.joinValues(t.options)}, received '${t.received}'`;break;case q.invalid_arguments:n="Invalid function arguments";break;case q.invalid_return_type:n="Invalid function return type";break;case q.invalid_date:n="Invalid date";break;case q.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:ue.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case q.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case q.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case q.custom:n="Invalid input";break;case q.invalid_intersection_types:n="Intersection results could not be merged";break;case q.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case q.not_finite:n="Number must be finite";break;default:n=e.defaultError,ue.assertNever(t)}return{message:n}},en=AC;var hp=en;function CC(t){hp=t}function Nr(){return hp}var Ci=t=>{let{data:e,path:n,errorMaps:i,issueData:a}=t,o=[...n,...a.path||[]],l={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let f="",d=i.filter(m=>!!m).slice().reverse();for(let m of d)f=m(l,{data:e,defaultError:f}).message;return{...a,path:o,message:f}},kC=[];function P(t,e){let n=Nr(),i=Ci({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===en?void 0:en].filter(a=>!!a)});t.common.issues.push(i)}var Ue=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let i=[];for(let a of n){if(a.status==="aborted")return G;a.status==="dirty"&&e.dirty(),i.push(a.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,n){let i=[];for(let a of n){let o=await a.key,l=await a.value;i.push({key:o,value:l})}return t.mergeObjectSync(e,i)}static mergeObjectSync(e,n){let i={};for(let a of n){let{key:o,value:l}=a;if(o.status==="aborted"||l.status==="aborted")return G;o.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(i[o.value]=l.value)}return{status:e.value,value:i}}},G=Object.freeze({status:"aborted"}),jn=t=>({status:"dirty",value:t}),ze=t=>({status:"valid",value:t}),ga=t=>t.status==="aborted",ya=t=>t.status==="dirty",bn=t=>t.status==="valid",Ir=t=>typeof Promise<"u"&&t instanceof Promise;var W;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(W||(W={}));var Ot=class{constructor(e,n,i,a){this._cachedPath=[],this.parent=e,this.data=n,this._path=i,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},dp=(t,e)=>{if(bn(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new tt(t.common.issues);return this._error=n,this._error}}};function ne(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:i,description:a}=t;if(e&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(l,f)=>{let{message:d}=t;return l.code==="invalid_enum_value"?{message:d??f.defaultError}:typeof f.data>"u"?{message:d??i??f.defaultError}:l.code!=="invalid_type"?{message:f.defaultError}:{message:d??n??f.defaultError}},description:a}}var re=class{get description(){return this._def.description}_getType(e){return Dt(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Dt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ue,ctx:{common:e.parent.common,data:e.data,parsedType:Dt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Ir(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let i=this.safeParse(e,n);if(i.success)return i.data;throw i.error}safeParse(e,n){let i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Dt(e)},a=this._parseSync({data:e,path:i.path,parent:i});return dp(i,a)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Dt(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:n});return bn(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>bn(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){let i=await this.safeParseAsync(e,n);if(i.success)return i.data;throw i.error}async safeParseAsync(e,n){let i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Dt(e)},a=this._parse({data:e,path:i.path,parent:i}),o=await(Ir(a)?a:Promise.resolve(a));return dp(i,o)}refine(e,n){let i=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,o)=>{let l=e(a),f=()=>o.addIssue({code:q.custom,...i(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(d=>d?!0:(f(),!1)):l?!0:(f(),!1)})}refinement(e,n){return this._refinement((i,a)=>e(i)?!0:(a.addIssue(typeof n=="function"?n(i,a):n),!1))}_refinement(e){return new St({schema:this,typeName:J.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return wt.create(this,this._def)}nullable(){return Bt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rn.create(this)}promise(){return Sn.create(this,this._def)}or(e){return Qn.create([this,e],this._def)}and(e){return Xn.create(this,e,this._def)}transform(e){return new St({...ne(this._def),schema:this,typeName:J.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new ir({...ne(this._def),innerType:this,defaultValue:n,typeName:J.ZodDefault})}brand(){return new ki({typeName:J.ZodBranded,type:this,...ne(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new sr({...ne(this._def),innerType:this,catchValue:n,typeName:J.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Ti.create(this,e)}readonly(){return ar.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},TC=/^c[^\s-]{8,}$/i,EC=/^[0-9a-z]+$/,NC=/^[0-9A-HJKMNP-TV-Z]{26}$/i,IC=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,$C=/^[a-z0-9_-]{21}$/i,LC=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qC=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,PC=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,MC="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",bl,RC=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,DC=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,FC=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,BC=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,VC=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,WC=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mp="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",UC=new RegExp(`^${mp}$`);function gp(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function HC(t){return new RegExp(`^${gp(t)}$`)}function yp(t){let e=`${mp}T${gp(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function jC(t,e){return!!((e==="v4"||!e)&&RC.test(t)||(e==="v6"||!e)&&FC.test(t))}function KC(t,e){if(!LC.test(t))return!1;try{let[n]=t.split("."),i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(i));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function zC(t,e){return!!((e==="v4"||!e)&&DC.test(t)||(e==="v6"||!e)&&BC.test(t))}var wn=class t extends re{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==R.string){let o=this._getOrReturnCtx(e);return P(o,{code:q.invalid_type,expected:R.string,received:o.parsedType}),G}let i=new Ue,a;for(let o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:q.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="length"){let l=e.data.length>o.value,f=e.data.lengthe.test(a),{validation:n,code:q.invalid_string,...W.errToObj(i)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...W.errToObj(e)})}url(e){return this._addCheck({kind:"url",...W.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...W.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...W.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...W.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...W.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...W.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...W.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...W.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...W.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...W.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...W.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...W.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...W.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...W.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...W.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...W.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...W.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...W.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...W.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...W.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...W.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...W.errToObj(n)})}nonempty(e){return this.min(1,W.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew wn({checks:[],typeName:J.ZodString,coerce:t?.coerce??!1,...ne(t)});function GC(t,e){let n=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,a=n>i?n:i,o=Number.parseInt(t.toFixed(a).replace(".","")),l=Number.parseInt(e.toFixed(a).replace(".",""));return o%l/10**a}var Kn=class t extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==R.number){let o=this._getOrReturnCtx(e);return P(o,{code:q.invalid_type,expected:R.number,received:o.parsedType}),G}let i,a=new Ue;for(let o of this._def.checks)o.kind==="int"?ue.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{code:q.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),P(i,{code:q.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?GC(e.data,o.value)!==0&&(i=this._getOrReturnCtx(e,i),P(i,{code:q.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{code:q.not_finite,message:o.message}),a.dirty()):ue.assertNever(o);return{status:a.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,W.toString(n))}gt(e,n){return this.setLimit("min",e,!1,W.toString(n))}lte(e,n){return this.setLimit("max",e,!0,W.toString(n))}lt(e,n){return this.setLimit("max",e,!1,W.toString(n))}setLimit(e,n,i,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:W.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:W.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:W.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:W.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:W.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:W.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.valuee.kind==="int"||e.kind==="multipleOf"&&ue.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(e===null||i.valuenew Kn({checks:[],typeName:J.ZodNumber,coerce:t?.coerce||!1,...ne(t)});var zn=class t extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==R.bigint)return this._getInvalidInput(e);let i,a=new Ue;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),P(i,{code:q.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),P(i,{code:q.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):ue.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return P(n,{code:q.invalid_type,expected:R.bigint,received:n.parsedType}),G}gte(e,n){return this.setLimit("min",e,!0,W.toString(n))}gt(e,n){return this.setLimit("min",e,!1,W.toString(n))}lte(e,n){return this.setLimit("max",e,!0,W.toString(n))}lt(e,n){return this.setLimit("max",e,!1,W.toString(n))}setLimit(e,n,i,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:W.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:W.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew zn({checks:[],typeName:J.ZodBigInt,coerce:t?.coerce??!1,...ne(t)});var Gn=class extends re{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==R.boolean){let i=this._getOrReturnCtx(e);return P(i,{code:q.invalid_type,expected:R.boolean,received:i.parsedType}),G}return ze(e.data)}};Gn.create=t=>new Gn({typeName:J.ZodBoolean,coerce:t?.coerce||!1,...ne(t)});var Zn=class t extends re{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==R.date){let o=this._getOrReturnCtx(e);return P(o,{code:q.invalid_type,expected:R.date,received:o.parsedType}),G}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return P(o,{code:q.invalid_date}),G}let i=new Ue,a;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(a=this._getOrReturnCtx(e,a),P(a,{code:q.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):ue.assertNever(o);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:W.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:W.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew Zn({checks:[],coerce:t?.coerce||!1,typeName:J.ZodDate,...ne(t)});var Lr=class extends re{_parse(e){if(this._getType(e)!==R.symbol){let i=this._getOrReturnCtx(e);return P(i,{code:q.invalid_type,expected:R.symbol,received:i.parsedType}),G}return ze(e.data)}};Lr.create=t=>new Lr({typeName:J.ZodSymbol,...ne(t)});var Yn=class extends re{_parse(e){if(this._getType(e)!==R.undefined){let i=this._getOrReturnCtx(e);return P(i,{code:q.invalid_type,expected:R.undefined,received:i.parsedType}),G}return ze(e.data)}};Yn.create=t=>new Yn({typeName:J.ZodUndefined,...ne(t)});var Jn=class extends re{_parse(e){if(this._getType(e)!==R.null){let i=this._getOrReturnCtx(e);return P(i,{code:q.invalid_type,expected:R.null,received:i.parsedType}),G}return ze(e.data)}};Jn.create=t=>new Jn({typeName:J.ZodNull,...ne(t)});var On=class extends re{constructor(){super(...arguments),this._any=!0}_parse(e){return ze(e.data)}};On.create=t=>new On({typeName:J.ZodAny,...ne(t)});var nn=class extends re{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ze(e.data)}};nn.create=t=>new nn({typeName:J.ZodUnknown,...ne(t)});var ct=class extends re{_parse(e){let n=this._getOrReturnCtx(e);return P(n,{code:q.invalid_type,expected:R.never,received:n.parsedType}),G}};ct.create=t=>new ct({typeName:J.ZodNever,...ne(t)});var qr=class extends re{_parse(e){if(this._getType(e)!==R.undefined){let i=this._getOrReturnCtx(e);return P(i,{code:q.invalid_type,expected:R.void,received:i.parsedType}),G}return ze(e.data)}};qr.create=t=>new qr({typeName:J.ZodVoid,...ne(t)});var rn=class t extends re{_parse(e){let{ctx:n,status:i}=this._processInputParams(e),a=this._def;if(n.parsedType!==R.array)return P(n,{code:q.invalid_type,expected:R.array,received:n.parsedType}),G;if(a.exactLength!==null){let l=n.data.length>a.exactLength.value,f=n.data.lengtha.maxLength.value&&(P(n,{code:q.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((l,f)=>a.type._parseAsync(new Ot(n,l,n.path,f)))).then(l=>Ue.mergeArray(i,l));let o=[...n.data].map((l,f)=>a.type._parseSync(new Ot(n,l,n.path,f)));return Ue.mergeArray(i,o)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:W.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:W.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:W.toString(n)}})}nonempty(e){return this.min(1,e)}};rn.create=(t,e)=>new rn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:J.ZodArray,...ne(e)});function $r(t){if(t instanceof Ve){let e={};for(let n in t.shape){let i=t.shape[n];e[n]=wt.create($r(i))}return new Ve({...t._def,shape:()=>e})}else return t instanceof rn?new rn({...t._def,type:$r(t.element)}):t instanceof wt?wt.create($r(t.unwrap())):t instanceof Bt?Bt.create($r(t.unwrap())):t instanceof Ft?Ft.create(t.items.map(e=>$r(e))):t}var Ve=class t extends re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=ue.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==R.object){let m=this._getOrReturnCtx(e);return P(m,{code:q.invalid_type,expected:R.object,received:m.parsedType}),G}let{status:i,ctx:a}=this._processInputParams(e),{shape:o,keys:l}=this._getCached(),f=[];if(!(this._def.catchall instanceof ct&&this._def.unknownKeys==="strip"))for(let m in a.data)l.includes(m)||f.push(m);let d=[];for(let m of l){let v=o[m],_=a.data[m];d.push({key:{status:"valid",value:m},value:v._parse(new Ot(a,_,a.path,m)),alwaysSet:m in a.data})}if(this._def.catchall instanceof ct){let m=this._def.unknownKeys;if(m==="passthrough")for(let v of f)d.push({key:{status:"valid",value:v},value:{status:"valid",value:a.data[v]}});else if(m==="strict")f.length>0&&(P(a,{code:q.unrecognized_keys,keys:f}),i.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let m=this._def.catchall;for(let v of f){let _=a.data[v];d.push({key:{status:"valid",value:v},value:m._parse(new Ot(a,_,a.path,v)),alwaysSet:v in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let m=[];for(let v of d){let _=await v.key,O=await v.value;m.push({key:_,value:O,alwaysSet:v.alwaysSet})}return m}).then(m=>Ue.mergeObjectSync(i,m)):Ue.mergeObjectSync(i,d)}get shape(){return this._def.shape()}strict(e){return W.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,i)=>{let a=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:W.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:J.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let i of ue.objectKeys(e))e[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let i of ue.objectKeys(this.shape))e[i]||(n[i]=this.shape[i]);return new t({...this._def,shape:()=>n})}deepPartial(){return $r(this)}partial(e){let n={};for(let i of ue.objectKeys(this.shape)){let a=this.shape[i];e&&!e[i]?n[i]=a:n[i]=a.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let i of ue.objectKeys(this.shape))if(e&&!e[i])n[i]=this.shape[i];else{let o=this.shape[i];for(;o instanceof wt;)o=o._def.innerType;n[i]=o}return new t({...this._def,shape:()=>n})}keyof(){return _p(ue.objectKeys(this.shape))}};Ve.create=(t,e)=>new Ve({shape:()=>t,unknownKeys:"strip",catchall:ct.create(),typeName:J.ZodObject,...ne(e)});Ve.strictCreate=(t,e)=>new Ve({shape:()=>t,unknownKeys:"strict",catchall:ct.create(),typeName:J.ZodObject,...ne(e)});Ve.lazycreate=(t,e)=>new Ve({shape:t,unknownKeys:"strip",catchall:ct.create(),typeName:J.ZodObject,...ne(e)});var Qn=class extends re{_parse(e){let{ctx:n}=this._processInputParams(e),i=this._def.options;function a(o){for(let f of o)if(f.result.status==="valid")return f.result;for(let f of o)if(f.result.status==="dirty")return n.common.issues.push(...f.ctx.common.issues),f.result;let l=o.map(f=>new tt(f.ctx.common.issues));return P(n,{code:q.invalid_union,unionErrors:l}),G}if(n.common.async)return Promise.all(i.map(async o=>{let l={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(a);{let o,l=[];for(let d of i){let m={...n,common:{...n.common,issues:[]},parent:null},v=d._parseSync({data:n.data,path:n.path,parent:m});if(v.status==="valid")return v;v.status==="dirty"&&!o&&(o={result:v,ctx:m}),m.common.issues.length&&l.push(m.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let f=l.map(d=>new tt(d));return P(n,{code:q.invalid_union,unionErrors:f}),G}}get options(){return this._def.options}};Qn.create=(t,e)=>new Qn({options:t,typeName:J.ZodUnion,...ne(e)});var tn=t=>t instanceof er?tn(t.schema):t instanceof St?tn(t.innerType()):t instanceof tr?[t.value]:t instanceof nr?t.options:t instanceof rr?ue.objectValues(t.enum):t instanceof ir?tn(t._def.innerType):t instanceof Yn?[void 0]:t instanceof Jn?[null]:t instanceof wt?[void 0,...tn(t.unwrap())]:t instanceof Bt?[null,...tn(t.unwrap())]:t instanceof ki||t instanceof ar?tn(t.unwrap()):t instanceof sr?tn(t._def.innerType):[],_a=class t extends re{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==R.object)return P(n,{code:q.invalid_type,expected:R.object,received:n.parsedType}),G;let i=this.discriminator,a=n.data[i],o=this.optionsMap.get(a);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(P(n,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),G)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,i){let a=new Map;for(let o of n){let l=tn(o.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let f of l){if(a.has(f))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(f)}`);a.set(f,o)}}return new t({typeName:J.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:a,...ne(i)})}};function wl(t,e){let n=Dt(t),i=Dt(e);if(t===e)return{valid:!0,data:t};if(n===R.object&&i===R.object){let a=ue.objectKeys(e),o=ue.objectKeys(t).filter(f=>a.indexOf(f)!==-1),l={...t,...e};for(let f of o){let d=wl(t[f],e[f]);if(!d.valid)return{valid:!1};l[f]=d.data}return{valid:!0,data:l}}else if(n===R.array&&i===R.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let o=0;o{if(ga(o)||ga(l))return G;let f=wl(o.value,l.value);return f.valid?((ya(o)||ya(l))&&n.dirty(),{status:n.value,value:f.data}):(P(i,{code:q.invalid_intersection_types}),G)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,l])=>a(o,l)):a(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};Xn.create=(t,e,n)=>new Xn({left:t,right:e,typeName:J.ZodIntersection,...ne(n)});var Ft=class t extends re{_parse(e){let{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==R.array)return P(i,{code:q.invalid_type,expected:R.array,received:i.parsedType}),G;if(i.data.lengththis._def.items.length&&(P(i,{code:q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let o=[...i.data].map((l,f)=>{let d=this._def.items[f]||this._def.rest;return d?d._parse(new Ot(i,l,i.path,f)):null}).filter(l=>!!l);return i.common.async?Promise.all(o).then(l=>Ue.mergeArray(n,l)):Ue.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Ft.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ft({items:t,typeName:J.ZodTuple,rest:null,...ne(e)})};var va=class t extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==R.object)return P(i,{code:q.invalid_type,expected:R.object,received:i.parsedType}),G;let a=[],o=this._def.keyType,l=this._def.valueType;for(let f in i.data)a.push({key:o._parse(new Ot(i,f,i.path,f)),value:l._parse(new Ot(i,i.data[f],i.path,f)),alwaysSet:f in i.data});return i.common.async?Ue.mergeObjectAsync(n,a):Ue.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(e,n,i){return n instanceof re?new t({keyType:e,valueType:n,typeName:J.ZodRecord,...ne(i)}):new t({keyType:wn.create(),valueType:e,typeName:J.ZodRecord,...ne(n)})}},Pr=class extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==R.map)return P(i,{code:q.invalid_type,expected:R.map,received:i.parsedType}),G;let a=this._def.keyType,o=this._def.valueType,l=[...i.data.entries()].map(([f,d],m)=>({key:a._parse(new Ot(i,f,i.path,[m,"key"])),value:o._parse(new Ot(i,d,i.path,[m,"value"]))}));if(i.common.async){let f=new Map;return Promise.resolve().then(async()=>{for(let d of l){let m=await d.key,v=await d.value;if(m.status==="aborted"||v.status==="aborted")return G;(m.status==="dirty"||v.status==="dirty")&&n.dirty(),f.set(m.value,v.value)}return{status:n.value,value:f}})}else{let f=new Map;for(let d of l){let m=d.key,v=d.value;if(m.status==="aborted"||v.status==="aborted")return G;(m.status==="dirty"||v.status==="dirty")&&n.dirty(),f.set(m.value,v.value)}return{status:n.value,value:f}}}};Pr.create=(t,e,n)=>new Pr({valueType:e,keyType:t,typeName:J.ZodMap,...ne(n)});var Mr=class t extends re{_parse(e){let{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==R.set)return P(i,{code:q.invalid_type,expected:R.set,received:i.parsedType}),G;let a=this._def;a.minSize!==null&&i.data.sizea.maxSize.value&&(P(i,{code:q.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let o=this._def.valueType;function l(d){let m=new Set;for(let v of d){if(v.status==="aborted")return G;v.status==="dirty"&&n.dirty(),m.add(v.value)}return{status:n.value,value:m}}let f=[...i.data.values()].map((d,m)=>o._parse(new Ot(i,d,i.path,m)));return i.common.async?Promise.all(f).then(d=>l(d)):l(f)}min(e,n){return new t({...this._def,minSize:{value:e,message:W.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:W.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Mr.create=(t,e)=>new Mr({valueType:t,minSize:null,maxSize:null,typeName:J.ZodSet,...ne(e)});var ba=class t extends re{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==R.function)return P(n,{code:q.invalid_type,expected:R.function,received:n.parsedType}),G;function i(f,d){return Ci({data:f,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Nr(),en].filter(m=>!!m),issueData:{code:q.invalid_arguments,argumentsError:d}})}function a(f,d){return Ci({data:f,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Nr(),en].filter(m=>!!m),issueData:{code:q.invalid_return_type,returnTypeError:d}})}let o={errorMap:n.common.contextualErrorMap},l=n.data;if(this._def.returns instanceof Sn){let f=this;return ze(async function(...d){let m=new tt([]),v=await f._def.args.parseAsync(d,o).catch(T=>{throw m.addIssue(i(d,T)),m}),_=await Reflect.apply(l,this,v);return await f._def.returns._def.type.parseAsync(_,o).catch(T=>{throw m.addIssue(a(_,T)),m})})}else{let f=this;return ze(function(...d){let m=f._def.args.safeParse(d,o);if(!m.success)throw new tt([i(d,m.error)]);let v=Reflect.apply(l,this,m.data),_=f._def.returns.safeParse(v,o);if(!_.success)throw new tt([a(v,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Ft.create(e).rest(nn.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,i){return new t({args:e||Ft.create([]).rest(nn.create()),returns:n||nn.create(),typeName:J.ZodFunction,...ne(i)})}},er=class extends re{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};er.create=(t,e)=>new er({getter:t,typeName:J.ZodLazy,...ne(e)});var tr=class extends re{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return P(n,{received:n.data,code:q.invalid_literal,expected:this._def.value}),G}return{status:"valid",value:e.data}}get value(){return this._def.value}};tr.create=(t,e)=>new tr({value:t,typeName:J.ZodLiteral,...ne(e)});function _p(t,e){return new nr({values:t,typeName:J.ZodEnum,...ne(e)})}var nr=class t extends re{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),i=this._def.values;return P(n,{expected:ue.joinValues(i),received:n.parsedType,code:q.invalid_type}),G}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),i=this._def.values;return P(n,{received:n.data,code:q.invalid_enum_value,options:i}),G}return ze(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(i=>!e.includes(i)),{...this._def,...n})}};nr.create=_p;var rr=class extends re{_parse(e){let n=ue.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==R.string&&i.parsedType!==R.number){let a=ue.objectValues(n);return P(i,{expected:ue.joinValues(a),received:i.parsedType,code:q.invalid_type}),G}if(this._cache||(this._cache=new Set(ue.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=ue.objectValues(n);return P(i,{received:i.data,code:q.invalid_enum_value,options:a}),G}return ze(e.data)}get enum(){return this._def.values}};rr.create=(t,e)=>new rr({values:t,typeName:J.ZodNativeEnum,...ne(e)});var Sn=class extends re{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==R.promise&&n.common.async===!1)return P(n,{code:q.invalid_type,expected:R.promise,received:n.parsedType}),G;let i=n.parsedType===R.promise?n.data:Promise.resolve(n.data);return ze(i.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Sn.create=(t,e)=>new Sn({type:t,typeName:J.ZodPromise,...ne(e)});var St=class extends re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===J.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:i}=this._processInputParams(e),a=this._def.effect||null,o={addIssue:l=>{P(i,l),l.fatal?n.abort():n.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let l=a.transform(i.data,o);if(i.common.async)return Promise.resolve(l).then(async f=>{if(n.value==="aborted")return G;let d=await this._def.schema._parseAsync({data:f,path:i.path,parent:i});return d.status==="aborted"?G:d.status==="dirty"?jn(d.value):n.value==="dirty"?jn(d.value):d});{if(n.value==="aborted")return G;let f=this._def.schema._parseSync({data:l,path:i.path,parent:i});return f.status==="aborted"?G:f.status==="dirty"?jn(f.value):n.value==="dirty"?jn(f.value):f}}if(a.type==="refinement"){let l=f=>{let d=a.refinement(f,o);if(i.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return f};if(i.common.async===!1){let f=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return f.status==="aborted"?G:(f.status==="dirty"&&n.dirty(),l(f.value),{status:n.value,value:f.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(f=>f.status==="aborted"?G:(f.status==="dirty"&&n.dirty(),l(f.value).then(()=>({status:n.value,value:f.value}))))}if(a.type==="transform")if(i.common.async===!1){let l=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!bn(l))return G;let f=a.transform(l.value,o);if(f instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:f}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(l=>bn(l)?Promise.resolve(a.transform(l.value,o)).then(f=>({status:n.value,value:f})):G);ue.assertNever(a)}};St.create=(t,e,n)=>new St({schema:t,typeName:J.ZodEffects,effect:e,...ne(n)});St.createWithPreprocess=(t,e,n)=>new St({schema:e,effect:{type:"preprocess",transform:t},typeName:J.ZodEffects,...ne(n)});var wt=class extends re{_parse(e){return this._getType(e)===R.undefined?ze(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};wt.create=(t,e)=>new wt({innerType:t,typeName:J.ZodOptional,...ne(e)});var Bt=class extends re{_parse(e){return this._getType(e)===R.null?ze(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Bt.create=(t,e)=>new Bt({innerType:t,typeName:J.ZodNullable,...ne(e)});var ir=class extends re{_parse(e){let{ctx:n}=this._processInputParams(e),i=n.data;return n.parsedType===R.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};ir.create=(t,e)=>new ir({innerType:t,typeName:J.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ne(e)});var sr=class extends re{_parse(e){let{ctx:n}=this._processInputParams(e),i={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Ir(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new tt(i.common.issues)},input:i.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new tt(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};sr.create=(t,e)=>new sr({innerType:t,typeName:J.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ne(e)});var Rr=class extends re{_parse(e){if(this._getType(e)!==R.nan){let i=this._getOrReturnCtx(e);return P(i,{code:q.invalid_type,expected:R.nan,received:i.parsedType}),G}return{status:"valid",value:e.data}}};Rr.create=t=>new Rr({typeName:J.ZodNaN,...ne(t)});var ZC=Symbol("zod_brand"),ki=class extends re{_parse(e){let{ctx:n}=this._processInputParams(e),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}},Ti=class t extends re{_parse(e){let{status:n,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?G:o.status==="dirty"?(n.dirty(),jn(o.value)):this._def.out._parseAsync({data:o.value,path:i.path,parent:i})})();{let a=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?G:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:i.path,parent:i})}}static create(e,n){return new t({in:e,out:n,typeName:J.ZodPipeline})}},ar=class extends re{_parse(e){let n=this._def.innerType._parse(e),i=a=>(bn(a)&&(a.value=Object.freeze(a.value)),a);return Ir(n)?n.then(a=>i(a)):i(n)}unwrap(){return this._def.innerType}};ar.create=(t,e)=>new ar({innerType:t,typeName:J.ZodReadonly,...ne(e)});function pp(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function vp(t,e={},n){return t?On.create().superRefine((i,a)=>{let o=t(i);if(o instanceof Promise)return o.then(l=>{if(!l){let f=pp(e,i),d=f.fatal??n??!0;a.addIssue({code:"custom",...f,fatal:d})}});if(!o){let l=pp(e,i),f=l.fatal??n??!0;a.addIssue({code:"custom",...l,fatal:f})}}):On.create()}var YC={object:Ve.lazycreate},J;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(J||(J={}));var JC=(t,e={message:`Input not instance of ${t.name}`})=>vp(n=>n instanceof t,e),bp=wn.create,wp=Kn.create,QC=Rr.create,XC=zn.create,Op=Gn.create,ek=Zn.create,tk=Lr.create,nk=Yn.create,rk=Jn.create,Dr=On.create,ik=nn.create,Ol=ct.create,sk=qr.create,ak=rn.create,wa=Ve.create,ok=Ve.strictCreate,Fr=Qn.create,uk=_a.create,lk=Xn.create,ck=Ft.create,or=va.create,fk=Pr.create,hk=Mr.create,dk=ba.create,pk=er.create,mk=tr.create,gk=nr.create,yk=rr.create,_k=Sn.create,vk=St.create,bk=wt.create,wk=Bt.create,Ok=St.createWithPreprocess,Sk=Ti.create,xk=()=>bp().optional(),Ak=()=>wp().optional(),Ck=()=>Op().optional(),kk={string:t=>wn.create({...t,coerce:!0}),number:t=>Kn.create({...t,coerce:!0}),boolean:t=>Gn.create({...t,coerce:!0}),bigint:t=>zn.create({...t,coerce:!0}),date:t=>Zn.create({...t,coerce:!0})};var Tk=G;var xp=Q.object({force:Q.boolean().describe("force overwritten").default(!1).optional()});var Ap=Ne(Oa()),Sa=Ne(require("node:path")),xa="\x1B[39m",Sl="\x1B[31m",Ek="\x1B[32m",Cp="\x1B[33m";var ur=(...t)=>{let e=[];for(let n of t)(0,Ap.isString)(n)&&n.includes("/")&&(n=Sa.relative(Sa.resolve(),n)),e.push(n);console.log(...e)},Ni=(...t)=>{ur("<<\u2705",Ek,...t,xa)},ft=(...t)=>{ur("<<\u{1F534}Error:\u{1F53B}\u{1F53B}",Sl);for(let e of t)e instanceof Error?ur(Sl,e.message):ur(Sl,e);ur(xa)},kp=(...t)=>{ur("- \u{1F7E8}",Cp,...t,xa)},Tp=(...t)=>{ur("\u{1F3C3}\u200D\u2642\uFE0F",Cp,...t,xa)};var Ep=Ne(require("node:process")),Np=Ne(Oa()),Nk=t=>{let e=Object.values(t).filter(l=>l instanceof ma)[0];if(!e)throw new Error("no cmd instance found; make sure add this function: e.g: command.action(thisFn)");let n={},i=e.registeredArguments.map(l=>l.name());for(let l=0;l{let n=Nk(t),i=e.safeParse(n);return i.error&&(Object.entries(i.error.format()).forEach(([a,o])=>{a.startsWith("_")||ft(a,(0,Np.flatten)(Object.values(o)).join(";"))}),Ep.exit(0)),i.data};var l0=Ne(Oa());var c0=Ne(require("node:process")),yf=Ne(require("node:path")),gs=require("node:child_process"),f0=require("node:fs");var Ii=Ne(require("node:path"));var qp=require("node:child_process"),xn=Ne(require("fs")),Pp=require("node:fs");var $p=(t,e)=>t.replace(/\s/g,"").includes(e.replace(/\s/g,""));function Ik(...t){let e=process.cwd();return Ii.resolve(e,...t)}function Lp(t){try{return xn.lstatSync(t).isDirectory()}catch{return!1}}function xl(t,e=!0){return Lp(t)||xn.mkdirSync(t,{recursive:e}),Lp(t)}function $k(t,e,n=!1,i=!0){return xl(Ii.dirname(t))?xn.existsSync(t)&&!n?(kp(`file ${t} already exists; use --force to overwrite`),!1):(xn.writeFileSync(t,e,{encoding:"utf-8"}),i&&(0,qp.execSync)(`npx prettier --write ${t}`),!0):(ft(`can not create ${Ii.dirname(t)} directory`),!1)}function Lk(...t){return Ik("src",...t)}function Aa(t,e,n=!1){let i=Lk(t),a;try{a=(0,Pp.readFileSync)(i,{encoding:"utf-8"}).toString()}catch{a=""}return!$p(a,e)&&$k(i,qk(`${a} ${e}`),n,!1)?i:""}function qk(t){try{let e=t.split(` `),n=e.filter(l=>l.trim().startsWith("import")).map(l=>l.replace(/["']/g,'"')),i=e.filter(l=>!l.trim().startsWith("import"));return[...new Set(n),...i].reduce((l,f)=>(f.trim()===""&&l.length>0&&l[l.length-1].trim()===""||l.push(f),l),[]).join(` `)}catch(e){return ft("makeContent error:",e),""}}var hf=Ne(require("node:path")),bv=Ne(require("node:fs")),wv=Ne(af()),To=Ne(ko()),Ov=Ne(require("node:process"));var on=Ne(ko());function ds(t){let e=(0,on.default)(t,"type"),n=(0,on.default)(t,"anyOf");if(n)return ds(n[0]);if(!e)return;let i=(0,on.default)(t,"default");switch(e){case"string":let a=(0,on.default)(t,"enum");return a&&(i=a[0]),i||"";case"array":let o=(0,on.default)(t,"items"),l=(0,on.default)(o,"type");return["integer","number"].includes(l)?i:[ds(o)];case"boolean":return i||!1;case"integer":case"number":return i||0;case"object":let f=(0,on.default)(t,"required"),d={};if(f?.length>0)for(let m of f){let v=(0,on.default)(t,`properties.${m}`);d[m]=ds(v)}return d}}var Sv=(t,e,n)=>{n??=!0;let i=hf.default.resolve(e);i||(ft(`no ${i} file`),Ov.exit());let a=(0,wv.parseAllDocuments)(bv.default.readFileSync(i).toString("utf-8"));for(let o of a){let l=o.toJSON(),f=(0,To.default)(l,"components.schemas");Object.keys(f).forEach(d=>{let m=f[d];if(!d.endsWith("IN"))return;let v=(0,To.default)(m,"properties.data.properties");if(!v)return;let _=(0,To.default)(m,"properties.data.required"),O=`${d}Data_default`,T={};Object.keys(v).forEach(L=>{n&&!_?.includes(L)||(T[L]=ds(v[L]))}),Aa(hf.default.resolve(`${t}/defaults/${O}.ts`),` @@ -276,9 +276,9 @@ ${L} ${x} -${T?` +${` /* ${v} default values */ -export const ${f}_defaultValues = ${JSON.stringify(T,null,2)}`:""} +export const ${f}_defaultValues = ${JSON.stringify(T||{data:{}},null,2)}`} `,!0)})}(0,o0.execSync)(`npx prettier --write ${Lo.default.resolve(`${t}/zodSchemas`)}`)};function gf(t){if(t instanceof Ve){let e=t.shape,n={};for(let i in e){let a=e[i],o=gf(a);o!==void 0&&(n[i]=o)}return Object.keys(n).length>0?n:void 0}else{if("_def"in t&&"defaultValue"in t._def)return t._def.defaultValue();if("innerType"in t._def)return gf(t._def.innerType);if("typeName"in t._def&&t._def.typeName==="ZodOptional")return;if("typeName"in t._def&&t._def.typeName==="ZodDefault")return t._def.defaultValue();if("typeName"in t._def&&t._def.typeName==="ZodNullable")return null;if("typeName"in t._def&&t._def.typeName==="ZodArray")return[];if("typeName"in t._def&&t._def.typeName==="ZodEnum")return t._def.values[0]}}var sP=xp.extend({inputYaml:Q.string(),outDir:Q.string(),name:Q.string().optional(),genDefaults:Q.boolean().optional().default(!0),genZodSchemas:Q.boolean().optional().default(!0)});function h0(){let t=Ip(arguments,sP),e=(0,l0.last)(t.inputYaml.split("/"))||"",n=t.name||e.split(".")?.[0];n||(ft(new Error("can not get name")),c0.exit(1));let i=yf.default.join(t.outDir,n);(0,gs.execSync)(`rm -fr ${i}`);let a=yf.default.join(t.outDir,e);xl(t.outDir),t.inputYaml.startsWith("https")?(0,gs.execSync)(`curl ${t.inputYaml} -o ${a}`):(0,f0.copyFileSync)(t.inputYaml,a),(0,gs.execSync)(`npx @openapitools/openapi-generator-cli generate -i ${a} --generator-name typescript-fetch -o ${i}`),Ni("openapi-generator:",i),(0,gs.execSync)(`npx tsx ${__dirname}/scripts/generateUses.script.ts ${i}`),Ni("generated uses:",i+"/uses"),t.genDefaults&&(Sv(i,a,!0),Ni("generated defaults:",i+"/defaults")),t.genZodSchemas&&(u0(i,a),Ni("generated zodSchemas:",i+"/zodSchemas"))}var qo=new ma;qo.addOption(new cp("-f, --force","force write").default(!1)).option("-v, --version","show version",()=>{console.log(`Version: ${fp}`),process.exit(0)});qo.command("make").description("make api from .yaml file").option("-i, --inputYaml [inputYaml]","input yaml file path (local or https://)","api.yaml").option("-o, --outDir [outDir]","output directory path","docs").option("-n, --name [name]","name of output directory").option("-d, --genDefaults","generate defaults",!0).option("-z, --genZodSchemas","generate zod schemas",!0).action(h0);process.env.HELP_INFO_GEN||qo.parse();0&&(module.exports={program}); /*! Bundled license information: diff --git a/esbuild_out/scripts/generateUses.script.ts b/esbuild_out/scripts/generateUses.script.ts index 78460ee..0bd1bd9 100755 --- a/esbuild_out/scripts/generateUses.script.ts +++ b/esbuild_out/scripts/generateUses.script.ts @@ -36,6 +36,18 @@ fs.copyFileSync( path.resolve(templatesDir, `InfinityLoading.tsx`), path.resolve(usesDir, `InfinityLoading.tsx`), ) +fs.copyFileSync( + path.resolve(templatesDir, `InputForm.module.css`), + path.resolve(usesDir, `InputForm.module.css`), +) +fs.copyFileSync( + path.resolve(templatesDir, `InputForm.tsx`), + path.resolve(usesDir, `InputForm.tsx`), +) +fs.copyFileSync( + path.resolve(templatesDir, `InputFormHelpers.tsx`), + path.resolve(usesDir, `InputFormHelpers.tsx`), +) // fs.mkdirSync( // path.resolve(usesDir, `InfiniteScrollers`), // {recursive: true}, diff --git a/esbuild_out/scripts/templates/InputForm.module.css b/esbuild_out/scripts/templates/InputForm.module.css new file mode 100644 index 0000000..99a08a7 --- /dev/null +++ b/esbuild_out/scripts/templates/InputForm.module.css @@ -0,0 +1,104 @@ +.formContainer { + width: 100%; + max-width: 2000px; + background-color: white; + padding: 2rem; + border-radius: 0.5rem; + box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); +} + +.form { + display: grid; + grid-template-columns: 1fr; + gap: 1.5rem; +} + +@media (min-width: 768px) { + .form { + grid-template-columns: repeat(2, 1fr); + } +} + +@media (min-width: 1024px) { + .form { + grid-template-columns: repeat(3, 1fr); + } +} + +.formGroup { + display: flex; + flex-direction: column; + gap: 0.625rem; +} + +.label { + font-size: 0.875rem; + font-weight: 600; + color: #1f2937; +} + +.input { + width: 100%; + padding: 0.625rem 0.875rem; + border: 1px solid #D1D5DB; + border-radius: 0.375rem; + transition: border-color 0.2s, box-shadow 0.2s; + font-size: 1rem; + color: #111827; +} + +.input::placeholder { + color: #9ca3af; +} + +.input:focus { + outline: none; + border-color: #2563EB; + box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4); +} + +.description { + font-size: 0.875rem; + color: #4b5563; + margin-top: 0.25rem; +} + +.description a { + color: #2563EB; + text-decoration: none; +} + +.description a:hover { + text-decoration: underline; +} + +.helperText { + font-size: 0.875rem; + color: #6B7280; +} + +.errorMessage { + margin-top: 1rem; + color: #DC2626; + background-color: #FEE2E2; + padding: 0.75rem; + border-radius: 0.375rem; + grid-column: 1 / -1; + @apply break-all; +} + +.fieldSet { + display: flex; + flex-direction: column; + gap: 0.75rem; + border: 1px solid #D1D5DB; + padding: 1rem; + border-radius: 0.375rem; +} + +.optionLabel { + display: flex; + align-items: center; + gap: 0.5rem; + cursor: pointer; +} \ No newline at end of file diff --git a/esbuild_out/scripts/templates/InputForm.tsx b/esbuild_out/scripts/templates/InputForm.tsx new file mode 100644 index 0000000..fcb4c76 --- /dev/null +++ b/esbuild_out/scripts/templates/InputForm.tsx @@ -0,0 +1,227 @@ +'use client'; + +import {FieldValues, Path, useForm} from 'react-hook-form'; +import {zodResolver} from '@hookform/resolvers/zod'; +import {z} from 'zod'; +import {startCase} from 'lodash'; +import {JSX, ReactNode, useState, useTransition} from 'react'; + +import {getHtmlInputType, getUiMetadata, getZodInnerType} from './InputFormHelpers'; +import defaultFormStyles from './InputForm.module.css'; + +// --- Định nghĩa Types cho Props --- +type SubmitHook = (options?: { fireImmediately?: boolean }) => { + fire: (data: TData) => Promise; + loading: boolean; + error: Error | null; + data: any; +}; + +// NEW: Định nghĩa kiểu cho tất cả các class style có thể có +// Nó bao gồm các style từ CSS Module và các style được định nghĩa inline (Tailwind) +type AllStyleKeys = keyof typeof defaultFormStyles | 'submitButton' | 'successMessage'; +type AllStyles = { [K in AllStyleKeys]: string }; + +// Type cho customStyles giờ đây sẽ an toàn hơn +type CustomStyles = Partial; + +export interface DynamicFormProps { + formSchema: z.ZodObject; + useSubmitHook: SubmitHook; + defaultValues?: TData; + onSuccess?: (data: any) => void; + submitButtonText?: string; + loadingButtonText?: string; + successMessage?: string; + customStyles?: CustomStyles; +} + +// --- Component DynamicForm --- +/* DynamicForm +usage: +// 1. Với CSS Module +import myCustomStyles from './MyForm.module.css'; + + +// 2. Với Tailwind CSS (ghi đè từng phần) + +* */ +export function DynamicForm({ + formSchema, + useSubmitHook, + defaultValues, + onSuccess, + submitButtonText = 'Send', + loadingButtonText = 'Sending...', + successMessage = '', + customStyles = {}, + }: DynamicFormProps) { + const {fire, loading: hookLoading, error, data} = useSubmitHook({fireImmediately: false}); + const [isPending, startTransition] = useTransition(); + const [hasSubmitted, setHasSubmitted] = useState(false); + const isBusy = isPending || hookLoading; + + // Tạo một object chứa tất cả các style mặc định trước + const allDefaultStyles: AllStyles = { + ...defaultFormStyles, + submitButton: "bg-blue-600 text-white font-semibold py-2 px-4 rounded-lg shadow-md transition-colors duration-300 ease-in-out hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50 disabled:bg-gray-400 disabled:cursor-not-allowed", + successMessage: "mt-4 text-green-600", + }; + + // Sau đó, trộn object mặc định với style tùy chỉnh. + const styles: AllStyles = { + ...allDefaultStyles, + ...customStyles, + } as AllStyles; + + const { + register, + handleSubmit, + formState: {errors: formValidationErrors}, + } = useForm({ + resolver: zodResolver(formSchema as any), + defaultValues: defaultValues as any, + }); + + const handleFormSubmit = (formData: TData) => { + if (!hasSubmitted) setHasSubmitted(true); + startTransition(async () => { + try { + const result = await fire(formData); + onSuccess?.(result); + } catch (e) { + console.error("Form submission caught an error:", e); + } + }); + }; + + const shouldShowStatusMessage = hasSubmitted && !isBusy; + + // --- Hàm Render Field --- + const renderField = (key: string, schema: z.ZodTypeAny): JSX.Element => { + const formKey = key as Path; + const coreType = getZodInnerType(schema); + const uiConfig = getUiMetadata(schema) || {}; + const componentType = uiConfig.component || 'input'; + const inputType = uiConfig.type || getHtmlInputType(schema); + + if (inputType === 'hidden') { + return ; + } + + let fieldElement: ReactNode; + const inputClassName = styles.input; + + switch (componentType) { + case 'textarea': + fieldElement = ( +