From a47e57bb354c836d23fb73f14cfd6870abeabeaf Mon Sep 17 00:00:00 2001 From: Alex Newman Date: Thu, 25 Dec 2025 20:40:18 -0500 Subject: [PATCH] feat(GeminiAgent): expand available Gemini models and update RPM limits - Added new Gemini model types: 'gemini-2.5-pro', 'gemini-2.0-flash', and 'gemini-2.0-flash-lite'. - Updated RPM limits for existing and new models. - Enhanced model selection logic to validate configured model against available options, with fallback to a default model. --- plugin/scripts/worker-service.cjs | 6 ++--- src/services/worker/GeminiAgent.ts | 40 ++++++++++++++++++++++++------ 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/plugin/scripts/worker-service.cjs b/plugin/scripts/worker-service.cjs index 4f04a6fc..afecd2b1 100755 --- a/plugin/scripts/worker-service.cjs +++ b/plugin/scripts/worker-service.cjs @@ -49,7 +49,7 @@ Please see the 3.x to 4.x migration guide for details on how to update your app.
`+e+`
-`}function M4(){return function(){this.error(404)}}function D4(){return function(e){if(this.hasTrailingSlash()){this.error(404);return}var r=rf.original(this.req);r.path=null,r.pathname=N4(r.pathname+"/");var n=P4(I4.format(r)),a=j4("Redirecting","Redirecting to "+O4(n));e.statusCode=301,e.setHeader("Content-Type","text/html; charset=UTF-8"),e.setHeader("Content-Length",Buffer.byteLength(a)),e.setHeader("Content-Security-Policy","default-src 'none'"),e.setHeader("X-Content-Type-Options","nosniff"),e.setHeader("Location",n),e.end(a)}}});var wx=V((Qt,xx)=>{"use strict";var Xc=B_(),q4=require("events").EventEmitter,gx=G_(),yx=k0(),L4=kp(),F4=Rp(),_x=Y0(),bx=mx();Qt=xx.exports=U4;function U4(){var t=function(e,r,n){t.handle(e,r,n)};return gx(t,q4.prototype,!1),gx(t,yx,!1),t.request=Object.create(_x,{app:{configurable:!0,enumerable:!0,writable:!0,value:t}}),t.response=Object.create(bx,{app:{configurable:!0,enumerable:!0,writable:!0,value:t}}),t.init(),t}Qt.application=yx;Qt.request=_x;Qt.response=bx;Qt.Route=L4;Qt.Router=F4;Qt.json=Xc.json;Qt.query=Pp();Qt.raw=Xc.raw;Qt.static=vx();Qt.text=Xc.text;Qt.urlencoded=Xc.urlencoded;var z4=["bodyParser","compress","cookieSession","session","logger","cookieParser","favicon","responseTime","errorHandler","timeout","methodOverride","vhost","csrf","directory","limit","multipart","staticCache"];z4.forEach(function(t){Object.defineProperty(Qt,t,{get:function(){throw new Error("Most middleware (like "+t+") is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.")},configurable:!0})})});var Jc=V((PZ,Sx)=>{"use strict";Sx.exports=wx()});var tw=V((pu,ew)=>{(function(t,e){typeof pu=="object"&&typeof ew<"u"?e(pu):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(pu,(function(t){"use strict";function e(){for(var B=arguments.length,D=Array(B),G=0;G1){D[0]=D[0].slice(0,-1);for(var X=D.length-1,Y=1;Y= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$=m-g,N=Math.floor,j=String.fromCharCode;function L(B){throw new RangeError(T[B])}function H(B,D){for(var G=[],X=B.length;X--;)G[X]=D(B[X]);return G}function A(B,D){var G=B.split("@"),X="";G.length>1&&(X=G[0]+"@",B=G[1]),B=B.replace(E,".");var Y=B.split("."),ye=H(Y,D).join(".");return X+ye}function W(B){for(var D=[],G=0,X=B.length;G=55296&&Y<=56319&&G>1,D+=N(D/G);D>$*b>>1;Y+=m)D=N(D/$);return N(Y+($+1)*D/(D+f))},U=function(D){var G=[],X=D.length,Y=0,ye=v,De=y,Ze=D.lastIndexOf(_);Ze<0&&(Ze=0);for(var Qe=0;Qe=128&&L("not-basic"),G.push(D.charCodeAt(Qe));for(var Pt=Ze>0?Ze+1:0;Pt=X&&L("invalid-input");var ft=he(D.charCodeAt(Pt++));(ft>=m||ft>N((p-Y)/yt))&&L("overflow"),Y+=ft*yt;var Ke=Ot<=De?g:Ot>=De+b?b:Ot-De;if(ftN(p/_t)&&L("overflow"),yt*=_t}var rt=G.length+1;De=re(Y-Ve,rt,Ve==0),N(Y/rt)>p-ye&&L("overflow"),ye+=N(Y/rt),Y%=rt,G.splice(Y++,0,ye)}return String.fromCodePoint.apply(String,G)},R=function(D){var G=[];D=W(D);var X=D.length,Y=v,ye=0,De=y,Ze=!0,Qe=!1,Pt=void 0;try{for(var Ve=D[Symbol.iterator](),yt;!(Ze=(yt=Ve.next()).done);Ze=!0){var Ot=yt.value;Ot<128&&G.push(j(Ot))}}catch(Xa){Qe=!0,Pt=Xa}finally{try{!Ze&&Ve.return&&Ve.return()}finally{if(Qe)throw Pt}}var ft=G.length,Ke=ft;for(ft&&G.push(_);Ke=Y&&ur<_t&&(_t=ur)}}catch(Xa){Wa=!0,cr=Xa}finally{try{!rt&&fr.return&&fr.return()}finally{if(Wa)throw cr}}var mr=Ke+1;_t-Y>N((p-ye)/mr)&&L("overflow"),ye+=(_t-Y)*mr,Y=_t;var Br=!0,Ka=!1,ia=void 0;try{for(var mi=D[Symbol.iterator](),zo;!(Br=(zo=mi.next()).done);Br=!0){var Ho=zo.value;if(Hop&&L("overflow"),Ho==Y){for(var Gn=ye,Zn=m;;Zn+=m){var oa=Zn<=De?g:Zn>=De+b?b:Zn-De;if(Gn>6|192).toString(16).toUpperCase()+"%"+(D&63|128).toString(16).toUpperCase():G="%"+(D>>12|224).toString(16).toUpperCase()+"%"+(D>>6&63|128).toString(16).toUpperCase()+"%"+(D&63|128).toString(16).toUpperCase(),G}function K(B){for(var D="",G=0,X=B.length;G=194&&Y<224){if(X-G>=6){var ye=parseInt(B.substr(G+4,2),16);D+=String.fromCharCode((Y&31)<<6|ye&63)}else D+=B.substr(G,6);G+=6}else if(Y>=224){if(X-G>=9){var De=parseInt(B.substr(G+4,2),16),Ze=parseInt(B.substr(G+7,2),16);D+=String.fromCharCode((Y&15)<<12|(De&63)<<6|Ze&63)}else D+=B.substr(G,9);G+=9}else D+=B.substr(G,3),G+=3}return D}function J(B,D){function G(X){var Y=K(X);return Y.match(D.UNRESERVED)?Y:X}return B.scheme&&(B.scheme=String(B.scheme).replace(D.PCT_ENCODED,G).toLowerCase().replace(D.NOT_SCHEME,"")),B.userinfo!==void 0&&(B.userinfo=String(B.userinfo).replace(D.PCT_ENCODED,G).replace(D.NOT_USERINFO,M).replace(D.PCT_ENCODED,a)),B.host!==void 0&&(B.host=String(B.host).replace(D.PCT_ENCODED,G).toLowerCase().replace(D.NOT_HOST,M).replace(D.PCT_ENCODED,a)),B.path!==void 0&&(B.path=String(B.path).replace(D.PCT_ENCODED,G).replace(B.scheme?D.NOT_PATH:D.NOT_PATH_NOSCHEME,M).replace(D.PCT_ENCODED,a)),B.query!==void 0&&(B.query=String(B.query).replace(D.PCT_ENCODED,G).replace(D.NOT_QUERY,M).replace(D.PCT_ENCODED,a)),B.fragment!==void 0&&(B.fragment=String(B.fragment).replace(D.PCT_ENCODED,G).replace(D.NOT_FRAGMENT,M).replace(D.PCT_ENCODED,a)),B}function de(B){return B.replace(/^0*(.*)/,"$1")||"0"}function se(B,D){var G=B.match(D.IPV4ADDRESS)||[],X=l(G,2),Y=X[1];return Y?Y.split(".").map(de).join("."):B}function me(B,D){var G=B.match(D.IPV6ADDRESS)||[],X=l(G,3),Y=X[1],ye=X[2];if(Y){for(var De=Y.toLowerCase().split("::").reverse(),Ze=l(De,2),Qe=Ze[0],Pt=Ze[1],Ve=Pt?Pt.split(":").map(de):[],yt=Qe.split(":").map(de),Ot=D.IPV4ADDRESS.test(yt[yt.length-1]),ft=Ot?7:8,Ke=yt.length-ft,_t=Array(ft),rt=0;rt1){var st=_t.slice(0,cr.index),ur=_t.slice(cr.index+cr.length);fr=st.join(":")+"::"+ur.join(":")}else fr=_t.join(":");return ye&&(fr+="%"+ye),fr}else return B}var O=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,C="".match(/(){0}/)[1]===void 0;function F(B){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},G={},X=D.iri!==!1?u:c;D.reference==="suffix"&&(B=(D.scheme?D.scheme+":":"")+"//"+B);var Y=B.match(O);if(Y){C?(G.scheme=Y[1],G.userinfo=Y[3],G.host=Y[4],G.port=parseInt(Y[5],10),G.path=Y[6]||"",G.query=Y[7],G.fragment=Y[8],isNaN(G.port)&&(G.port=Y[5])):(G.scheme=Y[1]||void 0,G.userinfo=B.indexOf("@")!==-1?Y[3]:void 0,G.host=B.indexOf("//")!==-1?Y[4]:void 0,G.port=parseInt(Y[5],10),G.path=Y[6]||"",G.query=B.indexOf("?")!==-1?Y[7]:void 0,G.fragment=B.indexOf("#")!==-1?Y[8]:void 0,isNaN(G.port)&&(G.port=B.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?Y[4]:void 0)),G.host&&(G.host=me(se(G.host,X),X)),G.scheme===void 0&&G.userinfo===void 0&&G.host===void 0&&G.port===void 0&&!G.path&&G.query===void 0?G.reference="same-document":G.scheme===void 0?G.reference="relative":G.fragment===void 0?G.reference="absolute":G.reference="uri",D.reference&&D.reference!=="suffix"&&D.reference!==G.reference&&(G.error=G.error||"URI is not a "+D.reference+" reference.");var ye=k[(D.scheme||G.scheme||"").toLowerCase()];if(!D.unicodeSupport&&(!ye||!ye.unicodeSupport)){if(G.host&&(D.domainHost||ye&&ye.domainHost))try{G.host=w.toASCII(G.host.replace(X.PCT_ENCODED,K).toLowerCase())}catch(De){G.error=G.error||"Host's domain name can not be converted to ASCII via punycode: "+De}J(G,c)}else J(G,X);ye&&ye.parse&&ye.parse(G,D)}else G.error=G.error||"URI can not be parsed.";return G}function Z(B,D){var G=D.iri!==!1?u:c,X=[];return B.userinfo!==void 0&&(X.push(B.userinfo),X.push("@")),B.host!==void 0&&X.push(me(se(String(B.host),G),G).replace(G.IPV6ADDRESS,function(Y,ye,De){return"["+ye+(De?"%25"+De:"")+"]"})),(typeof B.port=="number"||typeof B.port=="string")&&(X.push(":"),X.push(String(B.port))),X.length?X.join(""):void 0}var ee=/^\.\.?\//,ce=/^\/\.(\/|$)/,Te=/^\/\.\.(\/|$)/,Ie=/^\/?(?:.|\n)*?(?=\/|$)/;function Ae(B){for(var D=[];B.length;)if(B.match(ee))B=B.replace(ee,"");else if(B.match(ce))B=B.replace(ce,"/");else if(B.match(Te))B=B.replace(Te,"/"),D.pop();else if(B==="."||B==="..")B="";else{var G=B.match(Ie);if(G){var X=G[0];B=B.slice(X.length),D.push(X)}else throw new Error("Unexpected dot segment condition")}return D.join("")}function Ne(B){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},G=D.iri?u:c,X=[],Y=k[(D.scheme||B.scheme||"").toLowerCase()];if(Y&&Y.serialize&&Y.serialize(B,D),B.host&&!G.IPV6ADDRESS.test(B.host)){if(D.domainHost||Y&&Y.domainHost)try{B.host=D.iri?w.toUnicode(B.host):w.toASCII(B.host.replace(G.PCT_ENCODED,K).toLowerCase())}catch(Ze){B.error=B.error||"Host's domain name can not be converted to "+(D.iri?"Unicode":"ASCII")+" via punycode: "+Ze}}J(B,G),D.reference!=="suffix"&&B.scheme&&(X.push(B.scheme),X.push(":"));var ye=Z(B,D);if(ye!==void 0&&(D.reference!=="suffix"&&X.push("//"),X.push(ye),B.path&&B.path.charAt(0)!=="/"&&X.push("/")),B.path!==void 0){var De=B.path;!D.absolutePath&&(!Y||!Y.absolutePath)&&(De=Ae(De)),ye===void 0&&(De=De.replace(/^\/\//,"/%2F")),X.push(De)}return B.query!==void 0&&(X.push("?"),X.push(B.query)),B.fragment!==void 0&&(X.push("#"),X.push(B.fragment)),X.join("")}function ke(B,D){var G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},X=arguments[3],Y={};return X||(B=F(Ne(B,G),G),D=F(Ne(D,G),G)),G=G||{},!G.tolerant&&D.scheme?(Y.scheme=D.scheme,Y.userinfo=D.userinfo,Y.host=D.host,Y.port=D.port,Y.path=Ae(D.path||""),Y.query=D.query):(D.userinfo!==void 0||D.host!==void 0||D.port!==void 0?(Y.userinfo=D.userinfo,Y.host=D.host,Y.port=D.port,Y.path=Ae(D.path||""),Y.query=D.query):(D.path?(D.path.charAt(0)==="/"?Y.path=Ae(D.path):((B.userinfo!==void 0||B.host!==void 0||B.port!==void 0)&&!B.path?Y.path="/"+D.path:B.path?Y.path=B.path.slice(0,B.path.lastIndexOf("/")+1)+D.path:Y.path=D.path,Y.path=Ae(Y.path)),Y.query=D.query):(Y.path=B.path,D.query!==void 0?Y.query=D.query:Y.query=B.query),Y.userinfo=B.userinfo,Y.host=B.host,Y.port=B.port),Y.scheme=B.scheme),Y.fragment=D.fragment,Y}function pt(B,D,G){var X=i({scheme:"null"},G);return Ne(ke(F(B,X),F(D,X),X,!0),X)}function Le(B,D){return typeof B=="string"?B=Ne(F(B,D),D):n(B)==="object"&&(B=F(Ne(B,D),D)),B}function pr(B,D,G){return typeof B=="string"?B=Ne(F(B,G),G):n(B)==="object"&&(B=Ne(B,G)),typeof D=="string"?D=Ne(F(D,G),G):n(D)==="object"&&(D=Ne(D,G)),B===D}function Vt(B,D){return B&&B.toString().replace(!D||!D.iri?c.ESCAPE:u.ESCAPE,M)}function It(B,D){return B&&B.toString().replace(!D||!D.iri?c.PCT_ENCODED:u.PCT_ENCODED,K)}var Ir={scheme:"http",domainHost:!0,parse:function(D,G){return D.host||(D.error=D.error||"HTTP URIs must have a host."),D},serialize:function(D,G){var X=String(D.scheme).toLowerCase()==="https";return(D.port===(X?443:80)||D.port==="")&&(D.port=void 0),D.path||(D.path="/"),D}},Sa={scheme:"https",domainHost:Ir.domainHost,parse:Ir.parse,serialize:Ir.serialize};function Bn(B){return typeof B.secure=="boolean"?B.secure:String(B.scheme).toLowerCase()==="wss"}var fi={scheme:"ws",domainHost:!0,parse:function(D,G){var X=D;return X.secure=Bn(X),X.resourceName=(X.path||"/")+(X.query?"?"+X.query:""),X.path=void 0,X.query=void 0,X},serialize:function(D,G){if((D.port===(Bn(D)?443:80)||D.port==="")&&(D.port=void 0),typeof D.secure=="boolean"&&(D.scheme=D.secure?"wss":"ws",D.secure=void 0),D.resourceName){var X=D.resourceName.split("?"),Y=l(X,2),ye=Y[0],De=Y[1];D.path=ye&&ye!=="/"?ye:void 0,D.query=De,D.resourceName=void 0}return D.fragment=void 0,D}},ph={scheme:"wss",domainHost:fi.domainHost,parse:fi.parse,serialize:fi.serialize},w$={},S$=!0,fh="[A-Za-z0-9\\-\\.\\_\\~"+(S$?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Hr="[0-9A-Fa-f]",E$=r(r("%[EFef]"+Hr+"%"+Hr+Hr+"%"+Hr+Hr)+"|"+r("%[89A-Fa-f]"+Hr+"%"+Hr+Hr)+"|"+r("%"+Hr+Hr)),T$="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",k$="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",$$=e(k$,'[\\"\\\\]'),R$="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",P$=new RegExp(fh,"g"),Vn=new RegExp(E$,"g"),O$=new RegExp(e("[^]",T$,"[\\.]",'[\\"]',$$),"g"),mh=new RegExp(e("[^]",fh,R$),"g"),C$=mh;function td(B){var D=K(B);return D.match(P$)?D:B}var hh={scheme:"mailto",parse:function(D,G){var X=D,Y=X.to=X.path?X.path.split(","):[];if(X.path=void 0,X.query){for(var ye=!1,De={},Ze=X.query.split("&"),Qe=0,Pt=Ze.length;Qe{"use strict";rw.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,a,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(a=n;a--!==0;)if(!t(e[a],r[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(a=n;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[a]))return!1;for(a=n;a--!==0;){var i=s[a];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var nw=V((mW,aw)=>{"use strict";aw.exports=function(e){for(var r=0,n=e.length,a=0,s;a=55296&&s<=56319&&a{"use strict";ow.exports={copy:K2,checkDataType:wf,checkDataTypes:X2,coerceToTypes:J2,toHash:Ef,getProperty:Tf,escapeQuotes:kf,equal:fu(),ucs2length:nw(),varOccurences:e8,varReplace:t8,schemaHasRules:r8,schemaHasRulesExcept:a8,schemaUnknownRules:n8,toQuotedString:Sf,getPathExpr:s8,getPath:i8,getData:u8,unescapeFragment:l8,unescapeJsonPointer:Rf,escapeFragment:d8,escapeJsonPointer:$f};function K2(t,e){e=e||{};for(var r in t)e[r]=t[r];return e}function wf(t,e,r,n){var a=n?" !== ":" === ",s=n?" || ":" && ",i=n?"!":"",o=n?"":"!";switch(t){case"null":return e+a+"null";case"array":return i+"Array.isArray("+e+")";case"object":return"("+i+e+s+"typeof "+e+a+'"object"'+s+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+a+'"number"'+s+o+"("+e+" % 1)"+s+e+a+e+(r?s+i+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+a+'"'+t+'"'+(r?s+i+"isFinite("+e+")":"")+")";default:return"typeof "+e+a+'"'+t+'"'}}function X2(t,e,r){switch(t.length){case 1:return wf(t[0],e,r,!0);default:var n="",a=Ef(t);a.array&&a.object&&(n=a.null?"(":"(!"+e+" || ",n+="typeof "+e+' !== "object")',delete a.null,delete a.array,delete a.object),a.number&&delete a.integer;for(var s in a)n+=(n?" && ":"")+wf(s,e,r,!0);return n}}var sw=Ef(["string","number","integer","boolean","null"]);function J2(t,e){if(Array.isArray(e)){for(var r=[],n=0;n=e)throw new Error("Cannot access property/index "+n+" levels up, current level is "+e);return r[e-n]}if(n>e)throw new Error("Cannot access data "+n+" levels up, current level is "+e);if(s="data"+(e-n||""),!a)return s}for(var o=s,c=a.split("/"),u=0;u{"use strict";var p8=Cn();cw.exports=f8;function f8(t){p8.copy(t,this)}});var lw=V((gW,uw)=>{"use strict";var Ma=uw.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},a=r.post||function(){};mu(e,n,a,t,"",t)};Ma.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Ma.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ma.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ma.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function mu(t,e,r,n,a,s,i,o,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,a,s,i,o,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in Ma.arrayKeywords)for(var p=0;p{"use strict";var so=tw(),dw=fu(),yu=Cn(),hu=Pf(),h8=lw();mw.exports=qa;qa.normalizeId=Da;qa.fullPath=vu;qa.url=gu;qa.ids=b8;qa.inlineRef=Of;qa.schema=_u;function qa(t,e,r){var n=this._refs[r];if(typeof n=="string")if(this._refs[n])n=this._refs[n];else return qa.call(this,t,e,n);if(n=n||this._schemas[r],n instanceof hu)return Of(n.schema,this._opts.inlineRefs)?n.schema:n.validate||this._compile(n);var a=_u.call(this,e,r),s,i,o;return a&&(s=a.schema,e=a.root,o=a.baseId),s instanceof hu?i=s.validate||t.call(this,s.schema,e,void 0,o):s!==void 0&&(i=Of(s,this._opts.inlineRefs)?s:t.call(this,s,e,void 0,o)),i}function _u(t,e){var r=so.parse(e),n=fw(r),a=vu(this._getId(t.schema));if(Object.keys(t.schema).length===0||n!==a){var s=Da(n),i=this._refs[s];if(typeof i=="string")return v8.call(this,t,i,r);if(i instanceof hu)i.validate||this._compile(i),t=i;else if(i=this._schemas[s],i instanceof hu){if(i.validate||this._compile(i),s==Da(e))return{schema:i,root:t,baseId:a};t=i}else return;if(!t.schema)return;a=vu(this._getId(t.schema))}return pw.call(this,r,a,t.schema,t)}function v8(t,e,r){var n=_u.call(this,t,e);if(n){var a=n.schema,s=n.baseId;t=n.root;var i=this._getId(a);return i&&(s=gu(s,i)),pw.call(this,r,s,a,t)}}var g8=yu.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function pw(t,e,r,n){if(t.fragment=t.fragment||"",t.fragment.slice(0,1)=="/"){for(var a=t.fragment.split("/"),s=1;s{"use strict";var Af=bu();vw.exports={Validation:hw(x8),MissingRef:hw(Nf)};function x8(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}Nf.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function Nf(t,e,r){this.message=r||Nf.message(t,e),this.missingRef=Af.url(t,e),this.missingSchema=Af.normalizeId(Af.fullPath(this.missingRef))}function hw(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}});var jf=V((bW,gw)=>{"use strict";gw.exports=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,n=e.cmp&&(function(s){return function(i){return function(o,c){var u={key:o,value:i[o]},l={key:c,value:i[c]};return s(u,l)}}})(e.cmp),a=[];return(function s(i){if(i&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i!==void 0){if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);var o,c;if(Array.isArray(i)){for(c="[",o=0;o{"use strict";yw.exports=function(e,r,n){var a="",s=e.schema.$async===!0,i=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var u="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(u);else throw new Error(u)}}if(e.isTop&&(a+=" var validate = ",s&&(e.async=!0,a+="async "),a+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(a+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(i||e.schema.$ref)){var r="false schema",l=e.level,d=e.dataLevel,p=e.schema[r],m=e.schemaPath+e.util.getProperty(r),g=e.errSchemaPath+"/"+r,S=!e.opts.allErrors,T,b="data"+(d||""),_="valid"+l;if(e.schema===!1){e.isTop?S=!0:a+=" var "+_+" = false; ";var f=f||[];f.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(T||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'boolean schema is false' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),a+=" } "):a+=" {} ";var h=a;a=f.pop(),!e.compositeRule&&S?e.async?a+=" throw new ValidationError(["+h+"]); ":a+=" validate.errors = ["+h+"]; return false; ":a+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?s?a+=" return data; ":a+=" validate.errors = null; return true; ":a+=" var "+_+" = true; ";return e.isTop&&(a+=" }; return validate; "),a}if(e.isTop){var y=e.isTop,l=e.level=0,d=e.dataLevel=0,b="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var v="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(v);else throw new Error(v)}a+=" var vErrors = null; ",a+=" var errors = 0; ",a+=" if (rootData === undefined) rootData = data; "}else{var l=e.level,d=e.dataLevel,b="data"+(d||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),s&&!e.async)throw new Error("async schema in sync schema");a+=" var errs_"+l+" = errors;"}var _="valid"+l,S=!e.opts.allErrors,x="",E="",T,$=e.schema.type,N=Array.isArray($);if($&&e.opts.nullable&&e.schema.nullable===!0&&(N?$.indexOf("null")==-1&&($=$.concat("null")):$!="null"&&($=[$,"null"],N=!0)),N&&$.length==1&&($=$[0],N=!1),e.schema.$ref&&i){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(i=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(a+=" "+e.RULES.all.$comment.code(e,"$comment")),$){if(e.opts.coerceTypes)var j=e.util.coerceToTypes(e.opts.coerceTypes,$);var L=e.RULES.types[$];if(j||N||L===!0||L&&!Ie(L)){var m=e.schemaPath+".type",g=e.errSchemaPath+"/type",m=e.schemaPath+".type",g=e.errSchemaPath+"/type",H=N?"checkDataTypes":"checkDataType";if(a+=" if ("+e.util[H]($,b,e.opts.strictNumbers,!0)+") { ",j){var A="dataType"+l,W="coerced"+l;a+=" var "+A+" = typeof "+b+"; var "+W+" = undefined; ",e.opts.coerceTypes=="array"&&(a+=" if ("+A+" == 'object' && Array.isArray("+b+") && "+b+".length == 1) { "+b+" = "+b+"[0]; "+A+" = typeof "+b+"; if ("+e.util.checkDataType(e.schema.type,b,e.opts.strictNumbers)+") "+W+" = "+b+"; } "),a+=" if ("+W+" !== undefined) ; ";var oe=j;if(oe)for(var he,ne=-1,re=oe.length-1;ne{"use strict";var wu=bu(),Eu=Cn(),bw=xu(),w8=jf(),_w=Mf(),S8=Eu.ucs2length,E8=fu(),T8=bw.Validation;ww.exports=Df;function Df(t,e,r,n){var a=this,s=this._opts,i=[void 0],o={},c=[],u={},l=[],d={},p=[];e=e||{schema:t,refVal:i,refs:o};var m=k8.call(this,t,e,n),g=this._compilations[m.index];if(m.compiling)return g.callValidate=v;var b=this._formats,f=this.RULES;try{var h=_(t,e,r,n);g.validate=h;var y=g.callValidate;return y&&(y.schema=h.schema,y.errors=null,y.refs=h.refs,y.refVal=h.refVal,y.root=h.root,y.$async=h.$async,s.sourceCode&&(y.source=h.source)),h}finally{$8.call(this,t,e,n)}function v(){var H=g.validate,A=H.apply(this,arguments);return v.errors=H.errors,A}function _(H,A,W,oe){var he=!A||A&&A.schema==H;if(A.schema!=e.schema)return Df.call(a,H,A,W,oe);var ne=H.$async===!0,re=_w({isTop:!0,schema:H,isRoot:he,baseId:oe,root:A,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:bw.MissingRef,RULES:f,validate:_w,util:Eu,resolve:wu,resolveRef:S,usePattern:N,useDefault:j,useCustomRule:L,opts:s,formats:b,logger:a.logger,self:a});re=Su(i,O8)+Su(c,R8)+Su(l,P8)+Su(p,C8)+re,s.processCode&&(re=s.processCode(re,H));var U;try{var R=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",re);U=R(a,f,b,e,i,l,p,E8,S8,T8),i[0]=U}catch(z){throw a.logger.error("Error compiling schema, function code:",re),z}return U.schema=H,U.errors=null,U.refs=o,U.refVal=i,U.root=he?U:A,ne&&(U.$async=!0),s.sourceCode===!0&&(U.source={code:re,patterns:c,defaults:l}),U}function S(H,A,W){A=wu.url(H,A);var oe=o[A],he,ne;if(oe!==void 0)return he=i[oe],ne="refVal["+oe+"]",$(he,ne);if(!W&&e.refs){var re=e.refs[A];if(re!==void 0)return he=e.refVal[re],ne=x(A,he),$(he,ne)}ne=x(A);var U=wu.call(a,_,e,A);if(U===void 0){var R=r&&r[A];R&&(U=wu.inlineRef(R,s.inlineRefs)?R:Df.call(a,R,e,r,H))}if(U===void 0)E(A);else return T(A,U),$(U,ne)}function x(H,A){var W=i.length;return i[W]=A,o[H]=W,"refVal"+W}function E(H){delete o[H]}function T(H,A){var W=o[H];i[W]=A}function $(H,A){return typeof H=="object"||typeof H=="boolean"?{code:A,schema:H,inline:!0}:{code:A,$async:H&&!!H.$async}}function N(H){var A=u[H];return A===void 0&&(A=u[H]=c.length,c[A]=H),"pattern"+A}function j(H){switch(typeof H){case"boolean":case"number":return""+H;case"string":return Eu.toQuotedString(H);case"object":if(H===null)return"null";var A=w8(H),W=d[A];return W===void 0&&(W=d[A]=l.length,l[W]=H),"default"+W}}function L(H,A,W,oe){if(a._opts.validateSchema!==!1){var he=H.definition.dependencies;if(he&&!he.every(function(M){return Object.prototype.hasOwnProperty.call(W,M)}))throw new Error("parent schema must have all required keywords: "+he.join(","));var ne=H.definition.validateSchema;if(ne){var re=ne(A);if(!re){var U="keyword schema is invalid: "+a.errorsText(ne.errors);if(a._opts.validateSchema=="log")a.logger.error(U);else throw new Error(U)}}}var R=H.definition.compile,z=H.definition.inline,I=H.definition.macro,w;if(R)w=R.call(a,A,W,oe);else if(I)w=I.call(a,A,W,oe),s.validateSchema!==!1&&a.validateSchema(w,!0);else if(z)w=z.call(a,oe,H.keyword,A,W);else if(w=H.definition.validate,!w)return;if(w===void 0)throw new Error('custom keyword "'+H.keyword+'"failed to compile');var k=p.length;return p[k]=w,{code:"customRule"+k,validate:w}}}function k8(t,e,r){var n=xw.call(this,t,e,r);return n>=0?{index:n,compiling:!0}:(n=this._compilations.length,this._compilations[n]={schema:t,root:e,baseId:r},{index:n,compiling:!1})}function $8(t,e,r){var n=xw.call(this,t,e,r);n>=0&&this._compilations.splice(n,1)}function xw(t,e,r){for(var n=0;n{"use strict";var Tu=Ew.exports=function(){this._cache={}};Tu.prototype.put=function(e,r){this._cache[e]=r};Tu.prototype.get=function(e){return this._cache[e]};Tu.prototype.del=function(e){delete this._cache[e]};Tu.prototype.clear=function(){this._cache={}}});var Dw=V((EW,Mw)=>{"use strict";var I8=Cn(),A8=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,N8=[0,31,28,31,30,31,30,31,31,30,31,30,31],j8=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,kw=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,M8=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,D8=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,$w=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Rw=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Pw=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Ow=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Cw=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Iw=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Mw.exports=ku;function ku(t){return t=t=="full"?"full":"fast",I8.copy(ku[t])}ku.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":$w,url:Rw,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:kw,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:jw,uuid:Pw,"json-pointer":Ow,"json-pointer-uri-fragment":Cw,"relative-json-pointer":Iw};ku.full={date:Aw,time:Nw,"date-time":F8,uri:z8,"uri-reference":D8,"uri-template":$w,url:Rw,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:kw,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:jw,uuid:Pw,"json-pointer":Ow,"json-pointer-uri-fragment":Cw,"relative-json-pointer":Iw};function q8(t){return t%4===0&&(t%100!==0||t%400===0)}function Aw(t){var e=t.match(A8);if(!e)return!1;var r=+e[1],n=+e[2],a=+e[3];return n>=1&&n<=12&&a>=1&&a<=(n==2&&q8(r)?29:N8[n])}function Nw(t,e){var r=t.match(j8);if(!r)return!1;var n=r[1],a=r[2],s=r[3],i=r[5];return(n<=23&&a<=59&&s<=59||n==23&&a==59&&s==60)&&(!e||i)}var L8=/t|\s/i;function F8(t){var e=t.split(L8);return e.length==2&&Aw(e[0])&&Nw(e[1],!0)}var U8=/\/|:/;function z8(t){return U8.test(t)&&M8.test(t)}var H8=/[^\\]\\Z/;function jw(t){if(H8.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Lw=V((TW,qw)=>{"use strict";qw.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,l="data"+(i||""),d="valid"+s,p,m;if(o=="#"||o=="#/")e.isRoot?(p=e.async,m="validate"):(p=e.root.schema.$async===!0,m="root.refVal[0]");else{var g=e.resolveRef(e.baseId,o,e.isRoot);if(g===void 0){var b=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(b);var f=f||[];f.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(a+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(a+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),a+=" } "):a+=" {} ";var h=a;a=f.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+h+"]); ":a+=" validate.errors = ["+h+"]; return false; ":a+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(a+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(b),u&&(a+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,b)}else if(g.inline){var y=e.util.copy(e);y.level++;var v="valid"+y.level;y.schema=g.schema,y.schemaPath="",y.errSchemaPath=o;var _=e.validate(y).replace(/validate\.schema/g,g.code);a+=" "+_+" ",u&&(a+=" if ("+v+") { ")}else p=g.$async===!0||e.async&&g.$async!==!1,m=g.code}if(m){var f=f||[];f.push(a),a="",e.opts.passContext?a+=" "+m+".call(this, ":a+=" "+m+"( ",a+=" "+l+", (dataPath || '')",e.errorPath!='""'&&(a+=" + "+e.errorPath);var S=i?"data"+(i-1||""):"parentData",x=i?e.dataPathArr[i]:"parentDataProperty";a+=" , "+S+" , "+x+", rootData) ";var E=a;if(a=f.pop(),p){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(a+=" var "+d+"; "),a+=" try { await "+E+"; ",u&&(a+=" "+d+" = true; "),a+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(a+=" "+d+" = false; "),a+=" } ",u&&(a+=" if ("+d+") { ")}else a+=" if (!"+E+") { if (vErrors === null) vErrors = "+m+".errors; else vErrors = vErrors.concat("+m+".errors); errors = vErrors.length; } ",u&&(a+=" else { ")}return a}});var Uw=V((kW,Fw)=>{"use strict";Fw.exports=function(e,r,n){var a=" ",s=e.schema[r],i=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u=e.util.copy(e),l="";u.level++;var d="valid"+u.level,p=u.baseId,m=!0,g=s;if(g)for(var b,f=-1,h=g.length-1;f0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(m=!1,u.schema=b,u.schemaPath=i+"["+f+"]",u.errSchemaPath=o+"/"+f,a+=" "+e.validate(u)+" ",u.baseId=p,c&&(a+=" if ("+d+") { ",l+="}"));return c&&(m?a+=" if (true) { ":a+=" "+l.slice(0,-1)+" "),a}});var Hw=V(($W,zw)=>{"use strict";zw.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m="errs__"+s,g=e.util.copy(e),b="";g.level++;var f="valid"+g.level,h=o.every(function(T){return e.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all)});if(h){var y=g.baseId;a+=" var "+m+" = errors; var "+p+" = false; ";var v=e.compositeRule;e.compositeRule=g.compositeRule=!0;var _=o;if(_)for(var S,x=-1,E=_.length-1;x{"use strict";Bw.exports=function(e,r,n){var a=" ",s=e.schema[r],i=e.errSchemaPath+"/"+r,o=!e.opts.allErrors,c=e.util.toQuotedString(s);return e.opts.$comment===!0?a+=" console.log("+c+");":typeof e.opts.$comment=="function"&&(a+=" self._opts.$comment("+c+", "+e.util.toQuotedString(i)+", validate.root.schema);"),a}});var Zw=V((PW,Gw)=>{"use strict";Gw.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m=e.opts.$data&&o&&o.$data,g;m?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+s):g=o,m||(a+=" var schema"+s+" = validate.schema"+c+";"),a+="var "+p+" = equal("+d+", schema"+s+"); if (!"+p+") { ";var b=b||[];b.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValue: schema"+s+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be equal to constant' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var f=a;return a=b.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+f+"]); ":a+=" validate.errors = ["+f+"]; return false; ":a+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",l&&(a+=" else { "),a}});var Kw=V((OW,Ww)=>{"use strict";Ww.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m="errs__"+s,g=e.util.copy(e),b="";g.level++;var f="valid"+g.level,h="i"+s,y=g.dataLevel=e.dataLevel+1,v="data"+y,_=e.baseId,S=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(a+="var "+m+" = errors;var "+p+";",S){var x=e.compositeRule;e.compositeRule=g.compositeRule=!0,g.schema=o,g.schemaPath=c,g.errSchemaPath=u,a+=" var "+f+" = false; for (var "+h+" = 0; "+h+" < "+d+".length; "+h+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers,!0);var E=d+"["+h+"]";g.dataPathArr[y]=h;var T=e.validate(g);g.baseId=_,e.util.varOccurences(T,v)<2?a+=" "+e.util.varReplace(T,v,E)+" ":a+=" var "+v+" = "+E+"; "+T+" ",a+=" if ("+f+") break; } ",e.compositeRule=g.compositeRule=x,a+=" "+b+" if (!"+f+") {"}else a+=" if ("+d+".length == 0) {";var $=$||[];$.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should contain a valid item' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var N=a;return a=$.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+N+"]); ":a+=" validate.errors = ["+N+"]; return false; ":a+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { ",S&&(a+=" errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } "),e.opts.allErrors&&(a+=" } "),a}});var Jw=V((CW,Xw)=>{"use strict";Xw.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="errs__"+s,m=e.util.copy(e),g="";m.level++;var b="valid"+m.level,f={},h={},y=e.opts.ownProperties;for(x in o)if(x!="__proto__"){var v=o[x],_=Array.isArray(v)?h:f;_[x]=v}a+="var "+p+" = errors;";var S=e.errorPath;a+="var missing"+s+";";for(var x in h)if(_=h[x],_.length){if(a+=" if ( "+d+e.util.getProperty(x)+" !== undefined ",y&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(x)+"') "),l){a+=" && ( ";var E=_;if(E)for(var T,$=-1,N=E.length-1;$0||v===!1:e.util.schemaHasRules(v,e.RULES.all))&&(a+=" "+b+" = true; if ( "+d+e.util.getProperty(x)+" !== undefined ",y&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(x)+"') "),a+=") { ",m.schema=v,m.schemaPath=c+e.util.getProperty(x),m.errSchemaPath=u+"/"+e.util.escapeFragment(x),a+=" "+e.validate(m)+" ",m.baseId=U,a+=" } ",l&&(a+=" if ("+b+") { ",g+="}"))}return l&&(a+=" "+g+" if ("+p+" == errors) {"),a}});var Qw=V((IW,Yw)=>{"use strict";Yw.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m=e.opts.$data&&o&&o.$data,g;m?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+s):g=o;var b="i"+s,f="schema"+s;m||(a+=" var "+f+" = validate.schema"+c+";"),a+="var "+p+";",m&&(a+=" if (schema"+s+" === undefined) "+p+" = true; else if (!Array.isArray(schema"+s+")) "+p+" = false; else {"),a+=""+p+" = false;for (var "+b+"=0; "+b+"<"+f+".length; "+b+"++) if (equal("+d+", "+f+"["+b+"])) { "+p+" = true; break; }",m&&(a+=" } "),a+=" if (!"+p+") { ";var h=h||[];h.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValues: schema"+s+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var y=a;return a=h.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+y+"]); ":a+=" validate.errors = ["+y+"]; return false; ":a+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",l&&(a+=" else { "),a}});var tS=V((AW,eS)=>{"use strict";eS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||"");if(e.opts.format===!1)return l&&(a+=" if (true) { "),a;var p=e.opts.$data&&o&&o.$data,m;p?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+s):m=o;var g=e.opts.unknownFormats,b=Array.isArray(g);if(p){var f="format"+s,h="isObject"+s,y="formatType"+s;a+=" var "+f+" = formats["+m+"]; var "+h+" = typeof "+f+" == 'object' && !("+f+" instanceof RegExp) && "+f+".validate; var "+y+" = "+h+" && "+f+".type || 'string'; if ("+h+") { ",e.async&&(a+=" var async"+s+" = "+f+".async; "),a+=" "+f+" = "+f+".validate; } if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'string') || "),a+=" (",g!="ignore"&&(a+=" ("+m+" && !"+f+" ",b&&(a+=" && self._opts.unknownFormats.indexOf("+m+") == -1 "),a+=") || "),a+=" ("+f+" && "+y+" == '"+n+"' && !(typeof "+f+" == 'function' ? ",e.async?a+=" (async"+s+" ? await "+f+"("+d+") : "+f+"("+d+")) ":a+=" "+f+"("+d+") ",a+=" : "+f+".test("+d+"))))) {"}else{var f=e.formats[o];if(!f){if(g=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),l&&(a+=" if (true) { "),a;if(b&&g.indexOf(o)>=0)return l&&(a+=" if (true) { "),a;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var h=typeof f=="object"&&!(f instanceof RegExp)&&f.validate,y=h&&f.type||"string";if(h){var v=f.async===!0;f=f.validate}if(y!=n)return l&&(a+=" if (true) { "),a;if(v){if(!e.async)throw new Error("async format in sync schema");var _="formats"+e.util.getProperty(o)+".validate";a+=" if (!(await "+_+"("+d+"))) { "}else{a+=" if (! ";var _="formats"+e.util.getProperty(o);h&&(_+=".validate"),typeof f=="function"?a+=" "+_+"("+d+") ":a+=" "+_+".test("+d+") ",a+=") { "}}var S=S||[];S.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { format: ",p?a+=""+m:a+=""+e.util.toQuotedString(o),a+=" } ",e.opts.messages!==!1&&(a+=` , message: 'should match format "`,p?a+="' + "+m+" + '":a+=""+e.util.escapeQuotes(o),a+=`"' `),e.opts.verbose&&(a+=" , schema: ",p?a+="validate.schema"+c:a+=""+e.util.toQuotedString(o),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var x=a;return a=S.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",l&&(a+=" else { "),a}});var aS=V((NW,rS)=>{"use strict";rS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m="errs__"+s,g=e.util.copy(e);g.level++;var b="valid"+g.level,f=e.schema.then,h=e.schema.else,y=f!==void 0&&(e.opts.strictKeywords?typeof f=="object"&&Object.keys(f).length>0||f===!1:e.util.schemaHasRules(f,e.RULES.all)),v=h!==void 0&&(e.opts.strictKeywords?typeof h=="object"&&Object.keys(h).length>0||h===!1:e.util.schemaHasRules(h,e.RULES.all)),_=g.baseId;if(y||v){var S;g.createErrors=!1,g.schema=o,g.schemaPath=c,g.errSchemaPath=u,a+=" var "+m+" = errors; var "+p+" = true; ";var x=e.compositeRule;e.compositeRule=g.compositeRule=!0,a+=" "+e.validate(g)+" ",g.baseId=_,g.createErrors=!0,a+=" errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } ",e.compositeRule=g.compositeRule=x,y?(a+=" if ("+b+") { ",g.schema=e.schema.then,g.schemaPath=e.schemaPath+".then",g.errSchemaPath=e.errSchemaPath+"/then",a+=" "+e.validate(g)+" ",g.baseId=_,a+=" "+p+" = "+b+"; ",y&&v?(S="ifClause"+s,a+=" var "+S+" = 'then'; "):S="'then'",a+=" } ",v&&(a+=" else { ")):a+=" if (!"+b+") { ",v&&(g.schema=e.schema.else,g.schemaPath=e.schemaPath+".else",g.errSchemaPath=e.errSchemaPath+"/else",a+=" "+e.validate(g)+" ",g.baseId=_,a+=" "+p+" = "+b+"; ",y&&v?(S="ifClause"+s,a+=" var "+S+" = 'else'; "):S="'else'",a+=" } "),a+=" if (!"+p+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+S+" } ",e.opts.messages!==!1&&(a+=` , message: 'should match "' + `+S+` + '" schema' `),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&l&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } ",l&&(a+=" else { ")}else l&&(a+=" if (true) { ");return a}});var sS=V((jW,nS)=>{"use strict";nS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m="errs__"+s,g=e.util.copy(e),b="";g.level++;var f="valid"+g.level,h="i"+s,y=g.dataLevel=e.dataLevel+1,v="data"+y,_=e.baseId;if(a+="var "+m+" = errors;var "+p+";",Array.isArray(o)){var S=e.schema.additionalItems;if(S===!1){a+=" "+p+" = "+d+".length <= "+o.length+"; ";var x=u;u=e.errSchemaPath+"/additionalItems",a+=" if (!"+p+") { ";var E=E||[];E.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var T=a;a=E.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+T+"]); ":a+=" validate.errors = ["+T+"]; return false; ":a+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",u=x,l&&(b+="}",a+=" else { ")}var $=o;if($){for(var N,j=-1,L=$.length-1;j0||N===!1:e.util.schemaHasRules(N,e.RULES.all)){a+=" "+f+" = true; if ("+d+".length > "+j+") { ";var H=d+"["+j+"]";g.schema=N,g.schemaPath=c+"["+j+"]",g.errSchemaPath=u+"/"+j,g.errorPath=e.util.getPathExpr(e.errorPath,j,e.opts.jsonPointers,!0),g.dataPathArr[y]=j;var A=e.validate(g);g.baseId=_,e.util.varOccurences(A,v)<2?a+=" "+e.util.varReplace(A,v,H)+" ":a+=" var "+v+" = "+H+"; "+A+" ",a+=" } ",l&&(a+=" if ("+f+") { ",b+="}")}}if(typeof S=="object"&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all))){g.schema=S,g.schemaPath=e.schemaPath+".additionalItems",g.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+f+" = true; if ("+d+".length > "+o.length+") { for (var "+h+" = "+o.length+"; "+h+" < "+d+".length; "+h+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers,!0);var H=d+"["+h+"]";g.dataPathArr[y]=h;var A=e.validate(g);g.baseId=_,e.util.varOccurences(A,v)<2?a+=" "+e.util.varReplace(A,v,H)+" ":a+=" var "+v+" = "+H+"; "+A+" ",l&&(a+=" if (!"+f+") break; "),a+=" } } ",l&&(a+=" if ("+f+") { ",b+="}")}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){g.schema=o,g.schemaPath=c,g.errSchemaPath=u,a+=" for (var "+h+" = 0; "+h+" < "+d+".length; "+h+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers,!0);var H=d+"["+h+"]";g.dataPathArr[y]=h;var A=e.validate(g);g.baseId=_,e.util.varOccurences(A,v)<2?a+=" "+e.util.varReplace(A,v,H)+" ":a+=" var "+v+" = "+H+"; "+A+" ",l&&(a+=" if (!"+f+") break; "),a+=" }"}return l&&(a+=" "+b+" if ("+m+" == errors) {"),a}});var qf=V((MW,iS)=>{"use strict";iS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,_,d="data"+(i||""),p=e.opts.$data&&o&&o.$data,m;p?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+s):m=o;var g=r=="maximum",b=g?"exclusiveMaximum":"exclusiveMinimum",f=e.schema[b],h=e.opts.$data&&f&&f.$data,y=g?"<":">",v=g?">":"<",_=void 0;if(!(p||typeof o=="number"||o===void 0))throw new Error(r+" must be number");if(!(h||f===void 0||typeof f=="number"||typeof f=="boolean"))throw new Error(b+" must be number or boolean");if(h){var S=e.util.getData(f.$data,i,e.dataPathArr),x="exclusive"+s,E="exclType"+s,T="exclIsNumber"+s,$="op"+s,N="' + "+$+" + '";a+=" var schemaExcl"+s+" = "+S+"; ",S="schemaExcl"+s,a+=" var "+x+"; var "+E+" = typeof "+S+"; if ("+E+" != 'boolean' && "+E+" != 'undefined' && "+E+" != 'number') { ";var _=b,j=j||[];j.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(_||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: '"+b+" should be boolean' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var L=a;a=j.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+L+"]); ":a+=" validate.errors = ["+L+"]; return false; ":a+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),a+=" "+E+" == 'number' ? ( ("+x+" = "+m+" === undefined || "+S+" "+y+"= "+m+") ? "+d+" "+v+"= "+S+" : "+d+" "+v+" "+m+" ) : ( ("+x+" = "+S+" === true) ? "+d+" "+v+"= "+m+" : "+d+" "+v+" "+m+" ) || "+d+" !== "+d+") { var op"+s+" = "+x+" ? '"+y+"' : '"+y+"='; ",o===void 0&&(_=b,u=e.errSchemaPath+"/"+b,m=S,p=h)}else{var T=typeof f=="number",N=y;if(T&&p){var $="'"+N+"'";a+=" if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),a+=" ( "+m+" === undefined || "+f+" "+y+"= "+m+" ? "+d+" "+v+"= "+f+" : "+d+" "+v+" "+m+" ) || "+d+" !== "+d+") { "}else{T&&o===void 0?(x=!0,_=b,u=e.errSchemaPath+"/"+b,m=f,v+="="):(T&&(m=Math[g?"min":"max"](f,o)),f===(T?m:!0)?(x=!0,_=b,u=e.errSchemaPath+"/"+b,v+="="):(x=!1,N+="="));var $="'"+N+"'";a+=" if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),a+=" "+d+" "+v+" "+m+" || "+d+" !== "+d+") { "}}_=_||r;var j=j||[];j.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(_||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+$+", limit: "+m+", exclusive: "+x+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be "+N+" ",p?a+="' + "+m:a+=""+m+"'"),e.opts.verbose&&(a+=" , schema: ",p?a+="validate.schema"+c:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var L=a;return a=j.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+L+"]); ":a+=" validate.errors = ["+L+"]; return false; ":a+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",l&&(a+=" else { "),a}});var Lf=V((DW,oS)=>{"use strict";oS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,b,d="data"+(i||""),p=e.opts.$data&&o&&o.$data,m;if(p?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+s):m=o,!(p||typeof o=="number"))throw new Error(r+" must be number");var g=r=="maxItems"?">":"<";a+="if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),a+=" "+d+".length "+g+" "+m+") { ";var b=r,f=f||[];f.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(b||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+m+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have ",r=="maxItems"?a+="more":a+="fewer",a+=" than ",p?a+="' + "+m+" + '":a+=""+o,a+=" items' "),e.opts.verbose&&(a+=" , schema: ",p?a+="validate.schema"+c:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var h=a;return a=f.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+h+"]); ":a+=" validate.errors = ["+h+"]; return false; ":a+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",l&&(a+=" else { "),a}});var Ff=V((qW,cS)=>{"use strict";cS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,b,d="data"+(i||""),p=e.opts.$data&&o&&o.$data,m;if(p?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+s):m=o,!(p||typeof o=="number"))throw new Error(r+" must be number");var g=r=="maxLength"?">":"<";a+="if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),e.opts.unicode===!1?a+=" "+d+".length ":a+=" ucs2length("+d+") ",a+=" "+g+" "+m+") { ";var b=r,f=f||[];f.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(b||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+m+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be ",r=="maxLength"?a+="longer":a+="shorter",a+=" than ",p?a+="' + "+m+" + '":a+=""+o,a+=" characters' "),e.opts.verbose&&(a+=" , schema: ",p?a+="validate.schema"+c:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var h=a;return a=f.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+h+"]); ":a+=" validate.errors = ["+h+"]; return false; ":a+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",l&&(a+=" else { "),a}});var Uf=V((LW,uS)=>{"use strict";uS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,b,d="data"+(i||""),p=e.opts.$data&&o&&o.$data,m;if(p?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+s):m=o,!(p||typeof o=="number"))throw new Error(r+" must be number");var g=r=="maxProperties"?">":"<";a+="if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),a+=" Object.keys("+d+").length "+g+" "+m+") { ";var b=r,f=f||[];f.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(b||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+m+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have ",r=="maxProperties"?a+="more":a+="fewer",a+=" than ",p?a+="' + "+m+" + '":a+=""+o,a+=" properties' "),e.opts.verbose&&(a+=" , schema: ",p?a+="validate.schema"+c:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var h=a;return a=f.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+h+"]); ":a+=" validate.errors = ["+h+"]; return false; ":a+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",l&&(a+=" else { "),a}});var dS=V((FW,lS)=>{"use strict";lS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p=e.opts.$data&&o&&o.$data,m;if(p?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+s):m=o,!(p||typeof o=="number"))throw new Error(r+" must be number");a+="var division"+s+";if (",p&&(a+=" "+m+" !== undefined && ( typeof "+m+" != 'number' || "),a+=" (division"+s+" = "+d+" / "+m+", ",e.opts.multipleOfPrecision?a+=" Math.abs(Math.round(division"+s+") - division"+s+") > 1e-"+e.opts.multipleOfPrecision+" ":a+=" division"+s+" !== parseInt(division"+s+") ",a+=" ) ",p&&(a+=" ) "),a+=" ) { ";var g=g||[];g.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { multipleOf: "+m+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be multiple of ",p?a+="' + "+m:a+=""+m+"'"),e.opts.verbose&&(a+=" , schema: ",p?a+="validate.schema"+c:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var b=a;return a=g.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+b+"]); ":a+=" validate.errors = ["+b+"]; return false; ":a+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",l&&(a+=" else { "),a}});var fS=V((UW,pS)=>{"use strict";pS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="errs__"+s,m=e.util.copy(e);m.level++;var g="valid"+m.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){m.schema=o,m.schemaPath=c,m.errSchemaPath=u,a+=" var "+p+" = errors; ";var b=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.createErrors=!1;var f;m.opts.allErrors&&(f=m.opts.allErrors,m.opts.allErrors=!1),a+=" "+e.validate(m)+" ",m.createErrors=!0,f&&(m.opts.allErrors=f),e.compositeRule=m.compositeRule=b,a+=" if ("+g+") { ";var h=h||[];h.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var y=a;a=h.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+y+"]); ":a+=" validate.errors = ["+y+"]; return false; ":a+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+=" var err = ",e.createErrors!==!1?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l&&(a+=" if (false) { ");return a}});var hS=V((zW,mS)=>{"use strict";mS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m="errs__"+s,g=e.util.copy(e),b="";g.level++;var f="valid"+g.level,h=g.baseId,y="prevValid"+s,v="passingSchemas"+s;a+="var "+m+" = errors , "+y+" = false , "+p+" = false , "+v+" = null; ";var _=e.compositeRule;e.compositeRule=g.compositeRule=!0;var S=o;if(S)for(var x,E=-1,T=S.length-1;E0||x===!1:e.util.schemaHasRules(x,e.RULES.all))?(g.schema=x,g.schemaPath=c+"["+E+"]",g.errSchemaPath=u+"/"+E,a+=" "+e.validate(g)+" ",g.baseId=h):a+=" var "+f+" = true; ",E&&(a+=" if ("+f+" && "+y+") { "+p+" = false; "+v+" = ["+v+", "+E+"]; } else { ",b+="}"),a+=" if ("+f+") { "+p+" = "+y+" = true; "+v+" = "+E+"; }";return e.compositeRule=g.compositeRule=_,a+=""+b+"if (!"+p+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+v+" } ",e.opts.messages!==!1&&(a+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&l&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+="} else { errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; }",e.opts.allErrors&&(a+=" } "),a}});var gS=V((HW,vS)=>{"use strict";vS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p=e.opts.$data&&o&&o.$data,m;p?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+s):m=o;var g=p?"(new RegExp("+m+"))":e.usePattern(o);a+="if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'string') || "),a+=" !"+g+".test("+d+") ) { ";var b=b||[];b.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { pattern: ",p?a+=""+m:a+=""+e.util.toQuotedString(o),a+=" } ",e.opts.messages!==!1&&(a+=` , message: 'should match pattern "`,p?a+="' + "+m+" + '":a+=""+e.util.escapeQuotes(o),a+=`"' `),e.opts.verbose&&(a+=" , schema: ",p?a+="validate.schema"+c:a+=""+e.util.toQuotedString(o),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var f=a;return a=b.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+f+"]); ":a+=" validate.errors = ["+f+"]; return false; ":a+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",l&&(a+=" else { "),a}});var _S=V((BW,yS)=>{"use strict";yS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="errs__"+s,m=e.util.copy(e),g="";m.level++;var b="valid"+m.level,f="key"+s,h="idx"+s,y=m.dataLevel=e.dataLevel+1,v="data"+y,_="dataProperties"+s,S=Object.keys(o||{}).filter(ne),x=e.schema.patternProperties||{},E=Object.keys(x).filter(ne),T=e.schema.additionalProperties,$=S.length||E.length,N=T===!1,j=typeof T=="object"&&Object.keys(T).length,L=e.opts.removeAdditional,H=N||j||L,A=e.opts.ownProperties,W=e.baseId,oe=e.schema.required;if(oe&&!(e.opts.$data&&oe.$data)&&oe.length8)a+=" || validate.schema"+c+".hasOwnProperty("+f+") ";else{var re=S;if(re)for(var U,R=-1,z=re.length-1;R0||Ie===!1:e.util.schemaHasRules(Ie,e.RULES.all)){var Ae=e.util.getProperty(U),C=d+Ae,Ne=Z&&Ie.default!==void 0;m.schema=Ie,m.schemaPath=c+Ae,m.errSchemaPath=u+"/"+e.util.escapeFragment(U),m.errorPath=e.util.getPath(e.errorPath,U,e.opts.jsonPointers),m.dataPathArr[y]=e.util.toQuotedString(U);var F=e.validate(m);if(m.baseId=W,e.util.varOccurences(F,v)<2){F=e.util.varReplace(F,v,C);var ke=C}else{var ke=v;a+=" var "+v+" = "+C+"; "}if(Ne)a+=" "+F+" ";else{if(he&&he[U]){a+=" if ( "+ke+" === undefined ",A&&(a+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(U)+"') "),a+=") { "+b+" = false; ";var K=e.errorPath,de=u,pt=e.util.escapeQuotes(U);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(K,U,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var se=se||[];se.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+pt+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+pt+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var me=a;a=se.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+me+"]); ":a+=" validate.errors = ["+me+"]; return false; ":a+=" var err = "+me+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=de,e.errorPath=K,a+=" } else { "}else l?(a+=" if ( "+ke+" === undefined ",A&&(a+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(U)+"') "),a+=") { "+b+" = true; } else { "):(a+=" if ("+ke+" !== undefined ",A&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(U)+"') "),a+=" ) { ");a+=" "+F+" } "}}l&&(a+=" if ("+b+") { ",g+="}")}}if(E.length){var Le=E;if(Le)for(var w,pr=-1,Vt=Le.length-1;pr0||Ie===!1:e.util.schemaHasRules(Ie,e.RULES.all)){m.schema=Ie,m.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(w),m.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(w),A?a+=" "+_+" = "+_+" || Object.keys("+d+"); for (var "+h+"=0; "+h+"<"+_+".length; "+h+"++) { var "+f+" = "+_+"["+h+"]; ":a+=" for (var "+f+" in "+d+") { ",a+=" if ("+e.usePattern(w)+".test("+f+")) { ",m.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers);var C=d+"["+f+"]";m.dataPathArr[y]=f;var F=e.validate(m);m.baseId=W,e.util.varOccurences(F,v)<2?a+=" "+e.util.varReplace(F,v,C)+" ":a+=" var "+v+" = "+C+"; "+F+" ",l&&(a+=" if (!"+b+") break; "),a+=" } ",l&&(a+=" else "+b+" = true; "),a+=" } ",l&&(a+=" if ("+b+") { ",g+="}")}}}return l&&(a+=" "+g+" if ("+p+" == errors) {"),a}});var xS=V((VW,bS)=>{"use strict";bS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="errs__"+s,m=e.util.copy(e),g="";m.level++;var b="valid"+m.level;if(a+="var "+p+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){m.schema=o,m.schemaPath=c,m.errSchemaPath=u;var f="key"+s,h="idx"+s,y="i"+s,v="' + "+f+" + '",_=m.dataLevel=e.dataLevel+1,S="data"+_,x="dataProperties"+s,E=e.opts.ownProperties,T=e.baseId;E&&(a+=" var "+x+" = undefined; "),E?a+=" "+x+" = "+x+" || Object.keys("+d+"); for (var "+h+"=0; "+h+"<"+x+".length; "+h+"++) { var "+f+" = "+x+"["+h+"]; ":a+=" for (var "+f+" in "+d+") { ",a+=" var startErrs"+s+" = errors; ";var $=f,N=e.compositeRule;e.compositeRule=m.compositeRule=!0;var j=e.validate(m);m.baseId=T,e.util.varOccurences(j,S)<2?a+=" "+e.util.varReplace(j,S,$)+" ":a+=" var "+S+" = "+$+"; "+j+" ",e.compositeRule=m.compositeRule=N,a+=" if (!"+b+") { for (var "+y+"=startErrs"+s+"; "+y+"{"use strict";wS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m=e.opts.$data&&o&&o.$data,g;m?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+s):g=o;var b="schema"+s;if(!m)if(o.length0||S===!1:e.util.schemaHasRules(S,e.RULES.all))||(f[f.length]=y)}}else var f=o;if(m||f.length){var x=e.errorPath,E=m||f.length>=e.opts.loopRequired,T=e.opts.ownProperties;if(l)if(a+=" var missing"+s+"; ",E){m||(a+=" var "+b+" = validate.schema"+c+"; ");var $="i"+s,N="schema"+s+"["+$+"]",j="' + "+N+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(x,N,e.opts.jsonPointers)),a+=" var "+p+" = true; ",m&&(a+=" if (schema"+s+" === undefined) "+p+" = true; else if (!Array.isArray(schema"+s+")) "+p+" = false; else {"),a+=" for (var "+$+" = 0; "+$+" < "+b+".length; "+$+"++) { "+p+" = "+d+"["+b+"["+$+"]] !== undefined ",T&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", "+b+"["+$+"]) "),a+="; if (!"+p+") break; } ",m&&(a+=" } "),a+=" if (!"+p+") { ";var L=L||[];L.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+j+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+j+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var H=a;a=L.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+H+"]); ":a+=" validate.errors = ["+H+"]; return false; ":a+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var A=f;if(A)for(var W,$=-1,oe=A.length-1;${"use strict";ES.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m=e.opts.$data&&o&&o.$data,g;if(m?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+s):g=o,(o||m)&&e.opts.uniqueItems!==!1){m&&(a+=" var "+p+"; if ("+g+" === false || "+g+" === undefined) "+p+" = true; else if (typeof "+g+" != 'boolean') "+p+" = false; else { "),a+=" var i = "+d+".length , "+p+" = true , j; if (i > 1) { ";var b=e.schema.items&&e.schema.items.type,f=Array.isArray(b);if(!b||b=="object"||b=="array"||f&&(b.indexOf("object")>=0||b.indexOf("array")>=0))a+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+d+"[i], "+d+"[j])) { "+p+" = false; break outer; } } } ";else{a+=" var itemIndices = {}, item; for (;i--;) { var item = "+d+"[i]; ";var h="checkDataType"+(f?"s":"");a+=" if ("+e.util[h](b,"item",e.opts.strictNumbers,!0)+") continue; ",f&&(a+=` if (typeof item == 'string') item = '"' + item; `),a+=" if (typeof itemIndices[item] == 'number') { "+p+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}a+=" } ",m&&(a+=" } "),a+=" if (!"+p+") { ";var y=y||[];y.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(a+=" , schema: ",m?a+="validate.schema"+c:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var v=a;a=y.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",l&&(a+=" else { ")}else l&&(a+=" if (true) { ");return a}});var $S=V((WW,kS)=>{"use strict";kS.exports={$ref:Lw(),allOf:Uw(),anyOf:Hw(),$comment:Vw(),const:Zw(),contains:Kw(),dependencies:Jw(),enum:Qw(),format:tS(),if:aS(),items:sS(),maximum:qf(),minimum:qf(),maxItems:Lf(),minItems:Lf(),maxLength:Ff(),minLength:Ff(),maxProperties:Uf(),minProperties:Uf(),multipleOf:dS(),not:fS(),oneOf:hS(),pattern:gS(),properties:_S(),propertyNames:xS(),required:SS(),uniqueItems:TS(),validate:Mf()}});var OS=V((KW,PS)=>{"use strict";var RS=$S(),zf=Cn().toHash;PS.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],r=["type","$comment"],n=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],a=["number","integer","string","array","object","boolean","null"];return e.all=zf(r),e.types=zf(a),e.forEach(function(s){s.rules=s.rules.map(function(i){var o;if(typeof i=="object"){var c=Object.keys(i)[0];o=i[c],i=c,o.forEach(function(l){r.push(l),e.all[l]=!0})}r.push(i);var u=e.all[i]={keyword:i,code:RS[i],implements:o};return u}),e.all.$comment={keyword:"$comment",code:RS.$comment},s.type&&(e.types[s.type]=s)}),e.keywords=zf(r.concat(n)),e.custom={},e}});var AS=V((XW,IS)=>{"use strict";var CS=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];IS.exports=function(t,e){for(var r=0;r{"use strict";var B8=xu().MissingRef;jS.exports=NS;function NS(t,e,r){var n=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(r=e,e=void 0);var a=s(t).then(function(){var o=n._addSchema(t,void 0,e);return o.validate||i(o)});return r&&a.then(function(o){r(null,o)},r),a;function s(o){var c=o.$schema;return c&&!n.getSchema(c)?NS.call(n,{$ref:c},!0):Promise.resolve()}function i(o){try{return n._compile(o)}catch(u){if(u instanceof B8)return c(u);throw u}function c(u){var l=u.missingSchema;if(m(l))throw new Error("Schema "+l+" is loaded but "+u.missingRef+" cannot be resolved");var d=n._loadingSchemas[l];return d||(d=n._loadingSchemas[l]=n._opts.loadSchema(l),d.then(p,p)),d.then(function(g){if(!m(l))return s(g).then(function(){m(l)||n.addSchema(g,l,void 0,e)})}).then(function(){return i(o)});function p(){delete n._loadingSchemas[l]}function m(g){return n._refs[g]||n._schemas[g]}}}}});var qS=V((YW,DS)=>{"use strict";DS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d,p="data"+(i||""),m="valid"+s,g="errs__"+s,b=e.opts.$data&&o&&o.$data,f;b?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+s):f=o;var h=this,y="definition"+s,v=h.definition,_="",S,x,E,T,$;if(b&&v.$data){$="keywordValidate"+s;var N=v.validateSchema;a+=" var "+y+" = RULES.custom['"+r+"'].definition; var "+$+" = "+y+".validate;"}else{if(T=e.useCustomRule(h,o,e.schema,e),!T)return;f="validate.schema"+c,$=T.code,S=v.compile,x=v.inline,E=v.macro}var j=$+".errors",L="i"+s,H="ruleErr"+s,A=v.async;if(A&&!e.async)throw new Error("async keyword in sync schema");if(x||E||(a+=""+j+" = null;"),a+="var "+g+" = errors;var "+m+";",b&&v.$data&&(_+="}",a+=" if ("+f+" === undefined) { "+m+" = true; } else { ",N&&(_+="}",a+=" "+m+" = "+y+".validateSchema("+f+"); if ("+m+") { ")),x)v.statements?a+=" "+T.validate+" ":a+=" "+m+" = "+T.validate+"; ";else if(E){var W=e.util.copy(e),_="";W.level++;var oe="valid"+W.level;W.schema=T.validate,W.schemaPath="";var he=e.compositeRule;e.compositeRule=W.compositeRule=!0;var ne=e.validate(W).replace(/validate\.schema/g,$);e.compositeRule=W.compositeRule=he,a+=" "+ne}else{var re=re||[];re.push(a),a="",a+=" "+$+".call( ",e.opts.passContext?a+="this":a+="self",S||v.schema===!1?a+=" , "+p+" ":a+=" , "+f+" , "+p+" , validate.schema"+e.schemaPath+" ",a+=" , (dataPath || '')",e.errorPath!='""'&&(a+=" + "+e.errorPath);var U=i?"data"+(i-1||""):"parentData",R=i?e.dataPathArr[i]:"parentDataProperty";a+=" , "+U+" , "+R+" , rootData ) ";var z=a;a=re.pop(),v.errors===!1?(a+=" "+m+" = ",A&&(a+="await "),a+=""+z+"; "):A?(j="customErrors"+s,a+=" var "+j+" = null; try { "+m+" = await "+z+"; } catch (e) { "+m+" = false; if (e instanceof ValidationError) "+j+" = e.errors; else throw e; } "):a+=" "+j+" = null; "+m+" = "+z+"; "}if(v.modifying&&(a+=" if ("+U+") "+p+" = "+U+"["+R+"];"),a+=""+_,v.valid)l&&(a+=" if (true) { ");else{a+=" if ( ",v.valid===void 0?(a+=" !",E?a+=""+oe:a+=""+m):a+=" "+!v.valid+" ",a+=") { ",d=h.keyword;var re=re||[];re.push(a),a="";var re=re||[];re.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+h.keyword+"' } ",e.opts.messages!==!1&&(a+=` , message: 'should pass "`+h.keyword+`" keyword validation' `),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),a+=" } "):a+=" {} ";var I=a;a=re.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+I+"]); ":a+=" validate.errors = ["+I+"]; return false; ":a+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var w=a;a=re.pop(),x?v.errors?v.errors!="full"&&(a+=" for (var "+L+"="+g+"; "+L+"{V8.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var US=V((eK,FS)=>{"use strict";var LS=Hf();FS.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:LS.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:LS.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var HS=V((tK,zS)=>{"use strict";var G8=/^[a-z_$][a-z0-9_$-]*$/i,Z8=qS(),W8=US();zS.exports={add:K8,get:X8,remove:J8,validate:Bf};function K8(t,e){var r=this.RULES;if(r.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!G8.test(t))throw new Error("Keyword "+t+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var n=e.type;if(Array.isArray(n))for(var a=0;a{Y8.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var eE=V((aK,QS)=>{"use strict";var GS=Sw(),In=bu(),Q8=Tw(),ZS=Pf(),e9=jf(),t9=Dw(),r9=OS(),WS=AS(),KS=Cn();QS.exports=kt;kt.prototype.validate=n9;kt.prototype.compile=s9;kt.prototype.addSchema=i9;kt.prototype.addMetaSchema=o9;kt.prototype.validateSchema=c9;kt.prototype.getSchema=l9;kt.prototype.removeSchema=p9;kt.prototype.addFormat=b9;kt.prototype.errorsText=_9;kt.prototype._addSchema=f9;kt.prototype._compile=m9;kt.prototype.compileAsync=MS();var Pu=HS();kt.prototype.addKeyword=Pu.add;kt.prototype.getKeyword=Pu.get;kt.prototype.removeKeyword=Pu.remove;kt.prototype.validateKeyword=Pu.validate;var XS=xu();kt.ValidationError=XS.Validation;kt.MissingRefError=XS.MissingRef;kt.$dataMetaSchema=WS;var Ru="http://json-schema.org/draft-07/schema",VS=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],a9=["/properties"];function kt(t){if(!(this instanceof kt))return new kt(t);t=this._opts=KS.copy(t)||{},k9(this),this._schemas={},this._refs={},this._fragments={},this._formats=t9(t.format),this._cache=t.cache||new Q8,this._loadingSchemas={},this._compilations=[],this.RULES=r9(),this._getId=h9(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=e9),this._metaOpts=T9(this),t.formats&&S9(this),t.keywords&&E9(this),x9(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),w9(this)}function n9(t,e){var r;if(typeof t=="string"){if(r=this.getSchema(t),!r)throw new Error('no schema with key or ref "'+t+'"')}else{var n=this._addSchema(t);r=n.validate||this._compile(n)}var a=r(e);return r.$async!==!0&&(this.errors=r.errors),a}function s9(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)}function i9(t,e,r,n){if(Array.isArray(t)){for(var a=0;a{sE.exports=nE;nE.sync=R9;var rE=require("fs");function $9(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{lE.exports=cE;cE.sync=P9;var oE=require("fs");function cE(t,e,r){oE.stat(t,function(n,a){r(n,n?!1:uE(a,e))})}function P9(t,e){return uE(oE.statSync(t),e)}function uE(t,e){return t.isFile()&&O9(t,e)}function O9(t,e){var r=t.mode,n=t.uid,a=t.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),i=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),o=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),l=o|c,d=r&u||r&c&&a===i||r&o&&n===s||r&l&&s===0;return d}});var fE=V((lK,pE)=>{var uK=require("fs"),Ou;process.platform==="win32"||global.TESTING_WINDOWS?Ou=iE():Ou=dE();pE.exports=Gf;Gf.sync=C9;function Gf(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,a){Gf(t,e||{},function(s,i){s?a(s):n(i)})})}Ou(t,e||{},function(n,a){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,a=!1),r(n,a)})}function C9(t,e){try{return Ou.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var bE=V((dK,_E)=>{var Ns=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",mE=require("path"),I9=Ns?";":":",hE=fE(),vE=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),gE=(t,e)=>{let r=e.colon||I9,n=t.match(/\//)||Ns&&t.match(/\\/)?[""]:[...Ns?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],a=Ns?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Ns?a.split(r):[""];return Ns&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:a}},yE=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:a,pathExtExe:s}=gE(t,e),i=[],o=u=>new Promise((l,d)=>{if(u===n.length)return e.all&&i.length?l(i):d(vE(t));let p=n[u],m=/^".*"$/.test(p)?p.slice(1,-1):p,g=mE.join(m,t),b=!m&&/^\.[\\\/]/.test(t)?t.slice(0,2)+g:g;l(c(b,u,0))}),c=(u,l,d)=>new Promise((p,m)=>{if(d===a.length)return p(o(l+1));let g=a[d];hE(u+g,{pathExt:s},(b,f)=>{if(!b&&f)if(e.all)i.push(u+g);else return p(u+g);return p(c(u,l,d+1))})});return r?o(0).then(u=>r(null,u),r):o(0)},A9=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:a}=gE(t,e),s=[];for(let i=0;i{"use strict";var xE=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Zf.exports=xE;Zf.exports.default=xE});var kE=V((fK,TE)=>{"use strict";var SE=require("path"),N9=bE(),j9=wE();function EE(t,e){let r=t.options.env||process.env,n=process.cwd(),a=t.options.cwd!=null,s=a&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let i;try{i=N9.sync(t.command,{path:r[j9({env:r})],pathExt:e?SE.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return i&&(i=SE.resolve(a?t.options.cwd:"",i)),i}function M9(t){return EE(t)||EE(t,!0)}TE.exports=M9});var $E=V((mK,Kf)=>{"use strict";var Wf=/([()\][%!^"`<>&|;, *?])/g;function D9(t){return t=t.replace(Wf,"^$1"),t}function q9(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(Wf,"^$1"),e&&(t=t.replace(Wf,"^$1")),t}Kf.exports.command=D9;Kf.exports.argument=q9});var PE=V((hK,RE)=>{"use strict";RE.exports=/^#!(.*)/});var CE=V((vK,OE)=>{"use strict";var L9=PE();OE.exports=(t="")=>{let e=t.match(L9);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),a=r.split("/").pop();return a==="env"?n:n?`${a} ${n}`:a}});var AE=V((gK,IE)=>{"use strict";var Xf=require("fs"),F9=CE();function U9(t){let r=Buffer.alloc(150),n;try{n=Xf.openSync(t,"r"),Xf.readSync(n,r,0,150,0),Xf.closeSync(n)}catch{}return F9(r.toString())}IE.exports=U9});var DE=V((yK,ME)=>{"use strict";var z9=require("path"),NE=kE(),jE=$E(),H9=AE(),B9=process.platform==="win32",V9=/\.(?:com|exe)$/i,G9=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Z9(t){t.file=NE(t);let e=t.file&&H9(t.file);return e?(t.args.unshift(t.file),t.command=e,NE(t)):t.file}function W9(t){if(!B9)return t;let e=Z9(t),r=!V9.test(e);if(t.options.forceShell||r){let n=G9.test(e);t.command=z9.normalize(t.command),t.command=jE.command(t.command),t.args=t.args.map(s=>jE.argument(s,n));let a=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${a}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function K9(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:W9(n)}ME.exports=K9});var FE=V((_K,LE)=>{"use strict";var Jf=process.platform==="win32";function Yf(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function X9(t,e){if(!Jf)return;let r=t.emit;t.emit=function(n,a){if(n==="exit"){let s=qE(a,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function qE(t,e){return Jf&&t===1&&!e.file?Yf(e.original,"spawn"):null}function J9(t,e){return Jf&&t===1&&!e.file?Yf(e.original,"spawnSync"):null}LE.exports={hookChildProcess:X9,verifyENOENT:qE,verifyENOENTSync:J9,notFoundError:Yf}});var HE=V((bK,js)=>{"use strict";var UE=require("child_process"),Qf=DE(),em=FE();function zE(t,e,r){let n=Qf(t,e,r),a=UE.spawn(n.command,n.args,n.options);return em.hookChildProcess(a,n),a}function Y9(t,e,r){let n=Qf(t,e,r),a=UE.spawnSync(n.command,n.args,n.options);return a.error=a.error||em.verifyENOENTSync(a.status,n),a}js.exports=zE;js.exports.spawn=zE;js.exports.sync=Y9;js.exports._parse=Qf;js.exports._enoent=em});var ZE,WE,KE=Vr(()=>{"use strict";ZE="bugfix,feature,refactor,discovery,decision,change",WE="how-it-works,why-it-exists,what-changed,problem-solution,gotcha,pattern,trade-off"});var YE={};Ja(YE,{SettingsDefaultsManager:()=>nt});var Ds,XE,JE,nt,Dr=Vr(()=>{"use strict";Ds=require("fs"),XE=require("path"),JE=require("os");KE();mt();nt=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_PROVIDER:"claude",CLAUDE_MEM_GEMINI_API_KEY:"",CLAUDE_MEM_GEMINI_MODEL:"gemini-2.5-flash-lite",CLAUDE_MEM_GEMINI_BILLING_ENABLED:"false",CLAUDE_MEM_DATA_DIR:(0,XE.join)((0,JE.homedir)(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_MODE:"code",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES:ZE,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:WE,CLAUDE_MEM_CONTEXT_FULL_COUNT:"5",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false"};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return this.DEFAULTS[e]}static getInt(e){let r=this.get(e);return parseInt(r,10)}static getBool(e){return this.get(e)==="true"}static loadFromFile(e){try{if(!(0,Ds.existsSync)(e))return this.getAllDefaults();let r=(0,Ds.readFileSync)(e,"utf-8"),n=JSON.parse(r),a=n;if(n.env&&typeof n.env=="object"){a=n.env;try{(0,Ds.writeFileSync)(e,JSON.stringify(a,null,2),"utf-8"),q.info("SETTINGS","Migrated settings file from nested to flat schema",{settingsPath:e})}catch(i){q.warn("SETTINGS","Failed to auto-migrate settings file",{settingsPath:e},i)}}let s={...this.DEFAULTS};for(let i of Object.keys(this.DEFAULTS))a[i]!==void 0&&(s[i]=a[i]);return s}catch(r){return q.warn("SETTINGS","Failed to load settings, using defaults",{settingsPath:e},r),this.getAllDefaults()}}}});var tm,rm,q,mt=Vr(()=>{"use strict";Dr();tm=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.SILENT=4]="SILENT",s))(tm||{}),rm=class{level=null;useColor;constructor(){this.useColor=process.stdout.isTTY??!1}getLevel(){if(this.level===null){let e=nt.get("CLAUDE_MEM_LOG_LEVEL").toUpperCase();this.level=tm[e]??1}return this.level}correlationId(e,r){return`obs-${e}-${r}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.getLevel()===0?`${e.message} +`}function M4(){return function(){this.error(404)}}function D4(){return function(e){if(this.hasTrailingSlash()){this.error(404);return}var r=rf.original(this.req);r.path=null,r.pathname=N4(r.pathname+"/");var n=P4(I4.format(r)),a=j4("Redirecting","Redirecting to "+O4(n));e.statusCode=301,e.setHeader("Content-Type","text/html; charset=UTF-8"),e.setHeader("Content-Length",Buffer.byteLength(a)),e.setHeader("Content-Security-Policy","default-src 'none'"),e.setHeader("X-Content-Type-Options","nosniff"),e.setHeader("Location",n),e.end(a)}}});var wx=V((Qt,xx)=>{"use strict";var Xc=B_(),q4=require("events").EventEmitter,gx=G_(),yx=k0(),L4=kp(),F4=Rp(),_x=Y0(),bx=mx();Qt=xx.exports=U4;function U4(){var t=function(e,r,n){t.handle(e,r,n)};return gx(t,q4.prototype,!1),gx(t,yx,!1),t.request=Object.create(_x,{app:{configurable:!0,enumerable:!0,writable:!0,value:t}}),t.response=Object.create(bx,{app:{configurable:!0,enumerable:!0,writable:!0,value:t}}),t.init(),t}Qt.application=yx;Qt.request=_x;Qt.response=bx;Qt.Route=L4;Qt.Router=F4;Qt.json=Xc.json;Qt.query=Pp();Qt.raw=Xc.raw;Qt.static=vx();Qt.text=Xc.text;Qt.urlencoded=Xc.urlencoded;var z4=["bodyParser","compress","cookieSession","session","logger","cookieParser","favicon","responseTime","errorHandler","timeout","methodOverride","vhost","csrf","directory","limit","multipart","staticCache"];z4.forEach(function(t){Object.defineProperty(Qt,t,{get:function(){throw new Error("Most middleware (like "+t+") is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.")},configurable:!0})})});var Jc=V((PZ,Sx)=>{"use strict";Sx.exports=wx()});var tw=V((pu,ew)=>{(function(t,e){typeof pu=="object"&&typeof ew<"u"?e(pu):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(pu,(function(t){"use strict";function e(){for(var B=arguments.length,D=Array(B),G=0;G1){D[0]=D[0].slice(0,-1);for(var X=D.length-1,Y=1;Y= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$=m-g,N=Math.floor,j=String.fromCharCode;function L(B){throw new RangeError(T[B])}function H(B,D){for(var G=[],X=B.length;X--;)G[X]=D(B[X]);return G}function A(B,D){var G=B.split("@"),X="";G.length>1&&(X=G[0]+"@",B=G[1]),B=B.replace(E,".");var Y=B.split("."),ye=H(Y,D).join(".");return X+ye}function W(B){for(var D=[],G=0,X=B.length;G=55296&&Y<=56319&&G>1,D+=N(D/G);D>$*b>>1;Y+=m)D=N(D/$);return N(Y+($+1)*D/(D+f))},U=function(D){var G=[],X=D.length,Y=0,ye=v,De=y,Ze=D.lastIndexOf(_);Ze<0&&(Ze=0);for(var Qe=0;Qe=128&&L("not-basic"),G.push(D.charCodeAt(Qe));for(var Pt=Ze>0?Ze+1:0;Pt=X&&L("invalid-input");var ft=he(D.charCodeAt(Pt++));(ft>=m||ft>N((p-Y)/yt))&&L("overflow"),Y+=ft*yt;var Ke=Ot<=De?g:Ot>=De+b?b:Ot-De;if(ftN(p/_t)&&L("overflow"),yt*=_t}var rt=G.length+1;De=re(Y-Ve,rt,Ve==0),N(Y/rt)>p-ye&&L("overflow"),ye+=N(Y/rt),Y%=rt,G.splice(Y++,0,ye)}return String.fromCodePoint.apply(String,G)},R=function(D){var G=[];D=W(D);var X=D.length,Y=v,ye=0,De=y,Ze=!0,Qe=!1,Pt=void 0;try{for(var Ve=D[Symbol.iterator](),yt;!(Ze=(yt=Ve.next()).done);Ze=!0){var Ot=yt.value;Ot<128&&G.push(j(Ot))}}catch(Xa){Qe=!0,Pt=Xa}finally{try{!Ze&&Ve.return&&Ve.return()}finally{if(Qe)throw Pt}}var ft=G.length,Ke=ft;for(ft&&G.push(_);Ke=Y&&ur<_t&&(_t=ur)}}catch(Xa){Wa=!0,cr=Xa}finally{try{!rt&&fr.return&&fr.return()}finally{if(Wa)throw cr}}var mr=Ke+1;_t-Y>N((p-ye)/mr)&&L("overflow"),ye+=(_t-Y)*mr,Y=_t;var Br=!0,Ka=!1,ia=void 0;try{for(var mi=D[Symbol.iterator](),zo;!(Br=(zo=mi.next()).done);Br=!0){var Ho=zo.value;if(Hop&&L("overflow"),Ho==Y){for(var Gn=ye,Zn=m;;Zn+=m){var oa=Zn<=De?g:Zn>=De+b?b:Zn-De;if(Gn>6|192).toString(16).toUpperCase()+"%"+(D&63|128).toString(16).toUpperCase():G="%"+(D>>12|224).toString(16).toUpperCase()+"%"+(D>>6&63|128).toString(16).toUpperCase()+"%"+(D&63|128).toString(16).toUpperCase(),G}function K(B){for(var D="",G=0,X=B.length;G=194&&Y<224){if(X-G>=6){var ye=parseInt(B.substr(G+4,2),16);D+=String.fromCharCode((Y&31)<<6|ye&63)}else D+=B.substr(G,6);G+=6}else if(Y>=224){if(X-G>=9){var De=parseInt(B.substr(G+4,2),16),Ze=parseInt(B.substr(G+7,2),16);D+=String.fromCharCode((Y&15)<<12|(De&63)<<6|Ze&63)}else D+=B.substr(G,9);G+=9}else D+=B.substr(G,3),G+=3}return D}function J(B,D){function G(X){var Y=K(X);return Y.match(D.UNRESERVED)?Y:X}return B.scheme&&(B.scheme=String(B.scheme).replace(D.PCT_ENCODED,G).toLowerCase().replace(D.NOT_SCHEME,"")),B.userinfo!==void 0&&(B.userinfo=String(B.userinfo).replace(D.PCT_ENCODED,G).replace(D.NOT_USERINFO,M).replace(D.PCT_ENCODED,a)),B.host!==void 0&&(B.host=String(B.host).replace(D.PCT_ENCODED,G).toLowerCase().replace(D.NOT_HOST,M).replace(D.PCT_ENCODED,a)),B.path!==void 0&&(B.path=String(B.path).replace(D.PCT_ENCODED,G).replace(B.scheme?D.NOT_PATH:D.NOT_PATH_NOSCHEME,M).replace(D.PCT_ENCODED,a)),B.query!==void 0&&(B.query=String(B.query).replace(D.PCT_ENCODED,G).replace(D.NOT_QUERY,M).replace(D.PCT_ENCODED,a)),B.fragment!==void 0&&(B.fragment=String(B.fragment).replace(D.PCT_ENCODED,G).replace(D.NOT_FRAGMENT,M).replace(D.PCT_ENCODED,a)),B}function de(B){return B.replace(/^0*(.*)/,"$1")||"0"}function se(B,D){var G=B.match(D.IPV4ADDRESS)||[],X=l(G,2),Y=X[1];return Y?Y.split(".").map(de).join("."):B}function me(B,D){var G=B.match(D.IPV6ADDRESS)||[],X=l(G,3),Y=X[1],ye=X[2];if(Y){for(var De=Y.toLowerCase().split("::").reverse(),Ze=l(De,2),Qe=Ze[0],Pt=Ze[1],Ve=Pt?Pt.split(":").map(de):[],yt=Qe.split(":").map(de),Ot=D.IPV4ADDRESS.test(yt[yt.length-1]),ft=Ot?7:8,Ke=yt.length-ft,_t=Array(ft),rt=0;rt1){var st=_t.slice(0,cr.index),ur=_t.slice(cr.index+cr.length);fr=st.join(":")+"::"+ur.join(":")}else fr=_t.join(":");return ye&&(fr+="%"+ye),fr}else return B}var O=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,C="".match(/(){0}/)[1]===void 0;function F(B){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},G={},X=D.iri!==!1?u:c;D.reference==="suffix"&&(B=(D.scheme?D.scheme+":":"")+"//"+B);var Y=B.match(O);if(Y){C?(G.scheme=Y[1],G.userinfo=Y[3],G.host=Y[4],G.port=parseInt(Y[5],10),G.path=Y[6]||"",G.query=Y[7],G.fragment=Y[8],isNaN(G.port)&&(G.port=Y[5])):(G.scheme=Y[1]||void 0,G.userinfo=B.indexOf("@")!==-1?Y[3]:void 0,G.host=B.indexOf("//")!==-1?Y[4]:void 0,G.port=parseInt(Y[5],10),G.path=Y[6]||"",G.query=B.indexOf("?")!==-1?Y[7]:void 0,G.fragment=B.indexOf("#")!==-1?Y[8]:void 0,isNaN(G.port)&&(G.port=B.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?Y[4]:void 0)),G.host&&(G.host=me(se(G.host,X),X)),G.scheme===void 0&&G.userinfo===void 0&&G.host===void 0&&G.port===void 0&&!G.path&&G.query===void 0?G.reference="same-document":G.scheme===void 0?G.reference="relative":G.fragment===void 0?G.reference="absolute":G.reference="uri",D.reference&&D.reference!=="suffix"&&D.reference!==G.reference&&(G.error=G.error||"URI is not a "+D.reference+" reference.");var ye=k[(D.scheme||G.scheme||"").toLowerCase()];if(!D.unicodeSupport&&(!ye||!ye.unicodeSupport)){if(G.host&&(D.domainHost||ye&&ye.domainHost))try{G.host=w.toASCII(G.host.replace(X.PCT_ENCODED,K).toLowerCase())}catch(De){G.error=G.error||"Host's domain name can not be converted to ASCII via punycode: "+De}J(G,c)}else J(G,X);ye&&ye.parse&&ye.parse(G,D)}else G.error=G.error||"URI can not be parsed.";return G}function Z(B,D){var G=D.iri!==!1?u:c,X=[];return B.userinfo!==void 0&&(X.push(B.userinfo),X.push("@")),B.host!==void 0&&X.push(me(se(String(B.host),G),G).replace(G.IPV6ADDRESS,function(Y,ye,De){return"["+ye+(De?"%25"+De:"")+"]"})),(typeof B.port=="number"||typeof B.port=="string")&&(X.push(":"),X.push(String(B.port))),X.length?X.join(""):void 0}var ee=/^\.\.?\//,ce=/^\/\.(\/|$)/,Te=/^\/\.\.(\/|$)/,Ie=/^\/?(?:.|\n)*?(?=\/|$)/;function Ae(B){for(var D=[];B.length;)if(B.match(ee))B=B.replace(ee,"");else if(B.match(ce))B=B.replace(ce,"/");else if(B.match(Te))B=B.replace(Te,"/"),D.pop();else if(B==="."||B==="..")B="";else{var G=B.match(Ie);if(G){var X=G[0];B=B.slice(X.length),D.push(X)}else throw new Error("Unexpected dot segment condition")}return D.join("")}function Ne(B){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},G=D.iri?u:c,X=[],Y=k[(D.scheme||B.scheme||"").toLowerCase()];if(Y&&Y.serialize&&Y.serialize(B,D),B.host&&!G.IPV6ADDRESS.test(B.host)){if(D.domainHost||Y&&Y.domainHost)try{B.host=D.iri?w.toUnicode(B.host):w.toASCII(B.host.replace(G.PCT_ENCODED,K).toLowerCase())}catch(Ze){B.error=B.error||"Host's domain name can not be converted to "+(D.iri?"Unicode":"ASCII")+" via punycode: "+Ze}}J(B,G),D.reference!=="suffix"&&B.scheme&&(X.push(B.scheme),X.push(":"));var ye=Z(B,D);if(ye!==void 0&&(D.reference!=="suffix"&&X.push("//"),X.push(ye),B.path&&B.path.charAt(0)!=="/"&&X.push("/")),B.path!==void 0){var De=B.path;!D.absolutePath&&(!Y||!Y.absolutePath)&&(De=Ae(De)),ye===void 0&&(De=De.replace(/^\/\//,"/%2F")),X.push(De)}return B.query!==void 0&&(X.push("?"),X.push(B.query)),B.fragment!==void 0&&(X.push("#"),X.push(B.fragment)),X.join("")}function ke(B,D){var G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},X=arguments[3],Y={};return X||(B=F(Ne(B,G),G),D=F(Ne(D,G),G)),G=G||{},!G.tolerant&&D.scheme?(Y.scheme=D.scheme,Y.userinfo=D.userinfo,Y.host=D.host,Y.port=D.port,Y.path=Ae(D.path||""),Y.query=D.query):(D.userinfo!==void 0||D.host!==void 0||D.port!==void 0?(Y.userinfo=D.userinfo,Y.host=D.host,Y.port=D.port,Y.path=Ae(D.path||""),Y.query=D.query):(D.path?(D.path.charAt(0)==="/"?Y.path=Ae(D.path):((B.userinfo!==void 0||B.host!==void 0||B.port!==void 0)&&!B.path?Y.path="/"+D.path:B.path?Y.path=B.path.slice(0,B.path.lastIndexOf("/")+1)+D.path:Y.path=D.path,Y.path=Ae(Y.path)),Y.query=D.query):(Y.path=B.path,D.query!==void 0?Y.query=D.query:Y.query=B.query),Y.userinfo=B.userinfo,Y.host=B.host,Y.port=B.port),Y.scheme=B.scheme),Y.fragment=D.fragment,Y}function pt(B,D,G){var X=i({scheme:"null"},G);return Ne(ke(F(B,X),F(D,X),X,!0),X)}function Le(B,D){return typeof B=="string"?B=Ne(F(B,D),D):n(B)==="object"&&(B=F(Ne(B,D),D)),B}function pr(B,D,G){return typeof B=="string"?B=Ne(F(B,G),G):n(B)==="object"&&(B=Ne(B,G)),typeof D=="string"?D=Ne(F(D,G),G):n(D)==="object"&&(D=Ne(D,G)),B===D}function Vt(B,D){return B&&B.toString().replace(!D||!D.iri?c.ESCAPE:u.ESCAPE,M)}function It(B,D){return B&&B.toString().replace(!D||!D.iri?c.PCT_ENCODED:u.PCT_ENCODED,K)}var Ir={scheme:"http",domainHost:!0,parse:function(D,G){return D.host||(D.error=D.error||"HTTP URIs must have a host."),D},serialize:function(D,G){var X=String(D.scheme).toLowerCase()==="https";return(D.port===(X?443:80)||D.port==="")&&(D.port=void 0),D.path||(D.path="/"),D}},Sa={scheme:"https",domainHost:Ir.domainHost,parse:Ir.parse,serialize:Ir.serialize};function Bn(B){return typeof B.secure=="boolean"?B.secure:String(B.scheme).toLowerCase()==="wss"}var fi={scheme:"ws",domainHost:!0,parse:function(D,G){var X=D;return X.secure=Bn(X),X.resourceName=(X.path||"/")+(X.query?"?"+X.query:""),X.path=void 0,X.query=void 0,X},serialize:function(D,G){if((D.port===(Bn(D)?443:80)||D.port==="")&&(D.port=void 0),typeof D.secure=="boolean"&&(D.scheme=D.secure?"wss":"ws",D.secure=void 0),D.resourceName){var X=D.resourceName.split("?"),Y=l(X,2),ye=Y[0],De=Y[1];D.path=ye&&ye!=="/"?ye:void 0,D.query=De,D.resourceName=void 0}return D.fragment=void 0,D}},ph={scheme:"wss",domainHost:fi.domainHost,parse:fi.parse,serialize:fi.serialize},w$={},S$=!0,fh="[A-Za-z0-9\\-\\.\\_\\~"+(S$?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Hr="[0-9A-Fa-f]",E$=r(r("%[EFef]"+Hr+"%"+Hr+Hr+"%"+Hr+Hr)+"|"+r("%[89A-Fa-f]"+Hr+"%"+Hr+Hr)+"|"+r("%"+Hr+Hr)),T$="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",k$="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",$$=e(k$,'[\\"\\\\]'),R$="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",P$=new RegExp(fh,"g"),Vn=new RegExp(E$,"g"),O$=new RegExp(e("[^]",T$,"[\\.]",'[\\"]',$$),"g"),mh=new RegExp(e("[^]",fh,R$),"g"),C$=mh;function td(B){var D=K(B);return D.match(P$)?D:B}var hh={scheme:"mailto",parse:function(D,G){var X=D,Y=X.to=X.path?X.path.split(","):[];if(X.path=void 0,X.query){for(var ye=!1,De={},Ze=X.query.split("&"),Qe=0,Pt=Ze.length;Qe{"use strict";rw.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,a,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(a=n;a--!==0;)if(!t(e[a],r[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(a=n;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[a]))return!1;for(a=n;a--!==0;){var i=s[a];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var nw=V((mW,aw)=>{"use strict";aw.exports=function(e){for(var r=0,n=e.length,a=0,s;a=55296&&s<=56319&&a{"use strict";ow.exports={copy:KD,checkDataType:wf,checkDataTypes:XD,coerceToTypes:JD,toHash:Ef,getProperty:Tf,escapeQuotes:kf,equal:fu(),ucs2length:nw(),varOccurences:e8,varReplace:t8,schemaHasRules:r8,schemaHasRulesExcept:a8,schemaUnknownRules:n8,toQuotedString:Sf,getPathExpr:s8,getPath:i8,getData:u8,unescapeFragment:l8,unescapeJsonPointer:Rf,escapeFragment:d8,escapeJsonPointer:$f};function KD(t,e){e=e||{};for(var r in t)e[r]=t[r];return e}function wf(t,e,r,n){var a=n?" !== ":" === ",s=n?" || ":" && ",i=n?"!":"",o=n?"":"!";switch(t){case"null":return e+a+"null";case"array":return i+"Array.isArray("+e+")";case"object":return"("+i+e+s+"typeof "+e+a+'"object"'+s+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+a+'"number"'+s+o+"("+e+" % 1)"+s+e+a+e+(r?s+i+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+a+'"'+t+'"'+(r?s+i+"isFinite("+e+")":"")+")";default:return"typeof "+e+a+'"'+t+'"'}}function XD(t,e,r){switch(t.length){case 1:return wf(t[0],e,r,!0);default:var n="",a=Ef(t);a.array&&a.object&&(n=a.null?"(":"(!"+e+" || ",n+="typeof "+e+' !== "object")',delete a.null,delete a.array,delete a.object),a.number&&delete a.integer;for(var s in a)n+=(n?" && ":"")+wf(s,e,r,!0);return n}}var sw=Ef(["string","number","integer","boolean","null"]);function JD(t,e){if(Array.isArray(e)){for(var r=[],n=0;n=e)throw new Error("Cannot access property/index "+n+" levels up, current level is "+e);return r[e-n]}if(n>e)throw new Error("Cannot access data "+n+" levels up, current level is "+e);if(s="data"+(e-n||""),!a)return s}for(var o=s,c=a.split("/"),u=0;u{"use strict";var p8=Cn();cw.exports=f8;function f8(t){p8.copy(t,this)}});var lw=V((gW,uw)=>{"use strict";var Ma=uw.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},a=r.post||function(){};mu(e,n,a,t,"",t)};Ma.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Ma.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ma.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ma.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function mu(t,e,r,n,a,s,i,o,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,a,s,i,o,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in Ma.arrayKeywords)for(var p=0;p{"use strict";var so=tw(),dw=fu(),yu=Cn(),hu=Pf(),h8=lw();mw.exports=qa;qa.normalizeId=Da;qa.fullPath=vu;qa.url=gu;qa.ids=b8;qa.inlineRef=Of;qa.schema=_u;function qa(t,e,r){var n=this._refs[r];if(typeof n=="string")if(this._refs[n])n=this._refs[n];else return qa.call(this,t,e,n);if(n=n||this._schemas[r],n instanceof hu)return Of(n.schema,this._opts.inlineRefs)?n.schema:n.validate||this._compile(n);var a=_u.call(this,e,r),s,i,o;return a&&(s=a.schema,e=a.root,o=a.baseId),s instanceof hu?i=s.validate||t.call(this,s.schema,e,void 0,o):s!==void 0&&(i=Of(s,this._opts.inlineRefs)?s:t.call(this,s,e,void 0,o)),i}function _u(t,e){var r=so.parse(e),n=fw(r),a=vu(this._getId(t.schema));if(Object.keys(t.schema).length===0||n!==a){var s=Da(n),i=this._refs[s];if(typeof i=="string")return v8.call(this,t,i,r);if(i instanceof hu)i.validate||this._compile(i),t=i;else if(i=this._schemas[s],i instanceof hu){if(i.validate||this._compile(i),s==Da(e))return{schema:i,root:t,baseId:a};t=i}else return;if(!t.schema)return;a=vu(this._getId(t.schema))}return pw.call(this,r,a,t.schema,t)}function v8(t,e,r){var n=_u.call(this,t,e);if(n){var a=n.schema,s=n.baseId;t=n.root;var i=this._getId(a);return i&&(s=gu(s,i)),pw.call(this,r,s,a,t)}}var g8=yu.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function pw(t,e,r,n){if(t.fragment=t.fragment||"",t.fragment.slice(0,1)=="/"){for(var a=t.fragment.split("/"),s=1;s{"use strict";var Af=bu();vw.exports={Validation:hw(x8),MissingRef:hw(Nf)};function x8(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}Nf.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function Nf(t,e,r){this.message=r||Nf.message(t,e),this.missingRef=Af.url(t,e),this.missingSchema=Af.normalizeId(Af.fullPath(this.missingRef))}function hw(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}});var jf=V((bW,gw)=>{"use strict";gw.exports=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,n=e.cmp&&(function(s){return function(i){return function(o,c){var u={key:o,value:i[o]},l={key:c,value:i[c]};return s(u,l)}}})(e.cmp),a=[];return(function s(i){if(i&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i!==void 0){if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);var o,c;if(Array.isArray(i)){for(c="[",o=0;o{"use strict";yw.exports=function(e,r,n){var a="",s=e.schema.$async===!0,i=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var u="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(u);else throw new Error(u)}}if(e.isTop&&(a+=" var validate = ",s&&(e.async=!0,a+="async "),a+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(a+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(i||e.schema.$ref)){var r="false schema",l=e.level,d=e.dataLevel,p=e.schema[r],m=e.schemaPath+e.util.getProperty(r),g=e.errSchemaPath+"/"+r,S=!e.opts.allErrors,T,b="data"+(d||""),_="valid"+l;if(e.schema===!1){e.isTop?S=!0:a+=" var "+_+" = false; ";var f=f||[];f.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(T||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'boolean schema is false' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),a+=" } "):a+=" {} ";var h=a;a=f.pop(),!e.compositeRule&&S?e.async?a+=" throw new ValidationError(["+h+"]); ":a+=" validate.errors = ["+h+"]; return false; ":a+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?s?a+=" return data; ":a+=" validate.errors = null; return true; ":a+=" var "+_+" = true; ";return e.isTop&&(a+=" }; return validate; "),a}if(e.isTop){var y=e.isTop,l=e.level=0,d=e.dataLevel=0,b="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var v="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(v);else throw new Error(v)}a+=" var vErrors = null; ",a+=" var errors = 0; ",a+=" if (rootData === undefined) rootData = data; "}else{var l=e.level,d=e.dataLevel,b="data"+(d||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),s&&!e.async)throw new Error("async schema in sync schema");a+=" var errs_"+l+" = errors;"}var _="valid"+l,S=!e.opts.allErrors,x="",E="",T,$=e.schema.type,N=Array.isArray($);if($&&e.opts.nullable&&e.schema.nullable===!0&&(N?$.indexOf("null")==-1&&($=$.concat("null")):$!="null"&&($=[$,"null"],N=!0)),N&&$.length==1&&($=$[0],N=!1),e.schema.$ref&&i){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(i=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(a+=" "+e.RULES.all.$comment.code(e,"$comment")),$){if(e.opts.coerceTypes)var j=e.util.coerceToTypes(e.opts.coerceTypes,$);var L=e.RULES.types[$];if(j||N||L===!0||L&&!Ie(L)){var m=e.schemaPath+".type",g=e.errSchemaPath+"/type",m=e.schemaPath+".type",g=e.errSchemaPath+"/type",H=N?"checkDataTypes":"checkDataType";if(a+=" if ("+e.util[H]($,b,e.opts.strictNumbers,!0)+") { ",j){var A="dataType"+l,W="coerced"+l;a+=" var "+A+" = typeof "+b+"; var "+W+" = undefined; ",e.opts.coerceTypes=="array"&&(a+=" if ("+A+" == 'object' && Array.isArray("+b+") && "+b+".length == 1) { "+b+" = "+b+"[0]; "+A+" = typeof "+b+"; if ("+e.util.checkDataType(e.schema.type,b,e.opts.strictNumbers)+") "+W+" = "+b+"; } "),a+=" if ("+W+" !== undefined) ; ";var oe=j;if(oe)for(var he,ne=-1,re=oe.length-1;ne{"use strict";var wu=bu(),Eu=Cn(),bw=xu(),w8=jf(),_w=Mf(),S8=Eu.ucs2length,E8=fu(),T8=bw.Validation;ww.exports=Df;function Df(t,e,r,n){var a=this,s=this._opts,i=[void 0],o={},c=[],u={},l=[],d={},p=[];e=e||{schema:t,refVal:i,refs:o};var m=k8.call(this,t,e,n),g=this._compilations[m.index];if(m.compiling)return g.callValidate=v;var b=this._formats,f=this.RULES;try{var h=_(t,e,r,n);g.validate=h;var y=g.callValidate;return y&&(y.schema=h.schema,y.errors=null,y.refs=h.refs,y.refVal=h.refVal,y.root=h.root,y.$async=h.$async,s.sourceCode&&(y.source=h.source)),h}finally{$8.call(this,t,e,n)}function v(){var H=g.validate,A=H.apply(this,arguments);return v.errors=H.errors,A}function _(H,A,W,oe){var he=!A||A&&A.schema==H;if(A.schema!=e.schema)return Df.call(a,H,A,W,oe);var ne=H.$async===!0,re=_w({isTop:!0,schema:H,isRoot:he,baseId:oe,root:A,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:bw.MissingRef,RULES:f,validate:_w,util:Eu,resolve:wu,resolveRef:S,usePattern:N,useDefault:j,useCustomRule:L,opts:s,formats:b,logger:a.logger,self:a});re=Su(i,O8)+Su(c,R8)+Su(l,P8)+Su(p,C8)+re,s.processCode&&(re=s.processCode(re,H));var U;try{var R=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",re);U=R(a,f,b,e,i,l,p,E8,S8,T8),i[0]=U}catch(z){throw a.logger.error("Error compiling schema, function code:",re),z}return U.schema=H,U.errors=null,U.refs=o,U.refVal=i,U.root=he?U:A,ne&&(U.$async=!0),s.sourceCode===!0&&(U.source={code:re,patterns:c,defaults:l}),U}function S(H,A,W){A=wu.url(H,A);var oe=o[A],he,ne;if(oe!==void 0)return he=i[oe],ne="refVal["+oe+"]",$(he,ne);if(!W&&e.refs){var re=e.refs[A];if(re!==void 0)return he=e.refVal[re],ne=x(A,he),$(he,ne)}ne=x(A);var U=wu.call(a,_,e,A);if(U===void 0){var R=r&&r[A];R&&(U=wu.inlineRef(R,s.inlineRefs)?R:Df.call(a,R,e,r,H))}if(U===void 0)E(A);else return T(A,U),$(U,ne)}function x(H,A){var W=i.length;return i[W]=A,o[H]=W,"refVal"+W}function E(H){delete o[H]}function T(H,A){var W=o[H];i[W]=A}function $(H,A){return typeof H=="object"||typeof H=="boolean"?{code:A,schema:H,inline:!0}:{code:A,$async:H&&!!H.$async}}function N(H){var A=u[H];return A===void 0&&(A=u[H]=c.length,c[A]=H),"pattern"+A}function j(H){switch(typeof H){case"boolean":case"number":return""+H;case"string":return Eu.toQuotedString(H);case"object":if(H===null)return"null";var A=w8(H),W=d[A];return W===void 0&&(W=d[A]=l.length,l[W]=H),"default"+W}}function L(H,A,W,oe){if(a._opts.validateSchema!==!1){var he=H.definition.dependencies;if(he&&!he.every(function(M){return Object.prototype.hasOwnProperty.call(W,M)}))throw new Error("parent schema must have all required keywords: "+he.join(","));var ne=H.definition.validateSchema;if(ne){var re=ne(A);if(!re){var U="keyword schema is invalid: "+a.errorsText(ne.errors);if(a._opts.validateSchema=="log")a.logger.error(U);else throw new Error(U)}}}var R=H.definition.compile,z=H.definition.inline,I=H.definition.macro,w;if(R)w=R.call(a,A,W,oe);else if(I)w=I.call(a,A,W,oe),s.validateSchema!==!1&&a.validateSchema(w,!0);else if(z)w=z.call(a,oe,H.keyword,A,W);else if(w=H.definition.validate,!w)return;if(w===void 0)throw new Error('custom keyword "'+H.keyword+'"failed to compile');var k=p.length;return p[k]=w,{code:"customRule"+k,validate:w}}}function k8(t,e,r){var n=xw.call(this,t,e,r);return n>=0?{index:n,compiling:!0}:(n=this._compilations.length,this._compilations[n]={schema:t,root:e,baseId:r},{index:n,compiling:!1})}function $8(t,e,r){var n=xw.call(this,t,e,r);n>=0&&this._compilations.splice(n,1)}function xw(t,e,r){for(var n=0;n{"use strict";var Tu=Ew.exports=function(){this._cache={}};Tu.prototype.put=function(e,r){this._cache[e]=r};Tu.prototype.get=function(e){return this._cache[e]};Tu.prototype.del=function(e){delete this._cache[e]};Tu.prototype.clear=function(){this._cache={}}});var Dw=V((EW,Mw)=>{"use strict";var I8=Cn(),A8=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,N8=[0,31,28,31,30,31,30,31,31,30,31,30,31],j8=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,kw=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,M8=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,D8=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,$w=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Rw=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Pw=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Ow=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Cw=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Iw=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Mw.exports=ku;function ku(t){return t=t=="full"?"full":"fast",I8.copy(ku[t])}ku.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":$w,url:Rw,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:kw,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:jw,uuid:Pw,"json-pointer":Ow,"json-pointer-uri-fragment":Cw,"relative-json-pointer":Iw};ku.full={date:Aw,time:Nw,"date-time":F8,uri:z8,"uri-reference":D8,"uri-template":$w,url:Rw,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:kw,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:jw,uuid:Pw,"json-pointer":Ow,"json-pointer-uri-fragment":Cw,"relative-json-pointer":Iw};function q8(t){return t%4===0&&(t%100!==0||t%400===0)}function Aw(t){var e=t.match(A8);if(!e)return!1;var r=+e[1],n=+e[2],a=+e[3];return n>=1&&n<=12&&a>=1&&a<=(n==2&&q8(r)?29:N8[n])}function Nw(t,e){var r=t.match(j8);if(!r)return!1;var n=r[1],a=r[2],s=r[3],i=r[5];return(n<=23&&a<=59&&s<=59||n==23&&a==59&&s==60)&&(!e||i)}var L8=/t|\s/i;function F8(t){var e=t.split(L8);return e.length==2&&Aw(e[0])&&Nw(e[1],!0)}var U8=/\/|:/;function z8(t){return U8.test(t)&&M8.test(t)}var H8=/[^\\]\\Z/;function jw(t){if(H8.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Lw=V((TW,qw)=>{"use strict";qw.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,l="data"+(i||""),d="valid"+s,p,m;if(o=="#"||o=="#/")e.isRoot?(p=e.async,m="validate"):(p=e.root.schema.$async===!0,m="root.refVal[0]");else{var g=e.resolveRef(e.baseId,o,e.isRoot);if(g===void 0){var b=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(b);var f=f||[];f.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(a+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(a+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),a+=" } "):a+=" {} ";var h=a;a=f.pop(),!e.compositeRule&&u?e.async?a+=" throw new ValidationError(["+h+"]); ":a+=" validate.errors = ["+h+"]; return false; ":a+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(a+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(b),u&&(a+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,b)}else if(g.inline){var y=e.util.copy(e);y.level++;var v="valid"+y.level;y.schema=g.schema,y.schemaPath="",y.errSchemaPath=o;var _=e.validate(y).replace(/validate\.schema/g,g.code);a+=" "+_+" ",u&&(a+=" if ("+v+") { ")}else p=g.$async===!0||e.async&&g.$async!==!1,m=g.code}if(m){var f=f||[];f.push(a),a="",e.opts.passContext?a+=" "+m+".call(this, ":a+=" "+m+"( ",a+=" "+l+", (dataPath || '')",e.errorPath!='""'&&(a+=" + "+e.errorPath);var S=i?"data"+(i-1||""):"parentData",x=i?e.dataPathArr[i]:"parentDataProperty";a+=" , "+S+" , "+x+", rootData) ";var E=a;if(a=f.pop(),p){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(a+=" var "+d+"; "),a+=" try { await "+E+"; ",u&&(a+=" "+d+" = true; "),a+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(a+=" "+d+" = false; "),a+=" } ",u&&(a+=" if ("+d+") { ")}else a+=" if (!"+E+") { if (vErrors === null) vErrors = "+m+".errors; else vErrors = vErrors.concat("+m+".errors); errors = vErrors.length; } ",u&&(a+=" else { ")}return a}});var Uw=V((kW,Fw)=>{"use strict";Fw.exports=function(e,r,n){var a=" ",s=e.schema[r],i=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u=e.util.copy(e),l="";u.level++;var d="valid"+u.level,p=u.baseId,m=!0,g=s;if(g)for(var b,f=-1,h=g.length-1;f0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(m=!1,u.schema=b,u.schemaPath=i+"["+f+"]",u.errSchemaPath=o+"/"+f,a+=" "+e.validate(u)+" ",u.baseId=p,c&&(a+=" if ("+d+") { ",l+="}"));return c&&(m?a+=" if (true) { ":a+=" "+l.slice(0,-1)+" "),a}});var Hw=V(($W,zw)=>{"use strict";zw.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m="errs__"+s,g=e.util.copy(e),b="";g.level++;var f="valid"+g.level,h=o.every(function(T){return e.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all)});if(h){var y=g.baseId;a+=" var "+m+" = errors; var "+p+" = false; ";var v=e.compositeRule;e.compositeRule=g.compositeRule=!0;var _=o;if(_)for(var S,x=-1,E=_.length-1;x{"use strict";Bw.exports=function(e,r,n){var a=" ",s=e.schema[r],i=e.errSchemaPath+"/"+r,o=!e.opts.allErrors,c=e.util.toQuotedString(s);return e.opts.$comment===!0?a+=" console.log("+c+");":typeof e.opts.$comment=="function"&&(a+=" self._opts.$comment("+c+", "+e.util.toQuotedString(i)+", validate.root.schema);"),a}});var Zw=V((PW,Gw)=>{"use strict";Gw.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m=e.opts.$data&&o&&o.$data,g;m?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+s):g=o,m||(a+=" var schema"+s+" = validate.schema"+c+";"),a+="var "+p+" = equal("+d+", schema"+s+"); if (!"+p+") { ";var b=b||[];b.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValue: schema"+s+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be equal to constant' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var f=a;return a=b.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+f+"]); ":a+=" validate.errors = ["+f+"]; return false; ":a+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",l&&(a+=" else { "),a}});var Kw=V((OW,Ww)=>{"use strict";Ww.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m="errs__"+s,g=e.util.copy(e),b="";g.level++;var f="valid"+g.level,h="i"+s,y=g.dataLevel=e.dataLevel+1,v="data"+y,_=e.baseId,S=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(a+="var "+m+" = errors;var "+p+";",S){var x=e.compositeRule;e.compositeRule=g.compositeRule=!0,g.schema=o,g.schemaPath=c,g.errSchemaPath=u,a+=" var "+f+" = false; for (var "+h+" = 0; "+h+" < "+d+".length; "+h+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers,!0);var E=d+"["+h+"]";g.dataPathArr[y]=h;var T=e.validate(g);g.baseId=_,e.util.varOccurences(T,v)<2?a+=" "+e.util.varReplace(T,v,E)+" ":a+=" var "+v+" = "+E+"; "+T+" ",a+=" if ("+f+") break; } ",e.compositeRule=g.compositeRule=x,a+=" "+b+" if (!"+f+") {"}else a+=" if ("+d+".length == 0) {";var $=$||[];$.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should contain a valid item' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var N=a;return a=$.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+N+"]); ":a+=" validate.errors = ["+N+"]; return false; ":a+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { ",S&&(a+=" errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } "),e.opts.allErrors&&(a+=" } "),a}});var Jw=V((CW,Xw)=>{"use strict";Xw.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="errs__"+s,m=e.util.copy(e),g="";m.level++;var b="valid"+m.level,f={},h={},y=e.opts.ownProperties;for(x in o)if(x!="__proto__"){var v=o[x],_=Array.isArray(v)?h:f;_[x]=v}a+="var "+p+" = errors;";var S=e.errorPath;a+="var missing"+s+";";for(var x in h)if(_=h[x],_.length){if(a+=" if ( "+d+e.util.getProperty(x)+" !== undefined ",y&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(x)+"') "),l){a+=" && ( ";var E=_;if(E)for(var T,$=-1,N=E.length-1;$0||v===!1:e.util.schemaHasRules(v,e.RULES.all))&&(a+=" "+b+" = true; if ( "+d+e.util.getProperty(x)+" !== undefined ",y&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(x)+"') "),a+=") { ",m.schema=v,m.schemaPath=c+e.util.getProperty(x),m.errSchemaPath=u+"/"+e.util.escapeFragment(x),a+=" "+e.validate(m)+" ",m.baseId=U,a+=" } ",l&&(a+=" if ("+b+") { ",g+="}"))}return l&&(a+=" "+g+" if ("+p+" == errors) {"),a}});var Qw=V((IW,Yw)=>{"use strict";Yw.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m=e.opts.$data&&o&&o.$data,g;m?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+s):g=o;var b="i"+s,f="schema"+s;m||(a+=" var "+f+" = validate.schema"+c+";"),a+="var "+p+";",m&&(a+=" if (schema"+s+" === undefined) "+p+" = true; else if (!Array.isArray(schema"+s+")) "+p+" = false; else {"),a+=""+p+" = false;for (var "+b+"=0; "+b+"<"+f+".length; "+b+"++) if (equal("+d+", "+f+"["+b+"])) { "+p+" = true; break; }",m&&(a+=" } "),a+=" if (!"+p+") { ";var h=h||[];h.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValues: schema"+s+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var y=a;return a=h.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+y+"]); ":a+=" validate.errors = ["+y+"]; return false; ":a+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",l&&(a+=" else { "),a}});var tS=V((AW,eS)=>{"use strict";eS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||"");if(e.opts.format===!1)return l&&(a+=" if (true) { "),a;var p=e.opts.$data&&o&&o.$data,m;p?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+s):m=o;var g=e.opts.unknownFormats,b=Array.isArray(g);if(p){var f="format"+s,h="isObject"+s,y="formatType"+s;a+=" var "+f+" = formats["+m+"]; var "+h+" = typeof "+f+" == 'object' && !("+f+" instanceof RegExp) && "+f+".validate; var "+y+" = "+h+" && "+f+".type || 'string'; if ("+h+") { ",e.async&&(a+=" var async"+s+" = "+f+".async; "),a+=" "+f+" = "+f+".validate; } if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'string') || "),a+=" (",g!="ignore"&&(a+=" ("+m+" && !"+f+" ",b&&(a+=" && self._opts.unknownFormats.indexOf("+m+") == -1 "),a+=") || "),a+=" ("+f+" && "+y+" == '"+n+"' && !(typeof "+f+" == 'function' ? ",e.async?a+=" (async"+s+" ? await "+f+"("+d+") : "+f+"("+d+")) ":a+=" "+f+"("+d+") ",a+=" : "+f+".test("+d+"))))) {"}else{var f=e.formats[o];if(!f){if(g=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),l&&(a+=" if (true) { "),a;if(b&&g.indexOf(o)>=0)return l&&(a+=" if (true) { "),a;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var h=typeof f=="object"&&!(f instanceof RegExp)&&f.validate,y=h&&f.type||"string";if(h){var v=f.async===!0;f=f.validate}if(y!=n)return l&&(a+=" if (true) { "),a;if(v){if(!e.async)throw new Error("async format in sync schema");var _="formats"+e.util.getProperty(o)+".validate";a+=" if (!(await "+_+"("+d+"))) { "}else{a+=" if (! ";var _="formats"+e.util.getProperty(o);h&&(_+=".validate"),typeof f=="function"?a+=" "+_+"("+d+") ":a+=" "+_+".test("+d+") ",a+=") { "}}var S=S||[];S.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { format: ",p?a+=""+m:a+=""+e.util.toQuotedString(o),a+=" } ",e.opts.messages!==!1&&(a+=` , message: 'should match format "`,p?a+="' + "+m+" + '":a+=""+e.util.escapeQuotes(o),a+=`"' `),e.opts.verbose&&(a+=" , schema: ",p?a+="validate.schema"+c:a+=""+e.util.toQuotedString(o),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var x=a;return a=S.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+x+"]); ":a+=" validate.errors = ["+x+"]; return false; ":a+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",l&&(a+=" else { "),a}});var aS=V((NW,rS)=>{"use strict";rS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m="errs__"+s,g=e.util.copy(e);g.level++;var b="valid"+g.level,f=e.schema.then,h=e.schema.else,y=f!==void 0&&(e.opts.strictKeywords?typeof f=="object"&&Object.keys(f).length>0||f===!1:e.util.schemaHasRules(f,e.RULES.all)),v=h!==void 0&&(e.opts.strictKeywords?typeof h=="object"&&Object.keys(h).length>0||h===!1:e.util.schemaHasRules(h,e.RULES.all)),_=g.baseId;if(y||v){var S;g.createErrors=!1,g.schema=o,g.schemaPath=c,g.errSchemaPath=u,a+=" var "+m+" = errors; var "+p+" = true; ";var x=e.compositeRule;e.compositeRule=g.compositeRule=!0,a+=" "+e.validate(g)+" ",g.baseId=_,g.createErrors=!0,a+=" errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } ",e.compositeRule=g.compositeRule=x,y?(a+=" if ("+b+") { ",g.schema=e.schema.then,g.schemaPath=e.schemaPath+".then",g.errSchemaPath=e.errSchemaPath+"/then",a+=" "+e.validate(g)+" ",g.baseId=_,a+=" "+p+" = "+b+"; ",y&&v?(S="ifClause"+s,a+=" var "+S+" = 'then'; "):S="'then'",a+=" } ",v&&(a+=" else { ")):a+=" if (!"+b+") { ",v&&(g.schema=e.schema.else,g.schemaPath=e.schemaPath+".else",g.errSchemaPath=e.errSchemaPath+"/else",a+=" "+e.validate(g)+" ",g.baseId=_,a+=" "+p+" = "+b+"; ",y&&v?(S="ifClause"+s,a+=" var "+S+" = 'else'; "):S="'else'",a+=" } "),a+=" if (!"+p+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+S+" } ",e.opts.messages!==!1&&(a+=` , message: 'should match "' + `+S+` + '" schema' `),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&l&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } ",l&&(a+=" else { ")}else l&&(a+=" if (true) { ");return a}});var sS=V((jW,nS)=>{"use strict";nS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m="errs__"+s,g=e.util.copy(e),b="";g.level++;var f="valid"+g.level,h="i"+s,y=g.dataLevel=e.dataLevel+1,v="data"+y,_=e.baseId;if(a+="var "+m+" = errors;var "+p+";",Array.isArray(o)){var S=e.schema.additionalItems;if(S===!1){a+=" "+p+" = "+d+".length <= "+o.length+"; ";var x=u;u=e.errSchemaPath+"/additionalItems",a+=" if (!"+p+") { ";var E=E||[];E.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var T=a;a=E.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+T+"]); ":a+=" validate.errors = ["+T+"]; return false; ":a+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",u=x,l&&(b+="}",a+=" else { ")}var $=o;if($){for(var N,j=-1,L=$.length-1;j0||N===!1:e.util.schemaHasRules(N,e.RULES.all)){a+=" "+f+" = true; if ("+d+".length > "+j+") { ";var H=d+"["+j+"]";g.schema=N,g.schemaPath=c+"["+j+"]",g.errSchemaPath=u+"/"+j,g.errorPath=e.util.getPathExpr(e.errorPath,j,e.opts.jsonPointers,!0),g.dataPathArr[y]=j;var A=e.validate(g);g.baseId=_,e.util.varOccurences(A,v)<2?a+=" "+e.util.varReplace(A,v,H)+" ":a+=" var "+v+" = "+H+"; "+A+" ",a+=" } ",l&&(a+=" if ("+f+") { ",b+="}")}}if(typeof S=="object"&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all))){g.schema=S,g.schemaPath=e.schemaPath+".additionalItems",g.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+f+" = true; if ("+d+".length > "+o.length+") { for (var "+h+" = "+o.length+"; "+h+" < "+d+".length; "+h+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers,!0);var H=d+"["+h+"]";g.dataPathArr[y]=h;var A=e.validate(g);g.baseId=_,e.util.varOccurences(A,v)<2?a+=" "+e.util.varReplace(A,v,H)+" ":a+=" var "+v+" = "+H+"; "+A+" ",l&&(a+=" if (!"+f+") break; "),a+=" } } ",l&&(a+=" if ("+f+") { ",b+="}")}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){g.schema=o,g.schemaPath=c,g.errSchemaPath=u,a+=" for (var "+h+" = 0; "+h+" < "+d+".length; "+h+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers,!0);var H=d+"["+h+"]";g.dataPathArr[y]=h;var A=e.validate(g);g.baseId=_,e.util.varOccurences(A,v)<2?a+=" "+e.util.varReplace(A,v,H)+" ":a+=" var "+v+" = "+H+"; "+A+" ",l&&(a+=" if (!"+f+") break; "),a+=" }"}return l&&(a+=" "+b+" if ("+m+" == errors) {"),a}});var qf=V((MW,iS)=>{"use strict";iS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,_,d="data"+(i||""),p=e.opts.$data&&o&&o.$data,m;p?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+s):m=o;var g=r=="maximum",b=g?"exclusiveMaximum":"exclusiveMinimum",f=e.schema[b],h=e.opts.$data&&f&&f.$data,y=g?"<":">",v=g?">":"<",_=void 0;if(!(p||typeof o=="number"||o===void 0))throw new Error(r+" must be number");if(!(h||f===void 0||typeof f=="number"||typeof f=="boolean"))throw new Error(b+" must be number or boolean");if(h){var S=e.util.getData(f.$data,i,e.dataPathArr),x="exclusive"+s,E="exclType"+s,T="exclIsNumber"+s,$="op"+s,N="' + "+$+" + '";a+=" var schemaExcl"+s+" = "+S+"; ",S="schemaExcl"+s,a+=" var "+x+"; var "+E+" = typeof "+S+"; if ("+E+" != 'boolean' && "+E+" != 'undefined' && "+E+" != 'number') { ";var _=b,j=j||[];j.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(_||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: '"+b+" should be boolean' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var L=a;a=j.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+L+"]); ":a+=" validate.errors = ["+L+"]; return false; ":a+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),a+=" "+E+" == 'number' ? ( ("+x+" = "+m+" === undefined || "+S+" "+y+"= "+m+") ? "+d+" "+v+"= "+S+" : "+d+" "+v+" "+m+" ) : ( ("+x+" = "+S+" === true) ? "+d+" "+v+"= "+m+" : "+d+" "+v+" "+m+" ) || "+d+" !== "+d+") { var op"+s+" = "+x+" ? '"+y+"' : '"+y+"='; ",o===void 0&&(_=b,u=e.errSchemaPath+"/"+b,m=S,p=h)}else{var T=typeof f=="number",N=y;if(T&&p){var $="'"+N+"'";a+=" if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),a+=" ( "+m+" === undefined || "+f+" "+y+"= "+m+" ? "+d+" "+v+"= "+f+" : "+d+" "+v+" "+m+" ) || "+d+" !== "+d+") { "}else{T&&o===void 0?(x=!0,_=b,u=e.errSchemaPath+"/"+b,m=f,v+="="):(T&&(m=Math[g?"min":"max"](f,o)),f===(T?m:!0)?(x=!0,_=b,u=e.errSchemaPath+"/"+b,v+="="):(x=!1,N+="="));var $="'"+N+"'";a+=" if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),a+=" "+d+" "+v+" "+m+" || "+d+" !== "+d+") { "}}_=_||r;var j=j||[];j.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(_||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+$+", limit: "+m+", exclusive: "+x+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be "+N+" ",p?a+="' + "+m:a+=""+m+"'"),e.opts.verbose&&(a+=" , schema: ",p?a+="validate.schema"+c:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var L=a;return a=j.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+L+"]); ":a+=" validate.errors = ["+L+"]; return false; ":a+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",l&&(a+=" else { "),a}});var Lf=V((DW,oS)=>{"use strict";oS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,b,d="data"+(i||""),p=e.opts.$data&&o&&o.$data,m;if(p?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+s):m=o,!(p||typeof o=="number"))throw new Error(r+" must be number");var g=r=="maxItems"?">":"<";a+="if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),a+=" "+d+".length "+g+" "+m+") { ";var b=r,f=f||[];f.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(b||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+m+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have ",r=="maxItems"?a+="more":a+="fewer",a+=" than ",p?a+="' + "+m+" + '":a+=""+o,a+=" items' "),e.opts.verbose&&(a+=" , schema: ",p?a+="validate.schema"+c:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var h=a;return a=f.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+h+"]); ":a+=" validate.errors = ["+h+"]; return false; ":a+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",l&&(a+=" else { "),a}});var Ff=V((qW,cS)=>{"use strict";cS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,b,d="data"+(i||""),p=e.opts.$data&&o&&o.$data,m;if(p?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+s):m=o,!(p||typeof o=="number"))throw new Error(r+" must be number");var g=r=="maxLength"?">":"<";a+="if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),e.opts.unicode===!1?a+=" "+d+".length ":a+=" ucs2length("+d+") ",a+=" "+g+" "+m+") { ";var b=r,f=f||[];f.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(b||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+m+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be ",r=="maxLength"?a+="longer":a+="shorter",a+=" than ",p?a+="' + "+m+" + '":a+=""+o,a+=" characters' "),e.opts.verbose&&(a+=" , schema: ",p?a+="validate.schema"+c:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var h=a;return a=f.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+h+"]); ":a+=" validate.errors = ["+h+"]; return false; ":a+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",l&&(a+=" else { "),a}});var Uf=V((LW,uS)=>{"use strict";uS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,b,d="data"+(i||""),p=e.opts.$data&&o&&o.$data,m;if(p?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+s):m=o,!(p||typeof o=="number"))throw new Error(r+" must be number");var g=r=="maxProperties"?">":"<";a+="if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'number') || "),a+=" Object.keys("+d+").length "+g+" "+m+") { ";var b=r,f=f||[];f.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(b||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+m+" } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have ",r=="maxProperties"?a+="more":a+="fewer",a+=" than ",p?a+="' + "+m+" + '":a+=""+o,a+=" properties' "),e.opts.verbose&&(a+=" , schema: ",p?a+="validate.schema"+c:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var h=a;return a=f.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+h+"]); ":a+=" validate.errors = ["+h+"]; return false; ":a+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",l&&(a+=" else { "),a}});var dS=V((FW,lS)=>{"use strict";lS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p=e.opts.$data&&o&&o.$data,m;if(p?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+s):m=o,!(p||typeof o=="number"))throw new Error(r+" must be number");a+="var division"+s+";if (",p&&(a+=" "+m+" !== undefined && ( typeof "+m+" != 'number' || "),a+=" (division"+s+" = "+d+" / "+m+", ",e.opts.multipleOfPrecision?a+=" Math.abs(Math.round(division"+s+") - division"+s+") > 1e-"+e.opts.multipleOfPrecision+" ":a+=" division"+s+" !== parseInt(division"+s+") ",a+=" ) ",p&&(a+=" ) "),a+=" ) { ";var g=g||[];g.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { multipleOf: "+m+" } ",e.opts.messages!==!1&&(a+=" , message: 'should be multiple of ",p?a+="' + "+m:a+=""+m+"'"),e.opts.verbose&&(a+=" , schema: ",p?a+="validate.schema"+c:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var b=a;return a=g.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+b+"]); ":a+=" validate.errors = ["+b+"]; return false; ":a+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",l&&(a+=" else { "),a}});var fS=V((UW,pS)=>{"use strict";pS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="errs__"+s,m=e.util.copy(e);m.level++;var g="valid"+m.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){m.schema=o,m.schemaPath=c,m.errSchemaPath=u,a+=" var "+p+" = errors; ";var b=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.createErrors=!1;var f;m.opts.allErrors&&(f=m.opts.allErrors,m.opts.allErrors=!1),a+=" "+e.validate(m)+" ",m.createErrors=!0,f&&(m.opts.allErrors=f),e.compositeRule=m.compositeRule=b,a+=" if ("+g+") { ";var h=h||[];h.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var y=a;a=h.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+y+"]); ":a+=" validate.errors = ["+y+"]; return false; ":a+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+=" var err = ",e.createErrors!==!1?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l&&(a+=" if (false) { ");return a}});var hS=V((zW,mS)=>{"use strict";mS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m="errs__"+s,g=e.util.copy(e),b="";g.level++;var f="valid"+g.level,h=g.baseId,y="prevValid"+s,v="passingSchemas"+s;a+="var "+m+" = errors , "+y+" = false , "+p+" = false , "+v+" = null; ";var _=e.compositeRule;e.compositeRule=g.compositeRule=!0;var S=o;if(S)for(var x,E=-1,T=S.length-1;E0||x===!1:e.util.schemaHasRules(x,e.RULES.all))?(g.schema=x,g.schemaPath=c+"["+E+"]",g.errSchemaPath=u+"/"+E,a+=" "+e.validate(g)+" ",g.baseId=h):a+=" var "+f+" = true; ",E&&(a+=" if ("+f+" && "+y+") { "+p+" = false; "+v+" = ["+v+", "+E+"]; } else { ",b+="}"),a+=" if ("+f+") { "+p+" = "+y+" = true; "+v+" = "+E+"; }";return e.compositeRule=g.compositeRule=_,a+=""+b+"if (!"+p+") { var err = ",e.createErrors!==!1?(a+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+v+" } ",e.opts.messages!==!1&&(a+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&l&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+="} else { errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; }",e.opts.allErrors&&(a+=" } "),a}});var gS=V((HW,vS)=>{"use strict";vS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p=e.opts.$data&&o&&o.$data,m;p?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",m="schema"+s):m=o;var g=p?"(new RegExp("+m+"))":e.usePattern(o);a+="if ( ",p&&(a+=" ("+m+" !== undefined && typeof "+m+" != 'string') || "),a+=" !"+g+".test("+d+") ) { ";var b=b||[];b.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { pattern: ",p?a+=""+m:a+=""+e.util.toQuotedString(o),a+=" } ",e.opts.messages!==!1&&(a+=` , message: 'should match pattern "`,p?a+="' + "+m+" + '":a+=""+e.util.escapeQuotes(o),a+=`"' `),e.opts.verbose&&(a+=" , schema: ",p?a+="validate.schema"+c:a+=""+e.util.toQuotedString(o),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var f=a;return a=b.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+f+"]); ":a+=" validate.errors = ["+f+"]; return false; ":a+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+="} ",l&&(a+=" else { "),a}});var _S=V((BW,yS)=>{"use strict";yS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="errs__"+s,m=e.util.copy(e),g="";m.level++;var b="valid"+m.level,f="key"+s,h="idx"+s,y=m.dataLevel=e.dataLevel+1,v="data"+y,_="dataProperties"+s,S=Object.keys(o||{}).filter(ne),x=e.schema.patternProperties||{},E=Object.keys(x).filter(ne),T=e.schema.additionalProperties,$=S.length||E.length,N=T===!1,j=typeof T=="object"&&Object.keys(T).length,L=e.opts.removeAdditional,H=N||j||L,A=e.opts.ownProperties,W=e.baseId,oe=e.schema.required;if(oe&&!(e.opts.$data&&oe.$data)&&oe.length8)a+=" || validate.schema"+c+".hasOwnProperty("+f+") ";else{var re=S;if(re)for(var U,R=-1,z=re.length-1;R0||Ie===!1:e.util.schemaHasRules(Ie,e.RULES.all)){var Ae=e.util.getProperty(U),C=d+Ae,Ne=Z&&Ie.default!==void 0;m.schema=Ie,m.schemaPath=c+Ae,m.errSchemaPath=u+"/"+e.util.escapeFragment(U),m.errorPath=e.util.getPath(e.errorPath,U,e.opts.jsonPointers),m.dataPathArr[y]=e.util.toQuotedString(U);var F=e.validate(m);if(m.baseId=W,e.util.varOccurences(F,v)<2){F=e.util.varReplace(F,v,C);var ke=C}else{var ke=v;a+=" var "+v+" = "+C+"; "}if(Ne)a+=" "+F+" ";else{if(he&&he[U]){a+=" if ( "+ke+" === undefined ",A&&(a+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(U)+"') "),a+=") { "+b+" = false; ";var K=e.errorPath,de=u,pt=e.util.escapeQuotes(U);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(K,U,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var se=se||[];se.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+pt+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+pt+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var me=a;a=se.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+me+"]); ":a+=" validate.errors = ["+me+"]; return false; ":a+=" var err = "+me+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=de,e.errorPath=K,a+=" } else { "}else l?(a+=" if ( "+ke+" === undefined ",A&&(a+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(U)+"') "),a+=") { "+b+" = true; } else { "):(a+=" if ("+ke+" !== undefined ",A&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(U)+"') "),a+=" ) { ");a+=" "+F+" } "}}l&&(a+=" if ("+b+") { ",g+="}")}}if(E.length){var Le=E;if(Le)for(var w,pr=-1,Vt=Le.length-1;pr0||Ie===!1:e.util.schemaHasRules(Ie,e.RULES.all)){m.schema=Ie,m.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(w),m.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(w),A?a+=" "+_+" = "+_+" || Object.keys("+d+"); for (var "+h+"=0; "+h+"<"+_+".length; "+h+"++) { var "+f+" = "+_+"["+h+"]; ":a+=" for (var "+f+" in "+d+") { ",a+=" if ("+e.usePattern(w)+".test("+f+")) { ",m.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers);var C=d+"["+f+"]";m.dataPathArr[y]=f;var F=e.validate(m);m.baseId=W,e.util.varOccurences(F,v)<2?a+=" "+e.util.varReplace(F,v,C)+" ":a+=" var "+v+" = "+C+"; "+F+" ",l&&(a+=" if (!"+b+") break; "),a+=" } ",l&&(a+=" else "+b+" = true; "),a+=" } ",l&&(a+=" if ("+b+") { ",g+="}")}}}return l&&(a+=" "+g+" if ("+p+" == errors) {"),a}});var xS=V((VW,bS)=>{"use strict";bS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="errs__"+s,m=e.util.copy(e),g="";m.level++;var b="valid"+m.level;if(a+="var "+p+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){m.schema=o,m.schemaPath=c,m.errSchemaPath=u;var f="key"+s,h="idx"+s,y="i"+s,v="' + "+f+" + '",_=m.dataLevel=e.dataLevel+1,S="data"+_,x="dataProperties"+s,E=e.opts.ownProperties,T=e.baseId;E&&(a+=" var "+x+" = undefined; "),E?a+=" "+x+" = "+x+" || Object.keys("+d+"); for (var "+h+"=0; "+h+"<"+x+".length; "+h+"++) { var "+f+" = "+x+"["+h+"]; ":a+=" for (var "+f+" in "+d+") { ",a+=" var startErrs"+s+" = errors; ";var $=f,N=e.compositeRule;e.compositeRule=m.compositeRule=!0;var j=e.validate(m);m.baseId=T,e.util.varOccurences(j,S)<2?a+=" "+e.util.varReplace(j,S,$)+" ":a+=" var "+S+" = "+$+"; "+j+" ",e.compositeRule=m.compositeRule=N,a+=" if (!"+b+") { for (var "+y+"=startErrs"+s+"; "+y+"{"use strict";wS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m=e.opts.$data&&o&&o.$data,g;m?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+s):g=o;var b="schema"+s;if(!m)if(o.length0||S===!1:e.util.schemaHasRules(S,e.RULES.all))||(f[f.length]=y)}}else var f=o;if(m||f.length){var x=e.errorPath,E=m||f.length>=e.opts.loopRequired,T=e.opts.ownProperties;if(l)if(a+=" var missing"+s+"; ",E){m||(a+=" var "+b+" = validate.schema"+c+"; ");var $="i"+s,N="schema"+s+"["+$+"]",j="' + "+N+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(x,N,e.opts.jsonPointers)),a+=" var "+p+" = true; ",m&&(a+=" if (schema"+s+" === undefined) "+p+" = true; else if (!Array.isArray(schema"+s+")) "+p+" = false; else {"),a+=" for (var "+$+" = 0; "+$+" < "+b+".length; "+$+"++) { "+p+" = "+d+"["+b+"["+$+"]] !== undefined ",T&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", "+b+"["+$+"]) "),a+="; if (!"+p+") break; } ",m&&(a+=" } "),a+=" if (!"+p+") { ";var L=L||[];L.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+j+"' } ",e.opts.messages!==!1&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+j+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var H=a;a=L.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+H+"]); ":a+=" validate.errors = ["+H+"]; return false; ":a+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var A=f;if(A)for(var W,$=-1,oe=A.length-1;${"use strict";ES.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d="data"+(i||""),p="valid"+s,m=e.opts.$data&&o&&o.$data,g;if(m?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+s):g=o,(o||m)&&e.opts.uniqueItems!==!1){m&&(a+=" var "+p+"; if ("+g+" === false || "+g+" === undefined) "+p+" = true; else if (typeof "+g+" != 'boolean') "+p+" = false; else { "),a+=" var i = "+d+".length , "+p+" = true , j; if (i > 1) { ";var b=e.schema.items&&e.schema.items.type,f=Array.isArray(b);if(!b||b=="object"||b=="array"||f&&(b.indexOf("object")>=0||b.indexOf("array")>=0))a+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+d+"[i], "+d+"[j])) { "+p+" = false; break outer; } } } ";else{a+=" var itemIndices = {}, item; for (;i--;) { var item = "+d+"[i]; ";var h="checkDataType"+(f?"s":"");a+=" if ("+e.util[h](b,"item",e.opts.strictNumbers,!0)+") continue; ",f&&(a+=` if (typeof item == 'string') item = '"' + item; `),a+=" if (typeof itemIndices[item] == 'number') { "+p+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}a+=" } ",m&&(a+=" } "),a+=" if (!"+p+") { ";var y=y||[];y.push(a),a="",e.createErrors!==!1?(a+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(a+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(a+=" , schema: ",m?a+="validate.schema"+c:a+=""+o,a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var v=a;a=y.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",l&&(a+=" else { ")}else l&&(a+=" if (true) { ");return a}});var $S=V((WW,kS)=>{"use strict";kS.exports={$ref:Lw(),allOf:Uw(),anyOf:Hw(),$comment:Vw(),const:Zw(),contains:Kw(),dependencies:Jw(),enum:Qw(),format:tS(),if:aS(),items:sS(),maximum:qf(),minimum:qf(),maxItems:Lf(),minItems:Lf(),maxLength:Ff(),minLength:Ff(),maxProperties:Uf(),minProperties:Uf(),multipleOf:dS(),not:fS(),oneOf:hS(),pattern:gS(),properties:_S(),propertyNames:xS(),required:SS(),uniqueItems:TS(),validate:Mf()}});var OS=V((KW,PS)=>{"use strict";var RS=$S(),zf=Cn().toHash;PS.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],r=["type","$comment"],n=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],a=["number","integer","string","array","object","boolean","null"];return e.all=zf(r),e.types=zf(a),e.forEach(function(s){s.rules=s.rules.map(function(i){var o;if(typeof i=="object"){var c=Object.keys(i)[0];o=i[c],i=c,o.forEach(function(l){r.push(l),e.all[l]=!0})}r.push(i);var u=e.all[i]={keyword:i,code:RS[i],implements:o};return u}),e.all.$comment={keyword:"$comment",code:RS.$comment},s.type&&(e.types[s.type]=s)}),e.keywords=zf(r.concat(n)),e.custom={},e}});var AS=V((XW,IS)=>{"use strict";var CS=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];IS.exports=function(t,e){for(var r=0;r{"use strict";var B8=xu().MissingRef;jS.exports=NS;function NS(t,e,r){var n=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(r=e,e=void 0);var a=s(t).then(function(){var o=n._addSchema(t,void 0,e);return o.validate||i(o)});return r&&a.then(function(o){r(null,o)},r),a;function s(o){var c=o.$schema;return c&&!n.getSchema(c)?NS.call(n,{$ref:c},!0):Promise.resolve()}function i(o){try{return n._compile(o)}catch(u){if(u instanceof B8)return c(u);throw u}function c(u){var l=u.missingSchema;if(m(l))throw new Error("Schema "+l+" is loaded but "+u.missingRef+" cannot be resolved");var d=n._loadingSchemas[l];return d||(d=n._loadingSchemas[l]=n._opts.loadSchema(l),d.then(p,p)),d.then(function(g){if(!m(l))return s(g).then(function(){m(l)||n.addSchema(g,l,void 0,e)})}).then(function(){return i(o)});function p(){delete n._loadingSchemas[l]}function m(g){return n._refs[g]||n._schemas[g]}}}}});var qS=V((YW,DS)=>{"use strict";DS.exports=function(e,r,n){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,d,p="data"+(i||""),m="valid"+s,g="errs__"+s,b=e.opts.$data&&o&&o.$data,f;b?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",f="schema"+s):f=o;var h=this,y="definition"+s,v=h.definition,_="",S,x,E,T,$;if(b&&v.$data){$="keywordValidate"+s;var N=v.validateSchema;a+=" var "+y+" = RULES.custom['"+r+"'].definition; var "+$+" = "+y+".validate;"}else{if(T=e.useCustomRule(h,o,e.schema,e),!T)return;f="validate.schema"+c,$=T.code,S=v.compile,x=v.inline,E=v.macro}var j=$+".errors",L="i"+s,H="ruleErr"+s,A=v.async;if(A&&!e.async)throw new Error("async keyword in sync schema");if(x||E||(a+=""+j+" = null;"),a+="var "+g+" = errors;var "+m+";",b&&v.$data&&(_+="}",a+=" if ("+f+" === undefined) { "+m+" = true; } else { ",N&&(_+="}",a+=" "+m+" = "+y+".validateSchema("+f+"); if ("+m+") { ")),x)v.statements?a+=" "+T.validate+" ":a+=" "+m+" = "+T.validate+"; ";else if(E){var W=e.util.copy(e),_="";W.level++;var oe="valid"+W.level;W.schema=T.validate,W.schemaPath="";var he=e.compositeRule;e.compositeRule=W.compositeRule=!0;var ne=e.validate(W).replace(/validate\.schema/g,$);e.compositeRule=W.compositeRule=he,a+=" "+ne}else{var re=re||[];re.push(a),a="",a+=" "+$+".call( ",e.opts.passContext?a+="this":a+="self",S||v.schema===!1?a+=" , "+p+" ":a+=" , "+f+" , "+p+" , validate.schema"+e.schemaPath+" ",a+=" , (dataPath || '')",e.errorPath!='""'&&(a+=" + "+e.errorPath);var U=i?"data"+(i-1||""):"parentData",R=i?e.dataPathArr[i]:"parentDataProperty";a+=" , "+U+" , "+R+" , rootData ) ";var z=a;a=re.pop(),v.errors===!1?(a+=" "+m+" = ",A&&(a+="await "),a+=""+z+"; "):A?(j="customErrors"+s,a+=" var "+j+" = null; try { "+m+" = await "+z+"; } catch (e) { "+m+" = false; if (e instanceof ValidationError) "+j+" = e.errors; else throw e; } "):a+=" "+j+" = null; "+m+" = "+z+"; "}if(v.modifying&&(a+=" if ("+U+") "+p+" = "+U+"["+R+"];"),a+=""+_,v.valid)l&&(a+=" if (true) { ");else{a+=" if ( ",v.valid===void 0?(a+=" !",E?a+=""+oe:a+=""+m):a+=" "+!v.valid+" ",a+=") { ",d=h.keyword;var re=re||[];re.push(a),a="";var re=re||[];re.push(a),a="",e.createErrors!==!1?(a+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+h.keyword+"' } ",e.opts.messages!==!1&&(a+=` , message: 'should pass "`+h.keyword+`" keyword validation' `),e.opts.verbose&&(a+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),a+=" } "):a+=" {} ";var I=a;a=re.pop(),!e.compositeRule&&l?e.async?a+=" throw new ValidationError(["+I+"]); ":a+=" validate.errors = ["+I+"]; return false; ":a+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var w=a;a=re.pop(),x?v.errors?v.errors!="full"&&(a+=" for (var "+L+"="+g+"; "+L+"{V8.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var US=V((eK,FS)=>{"use strict";var LS=Hf();FS.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:LS.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:LS.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var HS=V((tK,zS)=>{"use strict";var G8=/^[a-z_$][a-z0-9_$-]*$/i,Z8=qS(),W8=US();zS.exports={add:K8,get:X8,remove:J8,validate:Bf};function K8(t,e){var r=this.RULES;if(r.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!G8.test(t))throw new Error("Keyword "+t+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var n=e.type;if(Array.isArray(n))for(var a=0;a{Y8.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var eE=V((aK,QS)=>{"use strict";var GS=Sw(),In=bu(),Q8=Tw(),ZS=Pf(),e9=jf(),t9=Dw(),r9=OS(),WS=AS(),KS=Cn();QS.exports=kt;kt.prototype.validate=n9;kt.prototype.compile=s9;kt.prototype.addSchema=i9;kt.prototype.addMetaSchema=o9;kt.prototype.validateSchema=c9;kt.prototype.getSchema=l9;kt.prototype.removeSchema=p9;kt.prototype.addFormat=b9;kt.prototype.errorsText=_9;kt.prototype._addSchema=f9;kt.prototype._compile=m9;kt.prototype.compileAsync=MS();var Pu=HS();kt.prototype.addKeyword=Pu.add;kt.prototype.getKeyword=Pu.get;kt.prototype.removeKeyword=Pu.remove;kt.prototype.validateKeyword=Pu.validate;var XS=xu();kt.ValidationError=XS.Validation;kt.MissingRefError=XS.MissingRef;kt.$dataMetaSchema=WS;var Ru="http://json-schema.org/draft-07/schema",VS=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],a9=["/properties"];function kt(t){if(!(this instanceof kt))return new kt(t);t=this._opts=KS.copy(t)||{},k9(this),this._schemas={},this._refs={},this._fragments={},this._formats=t9(t.format),this._cache=t.cache||new Q8,this._loadingSchemas={},this._compilations=[],this.RULES=r9(),this._getId=h9(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=e9),this._metaOpts=T9(this),t.formats&&S9(this),t.keywords&&E9(this),x9(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),w9(this)}function n9(t,e){var r;if(typeof t=="string"){if(r=this.getSchema(t),!r)throw new Error('no schema with key or ref "'+t+'"')}else{var n=this._addSchema(t);r=n.validate||this._compile(n)}var a=r(e);return r.$async!==!0&&(this.errors=r.errors),a}function s9(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)}function i9(t,e,r,n){if(Array.isArray(t)){for(var a=0;a{sE.exports=nE;nE.sync=R9;var rE=require("fs");function $9(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n{lE.exports=cE;cE.sync=P9;var oE=require("fs");function cE(t,e,r){oE.stat(t,function(n,a){r(n,n?!1:uE(a,e))})}function P9(t,e){return uE(oE.statSync(t),e)}function uE(t,e){return t.isFile()&&O9(t,e)}function O9(t,e){var r=t.mode,n=t.uid,a=t.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),i=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),o=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),l=o|c,d=r&u||r&c&&a===i||r&o&&n===s||r&l&&s===0;return d}});var fE=V((lK,pE)=>{var uK=require("fs"),Ou;process.platform==="win32"||global.TESTING_WINDOWS?Ou=iE():Ou=dE();pE.exports=Gf;Gf.sync=C9;function Gf(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,a){Gf(t,e||{},function(s,i){s?a(s):n(i)})})}Ou(t,e||{},function(n,a){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,a=!1),r(n,a)})}function C9(t,e){try{return Ou.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var bE=V((dK,_E)=>{var Ns=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",mE=require("path"),I9=Ns?";":":",hE=fE(),vE=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),gE=(t,e)=>{let r=e.colon||I9,n=t.match(/\//)||Ns&&t.match(/\\/)?[""]:[...Ns?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],a=Ns?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Ns?a.split(r):[""];return Ns&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:a}},yE=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:a,pathExtExe:s}=gE(t,e),i=[],o=u=>new Promise((l,d)=>{if(u===n.length)return e.all&&i.length?l(i):d(vE(t));let p=n[u],m=/^".*"$/.test(p)?p.slice(1,-1):p,g=mE.join(m,t),b=!m&&/^\.[\\\/]/.test(t)?t.slice(0,2)+g:g;l(c(b,u,0))}),c=(u,l,d)=>new Promise((p,m)=>{if(d===a.length)return p(o(l+1));let g=a[d];hE(u+g,{pathExt:s},(b,f)=>{if(!b&&f)if(e.all)i.push(u+g);else return p(u+g);return p(c(u,l,d+1))})});return r?o(0).then(u=>r(null,u),r):o(0)},A9=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:a}=gE(t,e),s=[];for(let i=0;i{"use strict";var xE=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Zf.exports=xE;Zf.exports.default=xE});var kE=V((fK,TE)=>{"use strict";var SE=require("path"),N9=bE(),j9=wE();function EE(t,e){let r=t.options.env||process.env,n=process.cwd(),a=t.options.cwd!=null,s=a&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let i;try{i=N9.sync(t.command,{path:r[j9({env:r})],pathExt:e?SE.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return i&&(i=SE.resolve(a?t.options.cwd:"",i)),i}function M9(t){return EE(t)||EE(t,!0)}TE.exports=M9});var $E=V((mK,Kf)=>{"use strict";var Wf=/([()\][%!^"`<>&|;, *?])/g;function D9(t){return t=t.replace(Wf,"^$1"),t}function q9(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(Wf,"^$1"),e&&(t=t.replace(Wf,"^$1")),t}Kf.exports.command=D9;Kf.exports.argument=q9});var PE=V((hK,RE)=>{"use strict";RE.exports=/^#!(.*)/});var CE=V((vK,OE)=>{"use strict";var L9=PE();OE.exports=(t="")=>{let e=t.match(L9);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),a=r.split("/").pop();return a==="env"?n:n?`${a} ${n}`:a}});var AE=V((gK,IE)=>{"use strict";var Xf=require("fs"),F9=CE();function U9(t){let r=Buffer.alloc(150),n;try{n=Xf.openSync(t,"r"),Xf.readSync(n,r,0,150,0),Xf.closeSync(n)}catch{}return F9(r.toString())}IE.exports=U9});var DE=V((yK,ME)=>{"use strict";var z9=require("path"),NE=kE(),jE=$E(),H9=AE(),B9=process.platform==="win32",V9=/\.(?:com|exe)$/i,G9=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Z9(t){t.file=NE(t);let e=t.file&&H9(t.file);return e?(t.args.unshift(t.file),t.command=e,NE(t)):t.file}function W9(t){if(!B9)return t;let e=Z9(t),r=!V9.test(e);if(t.options.forceShell||r){let n=G9.test(e);t.command=z9.normalize(t.command),t.command=jE.command(t.command),t.args=t.args.map(s=>jE.argument(s,n));let a=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${a}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function K9(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:W9(n)}ME.exports=K9});var FE=V((_K,LE)=>{"use strict";var Jf=process.platform==="win32";function Yf(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function X9(t,e){if(!Jf)return;let r=t.emit;t.emit=function(n,a){if(n==="exit"){let s=qE(a,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function qE(t,e){return Jf&&t===1&&!e.file?Yf(e.original,"spawn"):null}function J9(t,e){return Jf&&t===1&&!e.file?Yf(e.original,"spawnSync"):null}LE.exports={hookChildProcess:X9,verifyENOENT:qE,verifyENOENTSync:J9,notFoundError:Yf}});var HE=V((bK,js)=>{"use strict";var UE=require("child_process"),Qf=DE(),em=FE();function zE(t,e,r){let n=Qf(t,e,r),a=UE.spawn(n.command,n.args,n.options);return em.hookChildProcess(a,n),a}function Y9(t,e,r){let n=Qf(t,e,r),a=UE.spawnSync(n.command,n.args,n.options);return a.error=a.error||em.verifyENOENTSync(a.status,n),a}js.exports=zE;js.exports.spawn=zE;js.exports.sync=Y9;js.exports._parse=Qf;js.exports._enoent=em});var ZE,WE,KE=Vr(()=>{"use strict";ZE="bugfix,feature,refactor,discovery,decision,change",WE="how-it-works,why-it-exists,what-changed,problem-solution,gotcha,pattern,trade-off"});var YE={};Ja(YE,{SettingsDefaultsManager:()=>nt});var Ds,XE,JE,nt,Dr=Vr(()=>{"use strict";Ds=require("fs"),XE=require("path"),JE=require("os");KE();mt();nt=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_PROVIDER:"claude",CLAUDE_MEM_GEMINI_API_KEY:"",CLAUDE_MEM_GEMINI_MODEL:"gemini-2.5-flash-lite",CLAUDE_MEM_GEMINI_BILLING_ENABLED:"false",CLAUDE_MEM_DATA_DIR:(0,XE.join)((0,JE.homedir)(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_MODE:"code",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES:ZE,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:WE,CLAUDE_MEM_CONTEXT_FULL_COUNT:"5",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false"};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return this.DEFAULTS[e]}static getInt(e){let r=this.get(e);return parseInt(r,10)}static getBool(e){return this.get(e)==="true"}static loadFromFile(e){try{if(!(0,Ds.existsSync)(e))return this.getAllDefaults();let r=(0,Ds.readFileSync)(e,"utf-8"),n=JSON.parse(r),a=n;if(n.env&&typeof n.env=="object"){a=n.env;try{(0,Ds.writeFileSync)(e,JSON.stringify(a,null,2),"utf-8"),q.info("SETTINGS","Migrated settings file from nested to flat schema",{settingsPath:e})}catch(i){q.warn("SETTINGS","Failed to auto-migrate settings file",{settingsPath:e},i)}}let s={...this.DEFAULTS};for(let i of Object.keys(this.DEFAULTS))a[i]!==void 0&&(s[i]=a[i]);return s}catch(r){return q.warn("SETTINGS","Failed to load settings, using defaults",{settingsPath:e},r),this.getAllDefaults()}}}});var tm,rm,q,mt=Vr(()=>{"use strict";Dr();tm=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.SILENT=4]="SILENT",s))(tm||{}),rm=class{level=null;useColor;constructor(){this.useColor=process.stdout.isTTY??!1}getLevel(){if(this.level===null){let e=nt.get("CLAUDE_MEM_LOG_LEVEL").toUpperCase();this.level=tm[e]??1}return this.level}correlationId(e,r){return`obs-${e}-${r}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.getLevel()===0?`${e.message} ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let r=Object.keys(e);return r.length===0?"{}":r.length<=3?JSON.stringify(e):`{${r.length} keys: ${r.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,r){if(!r)return e;let n=typeof r=="string"?JSON.parse(r):r;if(e==="Bash"&&n.command)return`${e}(${n.command})`;if(n.file_path)return`${e}(${n.file_path})`;if(n.notebook_path)return`${e}(${n.notebook_path})`;if(e==="Glob"&&n.pattern)return`${e}(${n.pattern})`;if(e==="Grep"&&n.pattern)return`${e}(${n.pattern})`;if(n.url)return`${e}(${n.url})`;if(n.query)return`${e}(${n.query})`;if(e==="Task"){if(n.subagent_type)return`${e}(${n.subagent_type})`;if(n.description)return`${e}(${n.description})`}return e==="Skill"&&n.skill?`${e}(${n.skill})`:e==="LSP"&&n.operation?`${e}(${n.operation})`:e}formatTimestamp(e){let r=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),i=String(e.getMinutes()).padStart(2,"0"),o=String(e.getSeconds()).padStart(2,"0"),c=String(e.getMilliseconds()).padStart(3,"0");return`${r}-${n}-${a} ${s}:${i}:${o}.${c}`}log(e,r,n,a,s){if(e0&&(d=` {${Object.entries(f).map(([y,v])=>`${y}=${v}`).join(", ")}}`)}let p=`[${i}] [${o}] [${c}] ${u}${n}${d}${l}`;e===3?console.error(p):console.log(p)}debug(e,r,n,a){this.log(0,e,r,n,a)}info(e,r,n,a){this.log(1,e,r,n,a)}warn(e,r,n,a){this.log(2,e,r,n,a)}error(e,r,n,a){this.log(3,e,r,n,a)}dataIn(e,r,n,a){this.info(e,`\u2192 ${r}`,n,a)}dataOut(e,r,n,a){this.info(e,`\u2190 ${r}`,n,a)}success(e,r,n,a){this.info(e,`\u2713 ${r}`,n,a)}failure(e,r,n,a){this.error(e,`\u2717 ${r}`,n,a)}timing(e,r,n,a){this.info(e,`\u23F1 ${r}`,a,{duration:`${n}ms`})}happyPathError(e,r,n,a,s=""){let u=((new Error().stack||"").split(` `)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),l=u?`${u[1].split("/").pop()}:${u[2]}`:"unknown",d={...n,location:l};return this.warn(e,`[HAPPY-PATH] ${r}`,d,a),s}},q=new rm});var d1={};Ja(d1,{ARCHIVES_DIR:()=>nm,BACKUPS_DIR:()=>u1,CLAUDE_COMMANDS_DIR:()=>l1,CLAUDE_CONFIG_DIR:()=>uo,CLAUDE_MD_PATH:()=>oq,CLAUDE_SETTINGS_PATH:()=>iq,DATA_DIR:()=>Wt,DB_PATH:()=>lo,LOGS_DIR:()=>o1,MODES_DIR:()=>sm,TRASH_DIR:()=>c1,USER_SETTINGS_PATH:()=>An,VECTOR_DB_DIR:()=>sq,createBackupFilename:()=>hq,ensureAllClaudeDirs:()=>pq,ensureAllDataDirs:()=>lq,ensureDir:()=>ar,ensureModesDir:()=>dq,getCurrentProjectName:()=>fq,getPackageCommandsDir:()=>mq,getPackageRoot:()=>nr,getProjectArchiveDir:()=>cq,getWorkerSocketPath:()=>uq});function aq(){return typeof __dirname<"u"?__dirname:(0,$t.dirname)((0,i1.fileURLToPath)(vq.url))}function cq(t){return(0,$t.join)(nm,t)}function uq(t){return(0,$t.join)(Wt,`worker-${t}.sock`)}function ar(t){(0,n1.mkdirSync)(t,{recursive:!0})}function lq(){ar(Wt),ar(nm),ar(o1),ar(c1),ar(u1),ar(sm)}function dq(){ar(sm)}function pq(){ar(uo),ar(l1)}function fq(){try{let t=(0,s1.execSync)("git rev-parse --show-toplevel",{cwd:process.cwd(),encoding:"utf8",stdio:["pipe","pipe","ignore"],windowsHide:!0}).trim();return(0,$t.basename)(t)}catch{return(0,$t.basename)(process.cwd())}}function nr(){return(0,$t.join)(nq,"..")}function mq(){let t=nr();return(0,$t.join)(t,"commands")}function hq(t){let e=new Date().toISOString().replace(/[:.]/g,"-").replace("T","_").slice(0,19);return`${t}.backup.${e}`}var $t,a1,n1,s1,i1,vq,nq,Wt,uo,nm,o1,c1,u1,sm,An,lo,sq,iq,l1,oq,kr=Vr(()=>{"use strict";$t=require("path"),a1=require("os"),n1=require("fs"),s1=require("child_process"),i1=require("url");Dr();vq={};nq=aq(),Wt=nt.get("CLAUDE_MEM_DATA_DIR"),uo=process.env.CLAUDE_CONFIG_DIR||(0,$t.join)((0,a1.homedir)(),".claude"),nm=(0,$t.join)(Wt,"archives"),o1=(0,$t.join)(Wt,"logs"),c1=(0,$t.join)(Wt,"trash"),u1=(0,$t.join)(Wt,"backups"),sm=(0,$t.join)(Wt,"modes"),An=(0,$t.join)(Wt,"settings.json"),lo=(0,$t.join)(Wt,"claude-mem.db"),sq=(0,$t.join)(Wt,"vector-db"),iq=(0,$t.join)(uo,"settings.json"),l1=(0,$t.join)(uo,"commands"),oq=(0,$t.join)(uo,"CLAUDE.md")});var p1,La,Au=Vr(()=>{"use strict";p1=require("bun:sqlite");kr();La=class{db;constructor(e=lo){e!==":memory:"&&ar(Wt),this.db=new p1.Database(e),this.db.run("PRAGMA journal_mode = WAL"),this.db.run("PRAGMA synchronous = NORMAL"),this.db.run("PRAGMA foreign_keys = ON"),this.initializeSchema(),this.ensureWorkerPortColumn(),this.ensurePromptTrackingColumns(),this.removeSessionSummariesUniqueConstraint(),this.addObservationHierarchicalFields(),this.makeObservationsTextNullable(),this.createUserPromptsTable(),this.ensureDiscoveryTokensColumn(),this.createPendingMessagesTable()}initializeSchema(){try{this.db.run(` @@ -629,7 +629,7 @@ ${pe.dim}No previous sessions found for this project yet.${pe.reset} No previous sessions found for this project yet.`;let g=d.slice(0,r.sessionCount),b=l,f=[];if(e?(f.push(""),f.push(`${pe.bright}${pe.cyan}[${a}] recent context${pe.reset}`),f.push(`${pe.gray}${"\u2500".repeat(60)}${pe.reset}`),f.push("")):(f.push(`# [${a}] recent context`),f.push("")),b.length>0){let y=ht.getInstance().getActiveMode().observation_types.map(ne=>`${ne.emoji} ${ne.id}`).join(" | ");e?f.push(`${pe.dim}Legend: \u{1F3AF} session-request | ${y}${pe.reset}`):f.push(`**Legend:** \u{1F3AF} session-request | ${y}`),f.push(""),e?(f.push(`${pe.bright}\u{1F4A1} Column Key${pe.reset}`),f.push(`${pe.dim} Read: Tokens to read this observation (cost to learn it now)${pe.reset}`),f.push(`${pe.dim} Work: Tokens spent on work that produced this record (\u{1F50D} research, \u{1F6E0}\uFE0F building, \u2696\uFE0F deciding)${pe.reset}`)):(f.push("\u{1F4A1} **Column Key**:"),f.push("- **Read**: Tokens to read this observation (cost to learn it now)"),f.push("- **Work**: Tokens spent on work that produced this record (\u{1F50D} research, \u{1F6E0}\uFE0F building, \u2696\uFE0F deciding)")),f.push(""),e?(f.push(`${pe.dim}\u{1F4A1} Context Index: This semantic index (titles, types, files, tokens) is usually sufficient to understand past work.${pe.reset}`),f.push(""),f.push(`${pe.dim}When you need implementation details, rationale, or debugging context:${pe.reset}`),f.push(`${pe.dim} - Use the mem-search skill to fetch full observations on-demand${pe.reset}`),f.push(`${pe.dim} - Critical types (\u{1F534} bugfix, \u2696\uFE0F decision) often need detailed fetching${pe.reset}`),f.push(`${pe.dim} - Trust this index over re-reading code for past decisions and learnings${pe.reset}`)):(f.push("\u{1F4A1} **Context Index:** This semantic index (titles, types, files, tokens) is usually sufficient to understand past work."),f.push(""),f.push("When you need implementation details, rationale, or debugging context:"),f.push("- Use the mem-search skill to fetch full observations on-demand"),f.push("- Critical types (\u{1F534} bugfix, \u2696\uFE0F decision) often need detailed fetching"),f.push("- Trust this index over re-reading code for past decisions and learnings")),f.push("");let v=l.length,_=l.reduce((ne,re)=>{let U=(re.title?.length||0)+(re.subtitle?.length||0)+(re.narrative?.length||0)+JSON.stringify(re.facts||[]).length;return ne+Math.ceil(U/h$)},0),S=l.reduce((ne,re)=>ne+(re.discovery_tokens||0),0),x=S-_,E=S>0?Math.round(x/S*100):0,T=r.showReadTokens||r.showWorkTokens||r.showSavingsAmount||r.showSavingsPercent;if(T)if(e){if(f.push(`${pe.bright}${pe.cyan}\u{1F4CA} Context Economics${pe.reset}`),f.push(`${pe.dim} Loading: ${v} observations (${_.toLocaleString()} tokens to read)${pe.reset}`),f.push(`${pe.dim} Work investment: ${S.toLocaleString()} tokens spent on research, building, and decisions${pe.reset}`),S>0&&(r.showSavingsAmount||r.showSavingsPercent)){let ne=" Your savings: ";r.showSavingsAmount&&r.showSavingsPercent?ne+=`${x.toLocaleString()} tokens (${E}% reduction from reuse)`:r.showSavingsAmount?ne+=`${x.toLocaleString()} tokens`:ne+=`${E}% reduction from reuse`,f.push(`${pe.green}${ne}${pe.reset}`)}f.push("")}else{if(f.push("\u{1F4CA} **Context Economics**:"),f.push(`- Loading: ${v} observations (${_.toLocaleString()} tokens to read)`),f.push(`- Work investment: ${S.toLocaleString()} tokens spent on research, building, and decisions`),S>0&&(r.showSavingsAmount||r.showSavingsPercent)){let ne="- Your savings: ";r.showSavingsAmount&&r.showSavingsPercent?ne+=`${x.toLocaleString()} tokens (${E}% reduction from reuse)`:r.showSavingsAmount?ne+=`${x.toLocaleString()} tokens`:ne+=`${E}% reduction from reuse`,f.push(ne)}f.push("")}let $=d[0]?.id,N=g.map((ne,re)=>{let U=re===0?null:d[re+1];return{...ne,displayEpoch:U?U.created_at_epoch:ne.created_at_epoch,displayTime:U?U.created_at:ne.created_at,shouldShowLink:ne.id!==$}}),j=new Set(l.slice(0,r.fullObservationCount).map(ne=>ne.id)),L=[...b.map(ne=>({type:"observation",data:ne})),...N.map(ne=>({type:"summary",data:ne}))];L.sort((ne,re)=>{let U=ne.type==="observation"?ne.data.created_at_epoch:ne.data.displayEpoch,R=re.type==="observation"?re.data.created_at_epoch:re.data.displayEpoch;return U-R});let H=new Map;for(let ne of L){let re=ne.type==="observation"?ne.data.created_at:ne.data.displayTime,U=Fn(re);H.has(U)||H.set(U,[]),H.get(U).push(ne)}let A=Array.from(H.entries()).sort((ne,re)=>{let U=new Date(ne[0]).getTime(),R=new Date(re[0]).getTime();return U-R});for(let[ne,re]of A){e?(f.push(`${pe.bright}${pe.cyan}${ne}${pe.reset}`),f.push("")):(f.push(`### ${ne}`),f.push(""));let U=null,R="",z=!1;for(let I of re)if(I.type==="summary"){z&&(f.push(""),z=!1,U=null,R="");let w=I.data,k=`${w.request||"Session started"} (${wa(w.displayTime)})`;e?f.push(`\u{1F3AF} ${pe.yellow}#S${w.id}${pe.reset} ${k}`):f.push(`**\u{1F3AF} #S${w.id}** ${k}`),f.push("")}else{let w=I.data,k=Un(w.files_modified,n);k!==U&&(z&&f.push(""),e?f.push(`${pe.dim}${k}${pe.reset}`):f.push(`**${k}**`),e||(f.push("| ID | Time | T | Title | Read | Work |"),f.push("|----|------|---|-------|------|------|")),U=k,z=!0,R="");let M=ci(w.created_at),K=w.title||"Untitled",J=ht.getInstance().getTypeIcon(w.type),de=(w.title?.length||0)+(w.subtitle?.length||0)+(w.narrative?.length||0)+JSON.stringify(w.facts||[]).length,se=Math.ceil(de/h$),me=w.discovery_tokens||0,O=ht.getInstance().getWorkEmoji(w.type),C=me>0?`${O} ${me.toLocaleString()}`:"-",F=M!==R,Z=F?M:"";if(R=M,j.has(w.id)){let ce=r.fullObservationField==="narrative"?w.narrative:w.facts?th(w.facts).join(` `):null;if(e){let Te=F?`${pe.dim}${M}${pe.reset}`:" ".repeat(M.length),Ie=r.showReadTokens&&se>0?`${pe.dim}(~${se}t)${pe.reset}`:"",Ae=r.showWorkTokens&&me>0?`${pe.dim}(${O} ${me.toLocaleString()}t)${pe.reset}`:"";f.push(` ${pe.dim}#${w.id}${pe.reset} ${Te} ${J} ${pe.bright}${K}${pe.reset}`),ce&&f.push(` ${pe.dim}${ce}${pe.reset}`),(Ie||Ae)&&f.push(` ${Ie} ${Ae}`),f.push("")}else{z&&(f.push(""),z=!1),f.push(`**#${w.id}** ${Z||"\u2033"} ${J} **${K}**`),ce&&(f.push(""),f.push(ce),f.push(""));let Te=[];r.showReadTokens&&Te.push(`Read: ~${se}`),r.showWorkTokens&&Te.push(`Work: ${C}`),Te.length>0&&f.push(Te.join(", ")),f.push(""),U=null}}else if(e){let ce=F?`${pe.dim}${M}${pe.reset}`:" ".repeat(M.length),Te=r.showReadTokens&&se>0?`${pe.dim}(~${se}t)${pe.reset}`:"",Ie=r.showWorkTokens&&me>0?`${pe.dim}(${O} ${me.toLocaleString()}t)${pe.reset}`:"";f.push(` ${pe.dim}#${w.id}${pe.reset} ${ce} ${J} ${K} ${Te} ${Ie}`)}else{let ce=r.showReadTokens?`~${se}`:"",Te=r.showWorkTokens?C:"";f.push(`| #${w.id} | ${Z||"\u2033"} | ${J} | ${K} | ${ce} | ${Te} |`)}}z&&f.push("")}let W=d[0],oe=l[0];if(r.showLastSummary&&W&&(W.investigated||W.learned||W.completed||W.next_steps)&&(!oe||W.created_at_epoch>oe.created_at_epoch)&&(f.push(...Vl("Investigated",W.investigated,pe.blue,e)),f.push(...Vl("Learned",W.learned,pe.yellow,e)),f.push(...Vl("Completed",W.completed,pe.green,e)),f.push(...Vl("Next Steps",W.next_steps,pe.magenta,e))),m&&(f.push(""),f.push("---"),f.push(""),e?(f.push(`${pe.bright}${pe.magenta}\u{1F4CB} Previously${pe.reset}`),f.push(""),f.push(`${pe.dim}A: ${m}${pe.reset}`)):(f.push("**\u{1F4CB} Previously**"),f.push(""),f.push(`A: ${m}`)),f.push("")),T&&S>0&&x>0){let ne=Math.round(S/1e3);f.push(""),e?f.push(`${pe.dim}\u{1F4B0} Access ${ne}k tokens of past research & decisions for just ${_.toLocaleString()}t. Use the mem-search skill to access memories by ID instead of re-reading files.${pe.reset}`):f.push(`\u{1F4B0} Access ${ne}k tokens of past research & decisions for just ${_.toLocaleString()}t. Use the mem-search skill to access memories by ID instead of re-reading files.`)}}return s?.close(),f.join(` -`).trimEnd()}var Gl,Zl,di,U7,h$,H7,pe,Kl=Vr(()=>{"use strict";Gl=St(require("path"),1),Zl=require("os"),di=require("fs");Au();mt();Dr();rh();m$();ha();U7=Gl.default.join((0,Zl.homedir)(),".claude","plugins","marketplaces","thedotmack","plugin",".install-version");h$=4,H7=1,pe={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",cyan:"\x1B[36m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",gray:"\x1B[90m",red:"\x1B[31m"}});var W7={};Ja(W7,{WorkerService:()=>Ql});module.exports=Sh(W7);var b$=St(Jc(),1),pi=St(require("path"),1),dh=St(require("fs"),1);var P={};Ja(P,{BRAND:()=>mD,DIRTY:()=>mn,EMPTY_PATH:()=>G4,INVALID:()=>$e,NEVER:()=>YD,OK:()=>Ut,ParseStatus:()=>qt,Schema:()=>qe,ZodAny:()=>Na,ZodArray:()=>ma,ZodBigInt:()=>vn,ZodBoolean:()=>gn,ZodBranded:()=>eo,ZodCatch:()=>Rn,ZodDate:()=>yn,ZodDefault:()=>$n,ZodDiscriminatedUnion:()=>eu,ZodEffects:()=>xr,ZodEnum:()=>Tn,ZodError:()=>er,ZodFirstPartyTypeKind:()=>Pe,ZodFunction:()=>ru,ZodIntersection:()=>wn,ZodIssueCode:()=>ie,ZodLazy:()=>Sn,ZodLiteral:()=>En,ZodMap:()=>Os,ZodNaN:()=>Is,ZodNativeEnum:()=>kn,ZodNever:()=>Mr,ZodNull:()=>bn,ZodNullable:()=>ta,ZodNumber:()=>hn,ZodObject:()=>tr,ZodOptional:()=>_r,ZodParsedType:()=>ge,ZodPipeline:()=>to,ZodPromise:()=>ja,ZodReadonly:()=>Pn,ZodRecord:()=>tu,ZodSchema:()=>qe,ZodSet:()=>Cs,ZodString:()=>Aa,ZodSymbol:()=>Rs,ZodTransformer:()=>xr,ZodTuple:()=>ea,ZodType:()=>qe,ZodUndefined:()=>_n,ZodUnion:()=>xn,ZodUnknown:()=>fa,ZodVoid:()=>Ps,addIssueToContext:()=>fe,any:()=>SD,array:()=>$D,bigint:()=>yD,boolean:()=>Nx,coerce:()=>JD,custom:()=>Cx,date:()=>_D,datetimeRegex:()=>Px,defaultErrorMap:()=>da,discriminatedUnion:()=>CD,effect:()=>HD,enum:()=>FD,function:()=>DD,getErrorMap:()=>Ts,getParsedType:()=>Qr,instanceof:()=>vD,intersection:()=>ID,isAborted:()=>Yc,isAsync:()=>ks,isDirty:()=>Qc,isValid:()=>Ia,late:()=>hD,lazy:()=>qD,literal:()=>LD,makeIssue:()=>Qi,map:()=>jD,nan:()=>gD,nativeEnum:()=>UD,never:()=>TD,null:()=>wD,nullable:()=>VD,number:()=>Ax,object:()=>RD,objectUtil:()=>nf,oboolean:()=>XD,onumber:()=>KD,optional:()=>BD,ostring:()=>WD,pipeline:()=>ZD,preprocess:()=>GD,promise:()=>zD,quotelessJson:()=>H4,record:()=>ND,set:()=>MD,setErrorMap:()=>V4,strictObject:()=>PD,string:()=>Ix,symbol:()=>bD,transformer:()=>HD,tuple:()=>AD,undefined:()=>xD,union:()=>OD,unknown:()=>ED,util:()=>He,void:()=>kD});var He;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{let s={};for(let i of a)s[i]=i;return s},t.getValidEnumValues=a=>{let s=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(let o of s)i[o]=a[o];return t.objectValues(i)},t.objectValues=a=>t.objectKeys(a).map(function(s){return a[s]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let i in a)Object.prototype.hasOwnProperty.call(a,i)&&s.push(i);return s},t.find=(a,s)=>{for(let i of a)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(He||(He={}));var nf;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(nf||(nf={}));var ge=He.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qr=t=>{switch(typeof t){case"undefined":return ge.undefined;case"string":return ge.string;case"number":return Number.isNaN(t)?ge.nan:ge.number;case"boolean":return ge.boolean;case"function":return ge.function;case"bigint":return ge.bigint;case"symbol":return ge.symbol;case"object":return Array.isArray(t)?ge.array:t===null?ge.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ge.promise:typeof Map<"u"&&t instanceof Map?ge.map:typeof Set<"u"&&t instanceof Set?ge.set:typeof Date<"u"&&t instanceof Date?ge.date:ge.object;default:return ge.unknown}};var ie=He.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"]),H4=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),er=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(s){return s.message},n={_errors:[]},a=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;cr.message){let r={},n=[];for(let a of this.issues)if(a.path.length>0){let s=a.path[0];r[s]=r[s]||[],r[s].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};er.create=t=>new er(t);var B4=(t,e)=>{let r;switch(t.code){case ie.invalid_type:t.received===ge.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,He.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${He.joinValues(t.keys,", ")}`;break;case ie.invalid_union:r="Invalid input";break;case ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${He.joinValues(t.options)}`;break;case ie.invalid_enum_value:r=`Invalid enum value. Expected ${He.joinValues(t.options)}, received '${t.received}'`;break;case ie.invalid_arguments:r="Invalid function arguments";break;case ie.invalid_return_type:r="Invalid function return type";break;case ie.invalid_date:r="Invalid date";break;case ie.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:He.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case ie.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case ie.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case ie.custom:r="Invalid input";break;case ie.invalid_intersection_types:r="Intersection results could not be merged";break;case ie.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case ie.not_finite:r="Number must be finite";break;default:r=e.defaultError,He.assertNever(t)}return{message:r}},da=B4;var Ex=da;function V4(t){Ex=t}function Ts(){return Ex}var Qi=t=>{let{data:e,path:r,errorMaps:n,issueData:a}=t,s=[...r,...a.path||[]],i={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let o="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)o=u(i,{data:e,defaultError:o}).message;return{...a,path:s,message:o}},G4=[];function fe(t,e){let r=Ts(),n=Qi({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===da?void 0:da].filter(a=>!!a)});t.common.issues.push(n)}var qt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let a of r){if(a.status==="aborted")return $e;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let a of r){let s=await a.key,i=await a.value;n.push({key:s,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let a of r){let{key:s,value:i}=a;if(s.status==="aborted"||i.status==="aborted")return $e;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}},$e=Object.freeze({status:"aborted"}),mn=t=>({status:"dirty",value:t}),Ut=t=>({status:"valid",value:t}),Yc=t=>t.status==="aborted",Qc=t=>t.status==="dirty",Ia=t=>t.status==="valid",ks=t=>typeof Promise<"u"&&t instanceof Promise;var be;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(be||(be={}));var br=class{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Tx=(t,e)=>{if(Ia(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new er(t.common.issues);return this._error=r,this._error}}};function je(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:a}}var qe=class{get description(){return this._def.description}_getType(e){return Qr(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Qr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new qt,ctx:{common:e.parent.common,data:e.data,parsedType:Qr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(ks(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qr(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Tx(n,a)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qr(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Ia(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Ia(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qr(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(ks(a)?a:Promise.resolve(a));return Tx(n,s)}refine(e,r){let n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,s)=>{let i=e(a),o=()=>s.addIssue({code:ie.custom,...n(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new xr({schema:this,typeName:Pe.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:r=>this["~validate"](r)}}optional(){return _r.create(this,this._def)}nullable(){return ta.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ma.create(this)}promise(){return ja.create(this,this._def)}or(e){return xn.create([this,e],this._def)}and(e){return wn.create(this,e,this._def)}transform(e){return new xr({...je(this._def),schema:this,typeName:Pe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new $n({...je(this._def),innerType:this,defaultValue:r,typeName:Pe.ZodDefault})}brand(){return new eo({typeName:Pe.ZodBranded,type:this,...je(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Rn({...je(this._def),innerType:this,catchValue:r,typeName:Pe.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return to.create(this,e)}readonly(){return Pn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Z4=/^c[^\s-]{8,}$/i,W4=/^[0-9a-z]+$/,K4=/^[0-9A-HJKMNP-TV-Z]{26}$/i,X4=/^[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,J4=/^[a-z0-9_-]{21}$/i,Y4=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Q4=/^[-+]?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)?)??$/,eD=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tD="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",sf,rD=/^(?:(?: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])$/,aD=/^(?:(?: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])$/,nD=/^(([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]))$/,sD=/^(([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])$/,iD=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,oD=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$x="((\\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])))",cD=new RegExp(`^${$x}$`);function Rx(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function uD(t){return new RegExp(`^${Rx(t)}$`)}function Px(t){let e=`${$x}T${Rx(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function lD(t,e){return!!((e==="v4"||!e)&&rD.test(t)||(e==="v6"||!e)&&nD.test(t))}function dD(t,e){if(!Y4.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function pD(t,e){return!!((e==="v4"||!e)&&aD.test(t)||(e==="v6"||!e)&&sD.test(t))}var Aa=class t extends qe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ge.string){let s=this._getOrReturnCtx(e);return fe(s,{code:ie.invalid_type,expected:ge.string,received:s.parsedType}),$e}let n=new qt,a;for(let s of this._def.checks)if(s.kind==="min")e.data.lengths.value&&(a=this._getOrReturnCtx(e,a),fe(a,{code:ie.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,o=e.data.lengthe.test(a),{validation:r,code:ie.invalid_string,...be.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...be.errToObj(e)})}url(e){return this._addCheck({kind:"url",...be.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...be.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...be.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...be.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...be.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...be.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...be.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...be.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...be.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...be.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...be.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...be.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...be.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...be.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...be.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...be.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...be.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...be.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...be.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...be.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...be.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...be.errToObj(r)})}nonempty(e){return this.min(1,be.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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Aa({checks:[],typeName:Pe.ZodString,coerce:t?.coerce??!1,...je(t)});function fD(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,s=Number.parseInt(t.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return s%i/10**a}var hn=class t extends qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ge.number){let s=this._getOrReturnCtx(e);return fe(s,{code:ie.invalid_type,expected:ge.number,received:s.parsedType}),$e}let n,a=new qt;for(let s of this._def.checks)s.kind==="int"?He.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),fe(n,{code:ie.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),fe(n,{code:ie.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?fD(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),fe(n,{code:ie.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),fe(n,{code:ie.not_finite,message:s.message}),a.dirty()):He.assertNever(s);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,be.toString(r))}gt(e,r){return this.setLimit("min",e,!1,be.toString(r))}lte(e,r){return this.setLimit("max",e,!0,be.toString(r))}lt(e,r){return this.setLimit("max",e,!1,be.toString(r))}setLimit(e,r,n,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:be.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:be.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:be.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:be.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:be.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:be.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:be.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:be.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:be.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:be.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&He.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew hn({checks:[],typeName:Pe.ZodNumber,coerce:t?.coerce||!1,...je(t)});var vn=class t extends qe{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)!==ge.bigint)return this._getInvalidInput(e);let n,a=new qt;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),fe(n,{code:ie.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),fe(n,{code:ie.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):He.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return fe(r,{code:ie.invalid_type,expected:ge.bigint,received:r.parsedType}),$e}gte(e,r){return this.setLimit("min",e,!0,be.toString(r))}gt(e,r){return this.setLimit("min",e,!1,be.toString(r))}lte(e,r){return this.setLimit("max",e,!0,be.toString(r))}lt(e,r){return this.setLimit("max",e,!1,be.toString(r))}setLimit(e,r,n,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:be.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:be.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:be.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:be.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:be.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:be.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew vn({checks:[],typeName:Pe.ZodBigInt,coerce:t?.coerce??!1,...je(t)});var gn=class extends qe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ge.boolean){let n=this._getOrReturnCtx(e);return fe(n,{code:ie.invalid_type,expected:ge.boolean,received:n.parsedType}),$e}return Ut(e.data)}};gn.create=t=>new gn({typeName:Pe.ZodBoolean,coerce:t?.coerce||!1,...je(t)});var yn=class t extends qe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ge.date){let s=this._getOrReturnCtx(e);return fe(s,{code:ie.invalid_type,expected:ge.date,received:s.parsedType}),$e}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return fe(s,{code:ie.invalid_date}),$e}let n=new qt,a;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()s.value&&(a=this._getOrReturnCtx(e,a),fe(a,{code:ie.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):He.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:be.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:be.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew yn({checks:[],coerce:t?.coerce||!1,typeName:Pe.ZodDate,...je(t)});var Rs=class extends qe{_parse(e){if(this._getType(e)!==ge.symbol){let n=this._getOrReturnCtx(e);return fe(n,{code:ie.invalid_type,expected:ge.symbol,received:n.parsedType}),$e}return Ut(e.data)}};Rs.create=t=>new Rs({typeName:Pe.ZodSymbol,...je(t)});var _n=class extends qe{_parse(e){if(this._getType(e)!==ge.undefined){let n=this._getOrReturnCtx(e);return fe(n,{code:ie.invalid_type,expected:ge.undefined,received:n.parsedType}),$e}return Ut(e.data)}};_n.create=t=>new _n({typeName:Pe.ZodUndefined,...je(t)});var bn=class extends qe{_parse(e){if(this._getType(e)!==ge.null){let n=this._getOrReturnCtx(e);return fe(n,{code:ie.invalid_type,expected:ge.null,received:n.parsedType}),$e}return Ut(e.data)}};bn.create=t=>new bn({typeName:Pe.ZodNull,...je(t)});var Na=class extends qe{constructor(){super(...arguments),this._any=!0}_parse(e){return Ut(e.data)}};Na.create=t=>new Na({typeName:Pe.ZodAny,...je(t)});var fa=class extends qe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ut(e.data)}};fa.create=t=>new fa({typeName:Pe.ZodUnknown,...je(t)});var Mr=class extends qe{_parse(e){let r=this._getOrReturnCtx(e);return fe(r,{code:ie.invalid_type,expected:ge.never,received:r.parsedType}),$e}};Mr.create=t=>new Mr({typeName:Pe.ZodNever,...je(t)});var Ps=class extends qe{_parse(e){if(this._getType(e)!==ge.undefined){let n=this._getOrReturnCtx(e);return fe(n,{code:ie.invalid_type,expected:ge.void,received:n.parsedType}),$e}return Ut(e.data)}};Ps.create=t=>new Ps({typeName:Pe.ZodVoid,...je(t)});var ma=class t extends qe{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==ge.array)return fe(r,{code:ie.invalid_type,expected:ge.array,received:r.parsedType}),$e;if(a.exactLength!==null){let i=r.data.length>a.exactLength.value,o=r.data.lengtha.maxLength.value&&(fe(r,{code:ie.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>a.type._parseAsync(new br(r,i,r.path,o)))).then(i=>qt.mergeArray(n,i));let s=[...r.data].map((i,o)=>a.type._parseSync(new br(r,i,r.path,o)));return qt.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:be.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:be.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:be.toString(r)}})}nonempty(e){return this.min(1,e)}};ma.create=(t,e)=>new ma({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Pe.ZodArray,...je(e)});function $s(t){if(t instanceof tr){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=_r.create($s(n))}return new tr({...t._def,shape:()=>e})}else return t instanceof ma?new ma({...t._def,type:$s(t.element)}):t instanceof _r?_r.create($s(t.unwrap())):t instanceof ta?ta.create($s(t.unwrap())):t instanceof ea?ea.create(t.items.map(e=>$s(e))):t}var tr=class t extends qe{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(),r=He.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==ge.object){let u=this._getOrReturnCtx(e);return fe(u,{code:ie.invalid_type,expected:ge.object,received:u.parsedType}),$e}let{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Mr&&this._def.unknownKeys==="strip"))for(let u in a.data)i.includes(u)||o.push(u);let c=[];for(let u of i){let l=s[u],d=a.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new br(a,d,a.path,u)),alwaysSet:u in a.data})}if(this._def.catchall instanceof Mr){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of o)c.push({key:{status:"valid",value:l},value:{status:"valid",value:a.data[l]}});else if(u==="strict")o.length>0&&(fe(a,{code:ie.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of o){let d=a.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new br(a,d,a.path,l)),alwaysSet:l in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>qt.mergeObjectSync(n,u)):qt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return be.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let a=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:be.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pe.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of He.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of He.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return $s(this)}partial(e){let r={};for(let n of He.objectKeys(this.shape)){let a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of He.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof _r;)s=s._def.innerType;r[n]=s}return new t({...this._def,shape:()=>r})}keyof(){return Ox(He.objectKeys(this.shape))}};tr.create=(t,e)=>new tr({shape:()=>t,unknownKeys:"strip",catchall:Mr.create(),typeName:Pe.ZodObject,...je(e)});tr.strictCreate=(t,e)=>new tr({shape:()=>t,unknownKeys:"strict",catchall:Mr.create(),typeName:Pe.ZodObject,...je(e)});tr.lazycreate=(t,e)=>new tr({shape:t,unknownKeys:"strip",catchall:Mr.create(),typeName:Pe.ZodObject,...je(e)});var xn=class extends qe{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function a(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map(o=>new er(o.ctx.common.issues));return fe(r,{code:ie.invalid_union,unionErrors:i}),$e}if(r.common.async)return Promise.all(n.map(async s=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(a);{let s,i=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map(c=>new er(c));return fe(r,{code:ie.invalid_union,unionErrors:o}),$e}}get options(){return this._def.options}};xn.create=(t,e)=>new xn({options:t,typeName:Pe.ZodUnion,...je(e)});var pa=t=>t instanceof Sn?pa(t.schema):t instanceof xr?pa(t.innerType()):t instanceof En?[t.value]:t instanceof Tn?t.options:t instanceof kn?He.objectValues(t.enum):t instanceof $n?pa(t._def.innerType):t instanceof _n?[void 0]:t instanceof bn?[null]:t instanceof _r?[void 0,...pa(t.unwrap())]:t instanceof ta?[null,...pa(t.unwrap())]:t instanceof eo||t instanceof Pn?pa(t.unwrap()):t instanceof Rn?pa(t._def.innerType):[],eu=class t extends qe{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ge.object)return fe(r,{code:ie.invalid_type,expected:ge.object,received:r.parsedType}),$e;let n=this.discriminator,a=r.data[n],s=this.optionsMap.get(a);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(fe(r,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),$e)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let a=new Map;for(let s of r){let i=pa(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,s)}}return new t({typeName:Pe.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:a,...je(n)})}};function of(t,e){let r=Qr(t),n=Qr(e);if(t===e)return{valid:!0,data:t};if(r===ge.object&&n===ge.object){let a=He.objectKeys(e),s=He.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i={...t,...e};for(let o of s){let c=of(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(r===ge.array&&n===ge.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let s=0;s{if(Yc(s)||Yc(i))return $e;let o=of(s.value,i.value);return o.valid?((Qc(s)||Qc(i))&&r.dirty(),{status:r.value,value:o.data}):(fe(n,{code:ie.invalid_intersection_types}),$e)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>a(s,i)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};wn.create=(t,e,r)=>new wn({left:t,right:e,typeName:Pe.ZodIntersection,...je(r)});var ea=class t extends qe{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ge.array)return fe(n,{code:ie.invalid_type,expected:ge.array,received:n.parsedType}),$e;if(n.data.lengththis._def.items.length&&(fe(n,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((i,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new br(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>qt.mergeArray(r,i)):qt.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};ea.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ea({items:t,typeName:Pe.ZodTuple,rest:null,...je(e)})};var tu=class t extends qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ge.object)return fe(n,{code:ie.invalid_type,expected:ge.object,received:n.parsedType}),$e;let a=[],s=this._def.keyType,i=this._def.valueType;for(let o in n.data)a.push({key:s._parse(new br(n,o,n.path,o)),value:i._parse(new br(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?qt.mergeObjectAsync(r,a):qt.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof qe?new t({keyType:e,valueType:r,typeName:Pe.ZodRecord,...je(n)}):new t({keyType:Aa.create(),valueType:e,typeName:Pe.ZodRecord,...je(r)})}},Os=class extends qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ge.map)return fe(n,{code:ie.invalid_type,expected:ge.map,received:n.parsedType}),$e;let a=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([o,c],u)=>({key:a._parse(new br(n,o,n.path,[u,"key"])),value:s._parse(new br(n,c,n.path,[u,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return $e;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(u.value,l.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let c of i){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return $e;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(u.value,l.value)}return{status:r.value,value:o}}}};Os.create=(t,e,r)=>new Os({valueType:e,keyType:t,typeName:Pe.ZodMap,...je(r)});var Cs=class t extends qe{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ge.set)return fe(n,{code:ie.invalid_type,expected:ge.set,received:n.parsedType}),$e;let a=this._def;a.minSize!==null&&n.data.sizea.maxSize.value&&(fe(n,{code:ie.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());let s=this._def.valueType;function i(c){let u=new Set;for(let l of c){if(l.status==="aborted")return $e;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let o=[...n.data.values()].map((c,u)=>s._parse(new br(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,r){return new t({...this._def,minSize:{value:e,message:be.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:be.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Cs.create=(t,e)=>new Cs({valueType:t,minSize:null,maxSize:null,typeName:Pe.ZodSet,...je(e)});var ru=class t extends qe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ge.function)return fe(r,{code:ie.invalid_type,expected:ge.function,received:r.parsedType}),$e;function n(o,c){return Qi({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ts(),da].filter(u=>!!u),issueData:{code:ie.invalid_arguments,argumentsError:c}})}function a(o,c){return Qi({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ts(),da].filter(u=>!!u),issueData:{code:ie.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof ja){let o=this;return Ut(async function(...c){let u=new er([]),l=await o._def.args.parseAsync(c,s).catch(m=>{throw u.addIssue(n(c,m)),u}),d=await Reflect.apply(i,this,l);return await o._def.returns._def.type.parseAsync(d,s).catch(m=>{throw u.addIssue(a(d,m)),u})})}else{let o=this;return Ut(function(...c){let u=o._def.args.safeParse(c,s);if(!u.success)throw new er([n(c,u.error)]);let l=Reflect.apply(i,this,u.data),d=o._def.returns.safeParse(l,s);if(!d.success)throw new er([a(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ea.create(e).rest(fa.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||ea.create([]).rest(fa.create()),returns:r||fa.create(),typeName:Pe.ZodFunction,...je(n)})}},Sn=class extends qe{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Sn.create=(t,e)=>new Sn({getter:t,typeName:Pe.ZodLazy,...je(e)});var En=class extends qe{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return fe(r,{received:r.data,code:ie.invalid_literal,expected:this._def.value}),$e}return{status:"valid",value:e.data}}get value(){return this._def.value}};En.create=(t,e)=>new En({value:t,typeName:Pe.ZodLiteral,...je(e)});function Ox(t,e){return new Tn({values:t,typeName:Pe.ZodEnum,...je(e)})}var Tn=class t extends qe{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return fe(r,{expected:He.joinValues(n),received:r.parsedType,code:ie.invalid_type}),$e}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return fe(r,{received:r.data,code:ie.invalid_enum_value,options:n}),$e}return Ut(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Tn.create=Ox;var kn=class extends qe{_parse(e){let r=He.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ge.string&&n.parsedType!==ge.number){let a=He.objectValues(r);return fe(n,{expected:He.joinValues(a),received:n.parsedType,code:ie.invalid_type}),$e}if(this._cache||(this._cache=new Set(He.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=He.objectValues(r);return fe(n,{received:n.data,code:ie.invalid_enum_value,options:a}),$e}return Ut(e.data)}get enum(){return this._def.values}};kn.create=(t,e)=>new kn({values:t,typeName:Pe.ZodNativeEnum,...je(e)});var ja=class extends qe{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ge.promise&&r.common.async===!1)return fe(r,{code:ie.invalid_type,expected:ge.promise,received:r.parsedType}),$e;let n=r.parsedType===ge.promise?r.data:Promise.resolve(r.data);return Ut(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ja.create=(t,e)=>new ja({type:t,typeName:Pe.ZodPromise,...je(e)});var xr=class extends qe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:i=>{fe(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){let i=a.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return $e;let c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?$e:c.status==="dirty"?mn(c.value):r.value==="dirty"?mn(c.value):c});{if(r.value==="aborted")return $e;let o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?$e:o.status==="dirty"?mn(o.value):r.value==="dirty"?mn(o.value):o}}if(a.type==="refinement"){let i=o=>{let c=a.refinement(o,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?$e:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?$e:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ia(i))return $e;let o=a.transform(i.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Ia(i)?Promise.resolve(a.transform(i.value,s)).then(o=>({status:r.value,value:o})):$e);He.assertNever(a)}};xr.create=(t,e,r)=>new xr({schema:t,typeName:Pe.ZodEffects,effect:e,...je(r)});xr.createWithPreprocess=(t,e,r)=>new xr({schema:e,effect:{type:"preprocess",transform:t},typeName:Pe.ZodEffects,...je(r)});var _r=class extends qe{_parse(e){return this._getType(e)===ge.undefined?Ut(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};_r.create=(t,e)=>new _r({innerType:t,typeName:Pe.ZodOptional,...je(e)});var ta=class extends qe{_parse(e){return this._getType(e)===ge.null?Ut(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ta.create=(t,e)=>new ta({innerType:t,typeName:Pe.ZodNullable,...je(e)});var $n=class extends qe{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===ge.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};$n.create=(t,e)=>new $n({innerType:t,typeName:Pe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...je(e)});var Rn=class extends qe{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ks(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new er(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new er(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Rn.create=(t,e)=>new Rn({innerType:t,typeName:Pe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...je(e)});var Is=class extends qe{_parse(e){if(this._getType(e)!==ge.nan){let n=this._getOrReturnCtx(e);return fe(n,{code:ie.invalid_type,expected:ge.nan,received:n.parsedType}),$e}return{status:"valid",value:e.data}}};Is.create=t=>new Is({typeName:Pe.ZodNaN,...je(t)});var mD=Symbol("zod_brand"),eo=class extends qe{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},to=class t extends qe{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?$e:s.status==="dirty"?(r.dirty(),mn(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?$e:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:Pe.ZodPipeline})}},Pn=class extends qe{_parse(e){let r=this._def.innerType._parse(e),n=a=>(Ia(a)&&(a.value=Object.freeze(a.value)),a);return ks(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}};Pn.create=(t,e)=>new Pn({innerType:t,typeName:Pe.ZodReadonly,...je(e)});function kx(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Cx(t,e={},r){return t?Na.create().superRefine((n,a)=>{let s=t(n);if(s instanceof Promise)return s.then(i=>{if(!i){let o=kx(e,n),c=o.fatal??r??!0;a.addIssue({code:"custom",...o,fatal:c})}});if(!s){let i=kx(e,n),o=i.fatal??r??!0;a.addIssue({code:"custom",...i,fatal:o})}}):Na.create()}var hD={object:tr.lazycreate},Pe;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Pe||(Pe={}));var vD=(t,e={message:`Input not instance of ${t.name}`})=>Cx(r=>r instanceof t,e),Ix=Aa.create,Ax=hn.create,gD=Is.create,yD=vn.create,Nx=gn.create,_D=yn.create,bD=Rs.create,xD=_n.create,wD=bn.create,SD=Na.create,ED=fa.create,TD=Mr.create,kD=Ps.create,$D=ma.create,RD=tr.create,PD=tr.strictCreate,OD=xn.create,CD=eu.create,ID=wn.create,AD=ea.create,ND=tu.create,jD=Os.create,MD=Cs.create,DD=ru.create,qD=Sn.create,LD=En.create,FD=Tn.create,UD=kn.create,zD=ja.create,HD=xr.create,BD=_r.create,VD=ta.create,GD=xr.createWithPreprocess,ZD=to.create,WD=()=>Ix().optional(),KD=()=>Ax().optional(),XD=()=>Nx().optional(),JD={string:(t=>Aa.create({...t,coerce:!0})),number:(t=>hn.create({...t,coerce:!0})),boolean:(t=>gn.create({...t,coerce:!0})),bigint:(t=>vn.create({...t,coerce:!0})),date:(t=>yn.create({...t,coerce:!0}))};var YD=$e;var cf="2025-06-18";var jx=[cf,"2025-03-26","2024-11-05","2024-10-07"],au="2.0",Mx=P.union([P.string(),P.number().int()]),Dx=P.string(),QD=P.object({progressToken:P.optional(Mx)}).passthrough(),Er=P.object({_meta:P.optional(QD)}).passthrough(),rr=P.object({method:P.string(),params:P.optional(Er)}),ro=P.object({_meta:P.optional(P.object({}).passthrough())}).passthrough(),ra=P.object({method:P.string(),params:P.optional(ro)}),Tr=P.object({_meta:P.optional(P.object({}).passthrough())}).passthrough(),nu=P.union([P.string(),P.number().int()]),qx=P.object({jsonrpc:P.literal(au),id:nu}).merge(rr).strict(),Lx=t=>qx.safeParse(t).success,Fx=P.object({jsonrpc:P.literal(au)}).merge(ra).strict(),Ux=t=>Fx.safeParse(t).success,zx=P.object({jsonrpc:P.literal(au),id:nu,result:Tr}).strict(),uf=t=>zx.safeParse(t).success,wr;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(wr||(wr={}));var Hx=P.object({jsonrpc:P.literal(au),id:nu,error:P.object({code:P.number().int(),message:P.string(),data:P.optional(P.unknown())})}).strict(),Bx=t=>Hx.safeParse(t).success,Vx=P.union([qx,Fx,zx,Hx]),On=Tr.strict(),su=ra.extend({method:P.literal("notifications/cancelled"),params:ro.extend({requestId:nu,reason:P.string().optional()})}),e2=P.object({src:P.string(),mimeType:P.optional(P.string()),sizes:P.optional(P.array(P.string()))}).passthrough(),ao=P.object({icons:P.array(e2).optional()}).passthrough(),no=P.object({name:P.string(),title:P.optional(P.string())}).passthrough(),Gx=no.extend({version:P.string(),websiteUrl:P.optional(P.string())}).merge(ao),t2=P.object({experimental:P.optional(P.object({}).passthrough()),sampling:P.optional(P.object({}).passthrough()),elicitation:P.optional(P.object({}).passthrough()),roots:P.optional(P.object({listChanged:P.optional(P.boolean())}).passthrough())}).passthrough(),r2=rr.extend({method:P.literal("initialize"),params:Er.extend({protocolVersion:P.string(),capabilities:t2,clientInfo:Gx})});var a2=P.object({experimental:P.optional(P.object({}).passthrough()),logging:P.optional(P.object({}).passthrough()),completions:P.optional(P.object({}).passthrough()),prompts:P.optional(P.object({listChanged:P.optional(P.boolean())}).passthrough()),resources:P.optional(P.object({subscribe:P.optional(P.boolean()),listChanged:P.optional(P.boolean())}).passthrough()),tools:P.optional(P.object({listChanged:P.optional(P.boolean())}).passthrough())}).passthrough(),lf=Tr.extend({protocolVersion:P.string(),capabilities:a2,serverInfo:Gx,instructions:P.optional(P.string())}),n2=ra.extend({method:P.literal("notifications/initialized")});var iu=rr.extend({method:P.literal("ping")}),s2=P.object({progress:P.number(),total:P.optional(P.number()),message:P.optional(P.string())}).passthrough(),ou=ra.extend({method:P.literal("notifications/progress"),params:ro.merge(s2).extend({progressToken:Mx})}),cu=rr.extend({params:Er.extend({cursor:P.optional(Dx)}).optional()}),uu=Tr.extend({nextCursor:P.optional(Dx)}),Zx=P.object({uri:P.string(),mimeType:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}).passthrough(),Wx=Zx.extend({text:P.string()}),df=P.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Kx=Zx.extend({blob:df}),Xx=no.extend({uri:P.string(),description:P.optional(P.string()),mimeType:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}).merge(ao),i2=no.extend({uriTemplate:P.string(),description:P.optional(P.string()),mimeType:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}).merge(ao),o2=cu.extend({method:P.literal("resources/list")}),pf=uu.extend({resources:P.array(Xx)}),c2=cu.extend({method:P.literal("resources/templates/list")}),ff=uu.extend({resourceTemplates:P.array(i2)}),u2=rr.extend({method:P.literal("resources/read"),params:Er.extend({uri:P.string()})}),mf=Tr.extend({contents:P.array(P.union([Wx,Kx]))}),l2=ra.extend({method:P.literal("notifications/resources/list_changed")}),d2=rr.extend({method:P.literal("resources/subscribe"),params:Er.extend({uri:P.string()})}),p2=rr.extend({method:P.literal("resources/unsubscribe"),params:Er.extend({uri:P.string()})}),f2=ra.extend({method:P.literal("notifications/resources/updated"),params:ro.extend({uri:P.string()})}),m2=P.object({name:P.string(),description:P.optional(P.string()),required:P.optional(P.boolean())}).passthrough(),h2=no.extend({description:P.optional(P.string()),arguments:P.optional(P.array(m2)),_meta:P.optional(P.object({}).passthrough())}).merge(ao),v2=cu.extend({method:P.literal("prompts/list")}),hf=uu.extend({prompts:P.array(h2)}),g2=rr.extend({method:P.literal("prompts/get"),params:Er.extend({name:P.string(),arguments:P.optional(P.record(P.string()))})}),vf=P.object({type:P.literal("text"),text:P.string(),_meta:P.optional(P.object({}).passthrough())}).passthrough(),gf=P.object({type:P.literal("image"),data:df,mimeType:P.string(),_meta:P.optional(P.object({}).passthrough())}).passthrough(),yf=P.object({type:P.literal("audio"),data:df,mimeType:P.string(),_meta:P.optional(P.object({}).passthrough())}).passthrough(),y2=P.object({type:P.literal("resource"),resource:P.union([Wx,Kx]),_meta:P.optional(P.object({}).passthrough())}).passthrough(),_2=Xx.extend({type:P.literal("resource_link")}),Jx=P.union([vf,gf,yf,_2,y2]),b2=P.object({role:P.enum(["user","assistant"]),content:Jx}).passthrough(),_f=Tr.extend({description:P.optional(P.string()),messages:P.array(b2)}),x2=ra.extend({method:P.literal("notifications/prompts/list_changed")}),w2=P.object({title:P.optional(P.string()),readOnlyHint:P.optional(P.boolean()),destructiveHint:P.optional(P.boolean()),idempotentHint:P.optional(P.boolean()),openWorldHint:P.optional(P.boolean())}).passthrough(),S2=no.extend({description:P.optional(P.string()),inputSchema:P.object({type:P.literal("object"),properties:P.optional(P.object({}).passthrough()),required:P.optional(P.array(P.string()))}).passthrough(),outputSchema:P.optional(P.object({type:P.literal("object"),properties:P.optional(P.object({}).passthrough()),required:P.optional(P.array(P.string()))}).passthrough()),annotations:P.optional(w2),_meta:P.optional(P.object({}).passthrough())}).merge(ao),E2=cu.extend({method:P.literal("tools/list")}),bf=uu.extend({tools:P.array(S2)}),lu=Tr.extend({content:P.array(Jx).default([]),structuredContent:P.object({}).passthrough().optional(),isError:P.optional(P.boolean())}),aW=lu.or(Tr.extend({toolResult:P.unknown()})),T2=rr.extend({method:P.literal("tools/call"),params:Er.extend({name:P.string(),arguments:P.optional(P.record(P.unknown()))})}),k2=ra.extend({method:P.literal("notifications/tools/list_changed")}),Yx=P.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),$2=rr.extend({method:P.literal("logging/setLevel"),params:Er.extend({level:Yx})}),R2=ra.extend({method:P.literal("notifications/message"),params:ro.extend({level:Yx,logger:P.optional(P.string()),data:P.unknown()})}),P2=P.object({name:P.string().optional()}).passthrough(),O2=P.object({hints:P.optional(P.array(P2)),costPriority:P.optional(P.number().min(0).max(1)),speedPriority:P.optional(P.number().min(0).max(1)),intelligencePriority:P.optional(P.number().min(0).max(1))}).passthrough(),C2=P.object({role:P.enum(["user","assistant"]),content:P.union([vf,gf,yf])}).passthrough(),I2=rr.extend({method:P.literal("sampling/createMessage"),params:Er.extend({messages:P.array(C2),systemPrompt:P.optional(P.string()),includeContext:P.optional(P.enum(["none","thisServer","allServers"])),temperature:P.optional(P.number()),maxTokens:P.number().int(),stopSequences:P.optional(P.array(P.string())),metadata:P.optional(P.object({}).passthrough()),modelPreferences:P.optional(O2)})}),A2=Tr.extend({model:P.string(),stopReason:P.optional(P.enum(["endTurn","stopSequence","maxTokens"]).or(P.string())),role:P.enum(["user","assistant"]),content:P.discriminatedUnion("type",[vf,gf,yf])}),N2=P.object({type:P.literal("boolean"),title:P.optional(P.string()),description:P.optional(P.string()),default:P.optional(P.boolean())}).passthrough(),j2=P.object({type:P.literal("string"),title:P.optional(P.string()),description:P.optional(P.string()),minLength:P.optional(P.number()),maxLength:P.optional(P.number()),format:P.optional(P.enum(["email","uri","date","date-time"]))}).passthrough(),M2=P.object({type:P.enum(["number","integer"]),title:P.optional(P.string()),description:P.optional(P.string()),minimum:P.optional(P.number()),maximum:P.optional(P.number())}).passthrough(),D2=P.object({type:P.literal("string"),title:P.optional(P.string()),description:P.optional(P.string()),enum:P.array(P.string()),enumNames:P.optional(P.array(P.string()))}).passthrough(),q2=P.union([N2,j2,M2,D2]),L2=rr.extend({method:P.literal("elicitation/create"),params:Er.extend({message:P.string(),requestedSchema:P.object({type:P.literal("object"),properties:P.record(P.string(),q2),required:P.optional(P.array(P.string()))}).passthrough()})}),F2=Tr.extend({action:P.enum(["accept","decline","cancel"]),content:P.optional(P.record(P.string(),P.unknown()))}),U2=P.object({type:P.literal("ref/resource"),uri:P.string()}).passthrough();var z2=P.object({type:P.literal("ref/prompt"),name:P.string()}).passthrough(),H2=rr.extend({method:P.literal("completion/complete"),params:Er.extend({ref:P.union([z2,U2]),argument:P.object({name:P.string(),value:P.string()}).passthrough(),context:P.optional(P.object({arguments:P.optional(P.record(P.string(),P.string()))}))})}),xf=Tr.extend({completion:P.object({values:P.array(P.string()).max(100),total:P.optional(P.number().int()),hasMore:P.optional(P.boolean())}).passthrough()}),B2=P.object({uri:P.string().startsWith("file://"),name:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}).passthrough(),V2=rr.extend({method:P.literal("roots/list")}),G2=Tr.extend({roots:P.array(B2)}),Z2=ra.extend({method:P.literal("notifications/roots/list_changed")}),nW=P.union([iu,r2,H2,$2,g2,v2,o2,c2,u2,d2,p2,T2,E2]),sW=P.union([su,ou,n2,Z2]),iW=P.union([On,A2,F2,G2]),oW=P.union([iu,I2,L2,V2]),cW=P.union([su,ou,R2,f2,l2,k2,x2]),uW=P.union([On,lf,xf,_f,hf,pf,ff,mf,lu,bf]),Sr=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}};var W2=6e4,du=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(su,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(ou,r=>{this._onprogress(r)}),this.setRequestHandler(iu,r=>({}))}_setupTimeout(e,r,n,a,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:a})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Sr(wr.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,a;this._transport=e;let s=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{s?.(),this._onclose()};let i=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{i?.(c),this._onerror(c)};let o=(a=this._transport)===null||a===void 0?void 0:a.onmessage;this._transport.onmessage=(c,u)=>{o?.(c,u),uf(c)||Bx(c)?this._onresponse(c):Lx(c)?this._onrequest(c,u):Ux(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let n=new Sr(wr.ConnectionClosed,"Connection closed");for(let a of r.values())a(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(a=>this._onerror(new Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,r){var n,a;let s=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,i=this._transport;if(s===void 0){i?.send({jsonrpc:"2.0",id:e.id,error:{code:wr.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let c={signal:o.signal,sessionId:i?.sessionId,_meta:(a=e.params)===null||a===void 0?void 0:a._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,l,d)=>this.request(u,l,{...d,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>s(e,c)).then(u=>{if(!o.signal.aborted)return i?.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var l;if(!o.signal.aborted)return i?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:wr.InternalError,message:(l=u.message)!==null&&l!==void 0?l:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,a=Number(r),s=this._progressHandlers.get(a);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(a),o=this._timeoutInfo.get(a);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(c){i(c);return}s(n)}_onresponse(e){let r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),uf(e))n(e);else{let a=new Sr(e.error.code,e.error.message,e.error.data);n(a)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){let{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}=n??{};return new Promise((o,c)=>{var u,l,d,p,m,g;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(l=n?.signal)===null||l===void 0||l.throwIfAborted();let b=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:b};n?.onprogress&&(this._progressHandlers.set(b,n.onprogress),f.params={...e.params,_meta:{...((d=e.params)===null||d===void 0?void 0:d._meta)||{},progressToken:b}});let h=_=>{var S;this._responseHandlers.delete(b),this._progressHandlers.delete(b),this._cleanupTimeout(b),(S=this._transport)===null||S===void 0||S.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(_)}},{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(x=>this._onerror(new Error(`Failed to send cancellation: ${x}`))),c(_)};this._responseHandlers.set(b,_=>{var S;if(!(!((S=n?.signal)===null||S===void 0)&&S.aborted)){if(_ instanceof Error)return c(_);try{let x=r.parse(_.result);o(x)}catch(x){c(x)}}}),(p=n?.signal)===null||p===void 0||p.addEventListener("abort",()=>{var _;h((_=n?.signal)===null||_===void 0?void 0:_.reason)});let y=(m=n?.timeout)!==null&&m!==void 0?m:W2,v=()=>h(new Sr(wr.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(b,y,n?.maxTotalTimeout,v,(g=n?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(f,{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(_=>{this._cleanupTimeout(b),c(_)})})}async notification(e,r){var n,a;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((a=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&a!==void 0?a:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,r).catch(l=>this._onerror(l))});return}let o={...e,jsonrpc:"2.0"};await this._transport.send(o,r)}setRequestHandler(e,r){let n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(a,s)=>Promise.resolve(r(e.parse(a),s)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Qx(t,e){return Object.entries(e).reduce((r,[n,a])=>(a&&typeof a=="object"?r[n]=r[n]?{...r[n],...a}:a:r[n]=a,r),{...t})}var tE=St(eE(),1),As=class extends du{constructor(e,r){var n;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._ajv=new tE.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Qx(this._capabilities,e)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:cf,capabilities:this._capabilities,clientInfo:this._clientInfo}},lf,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!jx.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,a,s,i;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},On,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},xf,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},On,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},_f,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},hf,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},pf,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},ff,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},mf,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},On,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},On,r)}async callTool(e,r=lu,n){let a=await this.request({method:"tools/call",params:e},r,n),s=this.getToolOutputValidator(e.name);if(s){if(!a.structuredContent&&!a.isError)throw new Sr(wr.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(a.structuredContent)try{if(!s(a.structuredContent))throw new Sr(wr.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(s.errors)}`)}catch(i){throw i instanceof Sr?i:new Sr(wr.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return a}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let r of e)if(r.outputSchema)try{let n=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},bf,r);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var VE=St(HE(),1),io=St(require("node:process"),1),GE=require("node:stream");var Cu=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(` +`).trimEnd()}var Gl,Zl,di,U7,h$,H7,pe,Kl=Vr(()=>{"use strict";Gl=St(require("path"),1),Zl=require("os"),di=require("fs");Au();mt();Dr();rh();m$();ha();U7=Gl.default.join((0,Zl.homedir)(),".claude","plugins","marketplaces","thedotmack","plugin",".install-version");h$=4,H7=1,pe={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",cyan:"\x1B[36m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",gray:"\x1B[90m",red:"\x1B[31m"}});var W7={};Ja(W7,{WorkerService:()=>Ql});module.exports=Sh(W7);var b$=St(Jc(),1),pi=St(require("path"),1),dh=St(require("fs"),1);var P={};Ja(P,{BRAND:()=>m2,DIRTY:()=>mn,EMPTY_PATH:()=>G4,INVALID:()=>$e,NEVER:()=>Y2,OK:()=>Ut,ParseStatus:()=>qt,Schema:()=>qe,ZodAny:()=>Na,ZodArray:()=>ma,ZodBigInt:()=>vn,ZodBoolean:()=>gn,ZodBranded:()=>eo,ZodCatch:()=>Rn,ZodDate:()=>yn,ZodDefault:()=>$n,ZodDiscriminatedUnion:()=>eu,ZodEffects:()=>xr,ZodEnum:()=>Tn,ZodError:()=>er,ZodFirstPartyTypeKind:()=>Pe,ZodFunction:()=>ru,ZodIntersection:()=>wn,ZodIssueCode:()=>ie,ZodLazy:()=>Sn,ZodLiteral:()=>En,ZodMap:()=>Os,ZodNaN:()=>Is,ZodNativeEnum:()=>kn,ZodNever:()=>Mr,ZodNull:()=>bn,ZodNullable:()=>ta,ZodNumber:()=>hn,ZodObject:()=>tr,ZodOptional:()=>_r,ZodParsedType:()=>ge,ZodPipeline:()=>to,ZodPromise:()=>ja,ZodReadonly:()=>Pn,ZodRecord:()=>tu,ZodSchema:()=>qe,ZodSet:()=>Cs,ZodString:()=>Aa,ZodSymbol:()=>Rs,ZodTransformer:()=>xr,ZodTuple:()=>ea,ZodType:()=>qe,ZodUndefined:()=>_n,ZodUnion:()=>xn,ZodUnknown:()=>fa,ZodVoid:()=>Ps,addIssueToContext:()=>fe,any:()=>S2,array:()=>$2,bigint:()=>y2,boolean:()=>Nx,coerce:()=>J2,custom:()=>Cx,date:()=>_2,datetimeRegex:()=>Px,defaultErrorMap:()=>da,discriminatedUnion:()=>C2,effect:()=>H2,enum:()=>F2,function:()=>D2,getErrorMap:()=>Ts,getParsedType:()=>Qr,instanceof:()=>v2,intersection:()=>I2,isAborted:()=>Yc,isAsync:()=>ks,isDirty:()=>Qc,isValid:()=>Ia,late:()=>h2,lazy:()=>q2,literal:()=>L2,makeIssue:()=>Qi,map:()=>j2,nan:()=>g2,nativeEnum:()=>U2,never:()=>T2,null:()=>w2,nullable:()=>V2,number:()=>Ax,object:()=>R2,objectUtil:()=>nf,oboolean:()=>X2,onumber:()=>K2,optional:()=>B2,ostring:()=>W2,pipeline:()=>Z2,preprocess:()=>G2,promise:()=>z2,quotelessJson:()=>H4,record:()=>N2,set:()=>M2,setErrorMap:()=>V4,strictObject:()=>P2,string:()=>Ix,symbol:()=>b2,transformer:()=>H2,tuple:()=>A2,undefined:()=>x2,union:()=>O2,unknown:()=>E2,util:()=>He,void:()=>k2});var He;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{let s={};for(let i of a)s[i]=i;return s},t.getValidEnumValues=a=>{let s=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(let o of s)i[o]=a[o];return t.objectValues(i)},t.objectValues=a=>t.objectKeys(a).map(function(s){return a[s]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let i in a)Object.prototype.hasOwnProperty.call(a,i)&&s.push(i);return s},t.find=(a,s)=>{for(let i of a)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(He||(He={}));var nf;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(nf||(nf={}));var ge=He.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qr=t=>{switch(typeof t){case"undefined":return ge.undefined;case"string":return ge.string;case"number":return Number.isNaN(t)?ge.nan:ge.number;case"boolean":return ge.boolean;case"function":return ge.function;case"bigint":return ge.bigint;case"symbol":return ge.symbol;case"object":return Array.isArray(t)?ge.array:t===null?ge.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ge.promise:typeof Map<"u"&&t instanceof Map?ge.map:typeof Set<"u"&&t instanceof Set?ge.set:typeof Date<"u"&&t instanceof Date?ge.date:ge.object;default:return ge.unknown}};var ie=He.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"]),H4=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),er=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(s){return s.message},n={_errors:[]},a=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;cr.message){let r={},n=[];for(let a of this.issues)if(a.path.length>0){let s=a.path[0];r[s]=r[s]||[],r[s].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};er.create=t=>new er(t);var B4=(t,e)=>{let r;switch(t.code){case ie.invalid_type:t.received===ge.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,He.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${He.joinValues(t.keys,", ")}`;break;case ie.invalid_union:r="Invalid input";break;case ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${He.joinValues(t.options)}`;break;case ie.invalid_enum_value:r=`Invalid enum value. Expected ${He.joinValues(t.options)}, received '${t.received}'`;break;case ie.invalid_arguments:r="Invalid function arguments";break;case ie.invalid_return_type:r="Invalid function return type";break;case ie.invalid_date:r="Invalid date";break;case ie.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:He.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case ie.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case ie.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case ie.custom:r="Invalid input";break;case ie.invalid_intersection_types:r="Intersection results could not be merged";break;case ie.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case ie.not_finite:r="Number must be finite";break;default:r=e.defaultError,He.assertNever(t)}return{message:r}},da=B4;var Ex=da;function V4(t){Ex=t}function Ts(){return Ex}var Qi=t=>{let{data:e,path:r,errorMaps:n,issueData:a}=t,s=[...r,...a.path||[]],i={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let o="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)o=u(i,{data:e,defaultError:o}).message;return{...a,path:s,message:o}},G4=[];function fe(t,e){let r=Ts(),n=Qi({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===da?void 0:da].filter(a=>!!a)});t.common.issues.push(n)}var qt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let a of r){if(a.status==="aborted")return $e;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let a of r){let s=await a.key,i=await a.value;n.push({key:s,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let a of r){let{key:s,value:i}=a;if(s.status==="aborted"||i.status==="aborted")return $e;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}},$e=Object.freeze({status:"aborted"}),mn=t=>({status:"dirty",value:t}),Ut=t=>({status:"valid",value:t}),Yc=t=>t.status==="aborted",Qc=t=>t.status==="dirty",Ia=t=>t.status==="valid",ks=t=>typeof Promise<"u"&&t instanceof Promise;var be;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(be||(be={}));var br=class{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Tx=(t,e)=>{if(Ia(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new er(t.common.issues);return this._error=r,this._error}}};function je(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:a}}var qe=class{get description(){return this._def.description}_getType(e){return Qr(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Qr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new qt,ctx:{common:e.parent.common,data:e.data,parsedType:Qr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(ks(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qr(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Tx(n,a)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qr(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Ia(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Ia(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qr(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(ks(a)?a:Promise.resolve(a));return Tx(n,s)}refine(e,r){let n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,s)=>{let i=e(a),o=()=>s.addIssue({code:ie.custom,...n(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new xr({schema:this,typeName:Pe.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:r=>this["~validate"](r)}}optional(){return _r.create(this,this._def)}nullable(){return ta.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ma.create(this)}promise(){return ja.create(this,this._def)}or(e){return xn.create([this,e],this._def)}and(e){return wn.create(this,e,this._def)}transform(e){return new xr({...je(this._def),schema:this,typeName:Pe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new $n({...je(this._def),innerType:this,defaultValue:r,typeName:Pe.ZodDefault})}brand(){return new eo({typeName:Pe.ZodBranded,type:this,...je(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Rn({...je(this._def),innerType:this,catchValue:r,typeName:Pe.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return to.create(this,e)}readonly(){return Pn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Z4=/^c[^\s-]{8,}$/i,W4=/^[0-9a-z]+$/,K4=/^[0-9A-HJKMNP-TV-Z]{26}$/i,X4=/^[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,J4=/^[a-z0-9_-]{21}$/i,Y4=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Q4=/^[-+]?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)?)??$/,e2=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,t2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",sf,r2=/^(?:(?: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])$/,a2=/^(?:(?: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])$/,n2=/^(([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]))$/,s2=/^(([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])$/,i2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,o2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$x="((\\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])))",c2=new RegExp(`^${$x}$`);function Rx(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function u2(t){return new RegExp(`^${Rx(t)}$`)}function Px(t){let e=`${$x}T${Rx(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function l2(t,e){return!!((e==="v4"||!e)&&r2.test(t)||(e==="v6"||!e)&&n2.test(t))}function d2(t,e){if(!Y4.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function p2(t,e){return!!((e==="v4"||!e)&&a2.test(t)||(e==="v6"||!e)&&s2.test(t))}var Aa=class t extends qe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ge.string){let s=this._getOrReturnCtx(e);return fe(s,{code:ie.invalid_type,expected:ge.string,received:s.parsedType}),$e}let n=new qt,a;for(let s of this._def.checks)if(s.kind==="min")e.data.lengths.value&&(a=this._getOrReturnCtx(e,a),fe(a,{code:ie.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,o=e.data.lengthe.test(a),{validation:r,code:ie.invalid_string,...be.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...be.errToObj(e)})}url(e){return this._addCheck({kind:"url",...be.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...be.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...be.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...be.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...be.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...be.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...be.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...be.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...be.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...be.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...be.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...be.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...be.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...be.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...be.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...be.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...be.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...be.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...be.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...be.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...be.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...be.errToObj(r)})}nonempty(e){return this.min(1,be.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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Aa({checks:[],typeName:Pe.ZodString,coerce:t?.coerce??!1,...je(t)});function f2(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,s=Number.parseInt(t.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return s%i/10**a}var hn=class t extends qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ge.number){let s=this._getOrReturnCtx(e);return fe(s,{code:ie.invalid_type,expected:ge.number,received:s.parsedType}),$e}let n,a=new qt;for(let s of this._def.checks)s.kind==="int"?He.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),fe(n,{code:ie.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),fe(n,{code:ie.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?f2(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),fe(n,{code:ie.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),fe(n,{code:ie.not_finite,message:s.message}),a.dirty()):He.assertNever(s);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,be.toString(r))}gt(e,r){return this.setLimit("min",e,!1,be.toString(r))}lte(e,r){return this.setLimit("max",e,!0,be.toString(r))}lt(e,r){return this.setLimit("max",e,!1,be.toString(r))}setLimit(e,r,n,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:be.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:be.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:be.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:be.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:be.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:be.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:be.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:be.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:be.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:be.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&He.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew hn({checks:[],typeName:Pe.ZodNumber,coerce:t?.coerce||!1,...je(t)});var vn=class t extends qe{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)!==ge.bigint)return this._getInvalidInput(e);let n,a=new qt;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),fe(n,{code:ie.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),fe(n,{code:ie.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):He.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return fe(r,{code:ie.invalid_type,expected:ge.bigint,received:r.parsedType}),$e}gte(e,r){return this.setLimit("min",e,!0,be.toString(r))}gt(e,r){return this.setLimit("min",e,!1,be.toString(r))}lte(e,r){return this.setLimit("max",e,!0,be.toString(r))}lt(e,r){return this.setLimit("max",e,!1,be.toString(r))}setLimit(e,r,n,a){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:be.toString(a)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:be.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:be.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:be.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:be.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:be.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew vn({checks:[],typeName:Pe.ZodBigInt,coerce:t?.coerce??!1,...je(t)});var gn=class extends qe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ge.boolean){let n=this._getOrReturnCtx(e);return fe(n,{code:ie.invalid_type,expected:ge.boolean,received:n.parsedType}),$e}return Ut(e.data)}};gn.create=t=>new gn({typeName:Pe.ZodBoolean,coerce:t?.coerce||!1,...je(t)});var yn=class t extends qe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ge.date){let s=this._getOrReturnCtx(e);return fe(s,{code:ie.invalid_type,expected:ge.date,received:s.parsedType}),$e}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return fe(s,{code:ie.invalid_date}),$e}let n=new qt,a;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()s.value&&(a=this._getOrReturnCtx(e,a),fe(a,{code:ie.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):He.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:be.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:be.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew yn({checks:[],coerce:t?.coerce||!1,typeName:Pe.ZodDate,...je(t)});var Rs=class extends qe{_parse(e){if(this._getType(e)!==ge.symbol){let n=this._getOrReturnCtx(e);return fe(n,{code:ie.invalid_type,expected:ge.symbol,received:n.parsedType}),$e}return Ut(e.data)}};Rs.create=t=>new Rs({typeName:Pe.ZodSymbol,...je(t)});var _n=class extends qe{_parse(e){if(this._getType(e)!==ge.undefined){let n=this._getOrReturnCtx(e);return fe(n,{code:ie.invalid_type,expected:ge.undefined,received:n.parsedType}),$e}return Ut(e.data)}};_n.create=t=>new _n({typeName:Pe.ZodUndefined,...je(t)});var bn=class extends qe{_parse(e){if(this._getType(e)!==ge.null){let n=this._getOrReturnCtx(e);return fe(n,{code:ie.invalid_type,expected:ge.null,received:n.parsedType}),$e}return Ut(e.data)}};bn.create=t=>new bn({typeName:Pe.ZodNull,...je(t)});var Na=class extends qe{constructor(){super(...arguments),this._any=!0}_parse(e){return Ut(e.data)}};Na.create=t=>new Na({typeName:Pe.ZodAny,...je(t)});var fa=class extends qe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ut(e.data)}};fa.create=t=>new fa({typeName:Pe.ZodUnknown,...je(t)});var Mr=class extends qe{_parse(e){let r=this._getOrReturnCtx(e);return fe(r,{code:ie.invalid_type,expected:ge.never,received:r.parsedType}),$e}};Mr.create=t=>new Mr({typeName:Pe.ZodNever,...je(t)});var Ps=class extends qe{_parse(e){if(this._getType(e)!==ge.undefined){let n=this._getOrReturnCtx(e);return fe(n,{code:ie.invalid_type,expected:ge.void,received:n.parsedType}),$e}return Ut(e.data)}};Ps.create=t=>new Ps({typeName:Pe.ZodVoid,...je(t)});var ma=class t extends qe{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==ge.array)return fe(r,{code:ie.invalid_type,expected:ge.array,received:r.parsedType}),$e;if(a.exactLength!==null){let i=r.data.length>a.exactLength.value,o=r.data.lengtha.maxLength.value&&(fe(r,{code:ie.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>a.type._parseAsync(new br(r,i,r.path,o)))).then(i=>qt.mergeArray(n,i));let s=[...r.data].map((i,o)=>a.type._parseSync(new br(r,i,r.path,o)));return qt.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:be.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:be.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:be.toString(r)}})}nonempty(e){return this.min(1,e)}};ma.create=(t,e)=>new ma({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Pe.ZodArray,...je(e)});function $s(t){if(t instanceof tr){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=_r.create($s(n))}return new tr({...t._def,shape:()=>e})}else return t instanceof ma?new ma({...t._def,type:$s(t.element)}):t instanceof _r?_r.create($s(t.unwrap())):t instanceof ta?ta.create($s(t.unwrap())):t instanceof ea?ea.create(t.items.map(e=>$s(e))):t}var tr=class t extends qe{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(),r=He.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==ge.object){let u=this._getOrReturnCtx(e);return fe(u,{code:ie.invalid_type,expected:ge.object,received:u.parsedType}),$e}let{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Mr&&this._def.unknownKeys==="strip"))for(let u in a.data)i.includes(u)||o.push(u);let c=[];for(let u of i){let l=s[u],d=a.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new br(a,d,a.path,u)),alwaysSet:u in a.data})}if(this._def.catchall instanceof Mr){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of o)c.push({key:{status:"valid",value:l},value:{status:"valid",value:a.data[l]}});else if(u==="strict")o.length>0&&(fe(a,{code:ie.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of o){let d=a.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new br(a,d,a.path,l)),alwaysSet:l in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>qt.mergeObjectSync(n,u)):qt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return be.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let a=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:be.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pe.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of He.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of He.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return $s(this)}partial(e){let r={};for(let n of He.objectKeys(this.shape)){let a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of He.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof _r;)s=s._def.innerType;r[n]=s}return new t({...this._def,shape:()=>r})}keyof(){return Ox(He.objectKeys(this.shape))}};tr.create=(t,e)=>new tr({shape:()=>t,unknownKeys:"strip",catchall:Mr.create(),typeName:Pe.ZodObject,...je(e)});tr.strictCreate=(t,e)=>new tr({shape:()=>t,unknownKeys:"strict",catchall:Mr.create(),typeName:Pe.ZodObject,...je(e)});tr.lazycreate=(t,e)=>new tr({shape:t,unknownKeys:"strip",catchall:Mr.create(),typeName:Pe.ZodObject,...je(e)});var xn=class extends qe{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function a(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map(o=>new er(o.ctx.common.issues));return fe(r,{code:ie.invalid_union,unionErrors:i}),$e}if(r.common.async)return Promise.all(n.map(async s=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(a);{let s,i=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map(c=>new er(c));return fe(r,{code:ie.invalid_union,unionErrors:o}),$e}}get options(){return this._def.options}};xn.create=(t,e)=>new xn({options:t,typeName:Pe.ZodUnion,...je(e)});var pa=t=>t instanceof Sn?pa(t.schema):t instanceof xr?pa(t.innerType()):t instanceof En?[t.value]:t instanceof Tn?t.options:t instanceof kn?He.objectValues(t.enum):t instanceof $n?pa(t._def.innerType):t instanceof _n?[void 0]:t instanceof bn?[null]:t instanceof _r?[void 0,...pa(t.unwrap())]:t instanceof ta?[null,...pa(t.unwrap())]:t instanceof eo||t instanceof Pn?pa(t.unwrap()):t instanceof Rn?pa(t._def.innerType):[],eu=class t extends qe{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ge.object)return fe(r,{code:ie.invalid_type,expected:ge.object,received:r.parsedType}),$e;let n=this.discriminator,a=r.data[n],s=this.optionsMap.get(a);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(fe(r,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),$e)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let a=new Map;for(let s of r){let i=pa(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,s)}}return new t({typeName:Pe.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:a,...je(n)})}};function of(t,e){let r=Qr(t),n=Qr(e);if(t===e)return{valid:!0,data:t};if(r===ge.object&&n===ge.object){let a=He.objectKeys(e),s=He.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i={...t,...e};for(let o of s){let c=of(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(r===ge.array&&n===ge.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let s=0;s{if(Yc(s)||Yc(i))return $e;let o=of(s.value,i.value);return o.valid?((Qc(s)||Qc(i))&&r.dirty(),{status:r.value,value:o.data}):(fe(n,{code:ie.invalid_intersection_types}),$e)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>a(s,i)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};wn.create=(t,e,r)=>new wn({left:t,right:e,typeName:Pe.ZodIntersection,...je(r)});var ea=class t extends qe{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ge.array)return fe(n,{code:ie.invalid_type,expected:ge.array,received:n.parsedType}),$e;if(n.data.lengththis._def.items.length&&(fe(n,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((i,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new br(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>qt.mergeArray(r,i)):qt.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};ea.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ea({items:t,typeName:Pe.ZodTuple,rest:null,...je(e)})};var tu=class t extends qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ge.object)return fe(n,{code:ie.invalid_type,expected:ge.object,received:n.parsedType}),$e;let a=[],s=this._def.keyType,i=this._def.valueType;for(let o in n.data)a.push({key:s._parse(new br(n,o,n.path,o)),value:i._parse(new br(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?qt.mergeObjectAsync(r,a):qt.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof qe?new t({keyType:e,valueType:r,typeName:Pe.ZodRecord,...je(n)}):new t({keyType:Aa.create(),valueType:e,typeName:Pe.ZodRecord,...je(r)})}},Os=class extends qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ge.map)return fe(n,{code:ie.invalid_type,expected:ge.map,received:n.parsedType}),$e;let a=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([o,c],u)=>({key:a._parse(new br(n,o,n.path,[u,"key"])),value:s._parse(new br(n,c,n.path,[u,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return $e;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(u.value,l.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let c of i){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return $e;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(u.value,l.value)}return{status:r.value,value:o}}}};Os.create=(t,e,r)=>new Os({valueType:e,keyType:t,typeName:Pe.ZodMap,...je(r)});var Cs=class t extends qe{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ge.set)return fe(n,{code:ie.invalid_type,expected:ge.set,received:n.parsedType}),$e;let a=this._def;a.minSize!==null&&n.data.sizea.maxSize.value&&(fe(n,{code:ie.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());let s=this._def.valueType;function i(c){let u=new Set;for(let l of c){if(l.status==="aborted")return $e;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let o=[...n.data.values()].map((c,u)=>s._parse(new br(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,r){return new t({...this._def,minSize:{value:e,message:be.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:be.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Cs.create=(t,e)=>new Cs({valueType:t,minSize:null,maxSize:null,typeName:Pe.ZodSet,...je(e)});var ru=class t extends qe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ge.function)return fe(r,{code:ie.invalid_type,expected:ge.function,received:r.parsedType}),$e;function n(o,c){return Qi({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ts(),da].filter(u=>!!u),issueData:{code:ie.invalid_arguments,argumentsError:c}})}function a(o,c){return Qi({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ts(),da].filter(u=>!!u),issueData:{code:ie.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof ja){let o=this;return Ut(async function(...c){let u=new er([]),l=await o._def.args.parseAsync(c,s).catch(m=>{throw u.addIssue(n(c,m)),u}),d=await Reflect.apply(i,this,l);return await o._def.returns._def.type.parseAsync(d,s).catch(m=>{throw u.addIssue(a(d,m)),u})})}else{let o=this;return Ut(function(...c){let u=o._def.args.safeParse(c,s);if(!u.success)throw new er([n(c,u.error)]);let l=Reflect.apply(i,this,u.data),d=o._def.returns.safeParse(l,s);if(!d.success)throw new er([a(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ea.create(e).rest(fa.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||ea.create([]).rest(fa.create()),returns:r||fa.create(),typeName:Pe.ZodFunction,...je(n)})}},Sn=class extends qe{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Sn.create=(t,e)=>new Sn({getter:t,typeName:Pe.ZodLazy,...je(e)});var En=class extends qe{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return fe(r,{received:r.data,code:ie.invalid_literal,expected:this._def.value}),$e}return{status:"valid",value:e.data}}get value(){return this._def.value}};En.create=(t,e)=>new En({value:t,typeName:Pe.ZodLiteral,...je(e)});function Ox(t,e){return new Tn({values:t,typeName:Pe.ZodEnum,...je(e)})}var Tn=class t extends qe{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return fe(r,{expected:He.joinValues(n),received:r.parsedType,code:ie.invalid_type}),$e}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return fe(r,{received:r.data,code:ie.invalid_enum_value,options:n}),$e}return Ut(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Tn.create=Ox;var kn=class extends qe{_parse(e){let r=He.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ge.string&&n.parsedType!==ge.number){let a=He.objectValues(r);return fe(n,{expected:He.joinValues(a),received:n.parsedType,code:ie.invalid_type}),$e}if(this._cache||(this._cache=new Set(He.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=He.objectValues(r);return fe(n,{received:n.data,code:ie.invalid_enum_value,options:a}),$e}return Ut(e.data)}get enum(){return this._def.values}};kn.create=(t,e)=>new kn({values:t,typeName:Pe.ZodNativeEnum,...je(e)});var ja=class extends qe{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ge.promise&&r.common.async===!1)return fe(r,{code:ie.invalid_type,expected:ge.promise,received:r.parsedType}),$e;let n=r.parsedType===ge.promise?r.data:Promise.resolve(r.data);return Ut(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ja.create=(t,e)=>new ja({type:t,typeName:Pe.ZodPromise,...je(e)});var xr=class extends qe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:i=>{fe(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){let i=a.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return $e;let c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?$e:c.status==="dirty"?mn(c.value):r.value==="dirty"?mn(c.value):c});{if(r.value==="aborted")return $e;let o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?$e:o.status==="dirty"?mn(o.value):r.value==="dirty"?mn(o.value):o}}if(a.type==="refinement"){let i=o=>{let c=a.refinement(o,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?$e:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?$e:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ia(i))return $e;let o=a.transform(i.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Ia(i)?Promise.resolve(a.transform(i.value,s)).then(o=>({status:r.value,value:o})):$e);He.assertNever(a)}};xr.create=(t,e,r)=>new xr({schema:t,typeName:Pe.ZodEffects,effect:e,...je(r)});xr.createWithPreprocess=(t,e,r)=>new xr({schema:e,effect:{type:"preprocess",transform:t},typeName:Pe.ZodEffects,...je(r)});var _r=class extends qe{_parse(e){return this._getType(e)===ge.undefined?Ut(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};_r.create=(t,e)=>new _r({innerType:t,typeName:Pe.ZodOptional,...je(e)});var ta=class extends qe{_parse(e){return this._getType(e)===ge.null?Ut(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ta.create=(t,e)=>new ta({innerType:t,typeName:Pe.ZodNullable,...je(e)});var $n=class extends qe{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===ge.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};$n.create=(t,e)=>new $n({innerType:t,typeName:Pe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...je(e)});var Rn=class extends qe{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ks(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new er(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new er(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Rn.create=(t,e)=>new Rn({innerType:t,typeName:Pe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...je(e)});var Is=class extends qe{_parse(e){if(this._getType(e)!==ge.nan){let n=this._getOrReturnCtx(e);return fe(n,{code:ie.invalid_type,expected:ge.nan,received:n.parsedType}),$e}return{status:"valid",value:e.data}}};Is.create=t=>new Is({typeName:Pe.ZodNaN,...je(t)});var m2=Symbol("zod_brand"),eo=class extends qe{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},to=class t extends qe{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?$e:s.status==="dirty"?(r.dirty(),mn(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?$e:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:Pe.ZodPipeline})}},Pn=class extends qe{_parse(e){let r=this._def.innerType._parse(e),n=a=>(Ia(a)&&(a.value=Object.freeze(a.value)),a);return ks(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}};Pn.create=(t,e)=>new Pn({innerType:t,typeName:Pe.ZodReadonly,...je(e)});function kx(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Cx(t,e={},r){return t?Na.create().superRefine((n,a)=>{let s=t(n);if(s instanceof Promise)return s.then(i=>{if(!i){let o=kx(e,n),c=o.fatal??r??!0;a.addIssue({code:"custom",...o,fatal:c})}});if(!s){let i=kx(e,n),o=i.fatal??r??!0;a.addIssue({code:"custom",...i,fatal:o})}}):Na.create()}var h2={object:tr.lazycreate},Pe;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Pe||(Pe={}));var v2=(t,e={message:`Input not instance of ${t.name}`})=>Cx(r=>r instanceof t,e),Ix=Aa.create,Ax=hn.create,g2=Is.create,y2=vn.create,Nx=gn.create,_2=yn.create,b2=Rs.create,x2=_n.create,w2=bn.create,S2=Na.create,E2=fa.create,T2=Mr.create,k2=Ps.create,$2=ma.create,R2=tr.create,P2=tr.strictCreate,O2=xn.create,C2=eu.create,I2=wn.create,A2=ea.create,N2=tu.create,j2=Os.create,M2=Cs.create,D2=ru.create,q2=Sn.create,L2=En.create,F2=Tn.create,U2=kn.create,z2=ja.create,H2=xr.create,B2=_r.create,V2=ta.create,G2=xr.createWithPreprocess,Z2=to.create,W2=()=>Ix().optional(),K2=()=>Ax().optional(),X2=()=>Nx().optional(),J2={string:(t=>Aa.create({...t,coerce:!0})),number:(t=>hn.create({...t,coerce:!0})),boolean:(t=>gn.create({...t,coerce:!0})),bigint:(t=>vn.create({...t,coerce:!0})),date:(t=>yn.create({...t,coerce:!0}))};var Y2=$e;var cf="2025-06-18";var jx=[cf,"2025-03-26","2024-11-05","2024-10-07"],au="2.0",Mx=P.union([P.string(),P.number().int()]),Dx=P.string(),Q2=P.object({progressToken:P.optional(Mx)}).passthrough(),Er=P.object({_meta:P.optional(Q2)}).passthrough(),rr=P.object({method:P.string(),params:P.optional(Er)}),ro=P.object({_meta:P.optional(P.object({}).passthrough())}).passthrough(),ra=P.object({method:P.string(),params:P.optional(ro)}),Tr=P.object({_meta:P.optional(P.object({}).passthrough())}).passthrough(),nu=P.union([P.string(),P.number().int()]),qx=P.object({jsonrpc:P.literal(au),id:nu}).merge(rr).strict(),Lx=t=>qx.safeParse(t).success,Fx=P.object({jsonrpc:P.literal(au)}).merge(ra).strict(),Ux=t=>Fx.safeParse(t).success,zx=P.object({jsonrpc:P.literal(au),id:nu,result:Tr}).strict(),uf=t=>zx.safeParse(t).success,wr;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(wr||(wr={}));var Hx=P.object({jsonrpc:P.literal(au),id:nu,error:P.object({code:P.number().int(),message:P.string(),data:P.optional(P.unknown())})}).strict(),Bx=t=>Hx.safeParse(t).success,Vx=P.union([qx,Fx,zx,Hx]),On=Tr.strict(),su=ra.extend({method:P.literal("notifications/cancelled"),params:ro.extend({requestId:nu,reason:P.string().optional()})}),eD=P.object({src:P.string(),mimeType:P.optional(P.string()),sizes:P.optional(P.array(P.string()))}).passthrough(),ao=P.object({icons:P.array(eD).optional()}).passthrough(),no=P.object({name:P.string(),title:P.optional(P.string())}).passthrough(),Gx=no.extend({version:P.string(),websiteUrl:P.optional(P.string())}).merge(ao),tD=P.object({experimental:P.optional(P.object({}).passthrough()),sampling:P.optional(P.object({}).passthrough()),elicitation:P.optional(P.object({}).passthrough()),roots:P.optional(P.object({listChanged:P.optional(P.boolean())}).passthrough())}).passthrough(),rD=rr.extend({method:P.literal("initialize"),params:Er.extend({protocolVersion:P.string(),capabilities:tD,clientInfo:Gx})});var aD=P.object({experimental:P.optional(P.object({}).passthrough()),logging:P.optional(P.object({}).passthrough()),completions:P.optional(P.object({}).passthrough()),prompts:P.optional(P.object({listChanged:P.optional(P.boolean())}).passthrough()),resources:P.optional(P.object({subscribe:P.optional(P.boolean()),listChanged:P.optional(P.boolean())}).passthrough()),tools:P.optional(P.object({listChanged:P.optional(P.boolean())}).passthrough())}).passthrough(),lf=Tr.extend({protocolVersion:P.string(),capabilities:aD,serverInfo:Gx,instructions:P.optional(P.string())}),nD=ra.extend({method:P.literal("notifications/initialized")});var iu=rr.extend({method:P.literal("ping")}),sD=P.object({progress:P.number(),total:P.optional(P.number()),message:P.optional(P.string())}).passthrough(),ou=ra.extend({method:P.literal("notifications/progress"),params:ro.merge(sD).extend({progressToken:Mx})}),cu=rr.extend({params:Er.extend({cursor:P.optional(Dx)}).optional()}),uu=Tr.extend({nextCursor:P.optional(Dx)}),Zx=P.object({uri:P.string(),mimeType:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}).passthrough(),Wx=Zx.extend({text:P.string()}),df=P.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Kx=Zx.extend({blob:df}),Xx=no.extend({uri:P.string(),description:P.optional(P.string()),mimeType:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}).merge(ao),iD=no.extend({uriTemplate:P.string(),description:P.optional(P.string()),mimeType:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}).merge(ao),oD=cu.extend({method:P.literal("resources/list")}),pf=uu.extend({resources:P.array(Xx)}),cD=cu.extend({method:P.literal("resources/templates/list")}),ff=uu.extend({resourceTemplates:P.array(iD)}),uD=rr.extend({method:P.literal("resources/read"),params:Er.extend({uri:P.string()})}),mf=Tr.extend({contents:P.array(P.union([Wx,Kx]))}),lD=ra.extend({method:P.literal("notifications/resources/list_changed")}),dD=rr.extend({method:P.literal("resources/subscribe"),params:Er.extend({uri:P.string()})}),pD=rr.extend({method:P.literal("resources/unsubscribe"),params:Er.extend({uri:P.string()})}),fD=ra.extend({method:P.literal("notifications/resources/updated"),params:ro.extend({uri:P.string()})}),mD=P.object({name:P.string(),description:P.optional(P.string()),required:P.optional(P.boolean())}).passthrough(),hD=no.extend({description:P.optional(P.string()),arguments:P.optional(P.array(mD)),_meta:P.optional(P.object({}).passthrough())}).merge(ao),vD=cu.extend({method:P.literal("prompts/list")}),hf=uu.extend({prompts:P.array(hD)}),gD=rr.extend({method:P.literal("prompts/get"),params:Er.extend({name:P.string(),arguments:P.optional(P.record(P.string()))})}),vf=P.object({type:P.literal("text"),text:P.string(),_meta:P.optional(P.object({}).passthrough())}).passthrough(),gf=P.object({type:P.literal("image"),data:df,mimeType:P.string(),_meta:P.optional(P.object({}).passthrough())}).passthrough(),yf=P.object({type:P.literal("audio"),data:df,mimeType:P.string(),_meta:P.optional(P.object({}).passthrough())}).passthrough(),yD=P.object({type:P.literal("resource"),resource:P.union([Wx,Kx]),_meta:P.optional(P.object({}).passthrough())}).passthrough(),_D=Xx.extend({type:P.literal("resource_link")}),Jx=P.union([vf,gf,yf,_D,yD]),bD=P.object({role:P.enum(["user","assistant"]),content:Jx}).passthrough(),_f=Tr.extend({description:P.optional(P.string()),messages:P.array(bD)}),xD=ra.extend({method:P.literal("notifications/prompts/list_changed")}),wD=P.object({title:P.optional(P.string()),readOnlyHint:P.optional(P.boolean()),destructiveHint:P.optional(P.boolean()),idempotentHint:P.optional(P.boolean()),openWorldHint:P.optional(P.boolean())}).passthrough(),SD=no.extend({description:P.optional(P.string()),inputSchema:P.object({type:P.literal("object"),properties:P.optional(P.object({}).passthrough()),required:P.optional(P.array(P.string()))}).passthrough(),outputSchema:P.optional(P.object({type:P.literal("object"),properties:P.optional(P.object({}).passthrough()),required:P.optional(P.array(P.string()))}).passthrough()),annotations:P.optional(wD),_meta:P.optional(P.object({}).passthrough())}).merge(ao),ED=cu.extend({method:P.literal("tools/list")}),bf=uu.extend({tools:P.array(SD)}),lu=Tr.extend({content:P.array(Jx).default([]),structuredContent:P.object({}).passthrough().optional(),isError:P.optional(P.boolean())}),aW=lu.or(Tr.extend({toolResult:P.unknown()})),TD=rr.extend({method:P.literal("tools/call"),params:Er.extend({name:P.string(),arguments:P.optional(P.record(P.unknown()))})}),kD=ra.extend({method:P.literal("notifications/tools/list_changed")}),Yx=P.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),$D=rr.extend({method:P.literal("logging/setLevel"),params:Er.extend({level:Yx})}),RD=ra.extend({method:P.literal("notifications/message"),params:ro.extend({level:Yx,logger:P.optional(P.string()),data:P.unknown()})}),PD=P.object({name:P.string().optional()}).passthrough(),OD=P.object({hints:P.optional(P.array(PD)),costPriority:P.optional(P.number().min(0).max(1)),speedPriority:P.optional(P.number().min(0).max(1)),intelligencePriority:P.optional(P.number().min(0).max(1))}).passthrough(),CD=P.object({role:P.enum(["user","assistant"]),content:P.union([vf,gf,yf])}).passthrough(),ID=rr.extend({method:P.literal("sampling/createMessage"),params:Er.extend({messages:P.array(CD),systemPrompt:P.optional(P.string()),includeContext:P.optional(P.enum(["none","thisServer","allServers"])),temperature:P.optional(P.number()),maxTokens:P.number().int(),stopSequences:P.optional(P.array(P.string())),metadata:P.optional(P.object({}).passthrough()),modelPreferences:P.optional(OD)})}),AD=Tr.extend({model:P.string(),stopReason:P.optional(P.enum(["endTurn","stopSequence","maxTokens"]).or(P.string())),role:P.enum(["user","assistant"]),content:P.discriminatedUnion("type",[vf,gf,yf])}),ND=P.object({type:P.literal("boolean"),title:P.optional(P.string()),description:P.optional(P.string()),default:P.optional(P.boolean())}).passthrough(),jD=P.object({type:P.literal("string"),title:P.optional(P.string()),description:P.optional(P.string()),minLength:P.optional(P.number()),maxLength:P.optional(P.number()),format:P.optional(P.enum(["email","uri","date","date-time"]))}).passthrough(),MD=P.object({type:P.enum(["number","integer"]),title:P.optional(P.string()),description:P.optional(P.string()),minimum:P.optional(P.number()),maximum:P.optional(P.number())}).passthrough(),DD=P.object({type:P.literal("string"),title:P.optional(P.string()),description:P.optional(P.string()),enum:P.array(P.string()),enumNames:P.optional(P.array(P.string()))}).passthrough(),qD=P.union([ND,jD,MD,DD]),LD=rr.extend({method:P.literal("elicitation/create"),params:Er.extend({message:P.string(),requestedSchema:P.object({type:P.literal("object"),properties:P.record(P.string(),qD),required:P.optional(P.array(P.string()))}).passthrough()})}),FD=Tr.extend({action:P.enum(["accept","decline","cancel"]),content:P.optional(P.record(P.string(),P.unknown()))}),UD=P.object({type:P.literal("ref/resource"),uri:P.string()}).passthrough();var zD=P.object({type:P.literal("ref/prompt"),name:P.string()}).passthrough(),HD=rr.extend({method:P.literal("completion/complete"),params:Er.extend({ref:P.union([zD,UD]),argument:P.object({name:P.string(),value:P.string()}).passthrough(),context:P.optional(P.object({arguments:P.optional(P.record(P.string(),P.string()))}))})}),xf=Tr.extend({completion:P.object({values:P.array(P.string()).max(100),total:P.optional(P.number().int()),hasMore:P.optional(P.boolean())}).passthrough()}),BD=P.object({uri:P.string().startsWith("file://"),name:P.optional(P.string()),_meta:P.optional(P.object({}).passthrough())}).passthrough(),VD=rr.extend({method:P.literal("roots/list")}),GD=Tr.extend({roots:P.array(BD)}),ZD=ra.extend({method:P.literal("notifications/roots/list_changed")}),nW=P.union([iu,rD,HD,$D,gD,vD,oD,cD,uD,dD,pD,TD,ED]),sW=P.union([su,ou,nD,ZD]),iW=P.union([On,AD,FD,GD]),oW=P.union([iu,ID,LD,VD]),cW=P.union([su,ou,RD,fD,lD,kD,xD]),uW=P.union([On,lf,xf,_f,hf,pf,ff,mf,lu,bf]),Sr=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}};var WD=6e4,du=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(su,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(ou,r=>{this._onprogress(r)}),this.setRequestHandler(iu,r=>({}))}_setupTimeout(e,r,n,a,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:a})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Sr(wr.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,a;this._transport=e;let s=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{s?.(),this._onclose()};let i=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{i?.(c),this._onerror(c)};let o=(a=this._transport)===null||a===void 0?void 0:a.onmessage;this._transport.onmessage=(c,u)=>{o?.(c,u),uf(c)||Bx(c)?this._onresponse(c):Lx(c)?this._onrequest(c,u):Ux(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let n=new Sr(wr.ConnectionClosed,"Connection closed");for(let a of r.values())a(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(a=>this._onerror(new Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,r){var n,a;let s=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,i=this._transport;if(s===void 0){i?.send({jsonrpc:"2.0",id:e.id,error:{code:wr.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let c={signal:o.signal,sessionId:i?.sessionId,_meta:(a=e.params)===null||a===void 0?void 0:a._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,l,d)=>this.request(u,l,{...d,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>s(e,c)).then(u=>{if(!o.signal.aborted)return i?.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var l;if(!o.signal.aborted)return i?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:wr.InternalError,message:(l=u.message)!==null&&l!==void 0?l:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,a=Number(r),s=this._progressHandlers.get(a);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(a),o=this._timeoutInfo.get(a);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(c){i(c);return}s(n)}_onresponse(e){let r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),uf(e))n(e);else{let a=new Sr(e.error.code,e.error.message,e.error.data);n(a)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){let{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}=n??{};return new Promise((o,c)=>{var u,l,d,p,m,g;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(l=n?.signal)===null||l===void 0||l.throwIfAborted();let b=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:b};n?.onprogress&&(this._progressHandlers.set(b,n.onprogress),f.params={...e.params,_meta:{...((d=e.params)===null||d===void 0?void 0:d._meta)||{},progressToken:b}});let h=_=>{var S;this._responseHandlers.delete(b),this._progressHandlers.delete(b),this._cleanupTimeout(b),(S=this._transport)===null||S===void 0||S.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(_)}},{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(x=>this._onerror(new Error(`Failed to send cancellation: ${x}`))),c(_)};this._responseHandlers.set(b,_=>{var S;if(!(!((S=n?.signal)===null||S===void 0)&&S.aborted)){if(_ instanceof Error)return c(_);try{let x=r.parse(_.result);o(x)}catch(x){c(x)}}}),(p=n?.signal)===null||p===void 0||p.addEventListener("abort",()=>{var _;h((_=n?.signal)===null||_===void 0?void 0:_.reason)});let y=(m=n?.timeout)!==null&&m!==void 0?m:WD,v=()=>h(new Sr(wr.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(b,y,n?.maxTotalTimeout,v,(g=n?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(f,{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(_=>{this._cleanupTimeout(b),c(_)})})}async notification(e,r){var n,a;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((a=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&a!==void 0?a:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,r).catch(l=>this._onerror(l))});return}let o={...e,jsonrpc:"2.0"};await this._transport.send(o,r)}setRequestHandler(e,r){let n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(a,s)=>Promise.resolve(r(e.parse(a),s)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Qx(t,e){return Object.entries(e).reduce((r,[n,a])=>(a&&typeof a=="object"?r[n]=r[n]?{...r[n],...a}:a:r[n]=a,r),{...t})}var tE=St(eE(),1),As=class extends du{constructor(e,r){var n;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._ajv=new tE.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Qx(this._capabilities,e)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:cf,capabilities:this._capabilities,clientInfo:this._clientInfo}},lf,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!jx.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,a,s,i;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},On,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},xf,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},On,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},_f,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},hf,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},pf,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},ff,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},mf,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},On,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},On,r)}async callTool(e,r=lu,n){let a=await this.request({method:"tools/call",params:e},r,n),s=this.getToolOutputValidator(e.name);if(s){if(!a.structuredContent&&!a.isError)throw new Sr(wr.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(a.structuredContent)try{if(!s(a.structuredContent))throw new Sr(wr.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(s.errors)}`)}catch(i){throw i instanceof Sr?i:new Sr(wr.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return a}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let r of e)if(r.outputSchema)try{let n=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},bf,r);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var VE=St(HE(),1),io=St(require("node:process"),1),GE=require("node:stream");var Cu=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(` `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Q9(r)}clear(){this._buffer=void 0}};function Q9(t){return Vx.parse(JSON.parse(t))}function BE(t){return JSON.stringify(t)+` `}var eq=io.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function tq(){let t={};for(let e of eq){let r=io.default.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}var Ms=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new Cu,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new GE.PassThrough)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{var n,a,s,i,o;this._process=(0,VE.default)(this._serverParams.command,(n=this._serverParams.args)!==null&&n!==void 0?n:[],{env:{...tq(),...this._serverParams.env},stdio:["pipe","pipe",(a=this._serverParams.stderr)!==null&&a!==void 0?a:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:io.default.platform==="win32"&&rq(),cwd:this._serverParams.cwd}),this._process.on("error",c=>{var u,l;if(c.name==="AbortError"){(u=this.onclose)===null||u===void 0||u.call(this);return}r(c),(l=this.onerror)===null||l===void 0||l.call(this,c)}),this._process.on("spawn",()=>{e()}),this._process.on("close",c=>{var u;this._process=void 0,(u=this.onclose)===null||u===void 0||u.call(this)}),(s=this._process.stdin)===null||s===void 0||s.on("error",c=>{var u;(u=this.onerror)===null||u===void 0||u.call(this,c)}),(i=this._process.stdout)===null||i===void 0||i.on("data",c=>{this._readBuffer.append(c),this.processReadBuffer()}),(o=this._process.stdout)===null||o===void 0||o.on("error",c=>{var u;(u=this.onerror)===null||u===void 0||u.call(this,c)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){var e,r;return this._stderrStream?this._stderrStream:(r=(e=this._process)===null||e===void 0?void 0:e.stderr)!==null&&r!==void 0?r:null}get pid(){var e,r;return(r=(e=this._process)===null||e===void 0?void 0:e.pid)!==null&&r!==void 0?r:null}processReadBuffer(){for(var e,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(e){return new Promise(r=>{var n;if(!(!((n=this._process)===null||n===void 0)&&n.stdin))throw new Error("Not connected");let a=BE(e);this._process.stdin.write(a)?r():this._process.stdin.once("drain",r)})}};function rq(){return"type"in io.default}var Iu=St(require("path"),1),e1=require("os");mt();var am={DEFAULT:12e4,HEALTH_CHECK:1e3,WORKER_STARTUP_WAIT:1e3,WORKER_STARTUP_RETRIES:15,PRE_RESTART_SETTLE_DELAY:2e3,WINDOWS_MULTIPLIER:1.5};function QE(t){return process.platform==="win32"?Math.round(t*am.WINDOWS_MULTIPLIER):t}Dr();var DK=Iu.default.join((0,e1.homedir)(),".claude","plugins","marketplaces","thedotmack"),qK=QE(am.HEALTH_CHECK),oo=null,co=null;function qs(){if(oo!==null)return oo;let t=Iu.default.join(nt.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),e=nt.loadFromFile(t);return oo=parseInt(e.CLAUDE_MEM_WORKER_PORT,10),oo}function t1(){if(co!==null)return co;let t=Iu.default.join(nt.get("CLAUDE_MEM_DATA_DIR"),"settings.json");return co=nt.loadFromFile(t).CLAUDE_MEM_WORKER_HOST,co}function r1(){oo=null,co=null}mt();var ed=require("child_process"),x$=require("util");Au();var f1=require("bun:sqlite");kr();var Nu=class{db;constructor(e){e||(ar(Wt),e=lo),this.db=new f1.Database(e),this.db.run("PRAGMA journal_mode = WAL"),this.ensureFTSTables()}ensureFTSTables(){this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '%_fts'").all().some(n=>n.name==="observations_fts"||n.name==="session_summaries_fts")||(console.log("[SessionSearch] Creating FTS5 tables..."),this.db.run(` CREATE VIRTUAL TABLE IF NOT EXISTS observations_fts USING fts5( @@ -974,7 +974,7 @@ ${n.prompts.header_memory_continued}`}Dr();kr();ha();var dm=require("path"),uT=r `):typeof l=="string"?l:"",p=d.length,m=e.cumulativeInputTokens+e.cumulativeOutputTokens,g=u.message.usage;g&&(e.cumulativeInputTokens+=g.input_tokens||0,e.cumulativeOutputTokens+=g.output_tokens||0,g.cache_creation_input_tokens&&(e.cumulativeInputTokens+=g.cache_creation_input_tokens),q.debug("SDK","Token usage captured",{sessionId:e.sessionDbId,inputTokens:g.input_tokens,outputTokens:g.output_tokens,cacheCreation:g.cache_creation_input_tokens||0,cacheRead:g.cache_read_input_tokens||0,cumulativeInput:e.cumulativeInputTokens,cumulativeOutput:e.cumulativeOutputTokens}));let b=e.cumulativeInputTokens+e.cumulativeOutputTokens-m,f=e.earliestPendingTimestamp;if(p>0){let h=p>100?d.substring(0,100)+"...":d;q.dataOut("SDK",`Response received (${p} chars)`,{sessionId:e.sessionDbId,promptNumber:e.lastPromptNumber},h),await this.processSDKResponse(e,d,r,b,f)}else await this.markMessagesProcessed(e,r)}u.type==="result"&&u.subtype}let c=Date.now()-e.startTime;q.success("SDK","Agent completed",{sessionId:e.sessionDbId,duration:`${(c/1e3).toFixed(1)}s`})}catch(n){throw n.name==="AbortError"?q.warn("SDK","Agent aborted",{sessionId:e.sessionDbId}):q.failure("SDK","Agent error",{sessionDbId:e.sessionDbId},n),n}finally{this.sessionManager.deleteSession(e.sessionDbId).catch(()=>{})}}async*createMessageGenerator(e){let r=ht.getInstance().getActiveMode(),n=e.lastPromptNumber===1?Bu(e.project,e.claudeSessionId,e.userPrompt,r):Zu(e.userPrompt,e.lastPromptNumber,e.claudeSessionId,r);e.conversationHistory.push({role:"user",content:n}),yield{type:"user",message:{role:"user",content:n},session_id:e.claudeSessionId,parent_tool_use_id:null,isSynthetic:!0};for await(let a of this.sessionManager.getMessageIterator(e.sessionDbId))if(a.type==="observation"){a.prompt_number!==void 0&&(e.lastPromptNumber=a.prompt_number);let s=Vu({id:0,tool_name:a.tool_name,tool_input:JSON.stringify(a.tool_input),tool_output:JSON.stringify(a.tool_response),created_at_epoch:Date.now(),cwd:a.cwd});e.conversationHistory.push({role:"user",content:s}),yield{type:"user",message:{role:"user",content:s},session_id:e.claudeSessionId,parent_tool_use_id:null,isSynthetic:!0}}else if(a.type==="summarize"){let s=Gu({id:e.sessionDbId,sdk_session_id:e.sdkSessionId,project:e.project,user_prompt:e.userPrompt,last_user_message:a.last_user_message||"",last_assistant_message:a.last_assistant_message||""},r);e.conversationHistory.push({role:"user",content:s}),yield{type:"user",message:{role:"user",content:s},session_id:e.claudeSessionId,parent_tool_use_id:null,isSynthetic:!0}}}async processSDKResponse(e,r,n,a,s){r&&e.conversationHistory.push({role:"assistant",content:r});let i=zu(r,e.claudeSessionId);for(let c of i){let{id:u,createdAtEpoch:l}=this.dbManager.getSessionStore().storeObservation(e.claudeSessionId,e.project,c,e.lastPromptNumber,a,s??void 0);q.info("SDK","Observation saved",{sessionId:e.sessionDbId,obsId:u,type:c.type,title:c.title||"(untitled)",filesRead:c.files_read?.length??0,filesModified:c.files_modified?.length??0,concepts:c.concepts?.length??0});let d=Date.now(),p=c.type,m=c.title||"(untitled)";this.dbManager.getChromaSync().syncObservation(u,e.claudeSessionId,e.project,c,e.lastPromptNumber,l,a).then(()=>{let g=Date.now()-d;q.debug("CHROMA","Observation synced",{obsId:u,duration:`${g}ms`,type:p,title:m})}).catch(g=>{q.warn("CHROMA","Observation sync failed, continuing without vector search",{obsId:u,type:p,title:m},g)}),n&&n.sseBroadcaster&&n.sseBroadcaster.broadcast({type:"new_observation",observation:{id:u,sdk_session_id:e.sdkSessionId,session_id:e.claudeSessionId,type:c.type,title:c.title,subtitle:c.subtitle,text:c.text||null,narrative:c.narrative||null,facts:JSON.stringify(c.facts||[]),concepts:JSON.stringify(c.concepts||[]),files_read:JSON.stringify(c.files||[]),files_modified:JSON.stringify([]),project:e.project,prompt_number:e.lastPromptNumber,created_at_epoch:l}})}let o=Hu(r,e.sessionDbId);if(o){let{id:c,createdAtEpoch:u}=this.dbManager.getSessionStore().storeSummary(e.claudeSessionId,e.project,o,e.lastPromptNumber,a,s??void 0);q.info("SDK","Summary saved",{sessionId:e.sessionDbId,summaryId:c,request:o.request||"(no request)",hasCompleted:!!o.completed,hasNextSteps:!!o.next_steps});let l=Date.now(),d=o.request||"(no request)";this.dbManager.getChromaSync().syncSummary(c,e.claudeSessionId,e.project,o,e.lastPromptNumber,u,a).then(()=>{let p=Date.now()-l;q.debug("CHROMA","Summary synced",{summaryId:c,duration:`${p}ms`,request:d})}).catch(p=>{q.warn("CHROMA","Summary sync failed, continuing without vector search",{summaryId:c,request:d},p)}),n&&n.sseBroadcaster&&n.sseBroadcaster.broadcast({type:"new_summary",summary:{id:c,session_id:e.claudeSessionId,request:o.request,investigated:o.investigated,learned:o.learned,completed:o.completed,next_steps:o.next_steps,notes:o.notes,project:e.project,prompt_number:e.lastPromptNumber,created_at_epoch:u}})}await this.markMessagesProcessed(e,n)}async markMessagesProcessed(e,r){let n=this.sessionManager.getPendingMessageStore();if(e.pendingProcessingIds.size>0){for(let s of e.pendingProcessingIds)n.markProcessed(s);q.debug("SDK","Messages marked as processed",{sessionId:e.sessionDbId,messageIds:Array.from(e.pendingProcessingIds),count:e.pendingProcessingIds.size}),e.pendingProcessingIds.clear(),e.earliestPendingTimestamp=null;let a=n.cleanupProcessed(100);a>0&&q.debug("SDK","Cleaned up old processed messages",{deletedCount:a})}r&&typeof r.broadcastProcessingStatus=="function"&&r.broadcastProcessingStatus()}findClaudeExecutable(){let e=nt.loadFromFile(An);if(e.CLAUDE_CODE_PATH){let{existsSync:r}=require("fs");if(!r(e.CLAUDE_CODE_PATH))throw new Error(`CLAUDE_CODE_PATH is set to "${e.CLAUDE_CODE_PATH}" but the file does not exist.`);return e.CLAUDE_CODE_PATH}try{let r=(0,Gk.execSync)(process.platform==="win32"?"where claude":"which claude",{encoding:"utf8",windowsHide:!0,stdio:["ignore","pipe","ignore"]}).trim().split(` `)[0].trim();if(r)return r}catch(r){q.debug("SDK","Claude executable auto-detection failed",r)}throw new Error(`Claude executable not found. Please either: 1. Add "claude" to your system PATH, or -2. Set CLAUDE_CODE_PATH in ~/.claude-mem/settings.json`)}getModelId(){let e=Wk.default.join((0,Zk.homedir)(),".claude-mem","settings.json");return nt.loadFromFile(e).CLAUDE_MEM_MODEL}};var Ol=St(require("path"),1),Cl=require("os");mt();Dr();ha();var O7="https://generativelanguage.googleapis.com/v1beta/models",C7={"gemini-2.5-flash-lite":10,"gemini-2.5-flash":5,"gemini-3-flash":5},Kk=0;async function I7(t,e){if(e)return;let r=C7[t]||5,n=Math.ceil(6e4/r)+100,s=Date.now()-Kk;if(ssetTimeout(o,i))}Kk=Date.now()}var Pl=class{dbManager;sessionManager;fallbackAgent=null;constructor(e,r){this.dbManager=e,this.sessionManager=r}setFallbackAgent(e){this.fallbackAgent=e}shouldFallbackToClaude(e){let r=e?.message||"";return r.includes("429")||r.includes("500")||r.includes("502")||r.includes("503")||r.includes("ECONNREFUSED")||r.includes("ETIMEDOUT")||r.includes("fetch failed")}async startSession(e,r){try{let{apiKey:n,model:a,billingEnabled:s}=this.getGeminiConfig();if(!n)throw new Error("Gemini API key not configured. Set CLAUDE_MEM_GEMINI_API_KEY in settings or GEMINI_API_KEY environment variable.");let i=ht.getInstance().getActiveMode(),o=e.lastPromptNumber===1?Bu(e.project,e.claudeSessionId,e.userPrompt,i):Zu(e.userPrompt,e.lastPromptNumber,e.claudeSessionId,i);e.conversationHistory.push({role:"user",content:o});let c=await this.queryGeminiMultiTurn(e.conversationHistory,n,a,s);if(c.content){e.conversationHistory.push({role:"assistant",content:c.content});let l=c.tokensUsed||0;e.cumulativeInputTokens+=Math.floor(l*.7),e.cumulativeOutputTokens+=Math.floor(l*.3),await this.processGeminiResponse(e,c.content,r,l)}for await(let l of this.sessionManager.getMessageIterator(e.sessionDbId))if(l.type==="observation"){l.prompt_number!==void 0&&(e.lastPromptNumber=l.prompt_number);let d=Vu({id:0,tool_name:l.tool_name,tool_input:JSON.stringify(l.tool_input),tool_output:JSON.stringify(l.tool_response),created_at_epoch:Date.now(),cwd:l.cwd});e.conversationHistory.push({role:"user",content:d});let p=await this.queryGeminiMultiTurn(e.conversationHistory,n,a,s);if(p.content){e.conversationHistory.push({role:"assistant",content:p.content});let m=p.tokensUsed||0;e.cumulativeInputTokens+=Math.floor(m*.7),e.cumulativeOutputTokens+=Math.floor(m*.3),await this.processGeminiResponse(e,p.content,r,m)}else q.warn("SDK","Empty Gemini response for observation, marking as processed",{sessionId:e.sessionDbId,toolName:l.tool_name}),await this.markMessagesProcessed(e,r)}else if(l.type==="summarize"){let d=Gu({id:e.sessionDbId,sdk_session_id:e.sdkSessionId,project:e.project,user_prompt:e.userPrompt,last_user_message:l.last_user_message||"",last_assistant_message:l.last_assistant_message||""},i);e.conversationHistory.push({role:"user",content:d});let p=await this.queryGeminiMultiTurn(e.conversationHistory,n,a,s);if(p.content){e.conversationHistory.push({role:"assistant",content:p.content});let m=p.tokensUsed||0;e.cumulativeInputTokens+=Math.floor(m*.7),e.cumulativeOutputTokens+=Math.floor(m*.3),await this.processGeminiResponse(e,p.content,r,m)}else q.warn("SDK","Empty Gemini response for summary, marking as processed",{sessionId:e.sessionDbId}),await this.markMessagesProcessed(e,r)}let u=Date.now()-e.startTime;q.success("SDK","Gemini agent completed",{sessionId:e.sessionDbId,duration:`${(u/1e3).toFixed(1)}s`,historyLength:e.conversationHistory.length}),this.dbManager.getSessionStore().markSessionCompleted(e.sessionDbId)}catch(n){if(n.name==="AbortError")throw q.warn("SDK","Gemini agent aborted",{sessionId:e.sessionDbId}),n;if(this.shouldFallbackToClaude(n)&&this.fallbackAgent){q.warn("SDK","Gemini API failed, falling back to Claude SDK",{sessionDbId:e.sessionDbId,error:n.message,historyLength:e.conversationHistory.length});let s=this.sessionManager.getPendingMessageStore().resetStuckMessages(0);return s>0&&q.info("SDK","Reset processing messages for fallback",{sessionDbId:e.sessionDbId,resetCount:s}),this.fallbackAgent.startSession(e,r)}throw q.failure("SDK","Gemini agent error",{sessionDbId:e.sessionDbId},n),n}}conversationToGeminiContents(e){return e.map(r=>({role:r.role==="assistant"?"model":"user",parts:[{text:r.content}]}))}async queryGeminiMultiTurn(e,r,n,a){let s=this.conversationToGeminiContents(e),i=e.reduce((p,m)=>p+m.content.length,0);q.debug("SDK",`Querying Gemini multi-turn (${n})`,{turns:e.length,totalChars:i});let o=`${O7}/${n}:generateContent?key=${r}`;await I7(n,a);let c=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contents:s,generationConfig:{temperature:.3,maxOutputTokens:4096}})});if(!c.ok){let p=await c.text();throw new Error(`Gemini API error: ${c.status} - ${p}`)}let u=await c.json();if(!u.candidates?.[0]?.content?.parts?.[0]?.text)return q.warn("SDK","Empty response from Gemini"),{content:""};let l=u.candidates[0].content.parts[0].text,d=u.usageMetadata?.totalTokenCount;return{content:l,tokensUsed:d}}async processGeminiResponse(e,r,n,a){let s=zu(r,e.claudeSessionId);for(let o of s){let{id:c,createdAtEpoch:u}=this.dbManager.getSessionStore().storeObservation(e.claudeSessionId,e.project,o,e.lastPromptNumber,a);q.info("SDK","Gemini observation saved",{sessionId:e.sessionDbId,obsId:c,type:o.type,title:o.title||"(untitled)"}),this.dbManager.getChromaSync().syncObservation(c,e.claudeSessionId,e.project,o,e.lastPromptNumber,u,a).catch(l=>{q.warn("SDK","Gemini chroma sync failed",{obsId:c},l)}),n&&n.sseBroadcaster&&n.sseBroadcaster.broadcast({type:"new_observation",observation:{id:c,sdk_session_id:e.sdkSessionId,session_id:e.claudeSessionId,type:o.type,title:o.title,subtitle:o.subtitle,text:null,narrative:o.narrative||null,facts:JSON.stringify(o.facts||[]),concepts:JSON.stringify(o.concepts||[]),files_read:JSON.stringify(o.files_read||[]),files_modified:JSON.stringify(o.files_modified||[]),project:e.project,prompt_number:e.lastPromptNumber,created_at_epoch:u}})}let i=Hu(r,e.sessionDbId);if(i){let o={request:i.request||"",investigated:i.investigated||"",learned:i.learned||"",completed:i.completed||"",next_steps:i.next_steps||"",notes:i.notes},{id:c,createdAtEpoch:u}=this.dbManager.getSessionStore().storeSummary(e.claudeSessionId,e.project,o,e.lastPromptNumber,a);q.info("SDK","Gemini summary saved",{sessionId:e.sessionDbId,summaryId:c,request:i.request||"(no request)"}),this.dbManager.getChromaSync().syncSummary(c,e.claudeSessionId,e.project,o,e.lastPromptNumber,u,a).catch(l=>{q.warn("SDK","Gemini chroma sync failed",{summaryId:c},l)}),n&&n.sseBroadcaster&&n.sseBroadcaster.broadcast({type:"new_summary",summary:{id:c,session_id:e.claudeSessionId,request:i.request,investigated:i.investigated,learned:i.learned,completed:i.completed,next_steps:i.next_steps,notes:i.notes,project:e.project,prompt_number:e.lastPromptNumber,created_at_epoch:u}})}await this.markMessagesProcessed(e,n)}async markMessagesProcessed(e,r){let n=this.sessionManager.getPendingMessageStore();if(e.pendingProcessingIds.size>0){for(let s of e.pendingProcessingIds)n.markProcessed(s);q.debug("SDK","Gemini messages marked as processed",{sessionId:e.sessionDbId,count:e.pendingProcessingIds.size}),e.pendingProcessingIds.clear();let a=n.cleanupProcessed(100);a>0&&q.debug("SDK","Gemini cleaned up old processed messages",{deletedCount:a})}r&&typeof r.broadcastProcessingStatus=="function"&&r.broadcastProcessingStatus()}getGeminiConfig(){let e=Ol.default.join((0,Cl.homedir)(),".claude-mem","settings.json"),r=nt.loadFromFile(e),n=r.CLAUDE_MEM_GEMINI_API_KEY||process.env.GEMINI_API_KEY||"",a=r.CLAUDE_MEM_GEMINI_MODEL||"gemini-2.5-flash-lite",s=r.CLAUDE_MEM_GEMINI_BILLING_ENABLED==="true";return{apiKey:n,model:a,billingEnabled:s}}};function Ym(){let t=Ol.default.join((0,Cl.homedir)(),".claude-mem","settings.json");return!!(nt.loadFromFile(t).CLAUDE_MEM_GEMINI_API_KEY||process.env.GEMINI_API_KEY)}function Qm(){let t=Ol.default.join((0,Cl.homedir)(),".claude-mem","settings.json");return nt.loadFromFile(t).CLAUDE_MEM_PROVIDER==="gemini"}var Il=class{dbManager;constructor(e){this.dbManager=e}stripProjectPath(e,r){let n=`/${r}/`,a=e.indexOf(n);return a!==-1?e.substring(a+n.length):e}stripProjectPaths(e,r){if(!e)return e;try{let a=JSON.parse(e).map(s=>this.stripProjectPath(s,r));return JSON.stringify(a)}catch{return e}}sanitizeObservation(e){return{...e,files_read:this.stripProjectPaths(e.files_read,e.project),files_modified:this.stripProjectPaths(e.files_modified,e.project)}}getObservations(e,r,n){let a=this.paginate("observations","id, sdk_session_id, project, type, title, subtitle, narrative, text, facts, concepts, files_read, files_modified, prompt_number, created_at, created_at_epoch",e,r,n);return{...a,items:a.items.map(s=>this.sanitizeObservation(s))}}getSummaries(e,r,n){let a=this.dbManager.getSessionStore().db,s=` +2. Set CLAUDE_CODE_PATH in ~/.claude-mem/settings.json`)}getModelId(){let e=Wk.default.join((0,Zk.homedir)(),".claude-mem","settings.json");return nt.loadFromFile(e).CLAUDE_MEM_MODEL}};var Ol=St(require("path"),1),Cl=require("os");mt();Dr();ha();var O7="https://generativelanguage.googleapis.com/v1beta/models",C7={"gemini-2.5-flash-lite":10,"gemini-2.5-flash":10,"gemini-2.5-pro":5,"gemini-2.0-flash":15,"gemini-2.0-flash-lite":30},Kk=0;async function I7(t,e){if(e)return;let r=C7[t]||5,n=Math.ceil(6e4/r)+100,s=Date.now()-Kk;if(ssetTimeout(o,i))}Kk=Date.now()}var Pl=class{dbManager;sessionManager;fallbackAgent=null;constructor(e,r){this.dbManager=e,this.sessionManager=r}setFallbackAgent(e){this.fallbackAgent=e}shouldFallbackToClaude(e){let r=e?.message||"";return r.includes("429")||r.includes("500")||r.includes("502")||r.includes("503")||r.includes("ECONNREFUSED")||r.includes("ETIMEDOUT")||r.includes("fetch failed")}async startSession(e,r){try{let{apiKey:n,model:a,billingEnabled:s}=this.getGeminiConfig();if(!n)throw new Error("Gemini API key not configured. Set CLAUDE_MEM_GEMINI_API_KEY in settings or GEMINI_API_KEY environment variable.");let i=ht.getInstance().getActiveMode(),o=e.lastPromptNumber===1?Bu(e.project,e.claudeSessionId,e.userPrompt,i):Zu(e.userPrompt,e.lastPromptNumber,e.claudeSessionId,i);e.conversationHistory.push({role:"user",content:o});let c=await this.queryGeminiMultiTurn(e.conversationHistory,n,a,s);if(c.content){e.conversationHistory.push({role:"assistant",content:c.content});let l=c.tokensUsed||0;e.cumulativeInputTokens+=Math.floor(l*.7),e.cumulativeOutputTokens+=Math.floor(l*.3),await this.processGeminiResponse(e,c.content,r,l)}for await(let l of this.sessionManager.getMessageIterator(e.sessionDbId))if(l.type==="observation"){l.prompt_number!==void 0&&(e.lastPromptNumber=l.prompt_number);let d=Vu({id:0,tool_name:l.tool_name,tool_input:JSON.stringify(l.tool_input),tool_output:JSON.stringify(l.tool_response),created_at_epoch:Date.now(),cwd:l.cwd});e.conversationHistory.push({role:"user",content:d});let p=await this.queryGeminiMultiTurn(e.conversationHistory,n,a,s);if(p.content){e.conversationHistory.push({role:"assistant",content:p.content});let m=p.tokensUsed||0;e.cumulativeInputTokens+=Math.floor(m*.7),e.cumulativeOutputTokens+=Math.floor(m*.3),await this.processGeminiResponse(e,p.content,r,m)}else q.warn("SDK","Empty Gemini response for observation, marking as processed",{sessionId:e.sessionDbId,toolName:l.tool_name}),await this.markMessagesProcessed(e,r)}else if(l.type==="summarize"){let d=Gu({id:e.sessionDbId,sdk_session_id:e.sdkSessionId,project:e.project,user_prompt:e.userPrompt,last_user_message:l.last_user_message||"",last_assistant_message:l.last_assistant_message||""},i);e.conversationHistory.push({role:"user",content:d});let p=await this.queryGeminiMultiTurn(e.conversationHistory,n,a,s);if(p.content){e.conversationHistory.push({role:"assistant",content:p.content});let m=p.tokensUsed||0;e.cumulativeInputTokens+=Math.floor(m*.7),e.cumulativeOutputTokens+=Math.floor(m*.3),await this.processGeminiResponse(e,p.content,r,m)}else q.warn("SDK","Empty Gemini response for summary, marking as processed",{sessionId:e.sessionDbId}),await this.markMessagesProcessed(e,r)}let u=Date.now()-e.startTime;q.success("SDK","Gemini agent completed",{sessionId:e.sessionDbId,duration:`${(u/1e3).toFixed(1)}s`,historyLength:e.conversationHistory.length})}catch(n){if(n.name==="AbortError")throw q.warn("SDK","Gemini agent aborted",{sessionId:e.sessionDbId}),n;if(this.shouldFallbackToClaude(n)&&this.fallbackAgent){q.warn("SDK","Gemini API failed, falling back to Claude SDK",{sessionDbId:e.sessionDbId,error:n.message,historyLength:e.conversationHistory.length});let s=this.sessionManager.getPendingMessageStore().resetStuckMessages(0);return s>0&&q.info("SDK","Reset processing messages for fallback",{sessionDbId:e.sessionDbId,resetCount:s}),this.fallbackAgent.startSession(e,r)}throw q.failure("SDK","Gemini agent error",{sessionDbId:e.sessionDbId},n),n}}conversationToGeminiContents(e){return e.map(r=>({role:r.role==="assistant"?"model":"user",parts:[{text:r.content}]}))}async queryGeminiMultiTurn(e,r,n,a){let s=this.conversationToGeminiContents(e),i=e.reduce((p,m)=>p+m.content.length,0);q.debug("SDK",`Querying Gemini multi-turn (${n})`,{turns:e.length,totalChars:i});let o=`${O7}/${n}:generateContent?key=${r}`;await I7(n,a);let c=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contents:s,generationConfig:{temperature:.3,maxOutputTokens:4096}})});if(!c.ok){let p=await c.text();throw new Error(`Gemini API error: ${c.status} - ${p}`)}let u=await c.json();if(!u.candidates?.[0]?.content?.parts?.[0]?.text)return q.warn("SDK","Empty response from Gemini"),{content:""};let l=u.candidates[0].content.parts[0].text,d=u.usageMetadata?.totalTokenCount;return{content:l,tokensUsed:d}}async processGeminiResponse(e,r,n,a){let s=zu(r,e.claudeSessionId);for(let o of s){let{id:c,createdAtEpoch:u}=this.dbManager.getSessionStore().storeObservation(e.claudeSessionId,e.project,o,e.lastPromptNumber,a);q.info("SDK","Gemini observation saved",{sessionId:e.sessionDbId,obsId:c,type:o.type,title:o.title||"(untitled)"}),this.dbManager.getChromaSync().syncObservation(c,e.claudeSessionId,e.project,o,e.lastPromptNumber,u,a).catch(l=>{q.warn("SDK","Gemini chroma sync failed",{obsId:c},l)}),n&&n.sseBroadcaster&&n.sseBroadcaster.broadcast({type:"new_observation",observation:{id:c,sdk_session_id:e.sdkSessionId,session_id:e.claudeSessionId,type:o.type,title:o.title,subtitle:o.subtitle,text:null,narrative:o.narrative||null,facts:JSON.stringify(o.facts||[]),concepts:JSON.stringify(o.concepts||[]),files_read:JSON.stringify(o.files_read||[]),files_modified:JSON.stringify(o.files_modified||[]),project:e.project,prompt_number:e.lastPromptNumber,created_at_epoch:u}})}let i=Hu(r,e.sessionDbId);if(i){let o={request:i.request||"",investigated:i.investigated||"",learned:i.learned||"",completed:i.completed||"",next_steps:i.next_steps||"",notes:i.notes},{id:c,createdAtEpoch:u}=this.dbManager.getSessionStore().storeSummary(e.claudeSessionId,e.project,o,e.lastPromptNumber,a);q.info("SDK","Gemini summary saved",{sessionId:e.sessionDbId,summaryId:c,request:i.request||"(no request)"}),this.dbManager.getChromaSync().syncSummary(c,e.claudeSessionId,e.project,o,e.lastPromptNumber,u,a).catch(l=>{q.warn("SDK","Gemini chroma sync failed",{summaryId:c},l)}),n&&n.sseBroadcaster&&n.sseBroadcaster.broadcast({type:"new_summary",summary:{id:c,session_id:e.claudeSessionId,request:i.request,investigated:i.investigated,learned:i.learned,completed:i.completed,next_steps:i.next_steps,notes:i.notes,project:e.project,prompt_number:e.lastPromptNumber,created_at_epoch:u}})}await this.markMessagesProcessed(e,n)}async markMessagesProcessed(e,r){let n=this.sessionManager.getPendingMessageStore();if(e.pendingProcessingIds.size>0){for(let s of e.pendingProcessingIds)n.markProcessed(s);q.debug("SDK","Gemini messages marked as processed",{sessionId:e.sessionDbId,count:e.pendingProcessingIds.size}),e.pendingProcessingIds.clear();let a=n.cleanupProcessed(100);a>0&&q.debug("SDK","Gemini cleaned up old processed messages",{deletedCount:a})}r&&typeof r.broadcastProcessingStatus=="function"&&r.broadcastProcessingStatus()}getGeminiConfig(){let e=Ol.default.join((0,Cl.homedir)(),".claude-mem","settings.json"),r=nt.loadFromFile(e),n=r.CLAUDE_MEM_GEMINI_API_KEY||process.env.GEMINI_API_KEY||"",a="gemini-2.5-flash",s=r.CLAUDE_MEM_GEMINI_MODEL||a,i=["gemini-2.5-flash-lite","gemini-2.5-flash","gemini-2.5-pro","gemini-2.0-flash","gemini-2.0-flash-lite"],o;i.includes(s)?o=s:(q.warn("SDK",`Invalid Gemini model "${s}", falling back to ${a}`,{configured:s,validModels:i}),o=a);let c=r.CLAUDE_MEM_GEMINI_BILLING_ENABLED==="true";return{apiKey:n,model:o,billingEnabled:c}}};function Ym(){let t=Ol.default.join((0,Cl.homedir)(),".claude-mem","settings.json");return!!(nt.loadFromFile(t).CLAUDE_MEM_GEMINI_API_KEY||process.env.GEMINI_API_KEY)}function Qm(){let t=Ol.default.join((0,Cl.homedir)(),".claude-mem","settings.json");return nt.loadFromFile(t).CLAUDE_MEM_PROVIDER==="gemini"}var Il=class{dbManager;constructor(e){this.dbManager=e}stripProjectPath(e,r){let n=`/${r}/`,a=e.indexOf(n);return a!==-1?e.substring(a+n.length):e}stripProjectPaths(e,r){if(!e)return e;try{let a=JSON.parse(e).map(s=>this.stripProjectPath(s,r));return JSON.stringify(a)}catch{return e}}sanitizeObservation(e){return{...e,files_read:this.stripProjectPaths(e.files_read,e.project),files_modified:this.stripProjectPaths(e.files_modified,e.project)}}getObservations(e,r,n){let a=this.paginate("observations","id, sdk_session_id, project, type, title, subtitle, narrative, text, facts, concepts, files_read, files_modified, prompt_number, created_at, created_at_epoch",e,r,n);return{...a,items:a.items.map(s=>this.sanitizeObservation(s))}}getSummaries(e,r,n){let a=this.dbManager.getSessionStore().db,s=` SELECT ss.id, s.claude_session_id as session_id, diff --git a/src/services/worker/GeminiAgent.ts b/src/services/worker/GeminiAgent.ts index 1215718c..ba2b7bf9 100644 --- a/src/services/worker/GeminiAgent.ts +++ b/src/services/worker/GeminiAgent.ts @@ -25,14 +25,21 @@ import { ModeManager } from '../domain/ModeManager.js'; // Gemini API endpoint const GEMINI_API_URL = 'https://generativelanguage.googleapis.com/v1beta/models'; -// Gemini model types (free tier models) -export type GeminiModel = 'gemini-2.5-flash-lite' | 'gemini-2.5-flash' | 'gemini-3-flash'; +// Gemini model types (available via API) +export type GeminiModel = + | 'gemini-2.5-flash-lite' + | 'gemini-2.5-flash' + | 'gemini-2.5-pro' + | 'gemini-2.0-flash' + | 'gemini-2.0-flash-lite'; // Free tier RPM limits by model (requests per minute) const GEMINI_RPM_LIMITS: Record = { 'gemini-2.5-flash-lite': 10, - 'gemini-2.5-flash': 5, - 'gemini-3-flash': 5, + 'gemini-2.5-flash': 10, + 'gemini-2.5-pro': 5, + 'gemini-2.0-flash': 15, + 'gemini-2.0-flash-lite': 30, }; // Track last request time for rate limiting @@ -246,8 +253,6 @@ export class GeminiAgent { historyLength: session.conversationHistory.length }); - this.dbManager.getSessionStore().markSessionCompleted(session.sessionDbId); - } catch (error: any) { if (error.name === 'AbortError') { logger.warn('SDK', 'Gemini agent aborted', { sessionId: session.sessionDbId }); @@ -518,8 +523,27 @@ export class GeminiAgent { // API key: check settings first, then environment variable const apiKey = settings.CLAUDE_MEM_GEMINI_API_KEY || process.env.GEMINI_API_KEY || ''; - // Model: from settings or default (gemini-2.5-flash-lite has highest free tier RPM) - const model = (settings.CLAUDE_MEM_GEMINI_MODEL || 'gemini-2.5-flash-lite') as GeminiModel; + // Model: from settings or default, with validation + const defaultModel: GeminiModel = 'gemini-2.5-flash'; + const configuredModel = settings.CLAUDE_MEM_GEMINI_MODEL || defaultModel; + const validModels: GeminiModel[] = [ + 'gemini-2.5-flash-lite', + 'gemini-2.5-flash', + 'gemini-2.5-pro', + 'gemini-2.0-flash', + 'gemini-2.0-flash-lite', + ]; + + let model: GeminiModel; + if (validModels.includes(configuredModel as GeminiModel)) { + model = configuredModel as GeminiModel; + } else { + logger.warn('SDK', `Invalid Gemini model "${configuredModel}", falling back to ${defaultModel}`, { + configured: configuredModel, + validModels, + }); + model = defaultModel; + } // Billing: if enabled, skip rate limiting (1000+ RPM available) const billingEnabled = settings.CLAUDE_MEM_GEMINI_BILLING_ENABLED === 'true';