barejs 0.1.47 → 0.1.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,193 +1,94 @@
1
1
  // @bun
2
- var{defineProperty:IQ,getOwnPropertyNames:s4,getOwnPropertyDescriptor:t4}=Object,r4=Object.prototype.hasOwnProperty;var jX=new WeakMap,a4=($)=>{var W=jX.get($),Q;if(W)return W;if(W=IQ({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function")s4($).map((X)=>!r4.call(W,X)&&IQ(W,X,{get:()=>$[X],enumerable:!(Q=t4($,X))||Q.enumerable}));return jX.set($,W),W};var JW=($,W)=>{for(var Q in W)IQ($,Q,{get:W[Q],enumerable:!0,configurable:!0,set:(X)=>W[Q]=()=>X})};var e4=($,W)=>()=>($&&(W=$($=0)),W);var i6={};JW(i6,{initConfig:()=>jQ,DEFAULT_CONFIG:()=>bQ,BARE_CONFIG:()=>eW});var bQ,eW,jQ=($={})=>{return eW={...bQ,...$,hash:{...bQ.hash,...$.hash}},eW};var RQ=e4(()=>{bQ={hash:{algorithm:"argon2id",memoryCost:65536,timeCost:2},port:3000},eW=bQ});class EW{prefix;groupMiddleware;routes=[];constructor($="",W=[]){this.prefix=$;this.groupMiddleware=W}_add($,W,Q){let X=(this.prefix+"/"+W).replace(/\/+/g,"/");if(X.endsWith("/"))X=X.slice(0,-1);return this.routes.push({method:$.toUpperCase(),path:X||"",handlers:[...this.groupMiddleware,...Q]}),this}get=($,...W)=>this._add("GET",$,W);post=($,...W)=>this._add("POST",$,W);put=($,...W)=>this._add("PUT",$,W);patch=($,...W)=>this._add("PATCH",$,W);delete=($,...W)=>this._add("DELETE",$,W);group=($,...W)=>{let Q=W.pop(),X=W,Y=(this.prefix+"/"+$).replace(/\/+/g,"/"),q=new EW(Y,[...this.groupMiddleware,...X]);return Q(q),this.routes.push(...q.routes),this};use($){if($ instanceof EW||$&&$.routes)this.routes.push(...$.routes);else this.groupMiddleware.push($);return this}}class kW{children={};staticKeys=[];paramNode=null;paramName=null;handlers={};insert($,W,Q){let X=this,Y=$.split("/").filter(Boolean);for(let q of Y)if(q.startsWith(":")){if(!X.paramNode)X.paramNode=new kW;X.paramName=q.slice(1),X=X.paramNode}else{if(!X.children[q])X.children[q]=new kW,X.staticKeys.push(q);X=X.children[q]}X.handlers[W]=Q}lookup($,W,Q,X){let Y=this,q=Q===-1?0:Q,H=W.length;if(W[q]==="/")q++;for(let z in X.params)delete X.params[z];while(q<H){let z=W.indexOf("/",q);if(z===-1)z=H;let w=z-q,N=!1,_=Y.staticKeys,x=_.length;if(x===1){let B$=_[0];if(B$.length===w){let r$=!0;for(let c$=0;c$<w;c$++)if(B$[c$]!==W[q+c$]){r$=!1;break}if(r$)Y=Y.children[B$],N=!0}}else for(let B$=0;B$<x;B$++){let r$=_[B$];if(r$.length===w){let c$=!0;for(let L$=0;L$<w;L$++)if(r$[L$]!==W[q+L$]){c$=!1;break}if(c$){Y=Y.children[r$],N=!0;break}}}if(!N)if(Y.paramNode)X.params[Y.paramName]=W.slice(q,z),Y=Y.paramNode;else return null;q=z+1}return Y.handlers[$]||null}jitCompile($,W=0,Q="url",X="s",Y=[]){let q="",H=" ".repeat(W);if(Object.keys(this.handlers).length>0){if(q+=`${H}if (${X} >= urlLen) {
3
- `,Y.length>0){let z=Y.map((w)=>`"${w.name}": ${w.varName}`).join(", ");q+=`${H} ctx.params = { ${z} };
4
- `}q+=`${H} switch(method) {
5
- `;for(let[z,w]of Object.entries(this.handlers)){let N=$(w);q+=`${H} case "${z}": return ${N}(ctx);
6
- `}q+=`${H} }
7
- `,q+=`${H}}
8
- `}if(this.staticKeys.length>0)if(this.staticKeys.length===1){let z=this.staticKeys[0],w=z.length;q+=`${H}if (${Q}.startsWith("${z}", ${X})) {
9
- `,q+=`${H} const nextChar = ${Q}.charCodeAt(${X} + ${w});
10
- `,q+=`${H} if (isNaN(nextChar) || nextChar === 47) {
11
- `;let N=this.children[z],_=`newIdxL${W}`;q+=`${H} const ${_} = isNaN(nextChar) ? ${Q}.length : (${X} + ${w} + 1);
12
- `,q+=N.jitCompile($,W+1,Q,_,Y),q+=`${H} }
13
- `,q+=`${H}}
14
- `}else{q+=`${H}let slash${W} = ${Q}.indexOf('/', ${X});
15
- `,q+=`${H}if (slash${W} === -1) slash${W} = ${Q}.length;
16
- `,q+=`${H}const len${W} = slash${W} - (${X});
2
+ var{defineProperty:ni,getOwnPropertyNames:Wc,getOwnPropertyDescriptor:Jc}=Object,Yc=Object.prototype.hasOwnProperty;function Qc(e){return this[e]}var Xc=(e)=>{var t=(Ji??=new WeakMap).get(e),r;if(t)return t;if(t=ni({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var n of Wc(e))if(!Yc.call(t,n))ni(t,n,{get:Qc.bind(e,n),enumerable:!(r=Jc(e,n))||r.enumerable})}return Ji.set(e,t),t},Ji;var Zc=(e)=>e;function eu(e,t){this[e]=Zc.bind(null,t)}var oi=(e,t)=>{for(var r in t)ni(e,r,{get:t[r],enumerable:!0,configurable:!0,set:eu.bind(t,r)})};var tu=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};var qa={};oi(qa,{BARE_CONFIG:()=>dn,initConfig:()=>Wo});var ji,dn,Wo=(e={})=>(dn={...ji,...e,hash:{...ji.hash,...e.hash}},dn);var Jo=tu(()=>{ji={hash:{algorithm:"argon2id",memoryCost:65536,timeCost:2},port:3000},dn=ji});var Ci={};oi(Ci,{Any:()=>or,Argument:()=>Is,Array:()=>Yr,AsyncIterator:()=>Qr,Awaited:()=>nn,BigInt:()=>tn,Boolean:()=>Po,Capitalize:()=>xa,Composite:()=>Gs,Const:()=>Ds,Constructor:()=>Xr,ConstructorParameters:()=>vs,Date:()=>Uo,Enum:()=>qs,Exclude:()=>cn,Extends:()=>an,Extract:()=>un,Function:()=>Pt,Index:()=>ir,InstanceType:()=>ua,Instantiate:()=>ma,Integer:()=>da,Intersect:()=>Pe,Iterator:()=>rn,KeyOf:()=>on,Literal:()=>q,Lowercase:()=>ga,Mapped:()=>Ss,Module:()=>Ca,Never:()=>j,Not:()=>ja,Null:()=>Ko,Number:()=>Ze,Object:()=>z,Omit:()=>cr,Optional:()=>Ne,Parameters:()=>Ma,Partial:()=>fn,Pick:()=>ur,Promise:()=>Mo,Readonly:()=>Ge,ReadonlyOptional:()=>qo,Record:()=>Vo,Recursive:()=>Sa,Ref:()=>rt,RegExp:()=>Ua,Required:()=>mn,Rest:()=>Ka,ReturnType:()=>Ea,String:()=>It,Symbol:()=>Eo,TemplateLiteral:()=>Co,Transform:()=>Ga,Tuple:()=>et,Uint8Array:()=>Bo,Uncapitalize:()=>Ia,Undefined:()=>Lo,Union:()=>V,Unknown:()=>sr,Unsafe:()=>Da,Uppercase:()=>ha,Void:()=>va});var ri={};oi(ri,{BRAND:()=>Nx,DIRTY:()=>Mr,EMPTY_PATH:()=>cx,INVALID:()=>T,NEVER:()=>lg,OK:()=>Me,ParseStatus:()=>ke,Schema:()=>M,ZodAny:()=>Ur,ZodArray:()=>Ft,ZodBigInt:()=>lr,ZodBoolean:()=>bn,ZodBranded:()=>ti,ZodCatch:()=>kn,ZodDate:()=>Sr,ZodDefault:()=>An,ZodDiscriminatedUnion:()=>ei,ZodEffects:()=>Tt,ZodEnum:()=>yr,ZodError:()=>ve,ZodFirstPartyTypeKind:()=>A,ZodFunction:()=>hn,ZodIntersection:()=>Fn,ZodIssueCode:()=>x,ZodLazy:()=>wn,ZodLiteral:()=>Rn,ZodMap:()=>eo,ZodNaN:()=>to,ZodNativeEnum:()=>Tn,ZodNever:()=>Mt,ZodNull:()=>On,ZodNullable:()=>Yt,ZodNumber:()=>pr,ZodObject:()=>de,ZodOptional:()=>wt,ZodParsedType:()=>_,ZodPipeline:()=>ro,ZodPromise:()=>Er,ZodReadonly:()=>Nn,ZodRecord:()=>Zn,ZodSchema:()=>M,ZodSet:()=>Kr,ZodString:()=>$t,ZodSymbol:()=>Qn,ZodTransformer:()=>Tt,ZodTuple:()=>St,ZodType:()=>M,ZodUndefined:()=>_n,ZodUnion:()=>$n,ZodUnknown:()=>dr,ZodVoid:()=>Xn,addIssueToContext:()=>I,any:()=>Lx,array:()=>vx,bigint:()=>Mx,boolean:()=>hc,coerce:()=>pg,custom:()=>xc,date:()=>Sx,datetimeRegex:()=>lc,defaultErrorMap:()=>Wt,discriminatedUnion:()=>zx,effect:()=>ig,enum:()=>rg,function:()=>Zx,getErrorMap:()=>xn,getParsedType:()=>jt,instanceof:()=>Cx,intersection:()=>Wx,isAborted:()=>Xo,isAsync:()=>gn,isDirty:()=>Zo,isValid:()=>mr,late:()=>Px,lazy:()=>eg,literal:()=>tg,makeIssue:()=>Yn,map:()=>Qx,nan:()=>jx,nativeEnum:()=>ng,never:()=>Gx,null:()=>Ex,nullable:()=>ag,number:()=>Ic,object:()=>qx,objectUtil:()=>Gi,oboolean:()=>dg,onumber:()=>mg,optional:()=>sg,ostring:()=>fg,pipeline:()=>ug,preprocess:()=>cg,promise:()=>og,quotelessJson:()=>ix,record:()=>Yx,set:()=>Xx,setErrorMap:()=>ax,strictObject:()=>Vx,string:()=>gc,symbol:()=>Ux,transformer:()=>ig,tuple:()=>Jx,undefined:()=>Kx,union:()=>Hx,unknown:()=>Bx,util:()=>K,void:()=>Dx});class Dr{prefix;groupMiddleware;routes=[];constructor(e="",t=[]){this.prefix=e;this.groupMiddleware=t}_add(e,t,r){let n=(this.prefix+"/"+t).replace(/\/+/g,"/");if(n.endsWith("/"))n=n.slice(0,-1);return this.routes.push({method:e.toUpperCase(),path:n||"",handlers:[...this.groupMiddleware,...r]}),this}get=(e,...t)=>this._add("GET",e,t);post=(e,...t)=>this._add("POST",e,t);put=(e,...t)=>this._add("PUT",e,t);patch=(e,...t)=>this._add("PATCH",e,t);delete=(e,...t)=>this._add("DELETE",e,t);group=(e,...t)=>{let r=t.pop(),n=t,o=(this.prefix+"/"+e).replace(/\/+/g,"/"),i=new Dr(o,[...this.groupMiddleware,...n]);return r(i),this.routes.push(...i.routes),this};use(e){if(e instanceof Dr||e&&e.routes)this.routes.push(...e.routes);else this.groupMiddleware.push(e);return this}}class vr{children={};staticKeys=[];paramNode=null;paramName=null;handlers={};insert(e,t,r){let n=this,o=e.split("/").filter(Boolean);for(let i of o)if(i.startsWith(":")){if(!n.paramNode)n.paramNode=new vr;n.paramName=i.slice(1),n=n.paramNode}else{if(!n.children[i])n.children[i]=new vr,n.staticKeys.push(i);n=n.children[i]}n.handlers[t]=r}lookup(e,t,r,n){let o=this,i=r===-1?0:r,s=t.length;if(t[i]==="/")i++;for(let a in n.params)delete n.params[a];while(i<s){let a=t.indexOf("/",i);if(a===-1)a=s;let f=a-i,l=!1,g=o.staticKeys,R=g.length;if(R===1){let J=g[0];if(J.length===f){let be=!0;for(let P=0;P<f;P++)if(J[P]!==t[i+P]){be=!1;break}if(be)o=o.children[J],l=!0}}else for(let J=0;J<R;J++){let be=g[J];if(be.length===f){let P=!0;for(let qe=0;qe<f;qe++)if(be[qe]!==t[i+qe]){P=!1;break}if(P){o=o.children[be],l=!0;break}}}if(!l)if(o.paramNode)n.params[o.paramName]=t.slice(i,a),o=o.paramNode;else return null;i=a+1}return o.handlers[e]||null}jitCompile(e,t=0,r="url",n="s",o=[]){let i="",s=" ".repeat(t);if(Object.keys(this.handlers).length>0){if(i+=`${s}if (${n} >= urlLen) {
3
+ `,o.length>0){let a=o.map((f)=>`${JSON.stringify(f.name)}: ${f.varName}`).join(", ");i+=`${s} ctx.params = { ${a} };
4
+ `}i+=`${s} switch(method) {
5
+ `;for(let[a,f]of Object.entries(this.handlers)){let l=e(f);i+=`${s} case ${JSON.stringify(a)}: return ${l}(ctx);
6
+ `}i+=`${s} }
7
+ `,i+=`${s}}
8
+ `}if(this.staticKeys.length>0)if(this.staticKeys.length===1){let a=this.staticKeys[0],f=a.length,l=`nextIdxL${t}`;i+=`${s}if (${r}.startsWith(${JSON.stringify(a)}, ${n})) {
9
+ `,i+=`${s} const ${l} = ${n} + ${f};
10
+ `,i+=`${s} if (${l} === urlLen || ${r}.charCodeAt(${l}) === 47) {
11
+ `;let g=this.children[a],R=`newIdxL${t}`;i+=`${s} const ${R} = ${l} === urlLen ? urlLen : (${l} + 1);
12
+ `,i+=g.jitCompile(e,t+1,r,R,o),i+=`${s} }
13
+ `,i+=`${s}}
14
+ `}else{i+=`${s}let slash${t} = ${r}.indexOf('/', ${n});
15
+ `,i+=`${s}if (slash${t} === -1 || slash${t} > urlLen) slash${t} = urlLen;
16
+ `,i+=`${s}const len${t} = slash${t} - (${n});
17
17
 
18
- `,q+=`${H}switch(len${W}) {
19
- `;for(let z of this.staticKeys){if(q+=`${H} case ${z.length}: // "${z}"
20
- `,z.length===1)q+=`${H} if (${Q}.charCodeAt(${X}) === ${z.charCodeAt(0)}) {
21
- `;else q+=`${H} if (${Q}.startsWith("${z}", ${X})) {
22
- `;let w=this.children[z];q+=w.jitCompile($,W+1,Q,`slash${W} + 1`,Y),q+=`${H} }
23
- `,q+=`${H} break;
24
- `}q+=`${H}}
25
- `}if(this.paramNode){let z=this.paramNode;if(this.staticKeys.length===0)q+=`${H}let slash${W} = ${Q}.indexOf('/', ${X});
26
- `,q+=`${H}if (slash${W} === -1) slash${W} = ${Q}.length;
27
- `;let w=`pL${W}`;q+=`${H}const ${w} = ${Q}.slice(${X}, slash${W});
28
- `;let N=[...Y,{name:this.paramName,varName:w}];q+=z.jitCompile($,W+1,Q,`slash${W} + 1`,N)}return q}id=Math.random().toString(36).slice(2)}class xQ{req;params={};_status=200;_headers=void 0;store=new Map;body=void 0;query={};constructor(){}async jsonBody(){if(this.body!==void 0)return this.body;let $=this.req.headers.get("content-type");if($&&$.includes("application/json"))try{return this.body=await this.req.json()}catch{return this.body=null}return this.body=null}reset($){if(this.req=$,this._status=200,this._headers=void 0,this.store.size>0)this.store.clear();return this.params={},this.query={},this.body=void 0,this}status($){return this._status=$,this}json($){let W=this._status||200;if(!this._headers)return Response.json($,{status:W});if(this._headers["content-type"]===void 0)this._headers["content-type"]="application/json";return Response.json($,{status:W,headers:this._headers})}set($,W){return this.store.set($,W),this}get($){return this.store.get($)}setHeader($,W){if(!this._headers)this._headers={};return this._headers[$.toLowerCase()]=W,this}send($,W={}){let Q=this._status>=400;return this.json({status:Q?"error":"success",msg:$,...W})}}var V$={};JW(V$,{IsUndefined:()=>G$,IsUint8Array:()=>g2,IsSymbol:()=>dQ,IsString:()=>s,IsRegExp:()=>b8,IsObject:()=>i,IsNumber:()=>n$,IsNull:()=>vQ,IsIterator:()=>TQ,IsFunction:()=>fQ,IsDate:()=>MW,IsBoolean:()=>x2,IsBigInt:()=>O8,IsAsyncIterator:()=>gQ,IsArray:()=>w$,HasPropertyKey:()=>i8});function i8($,W){return W in $}function gQ($){return i($)&&!w$($)&&!g2($)&&Symbol.asyncIterator in $}function w$($){return Array.isArray($)}function O8($){return typeof $==="bigint"}function x2($){return typeof $==="boolean"}function MW($){return $ instanceof globalThis.Date}function fQ($){return typeof $==="function"}function TQ($){return i($)&&!w$($)&&!g2($)&&Symbol.iterator in $}function vQ($){return $===null}function n$($){return typeof $==="number"}function i($){return typeof $==="object"&&$!==null}function b8($){return $ instanceof globalThis.RegExp}function s($){return typeof $==="string"}function dQ($){return typeof $==="symbol"}function g2($){return $ instanceof globalThis.Uint8Array}function G$($){return $===void 0}function $Y($){return $.map((W)=>p8(W))}function WY($){return new Date($.getTime())}function QY($){return new Uint8Array($)}function XY($){return new RegExp($.source,$.flags)}function YY($){let W={};for(let Q of Object.getOwnPropertyNames($))W[Q]=p8($[Q]);for(let Q of Object.getOwnPropertySymbols($))W[Q]=p8($[Q]);return W}function p8($){return w$($)?$Y($):MW($)?WY($):g2($)?QY($):b8($)?XY($):i($)?YY($):$}function $$($){return p8($)}function IW($,W){return W===void 0?$$($):$$({...W,...$})}function u8($){return f$($)&&globalThis.Symbol.asyncIterator in $}function l8($){return f$($)&&globalThis.Symbol.iterator in $}function s8($){return $ instanceof globalThis.Promise}function xW($){return $ instanceof Date&&globalThis.Number.isFinite($.getTime())}function gW($){return $ instanceof globalThis.Uint8Array}function t8($,W){return W in $}function f$($){return $!==null&&typeof $==="object"}function A$($){return globalThis.Array.isArray($)&&!globalThis.ArrayBuffer.isView($)}function x$($){return $===void 0}function BW($){return $===null}function wW($){return typeof $==="boolean"}function Z($){return typeof $==="number"}function r8($){return globalThis.Number.isInteger($)}function o$($){return typeof $==="bigint"}function S$($){return typeof $==="string"}function a8($){return typeof $==="function"}function GW($){return typeof $==="symbol"}function e8($){return o$($)||wW($)||BW($)||Z($)||S$($)||GW($)||x$($)}var a;(function($){$.InstanceMode="default",$.ExactOptionalPropertyTypes=!1,$.AllowArrayObject=!1,$.AllowNaN=!1,$.AllowNullVoid=!1;function W(H,z){return $.ExactOptionalPropertyTypes?z in H:H[z]!==void 0}$.IsExactOptionalProperty=W;function Q(H){let z=f$(H);return $.AllowArrayObject?z:z&&!A$(H)}$.IsObjectLike=Q;function X(H){return Q(H)&&!(H instanceof Date)&&!(H instanceof Uint8Array)}$.IsRecordLike=X;function Y(H){return $.AllowNaN?Z(H):Number.isFinite(H)}$.IsNumberLike=Y;function q(H){let z=x$(H);return $.AllowNullVoid?z||H===null:z}$.IsVoidLike=q})(a||(a={}));function qY($){return globalThis.Object.freeze($).map((W)=>j8(W))}function HY($){return $}function zY($){return $}function JY($){return $}function MY($){let W={};for(let Q of Object.getOwnPropertyNames($))W[Q]=j8($[Q]);for(let Q of Object.getOwnPropertySymbols($))W[Q]=j8($[Q]);return globalThis.Object.freeze(W)}function j8($){return w$($)?qY($):MW($)?HY($):g2($)?zY($):b8($)?JY($):i($)?MY($):$}function U($,W){let Q=W!==void 0?{...W,...$}:$;switch(a.InstanceMode){case"freeze":return j8(Q);case"clone":return $$(Q);default:return Q}}class y extends Error{constructor($){super($)}}var X$=Symbol.for("TypeBox.Transform"),M2=Symbol.for("TypeBox.Readonly"),F$=Symbol.for("TypeBox.Optional"),a$=Symbol.for("TypeBox.Hint"),D=Symbol.for("TypeBox.Kind");function fW($){return i($)&&$[M2]==="Readonly"}function T$($){return i($)&&$[F$]==="Optional"}function hQ($){return d($,"Any")}function yQ($){return d($,"Argument")}function B2($){return d($,"Array")}function UW($){return d($,"AsyncIterator")}function AW($){return d($,"BigInt")}function f2($){return d($,"Boolean")}function w2($){return d($,"Computed")}function G2($){return d($,"Constructor")}function BY($){return d($,"Date")}function U2($){return d($,"Function")}function A2($){return d($,"Integer")}function H$($){return d($,"Intersect")}function DW($){return d($,"Iterator")}function d($,W){return i($)&&D in $&&$[D]===W}function $Q($){return x2($)||n$($)||s($)}function i$($){return d($,"Literal")}function p$($){return d($,"MappedKey")}function W$($){return d($,"MappedResult")}function u2($){return d($,"Never")}function wY($){return d($,"Not")}function R8($){return d($,"Null")}function D2($){return d($,"Number")}function U$($){return d($,"Object")}function _W($){return d($,"Promise")}function NW($){return d($,"Record")}function M$($){return d($,"Ref")}function mQ($){return d($,"RegExp")}function T2($){return d($,"String")}function F8($){return d($,"Symbol")}function u$($){return d($,"TemplateLiteral")}function GY($){return d($,"This")}function c($){return i($)&&X$ in $}function l$($){return d($,"Tuple")}function v2($){return d($,"Undefined")}function h($){return d($,"Union")}function UY($){return d($,"Uint8Array")}function AY($){return d($,"Unknown")}function DY($){return d($,"Unsafe")}function _Y($){return d($,"Void")}function NY($){return i($)&&D in $&&s($[D])}function Y$($){return hQ($)||yQ($)||B2($)||f2($)||AW($)||UW($)||w2($)||G2($)||BY($)||U2($)||A2($)||H$($)||DW($)||i$($)||p$($)||W$($)||u2($)||wY($)||R8($)||D2($)||U$($)||_W($)||NW($)||M$($)||mQ($)||T2($)||F8($)||u$($)||GY($)||l$($)||v2($)||h($)||UY($)||AY($)||DY($)||_Y($)||NY($)}var M={};JW(M,{TypeGuardUnknownTypeError:()=>RX,IsVoid:()=>B0,IsUnsafe:()=>M0,IsUnknown:()=>J0,IsUnionLiteral:()=>KY,IsUnion:()=>oQ,IsUndefined:()=>H0,IsUint8Array:()=>z0,IsTuple:()=>q0,IsTransform:()=>Y0,IsThis:()=>X0,IsTemplateLiteral:()=>Q0,IsSymbol:()=>W0,IsString:()=>$0,IsSchema:()=>Q$,IsRegExp:()=>eX,IsRef:()=>aX,IsRecursive:()=>CY,IsRecord:()=>rX,IsReadonly:()=>bY,IsProperties:()=>WQ,IsPromise:()=>tX,IsOptional:()=>jY,IsObject:()=>sX,IsNumber:()=>lX,IsNull:()=>uX,IsNot:()=>pX,IsNever:()=>iX,IsMappedResult:()=>oX,IsMappedKey:()=>nX,IsLiteralValue:()=>cX,IsLiteralString:()=>yX,IsLiteralNumber:()=>mX,IsLiteralBoolean:()=>FY,IsLiteral:()=>K8,IsKindOf:()=>g,IsKind:()=>w0,IsIterator:()=>hX,IsIntersect:()=>dX,IsInteger:()=>vX,IsImport:()=>RY,IsFunction:()=>TX,IsDate:()=>fX,IsConstructor:()=>gX,IsComputed:()=>xX,IsBoolean:()=>IX,IsBigInt:()=>kX,IsAsyncIterator:()=>EX,IsArray:()=>ZX,IsArgument:()=>PX,IsAny:()=>VX});class RX extends y{}var LY=["Argument","Any","Array","AsyncIterator","BigInt","Boolean","Computed","Constructor","Date","Enum","Function","Integer","Intersect","Iterator","Literal","MappedKey","MappedResult","Not","Null","Number","Object","Promise","Record","Ref","RegExp","String","Symbol","TemplateLiteral","This","Tuple","Undefined","Union","Uint8Array","Unknown","Void"];function FX($){try{return new RegExp($),!0}catch{return!1}}function cQ($){if(!s($))return!1;for(let W=0;W<$.length;W++){let Q=$.charCodeAt(W);if(Q>=7&&Q<=13||Q===27||Q===127)return!1}return!0}function CX($){return nQ($)||Q$($)}function C8($){return G$($)||O8($)}function t($){return G$($)||n$($)}function nQ($){return G$($)||x2($)}function p($){return G$($)||s($)}function SY($){return G$($)||s($)&&cQ($)&&FX($)}function OY($){return G$($)||s($)&&cQ($)}function KX($){return G$($)||Q$($)}function bY($){return i($)&&$[M2]==="Readonly"}function jY($){return i($)&&$[F$]==="Optional"}function VX($){return g($,"Any")&&p($.$id)}function PX($){return g($,"Argument")&&n$($.index)}function ZX($){return g($,"Array")&&$.type==="array"&&p($.$id)&&Q$($.items)&&t($.minItems)&&t($.maxItems)&&nQ($.uniqueItems)&&KX($.contains)&&t($.minContains)&&t($.maxContains)}function EX($){return g($,"AsyncIterator")&&$.type==="AsyncIterator"&&p($.$id)&&Q$($.items)}function kX($){return g($,"BigInt")&&$.type==="bigint"&&p($.$id)&&C8($.exclusiveMaximum)&&C8($.exclusiveMinimum)&&C8($.maximum)&&C8($.minimum)&&C8($.multipleOf)}function IX($){return g($,"Boolean")&&$.type==="boolean"&&p($.$id)}function xX($){return g($,"Computed")&&s($.target)&&w$($.parameters)&&$.parameters.every((W)=>Q$(W))}function gX($){return g($,"Constructor")&&$.type==="Constructor"&&p($.$id)&&w$($.parameters)&&$.parameters.every((W)=>Q$(W))&&Q$($.returns)}function fX($){return g($,"Date")&&$.type==="Date"&&p($.$id)&&t($.exclusiveMaximumTimestamp)&&t($.exclusiveMinimumTimestamp)&&t($.maximumTimestamp)&&t($.minimumTimestamp)&&t($.multipleOfTimestamp)}function TX($){return g($,"Function")&&$.type==="Function"&&p($.$id)&&w$($.parameters)&&$.parameters.every((W)=>Q$(W))&&Q$($.returns)}function RY($){return g($,"Import")&&i8($,"$defs")&&i($.$defs)&&WQ($.$defs)&&i8($,"$ref")&&s($.$ref)&&$.$ref in $.$defs}function vX($){return g($,"Integer")&&$.type==="integer"&&p($.$id)&&t($.exclusiveMaximum)&&t($.exclusiveMinimum)&&t($.maximum)&&t($.minimum)&&t($.multipleOf)}function WQ($){return i($)&&Object.entries($).every(([W,Q])=>cQ(W)&&Q$(Q))}function dX($){return g($,"Intersect")&&(s($.type)&&$.type!=="object"?!1:!0)&&w$($.allOf)&&$.allOf.every((W)=>Q$(W)&&!Y0(W))&&p($.type)&&(nQ($.unevaluatedProperties)||KX($.unevaluatedProperties))&&p($.$id)}function hX($){return g($,"Iterator")&&$.type==="Iterator"&&p($.$id)&&Q$($.items)}function g($,W){return i($)&&D in $&&$[D]===W}function yX($){return K8($)&&s($.const)}function mX($){return K8($)&&n$($.const)}function FY($){return K8($)&&x2($.const)}function K8($){return g($,"Literal")&&p($.$id)&&cX($.const)}function cX($){return x2($)||n$($)||s($)}function nX($){return g($,"MappedKey")&&w$($.keys)&&$.keys.every((W)=>n$(W)||s(W))}function oX($){return g($,"MappedResult")&&WQ($.properties)}function iX($){return g($,"Never")&&i($.not)&&Object.getOwnPropertyNames($.not).length===0}function pX($){return g($,"Not")&&Q$($.not)}function uX($){return g($,"Null")&&$.type==="null"&&p($.$id)}function lX($){return g($,"Number")&&$.type==="number"&&p($.$id)&&t($.exclusiveMaximum)&&t($.exclusiveMinimum)&&t($.maximum)&&t($.minimum)&&t($.multipleOf)}function sX($){return g($,"Object")&&$.type==="object"&&p($.$id)&&WQ($.properties)&&CX($.additionalProperties)&&t($.minProperties)&&t($.maxProperties)}function tX($){return g($,"Promise")&&$.type==="Promise"&&p($.$id)&&Q$($.item)}function rX($){return g($,"Record")&&$.type==="object"&&p($.$id)&&CX($.additionalProperties)&&i($.patternProperties)&&((W)=>{let Q=Object.getOwnPropertyNames(W.patternProperties);return Q.length===1&&FX(Q[0])&&i(W.patternProperties)&&Q$(W.patternProperties[Q[0]])})($)}function CY($){return i($)&&a$ in $&&$[a$]==="Recursive"}function aX($){return g($,"Ref")&&p($.$id)&&s($.$ref)}function eX($){return g($,"RegExp")&&p($.$id)&&s($.source)&&s($.flags)&&t($.maxLength)&&t($.minLength)}function $0($){return g($,"String")&&$.type==="string"&&p($.$id)&&t($.minLength)&&t($.maxLength)&&SY($.pattern)&&OY($.format)}function W0($){return g($,"Symbol")&&$.type==="symbol"&&p($.$id)}function Q0($){return g($,"TemplateLiteral")&&$.type==="string"&&s($.pattern)&&$.pattern[0]==="^"&&$.pattern[$.pattern.length-1]==="$"}function X0($){return g($,"This")&&p($.$id)&&s($.$ref)}function Y0($){return i($)&&X$ in $}function q0($){return g($,"Tuple")&&$.type==="array"&&p($.$id)&&n$($.minItems)&&n$($.maxItems)&&$.minItems===$.maxItems&&(G$($.items)&&G$($.additionalItems)&&$.minItems===0||w$($.items)&&$.items.every((W)=>Q$(W)))}function H0($){return g($,"Undefined")&&$.type==="undefined"&&p($.$id)}function KY($){return oQ($)&&$.anyOf.every((W)=>yX(W)||mX(W))}function oQ($){return g($,"Union")&&p($.$id)&&i($)&&w$($.anyOf)&&$.anyOf.every((W)=>Q$(W))}function z0($){return g($,"Uint8Array")&&$.type==="Uint8Array"&&p($.$id)&&t($.minByteLength)&&t($.maxByteLength)}function J0($){return g($,"Unknown")&&p($.$id)}function M0($){return g($,"Unsafe")}function B0($){return g($,"Void")&&$.type==="void"&&p($.$id)}function w0($){return i($)&&D in $&&s($[D])&&!LY.includes($[D])}function Q$($){return i($)&&(VX($)||PX($)||ZX($)||IX($)||kX($)||EX($)||xX($)||gX($)||fX($)||TX($)||vX($)||dX($)||hX($)||K8($)||nX($)||oX($)||iX($)||pX($)||uX($)||lX($)||sX($)||tX($)||rX($)||aX($)||eX($)||$0($)||W0($)||Q0($)||X0($)||q0($)||H0($)||oQ($)||z0($)||J0($)||M0($)||B0($)||w0($))}var G0="(true|false)",QQ="(0|[1-9][0-9]*)",U0="(.*)";var l2="^(0|[1-9][0-9]*)$",s2="^(.*)$",A0="^(?!.*)$";var e$={};JW(e$,{Set:()=>kY,Has:()=>EY,Get:()=>IY,Entries:()=>VY,Delete:()=>ZY,Clear:()=>PY});var TW=new Map;function VY(){return new Map(TW)}function PY(){return TW.clear()}function ZY($){return TW.delete($)}function EY($){return TW.has($)}function kY($,W){TW.set($,W)}function IY($){return TW.get($)}var v$={};JW(v$,{Set:()=>vY,Has:()=>TY,Get:()=>dY,Entries:()=>xY,Delete:()=>fY,Clear:()=>gY});var vW=new Map;function xY(){return new Map(vW)}function gY(){return vW.clear()}function fY($){return vW.delete($)}function TY($){return vW.has($)}function vY($,W){vW.set($,W)}function dY($){return vW.get($)}function D0($,W){return $.includes(W)}function _0($){return[...new Set($)]}function hY($,W){return $.filter((Q)=>W.includes(Q))}function yY($,W){return $.reduce((Q,X)=>{return hY(Q,X)},W)}function N0($){return $.length===1?$[0]:$.length>1?yY($.slice(1),$[0]):[]}function L0($){let W=[];for(let Q of $)W.push(...Q);return W}function t2($){return U({[D]:"Any"},$)}function dW($,W){return U({[D]:"Array",type:"array",items:$},W)}function S0($){return U({[D]:"Argument",index:$})}function hW($,W){return U({[D]:"AsyncIterator",type:"AsyncIterator",items:$},W)}function e($,W,Q){return U({[D]:"Computed",target:$,parameters:W},Q)}function mY($,W){let{[W]:Q,...X}=$;return X}function z$($,W){return W.reduce((Q,X)=>mY(Q,X),$)}function k($){return U({[D]:"Never",not:{}},$)}function m($){return U({[D]:"MappedResult",properties:$})}function yW($,W,Q){return U({[D]:"Constructor",type:"Constructor",parameters:$,returns:W},Q)}function V2($,W,Q){return U({[D]:"Function",type:"Function",parameters:$,returns:W},Q)}function V8($,W){return U({[D]:"Union",anyOf:$},W)}function cY($){return $.some((W)=>T$(W))}function O0($){return $.map((W)=>T$(W)?nY(W):W)}function nY($){return z$($,[F$])}function oY($,W){return cY($)?P$(V8(O0($),W)):V8(O0($),W)}function P2($,W){return $.length===1?U($[0],W):$.length===0?k(W):oY($,W)}function o($,W){return $.length===0?k(W):$.length===1?U($[0],W):V8($,W)}class iQ extends y{}function iY($){return $.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function pQ($,W,Q){return $[W]===Q&&$.charCodeAt(W-1)!==92}function h2($,W){return pQ($,W,"(")}function P8($,W){return pQ($,W,")")}function b0($,W){return pQ($,W,"|")}function pY($){if(!(h2($,0)&&P8($,$.length-1)))return!1;let W=0;for(let Q=0;Q<$.length;Q++){if(h2($,Q))W+=1;if(P8($,Q))W-=1;if(W===0&&Q!==$.length-1)return!1}return!0}function uY($){return $.slice(1,$.length-1)}function lY($){let W=0;for(let Q=0;Q<$.length;Q++){if(h2($,Q))W+=1;if(P8($,Q))W-=1;if(b0($,Q)&&W===0)return!0}return!1}function sY($){for(let W=0;W<$.length;W++)if(h2($,W))return!0;return!1}function tY($){let[W,Q]=[0,0],X=[];for(let q=0;q<$.length;q++){if(h2($,q))W+=1;if(P8($,q))W-=1;if(b0($,q)&&W===0){let H=$.slice(Q,q);if(H.length>0)X.push(mW(H));Q=q+1}}let Y=$.slice(Q);if(Y.length>0)X.push(mW(Y));if(X.length===0)return{type:"const",const:""};if(X.length===1)return X[0];return{type:"or",expr:X}}function rY($){function W(Y,q){if(!h2(Y,q))throw new iQ("TemplateLiteralParser: Index must point to open parens");let H=0;for(let z=q;z<Y.length;z++){if(h2(Y,z))H+=1;if(P8(Y,z))H-=1;if(H===0)return[q,z]}throw new iQ("TemplateLiteralParser: Unclosed group parens in expression")}function Q(Y,q){for(let H=q;H<Y.length;H++)if(h2(Y,H))return[q,H];return[q,Y.length]}let X=[];for(let Y=0;Y<$.length;Y++)if(h2($,Y)){let[q,H]=W($,Y),z=$.slice(q,H+1);X.push(mW(z)),Y=H}else{let[q,H]=Q($,Y),z=$.slice(q,H);if(z.length>0)X.push(mW(z));Y=H-1}return X.length===0?{type:"const",const:""}:X.length===1?X[0]:{type:"and",expr:X}}function mW($){return pY($)?mW(uY($)):lY($)?tY($):sY($)?rY($):{type:"const",const:iY($)}}function cW($){return mW($.slice(1,$.length-1))}class j0 extends y{}function aY($){return $.type==="or"&&$.expr.length===2&&$.expr[0].type==="const"&&$.expr[0].const==="0"&&$.expr[1].type==="const"&&$.expr[1].const==="[1-9][0-9]*"}function eY($){return $.type==="or"&&$.expr.length===2&&$.expr[0].type==="const"&&$.expr[0].const==="true"&&$.expr[1].type==="const"&&$.expr[1].const==="false"}function $1($){return $.type==="const"&&$.const===".*"}function LW($){return aY($)||$1($)?!1:eY($)?!0:$.type==="and"?$.expr.every((W)=>LW(W)):$.type==="or"?$.expr.every((W)=>LW(W)):$.type==="const"?!0:(()=>{throw new j0("Unknown expression type")})()}function R0($){let W=cW($.pattern);return LW(W)}class F0 extends y{}function*C0($){if($.length===1)return yield*$[0];for(let W of $[0])for(let Q of C0($.slice(1)))yield`${W}${Q}`}function*W1($){return yield*C0($.expr.map((W)=>[...Z8(W)]))}function*Q1($){for(let W of $.expr)yield*Z8(W)}function*X1($){return yield $.const}function*Z8($){return $.type==="and"?yield*W1($):$.type==="or"?yield*Q1($):$.type==="const"?yield*X1($):(()=>{throw new F0("Unknown expression")})()}function XQ($){let W=cW($.pattern);return LW(W)?[...Z8(W)]:[]}function n($,W){return U({[D]:"Literal",const:$,type:typeof $},W)}function YQ($){return U({[D]:"Boolean",type:"boolean"},$)}function nW($){return U({[D]:"BigInt",type:"bigint"},$)}function $2($){return U({[D]:"Number",type:"number"},$)}function _2($){return U({[D]:"String",type:"string"},$)}function*Y1($){let W=$.trim().replace(/"|'/g,"");return W==="boolean"?yield YQ():W==="number"?yield $2():W==="bigint"?yield nW():W==="string"?yield _2():yield(()=>{let Q=W.split("|").map((X)=>n(X.trim()));return Q.length===0?k():Q.length===1?Q[0]:P2(Q)})()}function*q1($){if($[1]!=="{"){let W=n("$"),Q=uQ($.slice(1));return yield*[W,...Q]}for(let W=2;W<$.length;W++)if($[W]==="}"){let Q=Y1($.slice(2,W)),X=uQ($.slice(W+1));return yield*[...Q,...X]}yield n($)}function*uQ($){for(let W=0;W<$.length;W++)if($[W]==="$"){let Q=n($.slice(0,W)),X=q1($.slice(W));return yield*[Q,...X]}yield n($)}function K0($){return[...uQ($)]}class V0 extends y{}function H1($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function P0($,W){return u$($)?$.pattern.slice(1,$.pattern.length-1):h($)?`(${$.anyOf.map((Q)=>P0(Q,W)).join("|")})`:D2($)?`${W}${QQ}`:A2($)?`${W}${QQ}`:AW($)?`${W}${QQ}`:T2($)?`${W}${U0}`:i$($)?`${W}${H1($.const.toString())}`:f2($)?`${W}${G0}`:(()=>{throw new V0(`Unexpected Kind '${$[D]}'`)})()}function lQ($){return`^${$.map((W)=>P0(W,"")).join("")}$`}function SW($){let Q=XQ($).map((X)=>n(X));return P2(Q)}function qQ($,W){let Q=s($)?lQ(K0($)):lQ($);return U({[D]:"TemplateLiteral",type:"string",pattern:Q},W)}function z1($){return XQ($).map((Q)=>Q.toString())}function J1($){let W=[];for(let Q of $)W.push(...d$(Q));return W}function M1($){return[$.toString()]}function d$($){return[...new Set(u$($)?z1($):h($)?J1($.anyOf):i$($)?M1($.const):D2($)?["[number]"]:A2($)?["[number]"]:[])]}function B1($,W,Q){let X={};for(let Y of Object.getOwnPropertyNames(W))X[Y]=r2($,d$(W[Y]),Q);return X}function w1($,W,Q){return B1($,W.properties,Q)}function Z0($,W,Q){let X=w1($,W,Q);return m(X)}function k0($,W){return $.map((Q)=>I0(Q,W))}function G1($){return $.filter((W)=>!u2(W))}function U1($,W){return HQ(G1(k0($,W)))}function A1($){return $.some((W)=>u2(W))?[]:$}function D1($,W){return P2(A1(k0($,W)))}function _1($,W){return W in $?$[W]:W==="[number]"?P2($):k()}function N1($,W){return W==="[number]"?$:k()}function L1($,W){return W in $?$[W]:k()}function I0($,W){return H$($)?U1($.allOf,W):h($)?D1($.anyOf,W):l$($)?_1($.items??[],W):B2($)?N1($.items,W):U$($)?L1($.properties,W):k()}function E8($,W){return W.map((Q)=>I0($,Q))}function E0($,W){return P2(E8($,W))}function r2($,W,Q){if(M$($)||M$(W)){if(!Y$($)||!Y$(W))throw new y("Index types using Ref parameters require both Type and Key to be of TSchema");return e("Index",[$,W])}if(W$(W))return Z0($,W,Q);if(p$(W))return x0($,W,Q);return U(Y$(W)?E0($,d$(W)):E0($,W),Q)}function S1($,W,Q){return{[W]:r2($,[W],$$(Q))}}function O1($,W,Q){return W.reduce((X,Y)=>{return{...X,...S1($,Y,Q)}},{})}function b1($,W,Q){return O1($,W.keys,Q)}function x0($,W,Q){let X=b1($,W,Q);return m(X)}function oW($,W){return U({[D]:"Iterator",type:"Iterator",items:$},W)}function j1($){return globalThis.Object.keys($).filter((W)=>!T$($[W]))}function R1($,W){let Q=j1($),X=Q.length>0?{[D]:"Object",type:"object",required:Q,properties:$}:{[D]:"Object",type:"object",properties:$};return U(X,W)}var u=R1;function zQ($,W){return U({[D]:"Promise",type:"Promise",item:$},W)}function F1($){return U(z$($,[M2]))}function C1($){return U({...$,[M2]:"Readonly"})}function K1($,W){return W===!1?F1($):C1($)}function h$($,W){let Q=W??!0;return W$($)?g0($,Q):K1($,Q)}function V1($,W){let Q={};for(let X of globalThis.Object.getOwnPropertyNames($))Q[X]=h$($[X],W);return Q}function P1($,W){return V1($.properties,W)}function g0($,W){let Q=P1($,W);return m(Q)}function W2($,W){return U($.length>0?{[D]:"Tuple",type:"array",items:$,additionalItems:!1,minItems:$.length,maxItems:$.length}:{[D]:"Tuple",type:"array",minItems:$.length,maxItems:$.length},W)}function f0($,W){return $ in W?Q2($,W[$]):m(W)}function Z1($){return{[$]:n($)}}function E1($){let W={};for(let Q of $)W[Q]=n(Q);return W}function k1($,W){return D0(W,$)?Z1($):E1(W)}function I1($,W){let Q=k1($,W);return f0($,Q)}function k8($,W){return W.map((Q)=>Q2($,Q))}function x1($,W){let Q={};for(let X of globalThis.Object.getOwnPropertyNames(W))Q[X]=Q2($,W[X]);return Q}function Q2($,W){let Q={...W};return T$(W)?P$(Q2($,z$(W,[F$]))):fW(W)?h$(Q2($,z$(W,[M2]))):W$(W)?f0($,W.properties):p$(W)?I1($,W.keys):G2(W)?yW(k8($,W.parameters),Q2($,W.returns),Q):U2(W)?V2(k8($,W.parameters),Q2($,W.returns),Q):UW(W)?hW(Q2($,W.items),Q):DW(W)?oW(Q2($,W.items),Q):H$(W)?Z$(k8($,W.allOf),Q):h(W)?o(k8($,W.anyOf),Q):l$(W)?W2(k8($,W.items??[]),Q):U$(W)?u(x1($,W.properties),Q):B2(W)?dW(Q2($,W.items),Q):_W(W)?zQ(Q2($,W.item),Q):W}function g1($,W){let Q={};for(let X of $)Q[X]=Q2(X,W);return Q}function T0($,W,Q){let X=Y$($)?d$($):$,Y=W({[D]:"MappedKey",keys:X}),q=g1(X,Y);return u(q,Q)}function f1($){return U(z$($,[F$]))}function T1($){return U({...$,[F$]:"Optional"})}function v1($,W){return W===!1?f1($):T1($)}function P$($,W){let Q=W??!0;return W$($)?v0($,Q):v1($,Q)}function d1($,W){let Q={};for(let X of globalThis.Object.getOwnPropertyNames($))Q[X]=P$($[X],W);return Q}function h1($,W){return d1($.properties,W)}function v0($,W){let Q=h1($,W);return m(Q)}function I8($,W={}){let Q=$.every((Y)=>U$(Y)),X=Y$(W.unevaluatedProperties)?{unevaluatedProperties:W.unevaluatedProperties}:{};return U(W.unevaluatedProperties===!1||Y$(W.unevaluatedProperties)||Q?{...X,[D]:"Intersect",type:"object",allOf:$}:{...X,[D]:"Intersect",allOf:$},W)}function y1($){return $.every((W)=>T$(W))}function m1($){return z$($,[F$])}function d0($){return $.map((W)=>T$(W)?m1(W):W)}function c1($,W){return y1($)?P$(I8(d0($),W)):I8(d0($),W)}function HQ($,W={}){if($.length===1)return U($[0],W);if($.length===0)return k(W);if($.some((Q)=>c(Q)))throw Error("Cannot intersect transform types");return c1($,W)}function Z$($,W){if($.length===1)return U($[0],W);if($.length===0)return k(W);if($.some((Q)=>c(Q)))throw Error("Cannot intersect transform types");return I8($,W)}function X2(...$){let[W,Q]=typeof $[0]==="string"?[$[0],$[1]]:[$[0].$id,$[1]];if(typeof W!=="string")throw new y("Ref: $ref must be a string");return U({[D]:"Ref",$ref:W},Q)}function n1($,W){return e("Awaited",[e($,W)])}function o1($){return e("Awaited",[X2($)])}function i1($){return Z$(h0($))}function p1($){return o(h0($))}function u1($){return iW($)}function h0($){return $.map((W)=>iW(W))}function iW($,W){return U(w2($)?n1($.target,$.parameters):H$($)?i1($.allOf):h($)?p1($.anyOf):_W($)?u1($.item):M$($)?o1($.$ref):$,W)}function y0($){let W=[];for(let Q of $)W.push(Y2(Q));return W}function l1($){let W=y0($);return L0(W)}function s1($){let W=y0($);return N0(W)}function t1($){return $.map((W,Q)=>Q.toString())}function r1($){return["[number]"]}function a1($){return globalThis.Object.getOwnPropertyNames($)}function e1($){if(!sQ)return[];return globalThis.Object.getOwnPropertyNames($).map((Q)=>{return Q[0]==="^"&&Q[Q.length-1]==="$"?Q.slice(1,Q.length-1):Q})}function Y2($){return H$($)?l1($.allOf):h($)?s1($.anyOf):l$($)?t1($.items??[]):B2($)?r1($.items):U$($)?a1($.properties):NW($)?e1($.patternProperties):[]}var sQ=!1;function y2($){sQ=!0;let W=Y2($);return sQ=!1,`^(${W.map((X)=>`(${X})`).join("|")})$`}function $q($,W){return e("KeyOf",[e($,W)])}function Wq($){return e("KeyOf",[X2($)])}function Qq($,W){let Q=Y2($),X=Xq(Q),Y=P2(X);return U(Y,W)}function Xq($){return $.map((W)=>W==="[number]"?$2():n(W))}function pW($,W){return w2($)?$q($.target,$.parameters):M$($)?Wq($.$ref):W$($)?m0($,W):Qq($,W)}function Yq($,W){let Q={};for(let X of globalThis.Object.getOwnPropertyNames($))Q[X]=pW($[X],$$(W));return Q}function qq($,W){return Yq($.properties,W)}function m0($,W){let Q=qq($,W);return m(Q)}function JQ($){let W=Y2($),Q=E8($,W);return W.map((X,Y)=>[W[Y],Q[Y]])}function Hq($){let W=[];for(let Q of $)W.push(...Y2(Q));return _0(W)}function zq($){return $.filter((W)=>!u2(W))}function Jq($,W){let Q=[];for(let X of $)Q.push(...E8(X,[W]));return zq(Q)}function Mq($,W){let Q={};for(let X of W)Q[X]=HQ(Jq($,X));return Q}function c0($,W){let Q=Hq($),X=Mq($,Q);return u(X,W)}function MQ($){return U({[D]:"Date",type:"Date"},$)}function BQ($){return U({[D]:"Null",type:"null"},$)}function wQ($){return U({[D]:"Symbol",type:"symbol"},$)}function GQ($){return U({[D]:"Undefined",type:"undefined"},$)}function UQ($){return U({[D]:"Uint8Array",type:"Uint8Array"},$)}function a2($){return U({[D]:"Unknown"},$)}function Bq($){return $.map((W)=>tQ(W,!1))}function wq($){let W={};for(let Q of globalThis.Object.getOwnPropertyNames($))W[Q]=h$(tQ($[Q],!1));return W}function AQ($,W){return W===!0?$:h$($)}function tQ($,W){return gQ($)?AQ(t2(),W):TQ($)?AQ(t2(),W):w$($)?h$(W2(Bq($))):g2($)?UQ():MW($)?MQ():i($)?AQ(u(wq($)),W):fQ($)?AQ(V2([],a2()),W):G$($)?GQ():vQ($)?BQ():dQ($)?wQ():O8($)?nW():n$($)?n($):x2($)?n($):s($)?n($):u({})}function n0($,W){return U(tQ($,!0),W)}function o0($,W){return G2($)?W2($.parameters,W):k(W)}function i0($,W){if(G$($))throw Error("Enum undefined or empty");let Q=globalThis.Object.getOwnPropertyNames($).filter((q)=>isNaN(q)).map((q)=>$[q]),Y=[...new Set(Q)].map((q)=>n(q));return o(Y,{...W,[a$]:"Enum"})}class t0 extends y{}var A;(function($){$[$.Union=0]="Union",$[$.True=1]="True",$[$.False=2]="False"})(A||(A={}));function q2($){return $===A.False?$:A.True}function uW($){throw new t0($)}function D$($){return M.IsNever($)||M.IsIntersect($)||M.IsUnion($)||M.IsUnknown($)||M.IsAny($)}function _$($,W){return M.IsNever(W)?e0($,W):M.IsIntersect(W)?DQ($,W):M.IsUnion(W)?WX($,W):M.IsUnknown(W)?X6($,W):M.IsAny(W)?$X($,W):uW("StructuralRight")}function $X($,W){return A.True}function Gq($,W){return M.IsIntersect(W)?DQ($,W):M.IsUnion(W)&&W.anyOf.some((Q)=>M.IsAny(Q)||M.IsUnknown(Q))?A.True:M.IsUnion(W)?A.Union:M.IsUnknown(W)?A.True:M.IsAny(W)?A.True:A.Union}function Uq($,W){return M.IsUnknown($)?A.False:M.IsAny($)?A.Union:M.IsNever($)?A.True:A.False}function Aq($,W){return M.IsObject(W)&&_Q(W)?A.True:D$(W)?_$($,W):!M.IsArray(W)?A.False:q2(l($.items,W.items))}function Dq($,W){return D$(W)?_$($,W):!M.IsAsyncIterator(W)?A.False:q2(l($.items,W.items))}function _q($,W){return D$(W)?_$($,W):M.IsObject(W)?E$($,W):M.IsRecord(W)?H2($,W):M.IsBigInt(W)?A.True:A.False}function r0($,W){return M.IsLiteralBoolean($)?A.True:M.IsBoolean($)?A.True:A.False}function Nq($,W){return D$(W)?_$($,W):M.IsObject(W)?E$($,W):M.IsRecord(W)?H2($,W):M.IsBoolean(W)?A.True:A.False}function Lq($,W){return D$(W)?_$($,W):M.IsObject(W)?E$($,W):!M.IsConstructor(W)?A.False:$.parameters.length>W.parameters.length?A.False:!$.parameters.every((Q,X)=>q2(l(W.parameters[X],Q))===A.True)?A.False:q2(l($.returns,W.returns))}function Sq($,W){return D$(W)?_$($,W):M.IsObject(W)?E$($,W):M.IsRecord(W)?H2($,W):M.IsDate(W)?A.True:A.False}function Oq($,W){return D$(W)?_$($,W):M.IsObject(W)?E$($,W):!M.IsFunction(W)?A.False:$.parameters.length>W.parameters.length?A.False:!$.parameters.every((Q,X)=>q2(l(W.parameters[X],Q))===A.True)?A.False:q2(l($.returns,W.returns))}function a0($,W){return M.IsLiteral($)&&V$.IsNumber($.const)?A.True:M.IsNumber($)||M.IsInteger($)?A.True:A.False}function bq($,W){return M.IsInteger(W)||M.IsNumber(W)?A.True:D$(W)?_$($,W):M.IsObject(W)?E$($,W):M.IsRecord(W)?H2($,W):A.False}function DQ($,W){return W.allOf.every((Q)=>l($,Q)===A.True)?A.True:A.False}function jq($,W){return $.allOf.some((Q)=>l(Q,W)===A.True)?A.True:A.False}function Rq($,W){return D$(W)?_$($,W):!M.IsIterator(W)?A.False:q2(l($.items,W.items))}function Fq($,W){return M.IsLiteral(W)&&W.const===$.const?A.True:D$(W)?_$($,W):M.IsObject(W)?E$($,W):M.IsRecord(W)?H2($,W):M.IsString(W)?Q6($,W):M.IsNumber(W)?$6($,W):M.IsInteger(W)?a0($,W):M.IsBoolean(W)?r0($,W):A.False}function e0($,W){return A.False}function Cq($,W){return A.True}function p0($){let[W,Q]=[$,0];while(!0){if(!M.IsNot(W))break;W=W.not,Q+=1}return Q%2===0?W:a2()}function Kq($,W){return M.IsNot($)?l(p0($),W):M.IsNot(W)?l($,p0(W)):uW("Invalid fallthrough for Not")}function Vq($,W){return D$(W)?_$($,W):M.IsObject(W)?E$($,W):M.IsRecord(W)?H2($,W):M.IsNull(W)?A.True:A.False}function $6($,W){return M.IsLiteralNumber($)?A.True:M.IsNumber($)||M.IsInteger($)?A.True:A.False}function Pq($,W){return D$(W)?_$($,W):M.IsObject(W)?E$($,W):M.IsRecord(W)?H2($,W):M.IsInteger(W)||M.IsNumber(W)?A.True:A.False}function y$($,W){return Object.getOwnPropertyNames($.properties).length===W}function u0($){return _Q($)}function l0($){return y$($,0)||y$($,1)&&"description"in $.properties&&M.IsUnion($.properties.description)&&$.properties.description.anyOf.length===2&&(M.IsString($.properties.description.anyOf[0])&&M.IsUndefined($.properties.description.anyOf[1])||M.IsString($.properties.description.anyOf[1])&&M.IsUndefined($.properties.description.anyOf[0]))}function rQ($){return y$($,0)}function s0($){return y$($,0)}function Zq($){return y$($,0)}function Eq($){return y$($,0)}function kq($){return _Q($)}function Iq($){let W=$2();return y$($,0)||y$($,1)&&"length"in $.properties&&q2(l($.properties.length,W))===A.True}function xq($){return y$($,0)}function _Q($){let W=$2();return y$($,0)||y$($,1)&&"length"in $.properties&&q2(l($.properties.length,W))===A.True}function gq($){let W=V2([t2()],t2());return y$($,0)||y$($,1)&&"then"in $.properties&&q2(l($.properties.then,W))===A.True}function W6($,W){return l($,W)===A.False?A.False:M.IsOptional($)&&!M.IsOptional(W)?A.False:A.True}function E$($,W){return M.IsUnknown($)?A.False:M.IsAny($)?A.Union:M.IsNever($)||M.IsLiteralString($)&&u0(W)||M.IsLiteralNumber($)&&rQ(W)||M.IsLiteralBoolean($)&&s0(W)||M.IsSymbol($)&&l0(W)||M.IsBigInt($)&&Zq(W)||M.IsString($)&&u0(W)||M.IsSymbol($)&&l0(W)||M.IsNumber($)&&rQ(W)||M.IsInteger($)&&rQ(W)||M.IsBoolean($)&&s0(W)||M.IsUint8Array($)&&kq(W)||M.IsDate($)&&Eq(W)||M.IsConstructor($)&&xq(W)||M.IsFunction($)&&Iq(W)?A.True:M.IsRecord($)&&M.IsString(aQ($))?(()=>{return W[a$]==="Record"?A.True:A.False})():M.IsRecord($)&&M.IsNumber(aQ($))?(()=>{return y$(W,0)?A.True:A.False})():A.False}function fq($,W){return D$(W)?_$($,W):M.IsRecord(W)?H2($,W):!M.IsObject(W)?A.False:(()=>{for(let Q of Object.getOwnPropertyNames(W.properties)){if(!(Q in $.properties)&&!M.IsOptional(W.properties[Q]))return A.False;if(M.IsOptional(W.properties[Q]))return A.True;if(W6($.properties[Q],W.properties[Q])===A.False)return A.False}return A.True})()}function Tq($,W){return D$(W)?_$($,W):M.IsObject(W)&&gq(W)?A.True:!M.IsPromise(W)?A.False:q2(l($.item,W.item))}function aQ($){return l2 in $.patternProperties?$2():(s2 in $.patternProperties)?_2():uW("Unknown record key pattern")}function eQ($){return l2 in $.patternProperties?$.patternProperties[l2]:(s2 in $.patternProperties)?$.patternProperties[s2]:uW("Unable to get record value schema")}function H2($,W){let[Q,X]=[aQ(W),eQ(W)];return M.IsLiteralString($)&&M.IsNumber(Q)&&q2(l($,X))===A.True?A.True:M.IsUint8Array($)&&M.IsNumber(Q)?l($,X):M.IsString($)&&M.IsNumber(Q)?l($,X):M.IsArray($)&&M.IsNumber(Q)?l($,X):M.IsObject($)?(()=>{for(let Y of Object.getOwnPropertyNames($.properties))if(W6(X,$.properties[Y])===A.False)return A.False;return A.True})():A.False}function vq($,W){return D$(W)?_$($,W):M.IsObject(W)?E$($,W):!M.IsRecord(W)?A.False:l(eQ($),eQ(W))}function dq($,W){let Q=M.IsRegExp($)?_2():$,X=M.IsRegExp(W)?_2():W;return l(Q,X)}function Q6($,W){return M.IsLiteral($)&&V$.IsString($.const)?A.True:M.IsString($)?A.True:A.False}function hq($,W){return D$(W)?_$($,W):M.IsObject(W)?E$($,W):M.IsRecord(W)?H2($,W):M.IsString(W)?A.True:A.False}function yq($,W){return D$(W)?_$($,W):M.IsObject(W)?E$($,W):M.IsRecord(W)?H2($,W):M.IsSymbol(W)?A.True:A.False}function mq($,W){return M.IsTemplateLiteral($)?l(SW($),W):M.IsTemplateLiteral(W)?l($,SW(W)):uW("Invalid fallthrough for TemplateLiteral")}function cq($,W){return M.IsArray(W)&&$.items!==void 0&&$.items.every((Q)=>l(Q,W.items)===A.True)}function nq($,W){return M.IsNever($)?A.True:M.IsUnknown($)?A.False:M.IsAny($)?A.Union:A.False}function oq($,W){return D$(W)?_$($,W):M.IsObject(W)&&_Q(W)?A.True:M.IsArray(W)&&cq($,W)?A.True:!M.IsTuple(W)?A.False:V$.IsUndefined($.items)&&!V$.IsUndefined(W.items)||!V$.IsUndefined($.items)&&V$.IsUndefined(W.items)?A.False:V$.IsUndefined($.items)&&!V$.IsUndefined(W.items)?A.True:$.items.every((Q,X)=>l(Q,W.items[X])===A.True)?A.True:A.False}function iq($,W){return D$(W)?_$($,W):M.IsObject(W)?E$($,W):M.IsRecord(W)?H2($,W):M.IsUint8Array(W)?A.True:A.False}function pq($,W){return D$(W)?_$($,W):M.IsObject(W)?E$($,W):M.IsRecord(W)?H2($,W):M.IsVoid(W)?sq($,W):M.IsUndefined(W)?A.True:A.False}function WX($,W){return W.anyOf.some((Q)=>l($,Q)===A.True)?A.True:A.False}function uq($,W){return $.anyOf.every((Q)=>l(Q,W)===A.True)?A.True:A.False}function X6($,W){return A.True}function lq($,W){return M.IsNever(W)?e0($,W):M.IsIntersect(W)?DQ($,W):M.IsUnion(W)?WX($,W):M.IsAny(W)?$X($,W):M.IsString(W)?Q6($,W):M.IsNumber(W)?$6($,W):M.IsInteger(W)?a0($,W):M.IsBoolean(W)?r0($,W):M.IsArray(W)?Uq($,W):M.IsTuple(W)?nq($,W):M.IsObject(W)?E$($,W):M.IsUnknown(W)?A.True:A.False}function sq($,W){return M.IsUndefined($)?A.True:M.IsUndefined($)?A.True:A.False}function tq($,W){return M.IsIntersect(W)?DQ($,W):M.IsUnion(W)?WX($,W):M.IsUnknown(W)?X6($,W):M.IsAny(W)?$X($,W):M.IsObject(W)?E$($,W):M.IsVoid(W)?A.True:A.False}function l($,W){return M.IsTemplateLiteral($)||M.IsTemplateLiteral(W)?mq($,W):M.IsRegExp($)||M.IsRegExp(W)?dq($,W):M.IsNot($)||M.IsNot(W)?Kq($,W):M.IsAny($)?Gq($,W):M.IsArray($)?Aq($,W):M.IsBigInt($)?_q($,W):M.IsBoolean($)?Nq($,W):M.IsAsyncIterator($)?Dq($,W):M.IsConstructor($)?Lq($,W):M.IsDate($)?Sq($,W):M.IsFunction($)?Oq($,W):M.IsInteger($)?bq($,W):M.IsIntersect($)?jq($,W):M.IsIterator($)?Rq($,W):M.IsLiteral($)?Fq($,W):M.IsNever($)?Cq($,W):M.IsNull($)?Vq($,W):M.IsNumber($)?Pq($,W):M.IsObject($)?fq($,W):M.IsRecord($)?vq($,W):M.IsString($)?hq($,W):M.IsSymbol($)?yq($,W):M.IsTuple($)?oq($,W):M.IsPromise($)?Tq($,W):M.IsUint8Array($)?iq($,W):M.IsUndefined($)?pq($,W):M.IsUnion($)?uq($,W):M.IsUnknown($)?lq($,W):M.IsVoid($)?tq($,W):uW(`Unknown left type operand '${$[D]}'`)}function e2($,W){return l($,W)}function rq($,W,Q,X,Y){let q={};for(let H of globalThis.Object.getOwnPropertyNames($))q[H]=lW($[H],W,Q,X,$$(Y));return q}function aq($,W,Q,X,Y){return rq($.properties,W,Q,X,Y)}function Y6($,W,Q,X,Y){let q=aq($,W,Q,X,Y);return m(q)}function eq($,W,Q,X){let Y=e2($,W);return Y===A.Union?o([Q,X]):Y===A.True?Q:X}function lW($,W,Q,X,Y){return W$($)?Y6($,W,Q,X,Y):p$($)?U(q6($,W,Q,X,Y)):U(eq($,W,Q,X),Y)}function $9($,W,Q,X,Y){return{[$]:lW(n($),W,Q,X,$$(Y))}}function W9($,W,Q,X,Y){return $.reduce((q,H)=>{return{...q,...$9(H,W,Q,X,Y)}},{})}function Q9($,W,Q,X,Y){return W9($.keys,W,Q,X,Y)}function q6($,W,Q,X,Y){let q=Q9($,W,Q,X,Y);return m(q)}function X9($){return $.allOf.every((W)=>m2(W))}function Y9($){return $.anyOf.some((W)=>m2(W))}function q9($){return!m2($.not)}function m2($){return $[D]==="Intersect"?X9($):$[D]==="Union"?Y9($):$[D]==="Not"?q9($):$[D]==="Undefined"?!0:!1}function H6($,W){return sW(SW($),W)}function H9($,W){let Q=$.filter((X)=>e2(X,W)===A.False);return Q.length===1?Q[0]:o(Q)}function sW($,W,Q={}){if(u$($))return U(H6($,W),Q);if(W$($))return U(z6($,W),Q);return U(h($)?H9($.anyOf,W):e2($,W)!==A.False?k():$,Q)}function z9($,W){let Q={};for(let X of globalThis.Object.getOwnPropertyNames($))Q[X]=sW($[X],W);return Q}function J9($,W){return z9($.properties,W)}function z6($,W){let Q=J9($,W);return m(Q)}function J6($,W){return tW(SW($),W)}function M9($,W){let Q=$.filter((X)=>e2(X,W)!==A.False);return Q.length===1?Q[0]:o(Q)}function tW($,W,Q){if(u$($))return U(J6($,W),Q);if(W$($))return U(M6($,W),Q);return U(h($)?M9($.anyOf,W):e2($,W)!==A.False?$:k(),Q)}function B9($,W){let Q={};for(let X of globalThis.Object.getOwnPropertyNames($))Q[X]=tW($[X],W);return Q}function w9($,W){return B9($.properties,W)}function M6($,W){let Q=w9($,W);return m(Q)}function B6($,W){return G2($)?U($.returns,W):k(W)}function NQ($){return h$(P$($))}function OW($,W,Q){return U({[D]:"Record",type:"object",patternProperties:{[$]:W}},Q)}function QX($,W,Q){let X={};for(let Y of $)X[Y]=W;return u(X,{...Q,[a$]:"Record"})}function G9($,W,Q){return R0($)?QX(d$($),W,Q):OW($.pattern,W,Q)}function U9($,W,Q){return QX(d$(o($)),W,Q)}function A9($,W,Q){return QX([$.toString()],W,Q)}function D9($,W,Q){return OW($.source,W,Q)}function _9($,W,Q){let X=G$($.pattern)?s2:$.pattern;return OW(X,W,Q)}function N9($,W,Q){return OW(s2,W,Q)}function L9($,W,Q){return OW(A0,W,Q)}function S9($,W,Q){return u({true:W,false:W},Q)}function O9($,W,Q){return OW(l2,W,Q)}function b9($,W,Q){return OW(l2,W,Q)}function LQ($,W,Q={}){return h($)?U9($.anyOf,W,Q):u$($)?G9($,W,Q):i$($)?A9($.const,W,Q):f2($)?S9($,W,Q):A2($)?O9($,W,Q):D2($)?b9($,W,Q):mQ($)?D9($,W,Q):T2($)?_9($,W,Q):hQ($)?N9($,W,Q):u2($)?L9($,W,Q):k(Q)}function SQ($){return globalThis.Object.getOwnPropertyNames($.patternProperties)[0]}function w6($){let W=SQ($);return W===s2?_2():W===l2?$2():_2({pattern:W})}function OQ($){return $.patternProperties[SQ($)]}function j9($,W){return W.parameters=x8($,W.parameters),W.returns=N2($,W.returns),W}function R9($,W){return W.parameters=x8($,W.parameters),W.returns=N2($,W.returns),W}function F9($,W){return W.allOf=x8($,W.allOf),W}function C9($,W){return W.anyOf=x8($,W.anyOf),W}function K9($,W){if(G$(W.items))return W;return W.items=x8($,W.items),W}function V9($,W){return W.items=N2($,W.items),W}function P9($,W){return W.items=N2($,W.items),W}function Z9($,W){return W.items=N2($,W.items),W}function E9($,W){return W.item=N2($,W.item),W}function k9($,W){let Q=f9($,W.properties);return{...W,...u(Q)}}function I9($,W){let Q=N2($,w6(W)),X=N2($,OQ(W)),Y=LQ(Q,X);return{...W,...Y}}function x9($,W){return W.index in $?$[W.index]:a2()}function g9($,W){let Q=fW(W),X=T$(W),Y=N2($,W);return Q&&X?NQ(Y):Q&&!X?h$(Y):!Q&&X?P$(Y):Y}function f9($,W){return globalThis.Object.getOwnPropertyNames(W).reduce((Q,X)=>{return{...Q,[X]:g9($,W[X])}},{})}function x8($,W){return W.map((Q)=>N2($,Q))}function N2($,W){return G2(W)?j9($,W):U2(W)?R9($,W):H$(W)?F9($,W):h(W)?C9($,W):l$(W)?K9($,W):B2(W)?V9($,W):UW(W)?P9($,W):DW(W)?Z9($,W):_W(W)?E9($,W):U$(W)?k9($,W):NW(W)?I9($,W):yQ(W)?x9($,W):W}function G6($,W){return N2(W,IW($))}function U6($){return U({[D]:"Integer",type:"integer"},$)}function T9($,W,Q){return{[$]:L2(n($),W,$$(Q))}}function v9($,W,Q){return $.reduce((Y,q)=>{return{...Y,...T9(q,W,Q)}},{})}function d9($,W,Q){return v9($.keys,W,Q)}function A6($,W,Q){let X=d9($,W,Q);return m(X)}function h9($){let[W,Q]=[$.slice(0,1),$.slice(1)];return[W.toLowerCase(),Q].join("")}function y9($){let[W,Q]=[$.slice(0,1),$.slice(1)];return[W.toUpperCase(),Q].join("")}function m9($){return $.toUpperCase()}function c9($){return $.toLowerCase()}function n9($,W,Q){let X=cW($.pattern);if(!LW(X))return{...$,pattern:D6($.pattern,W)};let H=[...Z8(X)].map((N)=>n(N)),z=_6(H,W),w=o(z);return qQ([w],Q)}function D6($,W){return typeof $==="string"?W==="Uncapitalize"?h9($):W==="Capitalize"?y9($):W==="Uppercase"?m9($):W==="Lowercase"?c9($):$:$.toString()}function _6($,W){return $.map((Q)=>L2(Q,W))}function L2($,W,Q={}){return p$($)?A6($,W,Q):u$($)?n9($,W,Q):h($)?o(_6($.anyOf,W),Q):i$($)?n(D6($.const,W),Q):U($,Q)}function N6($,W={}){return L2($,"Capitalize",W)}function L6($,W={}){return L2($,"Lowercase",W)}function S6($,W={}){return L2($,"Uncapitalize",W)}function O6($,W={}){return L2($,"Uppercase",W)}function o9($,W,Q){let X={};for(let Y of globalThis.Object.getOwnPropertyNames($))X[Y]=$W($[Y],W,$$(Q));return X}function i9($,W,Q){return o9($.properties,W,Q)}function b6($,W,Q){let X=i9($,W,Q);return m(X)}function p9($,W){return $.map((Q)=>XX(Q,W))}function u9($,W){return $.map((Q)=>XX(Q,W))}function l9($,W){let{[W]:Q,...X}=$;return X}function s9($,W){return W.reduce((Q,X)=>l9(Q,X),$)}function t9($,W,Q){let X=z$($,[X$,"$id","required","properties"]),Y=s9(Q,W);return u(Y,X)}function r9($){let W=$.reduce((Q,X)=>$Q(X)?[...Q,n(X)]:Q,[]);return o(W)}function XX($,W){return H$($)?Z$(p9($.allOf,W)):h($)?o(u9($.anyOf,W)):U$($)?t9($,W,$.properties):u({})}function $W($,W,Q){let X=w$(W)?r9(W):W,Y=Y$(W)?d$(W):W,q=M$($),H=M$(W);return W$($)?b6($,Y,Q):p$(W)?j6($,W,Q):q&&H?e("Omit",[$,X],Q):!q&&H?e("Omit",[$,X],Q):q&&!H?e("Omit",[$,X],Q):U({...XX($,Y),...Q})}function a9($,W,Q){return{[W]:$W($,[W],$$(Q))}}function e9($,W,Q){return W.reduce((X,Y)=>{return{...X,...a9($,Y,Q)}},{})}function $H($,W,Q){return e9($,W.keys,Q)}function j6($,W,Q){let X=$H($,W,Q);return m(X)}function WH($,W,Q){let X={};for(let Y of globalThis.Object.getOwnPropertyNames($))X[Y]=WW($[Y],W,$$(Q));return X}function QH($,W,Q){return WH($.properties,W,Q)}function R6($,W,Q){let X=QH($,W,Q);return m(X)}function XH($,W){return $.map((Q)=>YX(Q,W))}function YH($,W){return $.map((Q)=>YX(Q,W))}function qH($,W){let Q={};for(let X of W)if(X in $)Q[X]=$[X];return Q}function HH($,W,Q){let X=z$($,[X$,"$id","required","properties"]),Y=qH(Q,W);return u(Y,X)}function zH($){let W=$.reduce((Q,X)=>$Q(X)?[...Q,n(X)]:Q,[]);return o(W)}function YX($,W){return H$($)?Z$(XH($.allOf,W)):h($)?o(YH($.anyOf,W)):U$($)?HH($,W,$.properties):u({})}function WW($,W,Q){let X=w$(W)?zH(W):W,Y=Y$(W)?d$(W):W,q=M$($),H=M$(W);return W$($)?R6($,Y,Q):p$(W)?F6($,W,Q):q&&H?e("Pick",[$,X],Q):!q&&H?e("Pick",[$,X],Q):q&&!H?e("Pick",[$,X],Q):U({...YX($,Y),...Q})}function JH($,W,Q){return{[W]:WW($,[W],$$(Q))}}function MH($,W,Q){return W.reduce((X,Y)=>{return{...X,...JH($,Y,Q)}},{})}function BH($,W,Q){return MH($,W.keys,Q)}function F6($,W,Q){let X=BH($,W,Q);return m(X)}function wH($,W){return e("Partial",[e($,W)])}function GH($){return e("Partial",[X2($)])}function UH($){let W={};for(let Q of globalThis.Object.getOwnPropertyNames($))W[Q]=P$($[Q]);return W}function AH($,W){let Q=z$($,[X$,"$id","required","properties"]),X=UH(W);return u(X,Q)}function C6($){return $.map((W)=>K6(W))}function K6($){return w2($)?wH($.target,$.parameters):M$($)?GH($.$ref):H$($)?Z$(C6($.allOf)):h($)?o(C6($.anyOf)):U$($)?AH($,$.properties):AW($)?$:f2($)?$:A2($)?$:i$($)?$:R8($)?$:D2($)?$:T2($)?$:F8($)?$:v2($)?$:u({})}function rW($,W){if(W$($))return V6($,W);else return U({...K6($),...W})}function DH($,W){let Q={};for(let X of globalThis.Object.getOwnPropertyNames($))Q[X]=rW($[X],$$(W));return Q}function _H($,W){return DH($.properties,W)}function V6($,W){let Q=_H($,W);return m(Q)}function NH($,W){return e("Required",[e($,W)])}function LH($){return e("Required",[X2($)])}function SH($){let W={};for(let Q of globalThis.Object.getOwnPropertyNames($))W[Q]=z$($[Q],[F$]);return W}function OH($,W){let Q=z$($,[X$,"$id","required","properties"]),X=SH(W);return u(X,Q)}function P6($){return $.map((W)=>Z6(W))}function Z6($){return w2($)?NH($.target,$.parameters):M$($)?LH($.$ref):H$($)?Z$(P6($.allOf)):h($)?o(P6($.anyOf)):U$($)?OH($,$.properties):AW($)?$:f2($)?$:A2($)?$:i$($)?$:R8($)?$:D2($)?$:T2($)?$:F8($)?$:v2($)?$:u({})}function aW($,W){if(W$($))return E6($,W);else return U({...Z6($),...W})}function bH($,W){let Q={};for(let X of globalThis.Object.getOwnPropertyNames($))Q[X]=aW($[X],W);return Q}function jH($,W){return bH($.properties,W)}function E6($,W){let Q=jH($,W);return m(Q)}function RH($,W){return W.map((Q)=>{return M$(Q)?qX($,Q.$ref):s$($,Q)})}function qX($,W){return W in $?M$($[W])?qX($,$[W].$ref):s$($,$[W]):k()}function FH($){return iW($[0])}function CH($){return r2($[0],$[1])}function KH($){return pW($[0])}function VH($){return rW($[0])}function PH($){return $W($[0],$[1])}function ZH($){return WW($[0],$[1])}function EH($){return aW($[0])}function kH($,W,Q){let X=RH($,Q);return W==="Awaited"?FH(X):W==="Index"?CH(X):W==="KeyOf"?KH(X):W==="Partial"?VH(X):W==="Omit"?PH(X):W==="Pick"?ZH(X):W==="Required"?EH(X):k()}function IH($,W){return dW(s$($,W))}function xH($,W){return hW(s$($,W))}function gH($,W,Q){return yW(g8($,W),s$($,Q))}function fH($,W,Q){return V2(g8($,W),s$($,Q))}function TH($,W){return Z$(g8($,W))}function vH($,W){return oW(s$($,W))}function dH($,W){return u(globalThis.Object.keys(W).reduce((Q,X)=>{return{...Q,[X]:s$($,W[X])}},{}))}function hH($,W){let[Q,X]=[s$($,OQ(W)),SQ(W)],Y=IW(W);return Y.patternProperties[X]=Q,Y}function yH($,W){return M$(W)?{...qX($,W.$ref),[X$]:W[X$]}:W}function mH($,W){return W2(g8($,W))}function cH($,W){return o(g8($,W))}function g8($,W){return W.map((Q)=>s$($,Q))}function s$($,W){return T$(W)?U(s$($,z$(W,[F$])),W):fW(W)?U(s$($,z$(W,[M2])),W):c(W)?U(yH($,W),W):B2(W)?U(IH($,W.items),W):UW(W)?U(xH($,W.items),W):w2(W)?U(kH($,W.target,W.parameters)):G2(W)?U(gH($,W.parameters,W.returns),W):U2(W)?U(fH($,W.parameters,W.returns),W):H$(W)?U(TH($,W.allOf),W):DW(W)?U(vH($,W.items),W):U$(W)?U(dH($,W.properties),W):NW(W)?U(hH($,W)):l$(W)?U(mH($,W.items||[]),W):h(W)?U(cH($,W.anyOf),W):W}function nH($,W){return W in $?s$($,$[W]):k()}function k6($){return globalThis.Object.getOwnPropertyNames($).reduce((W,Q)=>{return{...W,[Q]:nH($,Q)}},{})}class I6{constructor($){let W=k6($),Q=this.WithIdentifiers(W);this.$defs=Q}Import($,W){let Q={...this.$defs,[$]:U(this.$defs[$],W)};return U({[D]:"Import",$defs:Q,$ref:$})}WithIdentifiers($){return globalThis.Object.getOwnPropertyNames($).reduce((W,Q)=>{return{...W,[Q]:{...$[Q],$id:Q}}},{})}}function x6($){return new I6($)}function g6($,W){return U({[D]:"Not",not:$},W)}function f6($,W){return U2($)?W2($.parameters,W):k()}var oH=0;function T6($,W={}){if(G$(W.$id))W.$id=`T${oH++}`;let Q=IW($({[D]:"This",$ref:`${W.$id}`}));return Q.$id=W.$id,U({[a$]:"Recursive",...Q},W)}function v6($,W){let Q=s($)?new globalThis.RegExp($):$;return U({[D]:"RegExp",type:"RegExp",source:Q.source,flags:Q.flags},W)}function iH($){return H$($)?$.allOf:h($)?$.anyOf:l$($)?$.items??[]:[]}function d6($){return iH($)}function h6($,W){return U2($)?U($.returns,W):k(W)}class y6{constructor($){this.schema=$}Decode($){return new m6(this.schema,$)}}class m6{constructor($,W){this.schema=$,this.decode=W}EncodeTransform($,W){let Y={Encode:(q)=>W[X$].Encode($(q)),Decode:(q)=>this.decode(W[X$].Decode(q))};return{...W,[X$]:Y}}EncodeSchema($,W){let Q={Decode:this.decode,Encode:$};return{...W,[X$]:Q}}Encode($){return c(this.schema)?this.EncodeTransform($,this.schema):this.EncodeSchema($,this.schema)}}function c6($){return new y6($)}function n6($={}){return U({[D]:$[D]??"Unsafe"},$)}function o6($){return U({[D]:"Void",type:"void"},$)}var HX={};JW(HX,{Void:()=>o6,Uppercase:()=>O6,Unsafe:()=>n6,Unknown:()=>a2,Union:()=>o,Undefined:()=>GQ,Uncapitalize:()=>S6,Uint8Array:()=>UQ,Tuple:()=>W2,Transform:()=>c6,TemplateLiteral:()=>qQ,Symbol:()=>wQ,String:()=>_2,ReturnType:()=>h6,Rest:()=>d6,Required:()=>aW,RegExp:()=>v6,Ref:()=>X2,Recursive:()=>T6,Record:()=>LQ,ReadonlyOptional:()=>NQ,Readonly:()=>h$,Promise:()=>zQ,Pick:()=>WW,Partial:()=>rW,Parameters:()=>f6,Optional:()=>P$,Omit:()=>$W,Object:()=>u,Number:()=>$2,Null:()=>BQ,Not:()=>g6,Never:()=>k,Module:()=>x6,Mapped:()=>T0,Lowercase:()=>L6,Literal:()=>n,KeyOf:()=>pW,Iterator:()=>oW,Intersect:()=>Z$,Integer:()=>U6,Instantiate:()=>G6,InstanceType:()=>B6,Index:()=>r2,Function:()=>V2,Extract:()=>tW,Extends:()=>lW,Exclude:()=>sW,Enum:()=>i0,Date:()=>MQ,ConstructorParameters:()=>o0,Constructor:()=>yW,Const:()=>n0,Composite:()=>c0,Capitalize:()=>N6,Boolean:()=>YQ,BigInt:()=>nW,Awaited:()=>iW,AsyncIterator:()=>hW,Array:()=>dW,Argument:()=>S0,Any:()=>t2});var pH=HX;import{join as lH}from"path";import{readFileSync as sH}from"fs";RQ();import{join as uH}from"path";async function p6(){let $=uH(process.cwd(),"bare.config.ts");try{let W=await import($);return jQ(W.default)}catch{return jQ()}}class u6 extends EW{tree=new kW;pool=[];hotFetch;compiled=!1;poolMask;_useLog=!1;useLog($=!0){return this._useLog=$,this}constructor($=1024){super();p6();let W=Math.pow(2,Math.ceil(Math.log2($)));this.poolMask=W-1;for(let Q=0;Q<W;Q++)this.pool.push(new xQ);try{let Q=lH(process.cwd(),"package.json"),X=JSON.parse(sH(Q,"utf-8"));if(X.name)this.name=X.name.split(/[-_]/).map((Y)=>Y.charAt(0).toUpperCase()+Y.slice(1)).join(" ")}catch{this.name="App"}}notFoundHandler=()=>({status:404,message:"Route not found"});setNotFound($){this.notFoundHandler=$}compileHandler($){let W=$,Q=$.length,X={status:200,headers:{"content-type":"application/json"}},Y=`
18
+ `;let a=new Map;for(let f of this.staticKeys){let l=a.get(f.length);if(!l)l=[],a.set(f.length,l);l.push(f)}i+=`${s}switch(len${t}) {
19
+ `;for(let[f,l]of a){i+=`${s} case ${f}:
20
+ `;for(let g of l){if(f===1)i+=`${s} if (${r}.charCodeAt(${n}) === ${g.charCodeAt(0)}) {
21
+ `;else i+=`${s} if (${r}.startsWith(${JSON.stringify(g)}, ${n})) {
22
+ `;let R=this.children[g];i+=R.jitCompile(e,t+1,r,`slash${t} + 1`,o),i+=`${s} }
23
+ `}i+=`${s} break;
24
+ `}i+=`${s}}
25
+ `}if(this.paramNode){let a=this.paramNode;if(this.staticKeys.length===0)i+=`${s}let slash${t} = ${r}.indexOf('/', ${n});
26
+ `,i+=`${s}if (slash${t} === -1 || slash${t} > urlLen) slash${t} = urlLen;
27
+ `;let f=`pL${t}`;i+=`${s}const ${f} = ${r}.slice(${n}, slash${t});
28
+ `;let l=[...o,{name:this.paramName,varName:f}];i+=a.jitCompile(e,t+1,r,`slash${t} + 1`,l)}return i}id=Math.random().toString(36).slice(2)}class ao{req;params={};_status=200;_headers=void 0;store=new Map;body=void 0;query={};constructor(){}async jsonBody(){if(this.body!==void 0)return this.body;let e=this.req.headers.get("content-type");if(e&&e.includes("application/json"))try{return this.body=await this.req.json()}catch{return this.body=null}return this.body=null}reset(e){if(this.req=e,this._status=200,this._headers=void 0,this.store.size>0)this.store.clear();return this.params={},this.query={},this.body=void 0,this}status(e){return this._status=e,this}json(e){let t=this._status||200;if(!this._headers)return Response.json(e,{status:t});if(this._headers["content-type"]===void 0)this._headers["content-type"]="application/json";return Response.json(e,{status:t,headers:this._headers})}set(e,t){return this.store.set(e,t),this}get(e){return this.store.get(e)}setHeader(e,t){if(!this._headers)this._headers={};return this._headers[e.toLowerCase()]=t,this}send(e,t={}){let r=this._status>=400;return this.json({status:r?"error":"success",msg:e,...t})}}function Yi(e){return re(e)&&!ye(e)&&!Xt(e)&&Symbol.asyncIterator in e}function ye(e){return Array.isArray(e)}function co(e){return typeof e==="bigint"}function Qt(e){return typeof e==="boolean"}function qr(e){return e instanceof globalThis.Date}function Qi(e){return typeof e==="function"}function Xi(e){return re(e)&&!ye(e)&&!Xt(e)&&Symbol.iterator in e}function Zi(e){return e===null}function Ve(e){return typeof e==="number"}function re(e){return typeof e==="object"&&e!==null}function uo(e){return e instanceof globalThis.RegExp}function X(e){return typeof e==="string"}function es(e){return typeof e==="symbol"}function Xt(e){return e instanceof globalThis.Uint8Array}function Z(e){return e===void 0}function ru(e){return e.map((t)=>fo(t))}function nu(e){return new Date(e.getTime())}function ou(e){return new Uint8Array(e)}function iu(e){return new RegExp(e.source,e.flags)}function su(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=fo(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=fo(e[r]);return t}function fo(e){return ye(e)?ru(e):qr(e)?nu(e):Xt(e)?ou(e):uo(e)?iu(e):re(e)?su(e):e}function ne(e){return fo(e)}function Vr(e,t){return t===void 0?ne(e):ne({...t,...e})}function mo(e){return Ke(e)&&globalThis.Symbol.asyncIterator in e}function po(e){return Ke(e)&&globalThis.Symbol.iterator in e}function lo(e){return e instanceof globalThis.Promise}function Hr(e){return e instanceof Date&&globalThis.Number.isFinite(e.getTime())}function zr(e){return e instanceof globalThis.Uint8Array}function yo(e,t){return t in e}function Ke(e){return e!==null&&typeof e==="object"}function xe(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function Se(e){return e===void 0}function gr(e){return e===null}function Ir(e){return typeof e==="boolean"}function N(e){return typeof e==="number"}function xo(e){return globalThis.Number.isInteger(e)}function He(e){return typeof e==="bigint"}function _e(e){return typeof e==="string"}function go(e){return typeof e==="function"}function hr(e){return typeof e==="symbol"}function Io(e){return He(e)||Ir(e)||gr(e)||N(e)||_e(e)||hr(e)||Se(e)}var ee;(function(e){e.InstanceMode="default",e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(s,a){return e.ExactOptionalPropertyTypes?a in s:s[a]!==void 0}e.IsExactOptionalProperty=t;function r(s){let a=Ke(s);return e.AllowArrayObject?a:a&&!xe(s)}e.IsObjectLike=r;function n(s){return r(s)&&!(s instanceof Date)&&!(s instanceof Uint8Array)}e.IsRecordLike=n;function o(s){return e.AllowNaN?N(s):Number.isFinite(s)}e.IsNumberLike=o;function i(s){let a=Se(s);return e.AllowNullVoid?a||s===null:a}e.IsVoidLike=i})(ee||(ee={}));function au(e){return globalThis.Object.freeze(e).map((t)=>jn(t))}function cu(e){return e}function uu(e){return e}function fu(e){return e}function mu(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=jn(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=jn(e[r]);return globalThis.Object.freeze(t)}function jn(e){return ye(e)?au(e):qr(e)?cu(e):Xt(e)?uu(e):uo(e)?fu(e):re(e)?mu(e):e}function d(e,t){let r=t!==void 0?{...t,...e}:e;switch(ee.InstanceMode){case"freeze":return jn(r);case"clone":return ne(r);default:return r}}class v extends Error{constructor(e){super(e)}}var ie=Symbol.for("TypeBox.Transform"),kt=Symbol.for("TypeBox.Readonly"),Re=Symbol.for("TypeBox.Optional"),Nt=Symbol.for("TypeBox.Hint"),y=Symbol.for("TypeBox.Kind");function Wr(e){return re(e)&&e[kt]==="Readonly"}function Ee(e){return re(e)&&e[Re]==="Optional"}function ii(e){return E(e,"Any")}function si(e){return E(e,"Argument")}function ut(e){return E(e,"Array")}function br(e){return E(e,"AsyncIterator")}function _r(e){return E(e,"BigInt")}function Kt(e){return E(e,"Boolean")}function ft(e){return E(e,"Computed")}function mt(e){return E(e,"Constructor")}function du(e){return E(e,"Date")}function dt(e){return E(e,"Function")}function pt(e){return E(e,"Integer")}function ue(e){return E(e,"Intersect")}function Or(e){return E(e,"Iterator")}function E(e,t){return re(e)&&y in e&&e[y]===t}function ho(e){return Qt(e)||Ve(e)||X(e)}function ze(e){return E(e,"Literal")}function We(e){return E(e,"MappedKey")}function oe(e){return E(e,"MappedResult")}function Zt(e){return E(e,"Never")}function pu(e){return E(e,"Not")}function Mn(e){return E(e,"Null")}function lt(e){return E(e,"Number")}function le(e){return E(e,"Object")}function $r(e){return E(e,"Promise")}function Fr(e){return E(e,"Record")}function pe(e){return E(e,"Ref")}function ai(e){return E(e,"RegExp")}function Et(e){return E(e,"String")}function Sn(e){return E(e,"Symbol")}function Je(e){return E(e,"TemplateLiteral")}function lu(e){return E(e,"This")}function D(e){return re(e)&&ie in e}function Ye(e){return E(e,"Tuple")}function Lt(e){return E(e,"Undefined")}function B(e){return E(e,"Union")}function yu(e){return E(e,"Uint8Array")}function xu(e){return E(e,"Unknown")}function gu(e){return E(e,"Unsafe")}function Iu(e){return E(e,"Void")}function hu(e){return re(e)&&y in e&&X(e[y])}function se(e){return ii(e)||si(e)||ut(e)||Kt(e)||_r(e)||br(e)||ft(e)||mt(e)||du(e)||dt(e)||pt(e)||ue(e)||Or(e)||ze(e)||We(e)||oe(e)||Zt(e)||pu(e)||Mn(e)||lt(e)||le(e)||$r(e)||Fr(e)||pe(e)||ai(e)||Et(e)||Sn(e)||Je(e)||lu(e)||Ye(e)||Lt(e)||B(e)||yu(e)||xu(e)||gu(e)||Iu(e)||hu(e)}var bu=["Argument","Any","Array","AsyncIterator","BigInt","Boolean","Computed","Constructor","Date","Enum","Function","Integer","Intersect","Iterator","Literal","MappedKey","MappedResult","Not","Null","Number","Object","Promise","Record","Ref","RegExp","String","Symbol","TemplateLiteral","This","Tuple","Undefined","Union","Uint8Array","Unknown","Void"];function ts(e){try{return new RegExp(e),!0}catch{return!1}}function ci(e){if(!X(e))return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>=7&&r<=13||r===27||r===127)return!1}return!0}function rs(e){return ui(e)||ae(e)}function Un(e){return Z(e)||co(e)}function Y(e){return Z(e)||Ve(e)}function ui(e){return Z(e)||Qt(e)}function H(e){return Z(e)||X(e)}function _u(e){return Z(e)||X(e)&&ci(e)&&ts(e)}function Ou(e){return Z(e)||X(e)&&ci(e)}function ns(e){return Z(e)||ae(e)}function bo(e){return re(e)&&e[Re]==="Optional"}function yt(e){return L(e,"Any")&&H(e.$id)}function $u(e){return L(e,"Argument")&&Ve(e.index)}function wr(e){return L(e,"Array")&&e.type==="array"&&H(e.$id)&&ae(e.items)&&Y(e.minItems)&&Y(e.maxItems)&&ui(e.uniqueItems)&&ns(e.contains)&&Y(e.minContains)&&Y(e.maxContains)}function fi(e){return L(e,"AsyncIterator")&&e.type==="AsyncIterator"&&H(e.$id)&&ae(e.items)}function _o(e){return L(e,"BigInt")&&e.type==="bigint"&&H(e.$id)&&Un(e.exclusiveMaximum)&&Un(e.exclusiveMinimum)&&Un(e.maximum)&&Un(e.minimum)&&Un(e.multipleOf)}function Rr(e){return L(e,"Boolean")&&e.type==="boolean"&&H(e.$id)}function Fu(e){return L(e,"Computed")&&X(e.target)&&ye(e.parameters)&&e.parameters.every((t)=>ae(t))}function Oo(e){return L(e,"Constructor")&&e.type==="Constructor"&&H(e.$id)&&ye(e.parameters)&&e.parameters.every((t)=>ae(t))&&ae(e.returns)}function $o(e){return L(e,"Date")&&e.type==="Date"&&H(e.$id)&&Y(e.exclusiveMaximumTimestamp)&&Y(e.exclusiveMinimumTimestamp)&&Y(e.maximumTimestamp)&&Y(e.minimumTimestamp)&&Y(e.multipleOfTimestamp)}function Fo(e){return L(e,"Function")&&e.type==="Function"&&H(e.$id)&&ye(e.parameters)&&e.parameters.every((t)=>ae(t))&&ae(e.returns)}function Gt(e){return L(e,"Integer")&&e.type==="integer"&&H(e.$id)&&Y(e.exclusiveMaximum)&&Y(e.exclusiveMinimum)&&Y(e.maximum)&&Y(e.minimum)&&Y(e.multipleOf)}function os(e){return re(e)&&Object.entries(e).every(([t,r])=>ci(t)&&ae(r))}function Tr(e){return L(e,"Intersect")&&(X(e.type)&&e.type!=="object"?!1:!0)&&ye(e.allOf)&&e.allOf.every((t)=>ae(t)&&!Nu(t))&&H(e.type)&&(ui(e.unevaluatedProperties)||ns(e.unevaluatedProperties))&&H(e.$id)}function mi(e){return L(e,"Iterator")&&e.type==="Iterator"&&H(e.$id)&&ae(e.items)}function L(e,t){return re(e)&&y in e&&e[y]===t}function is(e){return er(e)&&X(e.const)}function ss(e){return er(e)&&Ve(e.const)}function as(e){return er(e)&&Qt(e.const)}function er(e){return L(e,"Literal")&&H(e.$id)&&wu(e.const)}function wu(e){return Qt(e)||Ve(e)||X(e)}function Ru(e){return L(e,"MappedKey")&&ye(e.keys)&&e.keys.every((t)=>Ve(t)||X(t))}function Tu(e){return L(e,"MappedResult")&&os(e.properties)}function tr(e){return L(e,"Never")&&re(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function Jr(e){return L(e,"Not")&&ae(e.not)}function di(e){return L(e,"Null")&&e.type==="null"&&H(e.$id)}function Le(e){return L(e,"Number")&&e.type==="number"&&H(e.$id)&&Y(e.exclusiveMaximum)&&Y(e.exclusiveMinimum)&&Y(e.maximum)&&Y(e.minimum)&&Y(e.multipleOf)}function fe(e){return L(e,"Object")&&e.type==="object"&&H(e.$id)&&os(e.properties)&&rs(e.additionalProperties)&&Y(e.minProperties)&&Y(e.maxProperties)}function pi(e){return L(e,"Promise")&&e.type==="Promise"&&H(e.$id)&&ae(e.item)}function Te(e){return L(e,"Record")&&e.type==="object"&&H(e.$id)&&rs(e.additionalProperties)&&re(e.patternProperties)&&((t)=>{let r=Object.getOwnPropertyNames(t.patternProperties);return r.length===1&&ts(r[0])&&re(t.patternProperties)&&ae(t.patternProperties[r[0]])})(e)}function Au(e){return L(e,"Ref")&&H(e.$id)&&X(e.$ref)}function Kn(e){return L(e,"RegExp")&&H(e.$id)&&X(e.source)&&X(e.flags)&&Y(e.maxLength)&&Y(e.minLength)}function xt(e){return L(e,"String")&&e.type==="string"&&H(e.$id)&&Y(e.minLength)&&Y(e.maxLength)&&_u(e.pattern)&&Ou(e.format)}function En(e){return L(e,"Symbol")&&e.type==="symbol"&&H(e.$id)}function Ln(e){return L(e,"TemplateLiteral")&&e.type==="string"&&X(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function ku(e){return L(e,"This")&&H(e.$id)&&X(e.$ref)}function Nu(e){return re(e)&&ie in e}function wo(e){return L(e,"Tuple")&&e.type==="array"&&H(e.$id)&&Ve(e.minItems)&&Ve(e.maxItems)&&e.minItems===e.maxItems&&(Z(e.items)&&Z(e.additionalItems)&&e.minItems===0||ye(e.items)&&e.items.every((t)=>ae(t)))}function Ar(e){return L(e,"Undefined")&&e.type==="undefined"&&H(e.$id)}function Dt(e){return L(e,"Union")&&H(e.$id)&&re(e)&&ye(e.anyOf)&&e.anyOf.every((t)=>ae(t))}function Bn(e){return L(e,"Uint8Array")&&e.type==="Uint8Array"&&H(e.$id)&&Y(e.minByteLength)&&Y(e.maxByteLength)}function gt(e){return L(e,"Unknown")&&H(e.$id)}function Pu(e){return L(e,"Unsafe")}function Ro(e){return L(e,"Void")&&e.type==="void"&&H(e.$id)}function Cu(e){return re(e)&&y in e&&X(e[y])&&!bu.includes(e[y])}function ae(e){return re(e)&&(yt(e)||$u(e)||wr(e)||Rr(e)||_o(e)||fi(e)||Fu(e)||Oo(e)||$o(e)||Fo(e)||Gt(e)||Tr(e)||mi(e)||er(e)||Ru(e)||Tu(e)||tr(e)||Jr(e)||di(e)||Le(e)||fe(e)||pi(e)||Te(e)||Au(e)||Kn(e)||xt(e)||En(e)||Ln(e)||ku(e)||wo(e)||Ar(e)||Dt(e)||Bn(e)||gt(e)||Pu(e)||Ro(e)||Cu(e))}var us="(true|false)",To="(0|[1-9][0-9]*)",fs="(.*)";var rr="^(0|[1-9][0-9]*)$",nr="^(.*)$",ms="^(?!.*)$";var ds=new Map;function li(e){return ds.has(e)}function yi(e){return ds.get(e)}var ps=new Map;function Gn(e){return ps.has(e)}function xi(e){return ps.get(e)}function ls(e,t){return e.includes(t)}function ys(e){return[...new Set(e)]}function ju(e,t){return e.filter((r)=>t.includes(r))}function Mu(e,t){return e.reduce((r,n)=>ju(r,n),t)}function xs(e){return e.length===1?e[0]:e.length>1?Mu(e.slice(1),e[0]):[]}function gs(e){let t=[];for(let r of e)t.push(...r);return t}function or(e){return d({[y]:"Any"},e)}function Yr(e,t){return d({[y]:"Array",type:"array",items:e},t)}function Is(e){return d({[y]:"Argument",index:e})}function Qr(e,t){return d({[y]:"AsyncIterator",type:"AsyncIterator",items:e},t)}function te(e,t,r){return d({[y]:"Computed",target:e,parameters:t},r)}function Su(e,t){let{[t]:r,...n}=e;return n}function me(e,t){return t.reduce((r,n)=>Su(r,n),e)}function j(e){return d({[y]:"Never",not:{}},e)}function G(e){return d({[y]:"MappedResult",properties:e})}function Xr(e,t,r){return d({[y]:"Constructor",type:"Constructor",parameters:e,returns:t},r)}function Pt(e,t,r){return d({[y]:"Function",type:"Function",parameters:e,returns:t},r)}function Dn(e,t){return d({[y]:"Union",anyOf:e},t)}function Uu(e){return e.some((t)=>Ee(t))}function hs(e){return e.map((t)=>Ee(t)?Ku(t):t)}function Ku(e){return me(e,[Re])}function Eu(e,t){return Uu(e)?Ne(Dn(hs(e),t)):Dn(hs(e),t)}function Ct(e,t){return e.length===1?d(e[0],t):e.length===0?j(t):Eu(e,t)}function V(e,t){return e.length===0?j(t):e.length===1?d(e[0],t):Dn(e,t)}class gi extends v{}function Lu(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function Ii(e,t,r){return e[t]===r&&e.charCodeAt(t-1)!==92}function vt(e,t){return Ii(e,t,"(")}function vn(e,t){return Ii(e,t,")")}function bs(e,t){return Ii(e,t,"|")}function Bu(e){if(!(vt(e,0)&&vn(e,e.length-1)))return!1;let t=0;for(let r=0;r<e.length;r++){if(vt(e,r))t+=1;if(vn(e,r))t-=1;if(t===0&&r!==e.length-1)return!1}return!0}function Gu(e){return e.slice(1,e.length-1)}function Du(e){let t=0;for(let r=0;r<e.length;r++){if(vt(e,r))t+=1;if(vn(e,r))t-=1;if(bs(e,r)&&t===0)return!0}return!1}function vu(e){for(let t=0;t<e.length;t++)if(vt(e,t))return!0;return!1}function qu(e){let[t,r]=[0,0],n=[];for(let i=0;i<e.length;i++){if(vt(e,i))t+=1;if(vn(e,i))t-=1;if(bs(e,i)&&t===0){let s=e.slice(r,i);if(s.length>0)n.push(Zr(s));r=i+1}}let o=e.slice(r);if(o.length>0)n.push(Zr(o));if(n.length===0)return{type:"const",const:""};if(n.length===1)return n[0];return{type:"or",expr:n}}function Vu(e){function t(o,i){if(!vt(o,i))throw new gi("TemplateLiteralParser: Index must point to open parens");let s=0;for(let a=i;a<o.length;a++){if(vt(o,a))s+=1;if(vn(o,a))s-=1;if(s===0)return[i,a]}throw new gi("TemplateLiteralParser: Unclosed group parens in expression")}function r(o,i){for(let s=i;s<o.length;s++)if(vt(o,s))return[i,s];return[i,o.length]}let n=[];for(let o=0;o<e.length;o++)if(vt(e,o)){let[i,s]=t(e,o),a=e.slice(i,s+1);n.push(Zr(a)),o=s}else{let[i,s]=r(e,o),a=e.slice(i,s);if(a.length>0)n.push(Zr(a));o=s-1}return n.length===0?{type:"const",const:""}:n.length===1?n[0]:{type:"and",expr:n}}function Zr(e){return Bu(e)?Zr(Gu(e)):Du(e)?qu(e):vu(e)?Vu(e):{type:"const",const:Lu(e)}}function en(e){return Zr(e.slice(1,e.length-1))}class _s extends v{}function Hu(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="0"&&e.expr[1].type==="const"&&e.expr[1].const==="[1-9][0-9]*"}function zu(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="true"&&e.expr[1].type==="const"&&e.expr[1].const==="false"}function Wu(e){return e.type==="const"&&e.const===".*"}function kr(e){return Hu(e)||Wu(e)?!1:zu(e)?!0:e.type==="and"?e.expr.every((t)=>kr(t)):e.type==="or"?e.expr.every((t)=>kr(t)):e.type==="const"?!0:(()=>{throw new _s("Unknown expression type")})()}function Os(e){let t=en(e.pattern);return kr(t)}class $s extends v{}function*Fs(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let r of Fs(e.slice(1)))yield`${t}${r}`}function*Ju(e){return yield*Fs(e.expr.map((t)=>[...qn(t)]))}function*Yu(e){for(let t of e.expr)yield*qn(t)}function*Qu(e){return yield e.const}function*qn(e){return e.type==="and"?yield*Ju(e):e.type==="or"?yield*Yu(e):e.type==="const"?yield*Qu(e):(()=>{throw new $s("Unknown expression")})()}function No(e){let t=en(e.pattern);return kr(t)?[...qn(t)]:[]}function q(e,t){return d({[y]:"Literal",const:e,type:typeof e},t)}function Po(e){return d({[y]:"Boolean",type:"boolean"},e)}function tn(e){return d({[y]:"BigInt",type:"bigint"},e)}function Ze(e){return d({[y]:"Number",type:"number"},e)}function It(e){return d({[y]:"String",type:"string"},e)}function*Xu(e){let t=e.trim().replace(/"|'/g,"");return t==="boolean"?yield Po():t==="number"?yield Ze():t==="bigint"?yield tn():t==="string"?yield It():yield(()=>{let r=t.split("|").map((n)=>q(n.trim()));return r.length===0?j():r.length===1?r[0]:Ct(r)})()}function*Zu(e){if(e[1]!=="{"){let t=q("$"),r=hi(e.slice(1));return yield*[t,...r]}for(let t=2;t<e.length;t++)if(e[t]==="}"){let r=Xu(e.slice(2,t)),n=hi(e.slice(t+1));return yield*[...r,...n]}yield q(e)}function*hi(e){for(let t=0;t<e.length;t++)if(e[t]==="$"){let r=q(e.slice(0,t)),n=Zu(e.slice(t));return yield*[r,...n]}yield q(e)}function ws(e){return[...hi(e)]}class Rs extends v{}function ef(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ts(e,t){return Je(e)?e.pattern.slice(1,e.pattern.length-1):B(e)?`(${e.anyOf.map((r)=>Ts(r,t)).join("|")})`:lt(e)?`${t}${To}`:pt(e)?`${t}${To}`:_r(e)?`${t}${To}`:Et(e)?`${t}${fs}`:ze(e)?`${t}${ef(e.const.toString())}`:Kt(e)?`${t}${us}`:(()=>{throw new Rs(`Unexpected Kind '${e[y]}'`)})()}function bi(e){return`^${e.map((t)=>Ts(t,"")).join("")}$`}function Nr(e){let r=No(e).map((n)=>q(n));return Ct(r)}function Co(e,t){let r=X(e)?bi(ws(e)):bi(e);return d({[y]:"TemplateLiteral",type:"string",pattern:r},t)}function tf(e){return No(e).map((r)=>r.toString())}function rf(e){let t=[];for(let r of e)t.push(...Be(r));return t}function nf(e){return[e.toString()]}function Be(e){return[...new Set(Je(e)?tf(e):B(e)?rf(e.anyOf):ze(e)?nf(e.const):lt(e)?["[number]"]:pt(e)?["[number]"]:[])]}function of(e,t,r){let n={};for(let o of Object.getOwnPropertyNames(t))n[o]=ir(e,Be(t[o]),r);return n}function sf(e,t,r){return of(e,t.properties,r)}function As(e,t,r){let n=sf(e,t,r);return G(n)}function Ns(e,t){return e.map((r)=>Ps(r,t))}function af(e){return e.filter((t)=>!Zt(t))}function cf(e,t){return jo(af(Ns(e,t)))}function uf(e){return e.some((t)=>Zt(t))?[]:e}function ff(e,t){return Ct(uf(Ns(e,t)))}function mf(e,t){return t in e?e[t]:t==="[number]"?Ct(e):j()}function df(e,t){return t==="[number]"?e:j()}function pf(e,t){return t in e?e[t]:j()}function Ps(e,t){return ue(e)?cf(e.allOf,t):B(e)?ff(e.anyOf,t):Ye(e)?mf(e.items??[],t):ut(e)?df(e.items,t):le(e)?pf(e.properties,t):j()}function Vn(e,t){return t.map((r)=>Ps(e,r))}function ks(e,t){return Ct(Vn(e,t))}function ir(e,t,r){if(pe(e)||pe(t)){if(!se(e)||!se(t))throw new v("Index types using Ref parameters require both Type and Key to be of TSchema");return te("Index",[e,t])}if(oe(t))return As(e,t,r);if(We(t))return Cs(e,t,r);return d(se(t)?ks(e,Be(t)):ks(e,t),r)}function lf(e,t,r){return{[t]:ir(e,[t],ne(r))}}function yf(e,t,r){return t.reduce((n,o)=>({...n,...lf(e,o,r)}),{})}function xf(e,t,r){return yf(e,t.keys,r)}function Cs(e,t,r){let n=xf(e,t,r);return G(n)}function rn(e,t){return d({[y]:"Iterator",type:"Iterator",items:e},t)}function gf(e){return globalThis.Object.keys(e).filter((t)=>!Ee(e[t]))}function If(e,t){let r=gf(e),n=r.length>0?{[y]:"Object",type:"object",required:r,properties:e}:{[y]:"Object",type:"object",properties:e};return d(n,t)}var z=If;function Mo(e,t){return d({[y]:"Promise",type:"Promise",item:e},t)}function hf(e){return d(me(e,[kt]))}function bf(e){return d({...e,[kt]:"Readonly"})}function _f(e,t){return t===!1?hf(e):bf(e)}function Ge(e,t){let r=t??!0;return oe(e)?js(e,r):_f(e,r)}function Of(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Ge(e[n],t);return r}function $f(e,t){return Of(e.properties,t)}function js(e,t){let r=$f(e,t);return G(r)}function et(e,t){return d(e.length>0?{[y]:"Tuple",type:"array",items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[y]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},t)}function Ms(e,t){return e in t?tt(e,t[e]):G(t)}function Ff(e){return{[e]:q(e)}}function wf(e){let t={};for(let r of e)t[r]=q(r);return t}function Rf(e,t){return ls(t,e)?Ff(e):wf(t)}function Tf(e,t){let r=Rf(e,t);return Ms(e,r)}function Hn(e,t){return t.map((r)=>tt(e,r))}function Af(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(t))r[n]=tt(e,t[n]);return r}function tt(e,t){let r={...t};return Ee(t)?Ne(tt(e,me(t,[Re]))):Wr(t)?Ge(tt(e,me(t,[kt]))):oe(t)?Ms(e,t.properties):We(t)?Tf(e,t.keys):mt(t)?Xr(Hn(e,t.parameters),tt(e,t.returns),r):dt(t)?Pt(Hn(e,t.parameters),tt(e,t.returns),r):br(t)?Qr(tt(e,t.items),r):Or(t)?rn(tt(e,t.items),r):ue(t)?Pe(Hn(e,t.allOf),r):B(t)?V(Hn(e,t.anyOf),r):Ye(t)?et(Hn(e,t.items??[]),r):le(t)?z(Af(e,t.properties),r):ut(t)?Yr(tt(e,t.items),r):$r(t)?Mo(tt(e,t.item),r):t}function kf(e,t){let r={};for(let n of e)r[n]=tt(n,t);return r}function Ss(e,t,r){let n=se(e)?Be(e):e,o=t({[y]:"MappedKey",keys:n}),i=kf(n,o);return z(i,r)}function Nf(e){return d(me(e,[Re]))}function Pf(e){return d({...e,[Re]:"Optional"})}function Cf(e,t){return t===!1?Nf(e):Pf(e)}function Ne(e,t){let r=t??!0;return oe(e)?Us(e,r):Cf(e,r)}function jf(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=Ne(e[n],t);return r}function Mf(e,t){return jf(e.properties,t)}function Us(e,t){let r=Mf(e,t);return G(r)}function zn(e,t={}){let r=e.every((o)=>le(o)),n=se(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return d(t.unevaluatedProperties===!1||se(t.unevaluatedProperties)||r?{...n,[y]:"Intersect",type:"object",allOf:e}:{...n,[y]:"Intersect",allOf:e},t)}function Sf(e){return e.every((t)=>Ee(t))}function Uf(e){return me(e,[Re])}function Ks(e){return e.map((t)=>Ee(t)?Uf(t):t)}function Kf(e,t){return Sf(e)?Ne(zn(Ks(e),t)):zn(Ks(e),t)}function jo(e,t={}){if(e.length===1)return d(e[0],t);if(e.length===0)return j(t);if(e.some((r)=>D(r)))throw Error("Cannot intersect transform types");return Kf(e,t)}function Pe(e,t){if(e.length===1)return d(e[0],t);if(e.length===0)return j(t);if(e.some((r)=>D(r)))throw Error("Cannot intersect transform types");return zn(e,t)}function rt(...e){let[t,r]=typeof e[0]==="string"?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!=="string")throw new v("Ref: $ref must be a string");return d({[y]:"Ref",$ref:t},r)}function Ef(e,t){return te("Awaited",[te(e,t)])}function Lf(e){return te("Awaited",[rt(e)])}function Bf(e){return Pe(Es(e))}function Gf(e){return V(Es(e))}function Df(e){return nn(e)}function Es(e){return e.map((t)=>nn(t))}function nn(e,t){return d(ft(e)?Ef(e.target,e.parameters):ue(e)?Bf(e.allOf):B(e)?Gf(e.anyOf):$r(e)?Df(e.item):pe(e)?Lf(e.$ref):e,t)}function Ls(e){let t=[];for(let r of e)t.push(nt(r));return t}function vf(e){let t=Ls(e);return gs(t)}function qf(e){let t=Ls(e);return xs(t)}function Vf(e){return e.map((t,r)=>r.toString())}function Hf(e){return["[number]"]}function zf(e){return globalThis.Object.getOwnPropertyNames(e)}function Wf(e){if(!_i)return[];return globalThis.Object.getOwnPropertyNames(e).map((r)=>r[0]==="^"&&r[r.length-1]==="$"?r.slice(1,r.length-1):r)}function nt(e){return ue(e)?vf(e.allOf):B(e)?qf(e.anyOf):Ye(e)?Vf(e.items??[]):ut(e)?Hf(e.items):le(e)?zf(e.properties):Fr(e)?Wf(e.patternProperties):[]}var _i=!1;function qt(e){_i=!0;let t=nt(e);return _i=!1,`^(${t.map((n)=>`(${n})`).join("|")})$`}function Jf(e,t){return te("KeyOf",[te(e,t)])}function Yf(e){return te("KeyOf",[rt(e)])}function Qf(e,t){let r=nt(e),n=Xf(r),o=Ct(n);return d(o,t)}function Xf(e){return e.map((t)=>t==="[number]"?Ze():q(t))}function on(e,t){return ft(e)?Jf(e.target,e.parameters):pe(e)?Yf(e.$ref):oe(e)?Bs(e,t):Qf(e,t)}function Zf(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=on(e[n],ne(t));return r}function em(e,t){return Zf(e.properties,t)}function Bs(e,t){let r=em(e,t);return G(r)}function So(e){let t=nt(e),r=Vn(e,t);return t.map((n,o)=>[t[o],r[o]])}function tm(e){let t=[];for(let r of e)t.push(...nt(r));return ys(t)}function rm(e){return e.filter((t)=>!Zt(t))}function nm(e,t){let r=[];for(let n of e)r.push(...Vn(n,[t]));return rm(r)}function om(e,t){let r={};for(let n of t)r[n]=jo(nm(e,n));return r}function Gs(e,t){let r=tm(e),n=om(e,r);return z(n,t)}function Uo(e){return d({[y]:"Date",type:"Date"},e)}function Ko(e){return d({[y]:"Null",type:"null"},e)}function Eo(e){return d({[y]:"Symbol",type:"symbol"},e)}function Lo(e){return d({[y]:"Undefined",type:"undefined"},e)}function Bo(e){return d({[y]:"Uint8Array",type:"Uint8Array"},e)}function sr(e){return d({[y]:"Unknown"},e)}function im(e){return e.map((t)=>Oi(t,!1))}function sm(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=Ge(Oi(e[r],!1));return t}function Go(e,t){return t===!0?e:Ge(e)}function Oi(e,t){return Yi(e)?Go(or(),t):Xi(e)?Go(or(),t):ye(e)?Ge(et(im(e))):Xt(e)?Bo():qr(e)?Uo():re(e)?Go(z(sm(e)),t):Qi(e)?Go(Pt([],sr()),t):Z(e)?Lo():Zi(e)?Ko():es(e)?Eo():co(e)?tn():Ve(e)?q(e):Qt(e)?q(e):X(e)?q(e):z({})}function Ds(e,t){return d(Oi(e,!0),t)}function vs(e,t){return mt(e)?et(e.parameters,t):j(t)}function qs(e,t){if(Z(e))throw Error("Enum undefined or empty");let r=globalThis.Object.getOwnPropertyNames(e).filter((i)=>isNaN(i)).map((i)=>e[i]),o=[...new Set(r)].map((i)=>q(i));return V(o,{...t,[Nt]:"Enum"})}class Js extends v{}var p;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(p||(p={}));function ot(e){return e===p.False?e:p.True}function sn(e){throw new Js(e)}function ge(e){return tr(e)||Tr(e)||Dt(e)||gt(e)||yt(e)}function Ie(e,t){return tr(t)?Xs(e,t):Tr(t)?Do(e,t):Dt(t)?Ti(e,t):gt(t)?ra(e,t):yt(t)?Ri(e,t):sn("StructuralRight")}function Ri(e,t){return p.True}function am(e,t){return Tr(t)?Do(e,t):Dt(t)&&t.anyOf.some((r)=>yt(r)||gt(r))?p.True:Dt(t)?p.Union:gt(t)?p.True:yt(t)?p.True:p.Union}function cm(e,t){return gt(e)?p.False:yt(e)?p.Union:tr(e)?p.True:p.False}function um(e,t){return fe(t)&&vo(t)?p.True:ge(t)?Ie(e,t):!wr(t)?p.False:ot(W(e.items,t.items))}function fm(e,t){return ge(t)?Ie(e,t):!fi(t)?p.False:ot(W(e.items,t.items))}function mm(e,t){return ge(t)?Ie(e,t):fe(t)?Ce(e,t):Te(t)?it(e,t):_o(t)?p.True:p.False}function Ys(e,t){return as(e)?p.True:Rr(e)?p.True:p.False}function dm(e,t){return ge(t)?Ie(e,t):fe(t)?Ce(e,t):Te(t)?it(e,t):Rr(t)?p.True:p.False}function pm(e,t){return ge(t)?Ie(e,t):fe(t)?Ce(e,t):!Oo(t)?p.False:e.parameters.length>t.parameters.length?p.False:!e.parameters.every((r,n)=>ot(W(t.parameters[n],r))===p.True)?p.False:ot(W(e.returns,t.returns))}function lm(e,t){return ge(t)?Ie(e,t):fe(t)?Ce(e,t):Te(t)?it(e,t):$o(t)?p.True:p.False}function ym(e,t){return ge(t)?Ie(e,t):fe(t)?Ce(e,t):!Fo(t)?p.False:e.parameters.length>t.parameters.length?p.False:!e.parameters.every((r,n)=>ot(W(t.parameters[n],r))===p.True)?p.False:ot(W(e.returns,t.returns))}function Qs(e,t){return er(e)&&Ve(e.const)?p.True:Le(e)||Gt(e)?p.True:p.False}function xm(e,t){return Gt(t)||Le(t)?p.True:ge(t)?Ie(e,t):fe(t)?Ce(e,t):Te(t)?it(e,t):p.False}function Do(e,t){return t.allOf.every((r)=>W(e,r)===p.True)?p.True:p.False}function gm(e,t){return e.allOf.some((r)=>W(r,t)===p.True)?p.True:p.False}function Im(e,t){return ge(t)?Ie(e,t):!mi(t)?p.False:ot(W(e.items,t.items))}function hm(e,t){return er(t)&&t.const===e.const?p.True:ge(t)?Ie(e,t):fe(t)?Ce(e,t):Te(t)?it(e,t):xt(t)?ta(e,t):Le(t)?Zs(e,t):Gt(t)?Qs(e,t):Rr(t)?Ys(e,t):p.False}function Xs(e,t){return p.False}function bm(e,t){return p.True}function Vs(e){let[t,r]=[e,0];while(!0){if(!Jr(t))break;t=t.not,r+=1}return r%2===0?t:sr()}function _m(e,t){return Jr(e)?W(Vs(e),t):Jr(t)?W(e,Vs(t)):sn("Invalid fallthrough for Not")}function Om(e,t){return ge(t)?Ie(e,t):fe(t)?Ce(e,t):Te(t)?it(e,t):di(t)?p.True:p.False}function Zs(e,t){return ss(e)?p.True:Le(e)||Gt(e)?p.True:p.False}function $m(e,t){return ge(t)?Ie(e,t):fe(t)?Ce(e,t):Te(t)?it(e,t):Gt(t)||Le(t)?p.True:p.False}function De(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function Hs(e){return vo(e)}function zs(e){return De(e,0)||De(e,1)&&"description"in e.properties&&Dt(e.properties.description)&&e.properties.description.anyOf.length===2&&(xt(e.properties.description.anyOf[0])&&Ar(e.properties.description.anyOf[1])||xt(e.properties.description.anyOf[1])&&Ar(e.properties.description.anyOf[0]))}function $i(e){return De(e,0)}function Ws(e){return De(e,0)}function Fm(e){return De(e,0)}function wm(e){return De(e,0)}function Rm(e){return vo(e)}function Tm(e){let t=Ze();return De(e,0)||De(e,1)&&"length"in e.properties&&ot(W(e.properties.length,t))===p.True}function Am(e){return De(e,0)}function vo(e){let t=Ze();return De(e,0)||De(e,1)&&"length"in e.properties&&ot(W(e.properties.length,t))===p.True}function km(e){let t=Pt([or()],or());return De(e,0)||De(e,1)&&"then"in e.properties&&ot(W(e.properties.then,t))===p.True}function ea(e,t){return W(e,t)===p.False?p.False:bo(e)&&!bo(t)?p.False:p.True}function Ce(e,t){return gt(e)?p.False:yt(e)?p.Union:tr(e)||is(e)&&Hs(t)||ss(e)&&$i(t)||as(e)&&Ws(t)||En(e)&&zs(t)||_o(e)&&Fm(t)||xt(e)&&Hs(t)||En(e)&&zs(t)||Le(e)&&$i(t)||Gt(e)&&$i(t)||Rr(e)&&Ws(t)||Bn(e)&&Rm(t)||$o(e)&&wm(t)||Oo(e)&&Am(t)||Fo(e)&&Tm(t)?p.True:Te(e)&&xt(Fi(e))?(()=>t[Nt]==="Record"?p.True:p.False)():Te(e)&&Le(Fi(e))?(()=>De(t,0)?p.True:p.False)():p.False}function Nm(e,t){return ge(t)?Ie(e,t):Te(t)?it(e,t):!fe(t)?p.False:(()=>{for(let r of Object.getOwnPropertyNames(t.properties)){if(!(r in e.properties)&&!bo(t.properties[r]))return p.False;if(bo(t.properties[r]))return p.True;if(ea(e.properties[r],t.properties[r])===p.False)return p.False}return p.True})()}function Pm(e,t){return ge(t)?Ie(e,t):fe(t)&&km(t)?p.True:!pi(t)?p.False:ot(W(e.item,t.item))}function Fi(e){return rr in e.patternProperties?Ze():(nr in e.patternProperties)?It():sn("Unknown record key pattern")}function wi(e){return rr in e.patternProperties?e.patternProperties[rr]:(nr in e.patternProperties)?e.patternProperties[nr]:sn("Unable to get record value schema")}function it(e,t){let[r,n]=[Fi(t),wi(t)];return is(e)&&Le(r)&&ot(W(e,n))===p.True?p.True:Bn(e)&&Le(r)?W(e,n):xt(e)&&Le(r)?W(e,n):wr(e)&&Le(r)?W(e,n):fe(e)?(()=>{for(let o of Object.getOwnPropertyNames(e.properties))if(ea(n,e.properties[o])===p.False)return p.False;return p.True})():p.False}function Cm(e,t){return ge(t)?Ie(e,t):fe(t)?Ce(e,t):!Te(t)?p.False:W(wi(e),wi(t))}function jm(e,t){let r=Kn(e)?It():e,n=Kn(t)?It():t;return W(r,n)}function ta(e,t){return er(e)&&X(e.const)?p.True:xt(e)?p.True:p.False}function Mm(e,t){return ge(t)?Ie(e,t):fe(t)?Ce(e,t):Te(t)?it(e,t):xt(t)?p.True:p.False}function Sm(e,t){return ge(t)?Ie(e,t):fe(t)?Ce(e,t):Te(t)?it(e,t):En(t)?p.True:p.False}function Um(e,t){return Ln(e)?W(Nr(e),t):Ln(t)?W(e,Nr(t)):sn("Invalid fallthrough for TemplateLiteral")}function Km(e,t){return wr(t)&&e.items!==void 0&&e.items.every((r)=>W(r,t.items)===p.True)}function Em(e,t){return tr(e)?p.True:gt(e)?p.False:yt(e)?p.Union:p.False}function Lm(e,t){return ge(t)?Ie(e,t):fe(t)&&vo(t)?p.True:wr(t)&&Km(e,t)?p.True:!wo(t)?p.False:Z(e.items)&&!Z(t.items)||!Z(e.items)&&Z(t.items)?p.False:Z(e.items)&&!Z(t.items)?p.True:e.items.every((r,n)=>W(r,t.items[n])===p.True)?p.True:p.False}function Bm(e,t){return ge(t)?Ie(e,t):fe(t)?Ce(e,t):Te(t)?it(e,t):Bn(t)?p.True:p.False}function Gm(e,t){return ge(t)?Ie(e,t):fe(t)?Ce(e,t):Te(t)?it(e,t):Ro(t)?qm(e,t):Ar(t)?p.True:p.False}function Ti(e,t){return t.anyOf.some((r)=>W(e,r)===p.True)?p.True:p.False}function Dm(e,t){return e.anyOf.every((r)=>W(r,t)===p.True)?p.True:p.False}function ra(e,t){return p.True}function vm(e,t){return tr(t)?Xs(e,t):Tr(t)?Do(e,t):Dt(t)?Ti(e,t):yt(t)?Ri(e,t):xt(t)?ta(e,t):Le(t)?Zs(e,t):Gt(t)?Qs(e,t):Rr(t)?Ys(e,t):wr(t)?cm(e,t):wo(t)?Em(e,t):fe(t)?Ce(e,t):gt(t)?p.True:p.False}function qm(e,t){return Ar(e)?p.True:Ar(e)?p.True:p.False}function Vm(e,t){return Tr(t)?Do(e,t):Dt(t)?Ti(e,t):gt(t)?ra(e,t):yt(t)?Ri(e,t):fe(t)?Ce(e,t):Ro(t)?p.True:p.False}function W(e,t){return Ln(e)||Ln(t)?Um(e,t):Kn(e)||Kn(t)?jm(e,t):Jr(e)||Jr(t)?_m(e,t):yt(e)?am(e,t):wr(e)?um(e,t):_o(e)?mm(e,t):Rr(e)?dm(e,t):fi(e)?fm(e,t):Oo(e)?pm(e,t):$o(e)?lm(e,t):Fo(e)?ym(e,t):Gt(e)?xm(e,t):Tr(e)?gm(e,t):mi(e)?Im(e,t):er(e)?hm(e,t):tr(e)?bm(e,t):di(e)?Om(e,t):Le(e)?$m(e,t):fe(e)?Nm(e,t):Te(e)?Cm(e,t):xt(e)?Mm(e,t):En(e)?Sm(e,t):wo(e)?Lm(e,t):pi(e)?Pm(e,t):Bn(e)?Bm(e,t):Ar(e)?Gm(e,t):Dt(e)?Dm(e,t):gt(e)?vm(e,t):Ro(e)?Vm(e,t):sn(`Unknown left type operand '${e[y]}'`)}function ar(e,t){return W(e,t)}function Hm(e,t,r,n,o){let i={};for(let s of globalThis.Object.getOwnPropertyNames(e))i[s]=an(e[s],t,r,n,ne(o));return i}function zm(e,t,r,n,o){return Hm(e.properties,t,r,n,o)}function na(e,t,r,n,o){let i=zm(e,t,r,n,o);return G(i)}function Wm(e,t,r,n){let o=ar(e,t);return o===p.Union?V([r,n]):o===p.True?r:n}function an(e,t,r,n,o){return oe(e)?na(e,t,r,n,o):We(e)?d(oa(e,t,r,n,o)):d(Wm(e,t,r,n),o)}function Jm(e,t,r,n,o){return{[e]:an(q(e),t,r,n,ne(o))}}function Ym(e,t,r,n,o){return e.reduce((i,s)=>({...i,...Jm(s,t,r,n,o)}),{})}function Qm(e,t,r,n,o){return Ym(e.keys,t,r,n,o)}function oa(e,t,r,n,o){let i=Qm(e,t,r,n,o);return G(i)}function Xm(e){return e.allOf.every((t)=>Vt(t))}function Zm(e){return e.anyOf.some((t)=>Vt(t))}function ed(e){return!Vt(e.not)}function Vt(e){return e[y]==="Intersect"?Xm(e):e[y]==="Union"?Zm(e):e[y]==="Not"?ed(e):e[y]==="Undefined"?!0:!1}function ia(e,t){return cn(Nr(e),t)}function td(e,t){let r=e.filter((n)=>ar(n,t)===p.False);return r.length===1?r[0]:V(r)}function cn(e,t,r={}){if(Je(e))return d(ia(e,t),r);if(oe(e))return d(sa(e,t),r);return d(B(e)?td(e.anyOf,t):ar(e,t)!==p.False?j():e,r)}function rd(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=cn(e[n],t);return r}function nd(e,t){return rd(e.properties,t)}function sa(e,t){let r=nd(e,t);return G(r)}function aa(e,t){return un(Nr(e),t)}function od(e,t){let r=e.filter((n)=>ar(n,t)!==p.False);return r.length===1?r[0]:V(r)}function un(e,t,r){if(Je(e))return d(aa(e,t),r);if(oe(e))return d(ca(e,t),r);return d(B(e)?od(e.anyOf,t):ar(e,t)!==p.False?e:j(),r)}function id(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=un(e[n],t);return r}function sd(e,t){return id(e.properties,t)}function ca(e,t){let r=sd(e,t);return G(r)}function ua(e,t){return mt(e)?d(e.returns,t):j(t)}function qo(e){return Ge(Ne(e))}function Pr(e,t,r){return d({[y]:"Record",type:"object",patternProperties:{[e]:t}},r)}function Ai(e,t,r){let n={};for(let o of e)n[o]=t;return z(n,{...r,[Nt]:"Record"})}function ad(e,t,r){return Os(e)?Ai(Be(e),t,r):Pr(e.pattern,t,r)}function cd(e,t,r){return Ai(Be(V(e)),t,r)}function ud(e,t,r){return Ai([e.toString()],t,r)}function fd(e,t,r){return Pr(e.source,t,r)}function md(e,t,r){let n=Z(e.pattern)?nr:e.pattern;return Pr(n,t,r)}function dd(e,t,r){return Pr(nr,t,r)}function pd(e,t,r){return Pr(ms,t,r)}function ld(e,t,r){return z({true:t,false:t},r)}function yd(e,t,r){return Pr(rr,t,r)}function xd(e,t,r){return Pr(rr,t,r)}function Vo(e,t,r={}){return B(e)?cd(e.anyOf,t,r):Je(e)?ad(e,t,r):ze(e)?ud(e.const,t,r):Kt(e)?ld(e,t,r):pt(e)?yd(e,t,r):lt(e)?xd(e,t,r):ai(e)?fd(e,t,r):Et(e)?md(e,t,r):ii(e)?dd(e,t,r):Zt(e)?pd(e,t,r):j(r)}function Ho(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function fa(e){let t=Ho(e);return t===nr?It():t===rr?Ze():It({pattern:t})}function zo(e){return e.patternProperties[Ho(e)]}function gd(e,t){return t.parameters=Wn(e,t.parameters),t.returns=ht(e,t.returns),t}function Id(e,t){return t.parameters=Wn(e,t.parameters),t.returns=ht(e,t.returns),t}function hd(e,t){return t.allOf=Wn(e,t.allOf),t}function bd(e,t){return t.anyOf=Wn(e,t.anyOf),t}function _d(e,t){if(Z(t.items))return t;return t.items=Wn(e,t.items),t}function Od(e,t){return t.items=ht(e,t.items),t}function $d(e,t){return t.items=ht(e,t.items),t}function Fd(e,t){return t.items=ht(e,t.items),t}function wd(e,t){return t.item=ht(e,t.item),t}function Rd(e,t){let r=Nd(e,t.properties);return{...t,...z(r)}}function Td(e,t){let r=ht(e,fa(t)),n=ht(e,zo(t)),o=Vo(r,n);return{...t,...o}}function Ad(e,t){return t.index in e?e[t.index]:sr()}function kd(e,t){let r=Wr(t),n=Ee(t),o=ht(e,t);return r&&n?qo(o):r&&!n?Ge(o):!r&&n?Ne(o):o}function Nd(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((r,n)=>({...r,[n]:kd(e,t[n])}),{})}function Wn(e,t){return t.map((r)=>ht(e,r))}function ht(e,t){return mt(t)?gd(e,t):dt(t)?Id(e,t):ue(t)?hd(e,t):B(t)?bd(e,t):Ye(t)?_d(e,t):ut(t)?Od(e,t):br(t)?$d(e,t):Or(t)?Fd(e,t):$r(t)?wd(e,t):le(t)?Rd(e,t):Fr(t)?Td(e,t):si(t)?Ad(e,t):t}function ma(e,t){return ht(t,Vr(e))}function da(e){return d({[y]:"Integer",type:"integer"},e)}function Pd(e,t,r){return{[e]:bt(q(e),t,ne(r))}}function Cd(e,t,r){return e.reduce((o,i)=>({...o,...Pd(i,t,r)}),{})}function jd(e,t,r){return Cd(e.keys,t,r)}function pa(e,t,r){let n=jd(e,t,r);return G(n)}function Md(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),r].join("")}function Sd(e){let[t,r]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),r].join("")}function Ud(e){return e.toUpperCase()}function Kd(e){return e.toLowerCase()}function Ed(e,t,r){let n=en(e.pattern);if(!kr(n))return{...e,pattern:la(e.pattern,t)};let s=[...qn(n)].map((l)=>q(l)),a=ya(s,t),f=V(a);return Co([f],r)}function la(e,t){return typeof e==="string"?t==="Uncapitalize"?Md(e):t==="Capitalize"?Sd(e):t==="Uppercase"?Ud(e):t==="Lowercase"?Kd(e):e:e.toString()}function ya(e,t){return e.map((r)=>bt(r,t))}function bt(e,t,r={}){return We(e)?pa(e,t,r):Je(e)?Ed(e,t,r):B(e)?V(ya(e.anyOf,t),r):ze(e)?q(la(e.const,t),r):d(e,r)}function xa(e,t={}){return bt(e,"Capitalize",t)}function ga(e,t={}){return bt(e,"Lowercase",t)}function Ia(e,t={}){return bt(e,"Uncapitalize",t)}function ha(e,t={}){return bt(e,"Uppercase",t)}function Ld(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=cr(e[o],t,ne(r));return n}function Bd(e,t,r){return Ld(e.properties,t,r)}function ba(e,t,r){let n=Bd(e,t,r);return G(n)}function Gd(e,t){return e.map((r)=>ki(r,t))}function Dd(e,t){return e.map((r)=>ki(r,t))}function vd(e,t){let{[t]:r,...n}=e;return n}function qd(e,t){return t.reduce((r,n)=>vd(r,n),e)}function Vd(e,t,r){let n=me(e,[ie,"$id","required","properties"]),o=qd(r,t);return z(o,n)}function Hd(e){let t=e.reduce((r,n)=>ho(n)?[...r,q(n)]:r,[]);return V(t)}function ki(e,t){return ue(e)?Pe(Gd(e.allOf,t)):B(e)?V(Dd(e.anyOf,t)):le(e)?Vd(e,t,e.properties):z({})}function cr(e,t,r){let n=ye(t)?Hd(t):t,o=se(t)?Be(t):t,i=pe(e),s=pe(t);return oe(e)?ba(e,o,r):We(t)?_a(e,t,r):i&&s?te("Omit",[e,n],r):!i&&s?te("Omit",[e,n],r):i&&!s?te("Omit",[e,n],r):d({...ki(e,o),...r})}function zd(e,t,r){return{[t]:cr(e,[t],ne(r))}}function Wd(e,t,r){return t.reduce((n,o)=>({...n,...zd(e,o,r)}),{})}function Jd(e,t,r){return Wd(e,t.keys,r)}function _a(e,t,r){let n=Jd(e,t,r);return G(n)}function Yd(e,t,r){let n={};for(let o of globalThis.Object.getOwnPropertyNames(e))n[o]=ur(e[o],t,ne(r));return n}function Qd(e,t,r){return Yd(e.properties,t,r)}function Oa(e,t,r){let n=Qd(e,t,r);return G(n)}function Xd(e,t){return e.map((r)=>Ni(r,t))}function Zd(e,t){return e.map((r)=>Ni(r,t))}function ep(e,t){let r={};for(let n of t)if(n in e)r[n]=e[n];return r}function tp(e,t,r){let n=me(e,[ie,"$id","required","properties"]),o=ep(r,t);return z(o,n)}function rp(e){let t=e.reduce((r,n)=>ho(n)?[...r,q(n)]:r,[]);return V(t)}function Ni(e,t){return ue(e)?Pe(Xd(e.allOf,t)):B(e)?V(Zd(e.anyOf,t)):le(e)?tp(e,t,e.properties):z({})}function ur(e,t,r){let n=ye(t)?rp(t):t,o=se(t)?Be(t):t,i=pe(e),s=pe(t);return oe(e)?Oa(e,o,r):We(t)?$a(e,t,r):i&&s?te("Pick",[e,n],r):!i&&s?te("Pick",[e,n],r):i&&!s?te("Pick",[e,n],r):d({...Ni(e,o),...r})}function np(e,t,r){return{[t]:ur(e,[t],ne(r))}}function op(e,t,r){return t.reduce((n,o)=>({...n,...np(e,o,r)}),{})}function ip(e,t,r){return op(e,t.keys,r)}function $a(e,t,r){let n=ip(e,t,r);return G(n)}function sp(e,t){return te("Partial",[te(e,t)])}function ap(e){return te("Partial",[rt(e)])}function cp(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=Ne(e[r]);return t}function up(e,t){let r=me(e,[ie,"$id","required","properties"]),n=cp(t);return z(n,r)}function Fa(e){return e.map((t)=>wa(t))}function wa(e){return ft(e)?sp(e.target,e.parameters):pe(e)?ap(e.$ref):ue(e)?Pe(Fa(e.allOf)):B(e)?V(Fa(e.anyOf)):le(e)?up(e,e.properties):_r(e)?e:Kt(e)?e:pt(e)?e:ze(e)?e:Mn(e)?e:lt(e)?e:Et(e)?e:Sn(e)?e:Lt(e)?e:z({})}function fn(e,t){if(oe(e))return Ra(e,t);else return d({...wa(e),...t})}function fp(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=fn(e[n],ne(t));return r}function mp(e,t){return fp(e.properties,t)}function Ra(e,t){let r=mp(e,t);return G(r)}function dp(e,t){return te("Required",[te(e,t)])}function pp(e){return te("Required",[rt(e)])}function lp(e){let t={};for(let r of globalThis.Object.getOwnPropertyNames(e))t[r]=me(e[r],[Re]);return t}function yp(e,t){let r=me(e,[ie,"$id","required","properties"]),n=lp(t);return z(n,r)}function Ta(e){return e.map((t)=>Aa(t))}function Aa(e){return ft(e)?dp(e.target,e.parameters):pe(e)?pp(e.$ref):ue(e)?Pe(Ta(e.allOf)):B(e)?V(Ta(e.anyOf)):le(e)?yp(e,e.properties):_r(e)?e:Kt(e)?e:pt(e)?e:ze(e)?e:Mn(e)?e:lt(e)?e:Et(e)?e:Sn(e)?e:Lt(e)?e:z({})}function mn(e,t){if(oe(e))return ka(e,t);else return d({...Aa(e),...t})}function xp(e,t){let r={};for(let n of globalThis.Object.getOwnPropertyNames(e))r[n]=mn(e[n],t);return r}function gp(e,t){return xp(e.properties,t)}function ka(e,t){let r=gp(e,t);return G(r)}function Ip(e,t){return t.map((r)=>pe(r)?Pi(e,r.$ref):Qe(e,r))}function Pi(e,t){return t in e?pe(e[t])?Pi(e,e[t].$ref):Qe(e,e[t]):j()}function hp(e){return nn(e[0])}function bp(e){return ir(e[0],e[1])}function _p(e){return on(e[0])}function Op(e){return fn(e[0])}function $p(e){return cr(e[0],e[1])}function Fp(e){return ur(e[0],e[1])}function wp(e){return mn(e[0])}function Rp(e,t,r){let n=Ip(e,r);return t==="Awaited"?hp(n):t==="Index"?bp(n):t==="KeyOf"?_p(n):t==="Partial"?Op(n):t==="Omit"?$p(n):t==="Pick"?Fp(n):t==="Required"?wp(n):j()}function Tp(e,t){return Yr(Qe(e,t))}function Ap(e,t){return Qr(Qe(e,t))}function kp(e,t,r){return Xr(Jn(e,t),Qe(e,r))}function Np(e,t,r){return Pt(Jn(e,t),Qe(e,r))}function Pp(e,t){return Pe(Jn(e,t))}function Cp(e,t){return rn(Qe(e,t))}function jp(e,t){return z(globalThis.Object.keys(t).reduce((r,n)=>({...r,[n]:Qe(e,t[n])}),{}))}function Mp(e,t){let[r,n]=[Qe(e,zo(t)),Ho(t)],o=Vr(t);return o.patternProperties[n]=r,o}function Sp(e,t){return pe(t)?{...Pi(e,t.$ref),[ie]:t[ie]}:t}function Up(e,t){return et(Jn(e,t))}function Kp(e,t){return V(Jn(e,t))}function Jn(e,t){return t.map((r)=>Qe(e,r))}function Qe(e,t){return Ee(t)?d(Qe(e,me(t,[Re])),t):Wr(t)?d(Qe(e,me(t,[kt])),t):D(t)?d(Sp(e,t),t):ut(t)?d(Tp(e,t.items),t):br(t)?d(Ap(e,t.items),t):ft(t)?d(Rp(e,t.target,t.parameters)):mt(t)?d(kp(e,t.parameters,t.returns),t):dt(t)?d(Np(e,t.parameters,t.returns),t):ue(t)?d(Pp(e,t.allOf),t):Or(t)?d(Cp(e,t.items),t):le(t)?d(jp(e,t.properties),t):Fr(t)?d(Mp(e,t)):Ye(t)?d(Up(e,t.items||[]),t):B(t)?d(Kp(e,t.anyOf),t):t}function Ep(e,t){return t in e?Qe(e,e[t]):j()}function Na(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,r)=>({...t,[r]:Ep(e,r)}),{})}class Pa{constructor(e){let t=Na(e),r=this.WithIdentifiers(t);this.$defs=r}Import(e,t){let r={...this.$defs,[e]:d(this.$defs[e],t)};return d({[y]:"Import",$defs:r,$ref:e})}WithIdentifiers(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,r)=>({...t,[r]:{...e[r],$id:r}}),{})}}function Ca(e){return new Pa(e)}function ja(e,t){return d({[y]:"Not",not:e},t)}function Ma(e,t){return dt(e)?et(e.parameters,t):j()}var Lp=0;function Sa(e,t={}){if(Z(t.$id))t.$id=`T${Lp++}`;let r=Vr(e({[y]:"This",$ref:`${t.$id}`}));return r.$id=t.$id,d({[Nt]:"Recursive",...r},t)}function Ua(e,t){let r=X(e)?new globalThis.RegExp(e):e;return d({[y]:"RegExp",type:"RegExp",source:r.source,flags:r.flags},t)}function Bp(e){return ue(e)?e.allOf:B(e)?e.anyOf:Ye(e)?e.items??[]:[]}function Ka(e){return Bp(e)}function Ea(e,t){return dt(e)?d(e.returns,t):j(t)}class La{constructor(e){this.schema=e}Decode(e){return new Ba(this.schema,e)}}class Ba{constructor(e,t){this.schema=e,this.decode=t}EncodeTransform(e,t){let o={Encode:(i)=>t[ie].Encode(e(i)),Decode:(i)=>this.decode(t[ie].Decode(i))};return{...t,[ie]:o}}EncodeSchema(e,t){let r={Decode:this.decode,Encode:e};return{...t,[ie]:r}}Encode(e){return D(this.schema)?this.EncodeTransform(e,this.schema):this.EncodeSchema(e,this.schema)}}function Ga(e){return new La(e)}function Da(e={}){return d({[y]:e[y]??"Unsafe"},e)}function va(e){return d({[y]:"Void",type:"void"},e)}var Gp=Ci;import{join as vp}from"path";import{readFileSync as qp}from"fs";Jo();import{join as Dp}from"path";async function Va(){let e=Dp(process.cwd(),"bare.config.ts");try{let t=await import(e);return Wo(t.default)}catch{return Wo()}}class Ha extends Dr{tree=new vr;pool=[];hotFetch;compiled=!1;poolMask;_useLog=!1;useLog(e=!0){return this._useLog=e,this}constructor(e=1024){super();Va();let t=Math.pow(2,Math.ceil(Math.log2(e)));this.poolMask=t-1;for(let r=0;r<t;r++)this.pool.push(new ao);try{let r=vp(process.cwd(),"package.json"),n=JSON.parse(qp(r,"utf-8"));if(n.name)this.name=n.name.split(/[-_]/).map((o)=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ")}catch{this.name="App"}}notFoundHandler=()=>({status:404,message:"Route not found"});setNotFound(e){this.notFoundHandler=e}compileHandler(e,t){let r=e.length,n={status:200,headers:{"content-type":"application/json"}},o={status:200,headers:{"content-type":"text/plain"}},a=`
29
29
  if (res instanceof Response) {
30
- if (typeof doLog === 'function') doLog(res.status);
30
+ ${t?"doLog(res.status);":""}
31
31
  return res;
32
32
  }
33
33
 
34
34
  const finalStatus = ctx._status || 200;
35
- if (typeof doLog === 'function') doLog(finalStatus);
35
+ ${t?"doLog(finalStatus);":""}
36
36
 
37
37
  if (typeof res === 'string') {
38
- return new Response(res, {
39
- status: finalStatus,
40
- headers: ctx._headers || { "content-type": "text/plain" }
41
- });
38
+ if (finalStatus === 200 && !ctx._headers) return new Response(res, text200);
39
+ return new Response(res, {
40
+ status: finalStatus,
41
+ headers: ctx._headers || text200.headers
42
+ });
42
43
  }
43
44
 
45
+ if (finalStatus === 200 && !ctx._headers) return Response.json(res ?? null, json200);
44
46
  return Response.json(res ?? null, {
45
47
  status: finalStatus,
46
- headers: ctx._headers && ctx._headers["content-type"] ? ctx._headers : { "content-type": "application/json" }
48
+ headers: ctx._headers && ctx._headers["content-type"] ? ctx._headers : json200.headers
47
49
  });
48
- `;if(Q===1){let _=$[0];return Function("fn0","json200",`return function(ctx, doLog) {
50
+ `,f=t?"ctx, doLog":"ctx";if(r===1){let P=e[0];return Function("fn0","json200","text200",`return function(${f}) {
49
51
  const res = fn0(ctx);
50
- if (res && res.then) return res.then(v => { const res = v;
51
- if (res instanceof Response) {
52
- if (typeof doLog === 'function') doLog(res.status);
53
- return res;
54
- }
55
-
56
- const finalStatus = ctx._status || 200;
57
- if (typeof doLog === 'function') doLog(finalStatus);
58
-
59
- if (typeof res === 'string') {
60
- return new Response(res, {
61
- status: finalStatus,
62
- headers: ctx._headers || { "content-type": "text/plain" }
63
- });
64
- }
65
-
66
- return Response.json(res ?? null, {
67
- status: finalStatus,
68
- headers: ctx._headers && ctx._headers["content-type"] ? ctx._headers : { "content-type": "application/json" }
69
- });
70
- });
71
-
72
- if (res instanceof Response) {
73
- if (typeof doLog === 'function') doLog(res.status);
74
- return res;
75
- }
76
-
77
- const finalStatus = ctx._status || 200;
78
- if (typeof doLog === 'function') doLog(finalStatus);
79
-
80
- if (typeof res === 'string') {
81
- return new Response(res, {
82
- status: finalStatus,
83
- headers: ctx._headers || { "content-type": "text/plain" }
84
- });
85
- }
86
-
87
- return Response.json(res ?? null, {
88
- status: finalStatus,
89
- headers: ctx._headers && ctx._headers["content-type"] ? ctx._headers : { "content-type": "application/json" }
90
- });
91
-
92
- }`)(_,X)}let q=$.some((_)=>_.constructor.name==="AsyncFunction"),H="",z=$.map((_,x)=>`fn${x}`);if(q)for(let _=0;_<Q-1;_++)H+=`let r${_} = fn${_}(ctx, noop);
93
- `,H+=`if (r${_}) {
94
- `,H+=` if (r${_}.then) r${_} = await r${_};
95
- `,H+=` if (r${_} instanceof Response) return r${_};
96
- `,H+=`}
97
- `;else for(let _=0;_<Q-1;_++)H+=`const r${_} = fn${_}(ctx, noop);
98
- `,H+=`if (r${_} && r${_} instanceof Response) return r${_};
99
- `;if(q)H+=`
100
- let res = fn${Q-1}(ctx);
101
- if (res && res.then) res = await res;
102
-
103
- if (res instanceof Response) {
104
- if (typeof doLog === 'function') doLog(res.status);
105
- return res;
106
- }
107
-
108
- const finalStatus = ctx._status || 200;
109
- if (typeof doLog === 'function') doLog(finalStatus);
110
-
111
- if (typeof res === 'string') {
112
- return new Response(res, {
113
- status: finalStatus,
114
- headers: ctx._headers || { "content-type": "text/plain" }
115
- });
116
- }
117
-
118
- return Response.json(res ?? null, {
119
- status: finalStatus,
120
- headers: ctx._headers && ctx._headers["content-type"] ? ctx._headers : { "content-type": "application/json" }
121
- });
122
-
123
- `;else H+=`
124
- const res = fn${Q-1}(ctx);
125
- if (res && res.then) return res.then(v => { const res = v;
126
- if (res instanceof Response) {
127
- if (typeof doLog === 'function') doLog(res.status);
128
- return res;
129
- }
130
-
131
- const finalStatus = ctx._status || 200;
132
- if (typeof doLog === 'function') doLog(finalStatus);
133
-
134
- if (typeof res === 'string') {
135
- return new Response(res, {
136
- status: finalStatus,
137
- headers: ctx._headers || { "content-type": "text/plain" }
138
- });
139
- }
140
-
141
- return Response.json(res ?? null, {
142
- status: finalStatus,
143
- headers: ctx._headers && ctx._headers["content-type"] ? ctx._headers : { "content-type": "application/json" }
144
- });
145
- });
146
-
147
- if (res instanceof Response) {
148
- if (typeof doLog === 'function') doLog(res.status);
149
- return res;
150
- }
151
-
152
- const finalStatus = ctx._status || 200;
153
- if (typeof doLog === 'function') doLog(finalStatus);
154
-
155
- if (typeof res === 'string') {
156
- return new Response(res, {
157
- status: finalStatus,
158
- headers: ctx._headers || { "content-type": "text/plain" }
159
- });
160
- }
161
-
162
- return Response.json(res ?? null, {
163
- status: finalStatus,
164
- headers: ctx._headers && ctx._headers["content-type"] ? ctx._headers : { "content-type": "application/json" }
165
- });
166
-
167
- `;let w=()=>{},N=$.some((_)=>_.constructor.name==="AsyncFunction")?"return async function(ctx, doLog)":"return function(ctx, doLog)";return Function(...z,"noop","json200",`${N} { ${H} }`)(...$,w,X)}compile(){let $=this._useLog;this.tree=new kW;for(let L$ of this.routes)this.tree.insert(L$.path,L$.method,this.compileHandler(L$.handlers));let W=this.tree,Q=this.pool,X=this.poolMask,Y=0,q=this.notFoundHandler,H=(L$)=>({status:500,message:L$.message||"Internal Server Error",stack:L$.stack}),z=[],w=(L$)=>{let S8=`h${z.length}`;return z.push(L$),S8},N=W.jitCompile(w),_=Object.freeze({}),B$=["pool","pIdx","mask","hNotFound","hError","EMPTY_PARAMS",...z.map((L$,S8)=>`h${S8}`)],r$=[Q,Y,X,q,H,_,...z],c$=`
52
+ if (res && res.then) return res.then(v => { const res = v; ${a} });
53
+ ${a}
54
+ }`)(P,n,o)}let l=e.some((P)=>P.constructor.name==="AsyncFunction"),g="",R=e.map((P,qe)=>`fn${qe}`);if(l){for(let P=0;P<r-1;P++)g+=`let r${P} = fn${P}(ctx, noop);
55
+ `,g+=`if (r${P}) {
56
+ `,g+=` if (r${P}.then) r${P} = await r${P};
57
+ `,g+=` if (r${P} instanceof Response) { ${t?"doLog(r"+P+".status);":""} return r${P}; }
58
+ `,g+=`}
59
+ `;g+=`
60
+ let res = fn${r-1}(ctx);
61
+ if (res && res.then) res = await res;
62
+ ${a}
63
+ `}else{for(let P=0;P<r-1;P++)g+=`const r${P} = fn${P}(ctx, noop);
64
+ `,g+=`if (r${P} && r${P} instanceof Response) { ${t?"doLog(r"+P+".status);":""} return r${P}; }
65
+ `;g+=`
66
+ const res = fn${r-1}(ctx);
67
+ if (res && res.then) return res.then(v => { const res = v; ${a} });
68
+ ${a}
69
+ `}let J=()=>{},be=l?`return async function(${f})`:`return function(${f})`;return Function(...R,"noop","json200","text200",`${be} { ${g} }`)(...e,J,n,o)}compile(){let e=this._useLog;this.tree=new vr;for(let st of this.routes)this.tree.insert(st.path,st.method,this.compileHandler(st.handlers,e));let t=this.tree,r=this.pool,n=r.length,o=this.notFoundHandler,i=(st)=>({status:500,message:st?.message||"Internal Server Error",stack:st?.stack}),s=[],a=(st)=>{let Cn=`h${s.length}`;return s.push(st),Cn},f=t.jitCompile(a),l=Object.freeze({}),g=s.map((st,Cn)=>`h${Cn}`),R=`
70
+ if (ctx.store.size > 0) ctx.store.clear();
71
+ ctx.req = undefined;
72
+ ctx.body = undefined;
73
+ ctx._headers = undefined;
74
+ ctx.params = EMPTY_PARAMS;
75
+ if (poolTop < maxPool) pool[poolTop++] = ctx;
76
+ `,J=e?"(ctx, doLog)":"(ctx)",be=f.replace(/return (h\d+)\(ctx\);/g,`const out = $1${J};
77
+ if (out && out.then) return out.then((v) => { ${R} return v; }, (e) => { ${R} ${e?"doLog(500);":""} return Response.json(hError(e), { status: 500 }); });
78
+ ${R}
79
+ return out;`),P=["pool","maxPool","Context","hNotFound","hError","EMPTY_PARAMS",...g],qe=[r,n,ao,o,i,l,...s],Pn=`
80
+ let poolTop = maxPool;
168
81
  return function(req) {
169
- const start = performance.now();
170
- const url = req.url + " ";
171
- const urlLen = req.url.length; // \u2705 \u0E04\u0E27\u0E32\u0E21\u0E22\u0E32\u0E27\u0E08\u0E23\u0E34\u0E07\u0E02\u0E2D\u0E07 URL
172
-
82
+ const url = req.url;
173
83
  let s = url.indexOf('/', 8);
174
- if (s !== -1) s++;
175
- else s = urlLen; // \u2705 \u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E08\u0E32\u0E01 url.length \u0E40\u0E1B\u0E47\u0E19 urlLen
84
+ const q = s === -1 ? -1 : url.indexOf('?', s);
85
+ const urlLen = q === -1 ? url.length : q;
86
+ if (s !== -1) s++;
87
+ else s = urlLen;
176
88
 
177
89
  const method = req.method;
178
- const ctx = pool[(++pIdx) & mask];
179
-
180
- const doLog = (status) => {
181
- if (!${$}) return;
182
- const duration = (performance.now() - start).toFixed(3);
183
- console.log(
184
- \` \\x1b[90m\${new Date().toLocaleTimeString()}\\x1b[0m \` +
185
- \`\\x1b[1m\\x1b[38;5;117m\${method.padEnd(7)}\\x1b[0m \` +
186
- \`\\x1b[38;5;250m\${req.url.substring(req.url.indexOf('/', 8))}\\x1b[0m \` +
187
- \`\${status >= 400 ? '\\x1b[33m' : '\\x1b[32m'}\${status}\\x1b[0m \` +
188
- \`\\x1b[90m(\${duration}ms)\\x1b[0m\`
189
- );
190
- };
90
+ const ctx = poolTop > 0 ? pool[--poolTop] : new Context();
91
+ ${e?"\n const start = performance.now();\n const doLog = (status) => {\n const duration = (performance.now() - start).toFixed(3);\n console.log(\n ` \\x1b[90m${new Date().toLocaleTimeString()}\\x1b[0m ` +\n `\\x1b[1m\\x1b[38;5;117m${method.padEnd(7)}\\x1b[0m ` +\n `\\x1b[38;5;250m${url.substring(url.indexOf('/', 8))}\\x1b[0m ` +\n `${status >= 400 ? '\\x1b[33m' : '\\x1b[32m'}${status}\\x1b[0m ` +\n `\\x1b[90m(${duration}ms)\\x1b[0m`\n );\n };":""}
191
92
 
192
93
  try {
193
94
  ctx.req = req;
@@ -197,20 +98,21 @@ var{defineProperty:IQ,getOwnPropertyNames:s4,getOwnPropertyDescriptor:t4}=Object
197
98
  ctx.params = EMPTY_PARAMS;
198
99
  ctx.body = undefined;
199
100
 
200
- // \u26A1\uFE0F \u0E23\u0E31\u0E19 JIT Code (\u0E15\u0E49\u0E2D\u0E07 replace url.length \u0E40\u0E1B\u0E47\u0E19 urlLen)
201
- ${N.replace(/h(\d+)\(ctx\)/g,"h$1(ctx, doLog)").replace(/url\.length/g,"urlLen")}
101
+ ${be}
202
102
 
203
103
  const errorBody = hNotFound();
204
104
  const status = errorBody.status || 404;
205
- doLog(status);
105
+ ${e?"doLog(status);":""}
106
+ ${R}
206
107
  return Response.json(errorBody, { status });
207
108
 
208
109
  } catch (e) {
209
- doLog(500);
110
+ ${e?"doLog(500);":""}
111
+ ${R}
210
112
  return Response.json(hError(e), { status: 500 });
211
113
  }
212
114
  }
213
- `;this.hotFetch=Function(...B$,c$)(...r$),this.compiled=!0,this.fetch=this.hotFetch}fetch=($)=>{if(!this.compiled)return this.compile(),this.hotFetch($);return this.hotFetch($)};name="App";listen($,W="0.0.0.0",Q=!0){if(!this.compiled)this.compile();let{BARE_CONFIG:X}=(RQ(),a4(i6)),Y=$||X.port||3000;if(!0)console.log(`
115
+ `;this.hotFetch=Function(...P,Pn)(...qe),this.compiled=!0,this.fetch=this.hotFetch}fetch=(e)=>{if(!this.compiled)return this.compile(),this.hotFetch(e);return this.hotFetch(e)};name="App";listen(e,t="0.0.0.0",r=!0){if(!this.compiled)this.compile();let{BARE_CONFIG:n}=(Jo(),Xc(qa)),o=e||n.port||3000;if(!0)console.log(`
214
116
  \x1B[33m ____ _ _____ \x1B[0m
215
117
  \x1B[33m | __ ) __ _ _ __ ___ | | ____|\x1B[0m
216
118
  \x1B[33m | _ \\ / _\` | '__/ _ \\ _ | | _| \x1B[0m
@@ -218,14 +120,14 @@ var{defineProperty:IQ,getOwnPropertyNames:s4,getOwnPropertyDescriptor:t4}=Object
218
120
  \x1B[33m |____/ \\__,_|_| \\___| \\___/|_____|\x1B[0m
219
121
 
220
122
  \x1B[32m\uD83D\uDE80 ${this.name} is running in development mode\x1B[0m
221
- \x1B[90m\u2699\uFE0F Pool Size: ${this.pool.length} | JIT: Enabled | Port: ${Y}\x1B[0m
222
- \x1B[36m\uD83D\uDEE1\uFE0F Hash: ${X.hash.algorithm} (${X.hash.memoryCost/1024}MB) | Iterations: ${X.hash.timeCost}\x1B[0m
223
- `);let H=Bun.serve({port:Y,hostname:W,fetch:this.fetch,reusePort:Q}),z=()=>{let N=this.name,_=process.stdout.isTTY;{let x=_?"\uD83D\uDED1":"!",B$=_?"\u2705":"v";process.stdout.write(`
224
- \x1B[31m${x} Stopping ${N}...\x1B[0m
225
- `),H.stop(),process.stdout.write(`\x1B[32m${B$} ${N} has been stopped.\x1B[0m
226
- `)}process.exit(0)};process.on("SIGINT",z),process.on("SIGTERM",z)}}function tH($){switch($.errorType){case G.ArrayContains:return"Expected array to contain at least one matching value";case G.ArrayMaxContains:return`Expected array to contain no more than ${$.schema.maxContains} matching values`;case G.ArrayMinContains:return`Expected array to contain at least ${$.schema.minContains} matching values`;case G.ArrayMaxItems:return`Expected array length to be less or equal to ${$.schema.maxItems}`;case G.ArrayMinItems:return`Expected array length to be greater or equal to ${$.schema.minItems}`;case G.ArrayUniqueItems:return"Expected array elements to be unique";case G.Array:return"Expected array";case G.AsyncIterator:return"Expected AsyncIterator";case G.BigIntExclusiveMaximum:return`Expected bigint to be less than ${$.schema.exclusiveMaximum}`;case G.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${$.schema.exclusiveMinimum}`;case G.BigIntMaximum:return`Expected bigint to be less or equal to ${$.schema.maximum}`;case G.BigIntMinimum:return`Expected bigint to be greater or equal to ${$.schema.minimum}`;case G.BigIntMultipleOf:return`Expected bigint to be a multiple of ${$.schema.multipleOf}`;case G.BigInt:return"Expected bigint";case G.Boolean:return"Expected boolean";case G.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${$.schema.exclusiveMinimumTimestamp}`;case G.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${$.schema.exclusiveMaximumTimestamp}`;case G.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${$.schema.minimumTimestamp}`;case G.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${$.schema.maximumTimestamp}`;case G.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${$.schema.multipleOfTimestamp}`;case G.Date:return"Expected Date";case G.Function:return"Expected function";case G.IntegerExclusiveMaximum:return`Expected integer to be less than ${$.schema.exclusiveMaximum}`;case G.IntegerExclusiveMinimum:return`Expected integer to be greater than ${$.schema.exclusiveMinimum}`;case G.IntegerMaximum:return`Expected integer to be less or equal to ${$.schema.maximum}`;case G.IntegerMinimum:return`Expected integer to be greater or equal to ${$.schema.minimum}`;case G.IntegerMultipleOf:return`Expected integer to be a multiple of ${$.schema.multipleOf}`;case G.Integer:return"Expected integer";case G.IntersectUnevaluatedProperties:return"Unexpected property";case G.Intersect:return"Expected all values to match";case G.Iterator:return"Expected Iterator";case G.Literal:return`Expected ${typeof $.schema.const==="string"?`'${$.schema.const}'`:$.schema.const}`;case G.Never:return"Never";case G.Not:return"Value should not match";case G.Null:return"Expected null";case G.NumberExclusiveMaximum:return`Expected number to be less than ${$.schema.exclusiveMaximum}`;case G.NumberExclusiveMinimum:return`Expected number to be greater than ${$.schema.exclusiveMinimum}`;case G.NumberMaximum:return`Expected number to be less or equal to ${$.schema.maximum}`;case G.NumberMinimum:return`Expected number to be greater or equal to ${$.schema.minimum}`;case G.NumberMultipleOf:return`Expected number to be a multiple of ${$.schema.multipleOf}`;case G.Number:return"Expected number";case G.Object:return"Expected object";case G.ObjectAdditionalProperties:return"Unexpected property";case G.ObjectMaxProperties:return`Expected object to have no more than ${$.schema.maxProperties} properties`;case G.ObjectMinProperties:return`Expected object to have at least ${$.schema.minProperties} properties`;case G.ObjectRequiredProperty:return"Expected required property";case G.Promise:return"Expected Promise";case G.RegExp:return"Expected string to match regular expression";case G.StringFormatUnknown:return`Unknown format '${$.schema.format}'`;case G.StringFormat:return`Expected string to match '${$.schema.format}' format`;case G.StringMaxLength:return`Expected string length less or equal to ${$.schema.maxLength}`;case G.StringMinLength:return`Expected string length greater or equal to ${$.schema.minLength}`;case G.StringPattern:return`Expected string to match '${$.schema.pattern}'`;case G.String:return"Expected string";case G.Symbol:return"Expected symbol";case G.TupleLength:return`Expected tuple to have ${$.schema.maxItems||0} elements`;case G.Tuple:return"Expected tuple";case G.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${$.schema.maxByteLength}`;case G.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${$.schema.minByteLength}`;case G.Uint8Array:return"Expected Uint8Array";case G.Undefined:return"Expected undefined";case G.Union:return"Expected union value";case G.Void:return"Expected void";case G.Kind:return`Expected kind '${$.schema[D]}'`;default:return"Unknown error type"}}var rH=tH;function l6(){return rH}class s6 extends y{constructor($){super(`Unable to dereference schema with $id '${$.$ref}'`);this.schema=$}}function aH($,W){let Q=W.find((X)=>X.$id===$.$ref);if(Q===void 0)throw new s6($);return O$(Q,W)}function QW($,W){if(!S$($.$id)||W.some((Q)=>Q.$id===$.$id))return W;return W.push($),W}function O$($,W){return $[D]==="This"||$[D]==="Ref"?aH($,W):$}class t6 extends y{constructor($){super("Unable to hash value");this.value=$}}var t$;(function($){$[$.Undefined=0]="Undefined",$[$.Null=1]="Null",$[$.Boolean=2]="Boolean",$[$.Number=3]="Number",$[$.String=4]="String",$[$.Object=5]="Object",$[$.Array=6]="Array",$[$.Date=7]="Date",$[$.Uint8Array=8]="Uint8Array",$[$.Symbol=9]="Symbol",$[$.BigInt=10]="BigInt"})(t$||(t$={}));var $8=BigInt("14695981039346656037"),[eH,$5]=[BigInt("1099511628211"),BigInt("18446744073709551616")],W5=Array.from({length:256}).map(($,W)=>BigInt(W)),r6=new Float64Array(1),a6=new DataView(r6.buffer),e6=new Uint8Array(r6.buffer);function*Q5($){let W=$===0?1:Math.ceil(Math.floor(Math.log2($)+1)/8);for(let Q=0;Q<W;Q++)yield $>>8*(W-1-Q)&255}function X5($){k$(t$.Array);for(let W of $)W8(W)}function Y5($){k$(t$.Boolean),k$($?1:0)}function q5($){k$(t$.BigInt),a6.setBigInt64(0,$);for(let W of e6)k$(W)}function H5($){k$(t$.Date),W8($.getTime())}function z5($){k$(t$.Null)}function J5($){k$(t$.Number),a6.setFloat64(0,$);for(let W of e6)k$(W)}function M5($){k$(t$.Object);for(let W of globalThis.Object.getOwnPropertyNames($).sort())W8(W),W8($[W])}function B5($){k$(t$.String);for(let W=0;W<$.length;W++)for(let Q of Q5($.charCodeAt(W)))k$(Q)}function w5($){k$(t$.Symbol),W8($.description)}function G5($){k$(t$.Uint8Array);for(let W=0;W<$.length;W++)k$($[W])}function U5($){return k$(t$.Undefined)}function W8($){if(A$($))return X5($);if(wW($))return Y5($);if(o$($))return q5($);if(xW($))return H5($);if(BW($))return z5($);if(Z($))return J5($);if(f$($))return M5($);if(S$($))return B5($);if(GW($))return w5($);if(gW($))return G5($);if(x$($))return U5($);throw new t6($)}function k$($){$8=$8^W5[$],$8=$8*eH%$5}function Q8($){return $8=BigInt("14695981039346656037"),W8($),$8}class $4 extends y{constructor($){super("Unknown type");this.schema=$}}function A5($){return $[D]==="Any"||$[D]==="Unknown"}function f($){return $!==void 0}function D5($,W,Q){return!0}function _5($,W,Q){return!0}function N5($,W,Q){if(!A$(Q))return!1;if(f($.minItems)&&!(Q.length>=$.minItems))return!1;if(f($.maxItems)&&!(Q.length<=$.maxItems))return!1;if(!Q.every((q)=>b$($.items,W,q)))return!1;if($.uniqueItems===!0&&!function(){let q=new Set;for(let H of Q){let z=Q8(H);if(q.has(z))return!1;else q.add(z)}return!0}())return!1;if(!(f($.contains)||Z($.minContains)||Z($.maxContains)))return!0;let X=f($.contains)?$.contains:k(),Y=Q.reduce((q,H)=>b$(X,W,H)?q+1:q,0);if(Y===0)return!1;if(Z($.minContains)&&Y<$.minContains)return!1;if(Z($.maxContains)&&Y>$.maxContains)return!1;return!0}function L5($,W,Q){return u8(Q)}function S5($,W,Q){if(!o$(Q))return!1;if(f($.exclusiveMaximum)&&!(Q<$.exclusiveMaximum))return!1;if(f($.exclusiveMinimum)&&!(Q>$.exclusiveMinimum))return!1;if(f($.maximum)&&!(Q<=$.maximum))return!1;if(f($.minimum)&&!(Q>=$.minimum))return!1;if(f($.multipleOf)&&Q%$.multipleOf!==BigInt(0))return!1;return!0}function O5($,W,Q){return wW(Q)}function b5($,W,Q){return b$($.returns,W,Q.prototype)}function j5($,W,Q){if(!xW(Q))return!1;if(f($.exclusiveMaximumTimestamp)&&!(Q.getTime()<$.exclusiveMaximumTimestamp))return!1;if(f($.exclusiveMinimumTimestamp)&&!(Q.getTime()>$.exclusiveMinimumTimestamp))return!1;if(f($.maximumTimestamp)&&!(Q.getTime()<=$.maximumTimestamp))return!1;if(f($.minimumTimestamp)&&!(Q.getTime()>=$.minimumTimestamp))return!1;if(f($.multipleOfTimestamp)&&Q.getTime()%$.multipleOfTimestamp!==0)return!1;return!0}function R5($,W,Q){return a8(Q)}function F5($,W,Q){let X=globalThis.Object.values($.$defs),Y=$.$defs[$.$ref];return b$(Y,[...W,...X],Q)}function C5($,W,Q){if(!r8(Q))return!1;if(f($.exclusiveMaximum)&&!(Q<$.exclusiveMaximum))return!1;if(f($.exclusiveMinimum)&&!(Q>$.exclusiveMinimum))return!1;if(f($.maximum)&&!(Q<=$.maximum))return!1;if(f($.minimum)&&!(Q>=$.minimum))return!1;if(f($.multipleOf)&&Q%$.multipleOf!==0)return!1;return!0}function K5($,W,Q){let X=$.allOf.every((Y)=>b$(Y,W,Q));if($.unevaluatedProperties===!1){let Y=new RegExp(y2($)),q=Object.getOwnPropertyNames(Q).every((H)=>Y.test(H));return X&&q}else if(Y$($.unevaluatedProperties)){let Y=new RegExp(y2($)),q=Object.getOwnPropertyNames(Q).every((H)=>Y.test(H)||b$($.unevaluatedProperties,W,Q[H]));return X&&q}else return X}function V5($,W,Q){return l8(Q)}function P5($,W,Q){return Q===$.const}function Z5($,W,Q){return!1}function E5($,W,Q){return!b$($.not,W,Q)}function k5($,W,Q){return BW(Q)}function I5($,W,Q){if(!a.IsNumberLike(Q))return!1;if(f($.exclusiveMaximum)&&!(Q<$.exclusiveMaximum))return!1;if(f($.exclusiveMinimum)&&!(Q>$.exclusiveMinimum))return!1;if(f($.minimum)&&!(Q>=$.minimum))return!1;if(f($.maximum)&&!(Q<=$.maximum))return!1;if(f($.multipleOf)&&Q%$.multipleOf!==0)return!1;return!0}function x5($,W,Q){if(!a.IsObjectLike(Q))return!1;if(f($.minProperties)&&!(Object.getOwnPropertyNames(Q).length>=$.minProperties))return!1;if(f($.maxProperties)&&!(Object.getOwnPropertyNames(Q).length<=$.maxProperties))return!1;let X=Object.getOwnPropertyNames($.properties);for(let Y of X){let q=$.properties[Y];if($.required&&$.required.includes(Y)){if(!b$(q,W,Q[Y]))return!1;if((m2(q)||A5(q))&&!(Y in Q))return!1}else if(a.IsExactOptionalProperty(Q,Y)&&!b$(q,W,Q[Y]))return!1}if($.additionalProperties===!1){let Y=Object.getOwnPropertyNames(Q);if($.required&&$.required.length===X.length&&Y.length===X.length)return!0;else return Y.every((q)=>X.includes(q))}else if(typeof $.additionalProperties==="object")return Object.getOwnPropertyNames(Q).every((q)=>X.includes(q)||b$($.additionalProperties,W,Q[q]));else return!0}function g5($,W,Q){return s8(Q)}function f5($,W,Q){if(!a.IsRecordLike(Q))return!1;if(f($.minProperties)&&!(Object.getOwnPropertyNames(Q).length>=$.minProperties))return!1;if(f($.maxProperties)&&!(Object.getOwnPropertyNames(Q).length<=$.maxProperties))return!1;let[X,Y]=Object.entries($.patternProperties)[0],q=new RegExp(X),H=Object.entries(Q).every(([N,_])=>{return q.test(N)?b$(Y,W,_):!0}),z=typeof $.additionalProperties==="object"?Object.entries(Q).every(([N,_])=>{return!q.test(N)?b$($.additionalProperties,W,_):!0}):!0,w=$.additionalProperties===!1?Object.getOwnPropertyNames(Q).every((N)=>{return q.test(N)}):!0;return H&&z&&w}function T5($,W,Q){return b$(O$($,W),W,Q)}function v5($,W,Q){let X=new RegExp($.source,$.flags);if(f($.minLength)){if(!(Q.length>=$.minLength))return!1}if(f($.maxLength)){if(!(Q.length<=$.maxLength))return!1}return X.test(Q)}function d5($,W,Q){if(!S$(Q))return!1;if(f($.minLength)){if(!(Q.length>=$.minLength))return!1}if(f($.maxLength)){if(!(Q.length<=$.maxLength))return!1}if(f($.pattern)){if(!new RegExp($.pattern).test(Q))return!1}if(f($.format)){if(!e$.Has($.format))return!1;return e$.Get($.format)(Q)}return!0}function h5($,W,Q){return GW(Q)}function y5($,W,Q){return S$(Q)&&new RegExp($.pattern).test(Q)}function m5($,W,Q){return b$(O$($,W),W,Q)}function c5($,W,Q){if(!A$(Q))return!1;if($.items===void 0&&Q.length!==0)return!1;if(Q.length!==$.maxItems)return!1;if(!$.items)return!0;for(let X=0;X<$.items.length;X++)if(!b$($.items[X],W,Q[X]))return!1;return!0}function n5($,W,Q){return x$(Q)}function o5($,W,Q){return $.anyOf.some((X)=>b$(X,W,Q))}function i5($,W,Q){if(!gW(Q))return!1;if(f($.maxByteLength)&&!(Q.length<=$.maxByteLength))return!1;if(f($.minByteLength)&&!(Q.length>=$.minByteLength))return!1;return!0}function p5($,W,Q){return!0}function u5($,W,Q){return a.IsVoidLike(Q)}function l5($,W,Q){if(!v$.Has($[D]))return!1;return v$.Get($[D])($,Q)}function b$($,W,Q){let X=f($.$id)?QW($,W):W,Y=$;switch(Y[D]){case"Any":return D5(Y,X,Q);case"Argument":return _5(Y,X,Q);case"Array":return N5(Y,X,Q);case"AsyncIterator":return L5(Y,X,Q);case"BigInt":return S5(Y,X,Q);case"Boolean":return O5(Y,X,Q);case"Constructor":return b5(Y,X,Q);case"Date":return j5(Y,X,Q);case"Function":return R5(Y,X,Q);case"Import":return F5(Y,X,Q);case"Integer":return C5(Y,X,Q);case"Intersect":return K5(Y,X,Q);case"Iterator":return V5(Y,X,Q);case"Literal":return P5(Y,X,Q);case"Never":return Z5(Y,X,Q);case"Not":return E5(Y,X,Q);case"Null":return k5(Y,X,Q);case"Number":return I5(Y,X,Q);case"Object":return x5(Y,X,Q);case"Promise":return g5(Y,X,Q);case"Record":return f5(Y,X,Q);case"Ref":return T5(Y,X,Q);case"RegExp":return v5(Y,X,Q);case"String":return d5(Y,X,Q);case"Symbol":return h5(Y,X,Q);case"TemplateLiteral":return y5(Y,X,Q);case"This":return m5(Y,X,Q);case"Tuple":return c5(Y,X,Q);case"Undefined":return n5(Y,X,Q);case"Union":return o5(Y,X,Q);case"Uint8Array":return i5(Y,X,Q);case"Unknown":return p5(Y,X,Q);case"Void":return u5(Y,X,Q);default:if(!v$.Has(Y[D]))throw new $4(Y);return l5(Y,X,Q)}}function bW(...$){return $.length===3?b$($[0],$[1],$[2]):b$($[0],[],$[1])}var G;(function($){$[$.ArrayContains=0]="ArrayContains",$[$.ArrayMaxContains=1]="ArrayMaxContains",$[$.ArrayMaxItems=2]="ArrayMaxItems",$[$.ArrayMinContains=3]="ArrayMinContains",$[$.ArrayMinItems=4]="ArrayMinItems",$[$.ArrayUniqueItems=5]="ArrayUniqueItems",$[$.Array=6]="Array",$[$.AsyncIterator=7]="AsyncIterator",$[$.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",$[$.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",$[$.BigIntMaximum=10]="BigIntMaximum",$[$.BigIntMinimum=11]="BigIntMinimum",$[$.BigIntMultipleOf=12]="BigIntMultipleOf",$[$.BigInt=13]="BigInt",$[$.Boolean=14]="Boolean",$[$.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",$[$.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",$[$.DateMaximumTimestamp=17]="DateMaximumTimestamp",$[$.DateMinimumTimestamp=18]="DateMinimumTimestamp",$[$.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",$[$.Date=20]="Date",$[$.Function=21]="Function",$[$.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",$[$.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",$[$.IntegerMaximum=24]="IntegerMaximum",$[$.IntegerMinimum=25]="IntegerMinimum",$[$.IntegerMultipleOf=26]="IntegerMultipleOf",$[$.Integer=27]="Integer",$[$.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",$[$.Intersect=29]="Intersect",$[$.Iterator=30]="Iterator",$[$.Kind=31]="Kind",$[$.Literal=32]="Literal",$[$.Never=33]="Never",$[$.Not=34]="Not",$[$.Null=35]="Null",$[$.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",$[$.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",$[$.NumberMaximum=38]="NumberMaximum",$[$.NumberMinimum=39]="NumberMinimum",$[$.NumberMultipleOf=40]="NumberMultipleOf",$[$.Number=41]="Number",$[$.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",$[$.ObjectMaxProperties=43]="ObjectMaxProperties",$[$.ObjectMinProperties=44]="ObjectMinProperties",$[$.ObjectRequiredProperty=45]="ObjectRequiredProperty",$[$.Object=46]="Object",$[$.Promise=47]="Promise",$[$.RegExp=48]="RegExp",$[$.StringFormatUnknown=49]="StringFormatUnknown",$[$.StringFormat=50]="StringFormat",$[$.StringMaxLength=51]="StringMaxLength",$[$.StringMinLength=52]="StringMinLength",$[$.StringPattern=53]="StringPattern",$[$.String=54]="String",$[$.Symbol=55]="Symbol",$[$.TupleLength=56]="TupleLength",$[$.Tuple=57]="Tuple",$[$.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",$[$.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",$[$.Uint8Array=60]="Uint8Array",$[$.Undefined=61]="Undefined",$[$.Union=62]="Union",$[$.Void=63]="Void"})(G||(G={}));class W4 extends y{constructor($){super("Unknown type");this.schema=$}}function c2($){return $.replace(/~/g,"~0").replace(/\//g,"~1")}function T($){return $!==void 0}class zX{constructor($){this.iterator=$}[Symbol.iterator](){return this.iterator}First(){let $=this.iterator.next();return $.done?void 0:$.value}}function b($,W,Q,X,Y=[]){return{type:$,schema:W,path:Q,value:X,message:l6()({errorType:$,path:Q,schema:W,value:X,errors:Y}),errors:Y}}function*s5($,W,Q,X){}function*t5($,W,Q,X){}function*r5($,W,Q,X){if(!A$(X))return yield b(G.Array,$,Q,X);if(T($.minItems)&&!(X.length>=$.minItems))yield b(G.ArrayMinItems,$,Q,X);if(T($.maxItems)&&!(X.length<=$.maxItems))yield b(G.ArrayMaxItems,$,Q,X);for(let H=0;H<X.length;H++)yield*j$($.items,W,`${Q}/${H}`,X[H]);if($.uniqueItems===!0&&!function(){let H=new Set;for(let z of X){let w=Q8(z);if(H.has(w))return!1;else H.add(w)}return!0}())yield b(G.ArrayUniqueItems,$,Q,X);if(!(T($.contains)||T($.minContains)||T($.maxContains)))return;let Y=T($.contains)?$.contains:k(),q=X.reduce((H,z,w)=>j$(Y,W,`${Q}${w}`,z).next().done===!0?H+1:H,0);if(q===0)yield b(G.ArrayContains,$,Q,X);if(Z($.minContains)&&q<$.minContains)yield b(G.ArrayMinContains,$,Q,X);if(Z($.maxContains)&&q>$.maxContains)yield b(G.ArrayMaxContains,$,Q,X)}function*a5($,W,Q,X){if(!u8(X))yield b(G.AsyncIterator,$,Q,X)}function*e5($,W,Q,X){if(!o$(X))return yield b(G.BigInt,$,Q,X);if(T($.exclusiveMaximum)&&!(X<$.exclusiveMaximum))yield b(G.BigIntExclusiveMaximum,$,Q,X);if(T($.exclusiveMinimum)&&!(X>$.exclusiveMinimum))yield b(G.BigIntExclusiveMinimum,$,Q,X);if(T($.maximum)&&!(X<=$.maximum))yield b(G.BigIntMaximum,$,Q,X);if(T($.minimum)&&!(X>=$.minimum))yield b(G.BigIntMinimum,$,Q,X);if(T($.multipleOf)&&X%$.multipleOf!==BigInt(0))yield b(G.BigIntMultipleOf,$,Q,X)}function*$7($,W,Q,X){if(!wW(X))yield b(G.Boolean,$,Q,X)}function*W7($,W,Q,X){yield*j$($.returns,W,Q,X.prototype)}function*Q7($,W,Q,X){if(!xW(X))return yield b(G.Date,$,Q,X);if(T($.exclusiveMaximumTimestamp)&&!(X.getTime()<$.exclusiveMaximumTimestamp))yield b(G.DateExclusiveMaximumTimestamp,$,Q,X);if(T($.exclusiveMinimumTimestamp)&&!(X.getTime()>$.exclusiveMinimumTimestamp))yield b(G.DateExclusiveMinimumTimestamp,$,Q,X);if(T($.maximumTimestamp)&&!(X.getTime()<=$.maximumTimestamp))yield b(G.DateMaximumTimestamp,$,Q,X);if(T($.minimumTimestamp)&&!(X.getTime()>=$.minimumTimestamp))yield b(G.DateMinimumTimestamp,$,Q,X);if(T($.multipleOfTimestamp)&&X.getTime()%$.multipleOfTimestamp!==0)yield b(G.DateMultipleOfTimestamp,$,Q,X)}function*X7($,W,Q,X){if(!a8(X))yield b(G.Function,$,Q,X)}function*Y7($,W,Q,X){let Y=globalThis.Object.values($.$defs),q=$.$defs[$.$ref];yield*j$(q,[...W,...Y],Q,X)}function*q7($,W,Q,X){if(!r8(X))return yield b(G.Integer,$,Q,X);if(T($.exclusiveMaximum)&&!(X<$.exclusiveMaximum))yield b(G.IntegerExclusiveMaximum,$,Q,X);if(T($.exclusiveMinimum)&&!(X>$.exclusiveMinimum))yield b(G.IntegerExclusiveMinimum,$,Q,X);if(T($.maximum)&&!(X<=$.maximum))yield b(G.IntegerMaximum,$,Q,X);if(T($.minimum)&&!(X>=$.minimum))yield b(G.IntegerMinimum,$,Q,X);if(T($.multipleOf)&&X%$.multipleOf!==0)yield b(G.IntegerMultipleOf,$,Q,X)}function*H7($,W,Q,X){let Y=!1;for(let q of $.allOf)for(let H of j$(q,W,Q,X))Y=!0,yield H;if(Y)return yield b(G.Intersect,$,Q,X);if($.unevaluatedProperties===!1){let q=new RegExp(y2($));for(let H of Object.getOwnPropertyNames(X))if(!q.test(H))yield b(G.IntersectUnevaluatedProperties,$,`${Q}/${H}`,X)}if(typeof $.unevaluatedProperties==="object"){let q=new RegExp(y2($));for(let H of Object.getOwnPropertyNames(X))if(!q.test(H)){let z=j$($.unevaluatedProperties,W,`${Q}/${H}`,X[H]).next();if(!z.done)yield z.value}}}function*z7($,W,Q,X){if(!l8(X))yield b(G.Iterator,$,Q,X)}function*J7($,W,Q,X){if(X!==$.const)yield b(G.Literal,$,Q,X)}function*M7($,W,Q,X){yield b(G.Never,$,Q,X)}function*B7($,W,Q,X){if(j$($.not,W,Q,X).next().done===!0)yield b(G.Not,$,Q,X)}function*w7($,W,Q,X){if(!BW(X))yield b(G.Null,$,Q,X)}function*G7($,W,Q,X){if(!a.IsNumberLike(X))return yield b(G.Number,$,Q,X);if(T($.exclusiveMaximum)&&!(X<$.exclusiveMaximum))yield b(G.NumberExclusiveMaximum,$,Q,X);if(T($.exclusiveMinimum)&&!(X>$.exclusiveMinimum))yield b(G.NumberExclusiveMinimum,$,Q,X);if(T($.maximum)&&!(X<=$.maximum))yield b(G.NumberMaximum,$,Q,X);if(T($.minimum)&&!(X>=$.minimum))yield b(G.NumberMinimum,$,Q,X);if(T($.multipleOf)&&X%$.multipleOf!==0)yield b(G.NumberMultipleOf,$,Q,X)}function*U7($,W,Q,X){if(!a.IsObjectLike(X))return yield b(G.Object,$,Q,X);if(T($.minProperties)&&!(Object.getOwnPropertyNames(X).length>=$.minProperties))yield b(G.ObjectMinProperties,$,Q,X);if(T($.maxProperties)&&!(Object.getOwnPropertyNames(X).length<=$.maxProperties))yield b(G.ObjectMaxProperties,$,Q,X);let Y=Array.isArray($.required)?$.required:[],q=Object.getOwnPropertyNames($.properties),H=Object.getOwnPropertyNames(X);for(let z of Y){if(H.includes(z))continue;yield b(G.ObjectRequiredProperty,$.properties[z],`${Q}/${c2(z)}`,void 0)}if($.additionalProperties===!1){for(let z of H)if(!q.includes(z))yield b(G.ObjectAdditionalProperties,$,`${Q}/${c2(z)}`,X[z])}if(typeof $.additionalProperties==="object")for(let z of H){if(q.includes(z))continue;yield*j$($.additionalProperties,W,`${Q}/${c2(z)}`,X[z])}for(let z of q){let w=$.properties[z];if($.required&&$.required.includes(z)){if(yield*j$(w,W,`${Q}/${c2(z)}`,X[z]),m2($)&&!(z in X))yield b(G.ObjectRequiredProperty,w,`${Q}/${c2(z)}`,void 0)}else if(a.IsExactOptionalProperty(X,z))yield*j$(w,W,`${Q}/${c2(z)}`,X[z])}}function*A7($,W,Q,X){if(!s8(X))yield b(G.Promise,$,Q,X)}function*D7($,W,Q,X){if(!a.IsRecordLike(X))return yield b(G.Object,$,Q,X);if(T($.minProperties)&&!(Object.getOwnPropertyNames(X).length>=$.minProperties))yield b(G.ObjectMinProperties,$,Q,X);if(T($.maxProperties)&&!(Object.getOwnPropertyNames(X).length<=$.maxProperties))yield b(G.ObjectMaxProperties,$,Q,X);let[Y,q]=Object.entries($.patternProperties)[0],H=new RegExp(Y);for(let[z,w]of Object.entries(X))if(H.test(z))yield*j$(q,W,`${Q}/${c2(z)}`,w);if(typeof $.additionalProperties==="object"){for(let[z,w]of Object.entries(X))if(!H.test(z))yield*j$($.additionalProperties,W,`${Q}/${c2(z)}`,w)}if($.additionalProperties===!1)for(let[z,w]of Object.entries(X)){if(H.test(z))continue;return yield b(G.ObjectAdditionalProperties,$,`${Q}/${c2(z)}`,w)}}function*_7($,W,Q,X){yield*j$(O$($,W),W,Q,X)}function*N7($,W,Q,X){if(!S$(X))return yield b(G.String,$,Q,X);if(T($.minLength)&&!(X.length>=$.minLength))yield b(G.StringMinLength,$,Q,X);if(T($.maxLength)&&!(X.length<=$.maxLength))yield b(G.StringMaxLength,$,Q,X);if(!new RegExp($.source,$.flags).test(X))return yield b(G.RegExp,$,Q,X)}function*L7($,W,Q,X){if(!S$(X))return yield b(G.String,$,Q,X);if(T($.minLength)&&!(X.length>=$.minLength))yield b(G.StringMinLength,$,Q,X);if(T($.maxLength)&&!(X.length<=$.maxLength))yield b(G.StringMaxLength,$,Q,X);if(S$($.pattern)){if(!new RegExp($.pattern).test(X))yield b(G.StringPattern,$,Q,X)}if(S$($.format)){if(!e$.Has($.format))yield b(G.StringFormatUnknown,$,Q,X);else if(!e$.Get($.format)(X))yield b(G.StringFormat,$,Q,X)}}function*S7($,W,Q,X){if(!GW(X))yield b(G.Symbol,$,Q,X)}function*O7($,W,Q,X){if(!S$(X))return yield b(G.String,$,Q,X);if(!new RegExp($.pattern).test(X))yield b(G.StringPattern,$,Q,X)}function*b7($,W,Q,X){yield*j$(O$($,W),W,Q,X)}function*j7($,W,Q,X){if(!A$(X))return yield b(G.Tuple,$,Q,X);if($.items===void 0&&X.length!==0)return yield b(G.TupleLength,$,Q,X);if(X.length!==$.maxItems)return yield b(G.TupleLength,$,Q,X);if(!$.items)return;for(let Y=0;Y<$.items.length;Y++)yield*j$($.items[Y],W,`${Q}/${Y}`,X[Y])}function*R7($,W,Q,X){if(!x$(X))yield b(G.Undefined,$,Q,X)}function*F7($,W,Q,X){if(bW($,W,X))return;let Y=$.anyOf.map((q)=>new zX(j$(q,W,Q,X)));yield b(G.Union,$,Q,X,Y)}function*C7($,W,Q,X){if(!gW(X))return yield b(G.Uint8Array,$,Q,X);if(T($.maxByteLength)&&!(X.length<=$.maxByteLength))yield b(G.Uint8ArrayMaxByteLength,$,Q,X);if(T($.minByteLength)&&!(X.length>=$.minByteLength))yield b(G.Uint8ArrayMinByteLength,$,Q,X)}function*K7($,W,Q,X){}function*V7($,W,Q,X){if(!a.IsVoidLike(X))yield b(G.Void,$,Q,X)}function*P7($,W,Q,X){if(!v$.Get($[D])($,X))yield b(G.Kind,$,Q,X)}function*j$($,W,Q,X){let Y=T($.$id)?[...W,$]:W,q=$;switch(q[D]){case"Any":return yield*s5(q,Y,Q,X);case"Argument":return yield*t5(q,Y,Q,X);case"Array":return yield*r5(q,Y,Q,X);case"AsyncIterator":return yield*a5(q,Y,Q,X);case"BigInt":return yield*e5(q,Y,Q,X);case"Boolean":return yield*$7(q,Y,Q,X);case"Constructor":return yield*W7(q,Y,Q,X);case"Date":return yield*Q7(q,Y,Q,X);case"Function":return yield*X7(q,Y,Q,X);case"Import":return yield*Y7(q,Y,Q,X);case"Integer":return yield*q7(q,Y,Q,X);case"Intersect":return yield*H7(q,Y,Q,X);case"Iterator":return yield*z7(q,Y,Q,X);case"Literal":return yield*J7(q,Y,Q,X);case"Never":return yield*M7(q,Y,Q,X);case"Not":return yield*B7(q,Y,Q,X);case"Null":return yield*w7(q,Y,Q,X);case"Number":return yield*G7(q,Y,Q,X);case"Object":return yield*U7(q,Y,Q,X);case"Promise":return yield*A7(q,Y,Q,X);case"Record":return yield*D7(q,Y,Q,X);case"Ref":return yield*_7(q,Y,Q,X);case"RegExp":return yield*N7(q,Y,Q,X);case"String":return yield*L7(q,Y,Q,X);case"Symbol":return yield*S7(q,Y,Q,X);case"TemplateLiteral":return yield*O7(q,Y,Q,X);case"This":return yield*b7(q,Y,Q,X);case"Tuple":return yield*j7(q,Y,Q,X);case"Undefined":return yield*R7(q,Y,Q,X);case"Union":return yield*F7(q,Y,Q,X);case"Uint8Array":return yield*C7(q,Y,Q,X);case"Unknown":return yield*K7(q,Y,Q,X);case"Void":return yield*V7(q,Y,Q,X);default:if(!v$.Has(q[D]))throw new W4($);return yield*P7(q,Y,Q,X)}}function Q4(...$){let W=$.length===3?j$($[0],$[1],"",$[2]):j$($[0],[],"",$[1]);return new zX(W)}class JX extends y{constructor($,W,Q){super("Unable to decode value as it does not match the expected schema");this.schema=$,this.value=W,this.error=Q}}class X4 extends y{constructor($,W,Q,X){super(X instanceof Error?X.message:"Unknown error");this.schema=$,this.path=W,this.value=Q,this.error=X}}function q$($,W,Q){try{return c($)?$[X$].Decode(Q):Q}catch(X){throw new X4($,W,Q,X)}}function Z7($,W,Q,X){return A$(X)?q$($,Q,X.map((Y,q)=>S2($.items,W,`${Q}/${q}`,Y))):q$($,Q,X)}function E7($,W,Q,X){if(!f$(X)||e8(X))return q$($,Q,X);let Y=JQ($),q=Y.map((_)=>_[0]),H={...X};for(let[_,x]of Y)if(_ in H)H[_]=S2(x,W,`${Q}/${_}`,H[_]);if(!c($.unevaluatedProperties))return q$($,Q,H);let z=Object.getOwnPropertyNames(H),w=$.unevaluatedProperties,N={...H};for(let _ of z)if(!q.includes(_))N[_]=q$(w,`${Q}/${_}`,N[_]);return q$($,Q,N)}function k7($,W,Q,X){let Y=globalThis.Object.values($.$defs),q=$.$defs[$.$ref],H=S2(q,[...W,...Y],Q,X);return q$($,Q,H)}function I7($,W,Q,X){return q$($,Q,S2($.not,W,Q,X))}function x7($,W,Q,X){if(!f$(X))return q$($,Q,X);let Y=Y2($),q={...X};for(let N of Y){if(!t8(q,N))continue;if(x$(q[N])&&(!v2($.properties[N])||a.IsExactOptionalProperty(q,N)))continue;q[N]=S2($.properties[N],W,`${Q}/${N}`,q[N])}if(!Y$($.additionalProperties))return q$($,Q,q);let H=Object.getOwnPropertyNames(q),z=$.additionalProperties,w={...q};for(let N of H)if(!Y.includes(N))w[N]=q$(z,`${Q}/${N}`,w[N]);return q$($,Q,w)}function g7($,W,Q,X){if(!f$(X))return q$($,Q,X);let Y=Object.getOwnPropertyNames($.patternProperties)[0],q=new RegExp(Y),H={...X};for(let _ of Object.getOwnPropertyNames(X))if(q.test(_))H[_]=S2($.patternProperties[Y],W,`${Q}/${_}`,H[_]);if(!Y$($.additionalProperties))return q$($,Q,H);let z=Object.getOwnPropertyNames(H),w=$.additionalProperties,N={...H};for(let _ of z)if(!q.test(_))N[_]=q$(w,`${Q}/${_}`,N[_]);return q$($,Q,N)}function f7($,W,Q,X){let Y=O$($,W);return q$($,Q,S2(Y,W,Q,X))}function T7($,W,Q,X){let Y=O$($,W);return q$($,Q,S2(Y,W,Q,X))}function v7($,W,Q,X){return A$(X)&&A$($.items)?q$($,Q,$.items.map((Y,q)=>S2(Y,W,`${Q}/${q}`,X[q]))):q$($,Q,X)}function d7($,W,Q,X){for(let Y of $.anyOf){if(!bW(Y,W,X))continue;let q=S2(Y,W,Q,X);return q$($,Q,q)}return q$($,Q,X)}function S2($,W,Q,X){let Y=QW($,W),q=$;switch($[D]){case"Array":return Z7(q,Y,Q,X);case"Import":return k7(q,Y,Q,X);case"Intersect":return E7(q,Y,Q,X);case"Not":return I7(q,Y,Q,X);case"Object":return x7(q,Y,Q,X);case"Record":return g7(q,Y,Q,X);case"Ref":return f7(q,Y,Q,X);case"Symbol":return q$(q,Q,X);case"This":return T7(q,Y,Q,X);case"Tuple":return v7(q,Y,Q,X);case"Union":return d7(q,Y,Q,X);default:return q$(q,Q,X)}}function Y4($,W,Q){return S2($,W,"",Q)}class MX extends y{constructor($,W,Q){super("The encoded value does not match the expected schema");this.schema=$,this.value=W,this.error=Q}}class q4 extends y{constructor($,W,Q,X){super(`${X instanceof Error?X.message:"Unknown error"}`);this.schema=$,this.path=W,this.value=Q,this.error=X}}function C$($,W,Q){try{return c($)?$[X$].Encode(Q):Q}catch(X){throw new q4($,W,Q,X)}}function h7($,W,Q,X){let Y=C$($,Q,X);return A$(Y)?Y.map((q,H)=>O2($.items,W,`${Q}/${H}`,q)):Y}function y7($,W,Q,X){let Y=globalThis.Object.values($.$defs),q=$.$defs[$.$ref],H=C$($,Q,X);return O2(q,[...W,...Y],Q,H)}function m7($,W,Q,X){let Y=C$($,Q,X);if(!f$(X)||e8(X))return Y;let q=JQ($),H=q.map((x)=>x[0]),z={...Y};for(let[x,B$]of q)if(x in z)z[x]=O2(B$,W,`${Q}/${x}`,z[x]);if(!c($.unevaluatedProperties))return z;let w=Object.getOwnPropertyNames(z),N=$.unevaluatedProperties,_={...z};for(let x of w)if(!H.includes(x))_[x]=C$(N,`${Q}/${x}`,_[x]);return _}function c7($,W,Q,X){return C$($.not,Q,C$($,Q,X))}function n7($,W,Q,X){let Y=C$($,Q,X);if(!f$(Y))return Y;let q=Y2($),H={...Y};for(let _ of q){if(!t8(H,_))continue;if(x$(H[_])&&(!v2($.properties[_])||a.IsExactOptionalProperty(H,_)))continue;H[_]=O2($.properties[_],W,`${Q}/${_}`,H[_])}if(!Y$($.additionalProperties))return H;let z=Object.getOwnPropertyNames(H),w=$.additionalProperties,N={...H};for(let _ of z)if(!q.includes(_))N[_]=C$(w,`${Q}/${_}`,N[_]);return N}function o7($,W,Q,X){let Y=C$($,Q,X);if(!f$(X))return Y;let q=Object.getOwnPropertyNames($.patternProperties)[0],H=new RegExp(q),z={...Y};for(let x of Object.getOwnPropertyNames(X))if(H.test(x))z[x]=O2($.patternProperties[q],W,`${Q}/${x}`,z[x]);if(!Y$($.additionalProperties))return z;let w=Object.getOwnPropertyNames(z),N=$.additionalProperties,_={...z};for(let x of w)if(!H.test(x))_[x]=C$(N,`${Q}/${x}`,_[x]);return _}function i7($,W,Q,X){let Y=O$($,W),q=O2(Y,W,Q,X);return C$($,Q,q)}function p7($,W,Q,X){let Y=O$($,W),q=O2(Y,W,Q,X);return C$($,Q,q)}function u7($,W,Q,X){let Y=C$($,Q,X);return A$($.items)?$.items.map((q,H)=>O2(q,W,`${Q}/${H}`,Y[H])):[]}function l7($,W,Q,X){for(let Y of $.anyOf){if(!bW(Y,W,X))continue;let q=O2(Y,W,Q,X);return C$($,Q,q)}for(let Y of $.anyOf){let q=O2(Y,W,Q,X);if(!bW($,W,q))continue;return C$($,Q,q)}return C$($,Q,X)}function O2($,W,Q,X){let Y=QW($,W),q=$;switch($[D]){case"Array":return h7(q,Y,Q,X);case"Import":return y7(q,Y,Q,X);case"Intersect":return m7(q,Y,Q,X);case"Not":return c7(q,Y,Q,X);case"Object":return n7(q,Y,Q,X);case"Record":return o7(q,Y,Q,X);case"Ref":return i7(q,Y,Q,X);case"This":return p7(q,Y,Q,X);case"Tuple":return u7(q,Y,Q,X);case"Union":return l7(q,Y,Q,X);default:return C$(q,Q,X)}}function H4($,W,Q){return O2($,W,"",Q)}function s7($,W){return c($)||N$($.items,W)}function t7($,W){return c($)||N$($.items,W)}function r7($,W){return c($)||N$($.returns,W)||$.parameters.some((Q)=>N$(Q,W))}function a7($,W){return c($)||N$($.returns,W)||$.parameters.some((Q)=>N$(Q,W))}function e7($,W){return c($)||c($.unevaluatedProperties)||$.allOf.some((Q)=>N$(Q,W))}function $3($,W){let Q=globalThis.Object.getOwnPropertyNames($.$defs).reduce((Y,q)=>[...Y,$.$defs[q]],[]),X=$.$defs[$.$ref];return c($)||N$(X,[...Q,...W])}function W3($,W){return c($)||N$($.items,W)}function Q3($,W){return c($)||N$($.not,W)}function X3($,W){return c($)||Object.values($.properties).some((Q)=>N$(Q,W))||Y$($.additionalProperties)&&N$($.additionalProperties,W)}function Y3($,W){return c($)||N$($.item,W)}function q3($,W){let Q=Object.getOwnPropertyNames($.patternProperties)[0],X=$.patternProperties[Q];return c($)||N$(X,W)||Y$($.additionalProperties)&&c($.additionalProperties)}function H3($,W){if(c($))return!0;return N$(O$($,W),W)}function z3($,W){if(c($))return!0;return N$(O$($,W),W)}function J3($,W){return c($)||!x$($.items)&&$.items.some((Q)=>N$(Q,W))}function M3($,W){return c($)||$.anyOf.some((Q)=>N$(Q,W))}function N$($,W){let Q=QW($,W),X=$;if($.$id&&BX.has($.$id))return!1;if($.$id)BX.add($.$id);switch($[D]){case"Array":return s7(X,Q);case"AsyncIterator":return t7(X,Q);case"Constructor":return r7(X,Q);case"Function":return a7(X,Q);case"Import":return $3(X,Q);case"Intersect":return e7(X,Q);case"Iterator":return W3(X,Q);case"Not":return Q3(X,Q);case"Object":return X3(X,Q);case"Promise":return Y3(X,Q);case"Record":return q3(X,Q);case"Ref":return H3(X,Q);case"This":return z3(X,Q);case"Tuple":return J3(X,Q);case"Union":return M3(X,Q);default:return c($)}}var BX=new Set;function z4($,W){return BX.clear(),N$($,W)}class J4{constructor($,W,Q,X){this.schema=$,this.references=W,this.checkFunc=Q,this.code=X,this.hasTransform=z4($,W)}Code(){return this.code}Schema(){return this.schema}References(){return this.references}Errors($){return Q4(this.schema,this.references,$)}Check($){return this.checkFunc($)}Decode($){if(!this.checkFunc($))throw new JX(this.schema,$,this.Errors($).First());return this.hasTransform?Y4(this.schema,this.references,$):$}Encode($){let W=this.hasTransform?H4(this.schema,this.references,$):$;if(!this.checkFunc(W))throw new MX(this.schema,$,this.Errors($).First());return W}}var n2;(function($){function W(q){return q===36}$.DollarSign=W;function Q(q){return q===95}$.IsUnderscore=Q;function X(q){return q>=65&&q<=90||q>=97&&q<=122}$.IsAlpha=X;function Y(q){return q>=48&&q<=57}$.IsNumeric=Y})(n2||(n2={}));var FQ;(function($){function W(q){if(q.length===0)return!1;return n2.IsNumeric(q.charCodeAt(0))}function Q(q){if(W(q))return!1;for(let H=0;H<q.length;H++){let z=q.charCodeAt(H);if(!(n2.IsAlpha(z)||n2.IsNumeric(z)||n2.DollarSign(z)||n2.IsUnderscore(z)))return!1}return!0}function X(q){return q.replace(/'/g,"\\'")}function Y(q,H){return Q(H)?`${q}.${H}`:`${q}['${X(H)}']`}$.Encode=Y})(FQ||(FQ={}));var wX;(function($){function W(Q){let X=[];for(let Y=0;Y<Q.length;Y++){let q=Q.charCodeAt(Y);if(n2.IsNumeric(q)||n2.IsAlpha(q))X.push(Q.charAt(Y));else X.push(`_${q}_`)}return X.join("").replace(/__/g,"_")}$.Encode=W})(wX||(wX={}));var GX;(function($){function W(Q){return Q.replace(/'/g,"\\'")}$.Escape=W})(GX||(GX={}));class M4 extends y{constructor($){super("Unknown type");this.schema=$}}class UX extends y{constructor($){super("Preflight validation check failed to guard for the given schema");this.schema=$}}var jW;(function($){function W(H,z,w){return a.ExactOptionalPropertyTypes?`('${z}' in ${H} ? ${w} : true)`:`(${FQ.Encode(H,z)} !== undefined ? ${w} : true)`}$.IsExactOptionalProperty=W;function Q(H){return!a.AllowArrayObject?`(typeof ${H} === 'object' && ${H} !== null && !Array.isArray(${H}))`:`(typeof ${H} === 'object' && ${H} !== null)`}$.IsObjectLike=Q;function X(H){return!a.AllowArrayObject?`(typeof ${H} === 'object' && ${H} !== null && !Array.isArray(${H}) && !(${H} instanceof Date) && !(${H} instanceof Uint8Array))`:`(typeof ${H} === 'object' && ${H} !== null && !(${H} instanceof Date) && !(${H} instanceof Uint8Array))`}$.IsRecordLike=X;function Y(H){return a.AllowNaN?`typeof ${H} === 'number'`:`Number.isFinite(${H})`}$.IsNumberLike=Y;function q(H){return a.AllowNullVoid?`(${H} === undefined || ${H} === null)`:`${H} === undefined`}$.IsVoidLike=q})(jW||(jW={}));var CQ;(function($){function W(J){return J[D]==="Any"||J[D]==="Unknown"}function*Q(J,j,B){yield"true"}function*X(J,j,B){yield"true"}function*Y(J,j,B){yield`Array.isArray(${B})`;let[P,R]=[n8("value","any"),n8("acc","number")];if(Z(J.maxItems))yield`${B}.length <= ${J.maxItems}`;if(Z(J.minItems))yield`${B}.length >= ${J.minItems}`;let F=z2(J.items,j,"value");if(yield`${B}.every((${P}) => ${F})`,Q$(J.contains)||Z(J.minContains)||Z(J.maxContains)){let r=Q$(J.contains)?J.contains:k(),g$=z2(r,j,"value"),I2=Z(J.minContains)?[`(count >= ${J.minContains})`]:[],J2=Z(J.maxContains)?[`(count <= ${J.maxContains})`]:[],K2=`const count = value.reduce((${R}, ${P}) => ${g$} ? acc + 1 : acc, 0)`,o8=["(count > 0)",...I2,...J2].join(" && ");yield`((${P}) => { ${K2}; return ${o8}})(${B})`}if(J.uniqueItems===!0)yield`((${P}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${B})`}function*q(J,j,B){yield`(typeof value === 'object' && Symbol.asyncIterator in ${B})`}function*H(J,j,B){if(yield`(typeof ${B} === 'bigint')`,o$(J.exclusiveMaximum))yield`${B} < BigInt(${J.exclusiveMaximum})`;if(o$(J.exclusiveMinimum))yield`${B} > BigInt(${J.exclusiveMinimum})`;if(o$(J.maximum))yield`${B} <= BigInt(${J.maximum})`;if(o$(J.minimum))yield`${B} >= BigInt(${J.minimum})`;if(o$(J.multipleOf))yield`(${B} % BigInt(${J.multipleOf})) === 0`}function*z(J,j,B){yield`(typeof ${B} === 'boolean')`}function*w(J,j,B){yield*PW(J.returns,j,`${B}.prototype`)}function*N(J,j,B){if(yield`(${B} instanceof Date) && Number.isFinite(${B}.getTime())`,Z(J.exclusiveMaximumTimestamp))yield`${B}.getTime() < ${J.exclusiveMaximumTimestamp}`;if(Z(J.exclusiveMinimumTimestamp))yield`${B}.getTime() > ${J.exclusiveMinimumTimestamp}`;if(Z(J.maximumTimestamp))yield`${B}.getTime() <= ${J.maximumTimestamp}`;if(Z(J.minimumTimestamp))yield`${B}.getTime() >= ${J.minimumTimestamp}`;if(Z(J.multipleOfTimestamp))yield`(${B}.getTime() % ${J.multipleOfTimestamp}) === 0`}function*_(J,j,B){yield`(typeof ${B} === 'function')`}function*x(J,j,B){let P=globalThis.Object.getOwnPropertyNames(J.$defs).reduce((R,F)=>{return[...R,J.$defs[F]]},[]);yield*PW(X2(J.$ref),[...j,...P],B)}function*B$(J,j,B){if(yield`Number.isInteger(${B})`,Z(J.exclusiveMaximum))yield`${B} < ${J.exclusiveMaximum}`;if(Z(J.exclusiveMinimum))yield`${B} > ${J.exclusiveMinimum}`;if(Z(J.maximum))yield`${B} <= ${J.maximum}`;if(Z(J.minimum))yield`${B} >= ${J.minimum}`;if(Z(J.multipleOf))yield`(${B} % ${J.multipleOf}) === 0`}function*r$(J,j,B){let P=J.allOf.map((R)=>z2(R,j,B)).join(" && ");if(J.unevaluatedProperties===!1){let R=ZW(`${new RegExp(y2(J))};`),F=`Object.getOwnPropertyNames(${B}).every(key => ${R}.test(key))`;yield`(${P} && ${F})`}else if(Q$(J.unevaluatedProperties)){let R=ZW(`${new RegExp(y2(J))};`),F=`Object.getOwnPropertyNames(${B}).every(key => ${R}.test(key) || ${z2(J.unevaluatedProperties,j,`${B}[key]`)})`;yield`(${P} && ${F})`}else yield`(${P})`}function*c$(J,j,B){yield`(typeof value === 'object' && Symbol.iterator in ${B})`}function*L$(J,j,B){if(typeof J.const==="number"||typeof J.const==="boolean")yield`(${B} === ${J.const})`;else yield`(${B} === '${GX.Escape(J.const)}')`}function*S8(J,j,B){yield"false"}function*K4(J,j,B){yield`(!${z2(J.not,j,B)})`}function*V4(J,j,B){yield`(${B} === null)`}function*P4(J,j,B){if(yield jW.IsNumberLike(B),Z(J.exclusiveMaximum))yield`${B} < ${J.exclusiveMaximum}`;if(Z(J.exclusiveMinimum))yield`${B} > ${J.exclusiveMinimum}`;if(Z(J.maximum))yield`${B} <= ${J.maximum}`;if(Z(J.minimum))yield`${B} >= ${J.minimum}`;if(Z(J.multipleOf))yield`(${B} % ${J.multipleOf}) === 0`}function*Z4(J,j,B){if(yield jW.IsObjectLike(B),Z(J.minProperties))yield`Object.getOwnPropertyNames(${B}).length >= ${J.minProperties}`;if(Z(J.maxProperties))yield`Object.getOwnPropertyNames(${B}).length <= ${J.maxProperties}`;let P=Object.getOwnPropertyNames(J.properties);for(let R of P){let F=FQ.Encode(B,R),r=J.properties[R];if(J.required&&J.required.includes(R)){if(yield*PW(r,j,F),m2(r)||W(r))yield`('${R}' in ${B})`}else{let g$=z2(r,j,F);yield jW.IsExactOptionalProperty(B,R,g$)}}if(J.additionalProperties===!1)if(J.required&&J.required.length===P.length)yield`Object.getOwnPropertyNames(${B}).length === ${P.length}`;else{let R=`[${P.map((F)=>`'${F}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${B}).every(key => ${R}.includes(key))`}if(typeof J.additionalProperties==="object"){let R=z2(J.additionalProperties,j,`${B}[key]`),F=`[${P.map((r)=>`'${r}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${B}).every(key => ${F}.includes(key) || ${R}))`}}function*E4(J,j,B){yield`${B} instanceof Promise`}function*k4(J,j,B){if(yield jW.IsRecordLike(B),Z(J.minProperties))yield`Object.getOwnPropertyNames(${B}).length >= ${J.minProperties}`;if(Z(J.maxProperties))yield`Object.getOwnPropertyNames(${B}).length <= ${J.maxProperties}`;let[P,R]=Object.entries(J.patternProperties)[0],F=ZW(`${new RegExp(P)}`),r=z2(R,j,"value"),g$=Q$(J.additionalProperties)?z2(J.additionalProperties,j,B):J.additionalProperties===!1?"false":"true",I2=`(${F}.test(key) ? ${r} : ${g$})`;yield`(Object.entries(${B}).every(([key, value]) => ${I2}))`}function*I4(J,j,B){let P=O$(J,j);if(R$.functions.has(J.$ref))return yield`${c8(J.$ref)}(${B})`;yield*PW(P,j,B)}function*x4(J,j,B){let P=ZW(`${new RegExp(J.source,J.flags)};`);if(yield`(typeof ${B} === 'string')`,Z(J.maxLength))yield`${B}.length <= ${J.maxLength}`;if(Z(J.minLength))yield`${B}.length >= ${J.minLength}`;yield`${P}.test(${B})`}function*g4(J,j,B){if(yield`(typeof ${B} === 'string')`,Z(J.maxLength))yield`${B}.length <= ${J.maxLength}`;if(Z(J.minLength))yield`${B}.length >= ${J.minLength}`;if(J.pattern!==void 0)yield`${ZW(`${new RegExp(J.pattern)};`)}.test(${B})`;if(J.format!==void 0)yield`format('${J.format}', ${B})`}function*f4(J,j,B){yield`(typeof ${B} === 'symbol')`}function*T4(J,j,B){yield`(typeof ${B} === 'string')`,yield`${ZW(`${new RegExp(J.pattern)};`)}.test(${B})`}function*v4(J,j,B){yield`${c8(J.$ref)}(${B})`}function*d4(J,j,B){if(yield`Array.isArray(${B})`,J.items===void 0)return yield`${B}.length === 0`;yield`(${B}.length === ${J.maxItems})`;for(let P=0;P<J.items.length;P++)yield`${z2(J.items[P],j,`${B}[${P}]`)}`}function*h4(J,j,B){yield`${B} === undefined`}function*y4(J,j,B){yield`(${J.anyOf.map((R)=>z2(R,j,B)).join(" || ")})`}function*m4(J,j,B){if(yield`${B} instanceof Uint8Array`,Z(J.maxByteLength))yield`(${B}.length <= ${J.maxByteLength})`;if(Z(J.minByteLength))yield`(${B}.length >= ${J.minByteLength})`}function*c4(J,j,B){yield"true"}function*n4(J,j,B){yield jW.IsVoidLike(B)}function*o4(J,j,B){let P=R$.instances.size;R$.instances.set(P,J),yield`kind('${J[D]}', ${P}, ${B})`}function*PW(J,j,B,P=!0){let R=S$(J.$id)?[...j,J]:j,F=J;if(P&&S$(J.$id)){let r=c8(J.$id);if(R$.functions.has(r))return yield`${r}(${B})`;else{R$.functions.set(r,"<deferred>");let g$=SX(r,J,j,"value",!1);return R$.functions.set(r,g$),yield`${r}(${B})`}}switch(F[D]){case"Any":return yield*Q(F,R,B);case"Argument":return yield*X(F,R,B);case"Array":return yield*Y(F,R,B);case"AsyncIterator":return yield*q(F,R,B);case"BigInt":return yield*H(F,R,B);case"Boolean":return yield*z(F,R,B);case"Constructor":return yield*w(F,R,B);case"Date":return yield*N(F,R,B);case"Function":return yield*_(F,R,B);case"Import":return yield*x(F,R,B);case"Integer":return yield*B$(F,R,B);case"Intersect":return yield*r$(F,R,B);case"Iterator":return yield*c$(F,R,B);case"Literal":return yield*L$(F,R,B);case"Never":return yield*S8(F,R,B);case"Not":return yield*K4(F,R,B);case"Null":return yield*V4(F,R,B);case"Number":return yield*P4(F,R,B);case"Object":return yield*Z4(F,R,B);case"Promise":return yield*E4(F,R,B);case"Record":return yield*k4(F,R,B);case"Ref":return yield*I4(F,R,B);case"RegExp":return yield*x4(F,R,B);case"String":return yield*g4(F,R,B);case"Symbol":return yield*f4(F,R,B);case"TemplateLiteral":return yield*T4(F,R,B);case"This":return yield*v4(F,R,B);case"Tuple":return yield*d4(F,R,B);case"Undefined":return yield*h4(F,R,B);case"Union":return yield*y4(F,R,B);case"Uint8Array":return yield*m4(F,R,B);case"Unknown":return yield*c4(F,R,B);case"Void":return yield*n4(F,R,B);default:if(!v$.Has(F[D]))throw new M4(J);return yield*o4(F,R,B)}}let R$={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function z2(J,j,B,P=!0){return`(${[...PW(J,j,B,P)].join(" && ")})`}function c8(J){return`check_${wX.Encode(J)}`}function ZW(J){let j=`local_${R$.variables.size}`;return R$.variables.set(j,`const ${j} = ${J}`),j}function SX(J,j,B,P,R=!0){let[F,r]=[`
227
- `,(K2)=>"".padStart(K2," ")],g$=n8("value","any"),I2=OX("boolean"),J2=[...PW(j,B,P,R)].map((K2)=>`${r(4)}${K2}`).join(` &&${F}`);return`function ${J}(${g$})${I2} {${F}${r(2)}return (${F}${J2}${F}${r(2)})
228
- }`}function n8(J,j){let B=R$.language==="typescript"?`: ${j}`:"";return`${J}${B}`}function OX(J){return R$.language==="typescript"?`: ${J}`:""}function i4(J,j,B){let P=SX("check",J,j,"value"),R=n8("value","any"),F=OX("boolean"),r=[...R$.functions.values()],g$=[...R$.variables.values()],I2=S$(J.$id)?`return function check(${R})${F} {
229
- return ${c8(J.$id)}(value)
230
- }`:`return ${P}`;return[...g$,...r,I2].join(`
231
- `)}function bX(...J){let j={language:"javascript"},[B,P,R]=J.length===2&&A$(J[1])?[J[0],J[1],j]:J.length===2&&!A$(J[1])?[J[0],[],J[1]]:J.length===3?[J[0],J[1],J[2]]:J.length===1?[J[0],[],j]:[null,[],j];if(R$.language=R.language,R$.variables.clear(),R$.functions.clear(),R$.instances.clear(),!Q$(B))throw new UX(B);for(let F of P)if(!Q$(F))throw new UX(F);return i4(B,P,R)}$.Code=bX;function p4(J,j=[]){let B=bX(J,j,{language:"javascript"}),P=globalThis.Function("kind","format","hash",B),R=new Map(R$.instances);function F(J2,K2,o8){if(!v$.Has(J2)||!R.has(K2))return!1;let u4=v$.Get(J2),l4=R.get(K2);return u4(l4,o8)}function r(J2,K2){if(!e$.Has(J2))return!1;return e$.Get(J2)(K2)}function g$(J2){return Q8(J2)}let I2=P(F,r,g$);return new J4(J,j,I2,B)}$.Compile=p4})(CQ||(CQ={}));var EQ={};JW(EQ,{void:()=>u3,util:()=>v,unknown:()=>i3,union:()=>r3,undefined:()=>c3,tuple:()=>$z,transformer:()=>Bz,symbol:()=>m3,string:()=>L4,strictObject:()=>t3,setErrorMap:()=>G3,set:()=>Xz,record:()=>Wz,quotelessJson:()=>B3,promise:()=>Mz,preprocess:()=>Uz,pipeline:()=>Az,ostring:()=>Dz,optional:()=>wz,onumber:()=>_z,oboolean:()=>Nz,objectUtil:()=>AX,object:()=>s3,number:()=>S4,nullable:()=>Gz,null:()=>n3,never:()=>p3,nativeEnum:()=>Jz,nan:()=>d3,map:()=>Qz,makeIssue:()=>f8,literal:()=>Hz,lazy:()=>qz,late:()=>T3,isValid:()=>XW,isDirty:()=>VQ,isAsync:()=>Y8,isAborted:()=>KQ,intersection:()=>e3,instanceof:()=>v3,getParsedType:()=>Z2,getErrorMap:()=>X8,function:()=>Yz,enum:()=>zz,effect:()=>Bz,discriminatedUnion:()=>a3,defaultErrorMap:()=>o2,datetimeRegex:()=>D4,date:()=>y3,custom:()=>N4,coerce:()=>Lz,boolean:()=>O4,bigint:()=>h3,array:()=>l3,any:()=>o3,addIssueToContext:()=>O,ZodVoid:()=>v8,ZodUnknown:()=>YW,ZodUnion:()=>B8,ZodUndefined:()=>J8,ZodType:()=>I,ZodTuple:()=>k2,ZodTransformer:()=>C2,ZodSymbol:()=>T8,ZodString:()=>b2,ZodSet:()=>KW,ZodSchema:()=>I,ZodRecord:()=>d8,ZodReadonly:()=>N8,ZodPromise:()=>VW,ZodPipeline:()=>m8,ZodParsedType:()=>S,ZodOptional:()=>R2,ZodObject:()=>J$,ZodNumber:()=>qW,ZodNullable:()=>p2,ZodNull:()=>M8,ZodNever:()=>E2,ZodNativeEnum:()=>A8,ZodNaN:()=>y8,ZodMap:()=>h8,ZodLiteral:()=>U8,ZodLazy:()=>G8,ZodIssueCode:()=>L,ZodIntersection:()=>w8,ZodFunction:()=>H8,ZodFirstPartyTypeKind:()=>V,ZodError:()=>m$,ZodEnum:()=>zW,ZodEffects:()=>C2,ZodDiscriminatedUnion:()=>PQ,ZodDefault:()=>D8,ZodDate:()=>FW,ZodCatch:()=>_8,ZodBranded:()=>ZQ,ZodBoolean:()=>z8,ZodBigInt:()=>HW,ZodArray:()=>j2,ZodAny:()=>CW,Schema:()=>I,ParseStatus:()=>K$,OK:()=>I$,NEVER:()=>Sz,INVALID:()=>K,EMPTY_PATH:()=>U3,DIRTY:()=>RW,BRAND:()=>f3});var v;(function($){$.assertEqual=(Y)=>{};function W(Y){}$.assertIs=W;function Q(Y){throw Error()}$.assertNever=Q,$.arrayToEnum=(Y)=>{let q={};for(let H of Y)q[H]=H;return q},$.getValidEnumValues=(Y)=>{let q=$.objectKeys(Y).filter((z)=>typeof Y[Y[z]]!=="number"),H={};for(let z of q)H[z]=Y[z];return $.objectValues(H)},$.objectValues=(Y)=>{return $.objectKeys(Y).map(function(q){return Y[q]})},$.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let q=[];for(let H in Y)if(Object.prototype.hasOwnProperty.call(Y,H))q.push(H);return q},$.find=(Y,q)=>{for(let H of Y)if(q(H))return H;return},$.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function X(Y,q=" | "){return Y.map((H)=>typeof H==="string"?`'${H}'`:H).join(q)}$.joinValues=X,$.jsonStringifyReplacer=(Y,q)=>{if(typeof q==="bigint")return q.toString();return q}})(v||(v={}));var AX;(function($){$.mergeShapes=(W,Q)=>{return{...W,...Q}}})(AX||(AX={}));var S=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Z2=($)=>{switch(typeof $){case"undefined":return S.undefined;case"string":return S.string;case"number":return Number.isNaN($)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":if(Array.isArray($))return S.array;if($===null)return S.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return S.promise;if(typeof Map<"u"&&$ instanceof Map)return S.map;if(typeof Set<"u"&&$ instanceof Set)return S.set;if(typeof Date<"u"&&$ instanceof Date)return S.date;return S.object;default:return S.unknown}};var L=v.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"]),B3=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class m$ extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};let W=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,W);else this.__proto__=W;this.name="ZodError",this.issues=$}format($){let W=$||function(Y){return Y.message},Q={_errors:[]},X=(Y)=>{for(let q of Y.issues)if(q.code==="invalid_union")q.unionErrors.map(X);else if(q.code==="invalid_return_type")X(q.returnTypeError);else if(q.code==="invalid_arguments")X(q.argumentsError);else if(q.path.length===0)Q._errors.push(W(q));else{let H=Q,z=0;while(z<q.path.length){let w=q.path[z];if(z!==q.path.length-1)H[w]=H[w]||{_errors:[]};else H[w]=H[w]||{_errors:[]},H[w]._errors.push(W(q));H=H[w],z++}}};return X(this),Q}static assert($){if(!($ instanceof m$))throw Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(W)=>W.message){let W={},Q=[];for(let X of this.issues)if(X.path.length>0){let Y=X.path[0];W[Y]=W[Y]||[],W[Y].push($(X))}else Q.push($(X));return{formErrors:Q,fieldErrors:W}}get formErrors(){return this.flatten()}}m$.create=($)=>{return new m$($)};var w3=($,W)=>{let Q;switch($.code){case L.invalid_type:if($.received===S.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case L.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,v.jsonStringifyReplacer)}`;break;case L.unrecognized_keys:Q=`Unrecognized key(s) in object: ${v.joinValues($.keys,", ")}`;break;case L.invalid_union:Q="Invalid input";break;case L.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${v.joinValues($.options)}`;break;case L.invalid_enum_value:Q=`Invalid enum value. Expected ${v.joinValues($.options)}, received '${$.received}'`;break;case L.invalid_arguments:Q="Invalid function arguments";break;case L.invalid_return_type:Q="Invalid function return type";break;case L.invalid_date:Q="Invalid date";break;case L.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(Q=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)Q=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)Q=`Invalid input: must end with "${$.validation.endsWith}"`;else v.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case L.too_small:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="bigint")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else Q="Invalid input";break;case L.too_big:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")Q=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else Q="Invalid input";break;case L.custom:Q="Invalid input";break;case L.invalid_intersection_types:Q="Intersection results could not be merged";break;case L.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case L.not_finite:Q="Number must be finite";break;default:Q=W.defaultError,v.assertNever($)}return{message:Q}},o2=w3;var B4=o2;function G3($){B4=$}function X8(){return B4}var f8=($)=>{let{data:W,path:Q,errorMaps:X,issueData:Y}=$,q=[...Q,...Y.path||[]],H={...Y,path:q};if(Y.message!==void 0)return{...Y,path:q,message:Y.message};let z="",w=X.filter((N)=>!!N).slice().reverse();for(let N of w)z=N(H,{data:W,defaultError:z}).message;return{...Y,path:q,message:z}},U3=[];function O($,W){let Q=X8(),X=f8({issueData:W,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===o2?void 0:o2].filter((Y)=>!!Y)});$.common.issues.push(X)}class K${constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,W){let Q=[];for(let X of W){if(X.status==="aborted")return K;if(X.status==="dirty")$.dirty();Q.push(X.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,W){let Q=[];for(let X of W){let Y=await X.key,q=await X.value;Q.push({key:Y,value:q})}return K$.mergeObjectSync($,Q)}static mergeObjectSync($,W){let Q={};for(let X of W){let{key:Y,value:q}=X;if(Y.status==="aborted")return K;if(q.status==="aborted")return K;if(Y.status==="dirty")$.dirty();if(q.status==="dirty")$.dirty();if(Y.value!=="__proto__"&&(typeof q.value<"u"||X.alwaysSet))Q[Y.value]=q.value}return{status:$.value,value:Q}}}var K=Object.freeze({status:"aborted"}),RW=($)=>({status:"dirty",value:$}),I$=($)=>({status:"valid",value:$}),KQ=($)=>$.status==="aborted",VQ=($)=>$.status==="dirty",XW=($)=>$.status==="valid",Y8=($)=>typeof Promise<"u"&&$ instanceof Promise;var C;(function($){$.errToObj=(W)=>typeof W==="string"?{message:W}:W||{},$.toString=(W)=>typeof W==="string"?W:W?.message})(C||(C={}));class F2{constructor($,W,Q,X){this._cachedPath=[],this.parent=$,this.data=W,this._path=Q,this._key=X}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var w4=($,W)=>{if(XW(W))return{success:!0,data:W.value};else{if(!$.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Q=new m$($.common.issues);return this._error=Q,this._error}}}};function E($){if(!$)return{};let{errorMap:W,invalid_type_error:Q,required_error:X,description:Y}=$;if(W&&(Q||X))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(W)return{errorMap:W,description:Y};return{errorMap:(H,z)=>{let{message:w}=$;if(H.code==="invalid_enum_value")return{message:w??z.defaultError};if(typeof z.data>"u")return{message:w??X??z.defaultError};if(H.code!=="invalid_type")return{message:z.defaultError};return{message:w??Q??z.defaultError}},description:Y}}class I{get description(){return this._def.description}_getType($){return Z2($.data)}_getOrReturnCtx($,W){return W||{common:$.parent.common,data:$.data,parsedType:Z2($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new K$,ctx:{common:$.parent.common,data:$.data,parsedType:Z2($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let W=this._parse($);if(Y8(W))throw Error("Synchronous parse encountered promise.");return W}_parseAsync($){let W=this._parse($);return Promise.resolve(W)}parse($,W){let Q=this.safeParse($,W);if(Q.success)return Q.data;throw Q.error}safeParse($,W){let Q={common:{issues:[],async:W?.async??!1,contextualErrorMap:W?.errorMap},path:W?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:Z2($)},X=this._parseSync({data:$,path:Q.path,parent:Q});return w4(Q,X)}"~validate"($){let W={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:Z2($)};if(!this["~standard"].async)try{let Q=this._parseSync({data:$,path:[],parent:W});return XW(Q)?{value:Q.value}:{issues:W.common.issues}}catch(Q){if(Q?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;W.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:W}).then((Q)=>XW(Q)?{value:Q.value}:{issues:W.common.issues})}async parseAsync($,W){let Q=await this.safeParseAsync($,W);if(Q.success)return Q.data;throw Q.error}async safeParseAsync($,W){let Q={common:{issues:[],contextualErrorMap:W?.errorMap,async:!0},path:W?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:Z2($)},X=this._parse({data:$,path:Q.path,parent:Q}),Y=await(Y8(X)?X:Promise.resolve(X));return w4(Q,Y)}refine($,W){let Q=(X)=>{if(typeof W==="string"||typeof W>"u")return{message:W};else if(typeof W==="function")return W(X);else return W};return this._refinement((X,Y)=>{let q=$(X),H=()=>Y.addIssue({code:L.custom,...Q(X)});if(typeof Promise<"u"&&q instanceof Promise)return q.then((z)=>{if(!z)return H(),!1;else return!0});if(!q)return H(),!1;else return!0})}refinement($,W){return this._refinement((Q,X)=>{if(!$(Q))return X.addIssue(typeof W==="function"?W(Q,X):W),!1;else return!0})}_refinement($){return new C2({schema:this,typeName:V.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,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:(W)=>this["~validate"](W)}}optional(){return R2.create(this,this._def)}nullable(){return p2.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return j2.create(this)}promise(){return VW.create(this,this._def)}or($){return B8.create([this,$],this._def)}and($){return w8.create(this,$,this._def)}transform($){return new C2({...E(this._def),schema:this,typeName:V.ZodEffects,effect:{type:"transform",transform:$}})}default($){let W=typeof $==="function"?$:()=>$;return new D8({...E(this._def),innerType:this,defaultValue:W,typeName:V.ZodDefault})}brand(){return new ZQ({typeName:V.ZodBranded,type:this,...E(this._def)})}catch($){let W=typeof $==="function"?$:()=>$;return new _8({...E(this._def),innerType:this,catchValue:W,typeName:V.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return m8.create(this,$)}readonly(){return N8.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var A3=/^c[^\s-]{8,}$/i,D3=/^[0-9a-z]+$/,_3=/^[0-9A-HJKMNP-TV-Z]{26}$/i,N3=/^[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,L3=/^[a-z0-9_-]{21}$/i,S3=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,O3=/^[-+]?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)?)??$/,b3=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,j3="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",DX,R3=/^(?:(?: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])$/,F3=/^(?:(?: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])$/,C3=/^(([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]))$/,K3=/^(([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])$/,V3=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,P3=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,U4="((\\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])))",Z3=new RegExp(`^${U4}$`);function A4($){let W="[0-5]\\d";if($.precision)W=`${W}\\.\\d{${$.precision}}`;else if($.precision==null)W=`${W}(\\.\\d+)?`;let Q=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${W})${Q}`}function E3($){return new RegExp(`^${A4($)}$`)}function D4($){let W=`${U4}T${A4($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return W=`${W}(${Q.join("|")})`,new RegExp(`^${W}$`)}function k3($,W){if((W==="v4"||!W)&&R3.test($))return!0;if((W==="v6"||!W)&&C3.test($))return!0;return!1}function I3($,W){if(!S3.test($))return!1;try{let[Q]=$.split(".");if(!Q)return!1;let X=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),Y=JSON.parse(atob(X));if(typeof Y!=="object"||Y===null)return!1;if("typ"in Y&&Y?.typ!=="JWT")return!1;if(!Y.alg)return!1;if(W&&Y.alg!==W)return!1;return!0}catch{return!1}}function x3($,W){if((W==="v4"||!W)&&F3.test($))return!0;if((W==="v6"||!W)&&K3.test($))return!0;return!1}class b2 extends I{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==S.string){let Y=this._getOrReturnCtx($);return O(Y,{code:L.invalid_type,expected:S.string,received:Y.parsedType}),K}let Q=new K$,X=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if($.data.length<Y.value)X=this._getOrReturnCtx($,X),O(X,{code:L.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="max"){if($.data.length>Y.value)X=this._getOrReturnCtx($,X),O(X,{code:L.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="length"){let q=$.data.length>Y.value,H=$.data.length<Y.value;if(q||H){if(X=this._getOrReturnCtx($,X),q)O(X,{code:L.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(H)O(X,{code:L.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});Q.dirty()}}else if(Y.kind==="email"){if(!b3.test($.data))X=this._getOrReturnCtx($,X),O(X,{validation:"email",code:L.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="emoji"){if(!DX)DX=new RegExp(j3,"u");if(!DX.test($.data))X=this._getOrReturnCtx($,X),O(X,{validation:"emoji",code:L.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="uuid"){if(!N3.test($.data))X=this._getOrReturnCtx($,X),O(X,{validation:"uuid",code:L.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="nanoid"){if(!L3.test($.data))X=this._getOrReturnCtx($,X),O(X,{validation:"nanoid",code:L.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid"){if(!A3.test($.data))X=this._getOrReturnCtx($,X),O(X,{validation:"cuid",code:L.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid2"){if(!D3.test($.data))X=this._getOrReturnCtx($,X),O(X,{validation:"cuid2",code:L.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ulid"){if(!_3.test($.data))X=this._getOrReturnCtx($,X),O(X,{validation:"ulid",code:L.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="url")try{new URL($.data)}catch{X=this._getOrReturnCtx($,X),O(X,{validation:"url",code:L.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="regex"){if(Y.regex.lastIndex=0,!Y.regex.test($.data))X=this._getOrReturnCtx($,X),O(X,{validation:"regex",code:L.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="trim")$.data=$.data.trim();else if(Y.kind==="includes"){if(!$.data.includes(Y.value,Y.position))X=this._getOrReturnCtx($,X),O(X,{code:L.invalid_string,validation:{includes:Y.value,position:Y.position},message:Y.message}),Q.dirty()}else if(Y.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(Y.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(Y.kind==="startsWith"){if(!$.data.startsWith(Y.value))X=this._getOrReturnCtx($,X),O(X,{code:L.invalid_string,validation:{startsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="endsWith"){if(!$.data.endsWith(Y.value))X=this._getOrReturnCtx($,X),O(X,{code:L.invalid_string,validation:{endsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="datetime"){if(!D4(Y).test($.data))X=this._getOrReturnCtx($,X),O(X,{code:L.invalid_string,validation:"datetime",message:Y.message}),Q.dirty()}else if(Y.kind==="date"){if(!Z3.test($.data))X=this._getOrReturnCtx($,X),O(X,{code:L.invalid_string,validation:"date",message:Y.message}),Q.dirty()}else if(Y.kind==="time"){if(!E3(Y).test($.data))X=this._getOrReturnCtx($,X),O(X,{code:L.invalid_string,validation:"time",message:Y.message}),Q.dirty()}else if(Y.kind==="duration"){if(!O3.test($.data))X=this._getOrReturnCtx($,X),O(X,{validation:"duration",code:L.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ip"){if(!k3($.data,Y.version))X=this._getOrReturnCtx($,X),O(X,{validation:"ip",code:L.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="jwt"){if(!I3($.data,Y.alg))X=this._getOrReturnCtx($,X),O(X,{validation:"jwt",code:L.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cidr"){if(!x3($.data,Y.version))X=this._getOrReturnCtx($,X),O(X,{validation:"cidr",code:L.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64"){if(!V3.test($.data))X=this._getOrReturnCtx($,X),O(X,{validation:"base64",code:L.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64url"){if(!P3.test($.data))X=this._getOrReturnCtx($,X),O(X,{validation:"base64url",code:L.invalid_string,message:Y.message}),Q.dirty()}else v.assertNever(Y);return{status:Q.value,value:$.data}}_regex($,W,Q){return this.refinement((X)=>$.test(X),{validation:W,code:L.invalid_string,...C.errToObj(Q)})}_addCheck($){return new b2({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...C.errToObj($)})}url($){return this._addCheck({kind:"url",...C.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...C.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...C.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...C.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...C.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...C.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...C.errToObj($)})}base64($){return this._addCheck({kind:"base64",...C.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...C.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...C.errToObj($)})}ip($){return this._addCheck({kind:"ip",...C.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...C.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision>"u"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...C.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision>"u"?null:$?.precision,...C.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...C.errToObj($)})}regex($,W){return this._addCheck({kind:"regex",regex:$,...C.errToObj(W)})}includes($,W){return this._addCheck({kind:"includes",value:$,position:W?.position,...C.errToObj(W?.message)})}startsWith($,W){return this._addCheck({kind:"startsWith",value:$,...C.errToObj(W)})}endsWith($,W){return this._addCheck({kind:"endsWith",value:$,...C.errToObj(W)})}min($,W){return this._addCheck({kind:"min",value:$,...C.errToObj(W)})}max($,W){return this._addCheck({kind:"max",value:$,...C.errToObj(W)})}length($,W){return this._addCheck({kind:"length",value:$,...C.errToObj(W)})}nonempty($){return this.min(1,C.errToObj($))}trim(){return new b2({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new b2({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new b2({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let W of this._def.checks)if(W.kind==="min"){if($===null||W.value>$)$=W.value}return $}get maxLength(){let $=null;for(let W of this._def.checks)if(W.kind==="max"){if($===null||W.value<$)$=W.value}return $}}b2.create=($)=>{return new b2({checks:[],typeName:V.ZodString,coerce:$?.coerce??!1,...E($)})};function g3($,W){let Q=($.toString().split(".")[1]||"").length,X=(W.toString().split(".")[1]||"").length,Y=Q>X?Q:X,q=Number.parseInt($.toFixed(Y).replace(".","")),H=Number.parseInt(W.toFixed(Y).replace(".",""));return q%H/10**Y}class qW extends I{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==S.number){let Y=this._getOrReturnCtx($);return O(Y,{code:L.invalid_type,expected:S.number,received:Y.parsedType}),K}let Q=void 0,X=new K$;for(let Y of this._def.checks)if(Y.kind==="int"){if(!v.isInteger($.data))Q=this._getOrReturnCtx($,Q),O(Q,{code:L.invalid_type,expected:"integer",received:"float",message:Y.message}),X.dirty()}else if(Y.kind==="min"){if(Y.inclusive?$.data<Y.value:$.data<=Y.value)Q=this._getOrReturnCtx($,Q),O(Q,{code:L.too_small,minimum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),X.dirty()}else if(Y.kind==="max"){if(Y.inclusive?$.data>Y.value:$.data>=Y.value)Q=this._getOrReturnCtx($,Q),O(Q,{code:L.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),X.dirty()}else if(Y.kind==="multipleOf"){if(g3($.data,Y.value)!==0)Q=this._getOrReturnCtx($,Q),O(Q,{code:L.not_multiple_of,multipleOf:Y.value,message:Y.message}),X.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),O(Q,{code:L.not_finite,message:Y.message}),X.dirty()}else v.assertNever(Y);return{status:X.value,value:$.data}}gte($,W){return this.setLimit("min",$,!0,C.toString(W))}gt($,W){return this.setLimit("min",$,!1,C.toString(W))}lte($,W){return this.setLimit("max",$,!0,C.toString(W))}lt($,W){return this.setLimit("max",$,!1,C.toString(W))}setLimit($,W,Q,X){return new qW({...this._def,checks:[...this._def.checks,{kind:$,value:W,inclusive:Q,message:C.toString(X)}]})}_addCheck($){return new qW({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:C.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:C.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:C.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:C.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:C.toString($)})}multipleOf($,W){return this._addCheck({kind:"multipleOf",value:$,message:C.toString(W)})}finite($){return this._addCheck({kind:"finite",message:C.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:C.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:C.toString($)})}get minValue(){let $=null;for(let W of this._def.checks)if(W.kind==="min"){if($===null||W.value>$)$=W.value}return $}get maxValue(){let $=null;for(let W of this._def.checks)if(W.kind==="max"){if($===null||W.value<$)$=W.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&v.isInteger($.value))}get isFinite(){let $=null,W=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(W===null||Q.value>W)W=Q.value}else if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return Number.isFinite(W)&&Number.isFinite($)}}qW.create=($)=>{return new qW({checks:[],typeName:V.ZodNumber,coerce:$?.coerce||!1,...E($)})};class HW extends I{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==S.bigint)return this._getInvalidInput($);let Q=void 0,X=new K$;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?$.data<Y.value:$.data<=Y.value)Q=this._getOrReturnCtx($,Q),O(Q,{code:L.too_small,type:"bigint",minimum:Y.value,inclusive:Y.inclusive,message:Y.message}),X.dirty()}else if(Y.kind==="max"){if(Y.inclusive?$.data>Y.value:$.data>=Y.value)Q=this._getOrReturnCtx($,Q),O(Q,{code:L.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),X.dirty()}else if(Y.kind==="multipleOf"){if($.data%Y.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),O(Q,{code:L.not_multiple_of,multipleOf:Y.value,message:Y.message}),X.dirty()}else v.assertNever(Y);return{status:X.value,value:$.data}}_getInvalidInput($){let W=this._getOrReturnCtx($);return O(W,{code:L.invalid_type,expected:S.bigint,received:W.parsedType}),K}gte($,W){return this.setLimit("min",$,!0,C.toString(W))}gt($,W){return this.setLimit("min",$,!1,C.toString(W))}lte($,W){return this.setLimit("max",$,!0,C.toString(W))}lt($,W){return this.setLimit("max",$,!1,C.toString(W))}setLimit($,W,Q,X){return new HW({...this._def,checks:[...this._def.checks,{kind:$,value:W,inclusive:Q,message:C.toString(X)}]})}_addCheck($){return new HW({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:C.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:C.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:C.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:C.toString($)})}multipleOf($,W){return this._addCheck({kind:"multipleOf",value:$,message:C.toString(W)})}get minValue(){let $=null;for(let W of this._def.checks)if(W.kind==="min"){if($===null||W.value>$)$=W.value}return $}get maxValue(){let $=null;for(let W of this._def.checks)if(W.kind==="max"){if($===null||W.value<$)$=W.value}return $}}HW.create=($)=>{return new HW({checks:[],typeName:V.ZodBigInt,coerce:$?.coerce??!1,...E($)})};class z8 extends I{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==S.boolean){let Q=this._getOrReturnCtx($);return O(Q,{code:L.invalid_type,expected:S.boolean,received:Q.parsedType}),K}return I$($.data)}}z8.create=($)=>{return new z8({typeName:V.ZodBoolean,coerce:$?.coerce||!1,...E($)})};class FW extends I{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==S.date){let Y=this._getOrReturnCtx($);return O(Y,{code:L.invalid_type,expected:S.date,received:Y.parsedType}),K}if(Number.isNaN($.data.getTime())){let Y=this._getOrReturnCtx($);return O(Y,{code:L.invalid_date}),K}let Q=new K$,X=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if($.data.getTime()<Y.value)X=this._getOrReturnCtx($,X),O(X,{code:L.too_small,message:Y.message,inclusive:!0,exact:!1,minimum:Y.value,type:"date"}),Q.dirty()}else if(Y.kind==="max"){if($.data.getTime()>Y.value)X=this._getOrReturnCtx($,X),O(X,{code:L.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),Q.dirty()}else v.assertNever(Y);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new FW({...this._def,checks:[...this._def.checks,$]})}min($,W){return this._addCheck({kind:"min",value:$.getTime(),message:C.toString(W)})}max($,W){return this._addCheck({kind:"max",value:$.getTime(),message:C.toString(W)})}get minDate(){let $=null;for(let W of this._def.checks)if(W.kind==="min"){if($===null||W.value>$)$=W.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let W of this._def.checks)if(W.kind==="max"){if($===null||W.value<$)$=W.value}return $!=null?new Date($):null}}FW.create=($)=>{return new FW({checks:[],coerce:$?.coerce||!1,typeName:V.ZodDate,...E($)})};class T8 extends I{_parse($){if(this._getType($)!==S.symbol){let Q=this._getOrReturnCtx($);return O(Q,{code:L.invalid_type,expected:S.symbol,received:Q.parsedType}),K}return I$($.data)}}T8.create=($)=>{return new T8({typeName:V.ZodSymbol,...E($)})};class J8 extends I{_parse($){if(this._getType($)!==S.undefined){let Q=this._getOrReturnCtx($);return O(Q,{code:L.invalid_type,expected:S.undefined,received:Q.parsedType}),K}return I$($.data)}}J8.create=($)=>{return new J8({typeName:V.ZodUndefined,...E($)})};class M8 extends I{_parse($){if(this._getType($)!==S.null){let Q=this._getOrReturnCtx($);return O(Q,{code:L.invalid_type,expected:S.null,received:Q.parsedType}),K}return I$($.data)}}M8.create=($)=>{return new M8({typeName:V.ZodNull,...E($)})};class CW extends I{constructor(){super(...arguments);this._any=!0}_parse($){return I$($.data)}}CW.create=($)=>{return new CW({typeName:V.ZodAny,...E($)})};class YW extends I{constructor(){super(...arguments);this._unknown=!0}_parse($){return I$($.data)}}YW.create=($)=>{return new YW({typeName:V.ZodUnknown,...E($)})};class E2 extends I{_parse($){let W=this._getOrReturnCtx($);return O(W,{code:L.invalid_type,expected:S.never,received:W.parsedType}),K}}E2.create=($)=>{return new E2({typeName:V.ZodNever,...E($)})};class v8 extends I{_parse($){if(this._getType($)!==S.undefined){let Q=this._getOrReturnCtx($);return O(Q,{code:L.invalid_type,expected:S.void,received:Q.parsedType}),K}return I$($.data)}}v8.create=($)=>{return new v8({typeName:V.ZodVoid,...E($)})};class j2 extends I{_parse($){let{ctx:W,status:Q}=this._processInputParams($),X=this._def;if(W.parsedType!==S.array)return O(W,{code:L.invalid_type,expected:S.array,received:W.parsedType}),K;if(X.exactLength!==null){let q=W.data.length>X.exactLength.value,H=W.data.length<X.exactLength.value;if(q||H)O(W,{code:q?L.too_big:L.too_small,minimum:H?X.exactLength.value:void 0,maximum:q?X.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:X.exactLength.message}),Q.dirty()}if(X.minLength!==null){if(W.data.length<X.minLength.value)O(W,{code:L.too_small,minimum:X.minLength.value,type:"array",inclusive:!0,exact:!1,message:X.minLength.message}),Q.dirty()}if(X.maxLength!==null){if(W.data.length>X.maxLength.value)O(W,{code:L.too_big,maximum:X.maxLength.value,type:"array",inclusive:!0,exact:!1,message:X.maxLength.message}),Q.dirty()}if(W.common.async)return Promise.all([...W.data].map((q,H)=>{return X.type._parseAsync(new F2(W,q,W.path,H))})).then((q)=>{return K$.mergeArray(Q,q)});let Y=[...W.data].map((q,H)=>{return X.type._parseSync(new F2(W,q,W.path,H))});return K$.mergeArray(Q,Y)}get element(){return this._def.type}min($,W){return new j2({...this._def,minLength:{value:$,message:C.toString(W)}})}max($,W){return new j2({...this._def,maxLength:{value:$,message:C.toString(W)}})}length($,W){return new j2({...this._def,exactLength:{value:$,message:C.toString(W)}})}nonempty($){return this.min(1,$)}}j2.create=($,W)=>{return new j2({type:$,minLength:null,maxLength:null,exactLength:null,typeName:V.ZodArray,...E(W)})};function q8($){if($ instanceof J$){let W={};for(let Q in $.shape){let X=$.shape[Q];W[Q]=R2.create(q8(X))}return new J$({...$._def,shape:()=>W})}else if($ instanceof j2)return new j2({...$._def,type:q8($.element)});else if($ instanceof R2)return R2.create(q8($.unwrap()));else if($ instanceof p2)return p2.create(q8($.unwrap()));else if($ instanceof k2)return k2.create($.items.map((W)=>q8(W)));else return $}class J$ extends I{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),W=v.objectKeys($);return this._cached={shape:$,keys:W},this._cached}_parse($){if(this._getType($)!==S.object){let w=this._getOrReturnCtx($);return O(w,{code:L.invalid_type,expected:S.object,received:w.parsedType}),K}let{status:Q,ctx:X}=this._processInputParams($),{shape:Y,keys:q}=this._getCached(),H=[];if(!(this._def.catchall instanceof E2&&this._def.unknownKeys==="strip")){for(let w in X.data)if(!q.includes(w))H.push(w)}let z=[];for(let w of q){let N=Y[w],_=X.data[w];z.push({key:{status:"valid",value:w},value:N._parse(new F2(X,_,X.path,w)),alwaysSet:w in X.data})}if(this._def.catchall instanceof E2){let w=this._def.unknownKeys;if(w==="passthrough")for(let N of H)z.push({key:{status:"valid",value:N},value:{status:"valid",value:X.data[N]}});else if(w==="strict"){if(H.length>0)O(X,{code:L.unrecognized_keys,keys:H}),Q.dirty()}else if(w==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let w=this._def.catchall;for(let N of H){let _=X.data[N];z.push({key:{status:"valid",value:N},value:w._parse(new F2(X,_,X.path,N)),alwaysSet:N in X.data})}}if(X.common.async)return Promise.resolve().then(async()=>{let w=[];for(let N of z){let _=await N.key,x=await N.value;w.push({key:_,value:x,alwaysSet:N.alwaysSet})}return w}).then((w)=>{return K$.mergeObjectSync(Q,w)});else return K$.mergeObjectSync(Q,z)}get shape(){return this._def.shape()}strict($){return C.errToObj,new J$({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(W,Q)=>{let X=this._def.errorMap?.(W,Q).message??Q.defaultError;if(W.code==="unrecognized_keys")return{message:C.errToObj($).message??X};return{message:X}}}:{}})}strip(){return new J$({...this._def,unknownKeys:"strip"})}passthrough(){return new J$({...this._def,unknownKeys:"passthrough"})}extend($){return new J$({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new J$({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:V.ZodObject})}setKey($,W){return this.augment({[$]:W})}catchall($){return new J$({...this._def,catchall:$})}pick($){let W={};for(let Q of v.objectKeys($))if($[Q]&&this.shape[Q])W[Q]=this.shape[Q];return new J$({...this._def,shape:()=>W})}omit($){let W={};for(let Q of v.objectKeys(this.shape))if(!$[Q])W[Q]=this.shape[Q];return new J$({...this._def,shape:()=>W})}deepPartial(){return q8(this)}partial($){let W={};for(let Q of v.objectKeys(this.shape)){let X=this.shape[Q];if($&&!$[Q])W[Q]=X;else W[Q]=X.optional()}return new J$({...this._def,shape:()=>W})}required($){let W={};for(let Q of v.objectKeys(this.shape))if($&&!$[Q])W[Q]=this.shape[Q];else{let Y=this.shape[Q];while(Y instanceof R2)Y=Y._def.innerType;W[Q]=Y}return new J$({...this._def,shape:()=>W})}keyof(){return _4(v.objectKeys(this.shape))}}J$.create=($,W)=>{return new J$({shape:()=>$,unknownKeys:"strip",catchall:E2.create(),typeName:V.ZodObject,...E(W)})};J$.strictCreate=($,W)=>{return new J$({shape:()=>$,unknownKeys:"strict",catchall:E2.create(),typeName:V.ZodObject,...E(W)})};J$.lazycreate=($,W)=>{return new J$({shape:$,unknownKeys:"strip",catchall:E2.create(),typeName:V.ZodObject,...E(W)})};class B8 extends I{_parse($){let{ctx:W}=this._processInputParams($),Q=this._def.options;function X(Y){for(let H of Y)if(H.result.status==="valid")return H.result;for(let H of Y)if(H.result.status==="dirty")return W.common.issues.push(...H.ctx.common.issues),H.result;let q=Y.map((H)=>new m$(H.ctx.common.issues));return O(W,{code:L.invalid_union,unionErrors:q}),K}if(W.common.async)return Promise.all(Q.map(async(Y)=>{let q={...W,common:{...W.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:W.data,path:W.path,parent:q}),ctx:q}})).then(X);else{let Y=void 0,q=[];for(let z of Q){let w={...W,common:{...W.common,issues:[]},parent:null},N=z._parseSync({data:W.data,path:W.path,parent:w});if(N.status==="valid")return N;else if(N.status==="dirty"&&!Y)Y={result:N,ctx:w};if(w.common.issues.length)q.push(w.common.issues)}if(Y)return W.common.issues.push(...Y.ctx.common.issues),Y.result;let H=q.map((z)=>new m$(z));return O(W,{code:L.invalid_union,unionErrors:H}),K}}get options(){return this._def.options}}B8.create=($,W)=>{return new B8({options:$,typeName:V.ZodUnion,...E(W)})};var i2=($)=>{if($ instanceof G8)return i2($.schema);else if($ instanceof C2)return i2($.innerType());else if($ instanceof U8)return[$.value];else if($ instanceof zW)return $.options;else if($ instanceof A8)return v.objectValues($.enum);else if($ instanceof D8)return i2($._def.innerType);else if($ instanceof J8)return[void 0];else if($ instanceof M8)return[null];else if($ instanceof R2)return[void 0,...i2($.unwrap())];else if($ instanceof p2)return[null,...i2($.unwrap())];else if($ instanceof ZQ)return i2($.unwrap());else if($ instanceof N8)return i2($.unwrap());else if($ instanceof _8)return i2($._def.innerType);else return[]};class PQ extends I{_parse($){let{ctx:W}=this._processInputParams($);if(W.parsedType!==S.object)return O(W,{code:L.invalid_type,expected:S.object,received:W.parsedType}),K;let Q=this.discriminator,X=W.data[Q],Y=this.optionsMap.get(X);if(!Y)return O(W,{code:L.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),K;if(W.common.async)return Y._parseAsync({data:W.data,path:W.path,parent:W});else return Y._parseSync({data:W.data,path:W.path,parent:W})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,W,Q){let X=new Map;for(let Y of W){let q=i2(Y.shape[$]);if(!q.length)throw Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let H of q){if(X.has(H))throw Error(`Discriminator property ${String($)} has duplicate value ${String(H)}`);X.set(H,Y)}}return new PQ({typeName:V.ZodDiscriminatedUnion,discriminator:$,options:W,optionsMap:X,...E(Q)})}}function _X($,W){let Q=Z2($),X=Z2(W);if($===W)return{valid:!0,data:$};else if(Q===S.object&&X===S.object){let Y=v.objectKeys(W),q=v.objectKeys($).filter((z)=>Y.indexOf(z)!==-1),H={...$,...W};for(let z of q){let w=_X($[z],W[z]);if(!w.valid)return{valid:!1};H[z]=w.data}return{valid:!0,data:H}}else if(Q===S.array&&X===S.array){if($.length!==W.length)return{valid:!1};let Y=[];for(let q=0;q<$.length;q++){let H=$[q],z=W[q],w=_X(H,z);if(!w.valid)return{valid:!1};Y.push(w.data)}return{valid:!0,data:Y}}else if(Q===S.date&&X===S.date&&+$===+W)return{valid:!0,data:$};else return{valid:!1}}class w8 extends I{_parse($){let{status:W,ctx:Q}=this._processInputParams($),X=(Y,q)=>{if(KQ(Y)||KQ(q))return K;let H=_X(Y.value,q.value);if(!H.valid)return O(Q,{code:L.invalid_intersection_types}),K;if(VQ(Y)||VQ(q))W.dirty();return{status:W.value,value:H.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([Y,q])=>X(Y,q));else return X(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}}w8.create=($,W,Q)=>{return new w8({left:$,right:W,typeName:V.ZodIntersection,...E(Q)})};class k2 extends I{_parse($){let{status:W,ctx:Q}=this._processInputParams($);if(Q.parsedType!==S.array)return O(Q,{code:L.invalid_type,expected:S.array,received:Q.parsedType}),K;if(Q.data.length<this._def.items.length)return O(Q,{code:L.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),K;if(!this._def.rest&&Q.data.length>this._def.items.length)O(Q,{code:L.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),W.dirty();let Y=[...Q.data].map((q,H)=>{let z=this._def.items[H]||this._def.rest;if(!z)return null;return z._parse(new F2(Q,q,Q.path,H))}).filter((q)=>!!q);if(Q.common.async)return Promise.all(Y).then((q)=>{return K$.mergeArray(W,q)});else return K$.mergeArray(W,Y)}get items(){return this._def.items}rest($){return new k2({...this._def,rest:$})}}k2.create=($,W)=>{if(!Array.isArray($))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new k2({items:$,typeName:V.ZodTuple,rest:null,...E(W)})};class d8 extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:W,ctx:Q}=this._processInputParams($);if(Q.parsedType!==S.object)return O(Q,{code:L.invalid_type,expected:S.object,received:Q.parsedType}),K;let X=[],Y=this._def.keyType,q=this._def.valueType;for(let H in Q.data)X.push({key:Y._parse(new F2(Q,H,Q.path,H)),value:q._parse(new F2(Q,Q.data[H],Q.path,H)),alwaysSet:H in Q.data});if(Q.common.async)return K$.mergeObjectAsync(W,X);else return K$.mergeObjectSync(W,X)}get element(){return this._def.valueType}static create($,W,Q){if(W instanceof I)return new d8({keyType:$,valueType:W,typeName:V.ZodRecord,...E(Q)});return new d8({keyType:b2.create(),valueType:$,typeName:V.ZodRecord,...E(W)})}}class h8 extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:W,ctx:Q}=this._processInputParams($);if(Q.parsedType!==S.map)return O(Q,{code:L.invalid_type,expected:S.map,received:Q.parsedType}),K;let X=this._def.keyType,Y=this._def.valueType,q=[...Q.data.entries()].map(([H,z],w)=>{return{key:X._parse(new F2(Q,H,Q.path,[w,"key"])),value:Y._parse(new F2(Q,z,Q.path,[w,"value"]))}});if(Q.common.async){let H=new Map;return Promise.resolve().then(async()=>{for(let z of q){let w=await z.key,N=await z.value;if(w.status==="aborted"||N.status==="aborted")return K;if(w.status==="dirty"||N.status==="dirty")W.dirty();H.set(w.value,N.value)}return{status:W.value,value:H}})}else{let H=new Map;for(let z of q){let{key:w,value:N}=z;if(w.status==="aborted"||N.status==="aborted")return K;if(w.status==="dirty"||N.status==="dirty")W.dirty();H.set(w.value,N.value)}return{status:W.value,value:H}}}}h8.create=($,W,Q)=>{return new h8({valueType:W,keyType:$,typeName:V.ZodMap,...E(Q)})};class KW extends I{_parse($){let{status:W,ctx:Q}=this._processInputParams($);if(Q.parsedType!==S.set)return O(Q,{code:L.invalid_type,expected:S.set,received:Q.parsedType}),K;let X=this._def;if(X.minSize!==null){if(Q.data.size<X.minSize.value)O(Q,{code:L.too_small,minimum:X.minSize.value,type:"set",inclusive:!0,exact:!1,message:X.minSize.message}),W.dirty()}if(X.maxSize!==null){if(Q.data.size>X.maxSize.value)O(Q,{code:L.too_big,maximum:X.maxSize.value,type:"set",inclusive:!0,exact:!1,message:X.maxSize.message}),W.dirty()}let Y=this._def.valueType;function q(z){let w=new Set;for(let N of z){if(N.status==="aborted")return K;if(N.status==="dirty")W.dirty();w.add(N.value)}return{status:W.value,value:w}}let H=[...Q.data.values()].map((z,w)=>Y._parse(new F2(Q,z,Q.path,w)));if(Q.common.async)return Promise.all(H).then((z)=>q(z));else return q(H)}min($,W){return new KW({...this._def,minSize:{value:$,message:C.toString(W)}})}max($,W){return new KW({...this._def,maxSize:{value:$,message:C.toString(W)}})}size($,W){return this.min($,W).max($,W)}nonempty($){return this.min(1,$)}}KW.create=($,W)=>{return new KW({valueType:$,minSize:null,maxSize:null,typeName:V.ZodSet,...E(W)})};class H8 extends I{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:W}=this._processInputParams($);if(W.parsedType!==S.function)return O(W,{code:L.invalid_type,expected:S.function,received:W.parsedType}),K;function Q(H,z){return f8({data:H,path:W.path,errorMaps:[W.common.contextualErrorMap,W.schemaErrorMap,X8(),o2].filter((w)=>!!w),issueData:{code:L.invalid_arguments,argumentsError:z}})}function X(H,z){return f8({data:H,path:W.path,errorMaps:[W.common.contextualErrorMap,W.schemaErrorMap,X8(),o2].filter((w)=>!!w),issueData:{code:L.invalid_return_type,returnTypeError:z}})}let Y={errorMap:W.common.contextualErrorMap},q=W.data;if(this._def.returns instanceof VW){let H=this;return I$(async function(...z){let w=new m$([]),N=await H._def.args.parseAsync(z,Y).catch((B$)=>{throw w.addIssue(Q(z,B$)),w}),_=await Reflect.apply(q,this,N);return await H._def.returns._def.type.parseAsync(_,Y).catch((B$)=>{throw w.addIssue(X(_,B$)),w})})}else{let H=this;return I$(function(...z){let w=H._def.args.safeParse(z,Y);if(!w.success)throw new m$([Q(z,w.error)]);let N=Reflect.apply(q,this,w.data),_=H._def.returns.safeParse(N,Y);if(!_.success)throw new m$([X(N,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new H8({...this._def,args:k2.create($).rest(YW.create())})}returns($){return new H8({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,W,Q){return new H8({args:$?$:k2.create([]).rest(YW.create()),returns:W||YW.create(),typeName:V.ZodFunction,...E(Q)})}}class G8 extends I{get schema(){return this._def.getter()}_parse($){let{ctx:W}=this._processInputParams($);return this._def.getter()._parse({data:W.data,path:W.path,parent:W})}}G8.create=($,W)=>{return new G8({getter:$,typeName:V.ZodLazy,...E(W)})};class U8 extends I{_parse($){if($.data!==this._def.value){let W=this._getOrReturnCtx($);return O(W,{received:W.data,code:L.invalid_literal,expected:this._def.value}),K}return{status:"valid",value:$.data}}get value(){return this._def.value}}U8.create=($,W)=>{return new U8({value:$,typeName:V.ZodLiteral,...E(W)})};function _4($,W){return new zW({values:$,typeName:V.ZodEnum,...E(W)})}class zW extends I{_parse($){if(typeof $.data!=="string"){let W=this._getOrReturnCtx($),Q=this._def.values;return O(W,{expected:v.joinValues(Q),received:W.parsedType,code:L.invalid_type}),K}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let W=this._getOrReturnCtx($),Q=this._def.values;return O(W,{received:W.data,code:L.invalid_enum_value,options:Q}),K}return I$($.data)}get options(){return this._def.values}get enum(){let $={};for(let W of this._def.values)$[W]=W;return $}get Values(){let $={};for(let W of this._def.values)$[W]=W;return $}get Enum(){let $={};for(let W of this._def.values)$[W]=W;return $}extract($,W=this._def){return zW.create($,{...this._def,...W})}exclude($,W=this._def){return zW.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,...W})}}zW.create=_4;class A8 extends I{_parse($){let W=v.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==S.string&&Q.parsedType!==S.number){let X=v.objectValues(W);return O(Q,{expected:v.joinValues(X),received:Q.parsedType,code:L.invalid_type}),K}if(!this._cache)this._cache=new Set(v.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let X=v.objectValues(W);return O(Q,{received:Q.data,code:L.invalid_enum_value,options:X}),K}return I$($.data)}get enum(){return this._def.values}}A8.create=($,W)=>{return new A8({values:$,typeName:V.ZodNativeEnum,...E(W)})};class VW extends I{unwrap(){return this._def.type}_parse($){let{ctx:W}=this._processInputParams($);if(W.parsedType!==S.promise&&W.common.async===!1)return O(W,{code:L.invalid_type,expected:S.promise,received:W.parsedType}),K;let Q=W.parsedType===S.promise?W.data:Promise.resolve(W.data);return I$(Q.then((X)=>{return this._def.type.parseAsync(X,{path:W.path,errorMap:W.common.contextualErrorMap})}))}}VW.create=($,W)=>{return new VW({type:$,typeName:V.ZodPromise,...E(W)})};class C2 extends I{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===V.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:W,ctx:Q}=this._processInputParams($),X=this._def.effect||null,Y={addIssue:(q)=>{if(O(Q,q),q.fatal)W.abort();else W.dirty()},get path(){return Q.path}};if(Y.addIssue=Y.addIssue.bind(Y),X.type==="preprocess"){let q=X.transform(Q.data,Y);if(Q.common.async)return Promise.resolve(q).then(async(H)=>{if(W.value==="aborted")return K;let z=await this._def.schema._parseAsync({data:H,path:Q.path,parent:Q});if(z.status==="aborted")return K;if(z.status==="dirty")return RW(z.value);if(W.value==="dirty")return RW(z.value);return z});else{if(W.value==="aborted")return K;let H=this._def.schema._parseSync({data:q,path:Q.path,parent:Q});if(H.status==="aborted")return K;if(H.status==="dirty")return RW(H.value);if(W.value==="dirty")return RW(H.value);return H}}if(X.type==="refinement"){let q=(H)=>{let z=X.refinement(H,Y);if(Q.common.async)return Promise.resolve(z);if(z instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return H};if(Q.common.async===!1){let H=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(H.status==="aborted")return K;if(H.status==="dirty")W.dirty();return q(H.value),{status:W.value,value:H.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((H)=>{if(H.status==="aborted")return K;if(H.status==="dirty")W.dirty();return q(H.value).then(()=>{return{status:W.value,value:H.value}})})}if(X.type==="transform")if(Q.common.async===!1){let q=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!XW(q))return K;let H=X.transform(q.value,Y);if(H instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:W.value,value:H}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((q)=>{if(!XW(q))return K;return Promise.resolve(X.transform(q.value,Y)).then((H)=>({status:W.value,value:H}))});v.assertNever(X)}}C2.create=($,W,Q)=>{return new C2({schema:$,typeName:V.ZodEffects,effect:W,...E(Q)})};C2.createWithPreprocess=($,W,Q)=>{return new C2({schema:W,effect:{type:"preprocess",transform:$},typeName:V.ZodEffects,...E(Q)})};class R2 extends I{_parse($){if(this._getType($)===S.undefined)return I$(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}R2.create=($,W)=>{return new R2({innerType:$,typeName:V.ZodOptional,...E(W)})};class p2 extends I{_parse($){if(this._getType($)===S.null)return I$(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}p2.create=($,W)=>{return new p2({innerType:$,typeName:V.ZodNullable,...E(W)})};class D8 extends I{_parse($){let{ctx:W}=this._processInputParams($),Q=W.data;if(W.parsedType===S.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:W.path,parent:W})}removeDefault(){return this._def.innerType}}D8.create=($,W)=>{return new D8({innerType:$,typeName:V.ZodDefault,defaultValue:typeof W.default==="function"?W.default:()=>W.default,...E(W)})};class _8 extends I{_parse($){let{ctx:W}=this._processInputParams($),Q={...W,common:{...W.common,issues:[]}},X=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(Y8(X))return X.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new m$(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new m$(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}}_8.create=($,W)=>{return new _8({innerType:$,typeName:V.ZodCatch,catchValue:typeof W.catch==="function"?W.catch:()=>W.catch,...E(W)})};class y8 extends I{_parse($){if(this._getType($)!==S.nan){let Q=this._getOrReturnCtx($);return O(Q,{code:L.invalid_type,expected:S.nan,received:Q.parsedType}),K}return{status:"valid",value:$.data}}}y8.create=($)=>{return new y8({typeName:V.ZodNaN,...E($)})};var f3=Symbol("zod_brand");class ZQ extends I{_parse($){let{ctx:W}=this._processInputParams($),Q=W.data;return this._def.type._parse({data:Q,path:W.path,parent:W})}unwrap(){return this._def.type}}class m8 extends I{_parse($){let{status:W,ctx:Q}=this._processInputParams($);if(Q.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(Y.status==="aborted")return K;if(Y.status==="dirty")return W.dirty(),RW(Y.value);else return this._def.out._parseAsync({data:Y.value,path:Q.path,parent:Q})})();else{let X=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(X.status==="aborted")return K;if(X.status==="dirty")return W.dirty(),{status:"dirty",value:X.value};else return this._def.out._parseSync({data:X.value,path:Q.path,parent:Q})}}static create($,W){return new m8({in:$,out:W,typeName:V.ZodPipeline})}}class N8 extends I{_parse($){let W=this._def.innerType._parse($),Q=(X)=>{if(XW(X))X.value=Object.freeze(X.value);return X};return Y8(W)?W.then((X)=>Q(X)):Q(W)}unwrap(){return this._def.innerType}}N8.create=($,W)=>{return new N8({innerType:$,typeName:V.ZodReadonly,...E(W)})};function G4($,W){let Q=typeof $==="function"?$(W):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function N4($,W={},Q){if($)return CW.create().superRefine((X,Y)=>{let q=$(X);if(q instanceof Promise)return q.then((H)=>{if(!H){let z=G4(W,X),w=z.fatal??Q??!0;Y.addIssue({code:"custom",...z,fatal:w})}});if(!q){let H=G4(W,X),z=H.fatal??Q??!0;Y.addIssue({code:"custom",...H,fatal:z})}return});return CW.create()}var T3={object:J$.lazycreate},V;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(V||(V={}));var v3=($,W={message:`Input not instance of ${$.name}`})=>N4((Q)=>Q instanceof $,W),L4=b2.create,S4=qW.create,d3=y8.create,h3=HW.create,O4=z8.create,y3=FW.create,m3=T8.create,c3=J8.create,n3=M8.create,o3=CW.create,i3=YW.create,p3=E2.create,u3=v8.create,l3=j2.create,s3=J$.create,t3=J$.strictCreate,r3=B8.create,a3=PQ.create,e3=w8.create,$z=k2.create,Wz=d8.create,Qz=h8.create,Xz=KW.create,Yz=H8.create,qz=G8.create,Hz=U8.create,zz=zW.create,Jz=A8.create,Mz=VW.create,Bz=C2.create,wz=R2.create,Gz=p2.create,Uz=C2.createWithPreprocess,Az=m8.create,Dz=()=>L4().optional(),_z=()=>S4().optional(),Nz=()=>O4().optional(),Lz={string:($)=>b2.create({...$,coerce:!0}),number:($)=>qW.create({...$,coerce:!0}),boolean:($)=>z8.create({...$,coerce:!0}),bigint:($)=>HW.create({...$,coerce:!0}),date:($)=>FW.create({...$,coerce:!0})};var Sz=K;var Oz=EQ,L8=($,W=400)=>Response.json($,{status:W,headers:{"Content-Type":"application/json"}}),b4=($)=>{let W=CQ.Compile($);return async(Q,X)=>{try{let Y=await Q.jsonBody();if(!W.Check(Y)){let q=W.Errors(Y).First();return L8({status:"error",code:"VALIDATION_FAILED",message:q?.message||"Invalid input",path:q?.path||"body"})}return Q.body=Y,X?X():void 0}catch{return L8({status:"error",message:"Malformed JSON payload"})}}},j4=($)=>{let W=$.properties||{},Q=Object.keys(W),X=Q.length;return async(Y,q)=>{try{let H=Y instanceof Object&&"req"in Y,w=await(H?Y.req:Y).json();for(let N=0;N<X;N++){let _=Q[N];if(typeof w[_]!==W[_]?.type)return L8({status:"error",code:"TYPE_MISMATCH",message:`Field '${_}' must be of type ${W[_]?.type}`,field:_})}if(H)Y.body=w;return q?q():void 0}catch{return L8({status:"error",message:"Invalid JSON payload"})}}},R4=($)=>{return async(W,Q)=>{try{let X=W instanceof Object&&"req"in W,q=await(X?W.req:W).json(),H=await $.safeParseAsync(q);if(!H.success)return L8({status:"error",code:"ZOD_ERROR",errors:H.error.flatten()});if(X)W.body=H.data;return Q?Q():void 0}catch{return L8({status:"error",message:"Invalid JSON payload"})}}},bz=($)=>{if($&&"_def"in $)return R4($);if($&&($.kind||$.type||$[Symbol.for("TypeBox.Kind")]))return b4($);return j4($)};var jz=($={})=>{let W=$.origin||"*",Q=$.methods||"GET,POST,PUT,PATCH,DELETE,OPTIONS";return async(Y,q)=>{if(Y.req.method==="OPTIONS")return new Response(null,{status:204,headers:{"Access-Control-Allow-Origin":W,"Access-Control-Allow-Methods":Q,"Access-Control-Allow-Headers":"Content-Type, Authorization"}});let H=await q?.();if(H instanceof Response)H.headers.set("Access-Control-Allow-Origin",W),H.headers.set("Access-Control-Allow-Methods",Q);return H}};import{join as Rz}from"path";var Fz=($="public")=>{return async(W,Q)=>{if(W.req.method!=="GET"&&W.req.method!=="HEAD")return Q();let X=new URL(W.req.url),Y=decodeURIComponent(X.pathname).replace(/^\//,""),q=Rz(process.cwd(),$,Y),H=Bun.file(q);if(await H.exists())return new Response(H);return Q()}};var LX=new TextEncoder,kQ=($)=>{return(typeof $==="string"?Buffer.from($).toString("base64"):Buffer.from($).toString("base64")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},Cz=($)=>{$=$.replace(/-/g,"+").replace(/_/g,"/");while($.length%4)$+="=";return Buffer.from($,"base64").toString()},NX=new Map,F4=async($)=>{if(NX.has($))return NX.get($);let W=await crypto.subtle.importKey("raw",LX.encode($),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);return NX.set($,W),W},Kz=async($,W)=>{let Q=JSON.stringify({alg:"HS256",typ:"JWT"}),X=JSON.stringify($),Y=kQ(Q),q=kQ(X),H=`${Y}.${q}`,z=await F4(W),w=await crypto.subtle.sign("HMAC",z,LX.encode(H)),N=kQ(new Uint8Array(w));return`${H}.${N}`},Vz=($)=>{return async(W,Q)=>{let X=W.req.headers.get("Authorization");if(!X?.startsWith("Bearer "))return W.status(401).send("Bearer token required");let q=X.slice(7).split(".");if(q.length!==3)return W.status(401).send("Malformed JWT token");let[H,z,w]=q,N=`${H}.${z}`;try{let _=await F4($),x=await crypto.subtle.sign("HMAC",_,LX.encode(N)),B$=kQ(new Uint8Array(x));if(w!==B$)return W.status(401).send("Invalid signature");let r$=JSON.parse(Cz(z));if(W.set("user",r$),Array.isArray(Q)){if(Q.length===0)return;let[c$,...L$]=Q;return c$(W,L$)}if(typeof Q==="function")return Q();return}catch(_){return console.error("[Auth] Error:",_),W.status(401).send("Token verification failed")}}};RQ();var C4={make:($)=>Bun.password.hash($,eW.hash),verify:($,W)=>Bun.password.verify($,W),needsRehash:($)=>{let{algorithm:W,memoryCost:Q,timeCost:X}=eW.hash;if(!$.startsWith(`$${W}$`))return!0;return!($.includes(`m=${Q}`)&&$.includes(`t=${X}`))}};export{R4 as zod,R4 as z,bz as validate,bz as v,b4 as typebox,b4 as t,Fz as staticFile,j4 as native,j4 as n,Kz as createToken,jz as cors,Vz as bareAuth,Oz as Zod,Oz as Z,pH as TypeBox,pH as Type,pH as T,C4 as Password,C4 as Hash,EW as BareRouter,u6 as BareJS};
123
+ \x1B[90m\u2699\uFE0F Pool Size: ${this.pool.length} | JIT: Enabled | Port: ${o}\x1B[0m
124
+ \x1B[36m\uD83D\uDEE1\uFE0F Hash: ${n.hash.algorithm} (${n.hash.memoryCost/1024}MB) | Iterations: ${n.hash.timeCost}\x1B[0m
125
+ `);let s=Bun.serve({port:o,hostname:t,fetch:this.fetch,reusePort:r}),a=()=>{let l=this.name,g=process.stdout.isTTY;{let R=g?"\uD83D\uDED1":"!",J=g?"\u2705":"v";process.stdout.write(`
126
+ \x1B[31m${R} Stopping ${l}...\x1B[0m
127
+ `),s.stop(),process.stdout.write(`\x1B[32m${J} ${l} has been stopped.\x1B[0m
128
+ `)}process.exit(0)};process.on("SIGINT",a),process.on("SIGTERM",a)}}function Vp(e){switch(e.errorType){case m.ArrayContains:return"Expected array to contain at least one matching value";case m.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case m.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case m.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case m.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case m.ArrayUniqueItems:return"Expected array elements to be unique";case m.Array:return"Expected array";case m.AsyncIterator:return"Expected AsyncIterator";case m.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case m.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case m.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case m.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case m.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case m.BigInt:return"Expected bigint";case m.Boolean:return"Expected boolean";case m.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case m.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case m.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case m.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case m.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case m.Date:return"Expected Date";case m.Function:return"Expected function";case m.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case m.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case m.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case m.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case m.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case m.Integer:return"Expected integer";case m.IntersectUnevaluatedProperties:return"Unexpected property";case m.Intersect:return"Expected all values to match";case m.Iterator:return"Expected Iterator";case m.Literal:return`Expected ${typeof e.schema.const==="string"?`'${e.schema.const}'`:e.schema.const}`;case m.Never:return"Never";case m.Not:return"Value should not match";case m.Null:return"Expected null";case m.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case m.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case m.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case m.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case m.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case m.Number:return"Expected number";case m.Object:return"Expected object";case m.ObjectAdditionalProperties:return"Unexpected property";case m.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case m.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case m.ObjectRequiredProperty:return"Expected required property";case m.Promise:return"Expected Promise";case m.RegExp:return"Expected string to match regular expression";case m.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case m.StringFormat:return`Expected string to match '${e.schema.format}' format`;case m.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case m.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case m.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case m.String:return"Expected string";case m.Symbol:return"Expected symbol";case m.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case m.Tuple:return"Expected tuple";case m.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case m.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case m.Uint8Array:return"Expected Uint8Array";case m.Undefined:return"Expected undefined";case m.Union:return"Expected union value";case m.Void:return"Expected void";case m.Kind:return`Expected kind '${e.schema[y]}'`;default:return"Unknown error type"}}var Hp=Vp;function za(){return Hp}class Wa extends v{constructor(e){super(`Unable to dereference schema with $id '${e.$ref}'`);this.schema=e}}function zp(e,t){let r=t.find((n)=>n.$id===e.$ref);if(r===void 0)throw new Wa(e);return Oe(r,t)}function fr(e,t){if(!_e(e.$id)||t.some((r)=>r.$id===e.$id))return t;return t.push(e),t}function Oe(e,t){return e[y]==="This"||e[y]==="Ref"?zp(e,t):e}class Ja extends v{constructor(e){super("Unable to hash value");this.value=e}}var Xe;(function(e){e[e.Undefined=0]="Undefined",e[e.Null=1]="Null",e[e.Boolean=2]="Boolean",e[e.Number=3]="Number",e[e.String=4]="String",e[e.Object=5]="Object",e[e.Array=6]="Array",e[e.Date=7]="Date",e[e.Uint8Array=8]="Uint8Array",e[e.Symbol=9]="Symbol",e[e.BigInt=10]="BigInt"})(Xe||(Xe={}));var pn=BigInt("14695981039346656037"),[Wp,Jp]=[BigInt("1099511628211"),BigInt("18446744073709551616")],Yp=Array.from({length:256}).map((e,t)=>BigInt(t)),Ya=new Float64Array(1),Qa=new DataView(Ya.buffer),Xa=new Uint8Array(Ya.buffer);function*Qp(e){let t=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let r=0;r<t;r++)yield e>>8*(t-1-r)&255}function Xp(e){je(Xe.Array);for(let t of e)ln(t)}function Zp(e){je(Xe.Boolean),je(e?1:0)}function el(e){je(Xe.BigInt),Qa.setBigInt64(0,e);for(let t of Xa)je(t)}function tl(e){je(Xe.Date),ln(e.getTime())}function rl(e){je(Xe.Null)}function nl(e){je(Xe.Number),Qa.setFloat64(0,e);for(let t of Xa)je(t)}function ol(e){je(Xe.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())ln(t),ln(e[t])}function il(e){je(Xe.String);for(let t=0;t<e.length;t++)for(let r of Qp(e.charCodeAt(t)))je(r)}function sl(e){je(Xe.Symbol),ln(e.description)}function al(e){je(Xe.Uint8Array);for(let t=0;t<e.length;t++)je(e[t])}function cl(e){return je(Xe.Undefined)}function ln(e){if(xe(e))return Xp(e);if(Ir(e))return Zp(e);if(He(e))return el(e);if(Hr(e))return tl(e);if(gr(e))return rl(e);if(N(e))return nl(e);if(Ke(e))return ol(e);if(_e(e))return il(e);if(hr(e))return sl(e);if(zr(e))return al(e);if(Se(e))return cl(e);throw new Ja(e)}function je(e){pn=pn^Yp[e],pn=pn*Wp%Jp}function yn(e){return pn=BigInt("14695981039346656037"),ln(e),pn}class Za extends v{constructor(e){super("Unknown type");this.schema=e}}function ul(e){return e[y]==="Any"||e[y]==="Unknown"}function S(e){return e!==void 0}function fl(e,t,r){return!0}function ml(e,t,r){return!0}function dl(e,t,r){if(!xe(r))return!1;if(S(e.minItems)&&!(r.length>=e.minItems))return!1;if(S(e.maxItems)&&!(r.length<=e.maxItems))return!1;if(!r.every((i)=>$e(e.items,t,i)))return!1;if(e.uniqueItems===!0&&!function(){let i=new Set;for(let s of r){let a=yn(s);if(i.has(a))return!1;else i.add(a)}return!0}())return!1;if(!(S(e.contains)||N(e.minContains)||N(e.maxContains)))return!0;let n=S(e.contains)?e.contains:j(),o=r.reduce((i,s)=>$e(n,t,s)?i+1:i,0);if(o===0)return!1;if(N(e.minContains)&&o<e.minContains)return!1;if(N(e.maxContains)&&o>e.maxContains)return!1;return!0}function pl(e,t,r){return mo(r)}function ll(e,t,r){if(!He(r))return!1;if(S(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum))return!1;if(S(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum))return!1;if(S(e.maximum)&&!(r<=e.maximum))return!1;if(S(e.minimum)&&!(r>=e.minimum))return!1;if(S(e.multipleOf)&&r%e.multipleOf!==BigInt(0))return!1;return!0}function yl(e,t,r){return Ir(r)}function xl(e,t,r){return $e(e.returns,t,r.prototype)}function gl(e,t,r){if(!Hr(r))return!1;if(S(e.exclusiveMaximumTimestamp)&&!(r.getTime()<e.exclusiveMaximumTimestamp))return!1;if(S(e.exclusiveMinimumTimestamp)&&!(r.getTime()>e.exclusiveMinimumTimestamp))return!1;if(S(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp))return!1;if(S(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp))return!1;if(S(e.multipleOfTimestamp)&&r.getTime()%e.multipleOfTimestamp!==0)return!1;return!0}function Il(e,t,r){return go(r)}function hl(e,t,r){let n=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return $e(o,[...t,...n],r)}function bl(e,t,r){if(!xo(r))return!1;if(S(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum))return!1;if(S(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum))return!1;if(S(e.maximum)&&!(r<=e.maximum))return!1;if(S(e.minimum)&&!(r>=e.minimum))return!1;if(S(e.multipleOf)&&r%e.multipleOf!==0)return!1;return!0}function _l(e,t,r){let n=e.allOf.every((o)=>$e(o,t,r));if(e.unevaluatedProperties===!1){let o=new RegExp(qt(e)),i=Object.getOwnPropertyNames(r).every((s)=>o.test(s));return n&&i}else if(se(e.unevaluatedProperties)){let o=new RegExp(qt(e)),i=Object.getOwnPropertyNames(r).every((s)=>o.test(s)||$e(e.unevaluatedProperties,t,r[s]));return n&&i}else return n}function Ol(e,t,r){return po(r)}function $l(e,t,r){return r===e.const}function Fl(e,t,r){return!1}function wl(e,t,r){return!$e(e.not,t,r)}function Rl(e,t,r){return gr(r)}function Tl(e,t,r){if(!ee.IsNumberLike(r))return!1;if(S(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum))return!1;if(S(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum))return!1;if(S(e.minimum)&&!(r>=e.minimum))return!1;if(S(e.maximum)&&!(r<=e.maximum))return!1;if(S(e.multipleOf)&&r%e.multipleOf!==0)return!1;return!0}function Al(e,t,r){if(!ee.IsObjectLike(r))return!1;if(S(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties))return!1;if(S(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties))return!1;let n=Object.getOwnPropertyNames(e.properties);for(let o of n){let i=e.properties[o];if(e.required&&e.required.includes(o)){if(!$e(i,t,r[o]))return!1;if((Vt(i)||ul(i))&&!(o in r))return!1}else if(ee.IsExactOptionalProperty(r,o)&&!$e(i,t,r[o]))return!1}if(e.additionalProperties===!1){let o=Object.getOwnPropertyNames(r);if(e.required&&e.required.length===n.length&&o.length===n.length)return!0;else return o.every((i)=>n.includes(i))}else if(typeof e.additionalProperties==="object")return Object.getOwnPropertyNames(r).every((i)=>n.includes(i)||$e(e.additionalProperties,t,r[i]));else return!0}function kl(e,t,r){return lo(r)}function Nl(e,t,r){if(!ee.IsRecordLike(r))return!1;if(S(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties))return!1;if(S(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties))return!1;let[n,o]=Object.entries(e.patternProperties)[0],i=new RegExp(n),s=Object.entries(r).every(([l,g])=>i.test(l)?$e(o,t,g):!0),a=typeof e.additionalProperties==="object"?Object.entries(r).every(([l,g])=>!i.test(l)?$e(e.additionalProperties,t,g):!0):!0,f=e.additionalProperties===!1?Object.getOwnPropertyNames(r).every((l)=>i.test(l)):!0;return s&&a&&f}function Pl(e,t,r){return $e(Oe(e,t),t,r)}function Cl(e,t,r){let n=new RegExp(e.source,e.flags);if(S(e.minLength)){if(!(r.length>=e.minLength))return!1}if(S(e.maxLength)){if(!(r.length<=e.maxLength))return!1}return n.test(r)}function jl(e,t,r){if(!_e(r))return!1;if(S(e.minLength)){if(!(r.length>=e.minLength))return!1}if(S(e.maxLength)){if(!(r.length<=e.maxLength))return!1}if(S(e.pattern)){if(!new RegExp(e.pattern).test(r))return!1}if(S(e.format)){if(!li(e.format))return!1;return yi(e.format)(r)}return!0}function Ml(e,t,r){return hr(r)}function Sl(e,t,r){return _e(r)&&new RegExp(e.pattern).test(r)}function Ul(e,t,r){return $e(Oe(e,t),t,r)}function Kl(e,t,r){if(!xe(r))return!1;if(e.items===void 0&&r.length!==0)return!1;if(r.length!==e.maxItems)return!1;if(!e.items)return!0;for(let n=0;n<e.items.length;n++)if(!$e(e.items[n],t,r[n]))return!1;return!0}function El(e,t,r){return Se(r)}function Ll(e,t,r){return e.anyOf.some((n)=>$e(n,t,r))}function Bl(e,t,r){if(!zr(r))return!1;if(S(e.maxByteLength)&&!(r.length<=e.maxByteLength))return!1;if(S(e.minByteLength)&&!(r.length>=e.minByteLength))return!1;return!0}function Gl(e,t,r){return!0}function Dl(e,t,r){return ee.IsVoidLike(r)}function vl(e,t,r){if(!Gn(e[y]))return!1;return xi(e[y])(e,r)}function $e(e,t,r){let n=S(e.$id)?fr(e,t):t,o=e;switch(o[y]){case"Any":return fl(o,n,r);case"Argument":return ml(o,n,r);case"Array":return dl(o,n,r);case"AsyncIterator":return pl(o,n,r);case"BigInt":return ll(o,n,r);case"Boolean":return yl(o,n,r);case"Constructor":return xl(o,n,r);case"Date":return gl(o,n,r);case"Function":return Il(o,n,r);case"Import":return hl(o,n,r);case"Integer":return bl(o,n,r);case"Intersect":return _l(o,n,r);case"Iterator":return Ol(o,n,r);case"Literal":return $l(o,n,r);case"Never":return Fl(o,n,r);case"Not":return wl(o,n,r);case"Null":return Rl(o,n,r);case"Number":return Tl(o,n,r);case"Object":return Al(o,n,r);case"Promise":return kl(o,n,r);case"Record":return Nl(o,n,r);case"Ref":return Pl(o,n,r);case"RegExp":return Cl(o,n,r);case"String":return jl(o,n,r);case"Symbol":return Ml(o,n,r);case"TemplateLiteral":return Sl(o,n,r);case"This":return Ul(o,n,r);case"Tuple":return Kl(o,n,r);case"Undefined":return El(o,n,r);case"Union":return Ll(o,n,r);case"Uint8Array":return Bl(o,n,r);case"Unknown":return Gl(o,n,r);case"Void":return Dl(o,n,r);default:if(!Gn(o[y]))throw new Za(o);return vl(o,n,r)}}function Cr(...e){return e.length===3?$e(e[0],e[1],e[2]):$e(e[0],[],e[1])}var m;(function(e){e[e.ArrayContains=0]="ArrayContains",e[e.ArrayMaxContains=1]="ArrayMaxContains",e[e.ArrayMaxItems=2]="ArrayMaxItems",e[e.ArrayMinContains=3]="ArrayMinContains",e[e.ArrayMinItems=4]="ArrayMinItems",e[e.ArrayUniqueItems=5]="ArrayUniqueItems",e[e.Array=6]="Array",e[e.AsyncIterator=7]="AsyncIterator",e[e.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",e[e.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",e[e.BigIntMaximum=10]="BigIntMaximum",e[e.BigIntMinimum=11]="BigIntMinimum",e[e.BigIntMultipleOf=12]="BigIntMultipleOf",e[e.BigInt=13]="BigInt",e[e.Boolean=14]="Boolean",e[e.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",e[e.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",e[e.DateMaximumTimestamp=17]="DateMaximumTimestamp",e[e.DateMinimumTimestamp=18]="DateMinimumTimestamp",e[e.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",e[e.Date=20]="Date",e[e.Function=21]="Function",e[e.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",e[e.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",e[e.IntegerMaximum=24]="IntegerMaximum",e[e.IntegerMinimum=25]="IntegerMinimum",e[e.IntegerMultipleOf=26]="IntegerMultipleOf",e[e.Integer=27]="Integer",e[e.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",e[e.Intersect=29]="Intersect",e[e.Iterator=30]="Iterator",e[e.Kind=31]="Kind",e[e.Literal=32]="Literal",e[e.Never=33]="Never",e[e.Not=34]="Not",e[e.Null=35]="Null",e[e.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",e[e.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",e[e.NumberMaximum=38]="NumberMaximum",e[e.NumberMinimum=39]="NumberMinimum",e[e.NumberMultipleOf=40]="NumberMultipleOf",e[e.Number=41]="Number",e[e.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",e[e.ObjectMaxProperties=43]="ObjectMaxProperties",e[e.ObjectMinProperties=44]="ObjectMinProperties",e[e.ObjectRequiredProperty=45]="ObjectRequiredProperty",e[e.Object=46]="Object",e[e.Promise=47]="Promise",e[e.RegExp=48]="RegExp",e[e.StringFormatUnknown=49]="StringFormatUnknown",e[e.StringFormat=50]="StringFormat",e[e.StringMaxLength=51]="StringMaxLength",e[e.StringMinLength=52]="StringMinLength",e[e.StringPattern=53]="StringPattern",e[e.String=54]="String",e[e.Symbol=55]="Symbol",e[e.TupleLength=56]="TupleLength",e[e.Tuple=57]="Tuple",e[e.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",e[e.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",e[e.Uint8Array=60]="Uint8Array",e[e.Undefined=61]="Undefined",e[e.Union=62]="Union",e[e.Void=63]="Void"})(m||(m={}));class ec extends v{constructor(e){super("Unknown type");this.schema=e}}function Ht(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function U(e){return e!==void 0}class Mi{constructor(e){this.iterator=e}[Symbol.iterator](){return this.iterator}First(){let e=this.iterator.next();return e.done?void 0:e.value}}function h(e,t,r,n,o=[]){return{type:e,schema:t,path:r,value:n,message:za()({errorType:e,path:r,schema:t,value:n,errors:o}),errors:o}}function*ql(e,t,r,n){}function*Vl(e,t,r,n){}function*Hl(e,t,r,n){if(!xe(n))return yield h(m.Array,e,r,n);if(U(e.minItems)&&!(n.length>=e.minItems))yield h(m.ArrayMinItems,e,r,n);if(U(e.maxItems)&&!(n.length<=e.maxItems))yield h(m.ArrayMaxItems,e,r,n);for(let s=0;s<n.length;s++)yield*Fe(e.items,t,`${r}/${s}`,n[s]);if(e.uniqueItems===!0&&!function(){let s=new Set;for(let a of n){let f=yn(a);if(s.has(f))return!1;else s.add(f)}return!0}())yield h(m.ArrayUniqueItems,e,r,n);if(!(U(e.contains)||U(e.minContains)||U(e.maxContains)))return;let o=U(e.contains)?e.contains:j(),i=n.reduce((s,a,f)=>Fe(o,t,`${r}${f}`,a).next().done===!0?s+1:s,0);if(i===0)yield h(m.ArrayContains,e,r,n);if(N(e.minContains)&&i<e.minContains)yield h(m.ArrayMinContains,e,r,n);if(N(e.maxContains)&&i>e.maxContains)yield h(m.ArrayMaxContains,e,r,n)}function*zl(e,t,r,n){if(!mo(n))yield h(m.AsyncIterator,e,r,n)}function*Wl(e,t,r,n){if(!He(n))return yield h(m.BigInt,e,r,n);if(U(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum))yield h(m.BigIntExclusiveMaximum,e,r,n);if(U(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum))yield h(m.BigIntExclusiveMinimum,e,r,n);if(U(e.maximum)&&!(n<=e.maximum))yield h(m.BigIntMaximum,e,r,n);if(U(e.minimum)&&!(n>=e.minimum))yield h(m.BigIntMinimum,e,r,n);if(U(e.multipleOf)&&n%e.multipleOf!==BigInt(0))yield h(m.BigIntMultipleOf,e,r,n)}function*Jl(e,t,r,n){if(!Ir(n))yield h(m.Boolean,e,r,n)}function*Yl(e,t,r,n){yield*Fe(e.returns,t,r,n.prototype)}function*Ql(e,t,r,n){if(!Hr(n))return yield h(m.Date,e,r,n);if(U(e.exclusiveMaximumTimestamp)&&!(n.getTime()<e.exclusiveMaximumTimestamp))yield h(m.DateExclusiveMaximumTimestamp,e,r,n);if(U(e.exclusiveMinimumTimestamp)&&!(n.getTime()>e.exclusiveMinimumTimestamp))yield h(m.DateExclusiveMinimumTimestamp,e,r,n);if(U(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp))yield h(m.DateMaximumTimestamp,e,r,n);if(U(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp))yield h(m.DateMinimumTimestamp,e,r,n);if(U(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0)yield h(m.DateMultipleOfTimestamp,e,r,n)}function*Xl(e,t,r,n){if(!go(n))yield h(m.Function,e,r,n)}function*Zl(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];yield*Fe(i,[...t,...o],r,n)}function*ey(e,t,r,n){if(!xo(n))return yield h(m.Integer,e,r,n);if(U(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum))yield h(m.IntegerExclusiveMaximum,e,r,n);if(U(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum))yield h(m.IntegerExclusiveMinimum,e,r,n);if(U(e.maximum)&&!(n<=e.maximum))yield h(m.IntegerMaximum,e,r,n);if(U(e.minimum)&&!(n>=e.minimum))yield h(m.IntegerMinimum,e,r,n);if(U(e.multipleOf)&&n%e.multipleOf!==0)yield h(m.IntegerMultipleOf,e,r,n)}function*ty(e,t,r,n){let o=!1;for(let i of e.allOf)for(let s of Fe(i,t,r,n))o=!0,yield s;if(o)return yield h(m.Intersect,e,r,n);if(e.unevaluatedProperties===!1){let i=new RegExp(qt(e));for(let s of Object.getOwnPropertyNames(n))if(!i.test(s))yield h(m.IntersectUnevaluatedProperties,e,`${r}/${s}`,n)}if(typeof e.unevaluatedProperties==="object"){let i=new RegExp(qt(e));for(let s of Object.getOwnPropertyNames(n))if(!i.test(s)){let a=Fe(e.unevaluatedProperties,t,`${r}/${s}`,n[s]).next();if(!a.done)yield a.value}}}function*ry(e,t,r,n){if(!po(n))yield h(m.Iterator,e,r,n)}function*ny(e,t,r,n){if(n!==e.const)yield h(m.Literal,e,r,n)}function*oy(e,t,r,n){yield h(m.Never,e,r,n)}function*iy(e,t,r,n){if(Fe(e.not,t,r,n).next().done===!0)yield h(m.Not,e,r,n)}function*sy(e,t,r,n){if(!gr(n))yield h(m.Null,e,r,n)}function*ay(e,t,r,n){if(!ee.IsNumberLike(n))return yield h(m.Number,e,r,n);if(U(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum))yield h(m.NumberExclusiveMaximum,e,r,n);if(U(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum))yield h(m.NumberExclusiveMinimum,e,r,n);if(U(e.maximum)&&!(n<=e.maximum))yield h(m.NumberMaximum,e,r,n);if(U(e.minimum)&&!(n>=e.minimum))yield h(m.NumberMinimum,e,r,n);if(U(e.multipleOf)&&n%e.multipleOf!==0)yield h(m.NumberMultipleOf,e,r,n)}function*cy(e,t,r,n){if(!ee.IsObjectLike(n))return yield h(m.Object,e,r,n);if(U(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties))yield h(m.ObjectMinProperties,e,r,n);if(U(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))yield h(m.ObjectMaxProperties,e,r,n);let o=Array.isArray(e.required)?e.required:[],i=Object.getOwnPropertyNames(e.properties),s=Object.getOwnPropertyNames(n);for(let a of o){if(s.includes(a))continue;yield h(m.ObjectRequiredProperty,e.properties[a],`${r}/${Ht(a)}`,void 0)}if(e.additionalProperties===!1){for(let a of s)if(!i.includes(a))yield h(m.ObjectAdditionalProperties,e,`${r}/${Ht(a)}`,n[a])}if(typeof e.additionalProperties==="object")for(let a of s){if(i.includes(a))continue;yield*Fe(e.additionalProperties,t,`${r}/${Ht(a)}`,n[a])}for(let a of i){let f=e.properties[a];if(e.required&&e.required.includes(a)){if(yield*Fe(f,t,`${r}/${Ht(a)}`,n[a]),Vt(e)&&!(a in n))yield h(m.ObjectRequiredProperty,f,`${r}/${Ht(a)}`,void 0)}else if(ee.IsExactOptionalProperty(n,a))yield*Fe(f,t,`${r}/${Ht(a)}`,n[a])}}function*uy(e,t,r,n){if(!lo(n))yield h(m.Promise,e,r,n)}function*fy(e,t,r,n){if(!ee.IsRecordLike(n))return yield h(m.Object,e,r,n);if(U(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties))yield h(m.ObjectMinProperties,e,r,n);if(U(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))yield h(m.ObjectMaxProperties,e,r,n);let[o,i]=Object.entries(e.patternProperties)[0],s=new RegExp(o);for(let[a,f]of Object.entries(n))if(s.test(a))yield*Fe(i,t,`${r}/${Ht(a)}`,f);if(typeof e.additionalProperties==="object"){for(let[a,f]of Object.entries(n))if(!s.test(a))yield*Fe(e.additionalProperties,t,`${r}/${Ht(a)}`,f)}if(e.additionalProperties===!1)for(let[a,f]of Object.entries(n)){if(s.test(a))continue;return yield h(m.ObjectAdditionalProperties,e,`${r}/${Ht(a)}`,f)}}function*my(e,t,r,n){yield*Fe(Oe(e,t),t,r,n)}function*dy(e,t,r,n){if(!_e(n))return yield h(m.String,e,r,n);if(U(e.minLength)&&!(n.length>=e.minLength))yield h(m.StringMinLength,e,r,n);if(U(e.maxLength)&&!(n.length<=e.maxLength))yield h(m.StringMaxLength,e,r,n);if(!new RegExp(e.source,e.flags).test(n))return yield h(m.RegExp,e,r,n)}function*py(e,t,r,n){if(!_e(n))return yield h(m.String,e,r,n);if(U(e.minLength)&&!(n.length>=e.minLength))yield h(m.StringMinLength,e,r,n);if(U(e.maxLength)&&!(n.length<=e.maxLength))yield h(m.StringMaxLength,e,r,n);if(_e(e.pattern)){if(!new RegExp(e.pattern).test(n))yield h(m.StringPattern,e,r,n)}if(_e(e.format)){if(!li(e.format))yield h(m.StringFormatUnknown,e,r,n);else if(!yi(e.format)(n))yield h(m.StringFormat,e,r,n)}}function*ly(e,t,r,n){if(!hr(n))yield h(m.Symbol,e,r,n)}function*yy(e,t,r,n){if(!_e(n))return yield h(m.String,e,r,n);if(!new RegExp(e.pattern).test(n))yield h(m.StringPattern,e,r,n)}function*xy(e,t,r,n){yield*Fe(Oe(e,t),t,r,n)}function*gy(e,t,r,n){if(!xe(n))return yield h(m.Tuple,e,r,n);if(e.items===void 0&&n.length!==0)return yield h(m.TupleLength,e,r,n);if(n.length!==e.maxItems)return yield h(m.TupleLength,e,r,n);if(!e.items)return;for(let o=0;o<e.items.length;o++)yield*Fe(e.items[o],t,`${r}/${o}`,n[o])}function*Iy(e,t,r,n){if(!Se(n))yield h(m.Undefined,e,r,n)}function*hy(e,t,r,n){if(Cr(e,t,n))return;let o=e.anyOf.map((i)=>new Mi(Fe(i,t,r,n)));yield h(m.Union,e,r,n,o)}function*by(e,t,r,n){if(!zr(n))return yield h(m.Uint8Array,e,r,n);if(U(e.maxByteLength)&&!(n.length<=e.maxByteLength))yield h(m.Uint8ArrayMaxByteLength,e,r,n);if(U(e.minByteLength)&&!(n.length>=e.minByteLength))yield h(m.Uint8ArrayMinByteLength,e,r,n)}function*_y(e,t,r,n){}function*Oy(e,t,r,n){if(!ee.IsVoidLike(n))yield h(m.Void,e,r,n)}function*$y(e,t,r,n){if(!xi(e[y])(e,n))yield h(m.Kind,e,r,n)}function*Fe(e,t,r,n){let o=U(e.$id)?[...t,e]:t,i=e;switch(i[y]){case"Any":return yield*ql(i,o,r,n);case"Argument":return yield*Vl(i,o,r,n);case"Array":return yield*Hl(i,o,r,n);case"AsyncIterator":return yield*zl(i,o,r,n);case"BigInt":return yield*Wl(i,o,r,n);case"Boolean":return yield*Jl(i,o,r,n);case"Constructor":return yield*Yl(i,o,r,n);case"Date":return yield*Ql(i,o,r,n);case"Function":return yield*Xl(i,o,r,n);case"Import":return yield*Zl(i,o,r,n);case"Integer":return yield*ey(i,o,r,n);case"Intersect":return yield*ty(i,o,r,n);case"Iterator":return yield*ry(i,o,r,n);case"Literal":return yield*ny(i,o,r,n);case"Never":return yield*oy(i,o,r,n);case"Not":return yield*iy(i,o,r,n);case"Null":return yield*sy(i,o,r,n);case"Number":return yield*ay(i,o,r,n);case"Object":return yield*cy(i,o,r,n);case"Promise":return yield*uy(i,o,r,n);case"Record":return yield*fy(i,o,r,n);case"Ref":return yield*my(i,o,r,n);case"RegExp":return yield*dy(i,o,r,n);case"String":return yield*py(i,o,r,n);case"Symbol":return yield*ly(i,o,r,n);case"TemplateLiteral":return yield*yy(i,o,r,n);case"This":return yield*xy(i,o,r,n);case"Tuple":return yield*gy(i,o,r,n);case"Undefined":return yield*Iy(i,o,r,n);case"Union":return yield*hy(i,o,r,n);case"Uint8Array":return yield*by(i,o,r,n);case"Unknown":return yield*_y(i,o,r,n);case"Void":return yield*Oy(i,o,r,n);default:if(!Gn(i[y]))throw new ec(e);return yield*$y(i,o,r,n)}}function tc(...e){let t=e.length===3?Fe(e[0],e[1],"",e[2]):Fe(e[0],[],"",e[1]);return new Mi(t)}class Si extends v{constructor(e,t,r){super("Unable to decode value as it does not match the expected schema");this.schema=e,this.value=t,this.error=r}}class rc extends v{constructor(e,t,r,n){super(n instanceof Error?n.message:"Unknown error");this.schema=e,this.path=t,this.value=r,this.error=n}}function ce(e,t,r){try{return D(e)?e[ie].Decode(r):r}catch(n){throw new rc(e,t,r,n)}}function Fy(e,t,r,n){return xe(n)?ce(e,r,n.map((o,i)=>_t(e.items,t,`${r}/${i}`,o))):ce(e,r,n)}function wy(e,t,r,n){if(!Ke(n)||Io(n))return ce(e,r,n);let o=So(e),i=o.map((g)=>g[0]),s={...n};for(let[g,R]of o)if(g in s)s[g]=_t(R,t,`${r}/${g}`,s[g]);if(!D(e.unevaluatedProperties))return ce(e,r,s);let a=Object.getOwnPropertyNames(s),f=e.unevaluatedProperties,l={...s};for(let g of a)if(!i.includes(g))l[g]=ce(f,`${r}/${g}`,l[g]);return ce(e,r,l)}function Ry(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref],s=_t(i,[...t,...o],r,n);return ce(e,r,s)}function Ty(e,t,r,n){return ce(e,r,_t(e.not,t,r,n))}function Ay(e,t,r,n){if(!Ke(n))return ce(e,r,n);let o=nt(e),i={...n};for(let l of o){if(!yo(i,l))continue;if(Se(i[l])&&(!Lt(e.properties[l])||ee.IsExactOptionalProperty(i,l)))continue;i[l]=_t(e.properties[l],t,`${r}/${l}`,i[l])}if(!se(e.additionalProperties))return ce(e,r,i);let s=Object.getOwnPropertyNames(i),a=e.additionalProperties,f={...i};for(let l of s)if(!o.includes(l))f[l]=ce(a,`${r}/${l}`,f[l]);return ce(e,r,f)}function ky(e,t,r,n){if(!Ke(n))return ce(e,r,n);let o=Object.getOwnPropertyNames(e.patternProperties)[0],i=new RegExp(o),s={...n};for(let g of Object.getOwnPropertyNames(n))if(i.test(g))s[g]=_t(e.patternProperties[o],t,`${r}/${g}`,s[g]);if(!se(e.additionalProperties))return ce(e,r,s);let a=Object.getOwnPropertyNames(s),f=e.additionalProperties,l={...s};for(let g of a)if(!i.test(g))l[g]=ce(f,`${r}/${g}`,l[g]);return ce(e,r,l)}function Ny(e,t,r,n){let o=Oe(e,t);return ce(e,r,_t(o,t,r,n))}function Py(e,t,r,n){let o=Oe(e,t);return ce(e,r,_t(o,t,r,n))}function Cy(e,t,r,n){return xe(n)&&xe(e.items)?ce(e,r,e.items.map((o,i)=>_t(o,t,`${r}/${i}`,n[i]))):ce(e,r,n)}function jy(e,t,r,n){for(let o of e.anyOf){if(!Cr(o,t,n))continue;let i=_t(o,t,r,n);return ce(e,r,i)}return ce(e,r,n)}function _t(e,t,r,n){let o=fr(e,t),i=e;switch(e[y]){case"Array":return Fy(i,o,r,n);case"Import":return Ry(i,o,r,n);case"Intersect":return wy(i,o,r,n);case"Not":return Ty(i,o,r,n);case"Object":return Ay(i,o,r,n);case"Record":return ky(i,o,r,n);case"Ref":return Ny(i,o,r,n);case"Symbol":return ce(i,r,n);case"This":return Py(i,o,r,n);case"Tuple":return Cy(i,o,r,n);case"Union":return jy(i,o,r,n);default:return ce(i,r,n)}}function nc(e,t,r){return _t(e,t,"",r)}class Ui extends v{constructor(e,t,r){super("The encoded value does not match the expected schema");this.schema=e,this.value=t,this.error=r}}class oc extends v{constructor(e,t,r,n){super(`${n instanceof Error?n.message:"Unknown error"}`);this.schema=e,this.path=t,this.value=r,this.error=n}}function Ae(e,t,r){try{return D(e)?e[ie].Encode(r):r}catch(n){throw new oc(e,t,r,n)}}function My(e,t,r,n){let o=Ae(e,r,n);return xe(o)?o.map((i,s)=>Ot(e.items,t,`${r}/${s}`,i)):o}function Sy(e,t,r,n){let o=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref],s=Ae(e,r,n);return Ot(i,[...t,...o],r,s)}function Uy(e,t,r,n){let o=Ae(e,r,n);if(!Ke(n)||Io(n))return o;let i=So(e),s=i.map((R)=>R[0]),a={...o};for(let[R,J]of i)if(R in a)a[R]=Ot(J,t,`${r}/${R}`,a[R]);if(!D(e.unevaluatedProperties))return a;let f=Object.getOwnPropertyNames(a),l=e.unevaluatedProperties,g={...a};for(let R of f)if(!s.includes(R))g[R]=Ae(l,`${r}/${R}`,g[R]);return g}function Ky(e,t,r,n){return Ae(e.not,r,Ae(e,r,n))}function Ey(e,t,r,n){let o=Ae(e,r,n);if(!Ke(o))return o;let i=nt(e),s={...o};for(let g of i){if(!yo(s,g))continue;if(Se(s[g])&&(!Lt(e.properties[g])||ee.IsExactOptionalProperty(s,g)))continue;s[g]=Ot(e.properties[g],t,`${r}/${g}`,s[g])}if(!se(e.additionalProperties))return s;let a=Object.getOwnPropertyNames(s),f=e.additionalProperties,l={...s};for(let g of a)if(!i.includes(g))l[g]=Ae(f,`${r}/${g}`,l[g]);return l}function Ly(e,t,r,n){let o=Ae(e,r,n);if(!Ke(n))return o;let i=Object.getOwnPropertyNames(e.patternProperties)[0],s=new RegExp(i),a={...o};for(let R of Object.getOwnPropertyNames(n))if(s.test(R))a[R]=Ot(e.patternProperties[i],t,`${r}/${R}`,a[R]);if(!se(e.additionalProperties))return a;let f=Object.getOwnPropertyNames(a),l=e.additionalProperties,g={...a};for(let R of f)if(!s.test(R))g[R]=Ae(l,`${r}/${R}`,g[R]);return g}function By(e,t,r,n){let o=Oe(e,t),i=Ot(o,t,r,n);return Ae(e,r,i)}function Gy(e,t,r,n){let o=Oe(e,t),i=Ot(o,t,r,n);return Ae(e,r,i)}function Dy(e,t,r,n){let o=Ae(e,r,n);return xe(e.items)?e.items.map((i,s)=>Ot(i,t,`${r}/${s}`,o[s])):[]}function vy(e,t,r,n){for(let o of e.anyOf){if(!Cr(o,t,n))continue;let i=Ot(o,t,r,n);return Ae(e,r,i)}for(let o of e.anyOf){let i=Ot(o,t,r,n);if(!Cr(e,t,i))continue;return Ae(e,r,i)}return Ae(e,r,n)}function Ot(e,t,r,n){let o=fr(e,t),i=e;switch(e[y]){case"Array":return My(i,o,r,n);case"Import":return Sy(i,o,r,n);case"Intersect":return Uy(i,o,r,n);case"Not":return Ky(i,o,r,n);case"Object":return Ey(i,o,r,n);case"Record":return Ly(i,o,r,n);case"Ref":return By(i,o,r,n);case"This":return Gy(i,o,r,n);case"Tuple":return Dy(i,o,r,n);case"Union":return vy(i,o,r,n);default:return Ae(i,r,n)}}function ic(e,t,r){return Ot(e,t,"",r)}function qy(e,t){return D(e)||he(e.items,t)}function Vy(e,t){return D(e)||he(e.items,t)}function Hy(e,t){return D(e)||he(e.returns,t)||e.parameters.some((r)=>he(r,t))}function zy(e,t){return D(e)||he(e.returns,t)||e.parameters.some((r)=>he(r,t))}function Wy(e,t){return D(e)||D(e.unevaluatedProperties)||e.allOf.some((r)=>he(r,t))}function Jy(e,t){let r=globalThis.Object.getOwnPropertyNames(e.$defs).reduce((o,i)=>[...o,e.$defs[i]],[]),n=e.$defs[e.$ref];return D(e)||he(n,[...r,...t])}function Yy(e,t){return D(e)||he(e.items,t)}function Qy(e,t){return D(e)||he(e.not,t)}function Xy(e,t){return D(e)||Object.values(e.properties).some((r)=>he(r,t))||se(e.additionalProperties)&&he(e.additionalProperties,t)}function Zy(e,t){return D(e)||he(e.item,t)}function ex(e,t){let r=Object.getOwnPropertyNames(e.patternProperties)[0],n=e.patternProperties[r];return D(e)||he(n,t)||se(e.additionalProperties)&&D(e.additionalProperties)}function tx(e,t){if(D(e))return!0;return he(Oe(e,t),t)}function rx(e,t){if(D(e))return!0;return he(Oe(e,t),t)}function nx(e,t){return D(e)||!Se(e.items)&&e.items.some((r)=>he(r,t))}function ox(e,t){return D(e)||e.anyOf.some((r)=>he(r,t))}function he(e,t){let r=fr(e,t),n=e;if(e.$id&&Ki.has(e.$id))return!1;if(e.$id)Ki.add(e.$id);switch(e[y]){case"Array":return qy(n,r);case"AsyncIterator":return Vy(n,r);case"Constructor":return Hy(n,r);case"Function":return zy(n,r);case"Import":return Jy(n,r);case"Intersect":return Wy(n,r);case"Iterator":return Yy(n,r);case"Not":return Qy(n,r);case"Object":return Xy(n,r);case"Promise":return Zy(n,r);case"Record":return ex(n,r);case"Ref":return tx(n,r);case"This":return rx(n,r);case"Tuple":return nx(n,r);case"Union":return ox(n,r);default:return D(e)}}var Ki=new Set;function sc(e,t){return Ki.clear(),he(e,t)}class ac{constructor(e,t,r,n){this.schema=e,this.references=t,this.checkFunc=r,this.code=n,this.hasTransform=sc(e,t)}Code(){return this.code}Schema(){return this.schema}References(){return this.references}Errors(e){return tc(this.schema,this.references,e)}Check(e){return this.checkFunc(e)}Decode(e){if(!this.checkFunc(e))throw new Si(this.schema,e,this.Errors(e).First());return this.hasTransform?nc(this.schema,this.references,e):e}Encode(e){let t=this.hasTransform?ic(this.schema,this.references,e):e;if(!this.checkFunc(t))throw new Ui(this.schema,e,this.Errors(e).First());return t}}var zt;(function(e){function t(i){return i===36}e.DollarSign=t;function r(i){return i===95}e.IsUnderscore=r;function n(i){return i>=65&&i<=90||i>=97&&i<=122}e.IsAlpha=n;function o(i){return i>=48&&i<=57}e.IsNumeric=o})(zt||(zt={}));var Yo;(function(e){function t(i){if(i.length===0)return!1;return zt.IsNumeric(i.charCodeAt(0))}function r(i){if(t(i))return!1;for(let s=0;s<i.length;s++){let a=i.charCodeAt(s);if(!(zt.IsAlpha(a)||zt.IsNumeric(a)||zt.DollarSign(a)||zt.IsUnderscore(a)))return!1}return!0}function n(i){return i.replace(/'/g,"\\'")}function o(i,s){return r(s)?`${i}.${s}`:`${i}['${n(s)}']`}e.Encode=o})(Yo||(Yo={}));var Ei;(function(e){function t(r){let n=[];for(let o=0;o<r.length;o++){let i=r.charCodeAt(o);if(zt.IsNumeric(i)||zt.IsAlpha(i))n.push(r.charAt(o));else n.push(`_${i}_`)}return n.join("").replace(/__/g,"_")}e.Encode=t})(Ei||(Ei={}));var Li;(function(e){function t(r){return r.replace(/'/g,"\\'")}e.Escape=t})(Li||(Li={}));class cc extends v{constructor(e){super("Unknown type");this.schema=e}}class Bi extends v{constructor(e){super("Preflight validation check failed to guard for the given schema");this.schema=e}}var jr;(function(e){function t(s,a,f){return ee.ExactOptionalPropertyTypes?`('${a}' in ${s} ? ${f} : true)`:`(${Yo.Encode(s,a)} !== undefined ? ${f} : true)`}e.IsExactOptionalProperty=t;function r(s){return!ee.AllowArrayObject?`(typeof ${s} === 'object' && ${s} !== null && !Array.isArray(${s}))`:`(typeof ${s} === 'object' && ${s} !== null)`}e.IsObjectLike=r;function n(s){return!ee.AllowArrayObject?`(typeof ${s} === 'object' && ${s} !== null && !Array.isArray(${s}) && !(${s} instanceof Date) && !(${s} instanceof Uint8Array))`:`(typeof ${s} === 'object' && ${s} !== null && !(${s} instanceof Date) && !(${s} instanceof Uint8Array))`}e.IsRecordLike=n;function o(s){return ee.AllowNaN?`typeof ${s} === 'number'`:`Number.isFinite(${s})`}e.IsNumberLike=o;function i(s){return ee.AllowNullVoid?`(${s} === undefined || ${s} === null)`:`${s} === undefined`}e.IsVoidLike=i})(jr||(jr={}));var Qo;(function(e){function t(c){return c[y]==="Any"||c[y]==="Unknown"}function*r(c,b,u){yield"true"}function*n(c,b,u){yield"true"}function*o(c,b,u){yield`Array.isArray(${u})`;let[k,O]=[io("value","any"),io("acc","number")];if(N(c.maxItems))yield`${u}.length <= ${c.maxItems}`;if(N(c.minItems))yield`${u}.length >= ${c.minItems}`;let F=at(c.items,b,"value");if(yield`${u}.every((${k}) => ${F})`,ae(c.contains)||N(c.minContains)||N(c.maxContains)){let Q=ae(c.contains)?c.contains:j(),Ue=at(Q,b,"value"),Ut=N(c.minContains)?[`(count >= ${c.minContains})`]:[],ct=N(c.maxContains)?[`(count <= ${c.maxContains})`]:[],At=`const count = value.reduce((${O}, ${k}) => ${Ue} ? acc + 1 : acc, 0)`,so=["(count > 0)",...Ut,...ct].join(" && ");yield`((${k}) => { ${At}; return ${so}})(${u})`}if(c.uniqueItems===!0)yield`((${k}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${u})`}function*i(c,b,u){yield`(typeof value === 'object' && Symbol.asyncIterator in ${u})`}function*s(c,b,u){if(yield`(typeof ${u} === 'bigint')`,He(c.exclusiveMaximum))yield`${u} < BigInt(${c.exclusiveMaximum})`;if(He(c.exclusiveMinimum))yield`${u} > BigInt(${c.exclusiveMinimum})`;if(He(c.maximum))yield`${u} <= BigInt(${c.maximum})`;if(He(c.minimum))yield`${u} >= BigInt(${c.minimum})`;if(He(c.multipleOf))yield`(${u} % BigInt(${c.multipleOf})) === 0`}function*a(c,b,u){yield`(typeof ${u} === 'boolean')`}function*f(c,b,u){yield*Br(c.returns,b,`${u}.prototype`)}function*l(c,b,u){if(yield`(${u} instanceof Date) && Number.isFinite(${u}.getTime())`,N(c.exclusiveMaximumTimestamp))yield`${u}.getTime() < ${c.exclusiveMaximumTimestamp}`;if(N(c.exclusiveMinimumTimestamp))yield`${u}.getTime() > ${c.exclusiveMinimumTimestamp}`;if(N(c.maximumTimestamp))yield`${u}.getTime() <= ${c.maximumTimestamp}`;if(N(c.minimumTimestamp))yield`${u}.getTime() >= ${c.minimumTimestamp}`;if(N(c.multipleOfTimestamp))yield`(${u}.getTime() % ${c.multipleOfTimestamp}) === 0`}function*g(c,b,u){yield`(typeof ${u} === 'function')`}function*R(c,b,u){let k=globalThis.Object.getOwnPropertyNames(c.$defs).reduce((O,F)=>[...O,c.$defs[F]],[]);yield*Br(rt(c.$ref),[...b,...k],u)}function*J(c,b,u){if(yield`Number.isInteger(${u})`,N(c.exclusiveMaximum))yield`${u} < ${c.exclusiveMaximum}`;if(N(c.exclusiveMinimum))yield`${u} > ${c.exclusiveMinimum}`;if(N(c.maximum))yield`${u} <= ${c.maximum}`;if(N(c.minimum))yield`${u} >= ${c.minimum}`;if(N(c.multipleOf))yield`(${u} % ${c.multipleOf}) === 0`}function*be(c,b,u){let k=c.allOf.map((O)=>at(O,b,u)).join(" && ");if(c.unevaluatedProperties===!1){let O=Gr(`${new RegExp(qt(c))};`),F=`Object.getOwnPropertyNames(${u}).every(key => ${O}.test(key))`;yield`(${k} && ${F})`}else if(ae(c.unevaluatedProperties)){let O=Gr(`${new RegExp(qt(c))};`),F=`Object.getOwnPropertyNames(${u}).every(key => ${O}.test(key) || ${at(c.unevaluatedProperties,b,`${u}[key]`)})`;yield`(${k} && ${F})`}else yield`(${k})`}function*P(c,b,u){yield`(typeof value === 'object' && Symbol.iterator in ${u})`}function*qe(c,b,u){if(typeof c.const==="number"||typeof c.const==="boolean")yield`(${u} === ${c.const})`;else yield`(${u} === '${Li.Escape(c.const)}')`}function*no(c,b,u){yield"false"}function*Pn(c,b,u){yield`(!${at(c.not,b,u)})`}function*st(c,b,u){yield`(${u} === null)`}function*Cn(c,b,u){if(yield jr.IsNumberLike(u),N(c.exclusiveMaximum))yield`${u} < ${c.exclusiveMaximum}`;if(N(c.exclusiveMinimum))yield`${u} > ${c.exclusiveMinimum}`;if(N(c.maximum))yield`${u} <= ${c.maximum}`;if(N(c.minimum))yield`${u} >= ${c.minimum}`;if(N(c.multipleOf))yield`(${u} % ${c.multipleOf}) === 0`}function*Ac(c,b,u){if(yield jr.IsObjectLike(u),N(c.minProperties))yield`Object.getOwnPropertyNames(${u}).length >= ${c.minProperties}`;if(N(c.maxProperties))yield`Object.getOwnPropertyNames(${u}).length <= ${c.maxProperties}`;let k=Object.getOwnPropertyNames(c.properties);for(let O of k){let F=Yo.Encode(u,O),Q=c.properties[O];if(c.required&&c.required.includes(O)){if(yield*Br(Q,b,F),Vt(Q)||t(Q))yield`('${O}' in ${u})`}else{let Ue=at(Q,b,F);yield jr.IsExactOptionalProperty(u,O,Ue)}}if(c.additionalProperties===!1)if(c.required&&c.required.length===k.length)yield`Object.getOwnPropertyNames(${u}).length === ${k.length}`;else{let O=`[${k.map((F)=>`'${F}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${u}).every(key => ${O}.includes(key))`}if(typeof c.additionalProperties==="object"){let O=at(c.additionalProperties,b,`${u}[key]`),F=`[${k.map((Q)=>`'${Q}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${u}).every(key => ${F}.includes(key) || ${O}))`}}function*kc(c,b,u){yield`${u} instanceof Promise`}function*Nc(c,b,u){if(yield jr.IsRecordLike(u),N(c.minProperties))yield`Object.getOwnPropertyNames(${u}).length >= ${c.minProperties}`;if(N(c.maxProperties))yield`Object.getOwnPropertyNames(${u}).length <= ${c.maxProperties}`;let[k,O]=Object.entries(c.patternProperties)[0],F=Gr(`${new RegExp(k)}`),Q=at(O,b,"value"),Ue=ae(c.additionalProperties)?at(c.additionalProperties,b,u):c.additionalProperties===!1?"false":"true",Ut=`(${F}.test(key) ? ${Q} : ${Ue})`;yield`(Object.entries(${u}).every(([key, value]) => ${Ut}))`}function*Pc(c,b,u){let k=Oe(c,b);if(we.functions.has(c.$ref))return yield`${oo(c.$ref)}(${u})`;yield*Br(k,b,u)}function*Cc(c,b,u){let k=Gr(`${new RegExp(c.source,c.flags)};`);if(yield`(typeof ${u} === 'string')`,N(c.maxLength))yield`${u}.length <= ${c.maxLength}`;if(N(c.minLength))yield`${u}.length >= ${c.minLength}`;yield`${k}.test(${u})`}function*jc(c,b,u){if(yield`(typeof ${u} === 'string')`,N(c.maxLength))yield`${u}.length <= ${c.maxLength}`;if(N(c.minLength))yield`${u}.length >= ${c.minLength}`;if(c.pattern!==void 0)yield`${Gr(`${new RegExp(c.pattern)};`)}.test(${u})`;if(c.format!==void 0)yield`format('${c.format}', ${u})`}function*Mc(c,b,u){yield`(typeof ${u} === 'symbol')`}function*Sc(c,b,u){yield`(typeof ${u} === 'string')`,yield`${Gr(`${new RegExp(c.pattern)};`)}.test(${u})`}function*Uc(c,b,u){yield`${oo(c.$ref)}(${u})`}function*Kc(c,b,u){if(yield`Array.isArray(${u})`,c.items===void 0)return yield`${u}.length === 0`;yield`(${u}.length === ${c.maxItems})`;for(let k=0;k<c.items.length;k++)yield`${at(c.items[k],b,`${u}[${k}]`)}`}function*Ec(c,b,u){yield`${u} === undefined`}function*Lc(c,b,u){yield`(${c.anyOf.map((O)=>at(O,b,u)).join(" || ")})`}function*Bc(c,b,u){if(yield`${u} instanceof Uint8Array`,N(c.maxByteLength))yield`(${u}.length <= ${c.maxByteLength})`;if(N(c.minByteLength))yield`(${u}.length >= ${c.minByteLength})`}function*Gc(c,b,u){yield"true"}function*Dc(c,b,u){yield jr.IsVoidLike(u)}function*vc(c,b,u){let k=we.instances.size;we.instances.set(k,c),yield`kind('${c[y]}', ${k}, ${u})`}function*Br(c,b,u,k=!0){let O=_e(c.$id)?[...b,c]:b,F=c;if(k&&_e(c.$id)){let Q=oo(c.$id);if(we.functions.has(Q))return yield`${Q}(${u})`;else{we.functions.set(Q,"<deferred>");let Ue=Hi(Q,c,b,"value",!1);return we.functions.set(Q,Ue),yield`${Q}(${u})`}}switch(F[y]){case"Any":return yield*r(F,O,u);case"Argument":return yield*n(F,O,u);case"Array":return yield*o(F,O,u);case"AsyncIterator":return yield*i(F,O,u);case"BigInt":return yield*s(F,O,u);case"Boolean":return yield*a(F,O,u);case"Constructor":return yield*f(F,O,u);case"Date":return yield*l(F,O,u);case"Function":return yield*g(F,O,u);case"Import":return yield*R(F,O,u);case"Integer":return yield*J(F,O,u);case"Intersect":return yield*be(F,O,u);case"Iterator":return yield*P(F,O,u);case"Literal":return yield*qe(F,O,u);case"Never":return yield*no(F,O,u);case"Not":return yield*Pn(F,O,u);case"Null":return yield*st(F,O,u);case"Number":return yield*Cn(F,O,u);case"Object":return yield*Ac(F,O,u);case"Promise":return yield*kc(F,O,u);case"Record":return yield*Nc(F,O,u);case"Ref":return yield*Pc(F,O,u);case"RegExp":return yield*Cc(F,O,u);case"String":return yield*jc(F,O,u);case"Symbol":return yield*Mc(F,O,u);case"TemplateLiteral":return yield*Sc(F,O,u);case"This":return yield*Uc(F,O,u);case"Tuple":return yield*Kc(F,O,u);case"Undefined":return yield*Ec(F,O,u);case"Union":return yield*Lc(F,O,u);case"Uint8Array":return yield*Bc(F,O,u);case"Unknown":return yield*Gc(F,O,u);case"Void":return yield*Dc(F,O,u);default:if(!Gn(F[y]))throw new cc(c);return yield*vc(F,O,u)}}let we={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function at(c,b,u,k=!0){return`(${[...Br(c,b,u,k)].join(" && ")})`}function oo(c){return`check_${Ei.Encode(c)}`}function Gr(c){let b=`local_${we.variables.size}`;return we.variables.set(b,`const ${b} = ${c}`),b}function Hi(c,b,u,k,O=!0){let[F,Q]=[`
129
+ `,(At)=>"".padStart(At," ")],Ue=io("value","any"),Ut=zi("boolean"),ct=[...Br(b,u,k,O)].map((At)=>`${Q(4)}${At}`).join(` &&${F}`);return`function ${c}(${Ue})${Ut} {${F}${Q(2)}return (${F}${ct}${F}${Q(2)})
130
+ }`}function io(c,b){let u=we.language==="typescript"?`: ${b}`:"";return`${c}${u}`}function zi(c){return we.language==="typescript"?`: ${c}`:""}function qc(c,b,u){let k=Hi("check",c,b,"value"),O=io("value","any"),F=zi("boolean"),Q=[...we.functions.values()],Ue=[...we.variables.values()],Ut=_e(c.$id)?`return function check(${O})${F} {
131
+ return ${oo(c.$id)}(value)
132
+ }`:`return ${k}`;return[...Ue,...Q,Ut].join(`
133
+ `)}function Wi(...c){let b={language:"javascript"},[u,k,O]=c.length===2&&xe(c[1])?[c[0],c[1],b]:c.length===2&&!xe(c[1])?[c[0],[],c[1]]:c.length===3?[c[0],c[1],c[2]]:c.length===1?[c[0],[],b]:[null,[],b];if(we.language=O.language,we.variables.clear(),we.functions.clear(),we.instances.clear(),!ae(u))throw new Bi(u);for(let F of k)if(!ae(F))throw new Bi(F);return qc(u,k,O)}e.Code=Wi;function Vc(c,b=[]){let u=Wi(c,b,{language:"javascript"}),k=globalThis.Function("kind","format","hash",u),O=new Map(we.instances);function F(ct,At,so){if(!Gn(ct)||!O.has(At))return!1;let Hc=xi(ct),zc=O.get(At);return Hc(zc,so)}function Q(ct,At){if(!li(ct))return!1;return yi(ct)(At)}function Ue(ct){return yn(ct)}let Ut=k(F,Q,Ue);return new ac(c,b,Ut,u)}e.Compile=Vc})(Qo||(Qo={}));var K;(function(e){e.assertEqual=(o)=>{};function t(o){}e.assertIs=t;function r(o){throw Error()}e.assertNever=r,e.arrayToEnum=(o)=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=(o)=>{let i=e.objectKeys(o).filter((a)=>typeof o[o[a]]!=="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=(o)=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys==="function"?(o)=>Object.keys(o):(o)=>{let i=[];for(let s in o)if(Object.prototype.hasOwnProperty.call(o,s))i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s;return},e.isInteger=typeof Number.isInteger==="function"?(o)=>Number.isInteger(o):(o)=>typeof o==="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map((s)=>typeof s==="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>{if(typeof i==="bigint")return i.toString();return i}})(K||(K={}));var Gi;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Gi||(Gi={}));var _=K.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),jt=(e)=>{switch(typeof e){case"undefined":return _.undefined;case"string":return _.string;case"number":return Number.isNaN(e)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":if(Array.isArray(e))return _.array;if(e===null)return _.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return _.promise;if(typeof Map<"u"&&e instanceof Map)return _.map;if(typeof Set<"u"&&e instanceof Set)return _.set;if(typeof Date<"u"&&e instanceof Date)return _.date;return _.object;default:return _.unknown}};var x=K.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"]),ix=(e)=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ve extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},r={_errors:[]},n=(o)=>{for(let i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let s=r,a=0;while(a<i.path.length){let f=i.path[a];if(a!==i.path.length-1)s[f]=s[f]||{_errors:[]};else s[f]=s[f]||{_errors:[]},s[f]._errors.push(t(i));s=s[f],a++}}};return n(this),r}static assert(e){if(!(e instanceof ve))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,K.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t={},r=[];for(let n of this.issues)if(n.path.length>0){let o=n.path[0];t[o]=t[o]||[],t[o].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}ve.create=(e)=>new ve(e);var sx=(e,t)=>{let r;switch(e.code){case x.invalid_type:if(e.received===_.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case x.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,K.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:r=`Unrecognized key(s) in object: ${K.joinValues(e.keys,", ")}`;break;case x.invalid_union:r="Invalid input";break;case x.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${K.joinValues(e.options)}`;break;case x.invalid_enum_value:r=`Invalid enum value. Expected ${K.joinValues(e.options)}, received '${e.received}'`;break;case x.invalid_arguments:r="Invalid function arguments";break;case x.invalid_return_type:r="Invalid function return type";break;case x.invalid_date:r="Invalid date";break;case x.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else K.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case x.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case x.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case x.custom:r="Invalid input";break;case x.invalid_intersection_types:r="Intersection results could not be merged";break;case x.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case x.not_finite:r="Number must be finite";break;default:r=t.defaultError,K.assertNever(e)}return{message:r}},Wt=sx;var uc=Wt;function ax(e){uc=e}function xn(){return uc}var Yn=(e)=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",f=n.filter((l)=>!!l).slice().reverse();for(let l of f)a=l(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},cx=[];function I(e,t){let r=xn(),n=Yn({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Wt?void 0:Wt].filter((o)=>!!o)});e.common.issues.push(n)}class ke{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return T;if(n.status==="dirty")e.dirty();r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t){let o=await n.key,i=await n.value;r.push({key:o,value:i})}return ke.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:o,value:i}=n;if(o.status==="aborted")return T;if(i.status==="aborted")return T;if(o.status==="dirty")e.dirty();if(i.status==="dirty")e.dirty();if(o.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet))r[o.value]=i.value}return{status:e.value,value:r}}}var T=Object.freeze({status:"aborted"}),Mr=(e)=>({status:"dirty",value:e}),Me=(e)=>({status:"valid",value:e}),Xo=(e)=>e.status==="aborted",Zo=(e)=>e.status==="dirty",mr=(e)=>e.status==="valid",gn=(e)=>typeof Promise<"u"&&e instanceof Promise;var w;(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(w||(w={}));class Rt{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var fc=(e,t)=>{if(mr(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ve(e.common.issues);return this._error=r,this._error}}}};function C(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:o};return{errorMap:(s,a)=>{let{message:f}=e;if(s.code==="invalid_enum_value")return{message:f??a.defaultError};if(typeof a.data>"u")return{message:f??n??a.defaultError};if(s.code!=="invalid_type")return{message:a.defaultError};return{message:f??r??a.defaultError}},description:o}}class M{get description(){return this._def.description}_getType(e){return jt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:jt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ke,ctx:{common:e.parent.common,data:e.data,parsedType:jt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(gn(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jt(e)},n=this._parseSync({data:e,path:r.path,parent:r});return fc(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jt(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return mr(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>mr(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:jt(e)},n=this._parse({data:e,path:r.path,parent:r}),o=await(gn(n)?n:Promise.resolve(n));return fc(r,o)}refine(e,t){let r=(n)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(n);else return t};return this._refinement((n,o)=>{let i=e(n),s=()=>o.addIssue({code:x.custom,...r(n)});if(typeof Promise<"u"&&i instanceof Promise)return i.then((a)=>{if(!a)return s(),!1;else return!0});if(!i)return s(),!1;else return!0})}refinement(e,t){return this._refinement((r,n)=>{if(!e(r))return n.addIssue(typeof t==="function"?t(r,n):t),!1;else return!0})}_refinement(e){return new Tt({schema:this,typeName:A.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(t)=>this["~validate"](t)}}optional(){return wt.create(this,this._def)}nullable(){return Yt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ft.create(this)}promise(){return Er.create(this,this._def)}or(e){return $n.create([this,e],this._def)}and(e){return Fn.create(this,e,this._def)}transform(e){return new Tt({...C(this._def),schema:this,typeName:A.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new An({...C(this._def),innerType:this,defaultValue:t,typeName:A.ZodDefault})}brand(){return new ti({typeName:A.ZodBranded,type:this,...C(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new kn({...C(this._def),innerType:this,catchValue:t,typeName:A.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return ro.create(this,e)}readonly(){return Nn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var ux=/^c[^\s-]{8,}$/i,fx=/^[0-9a-z]+$/,mx=/^[0-9A-HJKMNP-TV-Z]{26}$/i,dx=/^[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,px=/^[a-z0-9_-]{21}$/i,lx=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yx=/^[-+]?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)?)??$/,xx=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,gx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Di,Ix=/^(?:(?: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])$/,hx=/^(?:(?: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])$/,bx=/^(([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]))$/,_x=/^(([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])$/,Ox=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$x=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dc="((\\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])))",Fx=new RegExp(`^${dc}$`);function pc(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function wx(e){return new RegExp(`^${pc(e)}$`)}function lc(e){let t=`${dc}T${pc(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Rx(e,t){if((t==="v4"||!t)&&Ix.test(e))return!0;if((t==="v6"||!t)&&bx.test(e))return!0;return!1}function Tx(e,t){if(!lx.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));if(typeof o!=="object"||o===null)return!1;if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&o.alg!==t)return!1;return!0}catch{return!1}}function Ax(e,t){if((t==="v4"||!t)&&hx.test(e))return!0;if((t==="v6"||!t)&&_x.test(e))return!0;return!1}class $t extends M{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==_.string){let o=this._getOrReturnCtx(e);return I(o,{code:x.invalid_type,expected:_.string,received:o.parsedType}),T}let r=new ke,n=void 0;for(let o of this._def.checks)if(o.kind==="min"){if(e.data.length<o.value)n=this._getOrReturnCtx(e,n),I(n,{code:x.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty()}else if(o.kind==="max"){if(e.data.length>o.value)n=this._getOrReturnCtx(e,n),I(n,{code:x.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty()}else if(o.kind==="length"){let i=e.data.length>o.value,s=e.data.length<o.value;if(i||s){if(n=this._getOrReturnCtx(e,n),i)I(n,{code:x.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message});else if(s)I(n,{code:x.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message});r.dirty()}}else if(o.kind==="email"){if(!xx.test(e.data))n=this._getOrReturnCtx(e,n),I(n,{validation:"email",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="emoji"){if(!Di)Di=new RegExp(gx,"u");if(!Di.test(e.data))n=this._getOrReturnCtx(e,n),I(n,{validation:"emoji",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="uuid"){if(!dx.test(e.data))n=this._getOrReturnCtx(e,n),I(n,{validation:"uuid",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="nanoid"){if(!px.test(e.data))n=this._getOrReturnCtx(e,n),I(n,{validation:"nanoid",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="cuid"){if(!ux.test(e.data))n=this._getOrReturnCtx(e,n),I(n,{validation:"cuid",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="cuid2"){if(!fx.test(e.data))n=this._getOrReturnCtx(e,n),I(n,{validation:"cuid2",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="ulid"){if(!mx.test(e.data))n=this._getOrReturnCtx(e,n),I(n,{validation:"ulid",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),I(n,{validation:"url",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="regex"){if(o.regex.lastIndex=0,!o.regex.test(e.data))n=this._getOrReturnCtx(e,n),I(n,{validation:"regex",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="trim")e.data=e.data.trim();else if(o.kind==="includes"){if(!e.data.includes(o.value,o.position))n=this._getOrReturnCtx(e,n),I(n,{code:x.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()}else if(o.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(o.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(o.kind==="startsWith"){if(!e.data.startsWith(o.value))n=this._getOrReturnCtx(e,n),I(n,{code:x.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()}else if(o.kind==="endsWith"){if(!e.data.endsWith(o.value))n=this._getOrReturnCtx(e,n),I(n,{code:x.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()}else if(o.kind==="datetime"){if(!lc(o).test(e.data))n=this._getOrReturnCtx(e,n),I(n,{code:x.invalid_string,validation:"datetime",message:o.message}),r.dirty()}else if(o.kind==="date"){if(!Fx.test(e.data))n=this._getOrReturnCtx(e,n),I(n,{code:x.invalid_string,validation:"date",message:o.message}),r.dirty()}else if(o.kind==="time"){if(!wx(o).test(e.data))n=this._getOrReturnCtx(e,n),I(n,{code:x.invalid_string,validation:"time",message:o.message}),r.dirty()}else if(o.kind==="duration"){if(!yx.test(e.data))n=this._getOrReturnCtx(e,n),I(n,{validation:"duration",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="ip"){if(!Rx(e.data,o.version))n=this._getOrReturnCtx(e,n),I(n,{validation:"ip",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="jwt"){if(!Tx(e.data,o.alg))n=this._getOrReturnCtx(e,n),I(n,{validation:"jwt",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="cidr"){if(!Ax(e.data,o.version))n=this._getOrReturnCtx(e,n),I(n,{validation:"cidr",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="base64"){if(!Ox.test(e.data))n=this._getOrReturnCtx(e,n),I(n,{validation:"base64",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="base64url"){if(!$x.test(e.data))n=this._getOrReturnCtx(e,n),I(n,{validation:"base64url",code:x.invalid_string,message:o.message}),r.dirty()}else K.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((n)=>e.test(n),{validation:t,code:x.invalid_string,...w.errToObj(r)})}_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){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return 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){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return 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,t){return this._addCheck({kind:"regex",regex:e,...w.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...w.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...w.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...w.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...w.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...w.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...w.errToObj(t)})}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 t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}$t.create=(e)=>new $t({checks:[],typeName:A.ZodString,coerce:e?.coerce??!1,...C(e)});function kx(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}class pr extends M{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);if(this._getType(e)!==_.number){let o=this._getOrReturnCtx(e);return I(o,{code:x.invalid_type,expected:_.number,received:o.parsedType}),T}let r=void 0,n=new ke;for(let o of this._def.checks)if(o.kind==="int"){if(!K.isInteger(e.data))r=this._getOrReturnCtx(e,r),I(r,{code:x.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()}else if(o.kind==="min"){if(o.inclusive?e.data<o.value:e.data<=o.value)r=this._getOrReturnCtx(e,r),I(r,{code:x.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()}else if(o.kind==="max"){if(o.inclusive?e.data>o.value:e.data>=o.value)r=this._getOrReturnCtx(e,r),I(r,{code:x.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()}else if(o.kind==="multipleOf"){if(kx(e.data,o.value)!==0)r=this._getOrReturnCtx(e,r),I(r,{code:x.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()}else if(o.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),I(r,{code:x.not_finite,message:o.message}),n.dirty()}else K.assertNever(o);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(e,t,r,n){return new pr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:w.toString(n)}]})}_addCheck(e){return new pr({...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,t){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(t)})}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 t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&K.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}}pr.create=(e)=>new pr({checks:[],typeName:A.ZodNumber,coerce:e?.coerce||!1,...C(e)});class lr extends M{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)!==_.bigint)return this._getInvalidInput(e);let r=void 0,n=new ke;for(let o of this._def.checks)if(o.kind==="min"){if(o.inclusive?e.data<o.value:e.data<=o.value)r=this._getOrReturnCtx(e,r),I(r,{code:x.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()}else if(o.kind==="max"){if(o.inclusive?e.data>o.value:e.data>=o.value)r=this._getOrReturnCtx(e,r),I(r,{code:x.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()}else if(o.kind==="multipleOf"){if(e.data%o.value!==BigInt(0))r=this._getOrReturnCtx(e,r),I(r,{code:x.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()}else K.assertNever(o);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return I(t,{code:x.invalid_type,expected:_.bigint,received:t.parsedType}),T}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(e,t,r,n){return new lr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:w.toString(n)}]})}_addCheck(e){return new lr({...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,t){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}lr.create=(e)=>new lr({checks:[],typeName:A.ZodBigInt,coerce:e?.coerce??!1,...C(e)});class bn extends M{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==_.boolean){let r=this._getOrReturnCtx(e);return I(r,{code:x.invalid_type,expected:_.boolean,received:r.parsedType}),T}return Me(e.data)}}bn.create=(e)=>new bn({typeName:A.ZodBoolean,coerce:e?.coerce||!1,...C(e)});class Sr extends M{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==_.date){let o=this._getOrReturnCtx(e);return I(o,{code:x.invalid_type,expected:_.date,received:o.parsedType}),T}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return I(o,{code:x.invalid_date}),T}let r=new ke,n=void 0;for(let o of this._def.checks)if(o.kind==="min"){if(e.data.getTime()<o.value)n=this._getOrReturnCtx(e,n),I(n,{code:x.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()}else if(o.kind==="max"){if(e.data.getTime()>o.value)n=this._getOrReturnCtx(e,n),I(n,{code:x.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()}else K.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Sr({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}}Sr.create=(e)=>new Sr({checks:[],coerce:e?.coerce||!1,typeName:A.ZodDate,...C(e)});class Qn extends M{_parse(e){if(this._getType(e)!==_.symbol){let r=this._getOrReturnCtx(e);return I(r,{code:x.invalid_type,expected:_.symbol,received:r.parsedType}),T}return Me(e.data)}}Qn.create=(e)=>new Qn({typeName:A.ZodSymbol,...C(e)});class _n extends M{_parse(e){if(this._getType(e)!==_.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:x.invalid_type,expected:_.undefined,received:r.parsedType}),T}return Me(e.data)}}_n.create=(e)=>new _n({typeName:A.ZodUndefined,...C(e)});class On extends M{_parse(e){if(this._getType(e)!==_.null){let r=this._getOrReturnCtx(e);return I(r,{code:x.invalid_type,expected:_.null,received:r.parsedType}),T}return Me(e.data)}}On.create=(e)=>new On({typeName:A.ZodNull,...C(e)});class Ur extends M{constructor(){super(...arguments);this._any=!0}_parse(e){return Me(e.data)}}Ur.create=(e)=>new Ur({typeName:A.ZodAny,...C(e)});class dr extends M{constructor(){super(...arguments);this._unknown=!0}_parse(e){return Me(e.data)}}dr.create=(e)=>new dr({typeName:A.ZodUnknown,...C(e)});class Mt extends M{_parse(e){let t=this._getOrReturnCtx(e);return I(t,{code:x.invalid_type,expected:_.never,received:t.parsedType}),T}}Mt.create=(e)=>new Mt({typeName:A.ZodNever,...C(e)});class Xn extends M{_parse(e){if(this._getType(e)!==_.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:x.invalid_type,expected:_.void,received:r.parsedType}),T}return Me(e.data)}}Xn.create=(e)=>new Xn({typeName:A.ZodVoid,...C(e)});class Ft extends M{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==_.array)return I(t,{code:x.invalid_type,expected:_.array,received:t.parsedType}),T;if(n.exactLength!==null){let i=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;if(i||s)I(t,{code:i?x.too_big:x.too_small,minimum:s?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty()}if(n.minLength!==null){if(t.data.length<n.minLength.value)I(t,{code:x.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()}if(n.maxLength!==null){if(t.data.length>n.maxLength.value)I(t,{code:x.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((i,s)=>n.type._parseAsync(new Rt(t,i,t.path,s)))).then((i)=>ke.mergeArray(r,i));let o=[...t.data].map((i,s)=>n.type._parseSync(new Rt(t,i,t.path,s)));return ke.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new Ft({...this._def,minLength:{value:e,message:w.toString(t)}})}max(e,t){return new Ft({...this._def,maxLength:{value:e,message:w.toString(t)}})}length(e,t){return new Ft({...this._def,exactLength:{value:e,message:w.toString(t)}})}nonempty(e){return this.min(1,e)}}Ft.create=(e,t)=>new Ft({type:e,minLength:null,maxLength:null,exactLength:null,typeName:A.ZodArray,...C(t)});function In(e){if(e instanceof de){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=wt.create(In(n))}return new de({...e._def,shape:()=>t})}else if(e instanceof Ft)return new Ft({...e._def,type:In(e.element)});else if(e instanceof wt)return wt.create(In(e.unwrap()));else if(e instanceof Yt)return Yt.create(In(e.unwrap()));else if(e instanceof St)return St.create(e.items.map((t)=>In(t)));else return e}class de extends M{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=K.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==_.object){let f=this._getOrReturnCtx(e);return I(f,{code:x.invalid_type,expected:_.object,received:f.parsedType}),T}let{status:r,ctx:n}=this._processInputParams(e),{shape:o,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof Mt&&this._def.unknownKeys==="strip")){for(let f in n.data)if(!i.includes(f))s.push(f)}let a=[];for(let f of i){let l=o[f],g=n.data[f];a.push({key:{status:"valid",value:f},value:l._parse(new Rt(n,g,n.path,f)),alwaysSet:f in n.data})}if(this._def.catchall instanceof Mt){let f=this._def.unknownKeys;if(f==="passthrough")for(let l of s)a.push({key:{status:"valid",value:l},value:{status:"valid",value:n.data[l]}});else if(f==="strict"){if(s.length>0)I(n,{code:x.unrecognized_keys,keys:s}),r.dirty()}else if(f==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let l of s){let g=n.data[l];a.push({key:{status:"valid",value:l},value:f._parse(new Rt(n,g,n.path,l)),alwaysSet:l in n.data})}}if(n.common.async)return Promise.resolve().then(async()=>{let f=[];for(let l of a){let g=await l.key,R=await l.value;f.push({key:g,value:R,alwaysSet:l.alwaysSet})}return f}).then((f)=>ke.mergeObjectSync(r,f));else return ke.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new de({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:w.errToObj(e).message??n};return{message:n}}}:{}})}strip(){return new de({...this._def,unknownKeys:"strip"})}passthrough(){return new de({...this._def,unknownKeys:"passthrough"})}extend(e){return new de({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new de({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:A.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new de({...this._def,catchall:e})}pick(e){let t={};for(let r of K.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new de({...this._def,shape:()=>t})}omit(e){let t={};for(let r of K.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new de({...this._def,shape:()=>t})}deepPartial(){return In(this)}partial(e){let t={};for(let r of K.objectKeys(this.shape)){let n=this.shape[r];if(e&&!e[r])t[r]=n;else t[r]=n.optional()}return new de({...this._def,shape:()=>t})}required(e){let t={};for(let r of K.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];while(o instanceof wt)o=o._def.innerType;t[r]=o}return new de({...this._def,shape:()=>t})}keyof(){return yc(K.objectKeys(this.shape))}}de.create=(e,t)=>new de({shape:()=>e,unknownKeys:"strip",catchall:Mt.create(),typeName:A.ZodObject,...C(t)});de.strictCreate=(e,t)=>new de({shape:()=>e,unknownKeys:"strict",catchall:Mt.create(),typeName:A.ZodObject,...C(t)});de.lazycreate=(e,t)=>new de({shape:e,unknownKeys:"strip",catchall:Mt.create(),typeName:A.ZodObject,...C(t)});class $n extends M{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(o){for(let s of o)if(s.result.status==="valid")return s.result;for(let s of o)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let i=o.map((s)=>new ve(s.ctx.common.issues));return I(t,{code:x.invalid_union,unionErrors:i}),T}if(t.common.async)return Promise.all(r.map(async(o)=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);else{let o=void 0,i=[];for(let a of r){let f={...t,common:{...t.common,issues:[]},parent:null},l=a._parseSync({data:t.data,path:t.path,parent:f});if(l.status==="valid")return l;else if(l.status==="dirty"&&!o)o={result:l,ctx:f};if(f.common.issues.length)i.push(f.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let s=i.map((a)=>new ve(a));return I(t,{code:x.invalid_union,unionErrors:s}),T}}get options(){return this._def.options}}$n.create=(e,t)=>new $n({options:e,typeName:A.ZodUnion,...C(t)});var Jt=(e)=>{if(e instanceof wn)return Jt(e.schema);else if(e instanceof Tt)return Jt(e.innerType());else if(e instanceof Rn)return[e.value];else if(e instanceof yr)return e.options;else if(e instanceof Tn)return K.objectValues(e.enum);else if(e instanceof An)return Jt(e._def.innerType);else if(e instanceof _n)return[void 0];else if(e instanceof On)return[null];else if(e instanceof wt)return[void 0,...Jt(e.unwrap())];else if(e instanceof Yt)return[null,...Jt(e.unwrap())];else if(e instanceof ti)return Jt(e.unwrap());else if(e instanceof Nn)return Jt(e.unwrap());else if(e instanceof kn)return Jt(e._def.innerType);else return[]};class ei extends M{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.object)return I(t,{code:x.invalid_type,expected:_.object,received:t.parsedType}),T;let r=this.discriminator,n=t.data[r],o=this.optionsMap.get(n);if(!o)return I(t,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),T;if(t.common.async)return o._parseAsync({data:t.data,path:t.path,parent:t});else return o._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let o of t){let i=Jt(o.shape[e]);if(!i.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of i){if(n.has(s))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);n.set(s,o)}}return new ei({typeName:A.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...C(r)})}}function vi(e,t){let r=jt(e),n=jt(t);if(e===t)return{valid:!0,data:e};else if(r===_.object&&n===_.object){let o=K.objectKeys(t),i=K.objectKeys(e).filter((a)=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let f=vi(e[a],t[a]);if(!f.valid)return{valid:!1};s[a]=f.data}return{valid:!0,data:s}}else if(r===_.array&&n===_.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],f=vi(s,a);if(!f.valid)return{valid:!1};o.push(f.data)}return{valid:!0,data:o}}else if(r===_.date&&n===_.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class Fn extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(o,i)=>{if(Xo(o)||Xo(i))return T;let s=vi(o.value,i.value);if(!s.valid)return I(r,{code:x.invalid_intersection_types}),T;if(Zo(o)||Zo(i))t.dirty();return{status:t.value,value:s.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,i])=>n(o,i));else return n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Fn.create=(e,t,r)=>new Fn({left:e,right:t,typeName:A.ZodIntersection,...C(r)});class St extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.array)return I(r,{code:x.invalid_type,expected:_.array,received:r.parsedType}),T;if(r.data.length<this._def.items.length)return I(r,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),T;if(!this._def.rest&&r.data.length>this._def.items.length)I(r,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let o=[...r.data].map((i,s)=>{let a=this._def.items[s]||this._def.rest;if(!a)return null;return a._parse(new Rt(r,i,r.path,s))}).filter((i)=>!!i);if(r.common.async)return Promise.all(o).then((i)=>ke.mergeArray(t,i));else return ke.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new St({...this._def,rest:e})}}St.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new St({items:e,typeName:A.ZodTuple,rest:null,...C(t)})};class Zn extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.object)return I(r,{code:x.invalid_type,expected:_.object,received:r.parsedType}),T;let n=[],o=this._def.keyType,i=this._def.valueType;for(let s in r.data)n.push({key:o._parse(new Rt(r,s,r.path,s)),value:i._parse(new Rt(r,r.data[s],r.path,s)),alwaysSet:s in r.data});if(r.common.async)return ke.mergeObjectAsync(t,n);else return ke.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof M)return new Zn({keyType:e,valueType:t,typeName:A.ZodRecord,...C(r)});return new Zn({keyType:$t.create(),valueType:e,typeName:A.ZodRecord,...C(t)})}}class eo extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.map)return I(r,{code:x.invalid_type,expected:_.map,received:r.parsedType}),T;let n=this._def.keyType,o=this._def.valueType,i=[...r.data.entries()].map(([s,a],f)=>({key:n._parse(new Rt(r,s,r.path,[f,"key"])),value:o._parse(new Rt(r,a,r.path,[f,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let a of i){let f=await a.key,l=await a.value;if(f.status==="aborted"||l.status==="aborted")return T;if(f.status==="dirty"||l.status==="dirty")t.dirty();s.set(f.value,l.value)}return{status:t.value,value:s}})}else{let s=new Map;for(let a of i){let{key:f,value:l}=a;if(f.status==="aborted"||l.status==="aborted")return T;if(f.status==="dirty"||l.status==="dirty")t.dirty();s.set(f.value,l.value)}return{status:t.value,value:s}}}}eo.create=(e,t,r)=>new eo({valueType:t,keyType:e,typeName:A.ZodMap,...C(r)});class Kr extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.set)return I(r,{code:x.invalid_type,expected:_.set,received:r.parsedType}),T;let n=this._def;if(n.minSize!==null){if(r.data.size<n.minSize.value)I(r,{code:x.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()}if(n.maxSize!==null){if(r.data.size>n.maxSize.value)I(r,{code:x.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty()}let o=this._def.valueType;function i(a){let f=new Set;for(let l of a){if(l.status==="aborted")return T;if(l.status==="dirty")t.dirty();f.add(l.value)}return{status:t.value,value:f}}let s=[...r.data.values()].map((a,f)=>o._parse(new Rt(r,a,r.path,f)));if(r.common.async)return Promise.all(s).then((a)=>i(a));else return i(s)}min(e,t){return new Kr({...this._def,minSize:{value:e,message:w.toString(t)}})}max(e,t){return new Kr({...this._def,maxSize:{value:e,message:w.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Kr.create=(e,t)=>new Kr({valueType:e,minSize:null,maxSize:null,typeName:A.ZodSet,...C(t)});class hn extends M{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.function)return I(t,{code:x.invalid_type,expected:_.function,received:t.parsedType}),T;function r(s,a){return Yn({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,xn(),Wt].filter((f)=>!!f),issueData:{code:x.invalid_arguments,argumentsError:a}})}function n(s,a){return Yn({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,xn(),Wt].filter((f)=>!!f),issueData:{code:x.invalid_return_type,returnTypeError:a}})}let o={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Er){let s=this;return Me(async function(...a){let f=new ve([]),l=await s._def.args.parseAsync(a,o).catch((J)=>{throw f.addIssue(r(a,J)),f}),g=await Reflect.apply(i,this,l);return await s._def.returns._def.type.parseAsync(g,o).catch((J)=>{throw f.addIssue(n(g,J)),f})})}else{let s=this;return Me(function(...a){let f=s._def.args.safeParse(a,o);if(!f.success)throw new ve([r(a,f.error)]);let l=Reflect.apply(i,this,f.data),g=s._def.returns.safeParse(l,o);if(!g.success)throw new ve([n(l,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new hn({...this._def,args:St.create(e).rest(dr.create())})}returns(e){return new hn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new hn({args:e?e:St.create([]).rest(dr.create()),returns:t||dr.create(),typeName:A.ZodFunction,...C(r)})}}class wn extends M{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}wn.create=(e,t)=>new wn({getter:e,typeName:A.ZodLazy,...C(t)});class Rn extends M{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return I(t,{received:t.data,code:x.invalid_literal,expected:this._def.value}),T}return{status:"valid",value:e.data}}get value(){return this._def.value}}Rn.create=(e,t)=>new Rn({value:e,typeName:A.ZodLiteral,...C(t)});function yc(e,t){return new yr({values:e,typeName:A.ZodEnum,...C(t)})}class yr extends M{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return I(t,{expected:K.joinValues(r),received:t.parsedType,code:x.invalid_type}),T}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return I(t,{received:t.data,code:x.invalid_enum_value,options:r}),T}return Me(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return yr.create(e,{...this._def,...t})}exclude(e,t=this._def){return yr.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}}yr.create=yc;class Tn extends M{_parse(e){let t=K.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==_.string&&r.parsedType!==_.number){let n=K.objectValues(t);return I(r,{expected:K.joinValues(n),received:r.parsedType,code:x.invalid_type}),T}if(!this._cache)this._cache=new Set(K.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let n=K.objectValues(t);return I(r,{received:r.data,code:x.invalid_enum_value,options:n}),T}return Me(e.data)}get enum(){return this._def.values}}Tn.create=(e,t)=>new Tn({values:e,typeName:A.ZodNativeEnum,...C(t)});class Er extends M{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.promise&&t.common.async===!1)return I(t,{code:x.invalid_type,expected:_.promise,received:t.parsedType}),T;let r=t.parsedType===_.promise?t.data:Promise.resolve(t.data);return Me(r.then((n)=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Er.create=(e,t)=>new Er({type:e,typeName:A.ZodPromise,...C(t)});class Tt extends M{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:(i)=>{if(I(r,i),i.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let i=n.transform(r.data,o);if(r.common.async)return Promise.resolve(i).then(async(s)=>{if(t.value==="aborted")return T;let a=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});if(a.status==="aborted")return T;if(a.status==="dirty")return Mr(a.value);if(t.value==="dirty")return Mr(a.value);return a});else{if(t.value==="aborted")return T;let s=this._def.schema._parseSync({data:i,path:r.path,parent:r});if(s.status==="aborted")return T;if(s.status==="dirty")return Mr(s.value);if(t.value==="dirty")return Mr(s.value);return s}}if(n.type==="refinement"){let i=(s)=>{let a=n.refinement(s,o);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(s.status==="aborted")return T;if(s.status==="dirty")t.dirty();return i(s.value),{status:t.value,value:s.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(s.status==="aborted")return T;if(s.status==="dirty")t.dirty();return i(s.value).then(()=>({status:t.value,value:s.value}))})}if(n.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!mr(i))return T;let s=n.transform(i.value,o);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((i)=>{if(!mr(i))return T;return Promise.resolve(n.transform(i.value,o)).then((s)=>({status:t.value,value:s}))});K.assertNever(n)}}Tt.create=(e,t,r)=>new Tt({schema:e,typeName:A.ZodEffects,effect:t,...C(r)});Tt.createWithPreprocess=(e,t,r)=>new Tt({schema:t,effect:{type:"preprocess",transform:e},typeName:A.ZodEffects,...C(r)});class wt extends M{_parse(e){if(this._getType(e)===_.undefined)return Me(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}wt.create=(e,t)=>new wt({innerType:e,typeName:A.ZodOptional,...C(t)});class Yt extends M{_parse(e){if(this._getType(e)===_.null)return Me(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Yt.create=(e,t)=>new Yt({innerType:e,typeName:A.ZodNullable,...C(t)});class An extends M{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===_.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:A.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...C(t)});class kn extends M{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(gn(n))return n.then((o)=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ve(r.common.issues)},input:r.data})}));else return{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ve(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}kn.create=(e,t)=>new kn({innerType:e,typeName:A.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...C(t)});class to extends M{_parse(e){if(this._getType(e)!==_.nan){let r=this._getOrReturnCtx(e);return I(r,{code:x.invalid_type,expected:_.nan,received:r.parsedType}),T}return{status:"valid",value:e.data}}}to.create=(e)=>new to({typeName:A.ZodNaN,...C(e)});var Nx=Symbol("zod_brand");class ti extends M{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ro extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(o.status==="aborted")return T;if(o.status==="dirty")return t.dirty(),Mr(o.value);else return this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();else{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return T;if(n.status==="dirty")return t.dirty(),{status:"dirty",value:n.value};else return this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new ro({in:e,out:t,typeName:A.ZodPipeline})}}class Nn extends M{_parse(e){let t=this._def.innerType._parse(e),r=(n)=>{if(mr(n))n.value=Object.freeze(n.value);return n};return gn(t)?t.then((n)=>r(n)):r(t)}unwrap(){return this._def.innerType}}Nn.create=(e,t)=>new Nn({innerType:e,typeName:A.ZodReadonly,...C(t)});function mc(e,t){let r=typeof e==="function"?e(t):typeof e==="string"?{message:e}:e;return typeof r==="string"?{message:r}:r}function xc(e,t={},r){if(e)return Ur.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then((s)=>{if(!s){let a=mc(t,n),f=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:f})}});if(!i){let s=mc(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}return});return Ur.create()}var Px={object:de.lazycreate},A;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(A||(A={}));var Cx=(e,t={message:`Input not instance of ${e.name}`})=>xc((r)=>r instanceof e,t),gc=$t.create,Ic=pr.create,jx=to.create,Mx=lr.create,hc=bn.create,Sx=Sr.create,Ux=Qn.create,Kx=_n.create,Ex=On.create,Lx=Ur.create,Bx=dr.create,Gx=Mt.create,Dx=Xn.create,vx=Ft.create,{create:qx,strictCreate:Vx}=de,Hx=$n.create,zx=ei.create,Wx=Fn.create,Jx=St.create,Yx=Zn.create,Qx=eo.create,Xx=Kr.create,Zx=hn.create,eg=wn.create,tg=Rn.create,rg=yr.create,ng=Tn.create,og=Er.create,ig=Tt.create,sg=wt.create,ag=Yt.create,cg=Tt.createWithPreprocess,ug=ro.create,fg=()=>gc().optional(),mg=()=>Ic().optional(),dg=()=>hc().optional(),pg={string:(e)=>$t.create({...e,coerce:!0}),number:(e)=>pr.create({...e,coerce:!0}),boolean:(e)=>bn.create({...e,coerce:!0}),bigint:(e)=>lr.create({...e,coerce:!0}),date:(e)=>Sr.create({...e,coerce:!0})};var lg=T;var yg=ri,Lr=(e,t=400)=>Response.json(e,{status:t,headers:{"Content-Type":"application/json"}}),bc=(e)=>{let t=Qo.Compile(e);return async(r,n)=>{try{let o=await r.jsonBody();if(!t.Check(o)){let i=t.Errors(o).First();return Lr({status:"error",code:"VALIDATION_FAILED",message:i?.message||"Invalid input",path:i?.path||"body"})}return r.body=o,n?n():void 0}catch{return Lr({status:"error",message:"Malformed JSON payload"})}}},_c=(e)=>{let t=e.properties||{},r=Object.keys(t),n=r.length;return async(o,i)=>{try{let s=o instanceof Object&&"req"in o,a=s?await o.jsonBody():await o.json();if(!a||typeof a!=="object"||Array.isArray(a))return Lr({status:"error",message:"Invalid JSON object payload"});for(let f=0;f<n;f++){let l=r[f];if(!Object.hasOwn(a,l)||typeof a[l]!==t[l]?.type)return Lr({status:"error",code:"TYPE_MISMATCH",message:`Field '${l}' must be of type ${t[l]?.type}`,field:l})}if(s)o.body=a;return i?i():void 0}catch{return Lr({status:"error",message:"Invalid JSON payload"})}}},Oc=(e)=>async(t,r)=>{try{let n=t instanceof Object&&"req"in t,o=n?await t.jsonBody():await t.json(),i=await e.safeParseAsync(o);if(!i.success)return Lr({status:"error",code:"ZOD_ERROR",errors:i.error.flatten()});if(n)t.body=i.data;return r?r():void 0}catch{return Lr({status:"error",message:"Invalid JSON payload"})}},xg=(e)=>{if(e&&"_def"in e)return Oc(e);if(e&&(e.kind||e.type||e[Symbol.for("TypeBox.Kind")]))return bc(e);return _c(e)};var gg=(e={})=>{let t=e.origin||"*",r=e.methods||"GET,POST,PUT,PATCH,DELETE,OPTIONS",n={"Access-Control-Allow-Origin":t,"Access-Control-Allow-Methods":r,"Access-Control-Allow-Headers":"Content-Type, Authorization"};if(t!=="*")n.Vary="Origin";let o={status:204,headers:n};return(s,a)=>{if(s.req.method==="OPTIONS")return new Response(null,o);if(s.setHeader("Access-Control-Allow-Origin",t),s.setHeader("Access-Control-Allow-Methods",r),t!=="*")s.setHeader("Vary","Origin");let f=a?.();if(f&&typeof f.then==="function")return f.then((l)=>{if(l instanceof Response){if(l.headers.set("Access-Control-Allow-Origin",t),l.headers.set("Access-Control-Allow-Methods",r),t!=="*")l.headers.set("Vary","Origin")}return l});if(f instanceof Response){if(f.headers.set("Access-Control-Allow-Origin",t),f.headers.set("Access-Control-Allow-Methods",r),t!=="*")f.headers.set("Vary","Origin")}return f}};import{resolve as $c,sep as Fc}from"path";var Ig=(e="public")=>{let t=$c(process.cwd(),e),r=t.endsWith(Fc)?t:t+Fc;return async(n,o)=>{let i=n.req.method;if(i!=="GET"&&i!=="HEAD")return o();let s=n.req.url,a=s.indexOf("/",8),f=a===-1?-1:s.indexOf("?",a),l=a===-1?"":f===-1?s.slice(a):s.slice(a,f),g;try{g=decodeURIComponent(l)}catch{return n.status(400).send("Bad Request")}if(g.includes("\x00"))return n.status(400).send("Bad Request");let R=g.replace(/^\/+/,""),J=$c(t,R);if(J!==t&&!J.startsWith(r))return n.status(403).send("Forbidden");let be=Bun.file(J);if(await be.exists())return new Response(be);return o()}};import{createHash as g0,createHmac as hg,timingSafeEqual as bg}from"crypto";var Rc=new TextEncoder,qi=(e)=>typeof e==="string"?Buffer.from(e).toString("base64url"):Buffer.from(e).toString("base64url"),wc=(e)=>Buffer.from(e,"base64url").toString("utf-8"),Vi=new Map,_g=async(e)=>{if(Vi.has(e))return Vi.get(e);let t=await crypto.subtle.importKey("raw",Rc.encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]);return Vi.set(e,t),t},Og=async(e,t)=>{let r=JSON.stringify({alg:"HS256",typ:"JWT"}),n=JSON.stringify(e),o=qi(r),i=qi(n),s=`${o}.${i}`,a=await _g(t),f=await crypto.subtle.sign("HMAC",a,Rc.encode(s)),l=qi(new Uint8Array(f));return`${s}.${l}`},$g=(e)=>(t,r)=>{let n=t.req.headers.get("Authorization");if(!n?.startsWith("Bearer "))return t.status(401).send("Bearer token required");let o=n.slice(7),i=o.indexOf("."),s=i===-1?-1:o.indexOf(".",i+1);if(i===-1||s===-1||o.indexOf(".",s+1)!==-1)return t.status(401).send("Malformed JWT token");let a=o.slice(0,i),f=o.slice(i+1,s),l=o.slice(s+1),g=o.slice(0,s);try{let R=hg("sha256",e).update(g).digest(),J=Buffer.from(l,"base64url");if(J.length!==R.length||!bg(J,R))return t.status(401).send("Invalid signature");let be=JSON.parse(wc(a));if(!be||be.alg!=="HS256")return t.status(401).send("Unsupported token algorithm");let P=JSON.parse(wc(f)),qe=Date.now()*0.001;if(typeof P.exp==="number"&&qe>=P.exp)return t.status(401).send("Token expired");if(typeof P.nbf==="number"&&qe<P.nbf)return t.status(401).send("Token not active");if(t.set("user",P),Array.isArray(r)){if(r.length===0)return;let[no,...Pn]=r;return no(t,Pn)}if(typeof r==="function")return r();return}catch{return t.status(401).send("Token verification failed")}};Jo();var Tc={make:(e)=>Bun.password.hash(e,dn.hash),verify:(e,t)=>Bun.password.verify(e,t),needsRehash:(e)=>{let{algorithm:t,memoryCost:r,timeCost:n}=dn.hash;if(t==="bcrypt"){if(!/^\$2[aby]\$/.test(e))return!0;let s=e.match(/^\$2[aby]\$(\d+)\$/);return!s||Number(s[1])!==n}if(!e.startsWith(`$${t}$`))return!0;let o=e.match(/(?:^|[,$])m=(\d+)(?:[,$]|$)/),i=e.match(/(?:^|[,$])t=(\d+)(?:[,$]|$)/);return!o||Number(o[1])!==r||!i||Number(i[1])!==n}};export{Ha as BareJS,Dr as BareRouter,Tc as Hash,Tc as Password,Gp as T,Gp as Type,Gp as TypeBox,yg as Z,yg as Zod,$g as bareAuth,gg as cors,Og as createToken,_c as n,_c as native,Ig as staticFile,bc as t,bc as typebox,xg as v,xg as validate,Oc as z,Oc as zod};