diff --git a/plugin/scripts/worker-service.cjs b/plugin/scripts/worker-service.cjs index f1f3a882..9f397c0a 100755 --- a/plugin/scripts/worker-service.cjs +++ b/plugin/scripts/worker-service.cjs @@ -1,5 +1,5 @@ #!/usr/bin/env node -"use strict";var Ww=Object.create;var no=Object.defineProperty;var Gw=Object.getOwnPropertyDescriptor;var Zw=Object.getOwnPropertyNames;var Kw=Object.getPrototypeOf,Xw=Object.prototype.hasOwnProperty;var Qn=(a,e)=>()=>(a&&(e=a(a=0)),e);var q=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),Ul=(a,e)=>{for(var r in e)no(a,r,{get:e[r],enumerable:!0})},wf=(a,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Zw(e))!Xw.call(a,s)&&s!==r&&no(a,s,{get:()=>e[s],enumerable:!(t=Gw(e,s))||t.enumerable});return a};var vt=(a,e,r)=>(r=a!=null?Ww(Kw(a)):{},wf(e||!a||!a.__esModule?no(r,"default",{value:a,enumerable:!0}):r,a)),Qw=a=>wf(no({},"__esModule",{value:!0}),a);var Ir=q((M6,Of)=>{var Jw=require("path").relative;Of.exports=a1;var Yw=process.cwd();function Rf(a,e){for(var r=a.split(/[ ,]+/),t=String(e).toLowerCase(),s=0;s()=>(a&&(e=a(a=0)),e);var q=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),Ul=(a,e)=>{for(var r in e)no(a,r,{get:e[r],enumerable:!0})},wf=(a,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Zw(e))!Xw.call(a,s)&&s!==r&&no(a,s,{get:()=>e[s],enumerable:!(t=Gw(e,s))||t.enumerable});return a};var gt=(a,e,r)=>(r=a!=null?Ww(Kw(a)):{},wf(e||!a||!a.__esModule?no(r,"default",{value:a,enumerable:!0}):r,a)),Qw=a=>wf(no({},"__esModule",{value:!0}),a);var Ir=q((M6,Of)=>{var Jw=require("path").relative;Of.exports=a1;var Yw=process.cwd();function Rf(a,e){for(var r=a.split(/[ ,]+/),t=String(e).toLowerCase(),s=0;s0}function n1(a){if(process.noDeprecation)return!0;var e=process.env.NO_DEPRECATION||"";return Rf(e,a)}function i1(a){if(process.traceDeprecation)return!0;var e=process.env.TRACE_DEPRECATION||"";return Rf(e,a)}function io(a,e){var r=s1(process,"deprecation");if(!(!r&&this._ignored)){var t,s,i,n,o=0,l=!1,c=oo(),u=this._file;for(e?(n=e,i=zs(c[1]),i.name=n.name,u=i[0]):(o=2,n=zs(c[o]),i=n);o",r=a.getLineNumber(),t=a.getColumnNumber();a.isEval()&&(e=a.getEvalOrigin()+", "+e);var s=[e,r,t];return s.callSite=a,s.name=a.getFunctionName(),s}function Tf(a){var e=a.callSite,r=a.name;r||(r="");var t=e.getThis(),s=t&&e.getTypeName();return s==="Object"&&(s=void 0),s==="Function"&&(s=t.name||s),s&&e.getMethodName()?s+"."+r:r}function o1(a,e,r){var t=new Date().toUTCString(),s=t+" "+this._namespace+" deprecated "+a;if(this._traced){for(var i=0;i`+e+` -`}function DI(a,e){return e?e instanceof Error?xp(a,e,{expose:!1}):xp(a,e):xp(a)}function jI(a){try{return decodeURIComponent(a)}catch{return-1}}function $I(a){return typeof a.getHeaderNames!="function"?Object.keys(a._headers||{}):a.getHeaderNames()}function db(a,e){var r=typeof a.listenerCount!="function"?a.listeners(e).length:a.listenerCount(e);return r>0}function MI(a){return typeof a.headersSent!="boolean"?!!a._header:a.headersSent}function Sp(a,e){for(var r=[].concat(a||[]),t=0;t{"use strict";fb.exports=FI;function FI(a){if(!a)throw new TypeError("argument req is required");var e=zI(a.headers["x-forwarded-for"]||""),r=UI(a),t=[r].concat(e);return t}function UI(a){return a.socket?a.socket.remoteAddress:a.connection.remoteAddress}function zI(a){for(var e=a.length,r=[],t=a.length,s=a.length-1;s>=0;s--)switch(a.charCodeAt(s)){case 32:t===e&&(t=e=s);break;case 44:t!==e&&r.push(a.substring(t,e)),t=e=s;break;default:t=s;break}return t!==e&&r.push(a.substring(t,e)),r}});var vb=q((hb,Ci)=>{(function(){var a,e,r,t,s,i,n,o,l;e={},o=this,typeof Ci<"u"&&Ci!==null&&Ci.exports?Ci.exports=e:o.ipaddr=e,n=function(c,u,p,f){var d,v;if(c.length!==u.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");for(d=0;f>0;){if(v=p-f,v<0&&(v=0),c[d]>>v!==u[d]>>v)return!1;f-=p,d+=1}return!0},e.subnetMatch=function(c,u,p){var f,d,v,h,m;p==null&&(p="unicast");for(v in u)for(h=u[v],h[0]&&!(h[0]instanceof Array)&&(h=[h]),f=0,d=h.length;f=0;p=f+=-1)if(d=this.octets[p],d in m){if(h=m[d],v&&h!==0)return null;h!==8&&(v=!0),u+=h}else return null;return 32-u},c})(),r="(0?\\d+|0x[a-f0-9]+)",t={fourOctet:new RegExp("^"+r+"\\."+r+"\\."+r+"\\."+r+"$","i"),longValue:new RegExp("^"+r+"$","i")},e.IPv4.parser=function(c){var u,p,f,d,v;if(p=function(h){return h[0]==="0"&&h[1]!=="x"?parseInt(h,8):parseInt(h)},u=c.match(t.fourOctet))return(function(){var h,m,y,g;for(y=u.slice(1,6),g=[],h=0,m=y.length;h4294967295||v<0)throw new Error("ipaddr: address outside defined range");return(function(){var h,m;for(m=[],d=h=0;h<=24;d=h+=8)m.push(v>>d&255);return m})().reverse()}else return null},e.IPv6=(function(){function c(u,p){var f,d,v,h,m,y;if(u.length===16)for(this.parts=[],f=d=0;d<=14;f=d+=2)this.parts.push(u[f]<<8|u[f+1]);else if(u.length===8)this.parts=u;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(y=this.parts,v=0,h=y.length;vp&&(u=f.index,p=f[0].length);return p<0?v:v.substring(0,u)+"::"+v.substring(u+p)},c.prototype.toByteArray=function(){var u,p,f,d,v;for(u=[],v=this.parts,p=0,f=v.length;p>8),u.push(d&255);return u},c.prototype.toNormalizedString=function(){var u,p,f;return u=(function(){var d,v,h,m;for(h=this.parts,m=[],d=0,v=h.length;d>8,u&255,p>>8,p&255])},c.prototype.prefixLengthFromSubnetMask=function(){var u,p,f,d,v,h,m;for(m={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},u=0,v=!1,p=f=7;f>=0;p=f+=-1)if(d=this.parts[p],d in m){if(h=m[d],v&&h!==0)return null;h!==16&&(v=!0),u+=h}else return null;return 128-u},c})(),s="(?:[0-9a-f]+::?)+",l="%[0-9a-z]{1,}",i={zoneIndex:new RegExp(l,"i"),native:new RegExp("^(::)?("+s+")?([0-9a-f]+)?(::)?("+l+")?$","i"),transitional:new RegExp("^((?:"+s+")|(?:::)(?:"+s+")?)"+(r+"\\."+r+"\\."+r+"\\."+r)+("("+l+")?$"),"i")},a=function(c,u){var p,f,d,v,h,m;if(c.indexOf("::")!==c.lastIndexOf("::"))return null;for(m=(c.match(i.zoneIndex)||[])[0],m&&(m=m.substring(1),c=c.replace(/%.+$/,"")),p=0,f=-1;(f=c.indexOf(":",f+1))>=0;)p++;if(c.substr(0,2)==="::"&&p--,c.substr(-2,2)==="::"&&p--,p>u)return null;for(h=u-p,v=":";h--;)v+="0:";return c=c.replace("::",v),c[0]===":"&&(c=c.slice(1)),c[c.length-1]===":"&&(c=c.slice(0,-1)),u=(function(){var y,g,b,w;for(b=c.split(":"),w=[],y=0,g=b.length;y=0&&u<=32))return f=[this.parse(p[1]),u],Object.defineProperty(f,"toString",{value:function(){return this.join("/")}}),f;throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},e.IPv4.subnetMaskFromPrefixLength=function(c){var u,p,f;if(c=parseInt(c),c<0||c>32)throw new Error("ipaddr: invalid IPv4 prefix length");for(f=[0,0,0,0],p=0,u=Math.floor(c/8);p=0&&u<=128))return f=[this.parse(p[1]),u],Object.defineProperty(f,"toString",{value:function(){return this.join("/")}}),f;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},e.isValid=function(c){return e.IPv6.isValid(c)||e.IPv4.isValid(c)},e.parse=function(c){if(e.IPv6.isValid(c))return e.IPv6.parse(c);if(e.IPv4.isValid(c))return e.IPv4.parse(c);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},e.parseCIDR=function(c){var u;try{return e.IPv6.parseCIDR(c)}catch(p){u=p;try{return e.IPv4.parseCIDR(c)}catch(f){throw u=f,new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},e.fromByteArray=function(c){var u;if(u=c.length,u===4)return new e.IPv4(c);if(u===16)return new e.IPv6(c);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},e.process=function(c){var u;return u=this.parse(c),u.kind()==="ipv6"&&u.isIPv4MappedAddress()?u.toIPv4Address():u}}).call(hb)});var Rp=q((Zq,ic)=>{"use strict";ic.exports=KI;ic.exports.all=bb;ic.exports.compile=xb;var BI=mb(),yb=vb(),HI=/^[0-9]+$/,sc=yb.isValid,nc=yb.parse,gb={linklocal:["169.254.0.0/16","fe80::/10"],loopback:["127.0.0.1/8","::1/128"],uniquelocal:["10.0.0.0/8","172.16.0.0/12","192.168.0.0/16","fc00::/7"]};function bb(a,e){var r=BI(a);if(!e)return r;typeof e!="function"&&(e=xb(e));for(var t=0;ts)throw new TypeError("invalid range on address: "+a);return[t,i]}function ZI(a){var e=nc(a),r=e.kind();return r==="ipv4"?e.prefixLengthFromSubnetMask():null}function KI(a,e){if(!a)throw new TypeError("req argument is required");if(!e)throw new TypeError("trust argument is required");var r=bb(a,e),t=r[r.length-1];return t}function XI(){return!1}function QI(a){return function(r){if(!sc(r))return!1;for(var t=nc(r),s,i=t.kind(),n=0;n{"use strict";var _b=Jo().Buffer,YI=vp(),Eb=Jn(),Sb=Ir()("express"),eA=Ti(),tA=ac().mime,rA=gp(),aA=Rp(),sA=zo(),nA=require("querystring");It.etag=wb({weak:!1});It.wetag=wb({weak:!0});It.isAbsolute=function(a){if(a[0]==="/"||a[1]===":"&&(a[2]==="\\"||a[2]==="/")||a.substring(0,2)==="\\\\")return!0};It.flatten=Sb.function(eA,"utils.flatten: use array-flatten npm module instead");It.normalizeType=function(a){return~a.indexOf("/")?iA(a):{value:tA.lookup(a),params:{}}};It.normalizeTypes=function(a){for(var e=[],r=0;r{"use strict";var lA=ny(),uA=dp(),Op=Go(),pA=Iy(),dA=fp(),oc=ar()("express:application"),fA=My(),mA=require("http"),hA=Sa().compileETag,vA=Sa().compileQueryParser,gA=Sa().compileTrust,yA=Ir()("express"),bA=Ti(),Pp=Ri(),xA=require("path").resolve,hn=Yn(),_A=Object.prototype.hasOwnProperty,kp=Array.prototype.slice,gt=Tb=Rb.exports={},Cp="@@symbol:trust_proxy_default";gt.init=function(){this.cache={},this.engines={},this.settings={},this.defaultConfiguration()};gt.defaultConfiguration=function(){var e=process.env.NODE_ENV||"development";this.enable("x-powered-by"),this.set("etag","weak"),this.set("env",e),this.set("query parser","extended"),this.set("subdomain offset",2),this.set("trust proxy",!1),Object.defineProperty(this.settings,Cp,{configurable:!0,value:!0}),oc("booting in %s mode",e),this.on("mount",function(t){this.settings[Cp]===!0&&typeof t.settings["trust proxy fn"]=="function"&&(delete this.settings["trust proxy"],delete this.settings["trust proxy fn"]),hn(this.request,t.request),hn(this.response,t.response),hn(this.engines,t.engines),hn(this.settings,t.settings)}),this.locals=Object.create(null),this.mountpath="/",this.locals.settings=this.settings,this.set("view",fA),this.set("views",xA("views")),this.set("jsonp callback name","callback"),e==="production"&&this.enable("view cache"),Object.defineProperty(this,"router",{get:function(){throw new Error(`'app.router' is deprecated! -Please see the 3.x to 4.x migration guide for details on how to update your app.`)}})};gt.lazyrouter=function(){this._router||(this._router=new uA({caseSensitive:this.enabled("case sensitive routing"),strict:this.enabled("strict routing")}),this._router.use(dA(this.get("query parser fn"))),this._router.use(pA.init(this)))};gt.handle=function(e,r,t){var s=this._router,i=t||lA(e,r,{env:this.get("env"),onerror:EA.bind(this)});if(!s){oc("no routes defined on app"),i();return}s.handle(e,r,i)};gt.use=function(e){var r=0,t="/";if(typeof e!="function"){for(var s=e;Array.isArray(s)&&s.length!==0;)s=s[0];typeof s!="function"&&(r=1,t=e)}var i=bA(kp.call(arguments,r));if(i.length===0)throw new TypeError("app.use() requires a middleware function");this.lazyrouter();var n=this._router;return i.forEach(function(o){if(!o||!o.handle||!o.set)return n.use(t,o);oc(".use app under %s",t),o.mountpath=t,o.parent=this,n.use(t,function(c,u,p){var f=c.app;o.handle(c,u,function(d){hn(c,f.request),hn(u,f.response),p(d)})}),o.emit("mount",this)},this),this};gt.route=function(e){return this.lazyrouter(),this._router.route(e)};gt.engine=function(e,r){if(typeof r!="function")throw new Error("callback function required");var t=e[0]!=="."?"."+e:e;return this.engines[t]=r,this};gt.param=function(e,r){if(this.lazyrouter(),Array.isArray(e)){for(var t=0;t1?'directories "'+c.root.slice(0,-1).join('", "')+'" or "'+c.root[c.root.length-1]+'"':'directory "'+c.root+'"',f=new Error('Failed to lookup view "'+e+'" in views '+p);return f.view=c,i(f)}l.cache&&(s[e]=c)}SA(c,l,i)};gt.listen=function(){var e=mA.createServer(this);return e.listen.apply(e,arguments)};function EA(a){this.get("env")!=="test"&&console.error(a.stack||a.toString())}function SA(a,e,r){try{a.render(e,r)}catch(t){r(t)}}});var Ib=q((Xq,Ip)=>{"use strict";Ip.exports=kb;Ip.exports.preferredCharsets=kb;var wA=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function TA(a){for(var e=a.split(","),r=0,t=0;r0}});var $b=q((Qq,Ap)=>{"use strict";Ap.exports=jb;Ap.exports.preferredEncodings=jb;var kA=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function IA(a){for(var e=a.split(","),r=!1,t=1,s=0,i=0;s0}});var Ub=q((Jq,Np)=>{"use strict";Np.exports=Fb;Np.exports.preferredLanguages=Fb;var jA=/^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;function $A(a){for(var e=a.split(","),r=0,t=0;r0}});var Gb=q((Yq,Dp)=>{"use strict";Dp.exports=Vb;Dp.exports.preferredMediaTypes=Vb;var FA=/^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;function UA(a){for(var e=WA(a),r=0,t=0;r0)if(i.every(function(n){return e.params[n]=="*"||(e.params[n]||"").toLowerCase()==(t.params[n]||"").toLowerCase()}))s|=1;else return null;return{i:r,o:e.i,q:e.q,s}}function Vb(a,e){var r=UA(a===void 0?"*/*":a||"");if(!e)return r.filter(Bb).sort(zb).map(HA);var t=e.map(function(i,n){return zA(i,r,n)});return t.filter(Bb).sort(zb).map(function(i){return e[t.indexOf(i)]})}function zb(a,e){return e.q-a.q||e.s-a.s||a.o-e.o||a.i-e.i||0}function HA(a){return a.type+"/"+a.subtype}function Bb(a){return a.q>0}function Wb(a){for(var e=0,r=0;(r=a.indexOf('"',r))!==-1;)e++,r++;return e}function VA(a){var e=a.indexOf("="),r,t;return e===-1?r=a:(r=a.substr(0,e),t=a.substr(e+1)),[r,t]}function WA(a){for(var e=a.split(","),r=1,t=0;r{"use strict";var ZA=Ib(),KA=$b(),XA=Ub(),QA=Gb();jp.exports=st;jp.exports.Negotiator=st;function st(a){if(!(this instanceof st))return new st(a);this.request=a}st.prototype.charset=function(e){var r=this.charsets(e);return r&&r[0]};st.prototype.charsets=function(e){return ZA(this.request.headers["accept-charset"],e)};st.prototype.encoding=function(e){var r=this.encodings(e);return r&&r[0]};st.prototype.encodings=function(e){return KA(this.request.headers["accept-encoding"],e)};st.prototype.language=function(e){var r=this.languages(e);return r&&r[0]};st.prototype.languages=function(e){return XA(this.request.headers["accept-language"],e)};st.prototype.mediaType=function(e){var r=this.mediaTypes(e);return r&&r[0]};st.prototype.mediaTypes=function(e){return QA(this.request.headers.accept,e)};st.prototype.preferredCharset=st.prototype.charset;st.prototype.preferredCharsets=st.prototype.charsets;st.prototype.preferredEncoding=st.prototype.encoding;st.prototype.preferredEncodings=st.prototype.encodings;st.prototype.preferredLanguage=st.prototype.language;st.prototype.preferredLanguages=st.prototype.languages;st.prototype.preferredMediaType=st.prototype.mediaType;st.prototype.preferredMediaTypes=st.prototype.mediaTypes});var Xb=q((tF,Kb)=>{"use strict";var JA=Zb(),YA=Iu();Kb.exports=Qt;function Qt(a){if(!(this instanceof Qt))return new Qt(a);this.headers=a.headers,this.negotiator=new JA(a)}Qt.prototype.type=Qt.prototype.types=function(a){var e=a;if(e&&!Array.isArray(e)){e=new Array(arguments.length);for(var r=0;r{"use strict";var cc=Xb(),ki=Ir()("express"),r4=require("net").isIP,a4=Js(),s4=require("http"),n4=yp(),i4=bp(),o4=on(),Qb=Rp(),nt=Object.create(s4.IncomingMessage.prototype);Jb.exports=nt;nt.get=nt.header=function(e){if(!e)throw new TypeError("name argument is required to req.get");if(typeof e!="string")throw new TypeError("name must be a string to req.get");var r=e.toLowerCase();switch(r){case"referer":case"referrer":return this.headers.referrer||this.headers.referer;default:return this.headers[r]}};nt.accepts=function(){var a=cc(this);return a.types.apply(a,arguments)};nt.acceptsEncodings=function(){var a=cc(this);return a.encodings.apply(a,arguments)};nt.acceptsEncoding=ki.function(nt.acceptsEncodings,"req.acceptsEncoding: Use acceptsEncodings instead");nt.acceptsCharsets=function(){var a=cc(this);return a.charsets.apply(a,arguments)};nt.acceptsCharset=ki.function(nt.acceptsCharsets,"req.acceptsCharset: Use acceptsCharsets instead");nt.acceptsLanguages=function(){var a=cc(this);return a.languages.apply(a,arguments)};nt.acceptsLanguage=ki.function(nt.acceptsLanguages,"req.acceptsLanguage: Use acceptsLanguages instead");nt.range=function(e,r){var t=this.get("Range");if(t)return i4(e,t,r)};nt.param=function(e,r){var t=this.params||{},s=this.body||{},i=this.query||{},n=arguments.length===1?"name":"name, default";return ki("req.param("+n+"): Use req.params, req.body, or req.query instead"),t[e]!=null&&t.hasOwnProperty(e)?t[e]:s[e]!=null?s[e]:i[e]!=null?i[e]:r};nt.is=function(e){var r=e;if(!Array.isArray(e)){r=new Array(arguments.length);for(var t=0;t=200&&r<300||r===304?n4(this.headers,{etag:e.get("ETag"),"last-modified":e.get("Last-Modified")}):!1});Tr(nt,"stale",function(){return!this.fresh});Tr(nt,"xhr",function(){var e=this.get("X-Requested-With")||"";return e.toLowerCase()==="xmlhttprequest"});function Tr(a,e,r){Object.defineProperty(a,e,{configurable:!0,enumerable:!0,get:r})}});var rx=q(lc=>{var tx=require("crypto");lc.sign=function(a,e){if(typeof a!="string")throw new TypeError("Cookie value must be provided as a string.");if(typeof e!="string")throw new TypeError("Secret string must be provided.");return a+"."+tx.createHmac("sha256",e).update(a).digest("base64").replace(/\=+$/,"")};lc.unsign=function(a,e){if(typeof a!="string")throw new TypeError("Signed cookie string must be provided.");if(typeof e!="string")throw new TypeError("Secret string must be provided.");var r=a.slice(0,a.lastIndexOf(".")),t=lc.sign(r,e);return ex(t)==ex(a)?r:!1};function ex(a){return tx.createHash("sha1").update(a).digest("hex")}});var nx=q($p=>{"use strict";$p.parse=f4;$p.serialize=m4;var c4=Object.prototype.toString,l4=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,u4=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,p4=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,d4=/^[\u0020-\u003A\u003D-\u007E]*$/;function f4(a,e){if(typeof a!="string")throw new TypeError("argument str must be a string");var r={},t=a.length;if(t<2)return r;var s=e&&e.decode||h4,i=0,n=0,o=0;do{if(n=a.indexOf("=",i),n===-1)break;if(o=a.indexOf(";",i),o===-1)o=t;else if(n>o){i=a.lastIndexOf(";",n-1)+1;continue}var l=ax(a,i,n),c=sx(a,n,l),u=a.slice(l,c);if(!r.hasOwnProperty(u)){var p=ax(a,n+1,o),f=sx(a,o,p);a.charCodeAt(p)===34&&a.charCodeAt(f-1)===34&&(p++,f--);var d=a.slice(p,f);r[u]=g4(d,s)}i=o+1}while(ir;){var t=a.charCodeAt(--e);if(t!==32&&t!==9)return e+1}return r}function m4(a,e,r){var t=r&&r.encode||encodeURIComponent;if(typeof t!="function")throw new TypeError("option encode is invalid");if(!l4.test(a))throw new TypeError("argument name is invalid");var s=t(e);if(!u4.test(s))throw new TypeError("argument val is invalid");var i=a+"="+s;if(!r)return i;if(r.maxAge!=null){var n=Math.floor(r.maxAge);if(!isFinite(n))throw new TypeError("option maxAge is invalid");i+="; Max-Age="+n}if(r.domain){if(!p4.test(r.domain))throw new TypeError("option domain is invalid");i+="; Domain="+r.domain}if(r.path){if(!d4.test(r.path))throw new TypeError("option path is invalid");i+="; Path="+r.path}if(r.expires){var o=r.expires;if(!v4(o)||isNaN(o.valueOf()))throw new TypeError("option expires is invalid");i+="; Expires="+o.toUTCString()}if(r.httpOnly&&(i+="; HttpOnly"),r.secure&&(i+="; Secure"),r.partitioned&&(i+="; Partitioned"),r.priority){var l=typeof r.priority=="string"?r.priority.toLowerCase():r.priority;switch(l){case"low":i+="; Priority=Low";break;case"medium":i+="; Priority=Medium";break;case"high":i+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(r.sameSite){var c=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(c){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return i}function h4(a){return a.indexOf("%")!==-1?decodeURIComponent(a):a}function v4(a){return c4.call(a)==="[object Date]"}function g4(a,e){try{return e(a)}catch{return a}}});var Lp=q((nF,Mp)=>{"use strict";Mp.exports=b4;Mp.exports.append=ox;var y4=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function ox(a,e){if(typeof a!="string")throw new TypeError("header argument is required");if(!e)throw new TypeError("field argument is required");for(var r=Array.isArray(e)?e:ix(String(e)),t=0;t{"use strict";var Ii=Jo().Buffer,cx=vp(),x4=Ua(),Lt=Ir()("express"),_4=Vo(),E4=wi(),S4=require("http"),w4=Sa().isAbsolute,T4=li(),lx=require("path"),uc=ei(),ux=Ri(),R4=rx().sign,P4=Sa().normalizeType,O4=Sa().normalizeTypes,C4=Sa().setCharset,k4=nx(),qp=ac(),I4=lx.extname,px=qp.mime,A4=lx.resolve,N4=Lp(),ot=Object.create(S4.ServerResponse.prototype);mx.exports=ot;var D4=/;\s*charset\s*=/;ot.status=function(e){return(typeof e=="string"||Math.floor(e)!==e)&&e>99&&e<1e3&&Lt("res.status("+JSON.stringify(e)+"): use res.status("+Math.floor(e)+") instead"),this.statusCode=e,this};ot.links=function(a){var e=this.get("Link")||"";return e&&(e+=", "),this.set("Link",e+Object.keys(a).map(function(r){return"<"+a[r]+'>; rel="'+r+'"'}).join(", "))};ot.send=function(e){var r=e,t,s=this.req,i,n=this.app;switch(arguments.length===2&&(typeof arguments[0]!="number"&&typeof arguments[1]=="number"?(Lt("res.send(body, status): Use res.status(status).send(body) instead"),this.statusCode=arguments[1]):(Lt("res.send(status, body): Use res.status(status).send(body) instead"),this.statusCode=arguments[0],r=arguments[1])),typeof r=="number"&&arguments.length===1&&(this.get("Content-Type")||this.type("txt"),Lt("res.send(status): Use res.sendStatus(status) instead"),this.statusCode=r,r=uc.message[r]),typeof r){case"string":this.get("Content-Type")||this.type("html");break;case"boolean":case"number":case"object":if(r===null)r="";else if(Ii.isBuffer(r))this.get("Content-Type")||this.type("bin");else return this.json(r);break}typeof r=="string"&&(t="utf8",i=this.get("Content-Type"),typeof i=="string"&&this.set("Content-Type",C4(i,"utf-8")));var o=n.get("etag fn"),l=!this.get("ETag")&&typeof o=="function",c;r!==void 0&&(Ii.isBuffer(r)?c=r.length:!l&&r.length<1e3?c=Ii.byteLength(r,t):(r=Ii.from(r,t),t=void 0,c=r.length),this.set("Content-Length",c));var u;return l&&c!==void 0&&(u=o(r,t))&&this.set("ETag",u),s.fresh&&(this.statusCode=304),(this.statusCode===204||this.statusCode===304)&&(this.removeHeader("Content-Type"),this.removeHeader("Content-Length"),this.removeHeader("Transfer-Encoding"),r=""),this.statusCode===205&&(this.set("Content-Length","0"),this.removeHeader("Transfer-Encoding"),r=""),s.method==="HEAD"?this.end():this.end(r,t),this};ot.json=function(e){var r=e;arguments.length===2&&(typeof arguments[1]=="number"?(Lt("res.json(obj, status): Use res.status(status).json(obj) instead"),this.statusCode=arguments[1]):(Lt("res.json(status, obj): Use res.status(status).json(obj) instead"),this.statusCode=arguments[0],r=arguments[1]));var t=this.app,s=t.get("json escape"),i=t.get("json replacer"),n=t.get("json spaces"),o=fx(r,i,n,s);return this.get("Content-Type")||this.set("Content-Type","application/json"),this.send(o)};ot.jsonp=function(e){var r=e;arguments.length===2&&(typeof arguments[1]=="number"?(Lt("res.jsonp(obj, status): Use res.status(status).jsonp(obj) instead"),this.statusCode=arguments[1]):(Lt("res.jsonp(status, obj): Use res.status(status).jsonp(obj) instead"),this.statusCode=arguments[0],r=arguments[1]));var t=this.app,s=t.get("json escape"),i=t.get("json replacer"),n=t.get("json spaces"),o=fx(r,i,n,s),l=this.req.query[t.get("jsonp callback name")];return this.get("Content-Type")||(this.set("X-Content-Type-Options","nosniff"),this.set("Content-Type","application/json")),Array.isArray(l)&&(l=l[0]),typeof l=="string"&&l.length!==0&&(this.set("X-Content-Type-Options","nosniff"),this.set("Content-Type","text/javascript"),l=l.replace(/[^\[\]\w$.]/g,""),o===void 0?o="":typeof o=="string"&&(o=o.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")),o="/**/ typeof "+l+" === 'function' && "+l+"("+o+");"),this.send(o)};ot.sendStatus=function(e){var r=uc.message[e]||String(e);return this.statusCode=e,this.type("txt"),this.send(r)};ot.sendFile=function(e,r,t){var s=t,i=this.req,n=this,o=i.next,l=r||{};if(!e)throw new TypeError("path argument is required to res.sendFile");if(typeof e!="string")throw new TypeError("path must be a string to res.sendFile");if(typeof r=="function"&&(s=r,l={}),!l.root&&!w4(e))throw new TypeError("path must be absolute or specify root to res.sendFile");var c=encodeURI(e),u=qp(i,c,l);dx(n,u,l,function(p){if(s)return s(p);if(p&&p.code==="EISDIR")return o();p&&p.code!=="ECONNABORTED"&&p.syscall!=="write"&&o(p)})};ot.sendfile=function(a,e,r){var t=r,s=this.req,i=this,n=s.next,o=e||{};typeof e=="function"&&(t=e,o={});var l=qp(s,a,o);dx(i,l,o,function(c){if(t)return t(c);if(c&&c.code==="EISDIR")return n();c&&c.code!=="ECONNABORTED"&&c.syscall!=="write"&&n(c)})};ot.sendfile=Lt.function(ot.sendfile,"res.sendfile: Use res.sendFile instead");ot.download=function(e,r,t,s){var i=s,n=r,o=t||null;typeof r=="function"?(i=r,n=null,o=null):typeof t=="function"&&(i=t,o=null),typeof r=="object"&&(typeof t=="function"||t===void 0)&&(n=null,o=r);var l={"Content-Disposition":cx(n||e)};if(o&&o.headers)for(var c=Object.keys(o.headers),u=0;u0?e.accepts(t):!1;return this.vary("Accept"),s?(this.set("Content-Type",P4(s).value),a[s](e,this,r)):a.default?a.default(e,this,r):r(x4(406,{types:O4(t).map(function(i){return i.value})})),this};ot.attachment=function(e){return e&&this.type(I4(e)),this.set("Content-Disposition",cx(e)),this};ot.append=function(e,r){var t=this.get(e),s=r;return t&&(s=Array.isArray(t)?t.concat(r):Array.isArray(r)?[t].concat(r):[t,r]),this.set(e,s)};ot.set=ot.header=function(e,r){if(arguments.length===2){var t=Array.isArray(r)?r.map(String):String(r);if(e.toLowerCase()==="content-type"){if(Array.isArray(t))throw new TypeError("Content-Type cannot be set to an Array");if(!D4.test(t)){var s=px.charsets.lookup(t.split(";")[0]);s&&(t+="; charset="+s.toLowerCase())}}this.setHeader(e,t)}else for(var i in e)this.set(i,e[i]);return this};ot.get=function(a){return this.getHeader(a)};ot.clearCookie=function(e,r){r&&(r.maxAge&&Lt('res.clearCookie: Passing "options.maxAge" is deprecated. In v5.0.0 of Express, this option will be ignored, as res.clearCookie will automatically set cookies to expire immediately. Please update your code to omit this option.'),r.expires&&Lt('res.clearCookie: Passing "options.expires" is deprecated. In v5.0.0 of Express, this option will be ignored, as res.clearCookie will automatically set cookies to expire immediately. Please update your code to omit this option.'));var t=ux({expires:new Date(1),path:"/"},r);return this.cookie(e,"",t)};ot.cookie=function(a,e,r){var t=ux({},r),s=this.req.secret,i=t.signed;if(i&&!s)throw new Error('cookieParser("secret") required for signed cookies');var n=typeof e=="object"?"j:"+JSON.stringify(e):String(e);if(i&&(n="s:"+R4(n,s)),t.maxAge!=null){var o=t.maxAge-0;isNaN(o)||(t.expires=new Date(Date.now()+o),t.maxAge=Math.floor(o/1e3))}return t.path==null&&(t.path="/"),this.append("Set-Cookie",k4.serialize(a,String(n),t)),this};ot.location=function(e){var r;return e==="back"?(Lt('res.location("back"): use res.location(req.get("Referrer") || "/") and refer to https://dub.sh/security-redirect for best practices'),r=this.req.get("Referrer")||"/"):r=String(e),this.set("Location",_4(r))};ot.redirect=function(e){var r=e,t,s=302;arguments.length===2&&(typeof arguments[0]=="number"?(s=arguments[0],r=arguments[1]):(Lt("res.redirect(url, status): Use res.redirect(status, url) instead"),s=arguments[1])),r=this.location(r).get("Location"),this.format({text:function(){t=uc.message[s]+". Redirecting to "+r},html:function(){var i=E4(r);t="

"+uc.message[s]+". Redirecting to "+i+"

"},default:function(){t=""}}),this.statusCode=s,this.set("Content-Length",Ii.byteLength(t)),this.req.method==="HEAD"?this.end():this.end(t)};ot.vary=function(a){return!a||Array.isArray(a)&&!a.length?(Lt("res.vary(): Provide a field name"),this):(N4(this,a),this)};ot.render=function(e,r,t){var s=this.req.app,i=t,n=r||{},o=this.req,l=this;typeof r=="function"&&(i=r,n={}),n._locals=l.locals,i=i||function(c,u){if(c)return o.next(c);l.send(u)},s.render(e,n,i)};function dx(a,e,r,t){var s=!1,i;function n(){if(!s){s=!0;var d=new Error("Request aborted");d.code="ECONNABORTED",t(d)}}function o(){if(!s){s=!0;var d=new Error("EISDIR, read");d.code="EISDIR",t(d)}}function l(d){s||(s=!0,t(d))}function c(){s||(s=!0,t())}function u(){i=!1}function p(d){if(d&&d.code==="ECONNRESET")return n();if(d)return l(d);s||setImmediate(function(){if(i!==!1&&!s){n();return}s||(s=!0,t())})}function f(){i=!0}e.on("directory",o),e.on("end",c),e.on("error",l),e.on("file",u),e.on("stream",f),T4(a,p),r.headers&&e.on("headers",function(v){for(var h=r.headers,m=Object.keys(h),y=0;y&]/g,function(i){switch(i.charCodeAt(0)){case 60:return"\\u003c";case 62:return"\\u003e";case 38:return"\\u0026";default:return i}})),s}});var gx=q((oF,Up)=>{"use strict";var j4=Vo(),$4=wi(),Fp=on(),M4=require("path").resolve,vx=ac(),L4=require("url");Up.exports=q4;Up.exports.mime=vx.mime;function q4(a,e){if(!a)throw new TypeError("root path required");if(typeof a!="string")throw new TypeError("root path must be a string");var r=Object.create(e||null),t=r.fallthrough!==!1,s=r.redirect!==!1,i=r.setHeaders;if(i&&typeof i!="function")throw new TypeError("option setHeaders must be function");r.maxage=r.maxage||r.maxAge||0,r.root=M4(a);var n=s?B4():z4();return function(l,c,u){if(l.method!=="GET"&&l.method!=="HEAD"){if(t)return u();c.statusCode=405,c.setHeader("Allow","GET, HEAD"),c.setHeader("Content-Length","0"),c.end();return}var p=!t,f=Fp.original(l),d=Fp(l).pathname;d==="/"&&f.pathname.substr(-1)!=="/"&&(d="");var v=vx(l,d,r);v.on("directory",n),i&&v.on("headers",i),t&&v.on("file",function(){p=!0}),v.on("error",function(m){if(p||!(m.statusCode<500)){u(m);return}u()}),v.pipe(c)}}function F4(a){for(var e=0;e1?"/"+a.substr(e):a}function U4(a,e){return` +`}function DI(a,e){return e?e instanceof Error?xp(a,e,{expose:!1}):xp(a,e):xp(a)}function jI(a){try{return decodeURIComponent(a)}catch{return-1}}function $I(a){return typeof a.getHeaderNames!="function"?Object.keys(a._headers||{}):a.getHeaderNames()}function db(a,e){var r=typeof a.listenerCount!="function"?a.listeners(e).length:a.listenerCount(e);return r>0}function MI(a){return typeof a.headersSent!="boolean"?!!a._header:a.headersSent}function Sp(a,e){for(var r=[].concat(a||[]),t=0;t{"use strict";fb.exports=FI;function FI(a){if(!a)throw new TypeError("argument req is required");var e=zI(a.headers["x-forwarded-for"]||""),r=UI(a),t=[r].concat(e);return t}function UI(a){return a.socket?a.socket.remoteAddress:a.connection.remoteAddress}function zI(a){for(var e=a.length,r=[],t=a.length,s=a.length-1;s>=0;s--)switch(a.charCodeAt(s)){case 32:t===e&&(t=e=s);break;case 44:t!==e&&r.push(a.substring(t,e)),t=e=s;break;default:t=s;break}return t!==e&&r.push(a.substring(t,e)),r}});var vb=q((hb,Ci)=>{(function(){var a,e,r,t,s,i,n,o,l;e={},o=this,typeof Ci<"u"&&Ci!==null&&Ci.exports?Ci.exports=e:o.ipaddr=e,n=function(c,u,p,f){var d,v;if(c.length!==u.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");for(d=0;f>0;){if(v=p-f,v<0&&(v=0),c[d]>>v!==u[d]>>v)return!1;f-=p,d+=1}return!0},e.subnetMatch=function(c,u,p){var f,d,v,h,m;p==null&&(p="unicast");for(v in u)for(h=u[v],h[0]&&!(h[0]instanceof Array)&&(h=[h]),f=0,d=h.length;f=0;p=f+=-1)if(d=this.octets[p],d in m){if(h=m[d],v&&h!==0)return null;h!==8&&(v=!0),u+=h}else return null;return 32-u},c})(),r="(0?\\d+|0x[a-f0-9]+)",t={fourOctet:new RegExp("^"+r+"\\."+r+"\\."+r+"\\."+r+"$","i"),longValue:new RegExp("^"+r+"$","i")},e.IPv4.parser=function(c){var u,p,f,d,v;if(p=function(h){return h[0]==="0"&&h[1]!=="x"?parseInt(h,8):parseInt(h)},u=c.match(t.fourOctet))return(function(){var h,m,y,g;for(y=u.slice(1,6),g=[],h=0,m=y.length;h4294967295||v<0)throw new Error("ipaddr: address outside defined range");return(function(){var h,m;for(m=[],d=h=0;h<=24;d=h+=8)m.push(v>>d&255);return m})().reverse()}else return null},e.IPv6=(function(){function c(u,p){var f,d,v,h,m,y;if(u.length===16)for(this.parts=[],f=d=0;d<=14;f=d+=2)this.parts.push(u[f]<<8|u[f+1]);else if(u.length===8)this.parts=u;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(y=this.parts,v=0,h=y.length;vp&&(u=f.index,p=f[0].length);return p<0?v:v.substring(0,u)+"::"+v.substring(u+p)},c.prototype.toByteArray=function(){var u,p,f,d,v;for(u=[],v=this.parts,p=0,f=v.length;p>8),u.push(d&255);return u},c.prototype.toNormalizedString=function(){var u,p,f;return u=(function(){var d,v,h,m;for(h=this.parts,m=[],d=0,v=h.length;d>8,u&255,p>>8,p&255])},c.prototype.prefixLengthFromSubnetMask=function(){var u,p,f,d,v,h,m;for(m={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},u=0,v=!1,p=f=7;f>=0;p=f+=-1)if(d=this.parts[p],d in m){if(h=m[d],v&&h!==0)return null;h!==16&&(v=!0),u+=h}else return null;return 128-u},c})(),s="(?:[0-9a-f]+::?)+",l="%[0-9a-z]{1,}",i={zoneIndex:new RegExp(l,"i"),native:new RegExp("^(::)?("+s+")?([0-9a-f]+)?(::)?("+l+")?$","i"),transitional:new RegExp("^((?:"+s+")|(?:::)(?:"+s+")?)"+(r+"\\."+r+"\\."+r+"\\."+r)+("("+l+")?$"),"i")},a=function(c,u){var p,f,d,v,h,m;if(c.indexOf("::")!==c.lastIndexOf("::"))return null;for(m=(c.match(i.zoneIndex)||[])[0],m&&(m=m.substring(1),c=c.replace(/%.+$/,"")),p=0,f=-1;(f=c.indexOf(":",f+1))>=0;)p++;if(c.substr(0,2)==="::"&&p--,c.substr(-2,2)==="::"&&p--,p>u)return null;for(h=u-p,v=":";h--;)v+="0:";return c=c.replace("::",v),c[0]===":"&&(c=c.slice(1)),c[c.length-1]===":"&&(c=c.slice(0,-1)),u=(function(){var y,g,b,w;for(b=c.split(":"),w=[],y=0,g=b.length;y=0&&u<=32))return f=[this.parse(p[1]),u],Object.defineProperty(f,"toString",{value:function(){return this.join("/")}}),f;throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},e.IPv4.subnetMaskFromPrefixLength=function(c){var u,p,f;if(c=parseInt(c),c<0||c>32)throw new Error("ipaddr: invalid IPv4 prefix length");for(f=[0,0,0,0],p=0,u=Math.floor(c/8);p=0&&u<=128))return f=[this.parse(p[1]),u],Object.defineProperty(f,"toString",{value:function(){return this.join("/")}}),f;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},e.isValid=function(c){return e.IPv6.isValid(c)||e.IPv4.isValid(c)},e.parse=function(c){if(e.IPv6.isValid(c))return e.IPv6.parse(c);if(e.IPv4.isValid(c))return e.IPv4.parse(c);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},e.parseCIDR=function(c){var u;try{return e.IPv6.parseCIDR(c)}catch(p){u=p;try{return e.IPv4.parseCIDR(c)}catch(f){throw u=f,new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},e.fromByteArray=function(c){var u;if(u=c.length,u===4)return new e.IPv4(c);if(u===16)return new e.IPv6(c);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},e.process=function(c){var u;return u=this.parse(c),u.kind()==="ipv6"&&u.isIPv4MappedAddress()?u.toIPv4Address():u}}).call(hb)});var Rp=q((Zq,ic)=>{"use strict";ic.exports=KI;ic.exports.all=bb;ic.exports.compile=xb;var BI=mb(),yb=vb(),HI=/^[0-9]+$/,sc=yb.isValid,nc=yb.parse,gb={linklocal:["169.254.0.0/16","fe80::/10"],loopback:["127.0.0.1/8","::1/128"],uniquelocal:["10.0.0.0/8","172.16.0.0/12","192.168.0.0/16","fc00::/7"]};function bb(a,e){var r=BI(a);if(!e)return r;typeof e!="function"&&(e=xb(e));for(var t=0;ts)throw new TypeError("invalid range on address: "+a);return[t,i]}function ZI(a){var e=nc(a),r=e.kind();return r==="ipv4"?e.prefixLengthFromSubnetMask():null}function KI(a,e){if(!a)throw new TypeError("req argument is required");if(!e)throw new TypeError("trust argument is required");var r=bb(a,e),t=r[r.length-1];return t}function XI(){return!1}function QI(a){return function(r){if(!sc(r))return!1;for(var t=nc(r),s,i=t.kind(),n=0;n{"use strict";var _b=Jo().Buffer,YI=vp(),Eb=Jn(),Sb=Ir()("express"),eA=Ti(),tA=ac().mime,rA=gp(),aA=Rp(),sA=zo(),nA=require("querystring");It.etag=wb({weak:!1});It.wetag=wb({weak:!0});It.isAbsolute=function(a){if(a[0]==="/"||a[1]===":"&&(a[2]==="\\"||a[2]==="/")||a.substring(0,2)==="\\\\")return!0};It.flatten=Sb.function(eA,"utils.flatten: use array-flatten npm module instead");It.normalizeType=function(a){return~a.indexOf("/")?iA(a):{value:tA.lookup(a),params:{}}};It.normalizeTypes=function(a){for(var e=[],r=0;r{"use strict";var lA=ny(),uA=dp(),Op=Go(),pA=Iy(),dA=fp(),oc=ar()("express:application"),fA=My(),mA=require("http"),hA=Sa().compileETag,vA=Sa().compileQueryParser,gA=Sa().compileTrust,yA=Ir()("express"),bA=Ti(),Pp=Ri(),xA=require("path").resolve,hn=Yn(),_A=Object.prototype.hasOwnProperty,kp=Array.prototype.slice,vt=Tb=Rb.exports={},Cp="@@symbol:trust_proxy_default";vt.init=function(){this.cache={},this.engines={},this.settings={},this.defaultConfiguration()};vt.defaultConfiguration=function(){var e=process.env.NODE_ENV||"development";this.enable("x-powered-by"),this.set("etag","weak"),this.set("env",e),this.set("query parser","extended"),this.set("subdomain offset",2),this.set("trust proxy",!1),Object.defineProperty(this.settings,Cp,{configurable:!0,value:!0}),oc("booting in %s mode",e),this.on("mount",function(t){this.settings[Cp]===!0&&typeof t.settings["trust proxy fn"]=="function"&&(delete this.settings["trust proxy"],delete this.settings["trust proxy fn"]),hn(this.request,t.request),hn(this.response,t.response),hn(this.engines,t.engines),hn(this.settings,t.settings)}),this.locals=Object.create(null),this.mountpath="/",this.locals.settings=this.settings,this.set("view",fA),this.set("views",xA("views")),this.set("jsonp callback name","callback"),e==="production"&&this.enable("view cache"),Object.defineProperty(this,"router",{get:function(){throw new Error(`'app.router' is deprecated! +Please see the 3.x to 4.x migration guide for details on how to update your app.`)}})};vt.lazyrouter=function(){this._router||(this._router=new uA({caseSensitive:this.enabled("case sensitive routing"),strict:this.enabled("strict routing")}),this._router.use(dA(this.get("query parser fn"))),this._router.use(pA.init(this)))};vt.handle=function(e,r,t){var s=this._router,i=t||lA(e,r,{env:this.get("env"),onerror:EA.bind(this)});if(!s){oc("no routes defined on app"),i();return}s.handle(e,r,i)};vt.use=function(e){var r=0,t="/";if(typeof e!="function"){for(var s=e;Array.isArray(s)&&s.length!==0;)s=s[0];typeof s!="function"&&(r=1,t=e)}var i=bA(kp.call(arguments,r));if(i.length===0)throw new TypeError("app.use() requires a middleware function");this.lazyrouter();var n=this._router;return i.forEach(function(o){if(!o||!o.handle||!o.set)return n.use(t,o);oc(".use app under %s",t),o.mountpath=t,o.parent=this,n.use(t,function(c,u,p){var f=c.app;o.handle(c,u,function(d){hn(c,f.request),hn(u,f.response),p(d)})}),o.emit("mount",this)},this),this};vt.route=function(e){return this.lazyrouter(),this._router.route(e)};vt.engine=function(e,r){if(typeof r!="function")throw new Error("callback function required");var t=e[0]!=="."?"."+e:e;return this.engines[t]=r,this};vt.param=function(e,r){if(this.lazyrouter(),Array.isArray(e)){for(var t=0;t1?'directories "'+c.root.slice(0,-1).join('", "')+'" or "'+c.root[c.root.length-1]+'"':'directory "'+c.root+'"',f=new Error('Failed to lookup view "'+e+'" in views '+p);return f.view=c,i(f)}l.cache&&(s[e]=c)}SA(c,l,i)};vt.listen=function(){var e=mA.createServer(this);return e.listen.apply(e,arguments)};function EA(a){this.get("env")!=="test"&&console.error(a.stack||a.toString())}function SA(a,e,r){try{a.render(e,r)}catch(t){r(t)}}});var Ib=q((Xq,Ip)=>{"use strict";Ip.exports=kb;Ip.exports.preferredCharsets=kb;var wA=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function TA(a){for(var e=a.split(","),r=0,t=0;r0}});var $b=q((Qq,Ap)=>{"use strict";Ap.exports=jb;Ap.exports.preferredEncodings=jb;var kA=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function IA(a){for(var e=a.split(","),r=!1,t=1,s=0,i=0;s0}});var Ub=q((Jq,Np)=>{"use strict";Np.exports=Fb;Np.exports.preferredLanguages=Fb;var jA=/^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;function $A(a){for(var e=a.split(","),r=0,t=0;r0}});var Gb=q((Yq,Dp)=>{"use strict";Dp.exports=Vb;Dp.exports.preferredMediaTypes=Vb;var FA=/^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;function UA(a){for(var e=WA(a),r=0,t=0;r0)if(i.every(function(n){return e.params[n]=="*"||(e.params[n]||"").toLowerCase()==(t.params[n]||"").toLowerCase()}))s|=1;else return null;return{i:r,o:e.i,q:e.q,s}}function Vb(a,e){var r=UA(a===void 0?"*/*":a||"");if(!e)return r.filter(Bb).sort(zb).map(HA);var t=e.map(function(i,n){return zA(i,r,n)});return t.filter(Bb).sort(zb).map(function(i){return e[t.indexOf(i)]})}function zb(a,e){return e.q-a.q||e.s-a.s||a.o-e.o||a.i-e.i||0}function HA(a){return a.type+"/"+a.subtype}function Bb(a){return a.q>0}function Wb(a){for(var e=0,r=0;(r=a.indexOf('"',r))!==-1;)e++,r++;return e}function VA(a){var e=a.indexOf("="),r,t;return e===-1?r=a:(r=a.substr(0,e),t=a.substr(e+1)),[r,t]}function WA(a){for(var e=a.split(","),r=1,t=0;r{"use strict";var ZA=Ib(),KA=$b(),XA=Ub(),QA=Gb();jp.exports=st;jp.exports.Negotiator=st;function st(a){if(!(this instanceof st))return new st(a);this.request=a}st.prototype.charset=function(e){var r=this.charsets(e);return r&&r[0]};st.prototype.charsets=function(e){return ZA(this.request.headers["accept-charset"],e)};st.prototype.encoding=function(e){var r=this.encodings(e);return r&&r[0]};st.prototype.encodings=function(e){return KA(this.request.headers["accept-encoding"],e)};st.prototype.language=function(e){var r=this.languages(e);return r&&r[0]};st.prototype.languages=function(e){return XA(this.request.headers["accept-language"],e)};st.prototype.mediaType=function(e){var r=this.mediaTypes(e);return r&&r[0]};st.prototype.mediaTypes=function(e){return QA(this.request.headers.accept,e)};st.prototype.preferredCharset=st.prototype.charset;st.prototype.preferredCharsets=st.prototype.charsets;st.prototype.preferredEncoding=st.prototype.encoding;st.prototype.preferredEncodings=st.prototype.encodings;st.prototype.preferredLanguage=st.prototype.language;st.prototype.preferredLanguages=st.prototype.languages;st.prototype.preferredMediaType=st.prototype.mediaType;st.prototype.preferredMediaTypes=st.prototype.mediaTypes});var Xb=q((tF,Kb)=>{"use strict";var JA=Zb(),YA=Iu();Kb.exports=Qt;function Qt(a){if(!(this instanceof Qt))return new Qt(a);this.headers=a.headers,this.negotiator=new JA(a)}Qt.prototype.type=Qt.prototype.types=function(a){var e=a;if(e&&!Array.isArray(e)){e=new Array(arguments.length);for(var r=0;r{"use strict";var cc=Xb(),ki=Ir()("express"),r4=require("net").isIP,a4=Js(),s4=require("http"),n4=yp(),i4=bp(),o4=on(),Qb=Rp(),nt=Object.create(s4.IncomingMessage.prototype);Jb.exports=nt;nt.get=nt.header=function(e){if(!e)throw new TypeError("name argument is required to req.get");if(typeof e!="string")throw new TypeError("name must be a string to req.get");var r=e.toLowerCase();switch(r){case"referer":case"referrer":return this.headers.referrer||this.headers.referer;default:return this.headers[r]}};nt.accepts=function(){var a=cc(this);return a.types.apply(a,arguments)};nt.acceptsEncodings=function(){var a=cc(this);return a.encodings.apply(a,arguments)};nt.acceptsEncoding=ki.function(nt.acceptsEncodings,"req.acceptsEncoding: Use acceptsEncodings instead");nt.acceptsCharsets=function(){var a=cc(this);return a.charsets.apply(a,arguments)};nt.acceptsCharset=ki.function(nt.acceptsCharsets,"req.acceptsCharset: Use acceptsCharsets instead");nt.acceptsLanguages=function(){var a=cc(this);return a.languages.apply(a,arguments)};nt.acceptsLanguage=ki.function(nt.acceptsLanguages,"req.acceptsLanguage: Use acceptsLanguages instead");nt.range=function(e,r){var t=this.get("Range");if(t)return i4(e,t,r)};nt.param=function(e,r){var t=this.params||{},s=this.body||{},i=this.query||{},n=arguments.length===1?"name":"name, default";return ki("req.param("+n+"): Use req.params, req.body, or req.query instead"),t[e]!=null&&t.hasOwnProperty(e)?t[e]:s[e]!=null?s[e]:i[e]!=null?i[e]:r};nt.is=function(e){var r=e;if(!Array.isArray(e)){r=new Array(arguments.length);for(var t=0;t=200&&r<300||r===304?n4(this.headers,{etag:e.get("ETag"),"last-modified":e.get("Last-Modified")}):!1});Tr(nt,"stale",function(){return!this.fresh});Tr(nt,"xhr",function(){var e=this.get("X-Requested-With")||"";return e.toLowerCase()==="xmlhttprequest"});function Tr(a,e,r){Object.defineProperty(a,e,{configurable:!0,enumerable:!0,get:r})}});var rx=q(lc=>{var tx=require("crypto");lc.sign=function(a,e){if(typeof a!="string")throw new TypeError("Cookie value must be provided as a string.");if(typeof e!="string")throw new TypeError("Secret string must be provided.");return a+"."+tx.createHmac("sha256",e).update(a).digest("base64").replace(/\=+$/,"")};lc.unsign=function(a,e){if(typeof a!="string")throw new TypeError("Signed cookie string must be provided.");if(typeof e!="string")throw new TypeError("Secret string must be provided.");var r=a.slice(0,a.lastIndexOf(".")),t=lc.sign(r,e);return ex(t)==ex(a)?r:!1};function ex(a){return tx.createHash("sha1").update(a).digest("hex")}});var nx=q($p=>{"use strict";$p.parse=f4;$p.serialize=m4;var c4=Object.prototype.toString,l4=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,u4=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,p4=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,d4=/^[\u0020-\u003A\u003D-\u007E]*$/;function f4(a,e){if(typeof a!="string")throw new TypeError("argument str must be a string");var r={},t=a.length;if(t<2)return r;var s=e&&e.decode||h4,i=0,n=0,o=0;do{if(n=a.indexOf("=",i),n===-1)break;if(o=a.indexOf(";",i),o===-1)o=t;else if(n>o){i=a.lastIndexOf(";",n-1)+1;continue}var l=ax(a,i,n),c=sx(a,n,l),u=a.slice(l,c);if(!r.hasOwnProperty(u)){var p=ax(a,n+1,o),f=sx(a,o,p);a.charCodeAt(p)===34&&a.charCodeAt(f-1)===34&&(p++,f--);var d=a.slice(p,f);r[u]=g4(d,s)}i=o+1}while(ir;){var t=a.charCodeAt(--e);if(t!==32&&t!==9)return e+1}return r}function m4(a,e,r){var t=r&&r.encode||encodeURIComponent;if(typeof t!="function")throw new TypeError("option encode is invalid");if(!l4.test(a))throw new TypeError("argument name is invalid");var s=t(e);if(!u4.test(s))throw new TypeError("argument val is invalid");var i=a+"="+s;if(!r)return i;if(r.maxAge!=null){var n=Math.floor(r.maxAge);if(!isFinite(n))throw new TypeError("option maxAge is invalid");i+="; Max-Age="+n}if(r.domain){if(!p4.test(r.domain))throw new TypeError("option domain is invalid");i+="; Domain="+r.domain}if(r.path){if(!d4.test(r.path))throw new TypeError("option path is invalid");i+="; Path="+r.path}if(r.expires){var o=r.expires;if(!v4(o)||isNaN(o.valueOf()))throw new TypeError("option expires is invalid");i+="; Expires="+o.toUTCString()}if(r.httpOnly&&(i+="; HttpOnly"),r.secure&&(i+="; Secure"),r.partitioned&&(i+="; Partitioned"),r.priority){var l=typeof r.priority=="string"?r.priority.toLowerCase():r.priority;switch(l){case"low":i+="; Priority=Low";break;case"medium":i+="; Priority=Medium";break;case"high":i+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(r.sameSite){var c=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(c){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return i}function h4(a){return a.indexOf("%")!==-1?decodeURIComponent(a):a}function v4(a){return c4.call(a)==="[object Date]"}function g4(a,e){try{return e(a)}catch{return a}}});var Lp=q((nF,Mp)=>{"use strict";Mp.exports=b4;Mp.exports.append=ox;var y4=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function ox(a,e){if(typeof a!="string")throw new TypeError("header argument is required");if(!e)throw new TypeError("field argument is required");for(var r=Array.isArray(e)?e:ix(String(e)),t=0;t{"use strict";var Ii=Jo().Buffer,cx=vp(),x4=Ua(),Lt=Ir()("express"),_4=Vo(),E4=wi(),S4=require("http"),w4=Sa().isAbsolute,T4=li(),lx=require("path"),uc=ei(),ux=Ri(),R4=rx().sign,P4=Sa().normalizeType,O4=Sa().normalizeTypes,C4=Sa().setCharset,k4=nx(),qp=ac(),I4=lx.extname,px=qp.mime,A4=lx.resolve,N4=Lp(),ot=Object.create(S4.ServerResponse.prototype);mx.exports=ot;var D4=/;\s*charset\s*=/;ot.status=function(e){return(typeof e=="string"||Math.floor(e)!==e)&&e>99&&e<1e3&&Lt("res.status("+JSON.stringify(e)+"): use res.status("+Math.floor(e)+") instead"),this.statusCode=e,this};ot.links=function(a){var e=this.get("Link")||"";return e&&(e+=", "),this.set("Link",e+Object.keys(a).map(function(r){return"<"+a[r]+'>; rel="'+r+'"'}).join(", "))};ot.send=function(e){var r=e,t,s=this.req,i,n=this.app;switch(arguments.length===2&&(typeof arguments[0]!="number"&&typeof arguments[1]=="number"?(Lt("res.send(body, status): Use res.status(status).send(body) instead"),this.statusCode=arguments[1]):(Lt("res.send(status, body): Use res.status(status).send(body) instead"),this.statusCode=arguments[0],r=arguments[1])),typeof r=="number"&&arguments.length===1&&(this.get("Content-Type")||this.type("txt"),Lt("res.send(status): Use res.sendStatus(status) instead"),this.statusCode=r,r=uc.message[r]),typeof r){case"string":this.get("Content-Type")||this.type("html");break;case"boolean":case"number":case"object":if(r===null)r="";else if(Ii.isBuffer(r))this.get("Content-Type")||this.type("bin");else return this.json(r);break}typeof r=="string"&&(t="utf8",i=this.get("Content-Type"),typeof i=="string"&&this.set("Content-Type",C4(i,"utf-8")));var o=n.get("etag fn"),l=!this.get("ETag")&&typeof o=="function",c;r!==void 0&&(Ii.isBuffer(r)?c=r.length:!l&&r.length<1e3?c=Ii.byteLength(r,t):(r=Ii.from(r,t),t=void 0,c=r.length),this.set("Content-Length",c));var u;return l&&c!==void 0&&(u=o(r,t))&&this.set("ETag",u),s.fresh&&(this.statusCode=304),(this.statusCode===204||this.statusCode===304)&&(this.removeHeader("Content-Type"),this.removeHeader("Content-Length"),this.removeHeader("Transfer-Encoding"),r=""),this.statusCode===205&&(this.set("Content-Length","0"),this.removeHeader("Transfer-Encoding"),r=""),s.method==="HEAD"?this.end():this.end(r,t),this};ot.json=function(e){var r=e;arguments.length===2&&(typeof arguments[1]=="number"?(Lt("res.json(obj, status): Use res.status(status).json(obj) instead"),this.statusCode=arguments[1]):(Lt("res.json(status, obj): Use res.status(status).json(obj) instead"),this.statusCode=arguments[0],r=arguments[1]));var t=this.app,s=t.get("json escape"),i=t.get("json replacer"),n=t.get("json spaces"),o=fx(r,i,n,s);return this.get("Content-Type")||this.set("Content-Type","application/json"),this.send(o)};ot.jsonp=function(e){var r=e;arguments.length===2&&(typeof arguments[1]=="number"?(Lt("res.jsonp(obj, status): Use res.status(status).jsonp(obj) instead"),this.statusCode=arguments[1]):(Lt("res.jsonp(status, obj): Use res.status(status).jsonp(obj) instead"),this.statusCode=arguments[0],r=arguments[1]));var t=this.app,s=t.get("json escape"),i=t.get("json replacer"),n=t.get("json spaces"),o=fx(r,i,n,s),l=this.req.query[t.get("jsonp callback name")];return this.get("Content-Type")||(this.set("X-Content-Type-Options","nosniff"),this.set("Content-Type","application/json")),Array.isArray(l)&&(l=l[0]),typeof l=="string"&&l.length!==0&&(this.set("X-Content-Type-Options","nosniff"),this.set("Content-Type","text/javascript"),l=l.replace(/[^\[\]\w$.]/g,""),o===void 0?o="":typeof o=="string"&&(o=o.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")),o="/**/ typeof "+l+" === 'function' && "+l+"("+o+");"),this.send(o)};ot.sendStatus=function(e){var r=uc.message[e]||String(e);return this.statusCode=e,this.type("txt"),this.send(r)};ot.sendFile=function(e,r,t){var s=t,i=this.req,n=this,o=i.next,l=r||{};if(!e)throw new TypeError("path argument is required to res.sendFile");if(typeof e!="string")throw new TypeError("path must be a string to res.sendFile");if(typeof r=="function"&&(s=r,l={}),!l.root&&!w4(e))throw new TypeError("path must be absolute or specify root to res.sendFile");var c=encodeURI(e),u=qp(i,c,l);dx(n,u,l,function(p){if(s)return s(p);if(p&&p.code==="EISDIR")return o();p&&p.code!=="ECONNABORTED"&&p.syscall!=="write"&&o(p)})};ot.sendfile=function(a,e,r){var t=r,s=this.req,i=this,n=s.next,o=e||{};typeof e=="function"&&(t=e,o={});var l=qp(s,a,o);dx(i,l,o,function(c){if(t)return t(c);if(c&&c.code==="EISDIR")return n();c&&c.code!=="ECONNABORTED"&&c.syscall!=="write"&&n(c)})};ot.sendfile=Lt.function(ot.sendfile,"res.sendfile: Use res.sendFile instead");ot.download=function(e,r,t,s){var i=s,n=r,o=t||null;typeof r=="function"?(i=r,n=null,o=null):typeof t=="function"&&(i=t,o=null),typeof r=="object"&&(typeof t=="function"||t===void 0)&&(n=null,o=r);var l={"Content-Disposition":cx(n||e)};if(o&&o.headers)for(var c=Object.keys(o.headers),u=0;u0?e.accepts(t):!1;return this.vary("Accept"),s?(this.set("Content-Type",P4(s).value),a[s](e,this,r)):a.default?a.default(e,this,r):r(x4(406,{types:O4(t).map(function(i){return i.value})})),this};ot.attachment=function(e){return e&&this.type(I4(e)),this.set("Content-Disposition",cx(e)),this};ot.append=function(e,r){var t=this.get(e),s=r;return t&&(s=Array.isArray(t)?t.concat(r):Array.isArray(r)?[t].concat(r):[t,r]),this.set(e,s)};ot.set=ot.header=function(e,r){if(arguments.length===2){var t=Array.isArray(r)?r.map(String):String(r);if(e.toLowerCase()==="content-type"){if(Array.isArray(t))throw new TypeError("Content-Type cannot be set to an Array");if(!D4.test(t)){var s=px.charsets.lookup(t.split(";")[0]);s&&(t+="; charset="+s.toLowerCase())}}this.setHeader(e,t)}else for(var i in e)this.set(i,e[i]);return this};ot.get=function(a){return this.getHeader(a)};ot.clearCookie=function(e,r){r&&(r.maxAge&&Lt('res.clearCookie: Passing "options.maxAge" is deprecated. In v5.0.0 of Express, this option will be ignored, as res.clearCookie will automatically set cookies to expire immediately. Please update your code to omit this option.'),r.expires&&Lt('res.clearCookie: Passing "options.expires" is deprecated. In v5.0.0 of Express, this option will be ignored, as res.clearCookie will automatically set cookies to expire immediately. Please update your code to omit this option.'));var t=ux({expires:new Date(1),path:"/"},r);return this.cookie(e,"",t)};ot.cookie=function(a,e,r){var t=ux({},r),s=this.req.secret,i=t.signed;if(i&&!s)throw new Error('cookieParser("secret") required for signed cookies');var n=typeof e=="object"?"j:"+JSON.stringify(e):String(e);if(i&&(n="s:"+R4(n,s)),t.maxAge!=null){var o=t.maxAge-0;isNaN(o)||(t.expires=new Date(Date.now()+o),t.maxAge=Math.floor(o/1e3))}return t.path==null&&(t.path="/"),this.append("Set-Cookie",k4.serialize(a,String(n),t)),this};ot.location=function(e){var r;return e==="back"?(Lt('res.location("back"): use res.location(req.get("Referrer") || "/") and refer to https://dub.sh/security-redirect for best practices'),r=this.req.get("Referrer")||"/"):r=String(e),this.set("Location",_4(r))};ot.redirect=function(e){var r=e,t,s=302;arguments.length===2&&(typeof arguments[0]=="number"?(s=arguments[0],r=arguments[1]):(Lt("res.redirect(url, status): Use res.redirect(status, url) instead"),s=arguments[1])),r=this.location(r).get("Location"),this.format({text:function(){t=uc.message[s]+". Redirecting to "+r},html:function(){var i=E4(r);t="

"+uc.message[s]+". Redirecting to "+i+"

"},default:function(){t=""}}),this.statusCode=s,this.set("Content-Length",Ii.byteLength(t)),this.req.method==="HEAD"?this.end():this.end(t)};ot.vary=function(a){return!a||Array.isArray(a)&&!a.length?(Lt("res.vary(): Provide a field name"),this):(N4(this,a),this)};ot.render=function(e,r,t){var s=this.req.app,i=t,n=r||{},o=this.req,l=this;typeof r=="function"&&(i=r,n={}),n._locals=l.locals,i=i||function(c,u){if(c)return o.next(c);l.send(u)},s.render(e,n,i)};function dx(a,e,r,t){var s=!1,i;function n(){if(!s){s=!0;var d=new Error("Request aborted");d.code="ECONNABORTED",t(d)}}function o(){if(!s){s=!0;var d=new Error("EISDIR, read");d.code="EISDIR",t(d)}}function l(d){s||(s=!0,t(d))}function c(){s||(s=!0,t())}function u(){i=!1}function p(d){if(d&&d.code==="ECONNRESET")return n();if(d)return l(d);s||setImmediate(function(){if(i!==!1&&!s){n();return}s||(s=!0,t())})}function f(){i=!0}e.on("directory",o),e.on("end",c),e.on("error",l),e.on("file",u),e.on("stream",f),T4(a,p),r.headers&&e.on("headers",function(v){for(var h=r.headers,m=Object.keys(h),y=0;y&]/g,function(i){switch(i.charCodeAt(0)){case 60:return"\\u003c";case 62:return"\\u003e";case 38:return"\\u0026";default:return i}})),s}});var gx=q((oF,Up)=>{"use strict";var j4=Vo(),$4=wi(),Fp=on(),M4=require("path").resolve,vx=ac(),L4=require("url");Up.exports=q4;Up.exports.mime=vx.mime;function q4(a,e){if(!a)throw new TypeError("root path required");if(typeof a!="string")throw new TypeError("root path must be a string");var r=Object.create(e||null),t=r.fallthrough!==!1,s=r.redirect!==!1,i=r.setHeaders;if(i&&typeof i!="function")throw new TypeError("option setHeaders must be function");r.maxage=r.maxage||r.maxAge||0,r.root=M4(a);var n=s?B4():z4();return function(l,c,u){if(l.method!=="GET"&&l.method!=="HEAD"){if(t)return u();c.statusCode=405,c.setHeader("Allow","GET, HEAD"),c.setHeader("Content-Length","0"),c.end();return}var p=!t,f=Fp.original(l),d=Fp(l).pathname;d==="/"&&f.pathname.substr(-1)!=="/"&&(d="");var v=vx(l,d,r);v.on("directory",n),i&&v.on("headers",i),t&&v.on("file",function(){p=!0}),v.on("error",function(m){if(p||!(m.statusCode<500)){u(m);return}u()}),v.pipe(c)}}function F4(a){for(var e=0;e1?"/"+a.substr(e):a}function U4(a,e){return` @@ -51,7 +51,7 @@ Please see the 3.x to 4.x migration guide for details on how to update your app. `}function z4(){return function(){this.error(404)}}function B4(){return function(e){if(this.hasTrailingSlash()){this.error(404);return}var r=Fp.original(this.req);r.path=null,r.pathname=F4(r.pathname+"/");var t=j4(L4.format(r)),s=U4("Redirecting","Redirecting to "+$4(t));e.statusCode=301,e.setHeader("Content-Type","text/html; charset=UTF-8"),e.setHeader("Content-Length",Buffer.byteLength(s)),e.setHeader("Content-Security-Policy","default-src 'none'"),e.setHeader("X-Content-Type-Options","nosniff"),e.setHeader("Location",t),e.end(s)}}});var Sx=q((qt,Ex)=>{"use strict";var pc=Vg(),H4=require("events").EventEmitter,yx=Gg(),bx=Pb(),V4=up(),W4=dp(),xx=Yb(),_x=hx();qt=Ex.exports=G4;function G4(){var a=function(e,r,t){a.handle(e,r,t)};return yx(a,H4.prototype,!1),yx(a,bx,!1),a.request=Object.create(xx,{app:{configurable:!0,enumerable:!0,writable:!0,value:a}}),a.response=Object.create(_x,{app:{configurable:!0,enumerable:!0,writable:!0,value:a}}),a.init(),a}qt.application=bx;qt.request=xx;qt.response=_x;qt.Route=V4;qt.Router=W4;qt.json=pc.json;qt.query=fp();qt.raw=pc.raw;qt.static=gx();qt.text=pc.text;qt.urlencoded=pc.urlencoded;var Z4=["bodyParser","compress","cookieSession","session","logger","cookieParser","favicon","responseTime","errorHandler","timeout","methodOverride","vhost","csrf","directory","limit","multipart","staticCache"];Z4.forEach(function(a){Object.defineProperty(qt,a,{get:function(){throw new Error("Most middleware (like "+a+") is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.")},configurable:!0})})});var zp=q((cF,wx)=>{"use strict";wx.exports=Sx()});var r0=q((Rc,t0)=>{(function(a,e){typeof Rc=="object"&&typeof t0<"u"?e(Rc):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Rc,(function(a){"use strict";function e(){for(var M=arguments.length,I=Array(M),_=0;_1){I[0]=I[0].slice(0,-1);for(var x=I.length-1,R=1;R= 0x80 (not a basic code point)","invalid-input":"Invalid input"},A=d-v,$=Math.floor,N=String.fromCharCode;function C(M){throw new RangeError(D[M])}function O(M,I){for(var _=[],x=M.length;x--;)_[x]=I(M[x]);return _}function j(M,I){var _=M.split("@"),x="";_.length>1&&(x=_[0]+"@",M=_[1]),M=M.replace(k,".");var R=M.split("."),L=O(R,I).join(".");return x+L}function F(M){for(var I=[],_=0,x=M.length;_=55296&&R<=56319&&_>1,I+=$(I/_);I>A*h>>1;R+=d)I=$(I/A);return $(R+(A+1)*I/(I+m))},W=function(I){var _=[],x=I.length,R=0,L=b,z=g,J=I.lastIndexOf(w);J<0&&(J=0);for(var le=0;le=128&&C("not-basic"),_.push(I.charCodeAt(le));for(var _e=J>0?J+1:0;_e=x&&C("invalid-input");var ke=V(I.charCodeAt(_e++));(ke>=d||ke>$((f-R)/je))&&C("overflow"),R+=ke*je;var we=xe<=z?v:xe>=z+h?h:xe-z;if(ke$(f/Ie)&&C("overflow"),je*=Ie}var ve=_.length+1;z=K(R-me,ve,me==0),$(R/ve)>f-L&&C("overflow"),L+=$(R/ve),R%=ve,_.splice(R++,0,L)}return String.fromCodePoint.apply(String,_)},ae=function(I){var _=[];I=F(I);var x=I.length,R=b,L=0,z=g,J=!0,le=!1,_e=void 0;try{for(var me=I[Symbol.iterator](),je;!(J=(je=me.next()).done);J=!0){var xe=je.value;xe<128&&_.push(N(xe))}}catch(jt){le=!0,_e=jt}finally{try{!J&&me.return&&me.return()}finally{if(le)throw _e}}var ke=_.length,we=ke;for(ke&&_.push(w);we=R&&it$((f-L)/Be)&&C("overflow"),L+=(Ie-R)*Be,R=Ie;var ct=!0,mt=!1,ht=void 0;try{for(var Wt=I[Symbol.iterator](),Dt;!(ct=(Dt=Wt.next()).done);ct=!0){var Cr=Dt.value;if(Crf&&C("overflow"),Cr==R){for(var br=L,xr=d;;xr+=d){var Pt=xr<=z?v:xr>=z+h?h:xr-z;if(br>6|192).toString(16).toUpperCase()+"%"+(I&63|128).toString(16).toUpperCase():_="%"+(I>>12|224).toString(16).toUpperCase()+"%"+(I>>6&63|128).toString(16).toUpperCase()+"%"+(I&63|128).toString(16).toUpperCase(),_}function Te(M){for(var I="",_=0,x=M.length;_=194&&R<224){if(x-_>=6){var L=parseInt(M.substr(_+4,2),16);I+=String.fromCharCode((R&31)<<6|L&63)}else I+=M.substr(_,6);_+=6}else if(R>=224){if(x-_>=9){var z=parseInt(M.substr(_+4,2),16),J=parseInt(M.substr(_+7,2),16);I+=String.fromCharCode((R&15)<<12|(z&63)<<6|J&63)}else I+=M.substr(_,9);_+=9}else I+=M.substr(_,3),_+=3}return I}function U(M,I){function _(x){var R=Te(x);return R.match(I.UNRESERVED)?R:x}return M.scheme&&(M.scheme=String(M.scheme).replace(I.PCT_ENCODED,_).toLowerCase().replace(I.NOT_SCHEME,"")),M.userinfo!==void 0&&(M.userinfo=String(M.userinfo).replace(I.PCT_ENCODED,_).replace(I.NOT_USERINFO,be).replace(I.PCT_ENCODED,s)),M.host!==void 0&&(M.host=String(M.host).replace(I.PCT_ENCODED,_).toLowerCase().replace(I.NOT_HOST,be).replace(I.PCT_ENCODED,s)),M.path!==void 0&&(M.path=String(M.path).replace(I.PCT_ENCODED,_).replace(M.scheme?I.NOT_PATH:I.NOT_PATH_NOSCHEME,be).replace(I.PCT_ENCODED,s)),M.query!==void 0&&(M.query=String(M.query).replace(I.PCT_ENCODED,_).replace(I.NOT_QUERY,be).replace(I.PCT_ENCODED,s)),M.fragment!==void 0&&(M.fragment=String(M.fragment).replace(I.PCT_ENCODED,_).replace(I.NOT_FRAGMENT,be).replace(I.PCT_ENCODED,s)),M}function G(M){return M.replace(/^0*(.*)/,"$1")||"0"}function re(M,I){var _=M.match(I.IPV4ADDRESS)||[],x=u(_,2),R=x[1];return R?R.split(".").map(G).join("."):M}function pe(M,I){var _=M.match(I.IPV6ADDRESS)||[],x=u(_,3),R=x[1],L=x[2];if(R){for(var z=R.toLowerCase().split("::").reverse(),J=u(z,2),le=J[0],_e=J[1],me=_e?_e.split(":").map(G):[],je=le.split(":").map(G),xe=I.IPV4ADDRESS.test(je[je.length-1]),ke=xe?7:8,we=je.length-ke,Ie=Array(ke),ve=0;ve1){var ze=Ie.slice(0,qe.index),it=Ie.slice(qe.index+qe.length);ft=ze.join(":")+"::"+it.join(":")}else ft=Ie.join(":");return L&&(ft+="%"+L),ft}else return M}var Z=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,X="".match(/(){0}/)[1]===void 0;function ce(M){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_={},x=I.iri!==!1?c:l;I.reference==="suffix"&&(M=(I.scheme?I.scheme+":":"")+"//"+M);var R=M.match(Z);if(R){X?(_.scheme=R[1],_.userinfo=R[3],_.host=R[4],_.port=parseInt(R[5],10),_.path=R[6]||"",_.query=R[7],_.fragment=R[8],isNaN(_.port)&&(_.port=R[5])):(_.scheme=R[1]||void 0,_.userinfo=M.indexOf("@")!==-1?R[3]:void 0,_.host=M.indexOf("//")!==-1?R[4]:void 0,_.port=parseInt(R[5],10),_.path=R[6]||"",_.query=M.indexOf("?")!==-1?R[7]:void 0,_.fragment=M.indexOf("#")!==-1?R[8]:void 0,isNaN(_.port)&&(_.port=M.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?R[4]:void 0)),_.host&&(_.host=pe(re(_.host,x),x)),_.scheme===void 0&&_.userinfo===void 0&&_.host===void 0&&_.port===void 0&&!_.path&&_.query===void 0?_.reference="same-document":_.scheme===void 0?_.reference="relative":_.fragment===void 0?_.reference="absolute":_.reference="uri",I.reference&&I.reference!=="suffix"&&I.reference!==_.reference&&(_.error=_.error||"URI is not a "+I.reference+" reference.");var L=Ee[(I.scheme||_.scheme||"").toLowerCase()];if(!I.unicodeSupport&&(!L||!L.unicodeSupport)){if(_.host&&(I.domainHost||L&&L.domainHost))try{_.host=he.toASCII(_.host.replace(x.PCT_ENCODED,Te).toLowerCase())}catch(z){_.error=_.error||"Host's domain name can not be converted to ASCII via punycode: "+z}U(_,l)}else U(_,x);L&&L.parse&&L.parse(_,I)}else _.error=_.error||"URI can not be parsed.";return _}function De(M,I){var _=I.iri!==!1?c:l,x=[];return M.userinfo!==void 0&&(x.push(M.userinfo),x.push("@")),M.host!==void 0&&x.push(pe(re(String(M.host),_),_).replace(_.IPV6ADDRESS,function(R,L,z){return"["+L+(z?"%25"+z:"")+"]"})),(typeof M.port=="number"||typeof M.port=="string")&&(x.push(":"),x.push(String(M.port))),x.length?x.join(""):void 0}var fe=/^\.\.?\//,$e=/^\/\.(\/|$)/,Ve=/^\/\.\.(\/|$)/,Se=/^\/?(?:.|\n)*?(?=\/|$)/;function tt(M){for(var I=[];M.length;)if(M.match(fe))M=M.replace(fe,"");else if(M.match($e))M=M.replace($e,"/");else if(M.match(Ve))M=M.replace(Ve,"/"),I.pop();else if(M==="."||M==="..")M="";else{var _=M.match(Se);if(_){var x=_[0];M=M.slice(x.length),I.push(x)}else throw new Error("Unexpected dot segment condition")}return I.join("")}function We(M){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_=I.iri?c:l,x=[],R=Ee[(I.scheme||M.scheme||"").toLowerCase()];if(R&&R.serialize&&R.serialize(M,I),M.host&&!_.IPV6ADDRESS.test(M.host)){if(I.domainHost||R&&R.domainHost)try{M.host=I.iri?he.toUnicode(M.host):he.toASCII(M.host.replace(_.PCT_ENCODED,Te).toLowerCase())}catch(J){M.error=M.error||"Host's domain name can not be converted to "+(I.iri?"Unicode":"ASCII")+" via punycode: "+J}}U(M,_),I.reference!=="suffix"&&M.scheme&&(x.push(M.scheme),x.push(":"));var L=De(M,I);if(L!==void 0&&(I.reference!=="suffix"&&x.push("//"),x.push(L),M.path&&M.path.charAt(0)!=="/"&&x.push("/")),M.path!==void 0){var z=M.path;!I.absolutePath&&(!R||!R.absolutePath)&&(z=tt(z)),L===void 0&&(z=z.replace(/^\/\//,"/%2F")),x.push(z)}return M.query!==void 0&&(x.push("?"),x.push(M.query)),M.fragment!==void 0&&(x.push("#"),x.push(M.fragment)),x.join("")}function Je(M,I){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x=arguments[3],R={};return x||(M=ce(We(M,_),_),I=ce(We(I,_),_)),_=_||{},!_.tolerant&&I.scheme?(R.scheme=I.scheme,R.userinfo=I.userinfo,R.host=I.host,R.port=I.port,R.path=tt(I.path||""),R.query=I.query):(I.userinfo!==void 0||I.host!==void 0||I.port!==void 0?(R.userinfo=I.userinfo,R.host=I.host,R.port=I.port,R.path=tt(I.path||""),R.query=I.query):(I.path?(I.path.charAt(0)==="/"?R.path=tt(I.path):((M.userinfo!==void 0||M.host!==void 0||M.port!==void 0)&&!M.path?R.path="/"+I.path:M.path?R.path=M.path.slice(0,M.path.lastIndexOf("/")+1)+I.path:R.path=I.path,R.path=tt(R.path)),R.query=I.query):(R.path=M.path,I.query!==void 0?R.query=I.query:R.query=M.query),R.userinfo=M.userinfo,R.host=M.host,R.port=M.port),R.scheme=M.scheme),R.fragment=I.fragment,R}function Ke(M,I,_){var x=n({scheme:"null"},_);return We(Je(ce(M,x),ce(I,x),x,!0),x)}function Qe(M,I){return typeof M=="string"?M=We(ce(M,I),I):t(M)==="object"&&(M=ce(We(M,I),I)),M}function Et(M,I,_){return typeof M=="string"?M=We(ce(M,_),_):t(M)==="object"&&(M=We(M,_)),typeof I=="string"?I=We(ce(I,_),_):t(I)==="object"&&(I=We(I,_)),M===I}function St(M,I){return M&&M.toString().replace(!I||!I.iri?l.ESCAPE:c.ESCAPE,be)}function Rt(M,I){return M&&M.toString().replace(!I||!I.iri?l.PCT_ENCODED:c.PCT_ENCODED,Te)}var Gr={scheme:"http",domainHost:!0,parse:function(I,_){return I.host||(I.error=I.error||"HTTP URIs must have a host."),I},serialize:function(I,_){var x=String(I.scheme).toLowerCase()==="https";return(I.port===(x?443:80)||I.port==="")&&(I.port=void 0),I.path||(I.path="/"),I}},Nt={scheme:"https",domainHost:Gr.domainHost,parse:Gr.parse,serialize:Gr.serialize};function la(M){return typeof M.secure=="boolean"?M.secure:String(M.scheme).toLowerCase()==="wss"}var ua={scheme:"ws",domainHost:!0,parse:function(I,_){var x=I;return x.secure=la(x),x.resourceName=(x.path||"/")+(x.query?"?"+x.query:""),x.path=void 0,x.query=void 0,x},serialize:function(I,_){if((I.port===(la(I)?443:80)||I.port==="")&&(I.port=void 0),typeof I.secure=="boolean"&&(I.scheme=I.secure?"wss":"ws",I.secure=void 0),I.resourceName){var x=I.resourceName.split("?"),R=u(x,2),L=R[0],z=R[1];I.path=L&&L!=="/"?L:void 0,I.query=z,I.resourceName=void 0}return I.fragment=void 0,I}},Vn={scheme:"wss",domainHost:ua.domainHost,parse:ua.parse,serialize:ua.serialize},Ma={},Ji=!0,Yi="[A-Za-z0-9\\-\\.\\_\\~"+(Ji?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",er="[0-9A-Fa-f]",eo=r(r("%[EFef]"+er+"%"+er+er+"%"+er+er)+"|"+r("%[89A-Fa-f]"+er+"%"+er+er)+"|"+r("%"+er+er)),tr="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Al="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Nl=e(Al,'[\\"\\\\]'),Dl="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",jl=new RegExp(Yi,"g"),pa=new RegExp(eo,"g"),$l=new RegExp(e("[^]",tr,"[\\.]",'[\\"]',Nl),"g"),Zr=new RegExp(e("[^]",Yi,Dl),"g"),Ml=Zr;function Fs(M){var I=Te(M);return I.match(jl)?I:M}var to={scheme:"mailto",parse:function(I,_){var x=I,R=x.to=x.path?x.path.split(","):[];if(x.path=void 0,x.query){for(var L=!1,z={},J=x.query.split("&"),le=0,_e=J.length;le<_e;++le){var me=J[le].split("=");switch(me[0]){case"to":for(var je=me[1].split(","),xe=0,ke=je.length;xe{"use strict";a0.exports=function a(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var t,s,i;if(Array.isArray(e)){if(t=e.length,t!=r.length)return!1;for(s=t;s--!==0;)if(!a(e[s],r[s]))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(i=Object.keys(e),t=i.length,t!==Object.keys(r).length)return!1;for(s=t;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=t;s--!==0;){var n=i[s];if(!a(e[n],r[n]))return!1}return!0}return e!==e&&r!==r}});var n0=q((GF,s0)=>{"use strict";s0.exports=function(e){for(var r=0,t=e.length,s=0,i;s=55296&&i<=56319&&s{"use strict";c0.exports={copy:tD,checkDataType:id,checkDataTypes:rD,coerceToTypes:aD,toHash:cd,getProperty:ld,escapeQuotes:ud,equal:Pc(),ucs2length:n0(),varOccurences:iD,varReplace:oD,schemaHasRules:cD,schemaHasRulesExcept:lD,schemaUnknownRules:uD,toQuotedString:od,getPathExpr:pD,getPath:dD,getData:hD,unescapeFragment:vD,unescapeJsonPointer:dd,escapeFragment:gD,escapeJsonPointer:pd};function tD(a,e){e=e||{};for(var r in a)e[r]=a[r];return e}function id(a,e,r,t){var s=t?" !== ":" === ",i=t?" || ":" && ",n=t?"!":"",o=t?"":"!";switch(a){case"null":return e+s+"null";case"array":return n+"Array.isArray("+e+")";case"object":return"("+n+e+i+"typeof "+e+s+'"object"'+i+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+s+'"number"'+i+o+"("+e+" % 1)"+i+e+s+e+(r?i+n+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+s+'"'+a+'"'+(r?i+n+"isFinite("+e+")":"")+")";default:return"typeof "+e+s+'"'+a+'"'}}function rD(a,e,r){switch(a.length){case 1:return id(a[0],e,r,!0);default:var t="",s=cd(a);s.array&&s.object&&(t=s.null?"(":"(!"+e+" || ",t+="typeof "+e+' !== "object")',delete s.null,delete s.array,delete s.object),s.number&&delete s.integer;for(var i in s)t+=(t?" && ":"")+id(i,e,r,!0);return t}}var i0=cd(["string","number","integer","boolean","null"]);function aD(a,e){if(Array.isArray(e)){for(var r=[],t=0;t=e)throw new Error("Cannot access property/index "+t+" levels up, current level is "+e);return r[e-t]}if(t>e)throw new Error("Cannot access data "+t+" levels up, current level is "+e);if(i="data"+(e-t||""),!s)return i}for(var o=i,l=s.split("/"),c=0;c{"use strict";var yD=ys();l0.exports=bD;function bD(a){yD.copy(a,this)}});var p0=q((XF,u0)=>{"use strict";var Oa=u0.exports=function(a,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var t=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};Oc(e,t,s,a,"",a)};Oa.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Oa.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Oa.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Oa.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 Oc(a,e,r,t,s,i,n,o,l,c){if(t&&typeof t=="object"&&!Array.isArray(t)){e(t,s,i,n,o,l,c);for(var u in t){var p=t[u];if(Array.isArray(p)){if(u in Oa.arrayKeywords)for(var f=0;f{"use strict";var Li=r0(),d0=Pc(),Ac=ys(),Cc=fd(),_D=p0();h0.exports=ka;ka.normalizeId=Ca;ka.fullPath=kc;ka.url=Ic;ka.ids=RD;ka.inlineRef=md;ka.schema=Nc;function ka(a,e,r){var t=this._refs[r];if(typeof t=="string")if(this._refs[t])t=this._refs[t];else return ka.call(this,a,e,t);if(t=t||this._schemas[r],t instanceof Cc)return md(t.schema,this._opts.inlineRefs)?t.schema:t.validate||this._compile(t);var s=Nc.call(this,e,r),i,n,o;return s&&(i=s.schema,e=s.root,o=s.baseId),i instanceof Cc?n=i.validate||a.call(this,i.schema,e,void 0,o):i!==void 0&&(n=md(i,this._opts.inlineRefs)?i:a.call(this,i,e,void 0,o)),n}function Nc(a,e){var r=Li.parse(e),t=m0(r),s=kc(this._getId(a.schema));if(Object.keys(a.schema).length===0||t!==s){var i=Ca(t),n=this._refs[i];if(typeof n=="string")return ED.call(this,a,n,r);if(n instanceof Cc)n.validate||this._compile(n),a=n;else if(n=this._schemas[i],n instanceof Cc){if(n.validate||this._compile(n),i==Ca(e))return{schema:n,root:a,baseId:s};a=n}else return;if(!a.schema)return;s=kc(this._getId(a.schema))}return f0.call(this,r,s,a.schema,a)}function ED(a,e,r){var t=Nc.call(this,a,e);if(t){var s=t.schema,i=t.baseId;a=t.root;var n=this._getId(s);return n&&(i=Ic(i,n)),f0.call(this,r,i,s,a)}}var SD=Ac.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function f0(a,e,r,t){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var s=a.fragment.split("/"),i=1;i{"use strict";var gd=Dc();g0.exports={Validation:v0(PD),MissingRef:v0(yd)};function PD(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}yd.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function yd(a,e,r){this.message=r||yd.message(a,e),this.missingRef=gd.url(a,e),this.missingSchema=gd.normalizeId(gd.fullPath(this.missingRef))}function v0(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var bd=q((YF,y0)=>{"use strict";y0.exports=function(a,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,t=e.cmp&&(function(i){return function(n){return function(o,l){var c={key:o,value:n[o]},u={key:l,value:n[l]};return i(c,u)}}})(e.cmp),s=[];return(function i(n){if(n&&n.toJSON&&typeof n.toJSON=="function"&&(n=n.toJSON()),n!==void 0){if(typeof n=="number")return isFinite(n)?""+n:"null";if(typeof n!="object")return JSON.stringify(n);var o,l;if(Array.isArray(n)){for(l="[",o=0;o{"use strict";b0.exports=function(e,r,t){var s="",i=e.schema.$async===!0,n=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var c="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(s+=" var validate = ",i&&(e.async=!0,s+="async "),s+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(s+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(n||e.schema.$ref)){var r="false schema",u=e.level,p=e.dataLevel,f=e.schema[r],d=e.schemaPath+e.util.getProperty(r),v=e.errSchemaPath+"/"+r,P=!e.opts.allErrors,D,h="data"+(p||""),w="valid"+u;if(e.schema===!1){e.isTop?P=!0:s+=" var "+w+" = false; ";var m=m||[];m.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(D||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(v)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: 'boolean schema is false' "),e.opts.verbose&&(s+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),s+=" } "):s+=" {} ";var y=s;s=m.pop(),!e.compositeRule&&P?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?i?s+=" return data; ":s+=" validate.errors = null; return true; ":s+=" var "+w+" = true; ";return e.isTop&&(s+=" }; return validate; "),s}if(e.isTop){var g=e.isTop,u=e.level=0,p=e.dataLevel=0,h="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 b="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}s+=" var vErrors = null; ",s+=" var errors = 0; ",s+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,p=e.dataLevel,h="data"+(p||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),i&&!e.async)throw new Error("async schema in sync schema");s+=" var errs_"+u+" = errors;"}var w="valid"+u,P=!e.opts.allErrors,T="",k="",D,A=e.schema.type,$=Array.isArray(A);if(A&&e.opts.nullable&&e.schema.nullable===!0&&($?A.indexOf("null")==-1&&(A=A.concat("null")):A!="null"&&(A=[A,"null"],$=!0)),$&&A.length==1&&(A=A[0],$=!1),e.schema.$ref&&n){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&&(n=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(s+=" "+e.RULES.all.$comment.code(e,"$comment")),A){if(e.opts.coerceTypes)var N=e.util.coerceToTypes(e.opts.coerceTypes,A);var C=e.RULES.types[A];if(N||$||C===!0||C&&!Se(C)){var d=e.schemaPath+".type",v=e.errSchemaPath+"/type",d=e.schemaPath+".type",v=e.errSchemaPath+"/type",O=$?"checkDataTypes":"checkDataType";if(s+=" if ("+e.util[O](A,h,e.opts.strictNumbers,!0)+") { ",N){var j="dataType"+u,F="coerced"+u;s+=" var "+j+" = typeof "+h+"; var "+F+" = undefined; ",e.opts.coerceTypes=="array"&&(s+=" if ("+j+" == 'object' && Array.isArray("+h+") && "+h+".length == 1) { "+h+" = "+h+"[0]; "+j+" = typeof "+h+"; if ("+e.util.checkDataType(e.schema.type,h,e.opts.strictNumbers)+") "+F+" = "+h+"; } "),s+=" if ("+F+" !== undefined) ; ";var B=N;if(B)for(var V,Q=-1,K=B.length-1;Q{"use strict";var $c=Dc(),Lc=ys(),_0=jc(),OD=bd(),x0=xd(),CD=Lc.ucs2length,kD=Pc(),ID=_0.Validation;S0.exports=_d;function _d(a,e,r,t){var s=this,i=this._opts,n=[void 0],o={},l=[],c={},u=[],p={},f=[];e=e||{schema:a,refVal:n,refs:o};var d=AD.call(this,a,e,t),v=this._compilations[d.index];if(d.compiling)return v.callValidate=b;var h=this._formats,m=this.RULES;try{var y=w(a,e,r,t);v.validate=y;var g=v.callValidate;return g&&(g.schema=y.schema,g.errors=null,g.refs=y.refs,g.refVal=y.refVal,g.root=y.root,g.$async=y.$async,i.sourceCode&&(g.source=y.source)),y}finally{ND.call(this,a,e,t)}function b(){var O=v.validate,j=O.apply(this,arguments);return b.errors=O.errors,j}function w(O,j,F,B){var V=!j||j&&j.schema==O;if(j.schema!=e.schema)return _d.call(s,O,j,F,B);var Q=O.$async===!0,K=x0({isTop:!0,schema:O,isRoot:V,baseId:B,root:j,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:_0.MissingRef,RULES:m,validate:x0,util:Lc,resolve:$c,resolveRef:P,usePattern:$,useDefault:N,useCustomRule:C,opts:i,formats:h,logger:s.logger,self:s});K=Mc(n,$D)+Mc(l,DD)+Mc(u,jD)+Mc(f,MD)+K,i.processCode&&(K=i.processCode(K,O));var W;try{var ae=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",K);W=ae(s,m,h,e,n,u,f,kD,CD,ID),n[0]=W}catch(ee){throw s.logger.error("Error compiling schema, function code:",K),ee}return W.schema=O,W.errors=null,W.refs=o,W.refVal=n,W.root=V?W:j,Q&&(W.$async=!0),i.sourceCode===!0&&(W.source={code:K,patterns:l,defaults:u}),W}function P(O,j,F){j=$c.url(O,j);var B=o[j],V,Q;if(B!==void 0)return V=n[B],Q="refVal["+B+"]",A(V,Q);if(!F&&e.refs){var K=e.refs[j];if(K!==void 0)return V=e.refVal[K],Q=T(j,V),A(V,Q)}Q=T(j);var W=$c.call(s,w,e,j);if(W===void 0){var ae=r&&r[j];ae&&(W=$c.inlineRef(ae,i.inlineRefs)?ae:_d.call(s,ae,e,r,O))}if(W===void 0)k(j);else return D(j,W),A(W,Q)}function T(O,j){var F=n.length;return n[F]=j,o[O]=F,"refVal"+F}function k(O){delete o[O]}function D(O,j){var F=o[O];n[F]=j}function A(O,j){return typeof O=="object"||typeof O=="boolean"?{code:j,schema:O,inline:!0}:{code:j,$async:O&&!!O.$async}}function $(O){var j=c[O];return j===void 0&&(j=c[O]=l.length,l[j]=O),"pattern"+j}function N(O){switch(typeof O){case"boolean":case"number":return""+O;case"string":return Lc.toQuotedString(O);case"object":if(O===null)return"null";var j=OD(O),F=p[j];return F===void 0&&(F=p[j]=u.length,u[F]=O),"default"+F}}function C(O,j,F,B){if(s._opts.validateSchema!==!1){var V=O.definition.dependencies;if(V&&!V.every(function(be){return Object.prototype.hasOwnProperty.call(F,be)}))throw new Error("parent schema must have all required keywords: "+V.join(","));var Q=O.definition.validateSchema;if(Q){var K=Q(j);if(!K){var W="keyword schema is invalid: "+s.errorsText(Q.errors);if(s._opts.validateSchema=="log")s.logger.error(W);else throw new Error(W)}}}var ae=O.definition.compile,ee=O.definition.inline,Le=O.definition.macro,he;if(ae)he=ae.call(s,j,F,B);else if(Le)he=Le.call(s,j,F,B),i.validateSchema!==!1&&s.validateSchema(he,!0);else if(ee)he=ee.call(s,B,O.keyword,j,F);else if(he=O.definition.validate,!he)return;if(he===void 0)throw new Error('custom keyword "'+O.keyword+'"failed to compile');var Ee=f.length;return f[Ee]=he,{code:"customRule"+Ee,validate:he}}}function AD(a,e,r){var t=E0.call(this,a,e,r);return t>=0?{index:t,compiling:!0}:(t=this._compilations.length,this._compilations[t]={schema:a,root:e,baseId:r},{index:t,compiling:!1})}function ND(a,e,r){var t=E0.call(this,a,e,r);t>=0&&this._compilations.splice(t,1)}function E0(a,e,r){for(var t=0;t{"use strict";var qc=T0.exports=function(){this._cache={}};qc.prototype.put=function(e,r){this._cache[e]=r};qc.prototype.get=function(e){return this._cache[e]};qc.prototype.del=function(e){delete this._cache[e]};qc.prototype.clear=function(){this._cache={}}});var L0=q((a3,M0)=>{"use strict";var LD=ys(),qD=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,FD=[0,31,28,31,30,31,30,31,31,30,31,30,31],UD=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,P0=/^(?=.{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,zD=/^(?:[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,BD=/^(?:[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,O0=/^(?:(?:[^\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,C0=/^(?:(?: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,k0=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,I0=/^(?:\/(?:[^~/]|~0|~1)*)*$/,A0=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,N0=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;M0.exports=Fc;function Fc(a){return a=a=="full"?"full":"fast",LD.copy(Fc[a])}Fc.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":O0,url:C0,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:P0,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:$0,uuid:k0,"json-pointer":I0,"json-pointer-uri-fragment":A0,"relative-json-pointer":N0};Fc.full={date:D0,time:j0,"date-time":WD,uri:ZD,"uri-reference":BD,"uri-template":O0,url:C0,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:P0,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:$0,uuid:k0,"json-pointer":I0,"json-pointer-uri-fragment":A0,"relative-json-pointer":N0};function HD(a){return a%4===0&&(a%100!==0||a%400===0)}function D0(a){var e=a.match(qD);if(!e)return!1;var r=+e[1],t=+e[2],s=+e[3];return t>=1&&t<=12&&s>=1&&s<=(t==2&&HD(r)?29:FD[t])}function j0(a,e){var r=a.match(UD);if(!r)return!1;var t=r[1],s=r[2],i=r[3],n=r[5];return(t<=23&&s<=59&&i<=59||t==23&&s==59&&i==60)&&(!e||n)}var VD=/t|\s/i;function WD(a){var e=a.split(VD);return e.length==2&&D0(e[0])&&j0(e[1],!0)}var GD=/\/|:/;function ZD(a){return GD.test(a)&&zD.test(a)}var KD=/[^\\]\\Z/;function $0(a){if(KD.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var F0=q((s3,q0)=>{"use strict";q0.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u="data"+(n||""),p="valid"+i,f,d;if(o=="#"||o=="#/")e.isRoot?(f=e.async,d="validate"):(f=e.root.schema.$async===!0,d="root.refVal[0]");else{var v=e.resolveRef(e.baseId,o,e.isRoot);if(v===void 0){var h=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(h);var m=m||[];m.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(s+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(s+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var y=s;s=m.pop(),!e.compositeRule&&c?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(s+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(h),c&&(s+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,h)}else if(v.inline){var g=e.util.copy(e);g.level++;var b="valid"+g.level;g.schema=v.schema,g.schemaPath="",g.errSchemaPath=o;var w=e.validate(g).replace(/validate\.schema/g,v.code);s+=" "+w+" ",c&&(s+=" if ("+b+") { ")}else f=v.$async===!0||e.async&&v.$async!==!1,d=v.code}if(d){var m=m||[];m.push(s),s="",e.opts.passContext?s+=" "+d+".call(this, ":s+=" "+d+"( ",s+=" "+u+", (dataPath || '')",e.errorPath!='""'&&(s+=" + "+e.errorPath);var P=n?"data"+(n-1||""):"parentData",T=n?e.dataPathArr[n]:"parentDataProperty";s+=" , "+P+" , "+T+", rootData) ";var k=s;if(s=m.pop(),f){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(s+=" var "+p+"; "),s+=" try { await "+k+"; ",c&&(s+=" "+p+" = true; "),s+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(s+=" "+p+" = false; "),s+=" } ",c&&(s+=" if ("+p+") { ")}else s+=" if (!"+k+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",c&&(s+=" else { ")}return s}});var z0=q((n3,U0)=>{"use strict";U0.exports=function(e,r,t){var s=" ",i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),o=e.errSchemaPath+"/"+r,l=!e.opts.allErrors,c=e.util.copy(e),u="";c.level++;var p="valid"+c.level,f=c.baseId,d=!0,v=i;if(v)for(var h,m=-1,y=v.length-1;m0||h===!1:e.util.schemaHasRules(h,e.RULES.all))&&(d=!1,c.schema=h,c.schemaPath=n+"["+m+"]",c.errSchemaPath=o+"/"+m,s+=" "+e.validate(c)+" ",c.baseId=f,l&&(s+=" if ("+p+") { ",u+="}"));return l&&(d?s+=" if (true) { ":s+=" "+u.slice(0,-1)+" "),s}});var H0=q((i3,B0)=>{"use strict";B0.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d="errs__"+i,v=e.util.copy(e),h="";v.level++;var m="valid"+v.level,y=o.every(function(D){return e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all)});if(y){var g=v.baseId;s+=" var "+d+" = errors; var "+f+" = false; ";var b=e.compositeRule;e.compositeRule=v.compositeRule=!0;var w=o;if(w)for(var P,T=-1,k=w.length-1;T{"use strict";V0.exports=function(e,r,t){var s=" ",i=e.schema[r],n=e.errSchemaPath+"/"+r,o=!e.opts.allErrors,l=e.util.toQuotedString(i);return e.opts.$comment===!0?s+=" console.log("+l+");":typeof e.opts.$comment=="function"&&(s+=" self._opts.$comment("+l+", "+e.util.toQuotedString(n)+", validate.root.schema);"),s}});var Z0=q((c3,G0)=>{"use strict";G0.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d=e.opts.$data&&o&&o.$data,v;d?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",v="schema"+i):v=o,d||(s+=" var schema"+i+" = validate.schema"+l+";"),s+="var "+f+" = equal("+p+", schema"+i+"); if (!"+f+") { ";var h=h||[];h.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+i+" } ",e.opts.messages!==!1&&(s+=" , message: 'should be equal to constant' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var m=s;return s=h.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+m+"]); ":s+=" validate.errors = ["+m+"]; return false; ":s+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" }",u&&(s+=" else { "),s}});var X0=q((l3,K0)=>{"use strict";K0.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d="errs__"+i,v=e.util.copy(e),h="";v.level++;var m="valid"+v.level,y="i"+i,g=v.dataLevel=e.dataLevel+1,b="data"+g,w=e.baseId,P=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(s+="var "+d+" = errors;var "+f+";",P){var T=e.compositeRule;e.compositeRule=v.compositeRule=!0,v.schema=o,v.schemaPath=l,v.errSchemaPath=c,s+=" var "+m+" = false; for (var "+y+" = 0; "+y+" < "+p+".length; "+y+"++) { ",v.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var k=p+"["+y+"]";v.dataPathArr[g]=y;var D=e.validate(v);v.baseId=w,e.util.varOccurences(D,b)<2?s+=" "+e.util.varReplace(D,b,k)+" ":s+=" var "+b+" = "+k+"; "+D+" ",s+=" if ("+m+") break; } ",e.compositeRule=v.compositeRule=T,s+=" "+h+" if (!"+m+") {"}else s+=" if ("+p+".length == 0) {";var A=A||[];A.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: 'should contain a valid item' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var $=s;return s=A.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+$+"]); ":s+=" validate.errors = ["+$+"]; return false; ":s+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else { ",P&&(s+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(s+=" } "),s}});var J0=q((u3,Q0)=>{"use strict";Q0.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="errs__"+i,d=e.util.copy(e),v="";d.level++;var h="valid"+d.level,m={},y={},g=e.opts.ownProperties;for(T in o)if(T!="__proto__"){var b=o[T],w=Array.isArray(b)?y:m;w[T]=b}s+="var "+f+" = errors;";var P=e.errorPath;s+="var missing"+i+";";for(var T in y)if(w=y[T],w.length){if(s+=" if ( "+p+e.util.getProperty(T)+" !== undefined ",g&&(s+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(T)+"') "),u){s+=" && ( ";var k=w;if(k)for(var D,A=-1,$=k.length-1;A<$;){D=k[A+=1],A&&(s+=" || ");var N=e.util.getProperty(D),C=p+N;s+=" ( ( "+C+" === undefined ",g&&(s+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(D)+"') "),s+=") && (missing"+i+" = "+e.util.toQuotedString(e.opts.jsonPointers?D:N)+") ) "}s+=")) { ";var O="missing"+i,j="' + "+O+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(P,O,!0):P+" + "+O);var F=F||[];F.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(T)+"', missingProperty: '"+j+"', depsCount: "+w.length+", deps: '"+e.util.escapeQuotes(w.length==1?w[0]:w.join(", "))+"' } ",e.opts.messages!==!1&&(s+=" , message: 'should have ",w.length==1?s+="property "+e.util.escapeQuotes(w[0]):s+="properties "+e.util.escapeQuotes(w.join(", ")),s+=" when property "+e.util.escapeQuotes(T)+" is present' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var B=s;s=F.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+B+"]); ":s+=" validate.errors = ["+B+"]; return false; ":s+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{s+=" ) { ";var V=w;if(V)for(var D,Q=-1,K=V.length-1;Q0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(s+=" "+h+" = true; if ( "+p+e.util.getProperty(T)+" !== undefined ",g&&(s+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(T)+"') "),s+=") { ",d.schema=b,d.schemaPath=l+e.util.getProperty(T),d.errSchemaPath=c+"/"+e.util.escapeFragment(T),s+=" "+e.validate(d)+" ",d.baseId=W,s+=" } ",u&&(s+=" if ("+h+") { ",v+="}"))}return u&&(s+=" "+v+" if ("+f+" == errors) {"),s}});var e_=q((p3,Y0)=>{"use strict";Y0.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d=e.opts.$data&&o&&o.$data,v;d?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",v="schema"+i):v=o;var h="i"+i,m="schema"+i;d||(s+=" var "+m+" = validate.schema"+l+";"),s+="var "+f+";",d&&(s+=" if (schema"+i+" === undefined) "+f+" = true; else if (!Array.isArray(schema"+i+")) "+f+" = false; else {"),s+=""+f+" = false;for (var "+h+"=0; "+h+"<"+m+".length; "+h+"++) if (equal("+p+", "+m+"["+h+"])) { "+f+" = true; break; }",d&&(s+=" } "),s+=" if (!"+f+") { ";var y=y||[];y.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+i+" } ",e.opts.messages!==!1&&(s+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var g=s;return s=y.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+g+"]); ":s+=" validate.errors = ["+g+"]; return false; ":s+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" }",u&&(s+=" else { "),s}});var r_=q((d3,t_)=>{"use strict";t_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||"");if(e.opts.format===!1)return u&&(s+=" if (true) { "),s;var f=e.opts.$data&&o&&o.$data,d;f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o;var v=e.opts.unknownFormats,h=Array.isArray(v);if(f){var m="format"+i,y="isObject"+i,g="formatType"+i;s+=" var "+m+" = formats["+d+"]; var "+y+" = typeof "+m+" == 'object' && !("+m+" instanceof RegExp) && "+m+".validate; var "+g+" = "+y+" && "+m+".type || 'string'; if ("+y+") { ",e.async&&(s+=" var async"+i+" = "+m+".async; "),s+=" "+m+" = "+m+".validate; } if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),s+=" (",v!="ignore"&&(s+=" ("+d+" && !"+m+" ",h&&(s+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),s+=") || "),s+=" ("+m+" && "+g+" == '"+t+"' && !(typeof "+m+" == 'function' ? ",e.async?s+=" (async"+i+" ? await "+m+"("+p+") : "+m+"("+p+")) ":s+=" "+m+"("+p+") ",s+=" : "+m+".test("+p+"))))) {"}else{var m=e.formats[o];if(!m){if(v=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),u&&(s+=" if (true) { "),s;if(h&&v.indexOf(o)>=0)return u&&(s+=" if (true) { "),s;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var y=typeof m=="object"&&!(m instanceof RegExp)&&m.validate,g=y&&m.type||"string";if(y){var b=m.async===!0;m=m.validate}if(g!=t)return u&&(s+=" if (true) { "),s;if(b){if(!e.async)throw new Error("async format in sync schema");var w="formats"+e.util.getProperty(o)+".validate";s+=" if (!(await "+w+"("+p+"))) { "}else{s+=" if (! ";var w="formats"+e.util.getProperty(o);y&&(w+=".validate"),typeof m=="function"?s+=" "+w+"("+p+") ":s+=" "+w+".test("+p+") ",s+=") { "}}var P=P||[];P.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",f?s+=""+d:s+=""+e.util.toQuotedString(o),s+=" } ",e.opts.messages!==!1&&(s+=` , message: 'should match format "`,f?s+="' + "+d+" + '":s+=""+e.util.escapeQuotes(o),s+=`"' `),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+e.util.toQuotedString(o),s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var T=s;return s=P.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+T+"]); ":s+=" validate.errors = ["+T+"]; return false; ":s+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { "),s}});var s_=q((f3,a_)=>{"use strict";a_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d="errs__"+i,v=e.util.copy(e);v.level++;var h="valid"+v.level,m=e.schema.then,y=e.schema.else,g=m!==void 0&&(e.opts.strictKeywords?typeof m=="object"&&Object.keys(m).length>0||m===!1:e.util.schemaHasRules(m,e.RULES.all)),b=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),w=v.baseId;if(g||b){var P;v.createErrors=!1,v.schema=o,v.schemaPath=l,v.errSchemaPath=c,s+=" var "+d+" = errors; var "+f+" = true; ";var T=e.compositeRule;e.compositeRule=v.compositeRule=!0,s+=" "+e.validate(v)+" ",v.baseId=w,v.createErrors=!0,s+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=v.compositeRule=T,g?(s+=" if ("+h+") { ",v.schema=e.schema.then,v.schemaPath=e.schemaPath+".then",v.errSchemaPath=e.errSchemaPath+"/then",s+=" "+e.validate(v)+" ",v.baseId=w,s+=" "+f+" = "+h+"; ",g&&b?(P="ifClause"+i,s+=" var "+P+" = 'then'; "):P="'then'",s+=" } ",b&&(s+=" else { ")):s+=" if (!"+h+") { ",b&&(v.schema=e.schema.else,v.schemaPath=e.schemaPath+".else",v.errSchemaPath=e.errSchemaPath+"/else",s+=" "+e.validate(v)+" ",v.baseId=w,s+=" "+f+" = "+h+"; ",g&&b?(P="ifClause"+i,s+=" var "+P+" = 'else'; "):P="'else'",s+=" } "),s+=" if (!"+f+") { var err = ",e.createErrors!==!1?(s+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+P+" } ",e.opts.messages!==!1&&(s+=` , message: 'should match "' + `+P+` + '" schema' `),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ",s+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?s+=" throw new ValidationError(vErrors); ":s+=" validate.errors = vErrors; return false; "),s+=" } ",u&&(s+=" else { ")}else u&&(s+=" if (true) { ");return s}});var i_=q((m3,n_)=>{"use strict";n_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d="errs__"+i,v=e.util.copy(e),h="";v.level++;var m="valid"+v.level,y="i"+i,g=v.dataLevel=e.dataLevel+1,b="data"+g,w=e.baseId;if(s+="var "+d+" = errors;var "+f+";",Array.isArray(o)){var P=e.schema.additionalItems;if(P===!1){s+=" "+f+" = "+p+".length <= "+o.length+"; ";var T=c;c=e.errSchemaPath+"/additionalItems",s+=" if (!"+f+") { ";var k=k||[];k.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(s+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var D=s;s=k.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+D+"]); ":s+=" validate.errors = ["+D+"]; return false; ":s+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",c=T,u&&(h+="}",s+=" else { ")}var A=o;if(A){for(var $,N=-1,C=A.length-1;N0||$===!1:e.util.schemaHasRules($,e.RULES.all)){s+=" "+m+" = true; if ("+p+".length > "+N+") { ";var O=p+"["+N+"]";v.schema=$,v.schemaPath=l+"["+N+"]",v.errSchemaPath=c+"/"+N,v.errorPath=e.util.getPathExpr(e.errorPath,N,e.opts.jsonPointers,!0),v.dataPathArr[g]=N;var j=e.validate(v);v.baseId=w,e.util.varOccurences(j,b)<2?s+=" "+e.util.varReplace(j,b,O)+" ":s+=" var "+b+" = "+O+"; "+j+" ",s+=" } ",u&&(s+=" if ("+m+") { ",h+="}")}}if(typeof P=="object"&&(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))){v.schema=P,v.schemaPath=e.schemaPath+".additionalItems",v.errSchemaPath=e.errSchemaPath+"/additionalItems",s+=" "+m+" = true; if ("+p+".length > "+o.length+") { for (var "+y+" = "+o.length+"; "+y+" < "+p+".length; "+y+"++) { ",v.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var O=p+"["+y+"]";v.dataPathArr[g]=y;var j=e.validate(v);v.baseId=w,e.util.varOccurences(j,b)<2?s+=" "+e.util.varReplace(j,b,O)+" ":s+=" var "+b+" = "+O+"; "+j+" ",u&&(s+=" if (!"+m+") break; "),s+=" } } ",u&&(s+=" if ("+m+") { ",h+="}")}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){v.schema=o,v.schemaPath=l,v.errSchemaPath=c,s+=" for (var "+y+" = 0; "+y+" < "+p+".length; "+y+"++) { ",v.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var O=p+"["+y+"]";v.dataPathArr[g]=y;var j=e.validate(v);v.baseId=w,e.util.varOccurences(j,b)<2?s+=" "+e.util.varReplace(j,b,O)+" ":s+=" var "+b+" = "+O+"; "+j+" ",u&&(s+=" if (!"+m+") break; "),s+=" }"}return u&&(s+=" "+h+" if ("+d+" == errors) {"),s}});var Ed=q((h3,o_)=>{"use strict";o_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,w,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o;var v=r=="maximum",h=v?"exclusiveMaximum":"exclusiveMinimum",m=e.schema[h],y=e.opts.$data&&m&&m.$data,g=v?"<":">",b=v?">":"<",w=void 0;if(!(f||typeof o=="number"||o===void 0))throw new Error(r+" must be number");if(!(y||m===void 0||typeof m=="number"||typeof m=="boolean"))throw new Error(h+" must be number or boolean");if(y){var P=e.util.getData(m.$data,n,e.dataPathArr),T="exclusive"+i,k="exclType"+i,D="exclIsNumber"+i,A="op"+i,$="' + "+A+" + '";s+=" var schemaExcl"+i+" = "+P+"; ",P="schemaExcl"+i,s+=" var "+T+"; var "+k+" = typeof "+P+"; if ("+k+" != 'boolean' && "+k+" != 'undefined' && "+k+" != 'number') { ";var w=h,N=N||[];N.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(w||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: '"+h+" should be boolean' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var C=s;s=N.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+C+"]); ":s+=" validate.errors = ["+C+"]; return false; ":s+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),s+=" "+k+" == 'number' ? ( ("+T+" = "+d+" === undefined || "+P+" "+g+"= "+d+") ? "+p+" "+b+"= "+P+" : "+p+" "+b+" "+d+" ) : ( ("+T+" = "+P+" === true) ? "+p+" "+b+"= "+d+" : "+p+" "+b+" "+d+" ) || "+p+" !== "+p+") { var op"+i+" = "+T+" ? '"+g+"' : '"+g+"='; ",o===void 0&&(w=h,c=e.errSchemaPath+"/"+h,d=P,f=y)}else{var D=typeof m=="number",$=g;if(D&&f){var A="'"+$+"'";s+=" if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),s+=" ( "+d+" === undefined || "+m+" "+g+"= "+d+" ? "+p+" "+b+"= "+m+" : "+p+" "+b+" "+d+" ) || "+p+" !== "+p+") { "}else{D&&o===void 0?(T=!0,w=h,c=e.errSchemaPath+"/"+h,d=m,b+="="):(D&&(d=Math[v?"min":"max"](m,o)),m===(D?d:!0)?(T=!0,w=h,c=e.errSchemaPath+"/"+h,b+="="):(T=!1,$+="="));var A="'"+$+"'";s+=" if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),s+=" "+p+" "+b+" "+d+" || "+p+" !== "+p+") { "}}w=w||r;var N=N||[];N.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(w||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+A+", limit: "+d+", exclusive: "+T+" } ",e.opts.messages!==!1&&(s+=" , message: 'should be "+$+" ",f?s+="' + "+d:s+=""+d+"'"),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var C=s;return s=N.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+C+"]); ":s+=" validate.errors = ["+C+"]; return false; ":s+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { "),s}});var Sd=q((v3,c_)=>{"use strict";c_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;if(f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o,!(f||typeof o=="number"))throw new Error(r+" must be number");var v=r=="maxItems"?">":"<";s+="if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),s+=" "+p+".length "+v+" "+d+") { ";var h=r,m=m||[];m.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(h||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT have ",r=="maxItems"?s+="more":s+="fewer",s+=" than ",f?s+="' + "+d+" + '":s+=""+o,s+=" items' "),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var y=s;return s=m.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}});var wd=q((g3,l_)=>{"use strict";l_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;if(f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o,!(f||typeof o=="number"))throw new Error(r+" must be number");var v=r=="maxLength"?">":"<";s+="if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?s+=" "+p+".length ":s+=" ucs2length("+p+") ",s+=" "+v+" "+d+") { ";var h=r,m=m||[];m.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(h||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT be ",r=="maxLength"?s+="longer":s+="shorter",s+=" than ",f?s+="' + "+d+" + '":s+=""+o,s+=" characters' "),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var y=s;return s=m.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}});var Td=q((y3,u_)=>{"use strict";u_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;if(f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o,!(f||typeof o=="number"))throw new Error(r+" must be number");var v=r=="maxProperties"?">":"<";s+="if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),s+=" Object.keys("+p+").length "+v+" "+d+") { ";var h=r,m=m||[];m.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(h||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT have ",r=="maxProperties"?s+="more":s+="fewer",s+=" than ",f?s+="' + "+d+" + '":s+=""+o,s+=" properties' "),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var y=s;return s=m.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}});var d_=q((b3,p_)=>{"use strict";p_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;if(f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o,!(f||typeof o=="number"))throw new Error(r+" must be number");s+="var division"+i+";if (",f&&(s+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),s+=" (division"+i+" = "+p+" / "+d+", ",e.opts.multipleOfPrecision?s+=" Math.abs(Math.round(division"+i+") - division"+i+") > 1e-"+e.opts.multipleOfPrecision+" ":s+=" division"+i+" !== parseInt(division"+i+") ",s+=" ) ",f&&(s+=" ) "),s+=" ) { ";var v=v||[];v.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(s+=" , message: 'should be multiple of ",f?s+="' + "+d:s+=""+d+"'"),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var h=s;return s=v.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+h+"]); ":s+=" validate.errors = ["+h+"]; return false; ":s+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}});var m_=q((x3,f_)=>{"use strict";f_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="errs__"+i,d=e.util.copy(e);d.level++;var v="valid"+d.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=l,d.errSchemaPath=c,s+=" var "+f+" = errors; ";var h=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var m;d.opts.allErrors&&(m=d.opts.allErrors,d.opts.allErrors=!1),s+=" "+e.validate(d)+" ",d.createErrors=!0,m&&(d.opts.allErrors=m),e.compositeRule=d.compositeRule=h,s+=" if ("+v+") { ";var y=y||[];y.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: 'should NOT be valid' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var g=s;s=y.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+g+"]); ":s+=" validate.errors = ["+g+"]; return false; ":s+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else { errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",e.opts.allErrors&&(s+=" } ")}else s+=" var err = ",e.createErrors!==!1?(s+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(s+=" , message: 'should NOT be valid' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ",s+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(s+=" if (false) { ");return s}});var v_=q((_3,h_)=>{"use strict";h_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d="errs__"+i,v=e.util.copy(e),h="";v.level++;var m="valid"+v.level,y=v.baseId,g="prevValid"+i,b="passingSchemas"+i;s+="var "+d+" = errors , "+g+" = false , "+f+" = false , "+b+" = null; ";var w=e.compositeRule;e.compositeRule=v.compositeRule=!0;var P=o;if(P)for(var T,k=-1,D=P.length-1;k0||T===!1:e.util.schemaHasRules(T,e.RULES.all))?(v.schema=T,v.schemaPath=l+"["+k+"]",v.errSchemaPath=c+"/"+k,s+=" "+e.validate(v)+" ",v.baseId=y):s+=" var "+m+" = true; ",k&&(s+=" if ("+m+" && "+g+") { "+f+" = false; "+b+" = ["+b+", "+k+"]; } else { ",h+="}"),s+=" if ("+m+") { "+f+" = "+g+" = true; "+b+" = "+k+"; }";return e.compositeRule=v.compositeRule=w,s+=""+h+"if (!"+f+") { var err = ",e.createErrors!==!1?(s+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+b+" } ",e.opts.messages!==!1&&(s+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ",s+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?s+=" throw new ValidationError(vErrors); ":s+=" validate.errors = vErrors; return false; "),s+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(s+=" } "),s}});var y_=q((E3,g_)=>{"use strict";g_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f=e.opts.$data&&o&&o.$data,d;f?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",d="schema"+i):d=o;var v=f?"(new RegExp("+d+"))":e.usePattern(o);s+="if ( ",f&&(s+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),s+=" !"+v+".test("+p+") ) { ";var h=h||[];h.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",f?s+=""+d:s+=""+e.util.toQuotedString(o),s+=" } ",e.opts.messages!==!1&&(s+=` , message: 'should match pattern "`,f?s+="' + "+d+" + '":s+=""+e.util.escapeQuotes(o),s+=`"' `),e.opts.verbose&&(s+=" , schema: ",f?s+="validate.schema"+l:s+=""+e.util.toQuotedString(o),s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var m=s;return s=h.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+m+"]); ":s+=" validate.errors = ["+m+"]; return false; ":s+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}});var x_=q((S3,b_)=>{"use strict";b_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="errs__"+i,d=e.util.copy(e),v="";d.level++;var h="valid"+d.level,m="key"+i,y="idx"+i,g=d.dataLevel=e.dataLevel+1,b="data"+g,w="dataProperties"+i,P=Object.keys(o||{}).filter(Q),T=e.schema.patternProperties||{},k=Object.keys(T).filter(Q),D=e.schema.additionalProperties,A=P.length||k.length,$=D===!1,N=typeof D=="object"&&Object.keys(D).length,C=e.opts.removeAdditional,O=$||N||C,j=e.opts.ownProperties,F=e.baseId,B=e.schema.required;if(B&&!(e.opts.$data&&B.$data)&&B.length8)s+=" || validate.schema"+l+".hasOwnProperty("+m+") ";else{var K=P;if(K)for(var W,ae=-1,ee=K.length-1;ae0||Se===!1:e.util.schemaHasRules(Se,e.RULES.all)){var tt=e.util.getProperty(W),X=p+tt,We=De&&Se.default!==void 0;d.schema=Se,d.schemaPath=l+tt,d.errSchemaPath=c+"/"+e.util.escapeFragment(W),d.errorPath=e.util.getPath(e.errorPath,W,e.opts.jsonPointers),d.dataPathArr[g]=e.util.toQuotedString(W);var ce=e.validate(d);if(d.baseId=F,e.util.varOccurences(ce,b)<2){ce=e.util.varReplace(ce,b,X);var Je=X}else{var Je=b;s+=" var "+b+" = "+X+"; "}if(We)s+=" "+ce+" ";else{if(V&&V[W]){s+=" if ( "+Je+" === undefined ",j&&(s+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(W)+"') "),s+=") { "+h+" = false; ";var Te=e.errorPath,G=c,Ke=e.util.escapeQuotes(W);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Te,W,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var re=re||[];re.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+Ke+"' } ",e.opts.messages!==!1&&(s+=" , message: '",e.opts._errorDataPathProperty?s+="is a required property":s+="should have required property \\'"+Ke+"\\'",s+="' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var pe=s;s=re.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+pe+"]); ":s+=" validate.errors = ["+pe+"]; return false; ":s+=" var err = "+pe+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=G,e.errorPath=Te,s+=" } else { "}else u?(s+=" if ( "+Je+" === undefined ",j&&(s+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(W)+"') "),s+=") { "+h+" = true; } else { "):(s+=" if ("+Je+" !== undefined ",j&&(s+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(W)+"') "),s+=" ) { ");s+=" "+ce+" } "}}u&&(s+=" if ("+h+") { ",v+="}")}}if(k.length){var Qe=k;if(Qe)for(var he,Et=-1,St=Qe.length-1;Et0||Se===!1:e.util.schemaHasRules(Se,e.RULES.all)){d.schema=Se,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(he),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(he),j?s+=" "+w+" = "+w+" || Object.keys("+p+"); for (var "+y+"=0; "+y+"<"+w+".length; "+y+"++) { var "+m+" = "+w+"["+y+"]; ":s+=" for (var "+m+" in "+p+") { ",s+=" if ("+e.usePattern(he)+".test("+m+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers);var X=p+"["+m+"]";d.dataPathArr[g]=m;var ce=e.validate(d);d.baseId=F,e.util.varOccurences(ce,b)<2?s+=" "+e.util.varReplace(ce,b,X)+" ":s+=" var "+b+" = "+X+"; "+ce+" ",u&&(s+=" if (!"+h+") break; "),s+=" } ",u&&(s+=" else "+h+" = true; "),s+=" } ",u&&(s+=" if ("+h+") { ",v+="}")}}}return u&&(s+=" "+v+" if ("+f+" == errors) {"),s}});var E_=q((w3,__)=>{"use strict";__.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="errs__"+i,d=e.util.copy(e),v="";d.level++;var h="valid"+d.level;if(s+="var "+f+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=l,d.errSchemaPath=c;var m="key"+i,y="idx"+i,g="i"+i,b="' + "+m+" + '",w=d.dataLevel=e.dataLevel+1,P="data"+w,T="dataProperties"+i,k=e.opts.ownProperties,D=e.baseId;k&&(s+=" var "+T+" = undefined; "),k?s+=" "+T+" = "+T+" || Object.keys("+p+"); for (var "+y+"=0; "+y+"<"+T+".length; "+y+"++) { var "+m+" = "+T+"["+y+"]; ":s+=" for (var "+m+" in "+p+") { ",s+=" var startErrs"+i+" = errors; ";var A=m,$=e.compositeRule;e.compositeRule=d.compositeRule=!0;var N=e.validate(d);d.baseId=D,e.util.varOccurences(N,P)<2?s+=" "+e.util.varReplace(N,P,A)+" ":s+=" var "+P+" = "+A+"; "+N+" ",e.compositeRule=d.compositeRule=$,s+=" if (!"+h+") { for (var "+g+"=startErrs"+i+"; "+g+"{"use strict";S_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d=e.opts.$data&&o&&o.$data,v;d?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",v="schema"+i):v=o;var h="schema"+i;if(!d)if(o.length0||P===!1:e.util.schemaHasRules(P,e.RULES.all))||(m[m.length]=g)}}else var m=o;if(d||m.length){var T=e.errorPath,k=d||m.length>=e.opts.loopRequired,D=e.opts.ownProperties;if(u)if(s+=" var missing"+i+"; ",k){d||(s+=" var "+h+" = validate.schema"+l+"; ");var A="i"+i,$="schema"+i+"["+A+"]",N="' + "+$+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(T,$,e.opts.jsonPointers)),s+=" var "+f+" = true; ",d&&(s+=" if (schema"+i+" === undefined) "+f+" = true; else if (!Array.isArray(schema"+i+")) "+f+" = false; else {"),s+=" for (var "+A+" = 0; "+A+" < "+h+".length; "+A+"++) { "+f+" = "+p+"["+h+"["+A+"]] !== undefined ",D&&(s+=" && Object.prototype.hasOwnProperty.call("+p+", "+h+"["+A+"]) "),s+="; if (!"+f+") break; } ",d&&(s+=" } "),s+=" if (!"+f+") { ";var C=C||[];C.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+N+"' } ",e.opts.messages!==!1&&(s+=" , message: '",e.opts._errorDataPathProperty?s+="is a required property":s+="should have required property \\'"+N+"\\'",s+="' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var O=s;s=C.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+O+"]); ":s+=" validate.errors = ["+O+"]; return false; ":s+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else { "}else{s+=" if ( ";var j=m;if(j)for(var F,A=-1,B=j.length-1;A{"use strict";T_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p="data"+(n||""),f="valid"+i,d=e.opts.$data&&o&&o.$data,v;if(d?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",v="schema"+i):v=o,(o||d)&&e.opts.uniqueItems!==!1){d&&(s+=" var "+f+"; if ("+v+" === false || "+v+" === undefined) "+f+" = true; else if (typeof "+v+" != 'boolean') "+f+" = false; else { "),s+=" var i = "+p+".length , "+f+" = true , j; if (i > 1) { ";var h=e.schema.items&&e.schema.items.type,m=Array.isArray(h);if(!h||h=="object"||h=="array"||m&&(h.indexOf("object")>=0||h.indexOf("array")>=0))s+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+f+" = false; break outer; } } } ";else{s+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ";var y="checkDataType"+(m?"s":"");s+=" if ("+e.util[y](h,"item",e.opts.strictNumbers,!0)+") continue; ",m&&(s+=` if (typeof item == 'string') item = '"' + item; `),s+=" if (typeof itemIndices[item] == 'number') { "+f+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}s+=" } ",d&&(s+=" } "),s+=" if (!"+f+") { ";var g=g||[];g.push(s),s="",e.createErrors!==!1?(s+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(s+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(s+=" , schema: ",d?s+="validate.schema"+l:s+=""+o,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),s+=" } "):s+=" {} ";var b=s;s=g.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+b+"]); ":s+=" validate.errors = ["+b+"]; return false; ":s+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { ")}else u&&(s+=" if (true) { ");return s}});var O_=q((P3,P_)=>{"use strict";P_.exports={$ref:F0(),allOf:z0(),anyOf:H0(),$comment:W0(),const:Z0(),contains:X0(),dependencies:J0(),enum:e_(),format:r_(),if:s_(),items:i_(),maximum:Ed(),minimum:Ed(),maxItems:Sd(),minItems:Sd(),maxLength:wd(),minLength:wd(),maxProperties:Td(),minProperties:Td(),multipleOf:d_(),not:m_(),oneOf:v_(),pattern:y_(),properties:x_(),propertyNames:E_(),required:w_(),uniqueItems:R_(),validate:xd()}});var I_=q((O3,k_)=>{"use strict";var C_=O_(),Rd=ys().toHash;k_.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"],t=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],s=["number","integer","string","array","object","boolean","null"];return e.all=Rd(r),e.types=Rd(s),e.forEach(function(i){i.rules=i.rules.map(function(n){var o;if(typeof n=="object"){var l=Object.keys(n)[0];o=n[l],n=l,o.forEach(function(u){r.push(u),e.all[u]=!0})}r.push(n);var c=e.all[n]={keyword:n,code:C_[n],implements:o};return c}),e.all.$comment={keyword:"$comment",code:C_.$comment},i.type&&(e.types[i.type]=i)}),e.keywords=Rd(r.concat(t)),e.custom={},e}});var D_=q((C3,N_)=>{"use strict";var A_=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];N_.exports=function(a,e){for(var r=0;r{"use strict";var XD=jc().MissingRef;$_.exports=j_;function j_(a,e,r){var t=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 s=i(a).then(function(){var o=t._addSchema(a,void 0,e);return o.validate||n(o)});return r&&s.then(function(o){r(null,o)},r),s;function i(o){var l=o.$schema;return l&&!t.getSchema(l)?j_.call(t,{$ref:l},!0):Promise.resolve()}function n(o){try{return t._compile(o)}catch(c){if(c instanceof XD)return l(c);throw c}function l(c){var u=c.missingSchema;if(d(u))throw new Error("Schema "+u+" is loaded but "+c.missingRef+" cannot be resolved");var p=t._loadingSchemas[u];return p||(p=t._loadingSchemas[u]=t._opts.loadSchema(u),p.then(f,f)),p.then(function(v){if(!d(u))return i(v).then(function(){d(u)||t.addSchema(v,u,void 0,e)})}).then(function(){return n(o)});function f(){delete t._loadingSchemas[u]}function d(v){return t._refs[v]||t._schemas[v]}}}}});var q_=q((I3,L_)=>{"use strict";L_.exports=function(e,r,t){var s=" ",i=e.level,n=e.dataLevel,o=e.schema[r],l=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,p,f="data"+(n||""),d="valid"+i,v="errs__"+i,h=e.opts.$data&&o&&o.$data,m;h?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",m="schema"+i):m=o;var y=this,g="definition"+i,b=y.definition,w="",P,T,k,D,A;if(h&&b.$data){A="keywordValidate"+i;var $=b.validateSchema;s+=" var "+g+" = RULES.custom['"+r+"'].definition; var "+A+" = "+g+".validate;"}else{if(D=e.useCustomRule(y,o,e.schema,e),!D)return;m="validate.schema"+l,A=D.code,P=b.compile,T=b.inline,k=b.macro}var N=A+".errors",C="i"+i,O="ruleErr"+i,j=b.async;if(j&&!e.async)throw new Error("async keyword in sync schema");if(T||k||(s+=""+N+" = null;"),s+="var "+v+" = errors;var "+d+";",h&&b.$data&&(w+="}",s+=" if ("+m+" === undefined) { "+d+" = true; } else { ",$&&(w+="}",s+=" "+d+" = "+g+".validateSchema("+m+"); if ("+d+") { ")),T)b.statements?s+=" "+D.validate+" ":s+=" "+d+" = "+D.validate+"; ";else if(k){var F=e.util.copy(e),w="";F.level++;var B="valid"+F.level;F.schema=D.validate,F.schemaPath="";var V=e.compositeRule;e.compositeRule=F.compositeRule=!0;var Q=e.validate(F).replace(/validate\.schema/g,A);e.compositeRule=F.compositeRule=V,s+=" "+Q}else{var K=K||[];K.push(s),s="",s+=" "+A+".call( ",e.opts.passContext?s+="this":s+="self",P||b.schema===!1?s+=" , "+f+" ":s+=" , "+m+" , "+f+" , validate.schema"+e.schemaPath+" ",s+=" , (dataPath || '')",e.errorPath!='""'&&(s+=" + "+e.errorPath);var W=n?"data"+(n-1||""):"parentData",ae=n?e.dataPathArr[n]:"parentDataProperty";s+=" , "+W+" , "+ae+" , rootData ) ";var ee=s;s=K.pop(),b.errors===!1?(s+=" "+d+" = ",j&&(s+="await "),s+=""+ee+"; "):j?(N="customErrors"+i,s+=" var "+N+" = null; try { "+d+" = await "+ee+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+N+" = e.errors; else throw e; } "):s+=" "+N+" = null; "+d+" = "+ee+"; "}if(b.modifying&&(s+=" if ("+W+") "+f+" = "+W+"["+ae+"];"),s+=""+w,b.valid)u&&(s+=" if (true) { ");else{s+=" if ( ",b.valid===void 0?(s+=" !",k?s+=""+B:s+=""+d):s+=" "+!b.valid+" ",s+=") { ",p=y.keyword;var K=K||[];K.push(s),s="";var K=K||[];K.push(s),s="",e.createErrors!==!1?(s+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+y.keyword+"' } ",e.opts.messages!==!1&&(s+=` , message: 'should pass "`+y.keyword+`" keyword validation' `),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),s+=" } "):s+=" {} ";var Le=s;s=K.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+Le+"]); ":s+=" validate.errors = ["+Le+"]; return false; ":s+=" var err = "+Le+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var he=s;s=K.pop(),T?b.errors?b.errors!="full"&&(s+=" for (var "+C+"="+v+"; "+C+"{QD.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 z_=q((N3,U_)=>{"use strict";var F_=Pd();U_.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:F_.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:F_.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 H_=q((D3,B_)=>{"use strict";var JD=/^[a-z_$][a-z0-9_$-]*$/i,YD=q_(),ej=z_();B_.exports={add:tj,get:rj,remove:aj,validate:Od};function tj(a,e){var r=this.RULES;if(r.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!JD.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var t=e.type;if(Array.isArray(t))for(var s=0;s{sj.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 tE=q(($3,eE)=>{"use strict";var G_=w0(),bs=Dc(),nj=R0(),Z_=fd(),ij=bd(),oj=L0(),cj=I_(),K_=D_(),X_=ys();eE.exports=dt;dt.prototype.validate=uj;dt.prototype.compile=pj;dt.prototype.addSchema=dj;dt.prototype.addMetaSchema=fj;dt.prototype.validateSchema=mj;dt.prototype.getSchema=vj;dt.prototype.removeSchema=yj;dt.prototype.addFormat=Rj;dt.prototype.errorsText=Tj;dt.prototype._addSchema=bj;dt.prototype._compile=xj;dt.prototype.compileAsync=M_();var Bc=H_();dt.prototype.addKeyword=Bc.add;dt.prototype.getKeyword=Bc.get;dt.prototype.removeKeyword=Bc.remove;dt.prototype.validateKeyword=Bc.validate;var Q_=jc();dt.ValidationError=Q_.Validation;dt.MissingRefError=Q_.MissingRef;dt.$dataMetaSchema=K_;var zc="http://json-schema.org/draft-07/schema",W_=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],lj=["/properties"];function dt(a){if(!(this instanceof dt))return new dt(a);a=this._opts=X_.copy(a)||{},Aj(this),this._schemas={},this._refs={},this._fragments={},this._formats=oj(a.format),this._cache=a.cache||new nj,this._loadingSchemas={},this._compilations=[],this.RULES=cj(),this._getId=_j(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=ij),this._metaOpts=Ij(this),a.formats&&Cj(this),a.keywords&&kj(this),Pj(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Oj(this)}function uj(a,e){var r;if(typeof a=="string"){if(r=this.getSchema(a),!r)throw new Error('no schema with key or ref "'+a+'"')}else{var t=this._addSchema(a);r=t.validate||this._compile(t)}var s=r(e);return r.$async!==!0&&(this.errors=r.errors),s}function pj(a,e){var r=this._addSchema(a,void 0,e);return r.validate||this._compile(r)}function dj(a,e,r,t){if(Array.isArray(a)){for(var s=0;s{iE.exports=nE;nE.sync=Dj;var aE=require("fs");function Nj(a,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var t=0;t{pE.exports=lE;lE.sync=jj;var cE=require("fs");function lE(a,e,r){cE.stat(a,function(t,s){r(t,t?!1:uE(s,e))})}function jj(a,e){return uE(cE.statSync(a),e)}function uE(a,e){return a.isFile()&&$j(a,e)}function $j(a,e){var r=a.mode,t=a.uid,s=a.gid,i=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),n=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),o=parseInt("100",8),l=parseInt("010",8),c=parseInt("001",8),u=o|l,p=r&c||r&l&&s===n||r&o&&t===i||r&u&&i===0;return p}});var mE=q((B3,fE)=>{var z3=require("fs"),Hc;process.platform==="win32"||global.TESTING_WINDOWS?Hc=oE():Hc=dE();fE.exports=kd;kd.sync=Mj;function kd(a,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(t,s){kd(a,e||{},function(i,n){i?s(i):t(n)})})}Hc(a,e||{},function(t,s){t&&(t.code==="EACCES"||e&&e.ignoreErrors)&&(t=null,s=!1),r(t,s)})}function Mj(a,e){try{return Hc.sync(a,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var _E=q((H3,xE)=>{var Tn=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",hE=require("path"),Lj=Tn?";":":",vE=mE(),gE=a=>Object.assign(new Error(`not found: ${a}`),{code:"ENOENT"}),yE=(a,e)=>{let r=e.colon||Lj,t=a.match(/\//)||Tn&&a.match(/\\/)?[""]:[...Tn?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],s=Tn?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=Tn?s.split(r):[""];return Tn&&a.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:t,pathExt:i,pathExtExe:s}},bE=(a,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:t,pathExt:s,pathExtExe:i}=yE(a,e),n=[],o=c=>new Promise((u,p)=>{if(c===t.length)return e.all&&n.length?u(n):p(gE(a));let f=t[c],d=/^".*"$/.test(f)?f.slice(1,-1):f,v=hE.join(d,a),h=!d&&/^\.[\\\/]/.test(a)?a.slice(0,2)+v:v;u(l(h,c,0))}),l=(c,u,p)=>new Promise((f,d)=>{if(p===s.length)return f(o(u+1));let v=s[p];vE(c+v,{pathExt:i},(h,m)=>{if(!h&&m)if(e.all)n.push(c+v);else return f(c+v);return f(l(c,u,p+1))})});return r?o(0).then(c=>r(null,c),r):o(0)},qj=(a,e)=>{e=e||{};let{pathEnv:r,pathExt:t,pathExtExe:s}=yE(a,e),i=[];for(let n=0;n{"use strict";var EE=(a={})=>{let e=a.env||process.env;return(a.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(t=>t.toUpperCase()==="PATH")||"Path"};Id.exports=EE;Id.exports.default=EE});var PE=q((W3,RE)=>{"use strict";var wE=require("path"),Fj=_E(),Uj=SE();function TE(a,e){let r=a.options.env||process.env,t=process.cwd(),s=a.options.cwd!=null,i=s&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(a.options.cwd)}catch{}let n;try{n=Fj.sync(a.command,{path:r[Uj({env:r})],pathExt:e?wE.delimiter:void 0})}catch{}finally{i&&process.chdir(t)}return n&&(n=wE.resolve(s?a.options.cwd:"",n)),n}function zj(a){return TE(a)||TE(a,!0)}RE.exports=zj});var OE=q((G3,Nd)=>{"use strict";var Ad=/([()\][%!^"`<>&|;, *?])/g;function Bj(a){return a=a.replace(Ad,"^$1"),a}function Hj(a,e){return a=`${a}`,a=a.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),a=a.replace(/(?=(\\+?)?)\1$/,"$1$1"),a=`"${a}"`,a=a.replace(Ad,"^$1"),e&&(a=a.replace(Ad,"^$1")),a}Nd.exports.command=Bj;Nd.exports.argument=Hj});var kE=q((Z3,CE)=>{"use strict";CE.exports=/^#!(.*)/});var AE=q((K3,IE)=>{"use strict";var Vj=kE();IE.exports=(a="")=>{let e=a.match(Vj);if(!e)return null;let[r,t]=e[0].replace(/#! ?/,"").split(" "),s=r.split("/").pop();return s==="env"?t:t?`${s} ${t}`:s}});var DE=q((X3,NE)=>{"use strict";var Dd=require("fs"),Wj=AE();function Gj(a){let r=Buffer.alloc(150),t;try{t=Dd.openSync(a,"r"),Dd.readSync(t,r,0,150,0),Dd.closeSync(t)}catch{}return Wj(r.toString())}NE.exports=Gj});var LE=q((Q3,ME)=>{"use strict";var Zj=require("path"),jE=PE(),$E=OE(),Kj=DE(),Xj=process.platform==="win32",Qj=/\.(?:com|exe)$/i,Jj=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Yj(a){a.file=jE(a);let e=a.file&&Kj(a.file);return e?(a.args.unshift(a.file),a.command=e,jE(a)):a.file}function e$(a){if(!Xj)return a;let e=Yj(a),r=!Qj.test(e);if(a.options.forceShell||r){let t=Jj.test(e);a.command=Zj.normalize(a.command),a.command=$E.command(a.command),a.args=a.args.map(i=>$E.argument(i,t));let s=[a.command].concat(a.args).join(" ");a.args=["/d","/s","/c",`"${s}"`],a.command=process.env.comspec||"cmd.exe",a.options.windowsVerbatimArguments=!0}return a}function t$(a,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let t={command:a,args:e,options:r,file:void 0,original:{command:a,args:e}};return r.shell?t:e$(t)}ME.exports=t$});var UE=q((J3,FE)=>{"use strict";var jd=process.platform==="win32";function $d(a,e){return Object.assign(new Error(`${e} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${a.command}`,path:a.command,spawnargs:a.args})}function r$(a,e){if(!jd)return;let r=a.emit;a.emit=function(t,s){if(t==="exit"){let i=qE(s,e);if(i)return r.call(a,"error",i)}return r.apply(a,arguments)}}function qE(a,e){return jd&&a===1&&!e.file?$d(e.original,"spawn"):null}function a$(a,e){return jd&&a===1&&!e.file?$d(e.original,"spawnSync"):null}FE.exports={hookChildProcess:r$,verifyENOENT:qE,verifyENOENTSync:a$,notFoundError:$d}});var HE=q((Y3,Rn)=>{"use strict";var zE=require("child_process"),Md=LE(),Ld=UE();function BE(a,e,r){let t=Md(a,e,r),s=zE.spawn(t.command,t.args,t.options);return Ld.hookChildProcess(s,t),s}function s$(a,e,r){let t=Md(a,e,r),s=zE.spawnSync(t.command,t.args,t.options);return s.error=s.error||Ld.verifyENOENTSync(s.status,t),s}Rn.exports=BE;Rn.exports.spawn=BE;Rn.exports.sync=s$;Rn.exports._parse=Md;Rn.exports._enoent=Ld});function l$(){return typeof __dirname<"u"?__dirname:(0,Tt.dirname)((0,ZE.fileURLToPath)(p$.url))}function Gc(a){(0,Fd.mkdirSync)(a,{recursive:!0})}function zr(){return(0,Tt.join)(u$,"..","..")}var Tt,qd,Fd,ZE,p$,u$,Pr,Ud,nU,iU,oU,cU,lU,Wc,uU,pU,dU,fU,Ia=Qn(()=>{"use strict";Tt=require("path"),qd=require("os"),Fd=require("fs"),ZE=require("url"),p$={};u$=l$(),Pr=process.env.CLAUDE_MEM_DATA_DIR||(0,Tt.join)((0,qd.homedir)(),".claude-mem"),Ud=process.env.CLAUDE_CONFIG_DIR||(0,Tt.join)((0,qd.homedir)(),".claude"),nU=(0,Tt.join)(Pr,"archives"),iU=(0,Tt.join)(Pr,"logs"),oU=(0,Tt.join)(Pr,"trash"),cU=(0,Tt.join)(Pr,"backups"),lU=(0,Tt.join)(Pr,"settings.json"),Wc=(0,Tt.join)(Pr,"claude-mem.db"),uU=(0,Tt.join)(Pr,"vector-db"),pU=(0,Tt.join)(Ud,"settings.json"),dU=(0,Tt.join)(Ud,"commands"),fU=(0,Tt.join)(Ud,"CLAUDE.md")});var zd,Bd,H,_t=Qn(()=>{"use strict";zd=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(zd||{}),Bd=class{level;useColor;constructor(){let e=process.env.CLAUDE_MEM_LOG_LEVEL?.toUpperCase()||"INFO";this.level=zd[e]??1,this.useColor=process.stdout.isTTY??!1}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.level===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;try{let t=typeof r=="string"?JSON.parse(r):r;if(e==="Bash"&&t.command){let s=t.command.length>50?t.command.substring(0,50)+"...":t.command;return`${e}(${s})`}if(e==="Read"&&t.file_path){let s=t.file_path.split("/").pop()||t.file_path;return`${e}(${s})`}if(e==="Edit"&&t.file_path){let s=t.file_path.split("/").pop()||t.file_path;return`${e}(${s})`}if(e==="Write"&&t.file_path){let s=t.file_path.split("/").pop()||t.file_path;return`${e}(${s})`}return e}catch{return e}}log(e,r,t,s,i){if(e0&&(p=` {${Object.entries(m).map(([g,b])=>`${g}=${b}`).join(", ")}}`)}let f=`[${n}] [${o}] [${l}] ${c}${t}${p}${u}`;e===3?console.error(f):console.log(f)}debug(e,r,t,s){this.log(0,e,r,t,s)}info(e,r,t,s){this.log(1,e,r,t,s)}warn(e,r,t,s){this.log(2,e,r,t,s)}error(e,r,t,s){this.log(3,e,r,t,s)}dataIn(e,r,t,s){this.info(e,`\u2192 ${r}`,t,s)}dataOut(e,r,t,s){this.info(e,`\u2190 ${r}`,t,s)}success(e,r,t,s){this.info(e,`\u2713 ${r}`,t,s)}failure(e,r,t,s){this.error(e,`\u2717 ${r}`,t,s)}timing(e,r,t,s){this.info(e,`\u23F1 ${r}`,s,{duration:`${t}ms`})}},H=new Bd});var QE,Aa,Kc=Qn(()=>{"use strict";QE=vt(require("better-sqlite3"),1);Ia();_t();Aa=class{db;constructor(){Gc(Pr),this.db=new QE.default(Wc),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),this.initializeSchema(),this.ensureWorkerPortColumn(),this.ensurePromptTrackingColumns(),this.removeSessionSummariesUniqueConstraint(),this.addObservationHierarchicalFields(),this.makeObservationsTextNullable(),this.createUserPromptsTable(),this.ensureDiscoveryTokensColumn()}initializeSchema(){try{this.db.exec(` +`+JSON.stringify(i,null,2):u=" "+this.formatData(i));let p="";if(s){let{sessionId:d,sdkSessionId:v,correlationId:h,...m}=s;Object.keys(m).length>0&&(p=` {${Object.entries(m).map(([g,b])=>`${g}=${b}`).join(", ")}}`)}let f=`[${n}] [${o}] [${l}] ${c}${t}${p}${u}`;e===3?console.error(f):console.log(f)}debug(e,r,t,s){this.log(0,e,r,t,s)}info(e,r,t,s){this.log(1,e,r,t,s)}warn(e,r,t,s){this.log(2,e,r,t,s)}error(e,r,t,s){this.log(3,e,r,t,s)}dataIn(e,r,t,s){this.info(e,`\u2192 ${r}`,t,s)}dataOut(e,r,t,s){this.info(e,`\u2190 ${r}`,t,s)}success(e,r,t,s){this.info(e,`\u2713 ${r}`,t,s)}failure(e,r,t,s){this.error(e,`\u2717 ${r}`,t,s)}timing(e,r,t,s){this.info(e,`\u23F1 ${r}`,s,{duration:`${t}ms`})}},H=new Bd});var QE,Aa,Kc=Qn(()=>{"use strict";QE=gt(require("better-sqlite3"),1);Ia();_t();Aa=class{db;constructor(){Gc(Pr),this.db=new QE.default(Wc),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),this.initializeSchema(),this.ensureWorkerPortColumn(),this.ensurePromptTrackingColumns(),this.removeSessionSummariesUniqueConstraint(),this.addObservationHierarchicalFields(),this.makeObservationsTextNullable(),this.createUserPromptsTable(),this.ensureDiscoveryTokensColumn()}initializeSchema(){try{this.db.exec(` CREATE TABLE IF NOT EXISTS schema_versions ( id INTEGER PRIMARY KEY, version INTEGER UNIQUE NOT NULL, @@ -497,9 +497,9 @@ ${se.dim}No previous sessions found for this project yet.${se.reset} No previous sessions found for this project yet.`;let v=p.slice(0,r.sessionCount),h=u,m=[];if(e?(m.push(""),m.push(`${se.bright}${se.cyan}[${s}] recent context${se.reset}`),m.push(`${se.gray}${"\u2500".repeat(60)}${se.reset}`),m.push("")):(m.push(`# [${s}] recent context`),m.push("")),h.length>0){e?m.push(`${se.dim}Legend: \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u2696\uFE0F decision${se.reset}`):m.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u2696\uFE0F decision"),m.push(""),e?(m.push(`${se.bright}\u{1F4A1} Column Key${se.reset}`),m.push(`${se.dim} Read: Tokens to read this observation (cost to learn it now)${se.reset}`),m.push(`${se.dim} Work: Tokens spent on work that produced this record (\u{1F50D} research, \u{1F6E0}\uFE0F building, \u2696\uFE0F deciding)${se.reset}`)):(m.push("\u{1F4A1} **Column Key**:"),m.push("- **Read**: Tokens to read this observation (cost to learn it now)"),m.push("- **Work**: Tokens spent on work that produced this record (\u{1F50D} research, \u{1F6E0}\uFE0F building, \u2696\uFE0F deciding)")),m.push(""),e?(m.push(`${se.dim}\u{1F4A1} Context Index: This semantic index (titles, types, files, tokens) is usually sufficient to understand past work.${se.reset}`),m.push(""),m.push(`${se.dim}When you need implementation details, rationale, or debugging context:${se.reset}`),m.push(`${se.dim} - Use the mem-search skill to fetch full observations on-demand${se.reset}`),m.push(`${se.dim} - Critical types (\u{1F534} bugfix, \u2696\uFE0F decision) often need detailed fetching${se.reset}`),m.push(`${se.dim} - Trust this index over re-reading code for past decisions and learnings${se.reset}`)):(m.push("\u{1F4A1} **Context Index:** This semantic index (titles, types, files, tokens) is usually sufficient to understand past work."),m.push(""),m.push("When you need implementation details, rationale, or debugging context:"),m.push("- Use the mem-search skill to fetch full observations on-demand"),m.push("- Critical types (\u{1F534} bugfix, \u2696\uFE0F decision) often need detailed fetching"),m.push("- Trust this index over re-reading code for past decisions and learnings")),m.push("");let y=u.length,g=u.reduce((B,V)=>{let Q=(V.title?.length||0)+(V.subtitle?.length||0)+(V.narrative?.length||0)+JSON.stringify(V.facts||[]).length;return B+Math.ceil(Q/Nw)},0),b=u.reduce((B,V)=>B+(V.discovery_tokens||0),0),w=b-g,P=b>0?Math.round(w/b*100):0,T=r.showReadTokens||r.showWorkTokens||r.showSavingsAmount||r.showSavingsPercent;if(T)if(e){if(m.push(`${se.bright}${se.cyan}\u{1F4CA} Context Economics${se.reset}`),m.push(`${se.dim} Loading: ${y} observations (${g.toLocaleString()} tokens to read)${se.reset}`),m.push(`${se.dim} Work investment: ${b.toLocaleString()} tokens spent on research, building, and decisions${se.reset}`),b>0&&(r.showSavingsAmount||r.showSavingsPercent)){let B=" Your savings: ";r.showSavingsAmount&&r.showSavingsPercent?B+=`${w.toLocaleString()} tokens (${P}% reduction from reuse)`:r.showSavingsAmount?B+=`${w.toLocaleString()} tokens`:B+=`${P}% reduction from reuse`,m.push(`${se.green}${B}${se.reset}`)}m.push("")}else{if(m.push("\u{1F4CA} **Context Economics**:"),m.push(`- Loading: ${y} observations (${g.toLocaleString()} tokens to read)`),m.push(`- Work investment: ${b.toLocaleString()} tokens spent on research, building, and decisions`),b>0&&(r.showSavingsAmount||r.showSavingsPercent)){let B="- Your savings: ";r.showSavingsAmount&&r.showSavingsPercent?B+=`${w.toLocaleString()} tokens (${P}% reduction from reuse)`:r.showSavingsAmount?B+=`${w.toLocaleString()} tokens`:B+=`${P}% reduction from reuse`,m.push(B)}m.push("")}let k=p[0]?.id,D=v.map((B,V)=>{let Q=V===0?null:p[V+1];return{...B,displayEpoch:Q?Q.created_at_epoch:B.created_at_epoch,displayTime:Q?Q.created_at:B.created_at,shouldShowLink:B.id!==k}}),A=new Set(u.slice(0,r.fullObservationCount).map(B=>B.id)),$=[...h.map(B=>({type:"observation",data:B})),...D.map(B=>({type:"summary",data:B}))];$.sort((B,V)=>{let Q=B.type==="observation"?B.data.created_at_epoch:B.data.displayEpoch,K=V.type==="observation"?V.data.created_at_epoch:V.data.displayEpoch;return Q-K});let N=new Map;for(let B of $){let V=B.type==="observation"?B.data.created_at:B.data.displayTime,Q=O6(V);N.has(Q)||N.set(Q,[]),N.get(Q).push(B)}let C=Array.from(N.entries()).sort((B,V)=>{let Q=new Date(B[0]).getTime(),K=new Date(V[0]).getTime();return Q-K});for(let[B,V]of C){e?(m.push(`${se.bright}${se.cyan}${B}${se.reset}`),m.push("")):(m.push(`### ${B}`),m.push(""));let Q=null,K="",W=!1;for(let ae of V)if(ae.type==="summary"){W&&(m.push(""),W=!1,Q=null,K="");let ee=ae.data,Le=`${ee.request||"Session started"} (${R6(ee.displayTime)})`,he=ee.shouldShowLink?`claude-mem://session-summary/${ee.id}`:"";if(e){let Ee=he?`${se.dim}[${he}]${se.reset}`:"";m.push(`\u{1F3AF} ${se.yellow}#S${ee.id}${se.reset} ${Le} ${Ee}`)}else{let Ee=he?` [\u2192](${he})`:"";m.push(`**\u{1F3AF} #S${ee.id}** ${Le}${Ee}`)}m.push("")}else{let ee=ae.data,Le=Dw(ee.files_modified),he=Le.length>0&&Le[0]?C6(Le[0],t):"General";he!==Q&&(W&&m.push(""),e?m.push(`${se.dim}${he}${se.reset}`):m.push(`**${he}**`),e||(m.push("| ID | Time | T | Title | Read | Work |"),m.push("|----|------|---|-------|------|------|")),Q=he,W=!0,K="");let Ee=P6(ee.created_at),be=ee.title||"Untitled",Te=Iw[ee.type]||"\u2022",U=(ee.title?.length||0)+(ee.subtitle?.length||0)+(ee.narrative?.length||0)+JSON.stringify(ee.facts||[]).length,G=Math.ceil(U/Nw),re=ee.discovery_tokens||0,pe=Aw[ee.type]||"\u{1F50D}",Z=re>0?`${pe} ${re.toLocaleString()}`:"-",X=Ee!==K,ce=X?Ee:"";if(K=Ee,A.has(ee.id)){let fe=r.fullObservationField==="narrative"?ee.narrative:ee.facts?Dw(ee.facts).join(` `):null;if(e){let $e=X?`${se.dim}${Ee}${se.reset}`:" ".repeat(Ee.length),Ve=r.showReadTokens&&G>0?`${se.dim}(~${G}t)${se.reset}`:"",Se=r.showWorkTokens&&re>0?`${se.dim}(${pe} ${re.toLocaleString()}t)${se.reset}`:"";m.push(` ${se.dim}#${ee.id}${se.reset} ${$e} ${Te} ${se.bright}${be}${se.reset}`),fe&&m.push(` ${se.dim}${fe}${se.reset}`),(Ve||Se)&&m.push(` ${Ve} ${Se}`),m.push("")}else{W&&(m.push(""),W=!1),m.push(`**#${ee.id}** ${ce||"\u2033"} ${Te} **${be}**`),fe&&(m.push(""),m.push(fe),m.push(""));let $e=[];r.showReadTokens&&$e.push(`Read: ~${G}`),r.showWorkTokens&&$e.push(`Work: ${Z}`),$e.length>0&&m.push($e.join(", ")),m.push(""),Q=null}}else if(e){let fe=X?`${se.dim}${Ee}${se.reset}`:" ".repeat(Ee.length),$e=r.showReadTokens&&G>0?`${se.dim}(~${G}t)${se.reset}`:"",Ve=r.showWorkTokens&&re>0?`${se.dim}(${pe} ${re.toLocaleString()}t)${se.reset}`:"";m.push(` ${se.dim}#${ee.id}${se.reset} ${fe} ${Te} ${be} ${$e} ${Ve}`)}else{let fe=r.showReadTokens?`~${G}`:"",$e=r.showWorkTokens?Z:"";m.push(`| #${ee.id} | ${ce||"\u2033"} | ${Te} | ${be} | ${fe} | ${$e} |`)}}W&&m.push("")}let O=p[0],j=u[0];if(r.showLastSummary&&O&&(O.investigated||O.learned||O.completed||O.next_steps)&&(!j||O.created_at_epoch>j.created_at_epoch)&&(m.push(...Rl("Investigated",O.investigated,se.blue,e)),m.push(...Rl("Learned",O.learned,se.yellow,e)),m.push(...Rl("Completed",O.completed,se.green,e)),m.push(...Rl("Next Steps",O.next_steps,se.magenta,e))),d&&(m.push(""),m.push("---"),m.push(""),e?(m.push(`${se.bright}${se.magenta}\u{1F4CB} Previously${se.reset}`),m.push(""),m.push(`${se.dim}A: ${d}${se.reset}`)):(m.push("**\u{1F4CB} Previously**"),m.push(""),m.push(`A: ${d}`)),m.push("")),T&&b>0&&w>0){let B=Math.round(b/1e3);m.push(""),e?m.push(`${se.dim}\u{1F4B0} Access ${B}k tokens of past research & decisions for just ${g.toLocaleString()}t. Use the mem-search skill to access memories by ID instead of re-reading files.${se.reset}`):m.push(`\u{1F4B0} Access ${B}k tokens of past research & decisions for just ${g.toLocaleString()}t. Use the mem-search skill to access memories by ID instead of re-reading files.`)}}return i?.close(),m.join(` -`).trimEnd()}var Ls,Pl,$a,S6,Nw,T6,se,bf=Qn(()=>{"use strict";Ls=vt(require("path"),1),Pl=require("os"),$a=require("fs");Kc();gf();_t();S6=Ls.default.join((0,Pl.homedir)(),".claude","plugins","marketplaces","thedotmack","plugin",".install-version");Nw=4,T6=1,se={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 N6={};Ul(N6,{WorkerService:()=>Il});module.exports=Qw(N6);var qw=vt(zp(),1),Fw=vt(require("path"),1);var E={};Ul(E,{BRAND:()=>x2,DIRTY:()=>ts,EMPTY_PATH:()=>J4,INVALID:()=>Re,NEVER:()=>sN,OK:()=>Ot,ParseStatus:()=>wt,Schema:()=>He,ZodAny:()=>Ra,ZodArray:()=>ra,ZodBigInt:()=>as,ZodBoolean:()=>ss,ZodBranded:()=>Ni,ZodCatch:()=>hs,ZodDate:()=>ns,ZodDefault:()=>ms,ZodDiscriminatedUnion:()=>mc,ZodEffects:()=>lr,ZodEnum:()=>ds,ZodError:()=>Ft,ZodFirstPartyTypeKind:()=>Oe,ZodFunction:()=>vc,ZodIntersection:()=>ls,ZodIssueCode:()=>Y,ZodLazy:()=>us,ZodLiteral:()=>ps,ZodMap:()=>_n,ZodNaN:()=>Sn,ZodNativeEnum:()=>fs,ZodNever:()=>Rr,ZodNull:()=>os,ZodNullable:()=>Fr,ZodNumber:()=>rs,ZodObject:()=>Ut,ZodOptional:()=>or,ZodParsedType:()=>ue,ZodPipeline:()=>Di,ZodPromise:()=>Pa,ZodReadonly:()=>vs,ZodRecord:()=>hc,ZodSchema:()=>He,ZodSet:()=>En,ZodString:()=>Ta,ZodSymbol:()=>bn,ZodTransformer:()=>lr,ZodTuple:()=>qr,ZodType:()=>He,ZodUndefined:()=>is,ZodUnion:()=>cs,ZodUnknown:()=>ta,ZodVoid:()=>xn,addIssueToContext:()=>ne,any:()=>C2,array:()=>N2,bigint:()=>w2,boolean:()=>jx,coerce:()=>aN,custom:()=>Ax,date:()=>T2,datetimeRegex:()=>kx,defaultErrorMap:()=>Yr,discriminatedUnion:()=>M2,effect:()=>K2,enum:()=>W2,function:()=>B2,getErrorMap:()=>vn,getParsedType:()=>Lr,instanceof:()=>E2,intersection:()=>L2,isAborted:()=>dc,isAsync:()=>gn,isDirty:()=>fc,isValid:()=>wa,late:()=>_2,lazy:()=>H2,literal:()=>V2,makeIssue:()=>Ai,map:()=>U2,nan:()=>S2,nativeEnum:()=>G2,never:()=>I2,null:()=>O2,nullable:()=>Q2,number:()=>Dx,object:()=>D2,objectUtil:()=>Bp,oboolean:()=>rN,onumber:()=>tN,optional:()=>X2,ostring:()=>eN,pipeline:()=>Y2,preprocess:()=>J2,promise:()=>Z2,quotelessJson:()=>K4,record:()=>F2,set:()=>z2,setErrorMap:()=>Q4,strictObject:()=>j2,string:()=>Nx,symbol:()=>R2,transformer:()=>K2,tuple:()=>q2,undefined:()=>P2,union:()=>$2,unknown:()=>k2,util:()=>Ze,void:()=>A2});var Ze;(function(a){a.assertEqual=s=>{};function e(s){}a.assertIs=e;function r(s){throw new Error}a.assertNever=r,a.arrayToEnum=s=>{let i={};for(let n of s)i[n]=n;return i},a.getValidEnumValues=s=>{let i=a.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),n={};for(let o of i)n[o]=s[o];return a.objectValues(n)},a.objectValues=s=>a.objectKeys(s).map(function(i){return s[i]}),a.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let n in s)Object.prototype.hasOwnProperty.call(s,n)&&i.push(n);return i},a.find=(s,i)=>{for(let n of s)if(i(n))return n},a.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function t(s,i=" | "){return s.map(n=>typeof n=="string"?`'${n}'`:n).join(i)}a.joinValues=t,a.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Ze||(Ze={}));var Bp;(function(a){a.mergeShapes=(e,r)=>({...e,...r})})(Bp||(Bp={}));var ue=Ze.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Lr=a=>{switch(typeof a){case"undefined":return ue.undefined;case"string":return ue.string;case"number":return Number.isNaN(a)?ue.nan:ue.number;case"boolean":return ue.boolean;case"function":return ue.function;case"bigint":return ue.bigint;case"symbol":return ue.symbol;case"object":return Array.isArray(a)?ue.array:a===null?ue.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?ue.promise:typeof Map<"u"&&a instanceof Map?ue.map:typeof Set<"u"&&a instanceof Set?ue.set:typeof Date<"u"&&a instanceof Date?ue.date:ue.object;default:return ue.unknown}};var Y=Ze.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"]),K4=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ft=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=t=>{this.issues=[...this.issues,t]},this.addIssues=(t=[])=>{this.issues=[...this.issues,...t]};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(i){return i.message},t={_errors:[]},s=i=>{for(let n of i.issues)if(n.code==="invalid_union")n.unionErrors.map(s);else if(n.code==="invalid_return_type")s(n.returnTypeError);else if(n.code==="invalid_arguments")s(n.argumentsError);else if(n.path.length===0)t._errors.push(r(n));else{let o=t,l=0;for(;lr.message){let r={},t=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];r[i]=r[i]||[],r[i].push(e(s))}else t.push(e(s));return{formErrors:t,fieldErrors:r}}get formErrors(){return this.flatten()}};Ft.create=a=>new Ft(a);var X4=(a,e)=>{let r;switch(a.code){case Y.invalid_type:a.received===ue.undefined?r="Required":r=`Expected ${a.expected}, received ${a.received}`;break;case Y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(a.expected,Ze.jsonStringifyReplacer)}`;break;case Y.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ze.joinValues(a.keys,", ")}`;break;case Y.invalid_union:r="Invalid input";break;case Y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ze.joinValues(a.options)}`;break;case Y.invalid_enum_value:r=`Invalid enum value. Expected ${Ze.joinValues(a.options)}, received '${a.received}'`;break;case Y.invalid_arguments:r="Invalid function arguments";break;case Y.invalid_return_type:r="Invalid function return type";break;case Y.invalid_date:r="Invalid date";break;case Y.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(r=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?r=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?r=`Invalid input: must end with "${a.validation.endsWith}"`:Ze.assertNever(a.validation):a.validation!=="regex"?r=`Invalid ${a.validation}`:r="Invalid";break;case Y.too_small:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:r="Invalid input";break;case Y.too_big:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?r=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:r="Invalid input";break;case Y.custom:r="Invalid input";break;case Y.invalid_intersection_types:r="Intersection results could not be merged";break;case Y.not_multiple_of:r=`Number must be a multiple of ${a.multipleOf}`;break;case Y.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ze.assertNever(a)}return{message:r}},Yr=X4;var Tx=Yr;function Q4(a){Tx=a}function vn(){return Tx}var Ai=a=>{let{data:e,path:r,errorMaps:t,issueData:s}=a,i=[...r,...s.path||[]],n={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let o="",l=t.filter(c=>!!c).slice().reverse();for(let c of l)o=c(n,{data:e,defaultError:o}).message;return{...s,path:i,message:o}},J4=[];function ne(a,e){let r=vn(),t=Ai({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,r,r===Yr?void 0:Yr].filter(s=>!!s)});a.common.issues.push(t)}var wt=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let t=[];for(let s of r){if(s.status==="aborted")return Re;s.status==="dirty"&&e.dirty(),t.push(s.value)}return{status:e.value,value:t}}static async mergeObjectAsync(e,r){let t=[];for(let s of r){let i=await s.key,n=await s.value;t.push({key:i,value:n})}return a.mergeObjectSync(e,t)}static mergeObjectSync(e,r){let t={};for(let s of r){let{key:i,value:n}=s;if(i.status==="aborted"||n.status==="aborted")return Re;i.status==="dirty"&&e.dirty(),n.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof n.value<"u"||s.alwaysSet)&&(t[i.value]=n.value)}return{status:e.value,value:t}}},Re=Object.freeze({status:"aborted"}),ts=a=>({status:"dirty",value:a}),Ot=a=>({status:"valid",value:a}),dc=a=>a.status==="aborted",fc=a=>a.status==="dirty",wa=a=>a.status==="valid",gn=a=>typeof Promise<"u"&&a instanceof Promise;var ge;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(ge||(ge={}));var cr=class{constructor(e,r,t,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=t,this._key=s}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}},Rx=(a,e)=>{if(wa(e))return{success:!0,data:e.value};if(!a.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 Ft(a.common.issues);return this._error=r,this._error}}};function Fe(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:t,description:s}=a;if(e&&(r||t))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(n,o)=>{let{message:l}=a;return n.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??t??o.defaultError}:n.code!=="invalid_type"?{message:o.defaultError}:{message:l??r??o.defaultError}},description:s}}var He=class{get description(){return this._def.description}_getType(e){return Lr(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Lr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new wt,ctx:{common:e.parent.common,data:e.data,parsedType:Lr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(gn(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 t=this.safeParse(e,r);if(t.success)return t.data;throw t.error}safeParse(e,r){let t={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Lr(e)},s=this._parseSync({data:e,path:t.path,parent:t});return Rx(t,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Lr(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:r});return wa(t)?{value:t.value}:{issues:r.common.issues}}catch(t){t?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(t=>wa(t)?{value:t.value}:{issues:r.common.issues})}async parseAsync(e,r){let t=await this.safeParseAsync(e,r);if(t.success)return t.data;throw t.error}async safeParseAsync(e,r){let t={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Lr(e)},s=this._parse({data:e,path:t.path,parent:t}),i=await(gn(s)?s:Promise.resolve(s));return Rx(t,i)}refine(e,r){let t=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,i)=>{let n=e(s),o=()=>i.addIssue({code:Y.custom,...t(s)});return typeof Promise<"u"&&n instanceof Promise?n.then(l=>l?!0:(o(),!1)):n?!0:(o(),!1)})}refinement(e,r){return this._refinement((t,s)=>e(t)?!0:(s.addIssue(typeof r=="function"?r(t,s):r),!1))}_refinement(e){return new lr({schema:this,typeName:Oe.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 or.create(this,this._def)}nullable(){return Fr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ra.create(this)}promise(){return Pa.create(this,this._def)}or(e){return cs.create([this,e],this._def)}and(e){return ls.create(this,e,this._def)}transform(e){return new lr({...Fe(this._def),schema:this,typeName:Oe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ms({...Fe(this._def),innerType:this,defaultValue:r,typeName:Oe.ZodDefault})}brand(){return new Ni({typeName:Oe.ZodBranded,type:this,...Fe(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new hs({...Fe(this._def),innerType:this,catchValue:r,typeName:Oe.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Di.create(this,e)}readonly(){return vs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Y4=/^c[^\s-]{8,}$/i,e2=/^[0-9a-z]+$/,t2=/^[0-9A-HJKMNP-TV-Z]{26}$/i,r2=/^[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,a2=/^[a-z0-9_-]{21}$/i,s2=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,n2=/^[-+]?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)?)??$/,i2=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,o2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Hp,c2=/^(?:(?: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])$/,l2=/^(?:(?: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])$/,u2=/^(([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]))$/,p2=/^(([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])$/,d2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,f2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ox="((\\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])))",m2=new RegExp(`^${Ox}$`);function Cx(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let r=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function h2(a){return new RegExp(`^${Cx(a)}$`)}function kx(a){let e=`${Ox}T${Cx(a)}`,r=[];return r.push(a.local?"Z?":"Z"),a.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function v2(a,e){return!!((e==="v4"||!e)&&c2.test(a)||(e==="v6"||!e)&&u2.test(a))}function g2(a,e){if(!s2.test(a))return!1;try{let[r]=a.split(".");if(!r)return!1;let t=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(t));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function y2(a,e){return!!((e==="v4"||!e)&&l2.test(a)||(e==="v6"||!e)&&p2.test(a))}var Ta=class a extends He{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ue.string){let i=this._getOrReturnCtx(e);return ne(i,{code:Y.invalid_type,expected:ue.string,received:i.parsedType}),Re}let t=new wt,s;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(s=this._getOrReturnCtx(e,s),ne(s,{code:Y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if(i.kind==="length"){let n=e.data.length>i.value,o=e.data.lengthe.test(s),{validation:r,code:Y.invalid_string,...ge.errToObj(t)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ge.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ge.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ge.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ge.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ge.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ge.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ge.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ge.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ge.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ge.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ge.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ge.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ge.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,...ge.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,...ge.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ge.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ge.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ge.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ge.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ge.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ge.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ge.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ge.errToObj(r)})}nonempty(e){return this.min(1,ge.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...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 Ta({checks:[],typeName:Oe.ZodString,coerce:a?.coerce??!1,...Fe(a)});function b2(a,e){let r=(a.toString().split(".")[1]||"").length,t=(e.toString().split(".")[1]||"").length,s=r>t?r:t,i=Number.parseInt(a.toFixed(s).replace(".","")),n=Number.parseInt(e.toFixed(s).replace(".",""));return i%n/10**s}var rs=class a extends He{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)!==ue.number){let i=this._getOrReturnCtx(e);return ne(i,{code:Y.invalid_type,expected:ue.number,received:i.parsedType}),Re}let t,s=new wt;for(let i of this._def.checks)i.kind==="int"?Ze.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ne(t,{code:Y.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),ne(t,{code:Y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?b2(e.data,i.value)!==0&&(t=this._getOrReturnCtx(e,t),ne(t,{code:Y.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ne(t,{code:Y.not_finite,message:i.message}),s.dirty()):Ze.assertNever(i);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ge.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ge.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ge.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ge.toString(r))}setLimit(e,r,t,s){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:t,message:ge.toString(s)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ge.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ge.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ge.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ge.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ge.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ge.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ge.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ge.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ge.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"&&Ze.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let t of this._def.checks){if(t.kind==="finite"||t.kind==="int"||t.kind==="multipleOf")return!0;t.kind==="min"?(r===null||t.value>r)&&(r=t.value):t.kind==="max"&&(e===null||t.valuenew rs({checks:[],typeName:Oe.ZodNumber,coerce:a?.coerce||!1,...Fe(a)});var as=class a extends He{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)!==ue.bigint)return this._getInvalidInput(e);let t,s=new wt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),ne(t,{code:Y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ne(t,{code:Y.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Ze.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ne(r,{code:Y.invalid_type,expected:ue.bigint,received:r.parsedType}),Re}gte(e,r){return this.setLimit("min",e,!0,ge.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ge.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ge.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ge.toString(r))}setLimit(e,r,t,s){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:t,message:ge.toString(s)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ge.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ge.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ge.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ge.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ge.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 as({checks:[],typeName:Oe.ZodBigInt,coerce:a?.coerce??!1,...Fe(a)});var ss=class extends He{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ue.boolean){let t=this._getOrReturnCtx(e);return ne(t,{code:Y.invalid_type,expected:ue.boolean,received:t.parsedType}),Re}return Ot(e.data)}};ss.create=a=>new ss({typeName:Oe.ZodBoolean,coerce:a?.coerce||!1,...Fe(a)});var ns=class a extends He{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ue.date){let i=this._getOrReturnCtx(e);return ne(i,{code:Y.invalid_type,expected:ue.date,received:i.parsedType}),Re}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return ne(i,{code:Y.invalid_date}),Re}let t=new wt,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(s=this._getOrReturnCtx(e,s),ne(s,{code:Y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),t.dirty()):Ze.assertNever(i);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ge.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ge.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 ns({checks:[],coerce:a?.coerce||!1,typeName:Oe.ZodDate,...Fe(a)});var bn=class extends He{_parse(e){if(this._getType(e)!==ue.symbol){let t=this._getOrReturnCtx(e);return ne(t,{code:Y.invalid_type,expected:ue.symbol,received:t.parsedType}),Re}return Ot(e.data)}};bn.create=a=>new bn({typeName:Oe.ZodSymbol,...Fe(a)});var is=class extends He{_parse(e){if(this._getType(e)!==ue.undefined){let t=this._getOrReturnCtx(e);return ne(t,{code:Y.invalid_type,expected:ue.undefined,received:t.parsedType}),Re}return Ot(e.data)}};is.create=a=>new is({typeName:Oe.ZodUndefined,...Fe(a)});var os=class extends He{_parse(e){if(this._getType(e)!==ue.null){let t=this._getOrReturnCtx(e);return ne(t,{code:Y.invalid_type,expected:ue.null,received:t.parsedType}),Re}return Ot(e.data)}};os.create=a=>new os({typeName:Oe.ZodNull,...Fe(a)});var Ra=class extends He{constructor(){super(...arguments),this._any=!0}_parse(e){return Ot(e.data)}};Ra.create=a=>new Ra({typeName:Oe.ZodAny,...Fe(a)});var ta=class extends He{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ot(e.data)}};ta.create=a=>new ta({typeName:Oe.ZodUnknown,...Fe(a)});var Rr=class extends He{_parse(e){let r=this._getOrReturnCtx(e);return ne(r,{code:Y.invalid_type,expected:ue.never,received:r.parsedType}),Re}};Rr.create=a=>new Rr({typeName:Oe.ZodNever,...Fe(a)});var xn=class extends He{_parse(e){if(this._getType(e)!==ue.undefined){let t=this._getOrReturnCtx(e);return ne(t,{code:Y.invalid_type,expected:ue.void,received:t.parsedType}),Re}return Ot(e.data)}};xn.create=a=>new xn({typeName:Oe.ZodVoid,...Fe(a)});var ra=class a extends He{_parse(e){let{ctx:r,status:t}=this._processInputParams(e),s=this._def;if(r.parsedType!==ue.array)return ne(r,{code:Y.invalid_type,expected:ue.array,received:r.parsedType}),Re;if(s.exactLength!==null){let n=r.data.length>s.exactLength.value,o=r.data.lengths.maxLength.value&&(ne(r,{code:Y.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),t.dirty()),r.common.async)return Promise.all([...r.data].map((n,o)=>s.type._parseAsync(new cr(r,n,r.path,o)))).then(n=>wt.mergeArray(t,n));let i=[...r.data].map((n,o)=>s.type._parseSync(new cr(r,n,r.path,o)));return wt.mergeArray(t,i)}get element(){return this._def.type}min(e,r){return new a({...this._def,minLength:{value:e,message:ge.toString(r)}})}max(e,r){return new a({...this._def,maxLength:{value:e,message:ge.toString(r)}})}length(e,r){return new a({...this._def,exactLength:{value:e,message:ge.toString(r)}})}nonempty(e){return this.min(1,e)}};ra.create=(a,e)=>new ra({type:a,minLength:null,maxLength:null,exactLength:null,typeName:Oe.ZodArray,...Fe(e)});function yn(a){if(a instanceof Ut){let e={};for(let r in a.shape){let t=a.shape[r];e[r]=or.create(yn(t))}return new Ut({...a._def,shape:()=>e})}else return a instanceof ra?new ra({...a._def,type:yn(a.element)}):a instanceof or?or.create(yn(a.unwrap())):a instanceof Fr?Fr.create(yn(a.unwrap())):a instanceof qr?qr.create(a.items.map(e=>yn(e))):a}var Ut=class a extends He{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=Ze.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==ue.object){let c=this._getOrReturnCtx(e);return ne(c,{code:Y.invalid_type,expected:ue.object,received:c.parsedType}),Re}let{status:t,ctx:s}=this._processInputParams(e),{shape:i,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof Rr&&this._def.unknownKeys==="strip"))for(let c in s.data)n.includes(c)||o.push(c);let l=[];for(let c of n){let u=i[c],p=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new cr(s,p,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Rr){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of o)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")o.length>0&&(ne(s,{code:Y.unrecognized_keys,keys:o}),t.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of o){let p=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new cr(s,p,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,f=await u.value;c.push({key:p,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>wt.mergeObjectSync(t,c)):wt.mergeObjectSync(t,l)}get shape(){return this._def.shape()}strict(e){return ge.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,t)=>{let s=this._def.errorMap?.(r,t).message??t.defaultError;return r.code==="unrecognized_keys"?{message:ge.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Oe.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let r={};for(let t of Ze.objectKeys(e))e[t]&&this.shape[t]&&(r[t]=this.shape[t]);return new a({...this._def,shape:()=>r})}omit(e){let r={};for(let t of Ze.objectKeys(this.shape))e[t]||(r[t]=this.shape[t]);return new a({...this._def,shape:()=>r})}deepPartial(){return yn(this)}partial(e){let r={};for(let t of Ze.objectKeys(this.shape)){let s=this.shape[t];e&&!e[t]?r[t]=s:r[t]=s.optional()}return new a({...this._def,shape:()=>r})}required(e){let r={};for(let t of Ze.objectKeys(this.shape))if(e&&!e[t])r[t]=this.shape[t];else{let i=this.shape[t];for(;i instanceof or;)i=i._def.innerType;r[t]=i}return new a({...this._def,shape:()=>r})}keyof(){return Ix(Ze.objectKeys(this.shape))}};Ut.create=(a,e)=>new Ut({shape:()=>a,unknownKeys:"strip",catchall:Rr.create(),typeName:Oe.ZodObject,...Fe(e)});Ut.strictCreate=(a,e)=>new Ut({shape:()=>a,unknownKeys:"strict",catchall:Rr.create(),typeName:Oe.ZodObject,...Fe(e)});Ut.lazycreate=(a,e)=>new Ut({shape:a,unknownKeys:"strip",catchall:Rr.create(),typeName:Oe.ZodObject,...Fe(e)});var cs=class extends He{_parse(e){let{ctx:r}=this._processInputParams(e),t=this._def.options;function s(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let n=i.map(o=>new Ft(o.ctx.common.issues));return ne(r,{code:Y.invalid_union,unionErrors:n}),Re}if(r.common.async)return Promise.all(t.map(async i=>{let n={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:n}),ctx:n}})).then(s);{let i,n=[];for(let l of t){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&n.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let o=n.map(l=>new Ft(l));return ne(r,{code:Y.invalid_union,unionErrors:o}),Re}}get options(){return this._def.options}};cs.create=(a,e)=>new cs({options:a,typeName:Oe.ZodUnion,...Fe(e)});var ea=a=>a instanceof us?ea(a.schema):a instanceof lr?ea(a.innerType()):a instanceof ps?[a.value]:a instanceof ds?a.options:a instanceof fs?Ze.objectValues(a.enum):a instanceof ms?ea(a._def.innerType):a instanceof is?[void 0]:a instanceof os?[null]:a instanceof or?[void 0,...ea(a.unwrap())]:a instanceof Fr?[null,...ea(a.unwrap())]:a instanceof Ni||a instanceof vs?ea(a.unwrap()):a instanceof hs?ea(a._def.innerType):[],mc=class a extends He{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ue.object)return ne(r,{code:Y.invalid_type,expected:ue.object,received:r.parsedType}),Re;let t=this.discriminator,s=r.data[t],i=this.optionsMap.get(s);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ne(r,{code:Y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[t]}),Re)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,t){let s=new Map;for(let i of r){let n=ea(i.shape[e]);if(!n.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of n){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,i)}}return new a({typeName:Oe.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...Fe(t)})}};function Vp(a,e){let r=Lr(a),t=Lr(e);if(a===e)return{valid:!0,data:a};if(r===ue.object&&t===ue.object){let s=Ze.objectKeys(e),i=Ze.objectKeys(a).filter(o=>s.indexOf(o)!==-1),n={...a,...e};for(let o of i){let l=Vp(a[o],e[o]);if(!l.valid)return{valid:!1};n[o]=l.data}return{valid:!0,data:n}}else if(r===ue.array&&t===ue.array){if(a.length!==e.length)return{valid:!1};let s=[];for(let i=0;i{if(dc(i)||dc(n))return Re;let o=Vp(i.value,n.value);return o.valid?((fc(i)||fc(n))&&r.dirty(),{status:r.value,value:o.data}):(ne(t,{code:Y.invalid_intersection_types}),Re)};return t.common.async?Promise.all([this._def.left._parseAsync({data:t.data,path:t.path,parent:t}),this._def.right._parseAsync({data:t.data,path:t.path,parent:t})]).then(([i,n])=>s(i,n)):s(this._def.left._parseSync({data:t.data,path:t.path,parent:t}),this._def.right._parseSync({data:t.data,path:t.path,parent:t}))}};ls.create=(a,e,r)=>new ls({left:a,right:e,typeName:Oe.ZodIntersection,...Fe(r)});var qr=class a extends He{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==ue.array)return ne(t,{code:Y.invalid_type,expected:ue.array,received:t.parsedType}),Re;if(t.data.lengththis._def.items.length&&(ne(t,{code:Y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...t.data].map((n,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new cr(t,n,t.path,o)):null}).filter(n=>!!n);return t.common.async?Promise.all(i).then(n=>wt.mergeArray(r,n)):wt.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};qr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new qr({items:a,typeName:Oe.ZodTuple,rest:null,...Fe(e)})};var hc=class a extends He{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==ue.object)return ne(t,{code:Y.invalid_type,expected:ue.object,received:t.parsedType}),Re;let s=[],i=this._def.keyType,n=this._def.valueType;for(let o in t.data)s.push({key:i._parse(new cr(t,o,t.path,o)),value:n._parse(new cr(t,t.data[o],t.path,o)),alwaysSet:o in t.data});return t.common.async?wt.mergeObjectAsync(r,s):wt.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,t){return r instanceof He?new a({keyType:e,valueType:r,typeName:Oe.ZodRecord,...Fe(t)}):new a({keyType:Ta.create(),valueType:e,typeName:Oe.ZodRecord,...Fe(r)})}},_n=class extends He{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==ue.map)return ne(t,{code:Y.invalid_type,expected:ue.map,received:t.parsedType}),Re;let s=this._def.keyType,i=this._def.valueType,n=[...t.data.entries()].map(([o,l],c)=>({key:s._parse(new cr(t,o,t.path,[c,"key"])),value:i._parse(new cr(t,l,t.path,[c,"value"]))}));if(t.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let l of n){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Re;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let l of n){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Re;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.value,value:o}}}};_n.create=(a,e,r)=>new _n({valueType:e,keyType:a,typeName:Oe.ZodMap,...Fe(r)});var En=class a extends He{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==ue.set)return ne(t,{code:Y.invalid_type,expected:ue.set,received:t.parsedType}),Re;let s=this._def;s.minSize!==null&&t.data.sizes.maxSize.value&&(ne(t,{code:Y.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let i=this._def.valueType;function n(l){let c=new Set;for(let u of l){if(u.status==="aborted")return Re;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let o=[...t.data.values()].map((l,c)=>i._parse(new cr(t,l,t.path,c)));return t.common.async?Promise.all(o).then(l=>n(l)):n(o)}min(e,r){return new a({...this._def,minSize:{value:e,message:ge.toString(r)}})}max(e,r){return new a({...this._def,maxSize:{value:e,message:ge.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};En.create=(a,e)=>new En({valueType:a,minSize:null,maxSize:null,typeName:Oe.ZodSet,...Fe(e)});var vc=class a extends He{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ue.function)return ne(r,{code:Y.invalid_type,expected:ue.function,received:r.parsedType}),Re;function t(o,l){return Ai({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,vn(),Yr].filter(c=>!!c),issueData:{code:Y.invalid_arguments,argumentsError:l}})}function s(o,l){return Ai({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,vn(),Yr].filter(c=>!!c),issueData:{code:Y.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},n=r.data;if(this._def.returns instanceof Pa){let o=this;return Ot(async function(...l){let c=new Ft([]),u=await o._def.args.parseAsync(l,i).catch(d=>{throw c.addIssue(t(l,d)),c}),p=await Reflect.apply(n,this,u);return await o._def.returns._def.type.parseAsync(p,i).catch(d=>{throw c.addIssue(s(p,d)),c})})}else{let o=this;return Ot(function(...l){let c=o._def.args.safeParse(l,i);if(!c.success)throw new Ft([t(l,c.error)]);let u=Reflect.apply(n,this,c.data),p=o._def.returns.safeParse(u,i);if(!p.success)throw new Ft([s(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:qr.create(e).rest(ta.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,t){return new a({args:e||qr.create([]).rest(ta.create()),returns:r||ta.create(),typeName:Oe.ZodFunction,...Fe(t)})}},us=class extends He{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})}};us.create=(a,e)=>new us({getter:a,typeName:Oe.ZodLazy,...Fe(e)});var ps=class extends He{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ne(r,{received:r.data,code:Y.invalid_literal,expected:this._def.value}),Re}return{status:"valid",value:e.data}}get value(){return this._def.value}};ps.create=(a,e)=>new ps({value:a,typeName:Oe.ZodLiteral,...Fe(e)});function Ix(a,e){return new ds({values:a,typeName:Oe.ZodEnum,...Fe(e)})}var ds=class a extends He{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),t=this._def.values;return ne(r,{expected:Ze.joinValues(t),received:r.parsedType,code:Y.invalid_type}),Re}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),t=this._def.values;return ne(r,{received:r.data,code:Y.invalid_enum_value,options:t}),Re}return Ot(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 a.create(e,{...this._def,...r})}exclude(e,r=this._def){return a.create(this.options.filter(t=>!e.includes(t)),{...this._def,...r})}};ds.create=Ix;var fs=class extends He{_parse(e){let r=Ze.getValidEnumValues(this._def.values),t=this._getOrReturnCtx(e);if(t.parsedType!==ue.string&&t.parsedType!==ue.number){let s=Ze.objectValues(r);return ne(t,{expected:Ze.joinValues(s),received:t.parsedType,code:Y.invalid_type}),Re}if(this._cache||(this._cache=new Set(Ze.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=Ze.objectValues(r);return ne(t,{received:t.data,code:Y.invalid_enum_value,options:s}),Re}return Ot(e.data)}get enum(){return this._def.values}};fs.create=(a,e)=>new fs({values:a,typeName:Oe.ZodNativeEnum,...Fe(e)});var Pa=class extends He{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ue.promise&&r.common.async===!1)return ne(r,{code:Y.invalid_type,expected:ue.promise,received:r.parsedType}),Re;let t=r.parsedType===ue.promise?r.data:Promise.resolve(r.data);return Ot(t.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Pa.create=(a,e)=>new Pa({type:a,typeName:Oe.ZodPromise,...Fe(e)});var lr=class extends He{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Oe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:t}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:n=>{ne(t,n),n.fatal?r.abort():r.dirty()},get path(){return t.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let n=s.transform(t.data,i);if(t.common.async)return Promise.resolve(n).then(async o=>{if(r.value==="aborted")return Re;let l=await this._def.schema._parseAsync({data:o,path:t.path,parent:t});return l.status==="aborted"?Re:l.status==="dirty"?ts(l.value):r.value==="dirty"?ts(l.value):l});{if(r.value==="aborted")return Re;let o=this._def.schema._parseSync({data:n,path:t.path,parent:t});return o.status==="aborted"?Re:o.status==="dirty"?ts(o.value):r.value==="dirty"?ts(o.value):o}}if(s.type==="refinement"){let n=o=>{let l=s.refinement(o,i);if(t.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(t.common.async===!1){let o=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});return o.status==="aborted"?Re:(o.status==="dirty"&&r.dirty(),n(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(o=>o.status==="aborted"?Re:(o.status==="dirty"&&r.dirty(),n(o.value).then(()=>({status:r.value,value:o.value}))))}if(s.type==="transform")if(t.common.async===!1){let n=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});if(!wa(n))return Re;let o=s.transform(n.value,i);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:t.data,path:t.path,parent:t}).then(n=>wa(n)?Promise.resolve(s.transform(n.value,i)).then(o=>({status:r.value,value:o})):Re);Ze.assertNever(s)}};lr.create=(a,e,r)=>new lr({schema:a,typeName:Oe.ZodEffects,effect:e,...Fe(r)});lr.createWithPreprocess=(a,e,r)=>new lr({schema:e,effect:{type:"preprocess",transform:a},typeName:Oe.ZodEffects,...Fe(r)});var or=class extends He{_parse(e){return this._getType(e)===ue.undefined?Ot(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};or.create=(a,e)=>new or({innerType:a,typeName:Oe.ZodOptional,...Fe(e)});var Fr=class extends He{_parse(e){return this._getType(e)===ue.null?Ot(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Fr.create=(a,e)=>new Fr({innerType:a,typeName:Oe.ZodNullable,...Fe(e)});var ms=class extends He{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return r.parsedType===ue.undefined&&(t=this._def.defaultValue()),this._def.innerType._parse({data:t,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ms.create=(a,e)=>new ms({innerType:a,typeName:Oe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Fe(e)});var hs=class extends He{_parse(e){let{ctx:r}=this._processInputParams(e),t={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:t.data,path:t.path,parent:{...t}});return gn(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ft(t.common.issues)},input:t.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ft(t.common.issues)},input:t.data})}}removeCatch(){return this._def.innerType}};hs.create=(a,e)=>new hs({innerType:a,typeName:Oe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Fe(e)});var Sn=class extends He{_parse(e){if(this._getType(e)!==ue.nan){let t=this._getOrReturnCtx(e);return ne(t,{code:Y.invalid_type,expected:ue.nan,received:t.parsedType}),Re}return{status:"valid",value:e.data}}};Sn.create=a=>new Sn({typeName:Oe.ZodNaN,...Fe(a)});var x2=Symbol("zod_brand"),Ni=class extends He{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return this._def.type._parse({data:t,path:r.path,parent:r})}unwrap(){return this._def.type}},Di=class a extends He{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:t.data,path:t.path,parent:t});return i.status==="aborted"?Re:i.status==="dirty"?(r.dirty(),ts(i.value)):this._def.out._parseAsync({data:i.value,path:t.path,parent:t})})();{let s=this._def.in._parseSync({data:t.data,path:t.path,parent:t});return s.status==="aborted"?Re:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:t.path,parent:t})}}static create(e,r){return new a({in:e,out:r,typeName:Oe.ZodPipeline})}},vs=class extends He{_parse(e){let r=this._def.innerType._parse(e),t=s=>(wa(s)&&(s.value=Object.freeze(s.value)),s);return gn(r)?r.then(s=>t(s)):t(r)}unwrap(){return this._def.innerType}};vs.create=(a,e)=>new vs({innerType:a,typeName:Oe.ZodReadonly,...Fe(e)});function Px(a,e){let r=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof r=="string"?{message:r}:r}function Ax(a,e={},r){return a?Ra.create().superRefine((t,s)=>{let i=a(t);if(i instanceof Promise)return i.then(n=>{if(!n){let o=Px(e,t),l=o.fatal??r??!0;s.addIssue({code:"custom",...o,fatal:l})}});if(!i){let n=Px(e,t),o=n.fatal??r??!0;s.addIssue({code:"custom",...n,fatal:o})}}):Ra.create()}var _2={object:Ut.lazycreate},Oe;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(Oe||(Oe={}));var E2=(a,e={message:`Input not instance of ${a.name}`})=>Ax(r=>r instanceof a,e),Nx=Ta.create,Dx=rs.create,S2=Sn.create,w2=as.create,jx=ss.create,T2=ns.create,R2=bn.create,P2=is.create,O2=os.create,C2=Ra.create,k2=ta.create,I2=Rr.create,A2=xn.create,N2=ra.create,D2=Ut.create,j2=Ut.strictCreate,$2=cs.create,M2=mc.create,L2=ls.create,q2=qr.create,F2=hc.create,U2=_n.create,z2=En.create,B2=vc.create,H2=us.create,V2=ps.create,W2=ds.create,G2=fs.create,Z2=Pa.create,K2=lr.create,X2=or.create,Q2=Fr.create,J2=lr.createWithPreprocess,Y2=Di.create,eN=()=>Nx().optional(),tN=()=>Dx().optional(),rN=()=>jx().optional(),aN={string:(a=>Ta.create({...a,coerce:!0})),number:(a=>rs.create({...a,coerce:!0})),boolean:(a=>ss.create({...a,coerce:!0})),bigint:(a=>as.create({...a,coerce:!0})),date:(a=>ns.create({...a,coerce:!0}))};var sN=Re;var Wp="2025-06-18";var $x=[Wp,"2025-03-26","2024-11-05","2024-10-07"],gc="2.0",Mx=E.union([E.string(),E.number().int()]),Lx=E.string(),nN=E.object({progressToken:E.optional(Mx)}).passthrough(),dr=E.object({_meta:E.optional(nN)}).passthrough(),zt=E.object({method:E.string(),params:E.optional(dr)}),ji=E.object({_meta:E.optional(E.object({}).passthrough())}).passthrough(),Ur=E.object({method:E.string(),params:E.optional(ji)}),fr=E.object({_meta:E.optional(E.object({}).passthrough())}).passthrough(),yc=E.union([E.string(),E.number().int()]),qx=E.object({jsonrpc:E.literal(gc),id:yc}).merge(zt).strict(),Fx=a=>qx.safeParse(a).success,Ux=E.object({jsonrpc:E.literal(gc)}).merge(Ur).strict(),zx=a=>Ux.safeParse(a).success,Bx=E.object({jsonrpc:E.literal(gc),id:yc,result:fr}).strict(),Gp=a=>Bx.safeParse(a).success,ur;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(ur||(ur={}));var Hx=E.object({jsonrpc:E.literal(gc),id:yc,error:E.object({code:E.number().int(),message:E.string(),data:E.optional(E.unknown())})}).strict(),Vx=a=>Hx.safeParse(a).success,Wx=E.union([qx,Ux,Bx,Hx]),gs=fr.strict(),bc=Ur.extend({method:E.literal("notifications/cancelled"),params:ji.extend({requestId:yc,reason:E.string().optional()})}),iN=E.object({src:E.string(),mimeType:E.optional(E.string()),sizes:E.optional(E.array(E.string()))}).passthrough(),$i=E.object({icons:E.array(iN).optional()}).passthrough(),Mi=E.object({name:E.string(),title:E.optional(E.string())}).passthrough(),Gx=Mi.extend({version:E.string(),websiteUrl:E.optional(E.string())}).merge($i),oN=E.object({experimental:E.optional(E.object({}).passthrough()),sampling:E.optional(E.object({}).passthrough()),elicitation:E.optional(E.object({}).passthrough()),roots:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough())}).passthrough(),cN=zt.extend({method:E.literal("initialize"),params:dr.extend({protocolVersion:E.string(),capabilities:oN,clientInfo:Gx})});var lN=E.object({experimental:E.optional(E.object({}).passthrough()),logging:E.optional(E.object({}).passthrough()),completions:E.optional(E.object({}).passthrough()),prompts:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough()),resources:E.optional(E.object({subscribe:E.optional(E.boolean()),listChanged:E.optional(E.boolean())}).passthrough()),tools:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough())}).passthrough(),Zp=fr.extend({protocolVersion:E.string(),capabilities:lN,serverInfo:Gx,instructions:E.optional(E.string())}),uN=Ur.extend({method:E.literal("notifications/initialized")});var xc=zt.extend({method:E.literal("ping")}),pN=E.object({progress:E.number(),total:E.optional(E.number()),message:E.optional(E.string())}).passthrough(),_c=Ur.extend({method:E.literal("notifications/progress"),params:ji.merge(pN).extend({progressToken:Mx})}),Ec=zt.extend({params:dr.extend({cursor:E.optional(Lx)}).optional()}),Sc=fr.extend({nextCursor:E.optional(Lx)}),Zx=E.object({uri:E.string(),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).passthrough(),Kx=Zx.extend({text:E.string()}),Kp=E.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),Xx=Zx.extend({blob:Kp}),Qx=Mi.extend({uri:E.string(),description:E.optional(E.string()),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).merge($i),dN=Mi.extend({uriTemplate:E.string(),description:E.optional(E.string()),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).merge($i),fN=Ec.extend({method:E.literal("resources/list")}),Xp=Sc.extend({resources:E.array(Qx)}),mN=Ec.extend({method:E.literal("resources/templates/list")}),Qp=Sc.extend({resourceTemplates:E.array(dN)}),hN=zt.extend({method:E.literal("resources/read"),params:dr.extend({uri:E.string()})}),Jp=fr.extend({contents:E.array(E.union([Kx,Xx]))}),vN=Ur.extend({method:E.literal("notifications/resources/list_changed")}),gN=zt.extend({method:E.literal("resources/subscribe"),params:dr.extend({uri:E.string()})}),yN=zt.extend({method:E.literal("resources/unsubscribe"),params:dr.extend({uri:E.string()})}),bN=Ur.extend({method:E.literal("notifications/resources/updated"),params:ji.extend({uri:E.string()})}),xN=E.object({name:E.string(),description:E.optional(E.string()),required:E.optional(E.boolean())}).passthrough(),_N=Mi.extend({description:E.optional(E.string()),arguments:E.optional(E.array(xN)),_meta:E.optional(E.object({}).passthrough())}).merge($i),EN=Ec.extend({method:E.literal("prompts/list")}),Yp=Sc.extend({prompts:E.array(_N)}),SN=zt.extend({method:E.literal("prompts/get"),params:dr.extend({name:E.string(),arguments:E.optional(E.record(E.string()))})}),ed=E.object({type:E.literal("text"),text:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),td=E.object({type:E.literal("image"),data:Kp,mimeType:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),rd=E.object({type:E.literal("audio"),data:Kp,mimeType:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),wN=E.object({type:E.literal("resource"),resource:E.union([Kx,Xx]),_meta:E.optional(E.object({}).passthrough())}).passthrough(),TN=Qx.extend({type:E.literal("resource_link")}),Jx=E.union([ed,td,rd,TN,wN]),RN=E.object({role:E.enum(["user","assistant"]),content:Jx}).passthrough(),ad=fr.extend({description:E.optional(E.string()),messages:E.array(RN)}),PN=Ur.extend({method:E.literal("notifications/prompts/list_changed")}),ON=E.object({title:E.optional(E.string()),readOnlyHint:E.optional(E.boolean()),destructiveHint:E.optional(E.boolean()),idempotentHint:E.optional(E.boolean()),openWorldHint:E.optional(E.boolean())}).passthrough(),CN=Mi.extend({description:E.optional(E.string()),inputSchema:E.object({type:E.literal("object"),properties:E.optional(E.object({}).passthrough()),required:E.optional(E.array(E.string()))}).passthrough(),outputSchema:E.optional(E.object({type:E.literal("object"),properties:E.optional(E.object({}).passthrough()),required:E.optional(E.array(E.string()))}).passthrough()),annotations:E.optional(ON),_meta:E.optional(E.object({}).passthrough())}).merge($i),kN=Ec.extend({method:E.literal("tools/list")}),sd=Sc.extend({tools:E.array(CN)}),wc=fr.extend({content:E.array(Jx).default([]),structuredContent:E.object({}).passthrough().optional(),isError:E.optional(E.boolean())}),$F=wc.or(fr.extend({toolResult:E.unknown()})),IN=zt.extend({method:E.literal("tools/call"),params:dr.extend({name:E.string(),arguments:E.optional(E.record(E.unknown()))})}),AN=Ur.extend({method:E.literal("notifications/tools/list_changed")}),Yx=E.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),NN=zt.extend({method:E.literal("logging/setLevel"),params:dr.extend({level:Yx})}),DN=Ur.extend({method:E.literal("notifications/message"),params:ji.extend({level:Yx,logger:E.optional(E.string()),data:E.unknown()})}),jN=E.object({name:E.string().optional()}).passthrough(),$N=E.object({hints:E.optional(E.array(jN)),costPriority:E.optional(E.number().min(0).max(1)),speedPriority:E.optional(E.number().min(0).max(1)),intelligencePriority:E.optional(E.number().min(0).max(1))}).passthrough(),MN=E.object({role:E.enum(["user","assistant"]),content:E.union([ed,td,rd])}).passthrough(),LN=zt.extend({method:E.literal("sampling/createMessage"),params:dr.extend({messages:E.array(MN),systemPrompt:E.optional(E.string()),includeContext:E.optional(E.enum(["none","thisServer","allServers"])),temperature:E.optional(E.number()),maxTokens:E.number().int(),stopSequences:E.optional(E.array(E.string())),metadata:E.optional(E.object({}).passthrough()),modelPreferences:E.optional($N)})}),qN=fr.extend({model:E.string(),stopReason:E.optional(E.enum(["endTurn","stopSequence","maxTokens"]).or(E.string())),role:E.enum(["user","assistant"]),content:E.discriminatedUnion("type",[ed,td,rd])}),FN=E.object({type:E.literal("boolean"),title:E.optional(E.string()),description:E.optional(E.string()),default:E.optional(E.boolean())}).passthrough(),UN=E.object({type:E.literal("string"),title:E.optional(E.string()),description:E.optional(E.string()),minLength:E.optional(E.number()),maxLength:E.optional(E.number()),format:E.optional(E.enum(["email","uri","date","date-time"]))}).passthrough(),zN=E.object({type:E.enum(["number","integer"]),title:E.optional(E.string()),description:E.optional(E.string()),minimum:E.optional(E.number()),maximum:E.optional(E.number())}).passthrough(),BN=E.object({type:E.literal("string"),title:E.optional(E.string()),description:E.optional(E.string()),enum:E.array(E.string()),enumNames:E.optional(E.array(E.string()))}).passthrough(),HN=E.union([FN,UN,zN,BN]),VN=zt.extend({method:E.literal("elicitation/create"),params:dr.extend({message:E.string(),requestedSchema:E.object({type:E.literal("object"),properties:E.record(E.string(),HN),required:E.optional(E.array(E.string()))}).passthrough()})}),WN=fr.extend({action:E.enum(["accept","decline","cancel"]),content:E.optional(E.record(E.string(),E.unknown()))}),GN=E.object({type:E.literal("ref/resource"),uri:E.string()}).passthrough();var ZN=E.object({type:E.literal("ref/prompt"),name:E.string()}).passthrough(),KN=zt.extend({method:E.literal("completion/complete"),params:dr.extend({ref:E.union([ZN,GN]),argument:E.object({name:E.string(),value:E.string()}).passthrough(),context:E.optional(E.object({arguments:E.optional(E.record(E.string(),E.string()))}))})}),nd=fr.extend({completion:E.object({values:E.array(E.string()).max(100),total:E.optional(E.number().int()),hasMore:E.optional(E.boolean())}).passthrough()}),XN=E.object({uri:E.string().startsWith("file://"),name:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).passthrough(),QN=zt.extend({method:E.literal("roots/list")}),JN=fr.extend({roots:E.array(XN)}),YN=Ur.extend({method:E.literal("notifications/roots/list_changed")}),MF=E.union([xc,cN,KN,NN,SN,EN,fN,mN,hN,gN,yN,IN,kN]),LF=E.union([bc,_c,uN,YN]),qF=E.union([gs,qN,WN,JN]),FF=E.union([xc,LN,VN,QN]),UF=E.union([bc,_c,DN,bN,vN,AN,PN]),zF=E.union([gs,Zp,nd,ad,Yp,Xp,Qp,Jp,wc,sd]),pr=class extends Error{constructor(e,r,t){super(`MCP error ${e}: ${r}`),this.code=e,this.data=t,this.name="McpError"}};var eD=6e4,Tc=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(bc,r=>{let t=this._requestHandlerAbortControllers.get(r.params.requestId);t?.abort(r.params.reason)}),this.setNotificationHandler(_c,r=>{this._onprogress(r)}),this.setRequestHandler(xc,r=>({}))}_setupTimeout(e,r,t,s,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,r),startTime:Date.now(),timeout:r,maxTotalTimeout:t,resetTimeoutOnProgress:i,onTimeout:s})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let t=Date.now()-r.startTime;if(r.maxTotalTimeout&&t>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new pr(ur.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:t});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,t,s;this._transport=e;let i=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{i?.(),this._onclose()};let n=(t=this.transport)===null||t===void 0?void 0:t.onerror;this._transport.onerror=l=>{n?.(l),this._onerror(l)};let o=(s=this._transport)===null||s===void 0?void 0:s.onmessage;this._transport.onmessage=(l,c)=>{o?.(l,c),Gp(l)||Vx(l)?this._onresponse(l):Fx(l)?this._onrequest(l,c):zx(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},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 t=new pr(ur.ConnectionClosed,"Connection closed");for(let s of r.values())s(t)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let t=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,r){var t,s;let i=(t=this._requestHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackRequestHandler,n=this._transport;if(i===void 0){n?.send({jsonrpc:"2.0",id:e.id,error:{code:ur.MethodNotFound,message:"Method not found"}}).catch(c=>this._onerror(new Error(`Failed to send an error response: ${c}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let l={signal:o.signal,sessionId:n?.sessionId,_meta:(s=e.params)===null||s===void 0?void 0:s._meta,sendNotification:c=>this.notification(c,{relatedRequestId:e.id}),sendRequest:(c,u,p)=>this.request(c,u,{...p,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>i(e,l)).then(c=>{if(!o.signal.aborted)return n?.send({result:c,jsonrpc:"2.0",id:e.id})},c=>{var u;if(!o.signal.aborted)return n?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:ur.InternalError,message:(u=c.message)!==null&&u!==void 0?u:"Internal error"}})}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...t}=e.params,s=Number(r),i=this._progressHandlers.get(s);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let n=this._responseHandlers.get(s),o=this._timeoutInfo.get(s);if(o&&n&&o.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(l){n(l);return}i(t)}_onresponse(e){let r=Number(e.id),t=this._responseHandlers.get(r);if(t===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),Gp(e))t(e);else{let s=new pr(e.error.code,e.error.message,e.error.data);t(s)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,t){let{relatedRequestId:s,resumptionToken:i,onresumptiontoken:n}=t??{};return new Promise((o,l)=>{var c,u,p,f,d,v;if(!this._transport){l(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=t?.signal)===null||u===void 0||u.throwIfAborted();let h=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:h};t?.onprogress&&(this._progressHandlers.set(h,t.onprogress),m.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:h}});let y=w=>{var P;this._responseHandlers.delete(h),this._progressHandlers.delete(h),this._cleanupTimeout(h),(P=this._transport)===null||P===void 0||P.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:h,reason:String(w)}},{relatedRequestId:s,resumptionToken:i,onresumptiontoken:n}).catch(T=>this._onerror(new Error(`Failed to send cancellation: ${T}`))),l(w)};this._responseHandlers.set(h,w=>{var P;if(!(!((P=t?.signal)===null||P===void 0)&&P.aborted)){if(w instanceof Error)return l(w);try{let T=r.parse(w.result);o(T)}catch(T){l(T)}}}),(f=t?.signal)===null||f===void 0||f.addEventListener("abort",()=>{var w;y((w=t?.signal)===null||w===void 0?void 0:w.reason)});let g=(d=t?.timeout)!==null&&d!==void 0?d:eD,b=()=>y(new pr(ur.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(h,g,t?.maxTotalTimeout,b,(v=t?.resetTimeoutOnProgress)!==null&&v!==void 0?v:!1),this._transport.send(m,{relatedRequestId:s,resumptionToken:i,onresumptiontoken:n}).catch(w=>{this._cleanupTimeout(h),l(w)})})}async notification(e,r){var t,s;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((s=(t=this._options)===null||t===void 0?void 0:t.debouncedNotificationMethods)!==null&&s!==void 0?s:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var l;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let c={...e,jsonrpc:"2.0"};(l=this._transport)===null||l===void 0||l.send(c,r).catch(u=>this._onerror(u))});return}let o={...e,jsonrpc:"2.0"};await this._transport.send(o,r)}setRequestHandler(e,r){let t=e.shape.method.value;this.assertRequestHandlerCapability(t),this._requestHandlers.set(t,(s,i)=>Promise.resolve(r(e.parse(s),i)))}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,t=>Promise.resolve(r(e.parse(t))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function e0(a,e){return Object.entries(e).reduce((r,[t,s])=>(s&&typeof s=="object"?r[t]=r[t]?{...r[t],...s}:s:r[t]=s,r),{...a})}var rE=vt(tE(),1),wn=class extends Tc{constructor(e,r){var t;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(t=r?.capabilities)!==null&&t!==void 0?t:{},this._ajv=new rE.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=e0(this._capabilities,e)}assertCapability(e,r){var t;if(!(!((t=this._serverCapabilities)===null||t===void 0)&&t[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 t=await this.request({method:"initialize",params:{protocolVersion:Wp,capabilities:this._capabilities,clientInfo:this._clientInfo}},Zp,r);if(t===void 0)throw new Error(`Server sent invalid initialize result: ${t}`);if(!$x.includes(t.protocolVersion))throw new Error(`Server's protocol version is not supported: ${t.protocolVersion}`);this._serverCapabilities=t.capabilities,this._serverVersion=t.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(t.protocolVersion),this._instructions=t.instructions,await this.notification({method:"notifications/initialized"})}catch(t){throw this.close(),t}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,t,s,i,n;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(!(!((t=this._serverCapabilities)===null||t===void 0)&&t.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(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.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(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.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"},gs,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},nd,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},gs,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},ad,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},Yp,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},Xp,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},Qp,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Jp,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},gs,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},gs,r)}async callTool(e,r=wc,t){let s=await this.request({method:"tools/call",params:e},r,t),i=this.getToolOutputValidator(e.name);if(i){if(!s.structuredContent&&!s.isError)throw new pr(ur.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent)try{if(!i(s.structuredContent))throw new pr(ur.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(i.errors)}`)}catch(n){throw n instanceof pr?n:new pr(ur.InvalidParams,`Failed to validate structured content: ${n instanceof Error?n.message:String(n)}`)}}return s}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let r of e)if(r.outputSchema)try{let t=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,t)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let t=await this.request({method:"tools/list",params:e},sd,r);return this.cacheToolOutputSchemas(t.tools),t}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var WE=vt(HE(),1),qi=vt(require("node:process"),1),GE=require("node:stream");var Vc=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 Ls,Pl,$a,S6,Nw,T6,se,bf=Qn(()=>{"use strict";Ls=gt(require("path"),1),Pl=require("os"),$a=require("fs");Kc();gf();_t();S6=Ls.default.join((0,Pl.homedir)(),".claude","plugins","marketplaces","thedotmack","plugin",".install-version");Nw=4,T6=1,se={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 N6={};Ul(N6,{WorkerService:()=>Il});module.exports=Qw(N6);var qw=gt(zp(),1),Fw=gt(require("path"),1);var E={};Ul(E,{BRAND:()=>x2,DIRTY:()=>ts,EMPTY_PATH:()=>J4,INVALID:()=>Re,NEVER:()=>sN,OK:()=>Ot,ParseStatus:()=>wt,Schema:()=>He,ZodAny:()=>Ra,ZodArray:()=>ra,ZodBigInt:()=>as,ZodBoolean:()=>ss,ZodBranded:()=>Ni,ZodCatch:()=>hs,ZodDate:()=>ns,ZodDefault:()=>ms,ZodDiscriminatedUnion:()=>mc,ZodEffects:()=>lr,ZodEnum:()=>ds,ZodError:()=>Ft,ZodFirstPartyTypeKind:()=>Oe,ZodFunction:()=>vc,ZodIntersection:()=>ls,ZodIssueCode:()=>Y,ZodLazy:()=>us,ZodLiteral:()=>ps,ZodMap:()=>_n,ZodNaN:()=>Sn,ZodNativeEnum:()=>fs,ZodNever:()=>Rr,ZodNull:()=>os,ZodNullable:()=>Fr,ZodNumber:()=>rs,ZodObject:()=>Ut,ZodOptional:()=>or,ZodParsedType:()=>ue,ZodPipeline:()=>Di,ZodPromise:()=>Pa,ZodReadonly:()=>vs,ZodRecord:()=>hc,ZodSchema:()=>He,ZodSet:()=>En,ZodString:()=>Ta,ZodSymbol:()=>bn,ZodTransformer:()=>lr,ZodTuple:()=>qr,ZodType:()=>He,ZodUndefined:()=>is,ZodUnion:()=>cs,ZodUnknown:()=>ta,ZodVoid:()=>xn,addIssueToContext:()=>ne,any:()=>C2,array:()=>N2,bigint:()=>w2,boolean:()=>jx,coerce:()=>aN,custom:()=>Ax,date:()=>T2,datetimeRegex:()=>kx,defaultErrorMap:()=>Yr,discriminatedUnion:()=>M2,effect:()=>K2,enum:()=>W2,function:()=>B2,getErrorMap:()=>vn,getParsedType:()=>Lr,instanceof:()=>E2,intersection:()=>L2,isAborted:()=>dc,isAsync:()=>gn,isDirty:()=>fc,isValid:()=>wa,late:()=>_2,lazy:()=>H2,literal:()=>V2,makeIssue:()=>Ai,map:()=>U2,nan:()=>S2,nativeEnum:()=>G2,never:()=>I2,null:()=>O2,nullable:()=>Q2,number:()=>Dx,object:()=>D2,objectUtil:()=>Bp,oboolean:()=>rN,onumber:()=>tN,optional:()=>X2,ostring:()=>eN,pipeline:()=>Y2,preprocess:()=>J2,promise:()=>Z2,quotelessJson:()=>K4,record:()=>F2,set:()=>z2,setErrorMap:()=>Q4,strictObject:()=>j2,string:()=>Nx,symbol:()=>R2,transformer:()=>K2,tuple:()=>q2,undefined:()=>P2,union:()=>$2,unknown:()=>k2,util:()=>Ze,void:()=>A2});var Ze;(function(a){a.assertEqual=s=>{};function e(s){}a.assertIs=e;function r(s){throw new Error}a.assertNever=r,a.arrayToEnum=s=>{let i={};for(let n of s)i[n]=n;return i},a.getValidEnumValues=s=>{let i=a.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),n={};for(let o of i)n[o]=s[o];return a.objectValues(n)},a.objectValues=s=>a.objectKeys(s).map(function(i){return s[i]}),a.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let n in s)Object.prototype.hasOwnProperty.call(s,n)&&i.push(n);return i},a.find=(s,i)=>{for(let n of s)if(i(n))return n},a.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function t(s,i=" | "){return s.map(n=>typeof n=="string"?`'${n}'`:n).join(i)}a.joinValues=t,a.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Ze||(Ze={}));var Bp;(function(a){a.mergeShapes=(e,r)=>({...e,...r})})(Bp||(Bp={}));var ue=Ze.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Lr=a=>{switch(typeof a){case"undefined":return ue.undefined;case"string":return ue.string;case"number":return Number.isNaN(a)?ue.nan:ue.number;case"boolean":return ue.boolean;case"function":return ue.function;case"bigint":return ue.bigint;case"symbol":return ue.symbol;case"object":return Array.isArray(a)?ue.array:a===null?ue.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?ue.promise:typeof Map<"u"&&a instanceof Map?ue.map:typeof Set<"u"&&a instanceof Set?ue.set:typeof Date<"u"&&a instanceof Date?ue.date:ue.object;default:return ue.unknown}};var Y=Ze.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"]),K4=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ft=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=t=>{this.issues=[...this.issues,t]},this.addIssues=(t=[])=>{this.issues=[...this.issues,...t]};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(i){return i.message},t={_errors:[]},s=i=>{for(let n of i.issues)if(n.code==="invalid_union")n.unionErrors.map(s);else if(n.code==="invalid_return_type")s(n.returnTypeError);else if(n.code==="invalid_arguments")s(n.argumentsError);else if(n.path.length===0)t._errors.push(r(n));else{let o=t,l=0;for(;lr.message){let r={},t=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];r[i]=r[i]||[],r[i].push(e(s))}else t.push(e(s));return{formErrors:t,fieldErrors:r}}get formErrors(){return this.flatten()}};Ft.create=a=>new Ft(a);var X4=(a,e)=>{let r;switch(a.code){case Y.invalid_type:a.received===ue.undefined?r="Required":r=`Expected ${a.expected}, received ${a.received}`;break;case Y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(a.expected,Ze.jsonStringifyReplacer)}`;break;case Y.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ze.joinValues(a.keys,", ")}`;break;case Y.invalid_union:r="Invalid input";break;case Y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ze.joinValues(a.options)}`;break;case Y.invalid_enum_value:r=`Invalid enum value. Expected ${Ze.joinValues(a.options)}, received '${a.received}'`;break;case Y.invalid_arguments:r="Invalid function arguments";break;case Y.invalid_return_type:r="Invalid function return type";break;case Y.invalid_date:r="Invalid date";break;case Y.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(r=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?r=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?r=`Invalid input: must end with "${a.validation.endsWith}"`:Ze.assertNever(a.validation):a.validation!=="regex"?r=`Invalid ${a.validation}`:r="Invalid";break;case Y.too_small:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:r="Invalid input";break;case Y.too_big:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?r=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:r="Invalid input";break;case Y.custom:r="Invalid input";break;case Y.invalid_intersection_types:r="Intersection results could not be merged";break;case Y.not_multiple_of:r=`Number must be a multiple of ${a.multipleOf}`;break;case Y.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ze.assertNever(a)}return{message:r}},Yr=X4;var Tx=Yr;function Q4(a){Tx=a}function vn(){return Tx}var Ai=a=>{let{data:e,path:r,errorMaps:t,issueData:s}=a,i=[...r,...s.path||[]],n={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let o="",l=t.filter(c=>!!c).slice().reverse();for(let c of l)o=c(n,{data:e,defaultError:o}).message;return{...s,path:i,message:o}},J4=[];function ne(a,e){let r=vn(),t=Ai({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,r,r===Yr?void 0:Yr].filter(s=>!!s)});a.common.issues.push(t)}var wt=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let t=[];for(let s of r){if(s.status==="aborted")return Re;s.status==="dirty"&&e.dirty(),t.push(s.value)}return{status:e.value,value:t}}static async mergeObjectAsync(e,r){let t=[];for(let s of r){let i=await s.key,n=await s.value;t.push({key:i,value:n})}return a.mergeObjectSync(e,t)}static mergeObjectSync(e,r){let t={};for(let s of r){let{key:i,value:n}=s;if(i.status==="aborted"||n.status==="aborted")return Re;i.status==="dirty"&&e.dirty(),n.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof n.value<"u"||s.alwaysSet)&&(t[i.value]=n.value)}return{status:e.value,value:t}}},Re=Object.freeze({status:"aborted"}),ts=a=>({status:"dirty",value:a}),Ot=a=>({status:"valid",value:a}),dc=a=>a.status==="aborted",fc=a=>a.status==="dirty",wa=a=>a.status==="valid",gn=a=>typeof Promise<"u"&&a instanceof Promise;var ge;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(ge||(ge={}));var cr=class{constructor(e,r,t,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=t,this._key=s}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}},Rx=(a,e)=>{if(wa(e))return{success:!0,data:e.value};if(!a.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 Ft(a.common.issues);return this._error=r,this._error}}};function Fe(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:t,description:s}=a;if(e&&(r||t))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(n,o)=>{let{message:l}=a;return n.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??t??o.defaultError}:n.code!=="invalid_type"?{message:o.defaultError}:{message:l??r??o.defaultError}},description:s}}var He=class{get description(){return this._def.description}_getType(e){return Lr(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Lr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new wt,ctx:{common:e.parent.common,data:e.data,parsedType:Lr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(gn(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 t=this.safeParse(e,r);if(t.success)return t.data;throw t.error}safeParse(e,r){let t={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Lr(e)},s=this._parseSync({data:e,path:t.path,parent:t});return Rx(t,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Lr(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:r});return wa(t)?{value:t.value}:{issues:r.common.issues}}catch(t){t?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(t=>wa(t)?{value:t.value}:{issues:r.common.issues})}async parseAsync(e,r){let t=await this.safeParseAsync(e,r);if(t.success)return t.data;throw t.error}async safeParseAsync(e,r){let t={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Lr(e)},s=this._parse({data:e,path:t.path,parent:t}),i=await(gn(s)?s:Promise.resolve(s));return Rx(t,i)}refine(e,r){let t=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,i)=>{let n=e(s),o=()=>i.addIssue({code:Y.custom,...t(s)});return typeof Promise<"u"&&n instanceof Promise?n.then(l=>l?!0:(o(),!1)):n?!0:(o(),!1)})}refinement(e,r){return this._refinement((t,s)=>e(t)?!0:(s.addIssue(typeof r=="function"?r(t,s):r),!1))}_refinement(e){return new lr({schema:this,typeName:Oe.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 or.create(this,this._def)}nullable(){return Fr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ra.create(this)}promise(){return Pa.create(this,this._def)}or(e){return cs.create([this,e],this._def)}and(e){return ls.create(this,e,this._def)}transform(e){return new lr({...Fe(this._def),schema:this,typeName:Oe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ms({...Fe(this._def),innerType:this,defaultValue:r,typeName:Oe.ZodDefault})}brand(){return new Ni({typeName:Oe.ZodBranded,type:this,...Fe(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new hs({...Fe(this._def),innerType:this,catchValue:r,typeName:Oe.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Di.create(this,e)}readonly(){return vs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Y4=/^c[^\s-]{8,}$/i,e2=/^[0-9a-z]+$/,t2=/^[0-9A-HJKMNP-TV-Z]{26}$/i,r2=/^[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,a2=/^[a-z0-9_-]{21}$/i,s2=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,n2=/^[-+]?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)?)??$/,i2=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,o2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Hp,c2=/^(?:(?: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])$/,l2=/^(?:(?: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])$/,u2=/^(([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]))$/,p2=/^(([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])$/,d2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,f2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ox="((\\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])))",m2=new RegExp(`^${Ox}$`);function Cx(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let r=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function h2(a){return new RegExp(`^${Cx(a)}$`)}function kx(a){let e=`${Ox}T${Cx(a)}`,r=[];return r.push(a.local?"Z?":"Z"),a.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function v2(a,e){return!!((e==="v4"||!e)&&c2.test(a)||(e==="v6"||!e)&&u2.test(a))}function g2(a,e){if(!s2.test(a))return!1;try{let[r]=a.split(".");if(!r)return!1;let t=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(t));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function y2(a,e){return!!((e==="v4"||!e)&&l2.test(a)||(e==="v6"||!e)&&p2.test(a))}var Ta=class a extends He{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ue.string){let i=this._getOrReturnCtx(e);return ne(i,{code:Y.invalid_type,expected:ue.string,received:i.parsedType}),Re}let t=new wt,s;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(s=this._getOrReturnCtx(e,s),ne(s,{code:Y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if(i.kind==="length"){let n=e.data.length>i.value,o=e.data.lengthe.test(s),{validation:r,code:Y.invalid_string,...ge.errToObj(t)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ge.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ge.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ge.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ge.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ge.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ge.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ge.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ge.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ge.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ge.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ge.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ge.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ge.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,...ge.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,...ge.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ge.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ge.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ge.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ge.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ge.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ge.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ge.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ge.errToObj(r)})}nonempty(e){return this.min(1,ge.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...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 Ta({checks:[],typeName:Oe.ZodString,coerce:a?.coerce??!1,...Fe(a)});function b2(a,e){let r=(a.toString().split(".")[1]||"").length,t=(e.toString().split(".")[1]||"").length,s=r>t?r:t,i=Number.parseInt(a.toFixed(s).replace(".","")),n=Number.parseInt(e.toFixed(s).replace(".",""));return i%n/10**s}var rs=class a extends He{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)!==ue.number){let i=this._getOrReturnCtx(e);return ne(i,{code:Y.invalid_type,expected:ue.number,received:i.parsedType}),Re}let t,s=new wt;for(let i of this._def.checks)i.kind==="int"?Ze.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ne(t,{code:Y.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),ne(t,{code:Y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?b2(e.data,i.value)!==0&&(t=this._getOrReturnCtx(e,t),ne(t,{code:Y.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ne(t,{code:Y.not_finite,message:i.message}),s.dirty()):Ze.assertNever(i);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ge.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ge.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ge.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ge.toString(r))}setLimit(e,r,t,s){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:t,message:ge.toString(s)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ge.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ge.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ge.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ge.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ge.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ge.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ge.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ge.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ge.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"&&Ze.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let t of this._def.checks){if(t.kind==="finite"||t.kind==="int"||t.kind==="multipleOf")return!0;t.kind==="min"?(r===null||t.value>r)&&(r=t.value):t.kind==="max"&&(e===null||t.valuenew rs({checks:[],typeName:Oe.ZodNumber,coerce:a?.coerce||!1,...Fe(a)});var as=class a extends He{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)!==ue.bigint)return this._getInvalidInput(e);let t,s=new wt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),ne(t,{code:Y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ne(t,{code:Y.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Ze.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ne(r,{code:Y.invalid_type,expected:ue.bigint,received:r.parsedType}),Re}gte(e,r){return this.setLimit("min",e,!0,ge.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ge.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ge.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ge.toString(r))}setLimit(e,r,t,s){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:t,message:ge.toString(s)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ge.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ge.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ge.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ge.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ge.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 as({checks:[],typeName:Oe.ZodBigInt,coerce:a?.coerce??!1,...Fe(a)});var ss=class extends He{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ue.boolean){let t=this._getOrReturnCtx(e);return ne(t,{code:Y.invalid_type,expected:ue.boolean,received:t.parsedType}),Re}return Ot(e.data)}};ss.create=a=>new ss({typeName:Oe.ZodBoolean,coerce:a?.coerce||!1,...Fe(a)});var ns=class a extends He{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ue.date){let i=this._getOrReturnCtx(e);return ne(i,{code:Y.invalid_type,expected:ue.date,received:i.parsedType}),Re}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return ne(i,{code:Y.invalid_date}),Re}let t=new wt,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(s=this._getOrReturnCtx(e,s),ne(s,{code:Y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),t.dirty()):Ze.assertNever(i);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ge.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ge.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 ns({checks:[],coerce:a?.coerce||!1,typeName:Oe.ZodDate,...Fe(a)});var bn=class extends He{_parse(e){if(this._getType(e)!==ue.symbol){let t=this._getOrReturnCtx(e);return ne(t,{code:Y.invalid_type,expected:ue.symbol,received:t.parsedType}),Re}return Ot(e.data)}};bn.create=a=>new bn({typeName:Oe.ZodSymbol,...Fe(a)});var is=class extends He{_parse(e){if(this._getType(e)!==ue.undefined){let t=this._getOrReturnCtx(e);return ne(t,{code:Y.invalid_type,expected:ue.undefined,received:t.parsedType}),Re}return Ot(e.data)}};is.create=a=>new is({typeName:Oe.ZodUndefined,...Fe(a)});var os=class extends He{_parse(e){if(this._getType(e)!==ue.null){let t=this._getOrReturnCtx(e);return ne(t,{code:Y.invalid_type,expected:ue.null,received:t.parsedType}),Re}return Ot(e.data)}};os.create=a=>new os({typeName:Oe.ZodNull,...Fe(a)});var Ra=class extends He{constructor(){super(...arguments),this._any=!0}_parse(e){return Ot(e.data)}};Ra.create=a=>new Ra({typeName:Oe.ZodAny,...Fe(a)});var ta=class extends He{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ot(e.data)}};ta.create=a=>new ta({typeName:Oe.ZodUnknown,...Fe(a)});var Rr=class extends He{_parse(e){let r=this._getOrReturnCtx(e);return ne(r,{code:Y.invalid_type,expected:ue.never,received:r.parsedType}),Re}};Rr.create=a=>new Rr({typeName:Oe.ZodNever,...Fe(a)});var xn=class extends He{_parse(e){if(this._getType(e)!==ue.undefined){let t=this._getOrReturnCtx(e);return ne(t,{code:Y.invalid_type,expected:ue.void,received:t.parsedType}),Re}return Ot(e.data)}};xn.create=a=>new xn({typeName:Oe.ZodVoid,...Fe(a)});var ra=class a extends He{_parse(e){let{ctx:r,status:t}=this._processInputParams(e),s=this._def;if(r.parsedType!==ue.array)return ne(r,{code:Y.invalid_type,expected:ue.array,received:r.parsedType}),Re;if(s.exactLength!==null){let n=r.data.length>s.exactLength.value,o=r.data.lengths.maxLength.value&&(ne(r,{code:Y.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),t.dirty()),r.common.async)return Promise.all([...r.data].map((n,o)=>s.type._parseAsync(new cr(r,n,r.path,o)))).then(n=>wt.mergeArray(t,n));let i=[...r.data].map((n,o)=>s.type._parseSync(new cr(r,n,r.path,o)));return wt.mergeArray(t,i)}get element(){return this._def.type}min(e,r){return new a({...this._def,minLength:{value:e,message:ge.toString(r)}})}max(e,r){return new a({...this._def,maxLength:{value:e,message:ge.toString(r)}})}length(e,r){return new a({...this._def,exactLength:{value:e,message:ge.toString(r)}})}nonempty(e){return this.min(1,e)}};ra.create=(a,e)=>new ra({type:a,minLength:null,maxLength:null,exactLength:null,typeName:Oe.ZodArray,...Fe(e)});function yn(a){if(a instanceof Ut){let e={};for(let r in a.shape){let t=a.shape[r];e[r]=or.create(yn(t))}return new Ut({...a._def,shape:()=>e})}else return a instanceof ra?new ra({...a._def,type:yn(a.element)}):a instanceof or?or.create(yn(a.unwrap())):a instanceof Fr?Fr.create(yn(a.unwrap())):a instanceof qr?qr.create(a.items.map(e=>yn(e))):a}var Ut=class a extends He{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=Ze.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==ue.object){let c=this._getOrReturnCtx(e);return ne(c,{code:Y.invalid_type,expected:ue.object,received:c.parsedType}),Re}let{status:t,ctx:s}=this._processInputParams(e),{shape:i,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof Rr&&this._def.unknownKeys==="strip"))for(let c in s.data)n.includes(c)||o.push(c);let l=[];for(let c of n){let u=i[c],p=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new cr(s,p,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Rr){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of o)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")o.length>0&&(ne(s,{code:Y.unrecognized_keys,keys:o}),t.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of o){let p=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new cr(s,p,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,f=await u.value;c.push({key:p,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>wt.mergeObjectSync(t,c)):wt.mergeObjectSync(t,l)}get shape(){return this._def.shape()}strict(e){return ge.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,t)=>{let s=this._def.errorMap?.(r,t).message??t.defaultError;return r.code==="unrecognized_keys"?{message:ge.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Oe.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let r={};for(let t of Ze.objectKeys(e))e[t]&&this.shape[t]&&(r[t]=this.shape[t]);return new a({...this._def,shape:()=>r})}omit(e){let r={};for(let t of Ze.objectKeys(this.shape))e[t]||(r[t]=this.shape[t]);return new a({...this._def,shape:()=>r})}deepPartial(){return yn(this)}partial(e){let r={};for(let t of Ze.objectKeys(this.shape)){let s=this.shape[t];e&&!e[t]?r[t]=s:r[t]=s.optional()}return new a({...this._def,shape:()=>r})}required(e){let r={};for(let t of Ze.objectKeys(this.shape))if(e&&!e[t])r[t]=this.shape[t];else{let i=this.shape[t];for(;i instanceof or;)i=i._def.innerType;r[t]=i}return new a({...this._def,shape:()=>r})}keyof(){return Ix(Ze.objectKeys(this.shape))}};Ut.create=(a,e)=>new Ut({shape:()=>a,unknownKeys:"strip",catchall:Rr.create(),typeName:Oe.ZodObject,...Fe(e)});Ut.strictCreate=(a,e)=>new Ut({shape:()=>a,unknownKeys:"strict",catchall:Rr.create(),typeName:Oe.ZodObject,...Fe(e)});Ut.lazycreate=(a,e)=>new Ut({shape:a,unknownKeys:"strip",catchall:Rr.create(),typeName:Oe.ZodObject,...Fe(e)});var cs=class extends He{_parse(e){let{ctx:r}=this._processInputParams(e),t=this._def.options;function s(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let n=i.map(o=>new Ft(o.ctx.common.issues));return ne(r,{code:Y.invalid_union,unionErrors:n}),Re}if(r.common.async)return Promise.all(t.map(async i=>{let n={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:n}),ctx:n}})).then(s);{let i,n=[];for(let l of t){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&n.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let o=n.map(l=>new Ft(l));return ne(r,{code:Y.invalid_union,unionErrors:o}),Re}}get options(){return this._def.options}};cs.create=(a,e)=>new cs({options:a,typeName:Oe.ZodUnion,...Fe(e)});var ea=a=>a instanceof us?ea(a.schema):a instanceof lr?ea(a.innerType()):a instanceof ps?[a.value]:a instanceof ds?a.options:a instanceof fs?Ze.objectValues(a.enum):a instanceof ms?ea(a._def.innerType):a instanceof is?[void 0]:a instanceof os?[null]:a instanceof or?[void 0,...ea(a.unwrap())]:a instanceof Fr?[null,...ea(a.unwrap())]:a instanceof Ni||a instanceof vs?ea(a.unwrap()):a instanceof hs?ea(a._def.innerType):[],mc=class a extends He{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ue.object)return ne(r,{code:Y.invalid_type,expected:ue.object,received:r.parsedType}),Re;let t=this.discriminator,s=r.data[t],i=this.optionsMap.get(s);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ne(r,{code:Y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[t]}),Re)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,t){let s=new Map;for(let i of r){let n=ea(i.shape[e]);if(!n.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of n){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,i)}}return new a({typeName:Oe.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...Fe(t)})}};function Vp(a,e){let r=Lr(a),t=Lr(e);if(a===e)return{valid:!0,data:a};if(r===ue.object&&t===ue.object){let s=Ze.objectKeys(e),i=Ze.objectKeys(a).filter(o=>s.indexOf(o)!==-1),n={...a,...e};for(let o of i){let l=Vp(a[o],e[o]);if(!l.valid)return{valid:!1};n[o]=l.data}return{valid:!0,data:n}}else if(r===ue.array&&t===ue.array){if(a.length!==e.length)return{valid:!1};let s=[];for(let i=0;i{if(dc(i)||dc(n))return Re;let o=Vp(i.value,n.value);return o.valid?((fc(i)||fc(n))&&r.dirty(),{status:r.value,value:o.data}):(ne(t,{code:Y.invalid_intersection_types}),Re)};return t.common.async?Promise.all([this._def.left._parseAsync({data:t.data,path:t.path,parent:t}),this._def.right._parseAsync({data:t.data,path:t.path,parent:t})]).then(([i,n])=>s(i,n)):s(this._def.left._parseSync({data:t.data,path:t.path,parent:t}),this._def.right._parseSync({data:t.data,path:t.path,parent:t}))}};ls.create=(a,e,r)=>new ls({left:a,right:e,typeName:Oe.ZodIntersection,...Fe(r)});var qr=class a extends He{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==ue.array)return ne(t,{code:Y.invalid_type,expected:ue.array,received:t.parsedType}),Re;if(t.data.lengththis._def.items.length&&(ne(t,{code:Y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...t.data].map((n,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new cr(t,n,t.path,o)):null}).filter(n=>!!n);return t.common.async?Promise.all(i).then(n=>wt.mergeArray(r,n)):wt.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};qr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new qr({items:a,typeName:Oe.ZodTuple,rest:null,...Fe(e)})};var hc=class a extends He{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==ue.object)return ne(t,{code:Y.invalid_type,expected:ue.object,received:t.parsedType}),Re;let s=[],i=this._def.keyType,n=this._def.valueType;for(let o in t.data)s.push({key:i._parse(new cr(t,o,t.path,o)),value:n._parse(new cr(t,t.data[o],t.path,o)),alwaysSet:o in t.data});return t.common.async?wt.mergeObjectAsync(r,s):wt.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,t){return r instanceof He?new a({keyType:e,valueType:r,typeName:Oe.ZodRecord,...Fe(t)}):new a({keyType:Ta.create(),valueType:e,typeName:Oe.ZodRecord,...Fe(r)})}},_n=class extends He{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==ue.map)return ne(t,{code:Y.invalid_type,expected:ue.map,received:t.parsedType}),Re;let s=this._def.keyType,i=this._def.valueType,n=[...t.data.entries()].map(([o,l],c)=>({key:s._parse(new cr(t,o,t.path,[c,"key"])),value:i._parse(new cr(t,l,t.path,[c,"value"]))}));if(t.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let l of n){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Re;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let l of n){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Re;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),o.set(c.value,u.value)}return{status:r.value,value:o}}}};_n.create=(a,e,r)=>new _n({valueType:e,keyType:a,typeName:Oe.ZodMap,...Fe(r)});var En=class a extends He{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==ue.set)return ne(t,{code:Y.invalid_type,expected:ue.set,received:t.parsedType}),Re;let s=this._def;s.minSize!==null&&t.data.sizes.maxSize.value&&(ne(t,{code:Y.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let i=this._def.valueType;function n(l){let c=new Set;for(let u of l){if(u.status==="aborted")return Re;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let o=[...t.data.values()].map((l,c)=>i._parse(new cr(t,l,t.path,c)));return t.common.async?Promise.all(o).then(l=>n(l)):n(o)}min(e,r){return new a({...this._def,minSize:{value:e,message:ge.toString(r)}})}max(e,r){return new a({...this._def,maxSize:{value:e,message:ge.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};En.create=(a,e)=>new En({valueType:a,minSize:null,maxSize:null,typeName:Oe.ZodSet,...Fe(e)});var vc=class a extends He{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ue.function)return ne(r,{code:Y.invalid_type,expected:ue.function,received:r.parsedType}),Re;function t(o,l){return Ai({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,vn(),Yr].filter(c=>!!c),issueData:{code:Y.invalid_arguments,argumentsError:l}})}function s(o,l){return Ai({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,vn(),Yr].filter(c=>!!c),issueData:{code:Y.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},n=r.data;if(this._def.returns instanceof Pa){let o=this;return Ot(async function(...l){let c=new Ft([]),u=await o._def.args.parseAsync(l,i).catch(d=>{throw c.addIssue(t(l,d)),c}),p=await Reflect.apply(n,this,u);return await o._def.returns._def.type.parseAsync(p,i).catch(d=>{throw c.addIssue(s(p,d)),c})})}else{let o=this;return Ot(function(...l){let c=o._def.args.safeParse(l,i);if(!c.success)throw new Ft([t(l,c.error)]);let u=Reflect.apply(n,this,c.data),p=o._def.returns.safeParse(u,i);if(!p.success)throw new Ft([s(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:qr.create(e).rest(ta.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,t){return new a({args:e||qr.create([]).rest(ta.create()),returns:r||ta.create(),typeName:Oe.ZodFunction,...Fe(t)})}},us=class extends He{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})}};us.create=(a,e)=>new us({getter:a,typeName:Oe.ZodLazy,...Fe(e)});var ps=class extends He{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ne(r,{received:r.data,code:Y.invalid_literal,expected:this._def.value}),Re}return{status:"valid",value:e.data}}get value(){return this._def.value}};ps.create=(a,e)=>new ps({value:a,typeName:Oe.ZodLiteral,...Fe(e)});function Ix(a,e){return new ds({values:a,typeName:Oe.ZodEnum,...Fe(e)})}var ds=class a extends He{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),t=this._def.values;return ne(r,{expected:Ze.joinValues(t),received:r.parsedType,code:Y.invalid_type}),Re}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),t=this._def.values;return ne(r,{received:r.data,code:Y.invalid_enum_value,options:t}),Re}return Ot(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 a.create(e,{...this._def,...r})}exclude(e,r=this._def){return a.create(this.options.filter(t=>!e.includes(t)),{...this._def,...r})}};ds.create=Ix;var fs=class extends He{_parse(e){let r=Ze.getValidEnumValues(this._def.values),t=this._getOrReturnCtx(e);if(t.parsedType!==ue.string&&t.parsedType!==ue.number){let s=Ze.objectValues(r);return ne(t,{expected:Ze.joinValues(s),received:t.parsedType,code:Y.invalid_type}),Re}if(this._cache||(this._cache=new Set(Ze.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=Ze.objectValues(r);return ne(t,{received:t.data,code:Y.invalid_enum_value,options:s}),Re}return Ot(e.data)}get enum(){return this._def.values}};fs.create=(a,e)=>new fs({values:a,typeName:Oe.ZodNativeEnum,...Fe(e)});var Pa=class extends He{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ue.promise&&r.common.async===!1)return ne(r,{code:Y.invalid_type,expected:ue.promise,received:r.parsedType}),Re;let t=r.parsedType===ue.promise?r.data:Promise.resolve(r.data);return Ot(t.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Pa.create=(a,e)=>new Pa({type:a,typeName:Oe.ZodPromise,...Fe(e)});var lr=class extends He{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Oe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:t}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:n=>{ne(t,n),n.fatal?r.abort():r.dirty()},get path(){return t.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let n=s.transform(t.data,i);if(t.common.async)return Promise.resolve(n).then(async o=>{if(r.value==="aborted")return Re;let l=await this._def.schema._parseAsync({data:o,path:t.path,parent:t});return l.status==="aborted"?Re:l.status==="dirty"?ts(l.value):r.value==="dirty"?ts(l.value):l});{if(r.value==="aborted")return Re;let o=this._def.schema._parseSync({data:n,path:t.path,parent:t});return o.status==="aborted"?Re:o.status==="dirty"?ts(o.value):r.value==="dirty"?ts(o.value):o}}if(s.type==="refinement"){let n=o=>{let l=s.refinement(o,i);if(t.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(t.common.async===!1){let o=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});return o.status==="aborted"?Re:(o.status==="dirty"&&r.dirty(),n(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(o=>o.status==="aborted"?Re:(o.status==="dirty"&&r.dirty(),n(o.value).then(()=>({status:r.value,value:o.value}))))}if(s.type==="transform")if(t.common.async===!1){let n=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});if(!wa(n))return Re;let o=s.transform(n.value,i);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:t.data,path:t.path,parent:t}).then(n=>wa(n)?Promise.resolve(s.transform(n.value,i)).then(o=>({status:r.value,value:o})):Re);Ze.assertNever(s)}};lr.create=(a,e,r)=>new lr({schema:a,typeName:Oe.ZodEffects,effect:e,...Fe(r)});lr.createWithPreprocess=(a,e,r)=>new lr({schema:e,effect:{type:"preprocess",transform:a},typeName:Oe.ZodEffects,...Fe(r)});var or=class extends He{_parse(e){return this._getType(e)===ue.undefined?Ot(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};or.create=(a,e)=>new or({innerType:a,typeName:Oe.ZodOptional,...Fe(e)});var Fr=class extends He{_parse(e){return this._getType(e)===ue.null?Ot(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Fr.create=(a,e)=>new Fr({innerType:a,typeName:Oe.ZodNullable,...Fe(e)});var ms=class extends He{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return r.parsedType===ue.undefined&&(t=this._def.defaultValue()),this._def.innerType._parse({data:t,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ms.create=(a,e)=>new ms({innerType:a,typeName:Oe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Fe(e)});var hs=class extends He{_parse(e){let{ctx:r}=this._processInputParams(e),t={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:t.data,path:t.path,parent:{...t}});return gn(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ft(t.common.issues)},input:t.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ft(t.common.issues)},input:t.data})}}removeCatch(){return this._def.innerType}};hs.create=(a,e)=>new hs({innerType:a,typeName:Oe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Fe(e)});var Sn=class extends He{_parse(e){if(this._getType(e)!==ue.nan){let t=this._getOrReturnCtx(e);return ne(t,{code:Y.invalid_type,expected:ue.nan,received:t.parsedType}),Re}return{status:"valid",value:e.data}}};Sn.create=a=>new Sn({typeName:Oe.ZodNaN,...Fe(a)});var x2=Symbol("zod_brand"),Ni=class extends He{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return this._def.type._parse({data:t,path:r.path,parent:r})}unwrap(){return this._def.type}},Di=class a extends He{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:t.data,path:t.path,parent:t});return i.status==="aborted"?Re:i.status==="dirty"?(r.dirty(),ts(i.value)):this._def.out._parseAsync({data:i.value,path:t.path,parent:t})})();{let s=this._def.in._parseSync({data:t.data,path:t.path,parent:t});return s.status==="aborted"?Re:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:t.path,parent:t})}}static create(e,r){return new a({in:e,out:r,typeName:Oe.ZodPipeline})}},vs=class extends He{_parse(e){let r=this._def.innerType._parse(e),t=s=>(wa(s)&&(s.value=Object.freeze(s.value)),s);return gn(r)?r.then(s=>t(s)):t(r)}unwrap(){return this._def.innerType}};vs.create=(a,e)=>new vs({innerType:a,typeName:Oe.ZodReadonly,...Fe(e)});function Px(a,e){let r=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof r=="string"?{message:r}:r}function Ax(a,e={},r){return a?Ra.create().superRefine((t,s)=>{let i=a(t);if(i instanceof Promise)return i.then(n=>{if(!n){let o=Px(e,t),l=o.fatal??r??!0;s.addIssue({code:"custom",...o,fatal:l})}});if(!i){let n=Px(e,t),o=n.fatal??r??!0;s.addIssue({code:"custom",...n,fatal:o})}}):Ra.create()}var _2={object:Ut.lazycreate},Oe;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(Oe||(Oe={}));var E2=(a,e={message:`Input not instance of ${a.name}`})=>Ax(r=>r instanceof a,e),Nx=Ta.create,Dx=rs.create,S2=Sn.create,w2=as.create,jx=ss.create,T2=ns.create,R2=bn.create,P2=is.create,O2=os.create,C2=Ra.create,k2=ta.create,I2=Rr.create,A2=xn.create,N2=ra.create,D2=Ut.create,j2=Ut.strictCreate,$2=cs.create,M2=mc.create,L2=ls.create,q2=qr.create,F2=hc.create,U2=_n.create,z2=En.create,B2=vc.create,H2=us.create,V2=ps.create,W2=ds.create,G2=fs.create,Z2=Pa.create,K2=lr.create,X2=or.create,Q2=Fr.create,J2=lr.createWithPreprocess,Y2=Di.create,eN=()=>Nx().optional(),tN=()=>Dx().optional(),rN=()=>jx().optional(),aN={string:(a=>Ta.create({...a,coerce:!0})),number:(a=>rs.create({...a,coerce:!0})),boolean:(a=>ss.create({...a,coerce:!0})),bigint:(a=>as.create({...a,coerce:!0})),date:(a=>ns.create({...a,coerce:!0}))};var sN=Re;var Wp="2025-06-18";var $x=[Wp,"2025-03-26","2024-11-05","2024-10-07"],gc="2.0",Mx=E.union([E.string(),E.number().int()]),Lx=E.string(),nN=E.object({progressToken:E.optional(Mx)}).passthrough(),dr=E.object({_meta:E.optional(nN)}).passthrough(),zt=E.object({method:E.string(),params:E.optional(dr)}),ji=E.object({_meta:E.optional(E.object({}).passthrough())}).passthrough(),Ur=E.object({method:E.string(),params:E.optional(ji)}),fr=E.object({_meta:E.optional(E.object({}).passthrough())}).passthrough(),yc=E.union([E.string(),E.number().int()]),qx=E.object({jsonrpc:E.literal(gc),id:yc}).merge(zt).strict(),Fx=a=>qx.safeParse(a).success,Ux=E.object({jsonrpc:E.literal(gc)}).merge(Ur).strict(),zx=a=>Ux.safeParse(a).success,Bx=E.object({jsonrpc:E.literal(gc),id:yc,result:fr}).strict(),Gp=a=>Bx.safeParse(a).success,ur;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(ur||(ur={}));var Hx=E.object({jsonrpc:E.literal(gc),id:yc,error:E.object({code:E.number().int(),message:E.string(),data:E.optional(E.unknown())})}).strict(),Vx=a=>Hx.safeParse(a).success,Wx=E.union([qx,Ux,Bx,Hx]),gs=fr.strict(),bc=Ur.extend({method:E.literal("notifications/cancelled"),params:ji.extend({requestId:yc,reason:E.string().optional()})}),iN=E.object({src:E.string(),mimeType:E.optional(E.string()),sizes:E.optional(E.array(E.string()))}).passthrough(),$i=E.object({icons:E.array(iN).optional()}).passthrough(),Mi=E.object({name:E.string(),title:E.optional(E.string())}).passthrough(),Gx=Mi.extend({version:E.string(),websiteUrl:E.optional(E.string())}).merge($i),oN=E.object({experimental:E.optional(E.object({}).passthrough()),sampling:E.optional(E.object({}).passthrough()),elicitation:E.optional(E.object({}).passthrough()),roots:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough())}).passthrough(),cN=zt.extend({method:E.literal("initialize"),params:dr.extend({protocolVersion:E.string(),capabilities:oN,clientInfo:Gx})});var lN=E.object({experimental:E.optional(E.object({}).passthrough()),logging:E.optional(E.object({}).passthrough()),completions:E.optional(E.object({}).passthrough()),prompts:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough()),resources:E.optional(E.object({subscribe:E.optional(E.boolean()),listChanged:E.optional(E.boolean())}).passthrough()),tools:E.optional(E.object({listChanged:E.optional(E.boolean())}).passthrough())}).passthrough(),Zp=fr.extend({protocolVersion:E.string(),capabilities:lN,serverInfo:Gx,instructions:E.optional(E.string())}),uN=Ur.extend({method:E.literal("notifications/initialized")});var xc=zt.extend({method:E.literal("ping")}),pN=E.object({progress:E.number(),total:E.optional(E.number()),message:E.optional(E.string())}).passthrough(),_c=Ur.extend({method:E.literal("notifications/progress"),params:ji.merge(pN).extend({progressToken:Mx})}),Ec=zt.extend({params:dr.extend({cursor:E.optional(Lx)}).optional()}),Sc=fr.extend({nextCursor:E.optional(Lx)}),Zx=E.object({uri:E.string(),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).passthrough(),Kx=Zx.extend({text:E.string()}),Kp=E.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),Xx=Zx.extend({blob:Kp}),Qx=Mi.extend({uri:E.string(),description:E.optional(E.string()),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).merge($i),dN=Mi.extend({uriTemplate:E.string(),description:E.optional(E.string()),mimeType:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).merge($i),fN=Ec.extend({method:E.literal("resources/list")}),Xp=Sc.extend({resources:E.array(Qx)}),mN=Ec.extend({method:E.literal("resources/templates/list")}),Qp=Sc.extend({resourceTemplates:E.array(dN)}),hN=zt.extend({method:E.literal("resources/read"),params:dr.extend({uri:E.string()})}),Jp=fr.extend({contents:E.array(E.union([Kx,Xx]))}),vN=Ur.extend({method:E.literal("notifications/resources/list_changed")}),gN=zt.extend({method:E.literal("resources/subscribe"),params:dr.extend({uri:E.string()})}),yN=zt.extend({method:E.literal("resources/unsubscribe"),params:dr.extend({uri:E.string()})}),bN=Ur.extend({method:E.literal("notifications/resources/updated"),params:ji.extend({uri:E.string()})}),xN=E.object({name:E.string(),description:E.optional(E.string()),required:E.optional(E.boolean())}).passthrough(),_N=Mi.extend({description:E.optional(E.string()),arguments:E.optional(E.array(xN)),_meta:E.optional(E.object({}).passthrough())}).merge($i),EN=Ec.extend({method:E.literal("prompts/list")}),Yp=Sc.extend({prompts:E.array(_N)}),SN=zt.extend({method:E.literal("prompts/get"),params:dr.extend({name:E.string(),arguments:E.optional(E.record(E.string()))})}),ed=E.object({type:E.literal("text"),text:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),td=E.object({type:E.literal("image"),data:Kp,mimeType:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),rd=E.object({type:E.literal("audio"),data:Kp,mimeType:E.string(),_meta:E.optional(E.object({}).passthrough())}).passthrough(),wN=E.object({type:E.literal("resource"),resource:E.union([Kx,Xx]),_meta:E.optional(E.object({}).passthrough())}).passthrough(),TN=Qx.extend({type:E.literal("resource_link")}),Jx=E.union([ed,td,rd,TN,wN]),RN=E.object({role:E.enum(["user","assistant"]),content:Jx}).passthrough(),ad=fr.extend({description:E.optional(E.string()),messages:E.array(RN)}),PN=Ur.extend({method:E.literal("notifications/prompts/list_changed")}),ON=E.object({title:E.optional(E.string()),readOnlyHint:E.optional(E.boolean()),destructiveHint:E.optional(E.boolean()),idempotentHint:E.optional(E.boolean()),openWorldHint:E.optional(E.boolean())}).passthrough(),CN=Mi.extend({description:E.optional(E.string()),inputSchema:E.object({type:E.literal("object"),properties:E.optional(E.object({}).passthrough()),required:E.optional(E.array(E.string()))}).passthrough(),outputSchema:E.optional(E.object({type:E.literal("object"),properties:E.optional(E.object({}).passthrough()),required:E.optional(E.array(E.string()))}).passthrough()),annotations:E.optional(ON),_meta:E.optional(E.object({}).passthrough())}).merge($i),kN=Ec.extend({method:E.literal("tools/list")}),sd=Sc.extend({tools:E.array(CN)}),wc=fr.extend({content:E.array(Jx).default([]),structuredContent:E.object({}).passthrough().optional(),isError:E.optional(E.boolean())}),$F=wc.or(fr.extend({toolResult:E.unknown()})),IN=zt.extend({method:E.literal("tools/call"),params:dr.extend({name:E.string(),arguments:E.optional(E.record(E.unknown()))})}),AN=Ur.extend({method:E.literal("notifications/tools/list_changed")}),Yx=E.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),NN=zt.extend({method:E.literal("logging/setLevel"),params:dr.extend({level:Yx})}),DN=Ur.extend({method:E.literal("notifications/message"),params:ji.extend({level:Yx,logger:E.optional(E.string()),data:E.unknown()})}),jN=E.object({name:E.string().optional()}).passthrough(),$N=E.object({hints:E.optional(E.array(jN)),costPriority:E.optional(E.number().min(0).max(1)),speedPriority:E.optional(E.number().min(0).max(1)),intelligencePriority:E.optional(E.number().min(0).max(1))}).passthrough(),MN=E.object({role:E.enum(["user","assistant"]),content:E.union([ed,td,rd])}).passthrough(),LN=zt.extend({method:E.literal("sampling/createMessage"),params:dr.extend({messages:E.array(MN),systemPrompt:E.optional(E.string()),includeContext:E.optional(E.enum(["none","thisServer","allServers"])),temperature:E.optional(E.number()),maxTokens:E.number().int(),stopSequences:E.optional(E.array(E.string())),metadata:E.optional(E.object({}).passthrough()),modelPreferences:E.optional($N)})}),qN=fr.extend({model:E.string(),stopReason:E.optional(E.enum(["endTurn","stopSequence","maxTokens"]).or(E.string())),role:E.enum(["user","assistant"]),content:E.discriminatedUnion("type",[ed,td,rd])}),FN=E.object({type:E.literal("boolean"),title:E.optional(E.string()),description:E.optional(E.string()),default:E.optional(E.boolean())}).passthrough(),UN=E.object({type:E.literal("string"),title:E.optional(E.string()),description:E.optional(E.string()),minLength:E.optional(E.number()),maxLength:E.optional(E.number()),format:E.optional(E.enum(["email","uri","date","date-time"]))}).passthrough(),zN=E.object({type:E.enum(["number","integer"]),title:E.optional(E.string()),description:E.optional(E.string()),minimum:E.optional(E.number()),maximum:E.optional(E.number())}).passthrough(),BN=E.object({type:E.literal("string"),title:E.optional(E.string()),description:E.optional(E.string()),enum:E.array(E.string()),enumNames:E.optional(E.array(E.string()))}).passthrough(),HN=E.union([FN,UN,zN,BN]),VN=zt.extend({method:E.literal("elicitation/create"),params:dr.extend({message:E.string(),requestedSchema:E.object({type:E.literal("object"),properties:E.record(E.string(),HN),required:E.optional(E.array(E.string()))}).passthrough()})}),WN=fr.extend({action:E.enum(["accept","decline","cancel"]),content:E.optional(E.record(E.string(),E.unknown()))}),GN=E.object({type:E.literal("ref/resource"),uri:E.string()}).passthrough();var ZN=E.object({type:E.literal("ref/prompt"),name:E.string()}).passthrough(),KN=zt.extend({method:E.literal("completion/complete"),params:dr.extend({ref:E.union([ZN,GN]),argument:E.object({name:E.string(),value:E.string()}).passthrough(),context:E.optional(E.object({arguments:E.optional(E.record(E.string(),E.string()))}))})}),nd=fr.extend({completion:E.object({values:E.array(E.string()).max(100),total:E.optional(E.number().int()),hasMore:E.optional(E.boolean())}).passthrough()}),XN=E.object({uri:E.string().startsWith("file://"),name:E.optional(E.string()),_meta:E.optional(E.object({}).passthrough())}).passthrough(),QN=zt.extend({method:E.literal("roots/list")}),JN=fr.extend({roots:E.array(XN)}),YN=Ur.extend({method:E.literal("notifications/roots/list_changed")}),MF=E.union([xc,cN,KN,NN,SN,EN,fN,mN,hN,gN,yN,IN,kN]),LF=E.union([bc,_c,uN,YN]),qF=E.union([gs,qN,WN,JN]),FF=E.union([xc,LN,VN,QN]),UF=E.union([bc,_c,DN,bN,vN,AN,PN]),zF=E.union([gs,Zp,nd,ad,Yp,Xp,Qp,Jp,wc,sd]),pr=class extends Error{constructor(e,r,t){super(`MCP error ${e}: ${r}`),this.code=e,this.data=t,this.name="McpError"}};var eD=6e4,Tc=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(bc,r=>{let t=this._requestHandlerAbortControllers.get(r.params.requestId);t?.abort(r.params.reason)}),this.setNotificationHandler(_c,r=>{this._onprogress(r)}),this.setRequestHandler(xc,r=>({}))}_setupTimeout(e,r,t,s,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,r),startTime:Date.now(),timeout:r,maxTotalTimeout:t,resetTimeoutOnProgress:i,onTimeout:s})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let t=Date.now()-r.startTime;if(r.maxTotalTimeout&&t>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new pr(ur.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:t});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,t,s;this._transport=e;let i=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{i?.(),this._onclose()};let n=(t=this.transport)===null||t===void 0?void 0:t.onerror;this._transport.onerror=l=>{n?.(l),this._onerror(l)};let o=(s=this._transport)===null||s===void 0?void 0:s.onmessage;this._transport.onmessage=(l,c)=>{o?.(l,c),Gp(l)||Vx(l)?this._onresponse(l):Fx(l)?this._onrequest(l,c):zx(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},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 t=new pr(ur.ConnectionClosed,"Connection closed");for(let s of r.values())s(t)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let t=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,r){var t,s;let i=(t=this._requestHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackRequestHandler,n=this._transport;if(i===void 0){n?.send({jsonrpc:"2.0",id:e.id,error:{code:ur.MethodNotFound,message:"Method not found"}}).catch(c=>this._onerror(new Error(`Failed to send an error response: ${c}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let l={signal:o.signal,sessionId:n?.sessionId,_meta:(s=e.params)===null||s===void 0?void 0:s._meta,sendNotification:c=>this.notification(c,{relatedRequestId:e.id}),sendRequest:(c,u,p)=>this.request(c,u,{...p,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>i(e,l)).then(c=>{if(!o.signal.aborted)return n?.send({result:c,jsonrpc:"2.0",id:e.id})},c=>{var u;if(!o.signal.aborted)return n?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:ur.InternalError,message:(u=c.message)!==null&&u!==void 0?u:"Internal error"}})}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...t}=e.params,s=Number(r),i=this._progressHandlers.get(s);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let n=this._responseHandlers.get(s),o=this._timeoutInfo.get(s);if(o&&n&&o.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(l){n(l);return}i(t)}_onresponse(e){let r=Number(e.id),t=this._responseHandlers.get(r);if(t===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),Gp(e))t(e);else{let s=new pr(e.error.code,e.error.message,e.error.data);t(s)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,t){let{relatedRequestId:s,resumptionToken:i,onresumptiontoken:n}=t??{};return new Promise((o,l)=>{var c,u,p,f,d,v;if(!this._transport){l(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=t?.signal)===null||u===void 0||u.throwIfAborted();let h=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:h};t?.onprogress&&(this._progressHandlers.set(h,t.onprogress),m.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:h}});let y=w=>{var P;this._responseHandlers.delete(h),this._progressHandlers.delete(h),this._cleanupTimeout(h),(P=this._transport)===null||P===void 0||P.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:h,reason:String(w)}},{relatedRequestId:s,resumptionToken:i,onresumptiontoken:n}).catch(T=>this._onerror(new Error(`Failed to send cancellation: ${T}`))),l(w)};this._responseHandlers.set(h,w=>{var P;if(!(!((P=t?.signal)===null||P===void 0)&&P.aborted)){if(w instanceof Error)return l(w);try{let T=r.parse(w.result);o(T)}catch(T){l(T)}}}),(f=t?.signal)===null||f===void 0||f.addEventListener("abort",()=>{var w;y((w=t?.signal)===null||w===void 0?void 0:w.reason)});let g=(d=t?.timeout)!==null&&d!==void 0?d:eD,b=()=>y(new pr(ur.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(h,g,t?.maxTotalTimeout,b,(v=t?.resetTimeoutOnProgress)!==null&&v!==void 0?v:!1),this._transport.send(m,{relatedRequestId:s,resumptionToken:i,onresumptiontoken:n}).catch(w=>{this._cleanupTimeout(h),l(w)})})}async notification(e,r){var t,s;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((s=(t=this._options)===null||t===void 0?void 0:t.debouncedNotificationMethods)!==null&&s!==void 0?s:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var l;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let c={...e,jsonrpc:"2.0"};(l=this._transport)===null||l===void 0||l.send(c,r).catch(u=>this._onerror(u))});return}let o={...e,jsonrpc:"2.0"};await this._transport.send(o,r)}setRequestHandler(e,r){let t=e.shape.method.value;this.assertRequestHandlerCapability(t),this._requestHandlers.set(t,(s,i)=>Promise.resolve(r(e.parse(s),i)))}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,t=>Promise.resolve(r(e.parse(t))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function e0(a,e){return Object.entries(e).reduce((r,[t,s])=>(s&&typeof s=="object"?r[t]=r[t]?{...r[t],...s}:s:r[t]=s,r),{...a})}var rE=gt(tE(),1),wn=class extends Tc{constructor(e,r){var t;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(t=r?.capabilities)!==null&&t!==void 0?t:{},this._ajv=new rE.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=e0(this._capabilities,e)}assertCapability(e,r){var t;if(!(!((t=this._serverCapabilities)===null||t===void 0)&&t[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 t=await this.request({method:"initialize",params:{protocolVersion:Wp,capabilities:this._capabilities,clientInfo:this._clientInfo}},Zp,r);if(t===void 0)throw new Error(`Server sent invalid initialize result: ${t}`);if(!$x.includes(t.protocolVersion))throw new Error(`Server's protocol version is not supported: ${t.protocolVersion}`);this._serverCapabilities=t.capabilities,this._serverVersion=t.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(t.protocolVersion),this._instructions=t.instructions,await this.notification({method:"notifications/initialized"})}catch(t){throw this.close(),t}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,t,s,i,n;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(!(!((t=this._serverCapabilities)===null||t===void 0)&&t.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(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.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(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.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"},gs,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},nd,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},gs,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},ad,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},Yp,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},Xp,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},Qp,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Jp,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},gs,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},gs,r)}async callTool(e,r=wc,t){let s=await this.request({method:"tools/call",params:e},r,t),i=this.getToolOutputValidator(e.name);if(i){if(!s.structuredContent&&!s.isError)throw new pr(ur.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent)try{if(!i(s.structuredContent))throw new pr(ur.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(i.errors)}`)}catch(n){throw n instanceof pr?n:new pr(ur.InvalidParams,`Failed to validate structured content: ${n instanceof Error?n.message:String(n)}`)}}return s}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let r of e)if(r.outputSchema)try{let t=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,t)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let t=await this.request({method:"tools/list",params:e},sd,r);return this.cacheToolOutputSchemas(t.tools),t}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var WE=gt(HE(),1),qi=gt(require("node:process"),1),GE=require("node:stream");var Vc=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),n$(r)}clear(){this._buffer=void 0}};function n$(a){return Wx.parse(JSON.parse(a))}function VE(a){return JSON.stringify(a)+` -`}var i$=qi.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function o$(){let a={};for(let e of i$){let r=qi.default.env[e];r!==void 0&&(r.startsWith("()")||(a[e]=r))}return a}var Pn=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new Vc,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 t,s,i,n,o;this._process=(0,WE.default)(this._serverParams.command,(t=this._serverParams.args)!==null&&t!==void 0?t:[],{env:{...o$(),...this._serverParams.env},stdio:["pipe","pipe",(s=this._serverParams.stderr)!==null&&s!==void 0?s:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:qi.default.platform==="win32"&&c$(),cwd:this._serverParams.cwd}),this._process.on("error",l=>{var c,u;if(l.name==="AbortError"){(c=this.onclose)===null||c===void 0||c.call(this);return}r(l),(u=this.onerror)===null||u===void 0||u.call(this,l)}),this._process.on("spawn",()=>{e()}),this._process.on("close",l=>{var c;this._process=void 0,(c=this.onclose)===null||c===void 0||c.call(this)}),(i=this._process.stdin)===null||i===void 0||i.on("error",l=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,l)}),(n=this._process.stdout)===null||n===void 0||n.on("data",l=>{this._readBuffer.append(l),this.processReadBuffer()}),(o=this._process.stdout)===null||o===void 0||o.on("error",l=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,l)}),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 t=this._readBuffer.readMessage();if(t===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,t)}catch(t){(r=this.onerror)===null||r===void 0||r.call(this,t)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(e){return new Promise(r=>{var t;if(!(!((t=this._process)===null||t===void 0)&&t.stdin))throw new Error("Not connected");let s=VE(e);this._process.stdin.write(s)?r():this._process.stdin.once("drain",r)})}};function c$(){return"type"in qi.default}var KE=vt(require("path"),1),XE=require("os"),Zc=require("fs");Ia();function On(){try{let a=KE.default.join((0,XE.homedir)(),".claude-mem","settings.json");if((0,Zc.existsSync)(a)){let e=JSON.parse((0,Zc.readFileSync)(a,"utf-8")),r=parseInt(e.env?.CLAUDE_MEM_WORKER_PORT,10);if(!isNaN(r))return r}}catch{}return parseInt(process.env.CLAUDE_MEM_WORKER_PORT||"37777",10)}_t();Kc();var JE=vt(require("better-sqlite3"),1);Ia();var Xc=class{db;constructor(e){e||(Gc(Pr),e=Wc),this.db=new JE.default(e),this.db.pragma("journal_mode = WAL"),this.ensureFTSTables()}ensureFTSTables(){try{if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '%_fts'").all().some(t=>t.name==="observations_fts"||t.name==="session_summaries_fts"))return;console.error("[SessionSearch] Creating FTS5 tables..."),this.db.exec(` +`}var i$=qi.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function o$(){let a={};for(let e of i$){let r=qi.default.env[e];r!==void 0&&(r.startsWith("()")||(a[e]=r))}return a}var Pn=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new Vc,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 t,s,i,n,o;this._process=(0,WE.default)(this._serverParams.command,(t=this._serverParams.args)!==null&&t!==void 0?t:[],{env:{...o$(),...this._serverParams.env},stdio:["pipe","pipe",(s=this._serverParams.stderr)!==null&&s!==void 0?s:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:qi.default.platform==="win32"&&c$(),cwd:this._serverParams.cwd}),this._process.on("error",l=>{var c,u;if(l.name==="AbortError"){(c=this.onclose)===null||c===void 0||c.call(this);return}r(l),(u=this.onerror)===null||u===void 0||u.call(this,l)}),this._process.on("spawn",()=>{e()}),this._process.on("close",l=>{var c;this._process=void 0,(c=this.onclose)===null||c===void 0||c.call(this)}),(i=this._process.stdin)===null||i===void 0||i.on("error",l=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,l)}),(n=this._process.stdout)===null||n===void 0||n.on("data",l=>{this._readBuffer.append(l),this.processReadBuffer()}),(o=this._process.stdout)===null||o===void 0||o.on("error",l=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,l)}),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 t=this._readBuffer.readMessage();if(t===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,t)}catch(t){(r=this.onerror)===null||r===void 0||r.call(this,t)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(e){return new Promise(r=>{var t;if(!(!((t=this._process)===null||t===void 0)&&t.stdin))throw new Error("Not connected");let s=VE(e);this._process.stdin.write(s)?r():this._process.stdin.once("drain",r)})}};function c$(){return"type"in qi.default}var KE=gt(require("path"),1),XE=require("os"),Zc=require("fs");Ia();function On(){try{let a=KE.default.join((0,XE.homedir)(),".claude-mem","settings.json");if((0,Zc.existsSync)(a)){let e=JSON.parse((0,Zc.readFileSync)(a,"utf-8")),r=parseInt(e.env?.CLAUDE_MEM_WORKER_PORT,10);if(!isNaN(r))return r}}catch{}return parseInt(process.env.CLAUDE_MEM_WORKER_PORT||"37777",10)}_t();Kc();var JE=gt(require("better-sqlite3"),1);Ia();var Xc=class{db;constructor(e){e||(Gc(Pr),e=Wc),this.db=new JE.default(e),this.db.pragma("journal_mode = WAL"),this.ensureFTSTables()}ensureFTSTables(){try{if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '%_fts'").all().some(t=>t.name==="observations_fts"||t.name==="session_summaries_fts"))return;console.error("[SessionSearch] Creating FTS5 tables..."),this.db.exec(` CREATE VIRTUAL TABLE IF NOT EXISTS observations_fts USING fts5( title, subtitle, @@ -623,7 +623,7 @@ No previous sessions found for this project yet.`;let v=p.slice(0,r.sessionCount FROM user_prompts WHERE claude_session_id = ? ORDER BY prompt_number ASC - `).all(e)}close(){this.db.close()}};Kc();_t();var YE=vt(require("path"),1),eS=vt(require("os"),1),Qc=class{client=null;connected=!1;project;collectionName;VECTOR_DB_DIR;BATCH_SIZE=100;constructor(e){this.project=e,this.collectionName=`cm__${e}`,this.VECTOR_DB_DIR=YE.default.join(eS.default.homedir(),".claude-mem","vector-db")}async ensureConnection(){if(!(this.connected&&this.client)){H.info("CHROMA_SYNC","Connecting to Chroma MCP server...",{project:this.project});try{let e=new Pn({command:"uvx",args:["chroma-mcp","--client-type","persistent","--data-dir",this.VECTOR_DB_DIR],stderr:"ignore"});this.client=new wn({name:"claude-mem-chroma-sync",version:"1.0.0"},{capabilities:{}}),await this.client.connect(e),this.connected=!0,H.info("CHROMA_SYNC","Connected to Chroma MCP server",{project:this.project})}catch(e){throw H.error("CHROMA_SYNC","Failed to connect to Chroma MCP server",{project:this.project},e),new Error(`Chroma connection failed: ${e instanceof Error?e.message:String(e)}`)}}}async ensureCollection(){if(await this.ensureConnection(),!this.client)throw new Error("Chroma client not initialized");try{await this.client.callTool({name:"chroma_get_collection_info",arguments:{collection_name:this.collectionName}}),H.debug("CHROMA_SYNC","Collection exists",{collection:this.collectionName})}catch{H.info("CHROMA_SYNC","Creating collection",{collection:this.collectionName});try{await this.client.callTool({name:"chroma_create_collection",arguments:{collection_name:this.collectionName,embedding_function_name:"default"}}),H.info("CHROMA_SYNC","Collection created",{collection:this.collectionName})}catch(r){throw H.error("CHROMA_SYNC","Failed to create collection",{collection:this.collectionName},r),new Error(`Collection creation failed: ${r instanceof Error?r.message:String(r)}`)}}}formatObservationDocs(e){let r=[],t=e.facts?JSON.parse(e.facts):[],s=e.concepts?JSON.parse(e.concepts):[],i=e.files_read?JSON.parse(e.files_read):[],n=e.files_modified?JSON.parse(e.files_modified):[],o={sqlite_id:e.id,doc_type:"observation",sdk_session_id:e.sdk_session_id,project:e.project,created_at_epoch:e.created_at_epoch,type:e.type||"discovery",title:e.title||"Untitled"};return e.subtitle&&(o.subtitle=e.subtitle),s.length>0&&(o.concepts=s.join(",")),i.length>0&&(o.files_read=i.join(",")),n.length>0&&(o.files_modified=n.join(",")),e.narrative&&r.push({id:`obs_${e.id}_narrative`,document:e.narrative,metadata:{...o,field_type:"narrative"}}),e.text&&r.push({id:`obs_${e.id}_text`,document:e.text,metadata:{...o,field_type:"text"}}),t.forEach((l,c)=>{r.push({id:`obs_${e.id}_fact_${c}`,document:l,metadata:{...o,field_type:"fact",fact_index:c}})}),r}formatSummaryDocs(e){let r=[],t={sqlite_id:e.id,doc_type:"session_summary",sdk_session_id:e.sdk_session_id,project:e.project,created_at_epoch:e.created_at_epoch,prompt_number:e.prompt_number||0};return e.request&&r.push({id:`summary_${e.id}_request`,document:e.request,metadata:{...t,field_type:"request"}}),e.investigated&&r.push({id:`summary_${e.id}_investigated`,document:e.investigated,metadata:{...t,field_type:"investigated"}}),e.learned&&r.push({id:`summary_${e.id}_learned`,document:e.learned,metadata:{...t,field_type:"learned"}}),e.completed&&r.push({id:`summary_${e.id}_completed`,document:e.completed,metadata:{...t,field_type:"completed"}}),e.next_steps&&r.push({id:`summary_${e.id}_next_steps`,document:e.next_steps,metadata:{...t,field_type:"next_steps"}}),e.notes&&r.push({id:`summary_${e.id}_notes`,document:e.notes,metadata:{...t,field_type:"notes"}}),r}async addDocuments(e){if(e.length!==0){if(await this.ensureCollection(),!this.client)throw new Error("Chroma client not initialized");try{await this.client.callTool({name:"chroma_add_documents",arguments:{collection_name:this.collectionName,documents:e.map(r=>r.document),ids:e.map(r=>r.id),metadatas:e.map(r=>r.metadata)}}),H.debug("CHROMA_SYNC","Documents added",{collection:this.collectionName,count:e.length})}catch(r){throw H.error("CHROMA_SYNC","Failed to add documents",{collection:this.collectionName,count:e.length},r),new Error(`Document add failed: ${r instanceof Error?r.message:String(r)}`)}}}async syncObservation(e,r,t,s,i,n,o=0){let l={id:e,sdk_session_id:r,project:t,text:null,type:s.type,title:s.title,subtitle:s.subtitle,facts:JSON.stringify(s.facts),narrative:s.narrative,concepts:JSON.stringify(s.concepts),files_read:JSON.stringify(s.files_read),files_modified:JSON.stringify(s.files_modified),prompt_number:i,discovery_tokens:o,created_at:new Date(n*1e3).toISOString(),created_at_epoch:n},c=this.formatObservationDocs(l);H.info("CHROMA_SYNC","Syncing observation",{observationId:e,documentCount:c.length,project:t}),await this.addDocuments(c)}async syncSummary(e,r,t,s,i,n,o=0){let l={id:e,sdk_session_id:r,project:t,request:s.request,investigated:s.investigated,learned:s.learned,completed:s.completed,next_steps:s.next_steps,notes:s.notes,prompt_number:i,discovery_tokens:o,created_at:new Date(n*1e3).toISOString(),created_at_epoch:n},c=this.formatSummaryDocs(l);H.info("CHROMA_SYNC","Syncing summary",{summaryId:e,documentCount:c.length,project:t}),await this.addDocuments(c)}formatUserPromptDoc(e){return{id:`prompt_${e.id}`,document:e.prompt_text,metadata:{sqlite_id:e.id,doc_type:"user_prompt",sdk_session_id:e.sdk_session_id,project:e.project,created_at_epoch:e.created_at_epoch,prompt_number:e.prompt_number}}}async syncUserPrompt(e,r,t,s,i,n){let o={id:e,claude_session_id:"",prompt_number:i,prompt_text:s,created_at:new Date(n*1e3).toISOString(),created_at_epoch:n,sdk_session_id:r,project:t},l=this.formatUserPromptDoc(o);H.info("CHROMA_SYNC","Syncing user prompt",{promptId:e,project:t}),await this.addDocuments([l])}async getExistingChromaIds(){if(await this.ensureConnection(),!this.client)throw new Error("Chroma client not initialized");let e=new Set,r=new Set,t=new Set,s=0,i=1e3;for(H.info("CHROMA_SYNC","Fetching existing Chroma document IDs...",{project:this.project});;)try{let o=(await this.client.callTool({name:"chroma_get_documents",arguments:{collection_name:this.collectionName,limit:i,offset:s,where:{project:this.project},include:["metadatas"]}})).content[0];if(o.type!=="text")throw new Error("Unexpected response type from chroma_get_documents");let c=JSON.parse(o.text).metadatas||[];if(c.length===0)break;for(let u of c)u.sqlite_id&&(u.doc_type==="observation"?e.add(u.sqlite_id):u.doc_type==="session_summary"?r.add(u.sqlite_id):u.doc_type==="user_prompt"&&t.add(u.sqlite_id));s+=i,H.debug("CHROMA_SYNC","Fetched batch of existing IDs",{project:this.project,offset:s,batchSize:c.length})}catch(n){throw H.error("CHROMA_SYNC","Failed to fetch existing IDs",{project:this.project},n),n}return H.info("CHROMA_SYNC","Existing IDs fetched",{project:this.project,observations:e.size,summaries:r.size,prompts:t.size}),{observations:e,summaries:r,prompts:t}}async ensureBackfilled(){H.info("CHROMA_SYNC","Starting smart backfill",{project:this.project}),await this.ensureCollection();let e=await this.getExistingChromaIds(),r=new Aa;try{let t=Array.from(e.observations),s=t.length>0?`AND id NOT IN (${t.join(",")})`:"",i=r.db.prepare(` + `).all(e)}close(){this.db.close()}};Kc();_t();var YE=gt(require("path"),1),eS=gt(require("os"),1),Qc=class{client=null;connected=!1;project;collectionName;VECTOR_DB_DIR;BATCH_SIZE=100;constructor(e){this.project=e,this.collectionName=`cm__${e}`,this.VECTOR_DB_DIR=YE.default.join(eS.default.homedir(),".claude-mem","vector-db")}async ensureConnection(){if(!(this.connected&&this.client)){H.info("CHROMA_SYNC","Connecting to Chroma MCP server...",{project:this.project});try{let e=new Pn({command:"uvx",args:["chroma-mcp","--client-type","persistent","--data-dir",this.VECTOR_DB_DIR],stderr:"ignore"});this.client=new wn({name:"claude-mem-chroma-sync",version:"1.0.0"},{capabilities:{}}),await this.client.connect(e),this.connected=!0,H.info("CHROMA_SYNC","Connected to Chroma MCP server",{project:this.project})}catch(e){throw H.error("CHROMA_SYNC","Failed to connect to Chroma MCP server",{project:this.project},e),new Error(`Chroma connection failed: ${e instanceof Error?e.message:String(e)}`)}}}async ensureCollection(){if(await this.ensureConnection(),!this.client)throw new Error("Chroma client not initialized");try{await this.client.callTool({name:"chroma_get_collection_info",arguments:{collection_name:this.collectionName}}),H.debug("CHROMA_SYNC","Collection exists",{collection:this.collectionName})}catch{H.info("CHROMA_SYNC","Creating collection",{collection:this.collectionName});try{await this.client.callTool({name:"chroma_create_collection",arguments:{collection_name:this.collectionName,embedding_function_name:"default"}}),H.info("CHROMA_SYNC","Collection created",{collection:this.collectionName})}catch(r){throw H.error("CHROMA_SYNC","Failed to create collection",{collection:this.collectionName},r),new Error(`Collection creation failed: ${r instanceof Error?r.message:String(r)}`)}}}formatObservationDocs(e){let r=[],t=e.facts?JSON.parse(e.facts):[],s=e.concepts?JSON.parse(e.concepts):[],i=e.files_read?JSON.parse(e.files_read):[],n=e.files_modified?JSON.parse(e.files_modified):[],o={sqlite_id:e.id,doc_type:"observation",sdk_session_id:e.sdk_session_id,project:e.project,created_at_epoch:e.created_at_epoch,type:e.type||"discovery",title:e.title||"Untitled"};return e.subtitle&&(o.subtitle=e.subtitle),s.length>0&&(o.concepts=s.join(",")),i.length>0&&(o.files_read=i.join(",")),n.length>0&&(o.files_modified=n.join(",")),e.narrative&&r.push({id:`obs_${e.id}_narrative`,document:e.narrative,metadata:{...o,field_type:"narrative"}}),e.text&&r.push({id:`obs_${e.id}_text`,document:e.text,metadata:{...o,field_type:"text"}}),t.forEach((l,c)=>{r.push({id:`obs_${e.id}_fact_${c}`,document:l,metadata:{...o,field_type:"fact",fact_index:c}})}),r}formatSummaryDocs(e){let r=[],t={sqlite_id:e.id,doc_type:"session_summary",sdk_session_id:e.sdk_session_id,project:e.project,created_at_epoch:e.created_at_epoch,prompt_number:e.prompt_number||0};return e.request&&r.push({id:`summary_${e.id}_request`,document:e.request,metadata:{...t,field_type:"request"}}),e.investigated&&r.push({id:`summary_${e.id}_investigated`,document:e.investigated,metadata:{...t,field_type:"investigated"}}),e.learned&&r.push({id:`summary_${e.id}_learned`,document:e.learned,metadata:{...t,field_type:"learned"}}),e.completed&&r.push({id:`summary_${e.id}_completed`,document:e.completed,metadata:{...t,field_type:"completed"}}),e.next_steps&&r.push({id:`summary_${e.id}_next_steps`,document:e.next_steps,metadata:{...t,field_type:"next_steps"}}),e.notes&&r.push({id:`summary_${e.id}_notes`,document:e.notes,metadata:{...t,field_type:"notes"}}),r}async addDocuments(e){if(e.length!==0){if(await this.ensureCollection(),!this.client)throw new Error("Chroma client not initialized");try{await this.client.callTool({name:"chroma_add_documents",arguments:{collection_name:this.collectionName,documents:e.map(r=>r.document),ids:e.map(r=>r.id),metadatas:e.map(r=>r.metadata)}}),H.debug("CHROMA_SYNC","Documents added",{collection:this.collectionName,count:e.length})}catch(r){throw H.error("CHROMA_SYNC","Failed to add documents",{collection:this.collectionName,count:e.length},r),new Error(`Document add failed: ${r instanceof Error?r.message:String(r)}`)}}}async syncObservation(e,r,t,s,i,n,o=0){let l={id:e,sdk_session_id:r,project:t,text:null,type:s.type,title:s.title,subtitle:s.subtitle,facts:JSON.stringify(s.facts),narrative:s.narrative,concepts:JSON.stringify(s.concepts),files_read:JSON.stringify(s.files_read),files_modified:JSON.stringify(s.files_modified),prompt_number:i,discovery_tokens:o,created_at:new Date(n*1e3).toISOString(),created_at_epoch:n},c=this.formatObservationDocs(l);H.info("CHROMA_SYNC","Syncing observation",{observationId:e,documentCount:c.length,project:t}),await this.addDocuments(c)}async syncSummary(e,r,t,s,i,n,o=0){let l={id:e,sdk_session_id:r,project:t,request:s.request,investigated:s.investigated,learned:s.learned,completed:s.completed,next_steps:s.next_steps,notes:s.notes,prompt_number:i,discovery_tokens:o,created_at:new Date(n*1e3).toISOString(),created_at_epoch:n},c=this.formatSummaryDocs(l);H.info("CHROMA_SYNC","Syncing summary",{summaryId:e,documentCount:c.length,project:t}),await this.addDocuments(c)}formatUserPromptDoc(e){return{id:`prompt_${e.id}`,document:e.prompt_text,metadata:{sqlite_id:e.id,doc_type:"user_prompt",sdk_session_id:e.sdk_session_id,project:e.project,created_at_epoch:e.created_at_epoch,prompt_number:e.prompt_number}}}async syncUserPrompt(e,r,t,s,i,n){let o={id:e,claude_session_id:"",prompt_number:i,prompt_text:s,created_at:new Date(n*1e3).toISOString(),created_at_epoch:n,sdk_session_id:r,project:t},l=this.formatUserPromptDoc(o);H.info("CHROMA_SYNC","Syncing user prompt",{promptId:e,project:t}),await this.addDocuments([l])}async getExistingChromaIds(){if(await this.ensureConnection(),!this.client)throw new Error("Chroma client not initialized");let e=new Set,r=new Set,t=new Set,s=0,i=1e3;for(H.info("CHROMA_SYNC","Fetching existing Chroma document IDs...",{project:this.project});;)try{let o=(await this.client.callTool({name:"chroma_get_documents",arguments:{collection_name:this.collectionName,limit:i,offset:s,where:{project:this.project},include:["metadatas"]}})).content[0];if(o.type!=="text")throw new Error("Unexpected response type from chroma_get_documents");let c=JSON.parse(o.text).metadatas||[];if(c.length===0)break;for(let u of c)u.sqlite_id&&(u.doc_type==="observation"?e.add(u.sqlite_id):u.doc_type==="session_summary"?r.add(u.sqlite_id):u.doc_type==="user_prompt"&&t.add(u.sqlite_id));s+=i,H.debug("CHROMA_SYNC","Fetched batch of existing IDs",{project:this.project,offset:s,batchSize:c.length})}catch(n){throw H.error("CHROMA_SYNC","Failed to fetch existing IDs",{project:this.project},n),n}return H.info("CHROMA_SYNC","Existing IDs fetched",{project:this.project,observations:e.size,summaries:r.size,prompts:t.size}),{observations:e,summaries:r,prompts:t}}async ensureBackfilled(){H.info("CHROMA_SYNC","Starting smart backfill",{project:this.project}),await this.ensureCollection();let e=await this.getExistingChromaIds(),r=new Aa;try{let t=Array.from(e.observations),s=t.length>0?`AND id NOT IN (${t.join(",")})`:"",i=r.db.prepare(` SELECT * FROM observations WHERE project = ? ${s} ORDER BY id ASC @@ -655,7 +655,7 @@ No previous sessions found for this project yet.`;let v=p.slice(0,r.sessionCount `;H.debug("WORKER","SSE broadcast sent",{eventType:e.type,clients:this.sseClients.size});for(let s of this.sseClients)try{s.write(t)}catch{this.sseClients.delete(s),H.debug("WORKER","Client removed due to write error")}}getClientCount(){return this.sseClients.size}sendToClient(e,r){let t=`data: ${JSON.stringify(r)} -`;try{e.write(t)}catch{this.sseClients.delete(e)}}};var mw=require("child_process"),hw=require("os"),vw=vt(require("path"),1),gl=require("fs");_t();_t();function nS(a,e){let r=[],t=/([\s\S]*?)<\/observation>/g,s;for(;(s=t.exec(a))!==null;){let i=s[1],n=Br(i,"type"),o=Br(i,"title"),l=Br(i,"subtitle"),c=Br(i,"narrative"),u=tl(i,"facts","fact"),p=tl(i,"concepts","concept"),f=tl(i,"files_read","file"),d=tl(i,"files_modified","file"),v="change";n?["bugfix","feature","refactor","change","discovery","decision"].includes(n.trim())?v=n.trim():H.warn("PARSER",`Invalid observation type: ${n}, using "change"`,{correlationId:e}):H.warn("PARSER",'Observation missing type field, using "change"',{correlationId:e});let h=p.filter(m=>m!==v);h.length!==p.length&&H.warn("PARSER","Removed observation type from concepts array",{correlationId:e,type:v,originalConcepts:p,cleanedConcepts:h}),r.push({type:v,title:o,subtitle:l,facts:u,narrative:c,concepts:h,files_read:f,files_modified:d})}return r}function iS(a,e){let t=//.exec(a);if(t)return H.info("PARSER","Summary skipped",{sessionId:e,reason:t[1]}),null;let i=/([\s\S]*?)<\/summary>/.exec(a);if(!i)return null;let n=i[1],o=Br(n,"request"),l=Br(n,"investigated"),c=Br(n,"learned"),u=Br(n,"completed"),p=Br(n,"next_steps"),f=Br(n,"notes");return{request:o,investigated:l,learned:c,completed:u,next_steps:p,notes:f}}function Br(a,e){let t=new RegExp(`<${e}>([^<]*)`).exec(a);if(!t)return null;let s=t[1].trim();return s===""?null:s}function tl(a,e,r){let t=[],i=new RegExp(`<${e}>(.*?)`,"s").exec(a);if(!i)return t;let n=i[1],o=new RegExp(`<${r}>([^<]+)`,"g"),l;for(;(l=o.exec(n))!==null;)t.push(l[1].trim());return t}function oS(a,e,r){return`You are a Claude-Mem, a specialized observer tool for creating searchable memory FOR FUTURE SESSIONS. +`;try{e.write(t)}catch{this.sseClients.delete(e)}}};var mw=require("child_process"),hw=require("os"),vw=gt(require("path"),1),gl=require("fs");_t();_t();function nS(a,e){let r=[],t=/([\s\S]*?)<\/observation>/g,s;for(;(s=t.exec(a))!==null;){let i=s[1],n=Br(i,"type"),o=Br(i,"title"),l=Br(i,"subtitle"),c=Br(i,"narrative"),u=tl(i,"facts","fact"),p=tl(i,"concepts","concept"),f=tl(i,"files_read","file"),d=tl(i,"files_modified","file"),v="change";n?["bugfix","feature","refactor","change","discovery","decision"].includes(n.trim())?v=n.trim():H.warn("PARSER",`Invalid observation type: ${n}, using "change"`,{correlationId:e}):H.warn("PARSER",'Observation missing type field, using "change"',{correlationId:e});let h=p.filter(m=>m!==v);h.length!==p.length&&H.warn("PARSER","Removed observation type from concepts array",{correlationId:e,type:v,originalConcepts:p,cleanedConcepts:h}),r.push({type:v,title:o,subtitle:l,facts:u,narrative:c,concepts:h,files_read:f,files_modified:d})}return r}function iS(a,e){let t=//.exec(a);if(t)return H.info("PARSER","Summary skipped",{sessionId:e,reason:t[1]}),null;let i=/([\s\S]*?)<\/summary>/.exec(a);if(!i)return null;let n=i[1],o=Br(n,"request"),l=Br(n,"investigated"),c=Br(n,"learned"),u=Br(n,"completed"),p=Br(n,"next_steps"),f=Br(n,"notes");return{request:o,investigated:l,learned:c,completed:u,next_steps:p,notes:f}}function Br(a,e){let t=new RegExp(`<${e}>([^<]*)`).exec(a);if(!t)return null;let s=t[1].trim();return s===""?null:s}function tl(a,e,r){let t=[],i=new RegExp(`<${e}>(.*?)`,"s").exec(a);if(!i)return t;let n=i[1],o=new RegExp(`<${r}>([^<]+)`,"g"),l;for(;(l=o.exec(n))!==null;)t.push(l[1].trim());return t}function oS(a,e,r){return`You are a Claude-Mem, a specialized observer tool for creating searchable memory FOR FUTURE SESSIONS. CRITICAL: Record what was LEARNED/BUILT/FIXED/DEPLOYED/CONFIGURED, not what you (the observer) are doing. @@ -887,7 +887,7 @@ Never reference yourself or your own actions. Do not output anything other than Remember that we record these observations as a way of helping us stay on track with our progress, and to help us keep important decisions and changes at the forefront of our minds! :) Thank you so much for your continued help! MEMORY PROCESSING CONTINUED -===========================`}var Gd=require("path"),CS=require("url"),kS=require("events"),AS=require("child_process"),NS=require("readline"),Ae=vt(require("fs"),1),DS=require("fs/promises"),FS=require("path"),US=require("os"),_s=require("path"),Qd=require("process"),zS=require("crypto"),g6={},f$=Object.create,m$=Object.getPrototypeOf,Wd=Object.defineProperty,h$=Object.getOwnPropertyNames,v$=Object.prototype.hasOwnProperty,g$=(a,e,r)=>{r=a!=null?f$(m$(a)):{};let t=e||!a||!a.__esModule?Wd(r,"default",{value:a,enumerable:!0}):r;for(let s of h$(a))v$.call(t,s)||Wd(t,s,{get:()=>a[s],enumerable:!0});return t},Ne=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),y$=(a,e)=>{for(var r in e)Wd(a,r,{get:e[r],enumerable:!0,configurable:!0,set:t=>e[r]=()=>t})},b$=Ne((a,e)=>{(function(r,t){typeof a=="object"&&typeof e<"u"?t(a):typeof define=="function"&&define.amd?define(["exports"],t):t(r.URI=r.URI||{})})(a,function(r){function t(){for(var _=arguments.length,x=Array(_),R=0;R<_;R++)x[R]=arguments[R];if(x.length>1){x[0]=x[0].slice(0,-1);for(var L=x.length-1,z=1;z= 0x80 (not a basic code point)","invalid-input":"Invalid input"},N=h-m,C=Math.floor,O=String.fromCharCode;function j(_){throw new RangeError($[_])}function F(_,x){for(var R=[],L=_.length;L--;)R[L]=x(_[L]);return R}function B(_,x){var R=_.split("@"),L="";R.length>1&&(L=R[0]+"@",_=R[1]),_=_.replace(A,".");var z=_.split("."),J=F(z,x).join(".");return L+J}function V(_){for(var x=[],R=0,L=_.length;R=55296&&z<=56319&&R>1,x+=C(x/R);x>N*y>>1;z+=h)x=C(x/N);return C(z+(N+1)*x/(x+g))},ee=function(x){var R=[],L=x.length,z=0,J=P,le=w,_e=x.lastIndexOf(T);_e<0&&(_e=0);for(var me=0;me<_e;++me)x.charCodeAt(me)>=128&&j("not-basic"),R.push(x.charCodeAt(me));for(var je=_e>0?_e+1:0;je=L&&j("invalid-input");var Ie=K(x.charCodeAt(je++));(Ie>=h||Ie>C((v-z)/ke))&&j("overflow"),z+=Ie*ke;var ve=we<=le?m:we>=le+y?y:we-le;if(IeC(v/Ye)&&j("overflow"),ke*=Ye}var qe=R.length+1;le=ae(z-xe,qe,xe==0),C(z/qe)>v-J&&j("overflow"),J+=C(z/qe),z%=qe,R.splice(z++,0,J)}return String.fromCodePoint.apply(String,R)},Le=function(x){var R=[];x=V(x);var L=x.length,z=P,J=0,le=w,_e=!0,me=!1,je=void 0;try{for(var xe=x[Symbol.iterator](),ke;!(_e=(ke=xe.next()).done);_e=!0){var we=ke.value;we<128&&R.push(O(we))}}catch(Kr){me=!0,je=Kr}finally{try{!_e&&xe.return&&xe.return()}finally{if(me)throw je}}var Ie=R.length,ve=Ie;for(Ie&&R.push(T);ve=z&&ctC((v-J)/mt)&&j("overflow"),J+=(Ye-z)*mt,z=Ye;var ht=!0,Wt=!1,Dt=void 0;try{for(var Cr=x[Symbol.iterator](),br;!(ht=(br=Cr.next()).done);ht=!0){var xr=br.value;if(xrv&&j("overflow"),xr==z){for(var Pt=J,Gt=h;;Gt+=h){var Zt=Gt<=le?m:Gt>=le+y?y:Gt-le;if(Pt>6|192).toString(16).toUpperCase()+"%"+(x&63|128).toString(16).toUpperCase():R="%"+(x>>12|224).toString(16).toUpperCase()+"%"+(x>>6&63|128).toString(16).toUpperCase()+"%"+(x&63|128).toString(16).toUpperCase(),R}function G(_){for(var x="",R=0,L=_.length;R=194&&z<224){if(L-R>=6){var J=parseInt(_.substr(R+4,2),16);x+=String.fromCharCode((z&31)<<6|J&63)}else x+=_.substr(R,6);R+=6}else if(z>=224){if(L-R>=9){var le=parseInt(_.substr(R+4,2),16),_e=parseInt(_.substr(R+7,2),16);x+=String.fromCharCode((z&15)<<12|(le&63)<<6|_e&63)}else x+=_.substr(R,9);R+=9}else x+=_.substr(R,3),R+=3}return x}function re(_,x){function R(L){var z=G(L);return z.match(x.UNRESERVED)?z:L}return _.scheme&&(_.scheme=String(_.scheme).replace(x.PCT_ENCODED,R).toLowerCase().replace(x.NOT_SCHEME,"")),_.userinfo!==void 0&&(_.userinfo=String(_.userinfo).replace(x.PCT_ENCODED,R).replace(x.NOT_USERINFO,U).replace(x.PCT_ENCODED,n)),_.host!==void 0&&(_.host=String(_.host).replace(x.PCT_ENCODED,R).toLowerCase().replace(x.NOT_HOST,U).replace(x.PCT_ENCODED,n)),_.path!==void 0&&(_.path=String(_.path).replace(x.PCT_ENCODED,R).replace(_.scheme?x.NOT_PATH:x.NOT_PATH_NOSCHEME,U).replace(x.PCT_ENCODED,n)),_.query!==void 0&&(_.query=String(_.query).replace(x.PCT_ENCODED,R).replace(x.NOT_QUERY,U).replace(x.PCT_ENCODED,n)),_.fragment!==void 0&&(_.fragment=String(_.fragment).replace(x.PCT_ENCODED,R).replace(x.NOT_FRAGMENT,U).replace(x.PCT_ENCODED,n)),_}function pe(_){return _.replace(/^0*(.*)/,"$1")||"0"}function Z(_,x){var R=_.match(x.IPV4ADDRESS)||[],L=f(R,2),z=L[1];return z?z.split(".").map(pe).join("."):_}function X(_,x){var R=_.match(x.IPV6ADDRESS)||[],L=f(R,3),z=L[1],J=L[2];if(z){for(var le=z.toLowerCase().split("::").reverse(),_e=f(le,2),me=_e[0],je=_e[1],xe=je?je.split(":").map(pe):[],ke=me.split(":").map(pe),we=x.IPV4ADDRESS.test(ke[ke.length-1]),Ie=we?7:8,ve=ke.length-Ie,Ye=Array(Ie),qe=0;qe1){var Be=Ye.slice(0,ze.index),ct=Ye.slice(ze.index+ze.length);it=Be.join(":")+"::"+ct.join(":")}else it=Ye.join(":");return J&&(it+="%"+J),it}else return _}var ce=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,De="".match(/(){0}/)[1]===void 0;function fe(_){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R={},L=x.iri!==!1?p:u;x.reference==="suffix"&&(_=(x.scheme?x.scheme+":":"")+"//"+_);var z=_.match(ce);if(z){De?(R.scheme=z[1],R.userinfo=z[3],R.host=z[4],R.port=parseInt(z[5],10),R.path=z[6]||"",R.query=z[7],R.fragment=z[8],isNaN(R.port)&&(R.port=z[5])):(R.scheme=z[1]||void 0,R.userinfo=_.indexOf("@")!==-1?z[3]:void 0,R.host=_.indexOf("//")!==-1?z[4]:void 0,R.port=parseInt(z[5],10),R.path=z[6]||"",R.query=_.indexOf("?")!==-1?z[7]:void 0,R.fragment=_.indexOf("#")!==-1?z[8]:void 0,isNaN(R.port)&&(R.port=_.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?z[4]:void 0)),R.host&&(R.host=X(Z(R.host,L),L)),R.scheme===void 0&&R.userinfo===void 0&&R.host===void 0&&R.port===void 0&&!R.path&&R.query===void 0?R.reference="same-document":R.scheme===void 0?R.reference="relative":R.fragment===void 0?R.reference="absolute":R.reference="uri",x.reference&&x.reference!=="suffix"&&x.reference!==R.reference&&(R.error=R.error||"URI is not a "+x.reference+" reference.");var J=Te[(x.scheme||R.scheme||"").toLowerCase()];if(!x.unicodeSupport&&(!J||!J.unicodeSupport)){if(R.host&&(x.domainHost||J&&J.domainHost))try{R.host=be.toASCII(R.host.replace(L.PCT_ENCODED,G).toLowerCase())}catch(le){R.error=R.error||"Host's domain name can not be converted to ASCII via punycode: "+le}re(R,u)}else re(R,L);J&&J.parse&&J.parse(R,x)}else R.error=R.error||"URI can not be parsed.";return R}function $e(_,x){var R=x.iri!==!1?p:u,L=[];return _.userinfo!==void 0&&(L.push(_.userinfo),L.push("@")),_.host!==void 0&&L.push(X(Z(String(_.host),R),R).replace(R.IPV6ADDRESS,function(z,J,le){return"["+J+(le?"%25"+le:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(L.push(":"),L.push(String(_.port))),L.length?L.join(""):void 0}var Ve=/^\.\.?\//,Se=/^\/\.(\/|$)/,tt=/^\/\.\.(\/|$)/,We=/^\/?(?:.|\n)*?(?=\/|$)/;function Je(_){for(var x=[];_.length;)if(_.match(Ve))_=_.replace(Ve,"");else if(_.match(Se))_=_.replace(Se,"/");else if(_.match(tt))_=_.replace(tt,"/"),x.pop();else if(_==="."||_==="..")_="";else{var R=_.match(We);if(R){var L=R[0];_=_.slice(L.length),x.push(L)}else throw new Error("Unexpected dot segment condition")}return x.join("")}function Ke(_){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=x.iri?p:u,L=[],z=Te[(x.scheme||_.scheme||"").toLowerCase()];if(z&&z.serialize&&z.serialize(_,x),_.host&&!R.IPV6ADDRESS.test(_.host)){if(x.domainHost||z&&z.domainHost)try{_.host=x.iri?be.toUnicode(_.host):be.toASCII(_.host.replace(R.PCT_ENCODED,G).toLowerCase())}catch(_e){_.error=_.error||"Host's domain name can not be converted to "+(x.iri?"Unicode":"ASCII")+" via punycode: "+_e}}re(_,R),x.reference!=="suffix"&&_.scheme&&(L.push(_.scheme),L.push(":"));var J=$e(_,x);if(J!==void 0&&(x.reference!=="suffix"&&L.push("//"),L.push(J),_.path&&_.path.charAt(0)!=="/"&&L.push("/")),_.path!==void 0){var le=_.path;!x.absolutePath&&(!z||!z.absolutePath)&&(le=Je(le)),J===void 0&&(le=le.replace(/^\/\//,"/%2F")),L.push(le)}return _.query!==void 0&&(L.push("?"),L.push(_.query)),_.fragment!==void 0&&(L.push("#"),L.push(_.fragment)),L.join("")}function Qe(_,x){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=arguments[3],z={};return L||(_=fe(Ke(_,R),R),x=fe(Ke(x,R),R)),R=R||{},!R.tolerant&&x.scheme?(z.scheme=x.scheme,z.userinfo=x.userinfo,z.host=x.host,z.port=x.port,z.path=Je(x.path||""),z.query=x.query):(x.userinfo!==void 0||x.host!==void 0||x.port!==void 0?(z.userinfo=x.userinfo,z.host=x.host,z.port=x.port,z.path=Je(x.path||""),z.query=x.query):(x.path?(x.path.charAt(0)==="/"?z.path=Je(x.path):((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path?z.path="/"+x.path:_.path?z.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+x.path:z.path=x.path,z.path=Je(z.path)),z.query=x.query):(z.path=_.path,x.query!==void 0?z.query=x.query:z.query=_.query),z.userinfo=_.userinfo,z.host=_.host,z.port=_.port),z.scheme=_.scheme),z.fragment=x.fragment,z}function Et(_,x,R){var L=l({scheme:"null"},R);return Ke(Qe(fe(_,L),fe(x,L),L,!0),L)}function St(_,x){return typeof _=="string"?_=Ke(fe(_,x),x):i(_)==="object"&&(_=fe(Ke(_,x),x)),_}function Rt(_,x,R){return typeof _=="string"?_=Ke(fe(_,R),R):i(_)==="object"&&(_=Ke(_,R)),typeof x=="string"?x=Ke(fe(x,R),R):i(x)==="object"&&(x=Ke(x,R)),_===x}function Gr(_,x){return _&&_.toString().replace(!x||!x.iri?u.ESCAPE:p.ESCAPE,U)}function Nt(_,x){return _&&_.toString().replace(!x||!x.iri?u.PCT_ENCODED:p.PCT_ENCODED,G)}var la={scheme:"http",domainHost:!0,parse:function(x,R){return x.host||(x.error=x.error||"HTTP URIs must have a host."),x},serialize:function(x,R){var L=String(x.scheme).toLowerCase()==="https";return(x.port===(L?443:80)||x.port==="")&&(x.port=void 0),x.path||(x.path="/"),x}},ua={scheme:"https",domainHost:la.domainHost,parse:la.parse,serialize:la.serialize};function Vn(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var Ma={scheme:"ws",domainHost:!0,parse:function(x,R){var L=x;return L.secure=Vn(L),L.resourceName=(L.path||"/")+(L.query?"?"+L.query:""),L.path=void 0,L.query=void 0,L},serialize:function(x,R){if((x.port===(Vn(x)?443:80)||x.port==="")&&(x.port=void 0),typeof x.secure=="boolean"&&(x.scheme=x.secure?"wss":"ws",x.secure=void 0),x.resourceName){var L=x.resourceName.split("?"),z=f(L,2),J=z[0],le=z[1];x.path=J&&J!=="/"?J:void 0,x.query=le,x.resourceName=void 0}return x.fragment=void 0,x}},Ji={scheme:"wss",domainHost:Ma.domainHost,parse:Ma.parse,serialize:Ma.serialize},Yi={},er=!0,eo="[A-Za-z0-9\\-\\.\\_\\~"+(er?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",tr="[0-9A-Fa-f]",Al=s(s("%[EFef]"+tr+"%"+tr+tr+"%"+tr+tr)+"|"+s("%[89A-Fa-f]"+tr+"%"+tr+tr)+"|"+s("%"+tr+tr)),Nl="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Dl="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",jl=t(Dl,'[\\"\\\\]'),pa="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",$l=new RegExp(eo,"g"),Zr=new RegExp(Al,"g"),Ml=new RegExp(t("[^]",Nl,"[\\.]",'[\\"]',jl),"g"),Fs=new RegExp(t("[^]",eo,pa),"g"),to=Fs;function Wn(_){var x=G(_);return x.match($l)?x:_}var Gn={scheme:"mailto",parse:function(x,R){var L=x,z=L.to=L.path?L.path.split(","):[];if(L.path=void 0,L.query){for(var J=!1,le={},_e=L.query.split("&"),me=0,je=_e.length;me{e.exports=function r(t,s){if(t===s)return!0;if(t&&s&&typeof t=="object"&&typeof s=="object"){if(t.constructor!==s.constructor)return!1;var i,n,o;if(Array.isArray(t)){if(i=t.length,i!=s.length)return!1;for(n=i;n--!==0;)if(!r(t[n],s[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if(o=Object.keys(t),i=o.length,i!==Object.keys(s).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(s,o[n]))return!1;for(n=i;n--!==0;){var l=o[n];if(!r(t[l],s[l]))return!1}return!0}return t!==t&&s!==s}}),x$=Ne((a,e)=>{e.exports=function(t){for(var s=0,i=t.length,n=0,o;n=55296&&o<=56319&&n{e.exports={copy:r,checkDataType:t,checkDataTypes:s,coerceToTypes:n,toHash:o,getProperty:u,escapeQuotes:p,equal:sf(),ucs2length:x$(),varOccurences:f,varReplace:d,schemaHasRules:v,schemaHasRulesExcept:h,schemaUnknownRules:m,toQuotedString:y,getPathExpr:g,getPath:b,getData:T,unescapeFragment:D,unescapeJsonPointer:N,escapeFragment:A,escapeJsonPointer:$};function r(C,O){O=O||{};for(var j in C)O[j]=C[j];return O}function t(C,O,j,F){var B=F?" !== ":" === ",V=F?" || ":" && ",Q=F?"!":"",K=F?"":"!";switch(C){case"null":return O+B+"null";case"array":return Q+"Array.isArray("+O+")";case"object":return"("+Q+O+V+"typeof "+O+B+'"object"'+V+K+"Array.isArray("+O+"))";case"integer":return"(typeof "+O+B+'"number"'+V+K+"("+O+" % 1)"+V+O+B+O+(j?V+Q+"isFinite("+O+")":"")+")";case"number":return"(typeof "+O+B+'"'+C+'"'+(j?V+Q+"isFinite("+O+")":"")+")";default:return"typeof "+O+B+'"'+C+'"'}}function s(C,O,j){switch(C.length){case 1:return t(C[0],O,j,!0);default:var F="",B=o(C);B.array&&B.object&&(F=B.null?"(":"(!"+O+" || ",F+="typeof "+O+' !== "object")',delete B.null,delete B.array,delete B.object),B.number&&delete B.integer;for(var V in B)F+=(F?" && ":"")+t(V,O,j,!0);return F}}var i=o(["string","number","integer","boolean","null"]);function n(C,O){if(Array.isArray(O)){for(var j=[],F=0;F=O)throw new Error("Cannot access property/index "+F+" levels up, current level is "+O);return j[O-F]}if(F>O)throw new Error("Cannot access data "+F+" levels up, current level is "+O);if(V="data"+(O-F||""),!B)return V}for(var K=V,W=B.split("/"),ae=0;ae{var r=Mn();e.exports=t;function t(s){r.copy(s,this)}}),_$=Ne((a,e)=>{var r=e.exports=function(i,n,o){typeof n=="function"&&(o=n,n={}),o=n.cb||o;var l=typeof o=="function"?o:o.pre||function(){},c=o.post||function(){};t(n,l,c,i,"",i)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.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 t(i,n,o,l,c,u,p,f,d,v){if(l&&typeof l=="object"&&!Array.isArray(l)){n(l,c,u,p,f,d,v);for(var h in l){var m=l[h];if(Array.isArray(m)){if(h in r.arrayKeywords)for(var y=0;y{var r=b$(),t=sf(),s=Mn(),i=TS(),n=_$();e.exports=o,o.normalizeId=b,o.fullPath=m,o.url=w,o.ids=P,o.inlineRef=d,o.schema=l;function o(T,k,D){var A=this._refs[D];if(typeof A=="string")if(this._refs[A])A=this._refs[A];else return o.call(this,T,k,A);if(A=A||this._schemas[D],A instanceof i)return d(A.schema,this._opts.inlineRefs)?A.schema:A.validate||this._compile(A);var $=l.call(this,k,D),N,C,O;return $&&(N=$.schema,k=$.root,O=$.baseId),N instanceof i?C=N.validate||T.call(this,N.schema,k,void 0,O):N!==void 0&&(C=d(N,this._opts.inlineRefs)?N:T.call(this,N,k,void 0,O)),C}function l(T,k){var D=r.parse(k),A=y(D),$=m(this._getId(T.schema));if(Object.keys(T.schema).length===0||A!==$){var N=b(A),C=this._refs[N];if(typeof C=="string")return c.call(this,T,C,D);if(C instanceof i)C.validate||this._compile(C),T=C;else if(C=this._schemas[N],C instanceof i){if(C.validate||this._compile(C),N==b(k))return{schema:C,root:T,baseId:$};T=C}else return;if(!T.schema)return;$=m(this._getId(T.schema))}return p.call(this,D,$,T.schema,T)}function c(T,k,D){var A=l.call(this,T,k);if(A){var $=A.schema,N=A.baseId;T=A.root;var C=this._getId($);return C&&(N=w(N,C)),p.call(this,D,N,$,T)}}var u=s.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function p(T,k,D,A){if(T.fragment=T.fragment||"",T.fragment.slice(0,1)=="/"){for(var $=T.fragment.split("/"),N=1;N<$.length;N++){var C=$[N];if(C){if(C=s.unescapeFragment(C),D=D[C],D===void 0)break;var O;if(!u[C]&&(O=this._getId(D),O&&(k=w(k,O)),D.$ref)){var j=w(k,D.$ref),F=l.call(this,A,j);F&&(D=F.schema,A=F.root,k=F.baseId)}}}if(D!==void 0&&D!==A.schema)return{schema:D,root:A,baseId:k}}}var f=s.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function d(T,k){if(k===!1)return!1;if(k===void 0||k===!0)return v(T);if(k)return h(T)<=k}function v(T){var k;if(Array.isArray(T)){for(var D=0;D{var r=nf();e.exports={Validation:i(t),MissingRef:i(s)};function t(n){this.message="validation failed",this.errors=n,this.ajv=this.validation=!0}s.message=function(n,o){return"can't resolve reference "+o+" from id "+n};function s(n,o,l){this.message=l||s.message(n,o),this.missingRef=r.url(n,o),this.missingSchema=r.normalizeId(r.fullPath(this.missingRef))}function i(n){return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}}),RS=Ne((a,e)=>{e.exports=function(r,t){t||(t={}),typeof t=="function"&&(t={cmp:t});var s=typeof t.cycles=="boolean"?t.cycles:!1,i=t.cmp&&(function(o){return function(l){return function(c,u){var p={key:c,value:l[c]},f={key:u,value:l[u]};return o(p,f)}}})(t.cmp),n=[];return(function o(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var c,u;if(Array.isArray(l)){for(u="[",c=0;c{e.exports=function(t,s,i){var n="",o=t.schema.$async===!0,l=t.util.schemaHasRulesExcept(t.schema,t.RULES.all,"$ref"),c=t.self._getId(t.schema);if(t.opts.strictKeywords){var u=t.util.schemaUnknownRules(t.schema,t.RULES.keywords);if(u){var p="unknown keyword: "+u;if(t.opts.strictKeywords==="log")t.logger.warn(p);else throw new Error(p)}}if(t.isTop&&(n+=" var validate = ",o&&(t.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",c&&(t.opts.sourceCode||t.opts.processCode)&&(n+=" "+("/*# sourceURL="+c+" */")+" ")),typeof t.schema=="boolean"||!(l||t.schema.$ref)){var s="false schema",f=t.level,d=t.dataLevel,v=t.schema[s],h=t.schemaPath+t.util.getProperty(s),m=t.errSchemaPath+"/"+s,k=!t.opts.allErrors,$,y="data"+(d||""),T="valid"+f;if(t.schema===!1){t.isTop?k=!0:n+=" var "+T+" = false; ";var g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+($||"false schema")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(m)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'boolean schema is false' "),t.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+t.schemaPath+" , data: "+y+" "),n+=" } "):n+=" {} ";var b=n;n=g.pop(),!t.compositeRule&&k?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else t.isTop?o?n+=" return data; ":n+=" validate.errors = null; return true; ":n+=" var "+T+" = true; ";return t.isTop&&(n+=" }; return validate; "),n}if(t.isTop){var w=t.isTop,f=t.level=0,d=t.dataLevel=0,y="data";if(t.rootId=t.resolve.fullPath(t.self._getId(t.root.schema)),t.baseId=t.baseId||t.rootId,delete t.isTop,t.dataPathArr=[""],t.schema.default!==void 0&&t.opts.useDefaults&&t.opts.strictDefaults){var P="default is ignored in the schema root";if(t.opts.strictDefaults==="log")t.logger.warn(P);else throw new Error(P)}n+=" var vErrors = null; ",n+=" var errors = 0; ",n+=" if (rootData === undefined) rootData = data; "}else{var{level:f,dataLevel:d}=t,y="data"+(d||"");if(c&&(t.baseId=t.resolve.url(t.baseId,c)),o&&!t.async)throw new Error("async schema in sync schema");n+=" var errs_"+f+" = errors;"}var T="valid"+f,k=!t.opts.allErrors,D="",A="",$,N=t.schema.type,C=Array.isArray(N);if(N&&t.opts.nullable&&t.schema.nullable===!0&&(C?N.indexOf("null")==-1&&(N=N.concat("null")):N!="null"&&(N=[N,"null"],C=!0)),C&&N.length==1&&(N=N[0],C=!1),t.schema.$ref&&l){if(t.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+t.errSchemaPath+'" (see option extendRefs)');t.opts.extendRefs!==!0&&(l=!1,t.logger.warn('$ref: keywords ignored in schema at path "'+t.errSchemaPath+'"'))}if(t.schema.$comment&&t.opts.$comment&&(n+=" "+t.RULES.all.$comment.code(t,"$comment")),N){if(t.opts.coerceTypes)var O=t.util.coerceToTypes(t.opts.coerceTypes,N);var j=t.RULES.types[N];if(O||C||j===!0||j&&!We(j)){var h=t.schemaPath+".type",m=t.errSchemaPath+"/type",h=t.schemaPath+".type",m=t.errSchemaPath+"/type",F=C?"checkDataTypes":"checkDataType";if(n+=" if ("+t.util[F](N,y,t.opts.strictNumbers,!0)+") { ",O){var B="dataType"+f,V="coerced"+f;n+=" var "+B+" = typeof "+y+"; var "+V+" = undefined; ",t.opts.coerceTypes=="array"&&(n+=" if ("+B+" == 'object' && Array.isArray("+y+") && "+y+".length == 1) { "+y+" = "+y+"[0]; "+B+" = typeof "+y+"; if ("+t.util.checkDataType(t.schema.type,y,t.opts.strictNumbers)+") "+V+" = "+y+"; } "),n+=" if ("+V+" !== undefined) ; ";var Q=O;if(Q)for(var K,W=-1,ae=Q.length-1;W{var r=nf(),t=Mn(),s=of(),i=RS(),n=PS(),o=t.ucs2length,l=sf(),c=s.Validation;e.exports=u;function u(b,w,P,T){var k=this,D=this._opts,A=[void 0],$={},N=[],C={},O=[],j={},F=[];w=w||{schema:b,refVal:A,refs:$};var B=p.call(this,b,w,T),V=this._compilations[B.index];if(B.compiling)return V.callValidate=ee;var Q=this._formats,K=this.RULES;try{var W=Le(b,w,P,T);V.validate=W;var ae=V.callValidate;return ae&&(ae.schema=W.schema,ae.errors=null,ae.refs=W.refs,ae.refVal=W.refVal,ae.root=W.root,ae.$async=W.$async,D.sourceCode&&(ae.source=W.source)),W}finally{f.call(this,b,w,T)}function ee(){var Z=V.validate,X=Z.apply(this,arguments);return ee.errors=Z.errors,X}function Le(Z,X,ce,De){var fe=!X||X&&X.schema==Z;if(X.schema!=w.schema)return u.call(k,Z,X,ce,De);var $e=Z.$async===!0,Ve=n({isTop:!0,schema:Z,isRoot:fe,baseId:De,root:X,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:s.MissingRef,RULES:K,validate:n,util:t,resolve:r,resolveRef:he,usePattern:G,useDefault:re,useCustomRule:pe,opts:D,formats:Q,logger:k.logger,self:k});Ve=g(A,m)+g(N,v)+g(O,h)+g(F,y)+Ve,D.processCode&&(Ve=D.processCode(Ve,Z));var Se;try{var tt=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Ve);Se=tt(k,K,Q,w,A,O,F,l,o,c),A[0]=Se}catch(We){throw k.logger.error("Error compiling schema, function code:",Ve),We}return Se.schema=Z,Se.errors=null,Se.refs=$,Se.refVal=A,Se.root=fe?Se:X,$e&&(Se.$async=!0),D.sourceCode===!0&&(Se.source={code:Ve,patterns:N,defaults:O}),Se}function he(Z,X,ce){X=r.url(Z,X);var De=$[X],fe,$e;if(De!==void 0)return fe=A[De],$e="refVal["+De+"]",U(fe,$e);if(!ce&&w.refs){var Ve=w.refs[X];if(Ve!==void 0)return fe=w.refVal[Ve],$e=Ee(X,fe),U(fe,$e)}$e=Ee(X);var Se=r.call(k,Le,w,X);if(Se===void 0){var tt=P&&P[X];tt&&(Se=r.inlineRef(tt,D.inlineRefs)?tt:u.call(k,tt,w,P,Z))}if(Se===void 0)be(X);else return Te(X,Se),U(Se,$e)}function Ee(Z,X){var ce=A.length;return A[ce]=X,$[Z]=ce,"refVal"+ce}function be(Z){delete $[Z]}function Te(Z,X){var ce=$[Z];A[ce]=X}function U(Z,X){return typeof Z=="object"||typeof Z=="boolean"?{code:X,schema:Z,inline:!0}:{code:X,$async:Z&&!!Z.$async}}function G(Z){var X=C[Z];return X===void 0&&(X=C[Z]=N.length,N[X]=Z),"pattern"+X}function re(Z){switch(typeof Z){case"boolean":case"number":return""+Z;case"string":return t.toQuotedString(Z);case"object":if(Z===null)return"null";var X=i(Z),ce=j[X];return ce===void 0&&(ce=j[X]=O.length,O[ce]=Z),"default"+ce}}function pe(Z,X,ce,De){if(k._opts.validateSchema!==!1){var fe=Z.definition.dependencies;if(fe&&!fe.every(function(Et){return Object.prototype.hasOwnProperty.call(ce,Et)}))throw new Error("parent schema must have all required keywords: "+fe.join(","));var $e=Z.definition.validateSchema;if($e){var Ve=$e(X);if(!Ve){var Se="keyword schema is invalid: "+k.errorsText($e.errors);if(k._opts.validateSchema=="log")k.logger.error(Se);else throw new Error(Se)}}}var tt=Z.definition.compile,We=Z.definition.inline,Je=Z.definition.macro,Ke;if(tt)Ke=tt.call(k,X,ce,De);else if(Je)Ke=Je.call(k,X,ce,De),D.validateSchema!==!1&&k.validateSchema(Ke,!0);else if(We)Ke=We.call(k,De,Z.keyword,X,ce);else if(Ke=Z.definition.validate,!Ke)return;if(Ke===void 0)throw new Error('custom keyword "'+Z.keyword+'"failed to compile');var Qe=F.length;return F[Qe]=Ke,{code:"customRule"+Qe,validate:Ke}}}function p(b,w,P){var T=d.call(this,b,w,P);return T>=0?{index:T,compiling:!0}:(T=this._compilations.length,this._compilations[T]={schema:b,root:w,baseId:P},{index:T,compiling:!1})}function f(b,w,P){var T=d.call(this,b,w,P);T>=0&&this._compilations.splice(T,1)}function d(b,w,P){for(var T=0;T{var r=e.exports=function(){this._cache={}};r.prototype.put=function(s,i){this._cache[s]=i},r.prototype.get=function(s){return this._cache[s]},r.prototype.del=function(s){delete this._cache[s]},r.prototype.clear=function(){this._cache={}}}),w$=Ne((a,e)=>{var r=Mn(),t=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,s=[0,31,28,31,30,31,30,31,31,30,31,30,31],i=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,n=/^(?=.{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,o=/^(?:[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,l=/^(?:[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,c=/^(?:(?:[^\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,u=/^(?:(?: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,p=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,f=/^(?:\/(?:[^~/]|~0|~1)*)*$/,d=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,v=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;e.exports=h;function h(A){return A=A=="full"?"full":"fast",r.copy(h[A])}h.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":c,url:u,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:n,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:D,uuid:p,"json-pointer":f,"json-pointer-uri-fragment":d,"relative-json-pointer":v},h.full={date:y,time:g,"date-time":w,uri:T,"uri-reference":l,"uri-template":c,url:u,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:n,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:D,uuid:p,"json-pointer":f,"json-pointer-uri-fragment":d,"relative-json-pointer":v};function m(A){return A%4===0&&(A%100!==0||A%400===0)}function y(A){var $=A.match(t);if(!$)return!1;var N=+$[1],C=+$[2],O=+$[3];return C>=1&&C<=12&&O>=1&&O<=(C==2&&m(N)?29:s[C])}function g(A,$){var N=A.match(i);if(!N)return!1;var C=N[1],O=N[2],j=N[3],F=N[5];return(C<=23&&O<=59&&j<=59||C==23&&O==59&&j==60)&&(!$||F)}var b=/t|\s/i;function w(A){var $=A.split(b);return $.length==2&&y($[0])&&g($[1],!0)}var P=/\/|:/;function T(A){return P.test(A)&&o.test(A)}var k=/[^\\]\\Z/;function D(A){if(k.test(A))return!1;try{return new RegExp(A),!0}catch{return!1}}}),T$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.errSchemaPath+"/"+s,p=!t.opts.allErrors,f="data"+(l||""),d="valid"+o,v,h;if(c=="#"||c=="#/")t.isRoot?(v=t.async,h="validate"):(v=t.root.schema.$async===!0,h="root.refVal[0]");else{var m=t.resolveRef(t.baseId,c,t.isRoot);if(m===void 0){var y=t.MissingRefError.message(t.baseId,c);if(t.opts.missingRefs=="fail"){t.logger.error(y);var g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { ref: '"+t.util.escapeQuotes(c)+"' } ",t.opts.messages!==!1&&(n+=" , message: 'can\\'t resolve reference "+t.util.escapeQuotes(c)+"' "),t.opts.verbose&&(n+=" , schema: "+t.util.toQuotedString(c)+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var b=n;n=g.pop(),!t.compositeRule&&p?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p&&(n+=" if (false) { ")}else if(t.opts.missingRefs=="ignore")t.logger.warn(y),p&&(n+=" if (true) { ");else throw new t.MissingRefError(t.baseId,c,y)}else if(m.inline){var w=t.util.copy(t);w.level++;var P="valid"+w.level;w.schema=m.schema,w.schemaPath="",w.errSchemaPath=c;var T=t.validate(w).replace(/validate\.schema/g,m.code);n+=" "+T+" ",p&&(n+=" if ("+P+") { ")}else v=m.$async===!0||t.async&&m.$async!==!1,h=m.code}if(h){var g=g||[];g.push(n),n="",t.opts.passContext?n+=" "+h+".call(this, ":n+=" "+h+"( ",n+=" "+f+", (dataPath || '')",t.errorPath!='""'&&(n+=" + "+t.errorPath);var k=l?"data"+(l-1||""):"parentData",D=l?t.dataPathArr[l]:"parentDataProperty";n+=" , "+k+" , "+D+", rootData) ";var A=n;if(n=g.pop(),v){if(!t.async)throw new Error("async schema referenced by sync schema");p&&(n+=" var "+d+"; "),n+=" try { await "+A+"; ",p&&(n+=" "+d+" = true; "),n+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",p&&(n+=" "+d+" = false; "),n+=" } ",p&&(n+=" if ("+d+") { ")}else n+=" if (!"+A+") { if (vErrors === null) vErrors = "+h+".errors; else vErrors = vErrors.concat("+h+".errors); errors = vErrors.length; } ",p&&(n+=" else { ")}return n}}),R$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.schema[s],l=t.schemaPath+t.util.getProperty(s),c=t.errSchemaPath+"/"+s,u=!t.opts.allErrors,p=t.util.copy(t),f="";p.level++;var d="valid"+p.level,v=p.baseId,h=!0,m=o;if(m)for(var y,g=-1,b=m.length-1;g0||y===!1:t.util.schemaHasRules(y,t.RULES.all))&&(h=!1,p.schema=y,p.schemaPath=l+"["+g+"]",p.errSchemaPath=c+"/"+g,n+=" "+t.validate(p)+" ",p.baseId=v,u&&(n+=" if ("+d+") { ",f+="}"));return u&&(h?n+=" if (true) { ":n+=" "+f.slice(0,-1)+" "),n}}),P$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b=c.every(function($){return t.opts.strictKeywords?typeof $=="object"&&Object.keys($).length>0||$===!1:t.util.schemaHasRules($,t.RULES.all)});if(b){var w=m.baseId;n+=" var "+h+" = errors; var "+v+" = false; ";var P=t.compositeRule;t.compositeRule=m.compositeRule=!0;var T=c;if(T)for(var k,D=-1,A=T.length-1;D{e.exports=function(t,s,i){var n=" ",o=t.schema[s],l=t.errSchemaPath+"/"+s,c=!t.opts.allErrors,u=t.util.toQuotedString(o);return t.opts.$comment===!0?n+=" console.log("+u+");":typeof t.opts.$comment=="function"&&(n+=" self._opts.$comment("+u+", "+t.util.toQuotedString(l)+", validate.root.schema);"),n}}),C$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c,h||(n+=" var schema"+o+" = validate.schema"+u+";"),n+="var "+v+" = equal("+d+", schema"+o+"); if (!"+v+") { ";var y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { allowedValue: schema"+o+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be equal to constant' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var g=n;return n=y.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",f&&(n+=" else { "),n}}),k$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b="i"+o,w=m.dataLevel=t.dataLevel+1,P="data"+w,T=t.baseId,k=t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all);if(n+="var "+h+" = errors;var "+v+";",k){var D=t.compositeRule;t.compositeRule=m.compositeRule=!0,m.schema=c,m.schemaPath=u,m.errSchemaPath=p,n+=" var "+g+" = false; for (var "+b+" = 0; "+b+" < "+d+".length; "+b+"++) { ",m.errorPath=t.util.getPathExpr(t.errorPath,b,t.opts.jsonPointers,!0);var A=d+"["+b+"]";m.dataPathArr[w]=b;var $=t.validate(m);m.baseId=T,t.util.varOccurences($,P)<2?n+=" "+t.util.varReplace($,P,A)+" ":n+=" var "+P+" = "+A+"; "+$+" ",n+=" if ("+g+") break; } ",t.compositeRule=m.compositeRule=D,n+=" "+y+" if (!"+g+") {"}else n+=" if ("+d+".length == 0) {";var N=N||[];N.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should contain a valid item' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var C=n;return n=N.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+C+"]); ":n+=" validate.errors = ["+C+"]; return false; ":n+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { ",k&&(n+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),t.opts.allErrors&&(n+=" } "),n}}),I$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t),m="";h.level++;var y="valid"+h.level,g={},b={},w=t.opts.ownProperties;for(D in c)if(D!="__proto__"){var P=c[D],T=Array.isArray(P)?b:g;T[D]=P}n+="var "+v+" = errors;";var k=t.errorPath;n+="var missing"+o+";";for(var D in b)if(T=b[D],T.length){if(n+=" if ( "+d+t.util.getProperty(D)+" !== undefined ",w&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(D)+"') "),f){n+=" && ( ";var A=T;if(A)for(var $,N=-1,C=A.length-1;N0||P===!1:t.util.schemaHasRules(P,t.RULES.all))&&(n+=" "+y+" = true; if ( "+d+t.util.getProperty(D)+" !== undefined ",w&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(D)+"') "),n+=") { ",h.schema=P,h.schemaPath=u+t.util.getProperty(D),h.errSchemaPath=p+"/"+t.util.escapeFragment(D),n+=" "+t.validate(h)+" ",h.baseId=ee,n+=" } ",f&&(n+=" if ("+y+") { ",m+="}"))}return f&&(n+=" "+m+" if ("+v+" == errors) {"),n}}),A$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c;var y="i"+o,g="schema"+o;h||(n+=" var "+g+" = validate.schema"+u+";"),n+="var "+v+";",h&&(n+=" if (schema"+o+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+o+")) "+v+" = false; else {"),n+=""+v+" = false;for (var "+y+"=0; "+y+"<"+g+".length; "+y+"++) if (equal("+d+", "+g+"["+y+"])) { "+v+" = true; break; }",h&&(n+=" } "),n+=" if (!"+v+") { ";var b=b||[];b.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { allowedValues: schema"+o+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be equal to one of the allowed values' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var w=n;return n=b.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",f&&(n+=" else { "),n}}),N$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||"");if(t.opts.format===!1)return f&&(n+=" if (true) { "),n;var v=t.opts.$data&&c&&c.$data,h;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c;var m=t.opts.unknownFormats,y=Array.isArray(m);if(v){var g="format"+o,b="isObject"+o,w="formatType"+o;n+=" var "+g+" = formats["+h+"]; var "+b+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+w+" = "+b+" && "+g+".type || 'string'; if ("+b+") { ",t.async&&(n+=" var async"+o+" = "+g+".async; "),n+=" "+g+" = "+g+".validate; } if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),n+=" (",m!="ignore"&&(n+=" ("+h+" && !"+g+" ",y&&(n+=" && self._opts.unknownFormats.indexOf("+h+") == -1 "),n+=") || "),n+=" ("+g+" && "+w+" == '"+i+"' && !(typeof "+g+" == 'function' ? ",t.async?n+=" (async"+o+" ? await "+g+"("+d+") : "+g+"("+d+")) ":n+=" "+g+"("+d+") ",n+=" : "+g+".test("+d+"))))) {"}else{var g=t.formats[c];if(!g){if(m=="ignore")return t.logger.warn('unknown format "'+c+'" ignored in schema at path "'+t.errSchemaPath+'"'),f&&(n+=" if (true) { "),n;if(y&&m.indexOf(c)>=0)return f&&(n+=" if (true) { "),n;throw new Error('unknown format "'+c+'" is used in schema at path "'+t.errSchemaPath+'"')}var b=typeof g=="object"&&!(g instanceof RegExp)&&g.validate,w=b&&g.type||"string";if(b){var P=g.async===!0;g=g.validate}if(w!=i)return f&&(n+=" if (true) { "),n;if(P){if(!t.async)throw new Error("async format in sync schema");var T="formats"+t.util.getProperty(c)+".validate";n+=" if (!(await "+T+"("+d+"))) { "}else{n+=" if (! ";var T="formats"+t.util.getProperty(c);b&&(T+=".validate"),typeof g=="function"?n+=" "+T+"("+d+") ":n+=" "+T+".test("+d+") ",n+=") { "}}var k=k||[];k.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { format: ",v?n+=""+h:n+=""+t.util.toQuotedString(c),n+=" } ",t.opts.messages!==!1&&(n+=` , message: 'should match format "`,v?n+="' + "+h+" + '":n+=""+t.util.escapeQuotes(c),n+=`"' `),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+t.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var D=n;return n=k.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+D+"]); ":n+=" validate.errors = ["+D+"]; return false; ":n+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { "),n}}),D$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t);m.level++;var y="valid"+m.level,g=t.schema.then,b=t.schema.else,w=g!==void 0&&(t.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:t.util.schemaHasRules(g,t.RULES.all)),P=b!==void 0&&(t.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:t.util.schemaHasRules(b,t.RULES.all)),T=m.baseId;if(w||P){var k;m.createErrors=!1,m.schema=c,m.schemaPath=u,m.errSchemaPath=p,n+=" var "+h+" = errors; var "+v+" = true; ";var D=t.compositeRule;t.compositeRule=m.compositeRule=!0,n+=" "+t.validate(m)+" ",m.baseId=T,m.createErrors=!0,n+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",t.compositeRule=m.compositeRule=D,w?(n+=" if ("+y+") { ",m.schema=t.schema.then,m.schemaPath=t.schemaPath+".then",m.errSchemaPath=t.errSchemaPath+"/then",n+=" "+t.validate(m)+" ",m.baseId=T,n+=" "+v+" = "+y+"; ",w&&P?(k="ifClause"+o,n+=" var "+k+" = 'then'; "):k="'then'",n+=" } ",P&&(n+=" else { ")):n+=" if (!"+y+") { ",P&&(m.schema=t.schema.else,m.schemaPath=t.schemaPath+".else",m.errSchemaPath=t.errSchemaPath+"/else",n+=" "+t.validate(m)+" ",m.baseId=T,n+=" "+v+" = "+y+"; ",w&&P?(k="ifClause"+o,n+=" var "+k+" = 'else'; "):k="'else'",n+=" } "),n+=" if (!"+v+") { var err = ",t.createErrors!==!1?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { failingKeyword: "+k+" } ",t.opts.messages!==!1&&(n+=` , message: 'should match "' + `+k+` + '" schema' `),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&f&&(t.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } ",f&&(n+=" else { ")}else f&&(n+=" if (true) { ");return n}}),j$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b="i"+o,w=m.dataLevel=t.dataLevel+1,P="data"+w,T=t.baseId;if(n+="var "+h+" = errors;var "+v+";",Array.isArray(c)){var k=t.schema.additionalItems;if(k===!1){n+=" "+v+" = "+d+".length <= "+c.length+"; ";var D=p;p=t.errSchemaPath+"/additionalItems",n+=" if (!"+v+") { ";var A=A||[];A.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+c.length+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have more than "+c.length+" items' "),t.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var $=n;n=A.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+$+"]); ":n+=" validate.errors = ["+$+"]; return false; ":n+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",p=D,f&&(y+="}",n+=" else { ")}var N=c;if(N){for(var C,O=-1,j=N.length-1;O0||C===!1:t.util.schemaHasRules(C,t.RULES.all)){n+=" "+g+" = true; if ("+d+".length > "+O+") { ";var F=d+"["+O+"]";m.schema=C,m.schemaPath=u+"["+O+"]",m.errSchemaPath=p+"/"+O,m.errorPath=t.util.getPathExpr(t.errorPath,O,t.opts.jsonPointers,!0),m.dataPathArr[w]=O;var B=t.validate(m);m.baseId=T,t.util.varOccurences(B,P)<2?n+=" "+t.util.varReplace(B,P,F)+" ":n+=" var "+P+" = "+F+"; "+B+" ",n+=" } ",f&&(n+=" if ("+g+") { ",y+="}")}}if(typeof k=="object"&&(t.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:t.util.schemaHasRules(k,t.RULES.all))){m.schema=k,m.schemaPath=t.schemaPath+".additionalItems",m.errSchemaPath=t.errSchemaPath+"/additionalItems",n+=" "+g+" = true; if ("+d+".length > "+c.length+") { for (var "+b+" = "+c.length+"; "+b+" < "+d+".length; "+b+"++) { ",m.errorPath=t.util.getPathExpr(t.errorPath,b,t.opts.jsonPointers,!0);var F=d+"["+b+"]";m.dataPathArr[w]=b;var B=t.validate(m);m.baseId=T,t.util.varOccurences(B,P)<2?n+=" "+t.util.varReplace(B,P,F)+" ":n+=" var "+P+" = "+F+"; "+B+" ",f&&(n+=" if (!"+g+") break; "),n+=" } } ",f&&(n+=" if ("+g+") { ",y+="}")}}else if(t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){m.schema=c,m.schemaPath=u,m.errSchemaPath=p,n+=" for (var "+b+" = 0; "+b+" < "+d+".length; "+b+"++) { ",m.errorPath=t.util.getPathExpr(t.errorPath,b,t.opts.jsonPointers,!0);var F=d+"["+b+"]";m.dataPathArr[w]=b;var B=t.validate(m);m.baseId=T,t.util.varOccurences(B,P)<2?n+=" "+t.util.varReplace(B,P,F)+" ":n+=" var "+P+" = "+F+"; "+B+" ",f&&(n+=" if (!"+g+") break; "),n+=" }"}return f&&(n+=" "+y+" if ("+h+" == errors) {"),n}}),pS=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,T,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c;var m=s=="maximum",y=m?"exclusiveMaximum":"exclusiveMinimum",g=t.schema[y],b=t.opts.$data&&g&&g.$data,w=m?"<":">",P=m?">":"<",T=void 0;if(!(v||typeof c=="number"||c===void 0))throw new Error(s+" must be number");if(!(b||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(y+" must be number or boolean");if(b){var k=t.util.getData(g.$data,l,t.dataPathArr),D="exclusive"+o,A="exclType"+o,$="exclIsNumber"+o,N="op"+o,C="' + "+N+" + '";n+=" var schemaExcl"+o+" = "+k+"; ",k="schemaExcl"+o,n+=" var "+D+"; var "+A+" = typeof "+k+"; if ("+A+" != 'boolean' && "+A+" != 'undefined' && "+A+" != 'number') { ";var T=y,O=O||[];O.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(T||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: '"+y+" should be boolean' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var j=n;n=O.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+j+"]); ":n+=" validate.errors = ["+j+"]; return false; ":n+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+A+" == 'number' ? ( ("+D+" = "+h+" === undefined || "+k+" "+w+"= "+h+") ? "+d+" "+P+"= "+k+" : "+d+" "+P+" "+h+" ) : ( ("+D+" = "+k+" === true) ? "+d+" "+P+"= "+h+" : "+d+" "+P+" "+h+" ) || "+d+" !== "+d+") { var op"+o+" = "+D+" ? '"+w+"' : '"+w+"='; ",c===void 0&&(T=y,p=t.errSchemaPath+"/"+y,h=k,v=b)}else{var $=typeof g=="number",C=w;if($&&v){var N="'"+C+"'";n+=" if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" ( "+h+" === undefined || "+g+" "+w+"= "+h+" ? "+d+" "+P+"= "+g+" : "+d+" "+P+" "+h+" ) || "+d+" !== "+d+") { "}else{$&&c===void 0?(D=!0,T=y,p=t.errSchemaPath+"/"+y,h=g,P+="="):($&&(h=Math[m?"min":"max"](g,c)),g===($?h:!0)?(D=!0,T=y,p=t.errSchemaPath+"/"+y,P+="="):(D=!1,C+="="));var N="'"+C+"'";n+=" if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+d+" "+P+" "+h+" || "+d+" !== "+d+") { "}}T=T||s;var O=O||[];O.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(T||"_limit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { comparison: "+N+", limit: "+h+", exclusive: "+D+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be "+C+" ",v?n+="' + "+h:n+=""+h+"'"),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var j=n;return n=O.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+j+"]); ":n+=" validate.errors = ["+j+"]; return false; ":n+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { "),n}}),dS=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,y,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");var m=s=="maxItems"?">":"<";n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+d+".length "+m+" "+h+") { ";var y=s,g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(y||"_limitItems")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have ",s=="maxItems"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+h+" + '":n+=""+c,n+=" items' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),fS=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,y,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");var m=s=="maxLength"?">":"<";n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),t.opts.unicode===!1?n+=" "+d+".length ":n+=" ucs2length("+d+") ",n+=" "+m+" "+h+") { ";var y=s,g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(y||"_limitLength")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be ",s=="maxLength"?n+="longer":n+="shorter",n+=" than ",v?n+="' + "+h+" + '":n+=""+c,n+=" characters' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),mS=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,y,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");var m=s=="maxProperties"?">":"<";n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" Object.keys("+d+").length "+m+" "+h+") { ";var y=s,g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(y||"_limitProperties")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have ",s=="maxProperties"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+h+" + '":n+=""+c,n+=" properties' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),$$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");n+="var division"+o+";if (",v&&(n+=" "+h+" !== undefined && ( typeof "+h+" != 'number' || "),n+=" (division"+o+" = "+d+" / "+h+", ",t.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+t.opts.multipleOfPrecision+" ":n+=" division"+o+" !== parseInt(division"+o+") ",n+=" ) ",v&&(n+=" ) "),n+=" ) { ";var m=m||[];m.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { multipleOf: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",v?n+="' + "+h:n+=""+h+"'"),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var y=n;return n=m.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),M$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t);h.level++;var m="valid"+h.level;if(t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){h.schema=c,h.schemaPath=u,h.errSchemaPath=p,n+=" var "+v+" = errors; ";var y=t.compositeRule;t.compositeRule=h.compositeRule=!0,h.createErrors=!1;var g;h.opts.allErrors&&(g=h.opts.allErrors,h.opts.allErrors=!1),n+=" "+t.validate(h)+" ",h.createErrors=!0,g&&(h.opts.allErrors=g),t.compositeRule=h.compositeRule=y,n+=" if ("+m+") { ";var b=b||[];b.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var w=n;n=b.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { errors = "+v+"; if (vErrors !== null) { if ("+v+") vErrors.length = "+v+"; else vErrors = null; } ",t.opts.allErrors&&(n+=" } ")}else n+=" var err = ",t.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(n+=" if (false) { ");return n}}),L$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b=m.baseId,w="prevValid"+o,P="passingSchemas"+o;n+="var "+h+" = errors , "+w+" = false , "+v+" = false , "+P+" = null; ";var T=t.compositeRule;t.compositeRule=m.compositeRule=!0;var k=c;if(k)for(var D,A=-1,$=k.length-1;A<$;)D=k[A+=1],(t.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:t.util.schemaHasRules(D,t.RULES.all))?(m.schema=D,m.schemaPath=u+"["+A+"]",m.errSchemaPath=p+"/"+A,n+=" "+t.validate(m)+" ",m.baseId=b):n+=" var "+g+" = true; ",A&&(n+=" if ("+g+" && "+w+") { "+v+" = false; "+P+" = ["+P+", "+A+"]; } else { ",y+="}"),n+=" if ("+g+") { "+v+" = "+w+" = true; "+P+" = "+A+"; }";return t.compositeRule=m.compositeRule=T,n+=""+y+"if (!"+v+") { var err = ",t.createErrors!==!1?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { passingSchemas: "+P+" } ",t.opts.messages!==!1&&(n+=" , message: 'should match exactly one schema in oneOf' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&f&&(t.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+="} else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }",t.opts.allErrors&&(n+=" } "),n}}),q$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c;var m=v?"(new RegExp("+h+"))":t.usePattern(c);n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),n+=" !"+m+".test("+d+") ) { ";var y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { pattern: ",v?n+=""+h:n+=""+t.util.toQuotedString(c),n+=" } ",t.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,v?n+="' + "+h+" + '":n+=""+t.util.escapeQuotes(c),n+=`"' `),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+t.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var g=n;return n=y.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),F$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t),m="";h.level++;var y="valid"+h.level,g="key"+o,b="idx"+o,w=h.dataLevel=t.dataLevel+1,P="data"+w,T="dataProperties"+o,k=Object.keys(c||{}).filter(W),D=t.schema.patternProperties||{},A=Object.keys(D).filter(W),$=t.schema.additionalProperties,N=k.length||A.length,C=$===!1,O=typeof $=="object"&&Object.keys($).length,j=t.opts.removeAdditional,F=C||O||j,B=t.opts.ownProperties,V=t.baseId,Q=t.schema.required;if(Q&&!(t.opts.$data&&Q.$data)&&Q.length8)n+=" || validate.schema"+u+".hasOwnProperty("+g+") ";else{var ae=k;if(ae)for(var ee,Le=-1,he=ae.length-1;Le0||We===!1:t.util.schemaHasRules(We,t.RULES.all)){var Je=t.util.getProperty(ee),De=d+Je,Ke=$e&&We.default!==void 0;h.schema=We,h.schemaPath=u+Je,h.errSchemaPath=p+"/"+t.util.escapeFragment(ee),h.errorPath=t.util.getPath(t.errorPath,ee,t.opts.jsonPointers),h.dataPathArr[w]=t.util.toQuotedString(ee);var fe=t.validate(h);if(h.baseId=V,t.util.varOccurences(fe,P)<2){fe=t.util.varReplace(fe,P,De);var Qe=De}else{var Qe=P;n+=" var "+P+" = "+De+"; "}if(Ke)n+=" "+fe+" ";else{if(K&&K[ee]){n+=" if ( "+Qe+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(ee)+"') "),n+=") { "+y+" = false; ";var G=t.errorPath,pe=p,Et=t.util.escapeQuotes(ee);t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPath(G,ee,t.opts.jsonPointers)),p=t.errSchemaPath+"/required";var Z=Z||[];Z.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { missingProperty: '"+Et+"' } ",t.opts.messages!==!1&&(n+=" , message: '",t.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+Et+"\\'",n+="' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var X=n;n=Z.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+X+"]); ":n+=" validate.errors = ["+X+"]; return false; ":n+=" var err = "+X+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p=pe,t.errorPath=G,n+=" } else { "}else f?(n+=" if ( "+Qe+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(ee)+"') "),n+=") { "+y+" = true; } else { "):(n+=" if ("+Qe+" !== undefined ",B&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(ee)+"') "),n+=" ) { ");n+=" "+fe+" } "}}f&&(n+=" if ("+y+") { ",m+="}")}}if(A.length){var St=A;if(St)for(var be,Rt=-1,Gr=St.length-1;Rt0||We===!1:t.util.schemaHasRules(We,t.RULES.all)){h.schema=We,h.schemaPath=t.schemaPath+".patternProperties"+t.util.getProperty(be),h.errSchemaPath=t.errSchemaPath+"/patternProperties/"+t.util.escapeFragment(be),B?n+=" "+T+" = "+T+" || Object.keys("+d+"); for (var "+b+"=0; "+b+"<"+T+".length; "+b+"++) { var "+g+" = "+T+"["+b+"]; ":n+=" for (var "+g+" in "+d+") { ",n+=" if ("+t.usePattern(be)+".test("+g+")) { ",h.errorPath=t.util.getPathExpr(t.errorPath,g,t.opts.jsonPointers);var De=d+"["+g+"]";h.dataPathArr[w]=g;var fe=t.validate(h);h.baseId=V,t.util.varOccurences(fe,P)<2?n+=" "+t.util.varReplace(fe,P,De)+" ":n+=" var "+P+" = "+De+"; "+fe+" ",f&&(n+=" if (!"+y+") break; "),n+=" } ",f&&(n+=" else "+y+" = true; "),n+=" } ",f&&(n+=" if ("+y+") { ",m+="}")}}}return f&&(n+=" "+m+" if ("+v+" == errors) {"),n}}),U$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t),m="";h.level++;var y="valid"+h.level;if(n+="var "+v+" = errors;",t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){h.schema=c,h.schemaPath=u,h.errSchemaPath=p;var g="key"+o,b="idx"+o,w="i"+o,P="' + "+g+" + '",T=h.dataLevel=t.dataLevel+1,k="data"+T,D="dataProperties"+o,A=t.opts.ownProperties,$=t.baseId;A&&(n+=" var "+D+" = undefined; "),A?n+=" "+D+" = "+D+" || Object.keys("+d+"); for (var "+b+"=0; "+b+"<"+D+".length; "+b+"++) { var "+g+" = "+D+"["+b+"]; ":n+=" for (var "+g+" in "+d+") { ",n+=" var startErrs"+o+" = errors; ";var N=g,C=t.compositeRule;t.compositeRule=h.compositeRule=!0;var O=t.validate(h);h.baseId=$,t.util.varOccurences(O,k)<2?n+=" "+t.util.varReplace(O,k,N)+" ":n+=" var "+k+" = "+N+"; "+O+" ",t.compositeRule=h.compositeRule=C,n+=" if (!"+y+") { for (var "+w+"=startErrs"+o+"; "+w+"{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c;var y="schema"+o;if(!h)if(c.length0||k===!1:t.util.schemaHasRules(k,t.RULES.all))||(g[g.length]=w)}}else var g=c;if(h||g.length){var D=t.errorPath,A=h||g.length>=t.opts.loopRequired,$=t.opts.ownProperties;if(f)if(n+=" var missing"+o+"; ",A){h||(n+=" var "+y+" = validate.schema"+u+"; ");var N="i"+o,C="schema"+o+"["+N+"]",O="' + "+C+" + '";t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPathExpr(D,C,t.opts.jsonPointers)),n+=" var "+v+" = true; ",h&&(n+=" if (schema"+o+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+o+")) "+v+" = false; else {"),n+=" for (var "+N+" = 0; "+N+" < "+y+".length; "+N+"++) { "+v+" = "+d+"["+y+"["+N+"]] !== undefined ",$&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", "+y+"["+N+"]) "),n+="; if (!"+v+") break; } ",h&&(n+=" } "),n+=" if (!"+v+") { ";var j=j||[];j.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { missingProperty: '"+O+"' } ",t.opts.messages!==!1&&(n+=" , message: '",t.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+O+"\\'",n+="' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var F=n;n=j.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+F+"]); ":n+=" validate.errors = ["+F+"]; return false; ":n+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var B=g;if(B)for(var V,N=-1,Q=B.length-1;N{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;if(h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c,(c||h)&&t.opts.uniqueItems!==!1){h&&(n+=" var "+v+"; if ("+m+" === false || "+m+" === undefined) "+v+" = true; else if (typeof "+m+" != 'boolean') "+v+" = false; else { "),n+=" var i = "+d+".length , "+v+" = true , j; if (i > 1) { ";var y=t.schema.items&&t.schema.items.type,g=Array.isArray(y);if(!y||y=="object"||y=="array"||g&&(y.indexOf("object")>=0||y.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+d+"[i], "+d+"[j])) { "+v+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+d+"[i]; ";var b="checkDataType"+(g?"s":"");n+=" if ("+t.util[b](y,"item",t.opts.strictNumbers,!0)+") continue; ",g&&(n+=` if (typeof item == 'string') item = '"' + item; `),n+=" if (typeof itemIndices[item] == 'number') { "+v+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",h&&(n+=" } "),n+=" if (!"+v+") { ";var w=w||[];w.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { i: i, j: j } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),t.opts.verbose&&(n+=" , schema: ",h?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var P=n;n=w.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+P+"]); ":n+=" validate.errors = ["+P+"]; return false; ":n+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { ")}else f&&(n+=" if (true) { ");return n}}),H$=Ne((a,e)=>{e.exports={$ref:T$(),allOf:R$(),anyOf:P$(),$comment:O$(),const:C$(),contains:k$(),dependencies:I$(),enum:A$(),format:N$(),if:D$(),items:j$(),maximum:pS(),minimum:pS(),maxItems:dS(),minItems:dS(),maxLength:fS(),minLength:fS(),maxProperties:mS(),minProperties:mS(),multipleOf:$$(),not:M$(),oneOf:L$(),pattern:q$(),properties:F$(),propertyNames:U$(),required:z$(),uniqueItems:B$(),validate:PS()}}),V$=Ne((a,e)=>{var r=H$(),t=Mn().toHash;e.exports=function(){var i=[{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"]}],n=["type","$comment"],o=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],l=["number","integer","string","array","object","boolean","null"];return i.all=t(n),i.types=t(l),i.forEach(function(c){c.rules=c.rules.map(function(u){var p;if(typeof u=="object"){var f=Object.keys(u)[0];p=u[f],u=f,p.forEach(function(v){n.push(v),i.all[v]=!0})}n.push(u);var d=i.all[u]={keyword:u,code:r[u],implements:p};return d}),i.all.$comment={keyword:"$comment",code:r.$comment},c.type&&(i.types[c.type]=c)}),i.keywords=t(n.concat(o)),i.custom={},i}}),W$=Ne((a,e)=>{var r=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];e.exports=function(t,s){for(var i=0;i{var r=of().MissingRef;e.exports=t;function t(s,i,n){var o=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof i=="function"&&(n=i,i=void 0);var l=c(s).then(function(){var p=o._addSchema(s,void 0,i);return p.validate||u(p)});return n&&l.then(function(p){n(null,p)},n),l;function c(p){var f=p.$schema;return f&&!o.getSchema(f)?t.call(o,{$ref:f},!0):Promise.resolve()}function u(p){try{return o._compile(p)}catch(d){if(d instanceof r)return f(d);throw d}function f(d){var v=d.missingSchema;if(y(v))throw new Error("Schema "+v+" is loaded but "+d.missingRef+" cannot be resolved");var h=o._loadingSchemas[v];return h||(h=o._loadingSchemas[v]=o._opts.loadSchema(v),h.then(m,m)),h.then(function(g){if(!y(v))return c(g).then(function(){y(v)||o.addSchema(g,v,void 0,i)})}).then(function(){return u(p)});function m(){delete o._loadingSchemas[v]}function y(g){return o._refs[g]||o._schemas[g]}}}}}),Z$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d,v="data"+(l||""),h="valid"+o,m="errs__"+o,y=t.opts.$data&&c&&c.$data,g;y?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",g="schema"+o):g=c;var b=this,w="definition"+o,P=b.definition,T="",k,D,A,$,N;if(y&&P.$data){N="keywordValidate"+o;var C=P.validateSchema;n+=" var "+w+" = RULES.custom['"+s+"'].definition; var "+N+" = "+w+".validate;"}else{if($=t.useCustomRule(b,c,t.schema,t),!$)return;g="validate.schema"+u,N=$.code,k=P.compile,D=P.inline,A=P.macro}var O=N+".errors",j="i"+o,F="ruleErr"+o,B=P.async;if(B&&!t.async)throw new Error("async keyword in sync schema");if(D||A||(n+=""+O+" = null;"),n+="var "+m+" = errors;var "+h+";",y&&P.$data&&(T+="}",n+=" if ("+g+" === undefined) { "+h+" = true; } else { ",C&&(T+="}",n+=" "+h+" = "+w+".validateSchema("+g+"); if ("+h+") { ")),D)P.statements?n+=" "+$.validate+" ":n+=" "+h+" = "+$.validate+"; ";else if(A){var V=t.util.copy(t),T="";V.level++;var Q="valid"+V.level;V.schema=$.validate,V.schemaPath="";var K=t.compositeRule;t.compositeRule=V.compositeRule=!0;var W=t.validate(V).replace(/validate\.schema/g,N);t.compositeRule=V.compositeRule=K,n+=" "+W}else{var ae=ae||[];ae.push(n),n="",n+=" "+N+".call( ",t.opts.passContext?n+="this":n+="self",k||P.schema===!1?n+=" , "+v+" ":n+=" , "+g+" , "+v+" , validate.schema"+t.schemaPath+" ",n+=" , (dataPath || '')",t.errorPath!='""'&&(n+=" + "+t.errorPath);var ee=l?"data"+(l-1||""):"parentData",Le=l?t.dataPathArr[l]:"parentDataProperty";n+=" , "+ee+" , "+Le+" , rootData ) ";var he=n;n=ae.pop(),P.errors===!1?(n+=" "+h+" = ",B&&(n+="await "),n+=""+he+"; "):B?(O="customErrors"+o,n+=" var "+O+" = null; try { "+h+" = await "+he+"; } catch (e) { "+h+" = false; if (e instanceof ValidationError) "+O+" = e.errors; else throw e; } "):n+=" "+O+" = null; "+h+" = "+he+"; "}if(P.modifying&&(n+=" if ("+ee+") "+v+" = "+ee+"["+Le+"];"),n+=""+T,P.valid)f&&(n+=" if (true) { ");else{n+=" if ( ",P.valid===void 0?(n+=" !",A?n+=""+Q:n+=""+h):n+=" "+!P.valid+" ",n+=") { ",d=b.keyword;var ae=ae||[];ae.push(n),n="";var ae=ae||[];ae.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { keyword: '"+b.keyword+"' } ",t.opts.messages!==!1&&(n+=` , message: 'should pass "`+b.keyword+`" keyword validation' `),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+v+" "),n+=" } "):n+=" {} ";var Ee=n;n=ae.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+Ee+"]); ":n+=" validate.errors = ["+Ee+"]; return false; ":n+=" var err = "+Ee+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var be=n;n=ae.pop(),D?P.errors?P.errors!="full"&&(n+=" for (var "+j+"="+m+"; "+j+"{e.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}}),K$=Ne((a,e)=>{var r=OS();e.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:r.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:r.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"}]}}}}),X$=Ne((a,e)=>{var r=/^[a-z_$][a-z0-9_$-]*$/i,t=Z$(),s=K$();e.exports={add:i,get:n,remove:o,validate:l};function i(c,u){var p=this.RULES;if(p.keywords[c])throw new Error("Keyword "+c+" is already defined");if(!r.test(c))throw new Error("Keyword "+c+" is not a valid identifier");if(u){this.validateKeyword(u,!0);var f=u.type;if(Array.isArray(f))for(var d=0;d{e.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}}),J$=Ne((a,e)=>{var r=E$(),t=nf(),s=S$(),i=TS(),n=RS(),o=w$(),l=V$(),c=W$(),u=Mn();e.exports=m,m.prototype.validate=y,m.prototype.compile=g,m.prototype.addSchema=b,m.prototype.addMetaSchema=w,m.prototype.validateSchema=P,m.prototype.getSchema=k,m.prototype.removeSchema=$,m.prototype.addFormat=K,m.prototype.errorsText=Q,m.prototype._addSchema=C,m.prototype._compile=O,m.prototype.compileAsync=G$();var p=X$();m.prototype.addKeyword=p.add,m.prototype.getKeyword=p.get,m.prototype.removeKeyword=p.remove,m.prototype.validateKeyword=p.validate;var f=of();m.ValidationError=f.Validation,m.MissingRefError=f.MissingRef,m.$dataMetaSchema=c;var d="http://json-schema.org/draft-07/schema",v=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],h=["/properties"];function m(U){if(!(this instanceof m))return new m(U);U=this._opts=u.copy(U)||{},be(this),this._schemas={},this._refs={},this._fragments={},this._formats=o(U.format),this._cache=U.cache||new s,this._loadingSchemas={},this._compilations=[],this.RULES=l(),this._getId=j(U),U.loopRequired=U.loopRequired||1/0,U.errorDataPath=="property"&&(U._errorDataPathProperty=!0),U.serialize===void 0&&(U.serialize=n),this._metaOpts=Ee(this),U.formats&&ee(this),U.keywords&&Le(this),W(this),typeof U.meta=="object"&&this.addMetaSchema(U.meta),U.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),ae(this)}function y(U,G){var re;if(typeof U=="string"){if(re=this.getSchema(U),!re)throw new Error('no schema with key or ref "'+U+'"')}else{var pe=this._addSchema(U);re=pe.validate||this._compile(pe)}var Z=re(G);return re.$async!==!0&&(this.errors=re.errors),Z}function g(U,G){var re=this._addSchema(U,void 0,G);return re.validate||this._compile(re)}function b(U,G,re,pe){if(Array.isArray(U)){for(var Z=0;Z0&&O.push("--allowedTools",T.join(",")),k.length>0&&O.push("--disallowedTools",k.join(",")),D&&Object.keys(D).length>0&&O.push("--mcp-config",JSON.stringify({mcpServers:D})),r&&Object.keys(r).length>0&&O.push("--agents",JSON.stringify(r)),P&&O.push("--setting-sources",P.join(",")),A&&O.push("--strict-mcp-config"),m&&O.push("--permission-mode",m),y&&O.push("--allow-dangerously-skip-permissions"),h){if(v&&h===v)throw new Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");O.push("--fallback-model",h)}N&&O.push("--include-partial-messages");for(let W of e)O.push("--add-dir",W);if(C&&C.length>0)for(let W of C)if(W.type==="local")O.push("--plugin-dir",W.path);else throw new Error(`Unsupported plugin type: ${W.type}`);this.options.forkSession&&O.push("--fork-session"),this.options.resumeSessionAt&&O.push("--resume-session-at",this.options.resumeSessionAt);for(let[W,ae]of Object.entries(n))ae===null?O.push(`--${W}`):O.push(`--${W}`,ae);if(l.CLAUDE_CODE_ENTRYPOINT||(l.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),!ia().existsSync(o)){let W=hS(o)?`Claude Code native binary not found at ${o}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${o}. Is options.pathToClaudeCodeExecutable set?`;throw new ReferenceError(W)}let F=hS(o),B=F?o:s,V=F?[...i,...O]:[...i,o,...O];this.logForDebugging(F?`Spawning Claude Code native binary: ${B} ${V.join(" ")}`:`Spawning Claude Code process: ${B} ${V.join(" ")}`);let Q=l.DEBUG||c?"pipe":"ignore";this.child=(0,AS.spawn)(B,V,{cwd:t,stdio:["pipe","pipe",Q],signal:this.abortController.signal,env:l}),this.childStdin=this.child.stdin,this.childStdout=this.child.stdout,(l.DEBUG||c)&&this.child.stderr.on("data",W=>{this.logForDebugging(W.toString())});let K=()=>{this.child&&!this.child.killed&&this.child.kill("SIGTERM")};this.processExitHandler=K,this.abortHandler=K,process.on("exit",this.processExitHandler),this.abortController.signal.addEventListener("abort",this.abortHandler),this.child.on("error",W=>{this.ready=!1,this.abortController.signal.aborted?this.exitError=new xs("Claude Code process aborted by user"):(this.exitError=new Error(`Failed to spawn Claude Code process: ${W.message}`),this.logForDebugging(this.exitError.message))}),this.child.on("close",(W,ae)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new xs("Claude Code process aborted by user");else{let ee=this.getProcessExitError(W,ae);ee&&(this.exitError=ee,this.logForDebugging(ee.message))}}),this.ready=!0}catch(e){throw this.ready=!1,e}}getProcessExitError(e,r){if(e!==0&&e!==null)return new Error(`Claude Code process exited with code ${e}`);if(r)return new Error(`Claude Code process terminated by signal ${r}`)}logForDebugging(e){process.env.DEBUG&&process.stderr.write(`${e} +===========================`}var Gd=require("path"),CS=require("url"),kS=require("events"),AS=require("child_process"),NS=require("readline"),Ae=gt(require("fs"),1),DS=require("fs/promises"),FS=require("path"),US=require("os"),_s=require("path"),Qd=require("process"),zS=require("crypto"),g6={},f$=Object.create,m$=Object.getPrototypeOf,Wd=Object.defineProperty,h$=Object.getOwnPropertyNames,v$=Object.prototype.hasOwnProperty,g$=(a,e,r)=>{r=a!=null?f$(m$(a)):{};let t=e||!a||!a.__esModule?Wd(r,"default",{value:a,enumerable:!0}):r;for(let s of h$(a))v$.call(t,s)||Wd(t,s,{get:()=>a[s],enumerable:!0});return t},Ne=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),y$=(a,e)=>{for(var r in e)Wd(a,r,{get:e[r],enumerable:!0,configurable:!0,set:t=>e[r]=()=>t})},b$=Ne((a,e)=>{(function(r,t){typeof a=="object"&&typeof e<"u"?t(a):typeof define=="function"&&define.amd?define(["exports"],t):t(r.URI=r.URI||{})})(a,function(r){function t(){for(var _=arguments.length,x=Array(_),R=0;R<_;R++)x[R]=arguments[R];if(x.length>1){x[0]=x[0].slice(0,-1);for(var L=x.length-1,z=1;z= 0x80 (not a basic code point)","invalid-input":"Invalid input"},N=h-m,C=Math.floor,O=String.fromCharCode;function j(_){throw new RangeError($[_])}function F(_,x){for(var R=[],L=_.length;L--;)R[L]=x(_[L]);return R}function B(_,x){var R=_.split("@"),L="";R.length>1&&(L=R[0]+"@",_=R[1]),_=_.replace(A,".");var z=_.split("."),J=F(z,x).join(".");return L+J}function V(_){for(var x=[],R=0,L=_.length;R=55296&&z<=56319&&R>1,x+=C(x/R);x>N*y>>1;z+=h)x=C(x/N);return C(z+(N+1)*x/(x+g))},ee=function(x){var R=[],L=x.length,z=0,J=P,le=w,_e=x.lastIndexOf(T);_e<0&&(_e=0);for(var me=0;me<_e;++me)x.charCodeAt(me)>=128&&j("not-basic"),R.push(x.charCodeAt(me));for(var je=_e>0?_e+1:0;je=L&&j("invalid-input");var Ie=K(x.charCodeAt(je++));(Ie>=h||Ie>C((v-z)/ke))&&j("overflow"),z+=Ie*ke;var ve=we<=le?m:we>=le+y?y:we-le;if(IeC(v/Ye)&&j("overflow"),ke*=Ye}var qe=R.length+1;le=ae(z-xe,qe,xe==0),C(z/qe)>v-J&&j("overflow"),J+=C(z/qe),z%=qe,R.splice(z++,0,J)}return String.fromCodePoint.apply(String,R)},Le=function(x){var R=[];x=V(x);var L=x.length,z=P,J=0,le=w,_e=!0,me=!1,je=void 0;try{for(var xe=x[Symbol.iterator](),ke;!(_e=(ke=xe.next()).done);_e=!0){var we=ke.value;we<128&&R.push(O(we))}}catch(Kr){me=!0,je=Kr}finally{try{!_e&&xe.return&&xe.return()}finally{if(me)throw je}}var Ie=R.length,ve=Ie;for(Ie&&R.push(T);ve=z&&ctC((v-J)/mt)&&j("overflow"),J+=(Ye-z)*mt,z=Ye;var ht=!0,Wt=!1,Dt=void 0;try{for(var Cr=x[Symbol.iterator](),br;!(ht=(br=Cr.next()).done);ht=!0){var xr=br.value;if(xrv&&j("overflow"),xr==z){for(var Pt=J,Gt=h;;Gt+=h){var Zt=Gt<=le?m:Gt>=le+y?y:Gt-le;if(Pt>6|192).toString(16).toUpperCase()+"%"+(x&63|128).toString(16).toUpperCase():R="%"+(x>>12|224).toString(16).toUpperCase()+"%"+(x>>6&63|128).toString(16).toUpperCase()+"%"+(x&63|128).toString(16).toUpperCase(),R}function G(_){for(var x="",R=0,L=_.length;R=194&&z<224){if(L-R>=6){var J=parseInt(_.substr(R+4,2),16);x+=String.fromCharCode((z&31)<<6|J&63)}else x+=_.substr(R,6);R+=6}else if(z>=224){if(L-R>=9){var le=parseInt(_.substr(R+4,2),16),_e=parseInt(_.substr(R+7,2),16);x+=String.fromCharCode((z&15)<<12|(le&63)<<6|_e&63)}else x+=_.substr(R,9);R+=9}else x+=_.substr(R,3),R+=3}return x}function re(_,x){function R(L){var z=G(L);return z.match(x.UNRESERVED)?z:L}return _.scheme&&(_.scheme=String(_.scheme).replace(x.PCT_ENCODED,R).toLowerCase().replace(x.NOT_SCHEME,"")),_.userinfo!==void 0&&(_.userinfo=String(_.userinfo).replace(x.PCT_ENCODED,R).replace(x.NOT_USERINFO,U).replace(x.PCT_ENCODED,n)),_.host!==void 0&&(_.host=String(_.host).replace(x.PCT_ENCODED,R).toLowerCase().replace(x.NOT_HOST,U).replace(x.PCT_ENCODED,n)),_.path!==void 0&&(_.path=String(_.path).replace(x.PCT_ENCODED,R).replace(_.scheme?x.NOT_PATH:x.NOT_PATH_NOSCHEME,U).replace(x.PCT_ENCODED,n)),_.query!==void 0&&(_.query=String(_.query).replace(x.PCT_ENCODED,R).replace(x.NOT_QUERY,U).replace(x.PCT_ENCODED,n)),_.fragment!==void 0&&(_.fragment=String(_.fragment).replace(x.PCT_ENCODED,R).replace(x.NOT_FRAGMENT,U).replace(x.PCT_ENCODED,n)),_}function pe(_){return _.replace(/^0*(.*)/,"$1")||"0"}function Z(_,x){var R=_.match(x.IPV4ADDRESS)||[],L=f(R,2),z=L[1];return z?z.split(".").map(pe).join("."):_}function X(_,x){var R=_.match(x.IPV6ADDRESS)||[],L=f(R,3),z=L[1],J=L[2];if(z){for(var le=z.toLowerCase().split("::").reverse(),_e=f(le,2),me=_e[0],je=_e[1],xe=je?je.split(":").map(pe):[],ke=me.split(":").map(pe),we=x.IPV4ADDRESS.test(ke[ke.length-1]),Ie=we?7:8,ve=ke.length-Ie,Ye=Array(Ie),qe=0;qe1){var Be=Ye.slice(0,ze.index),ct=Ye.slice(ze.index+ze.length);it=Be.join(":")+"::"+ct.join(":")}else it=Ye.join(":");return J&&(it+="%"+J),it}else return _}var ce=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,De="".match(/(){0}/)[1]===void 0;function fe(_){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R={},L=x.iri!==!1?p:u;x.reference==="suffix"&&(_=(x.scheme?x.scheme+":":"")+"//"+_);var z=_.match(ce);if(z){De?(R.scheme=z[1],R.userinfo=z[3],R.host=z[4],R.port=parseInt(z[5],10),R.path=z[6]||"",R.query=z[7],R.fragment=z[8],isNaN(R.port)&&(R.port=z[5])):(R.scheme=z[1]||void 0,R.userinfo=_.indexOf("@")!==-1?z[3]:void 0,R.host=_.indexOf("//")!==-1?z[4]:void 0,R.port=parseInt(z[5],10),R.path=z[6]||"",R.query=_.indexOf("?")!==-1?z[7]:void 0,R.fragment=_.indexOf("#")!==-1?z[8]:void 0,isNaN(R.port)&&(R.port=_.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?z[4]:void 0)),R.host&&(R.host=X(Z(R.host,L),L)),R.scheme===void 0&&R.userinfo===void 0&&R.host===void 0&&R.port===void 0&&!R.path&&R.query===void 0?R.reference="same-document":R.scheme===void 0?R.reference="relative":R.fragment===void 0?R.reference="absolute":R.reference="uri",x.reference&&x.reference!=="suffix"&&x.reference!==R.reference&&(R.error=R.error||"URI is not a "+x.reference+" reference.");var J=Te[(x.scheme||R.scheme||"").toLowerCase()];if(!x.unicodeSupport&&(!J||!J.unicodeSupport)){if(R.host&&(x.domainHost||J&&J.domainHost))try{R.host=be.toASCII(R.host.replace(L.PCT_ENCODED,G).toLowerCase())}catch(le){R.error=R.error||"Host's domain name can not be converted to ASCII via punycode: "+le}re(R,u)}else re(R,L);J&&J.parse&&J.parse(R,x)}else R.error=R.error||"URI can not be parsed.";return R}function $e(_,x){var R=x.iri!==!1?p:u,L=[];return _.userinfo!==void 0&&(L.push(_.userinfo),L.push("@")),_.host!==void 0&&L.push(X(Z(String(_.host),R),R).replace(R.IPV6ADDRESS,function(z,J,le){return"["+J+(le?"%25"+le:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(L.push(":"),L.push(String(_.port))),L.length?L.join(""):void 0}var Ve=/^\.\.?\//,Se=/^\/\.(\/|$)/,tt=/^\/\.\.(\/|$)/,We=/^\/?(?:.|\n)*?(?=\/|$)/;function Je(_){for(var x=[];_.length;)if(_.match(Ve))_=_.replace(Ve,"");else if(_.match(Se))_=_.replace(Se,"/");else if(_.match(tt))_=_.replace(tt,"/"),x.pop();else if(_==="."||_==="..")_="";else{var R=_.match(We);if(R){var L=R[0];_=_.slice(L.length),x.push(L)}else throw new Error("Unexpected dot segment condition")}return x.join("")}function Ke(_){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=x.iri?p:u,L=[],z=Te[(x.scheme||_.scheme||"").toLowerCase()];if(z&&z.serialize&&z.serialize(_,x),_.host&&!R.IPV6ADDRESS.test(_.host)){if(x.domainHost||z&&z.domainHost)try{_.host=x.iri?be.toUnicode(_.host):be.toASCII(_.host.replace(R.PCT_ENCODED,G).toLowerCase())}catch(_e){_.error=_.error||"Host's domain name can not be converted to "+(x.iri?"Unicode":"ASCII")+" via punycode: "+_e}}re(_,R),x.reference!=="suffix"&&_.scheme&&(L.push(_.scheme),L.push(":"));var J=$e(_,x);if(J!==void 0&&(x.reference!=="suffix"&&L.push("//"),L.push(J),_.path&&_.path.charAt(0)!=="/"&&L.push("/")),_.path!==void 0){var le=_.path;!x.absolutePath&&(!z||!z.absolutePath)&&(le=Je(le)),J===void 0&&(le=le.replace(/^\/\//,"/%2F")),L.push(le)}return _.query!==void 0&&(L.push("?"),L.push(_.query)),_.fragment!==void 0&&(L.push("#"),L.push(_.fragment)),L.join("")}function Qe(_,x){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=arguments[3],z={};return L||(_=fe(Ke(_,R),R),x=fe(Ke(x,R),R)),R=R||{},!R.tolerant&&x.scheme?(z.scheme=x.scheme,z.userinfo=x.userinfo,z.host=x.host,z.port=x.port,z.path=Je(x.path||""),z.query=x.query):(x.userinfo!==void 0||x.host!==void 0||x.port!==void 0?(z.userinfo=x.userinfo,z.host=x.host,z.port=x.port,z.path=Je(x.path||""),z.query=x.query):(x.path?(x.path.charAt(0)==="/"?z.path=Je(x.path):((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path?z.path="/"+x.path:_.path?z.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+x.path:z.path=x.path,z.path=Je(z.path)),z.query=x.query):(z.path=_.path,x.query!==void 0?z.query=x.query:z.query=_.query),z.userinfo=_.userinfo,z.host=_.host,z.port=_.port),z.scheme=_.scheme),z.fragment=x.fragment,z}function Et(_,x,R){var L=l({scheme:"null"},R);return Ke(Qe(fe(_,L),fe(x,L),L,!0),L)}function St(_,x){return typeof _=="string"?_=Ke(fe(_,x),x):i(_)==="object"&&(_=fe(Ke(_,x),x)),_}function Rt(_,x,R){return typeof _=="string"?_=Ke(fe(_,R),R):i(_)==="object"&&(_=Ke(_,R)),typeof x=="string"?x=Ke(fe(x,R),R):i(x)==="object"&&(x=Ke(x,R)),_===x}function Gr(_,x){return _&&_.toString().replace(!x||!x.iri?u.ESCAPE:p.ESCAPE,U)}function Nt(_,x){return _&&_.toString().replace(!x||!x.iri?u.PCT_ENCODED:p.PCT_ENCODED,G)}var la={scheme:"http",domainHost:!0,parse:function(x,R){return x.host||(x.error=x.error||"HTTP URIs must have a host."),x},serialize:function(x,R){var L=String(x.scheme).toLowerCase()==="https";return(x.port===(L?443:80)||x.port==="")&&(x.port=void 0),x.path||(x.path="/"),x}},ua={scheme:"https",domainHost:la.domainHost,parse:la.parse,serialize:la.serialize};function Vn(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var Ma={scheme:"ws",domainHost:!0,parse:function(x,R){var L=x;return L.secure=Vn(L),L.resourceName=(L.path||"/")+(L.query?"?"+L.query:""),L.path=void 0,L.query=void 0,L},serialize:function(x,R){if((x.port===(Vn(x)?443:80)||x.port==="")&&(x.port=void 0),typeof x.secure=="boolean"&&(x.scheme=x.secure?"wss":"ws",x.secure=void 0),x.resourceName){var L=x.resourceName.split("?"),z=f(L,2),J=z[0],le=z[1];x.path=J&&J!=="/"?J:void 0,x.query=le,x.resourceName=void 0}return x.fragment=void 0,x}},Ji={scheme:"wss",domainHost:Ma.domainHost,parse:Ma.parse,serialize:Ma.serialize},Yi={},er=!0,eo="[A-Za-z0-9\\-\\.\\_\\~"+(er?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",tr="[0-9A-Fa-f]",Al=s(s("%[EFef]"+tr+"%"+tr+tr+"%"+tr+tr)+"|"+s("%[89A-Fa-f]"+tr+"%"+tr+tr)+"|"+s("%"+tr+tr)),Nl="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Dl="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",jl=t(Dl,'[\\"\\\\]'),pa="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",$l=new RegExp(eo,"g"),Zr=new RegExp(Al,"g"),Ml=new RegExp(t("[^]",Nl,"[\\.]",'[\\"]',jl),"g"),Fs=new RegExp(t("[^]",eo,pa),"g"),to=Fs;function Wn(_){var x=G(_);return x.match($l)?x:_}var Gn={scheme:"mailto",parse:function(x,R){var L=x,z=L.to=L.path?L.path.split(","):[];if(L.path=void 0,L.query){for(var J=!1,le={},_e=L.query.split("&"),me=0,je=_e.length;me{e.exports=function r(t,s){if(t===s)return!0;if(t&&s&&typeof t=="object"&&typeof s=="object"){if(t.constructor!==s.constructor)return!1;var i,n,o;if(Array.isArray(t)){if(i=t.length,i!=s.length)return!1;for(n=i;n--!==0;)if(!r(t[n],s[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if(o=Object.keys(t),i=o.length,i!==Object.keys(s).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(s,o[n]))return!1;for(n=i;n--!==0;){var l=o[n];if(!r(t[l],s[l]))return!1}return!0}return t!==t&&s!==s}}),x$=Ne((a,e)=>{e.exports=function(t){for(var s=0,i=t.length,n=0,o;n=55296&&o<=56319&&n{e.exports={copy:r,checkDataType:t,checkDataTypes:s,coerceToTypes:n,toHash:o,getProperty:u,escapeQuotes:p,equal:sf(),ucs2length:x$(),varOccurences:f,varReplace:d,schemaHasRules:v,schemaHasRulesExcept:h,schemaUnknownRules:m,toQuotedString:y,getPathExpr:g,getPath:b,getData:T,unescapeFragment:D,unescapeJsonPointer:N,escapeFragment:A,escapeJsonPointer:$};function r(C,O){O=O||{};for(var j in C)O[j]=C[j];return O}function t(C,O,j,F){var B=F?" !== ":" === ",V=F?" || ":" && ",Q=F?"!":"",K=F?"":"!";switch(C){case"null":return O+B+"null";case"array":return Q+"Array.isArray("+O+")";case"object":return"("+Q+O+V+"typeof "+O+B+'"object"'+V+K+"Array.isArray("+O+"))";case"integer":return"(typeof "+O+B+'"number"'+V+K+"("+O+" % 1)"+V+O+B+O+(j?V+Q+"isFinite("+O+")":"")+")";case"number":return"(typeof "+O+B+'"'+C+'"'+(j?V+Q+"isFinite("+O+")":"")+")";default:return"typeof "+O+B+'"'+C+'"'}}function s(C,O,j){switch(C.length){case 1:return t(C[0],O,j,!0);default:var F="",B=o(C);B.array&&B.object&&(F=B.null?"(":"(!"+O+" || ",F+="typeof "+O+' !== "object")',delete B.null,delete B.array,delete B.object),B.number&&delete B.integer;for(var V in B)F+=(F?" && ":"")+t(V,O,j,!0);return F}}var i=o(["string","number","integer","boolean","null"]);function n(C,O){if(Array.isArray(O)){for(var j=[],F=0;F=O)throw new Error("Cannot access property/index "+F+" levels up, current level is "+O);return j[O-F]}if(F>O)throw new Error("Cannot access data "+F+" levels up, current level is "+O);if(V="data"+(O-F||""),!B)return V}for(var K=V,W=B.split("/"),ae=0;ae{var r=Mn();e.exports=t;function t(s){r.copy(s,this)}}),_$=Ne((a,e)=>{var r=e.exports=function(i,n,o){typeof n=="function"&&(o=n,n={}),o=n.cb||o;var l=typeof o=="function"?o:o.pre||function(){},c=o.post||function(){};t(n,l,c,i,"",i)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.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 t(i,n,o,l,c,u,p,f,d,v){if(l&&typeof l=="object"&&!Array.isArray(l)){n(l,c,u,p,f,d,v);for(var h in l){var m=l[h];if(Array.isArray(m)){if(h in r.arrayKeywords)for(var y=0;y{var r=b$(),t=sf(),s=Mn(),i=TS(),n=_$();e.exports=o,o.normalizeId=b,o.fullPath=m,o.url=w,o.ids=P,o.inlineRef=d,o.schema=l;function o(T,k,D){var A=this._refs[D];if(typeof A=="string")if(this._refs[A])A=this._refs[A];else return o.call(this,T,k,A);if(A=A||this._schemas[D],A instanceof i)return d(A.schema,this._opts.inlineRefs)?A.schema:A.validate||this._compile(A);var $=l.call(this,k,D),N,C,O;return $&&(N=$.schema,k=$.root,O=$.baseId),N instanceof i?C=N.validate||T.call(this,N.schema,k,void 0,O):N!==void 0&&(C=d(N,this._opts.inlineRefs)?N:T.call(this,N,k,void 0,O)),C}function l(T,k){var D=r.parse(k),A=y(D),$=m(this._getId(T.schema));if(Object.keys(T.schema).length===0||A!==$){var N=b(A),C=this._refs[N];if(typeof C=="string")return c.call(this,T,C,D);if(C instanceof i)C.validate||this._compile(C),T=C;else if(C=this._schemas[N],C instanceof i){if(C.validate||this._compile(C),N==b(k))return{schema:C,root:T,baseId:$};T=C}else return;if(!T.schema)return;$=m(this._getId(T.schema))}return p.call(this,D,$,T.schema,T)}function c(T,k,D){var A=l.call(this,T,k);if(A){var $=A.schema,N=A.baseId;T=A.root;var C=this._getId($);return C&&(N=w(N,C)),p.call(this,D,N,$,T)}}var u=s.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function p(T,k,D,A){if(T.fragment=T.fragment||"",T.fragment.slice(0,1)=="/"){for(var $=T.fragment.split("/"),N=1;N<$.length;N++){var C=$[N];if(C){if(C=s.unescapeFragment(C),D=D[C],D===void 0)break;var O;if(!u[C]&&(O=this._getId(D),O&&(k=w(k,O)),D.$ref)){var j=w(k,D.$ref),F=l.call(this,A,j);F&&(D=F.schema,A=F.root,k=F.baseId)}}}if(D!==void 0&&D!==A.schema)return{schema:D,root:A,baseId:k}}}var f=s.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function d(T,k){if(k===!1)return!1;if(k===void 0||k===!0)return v(T);if(k)return h(T)<=k}function v(T){var k;if(Array.isArray(T)){for(var D=0;D{var r=nf();e.exports={Validation:i(t),MissingRef:i(s)};function t(n){this.message="validation failed",this.errors=n,this.ajv=this.validation=!0}s.message=function(n,o){return"can't resolve reference "+o+" from id "+n};function s(n,o,l){this.message=l||s.message(n,o),this.missingRef=r.url(n,o),this.missingSchema=r.normalizeId(r.fullPath(this.missingRef))}function i(n){return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}}),RS=Ne((a,e)=>{e.exports=function(r,t){t||(t={}),typeof t=="function"&&(t={cmp:t});var s=typeof t.cycles=="boolean"?t.cycles:!1,i=t.cmp&&(function(o){return function(l){return function(c,u){var p={key:c,value:l[c]},f={key:u,value:l[u]};return o(p,f)}}})(t.cmp),n=[];return(function o(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var c,u;if(Array.isArray(l)){for(u="[",c=0;c{e.exports=function(t,s,i){var n="",o=t.schema.$async===!0,l=t.util.schemaHasRulesExcept(t.schema,t.RULES.all,"$ref"),c=t.self._getId(t.schema);if(t.opts.strictKeywords){var u=t.util.schemaUnknownRules(t.schema,t.RULES.keywords);if(u){var p="unknown keyword: "+u;if(t.opts.strictKeywords==="log")t.logger.warn(p);else throw new Error(p)}}if(t.isTop&&(n+=" var validate = ",o&&(t.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",c&&(t.opts.sourceCode||t.opts.processCode)&&(n+=" "+("/*# sourceURL="+c+" */")+" ")),typeof t.schema=="boolean"||!(l||t.schema.$ref)){var s="false schema",f=t.level,d=t.dataLevel,v=t.schema[s],h=t.schemaPath+t.util.getProperty(s),m=t.errSchemaPath+"/"+s,k=!t.opts.allErrors,$,y="data"+(d||""),T="valid"+f;if(t.schema===!1){t.isTop?k=!0:n+=" var "+T+" = false; ";var g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+($||"false schema")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(m)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'boolean schema is false' "),t.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+t.schemaPath+" , data: "+y+" "),n+=" } "):n+=" {} ";var b=n;n=g.pop(),!t.compositeRule&&k?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else t.isTop?o?n+=" return data; ":n+=" validate.errors = null; return true; ":n+=" var "+T+" = true; ";return t.isTop&&(n+=" }; return validate; "),n}if(t.isTop){var w=t.isTop,f=t.level=0,d=t.dataLevel=0,y="data";if(t.rootId=t.resolve.fullPath(t.self._getId(t.root.schema)),t.baseId=t.baseId||t.rootId,delete t.isTop,t.dataPathArr=[""],t.schema.default!==void 0&&t.opts.useDefaults&&t.opts.strictDefaults){var P="default is ignored in the schema root";if(t.opts.strictDefaults==="log")t.logger.warn(P);else throw new Error(P)}n+=" var vErrors = null; ",n+=" var errors = 0; ",n+=" if (rootData === undefined) rootData = data; "}else{var{level:f,dataLevel:d}=t,y="data"+(d||"");if(c&&(t.baseId=t.resolve.url(t.baseId,c)),o&&!t.async)throw new Error("async schema in sync schema");n+=" var errs_"+f+" = errors;"}var T="valid"+f,k=!t.opts.allErrors,D="",A="",$,N=t.schema.type,C=Array.isArray(N);if(N&&t.opts.nullable&&t.schema.nullable===!0&&(C?N.indexOf("null")==-1&&(N=N.concat("null")):N!="null"&&(N=[N,"null"],C=!0)),C&&N.length==1&&(N=N[0],C=!1),t.schema.$ref&&l){if(t.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+t.errSchemaPath+'" (see option extendRefs)');t.opts.extendRefs!==!0&&(l=!1,t.logger.warn('$ref: keywords ignored in schema at path "'+t.errSchemaPath+'"'))}if(t.schema.$comment&&t.opts.$comment&&(n+=" "+t.RULES.all.$comment.code(t,"$comment")),N){if(t.opts.coerceTypes)var O=t.util.coerceToTypes(t.opts.coerceTypes,N);var j=t.RULES.types[N];if(O||C||j===!0||j&&!We(j)){var h=t.schemaPath+".type",m=t.errSchemaPath+"/type",h=t.schemaPath+".type",m=t.errSchemaPath+"/type",F=C?"checkDataTypes":"checkDataType";if(n+=" if ("+t.util[F](N,y,t.opts.strictNumbers,!0)+") { ",O){var B="dataType"+f,V="coerced"+f;n+=" var "+B+" = typeof "+y+"; var "+V+" = undefined; ",t.opts.coerceTypes=="array"&&(n+=" if ("+B+" == 'object' && Array.isArray("+y+") && "+y+".length == 1) { "+y+" = "+y+"[0]; "+B+" = typeof "+y+"; if ("+t.util.checkDataType(t.schema.type,y,t.opts.strictNumbers)+") "+V+" = "+y+"; } "),n+=" if ("+V+" !== undefined) ; ";var Q=O;if(Q)for(var K,W=-1,ae=Q.length-1;W{var r=nf(),t=Mn(),s=of(),i=RS(),n=PS(),o=t.ucs2length,l=sf(),c=s.Validation;e.exports=u;function u(b,w,P,T){var k=this,D=this._opts,A=[void 0],$={},N=[],C={},O=[],j={},F=[];w=w||{schema:b,refVal:A,refs:$};var B=p.call(this,b,w,T),V=this._compilations[B.index];if(B.compiling)return V.callValidate=ee;var Q=this._formats,K=this.RULES;try{var W=Le(b,w,P,T);V.validate=W;var ae=V.callValidate;return ae&&(ae.schema=W.schema,ae.errors=null,ae.refs=W.refs,ae.refVal=W.refVal,ae.root=W.root,ae.$async=W.$async,D.sourceCode&&(ae.source=W.source)),W}finally{f.call(this,b,w,T)}function ee(){var Z=V.validate,X=Z.apply(this,arguments);return ee.errors=Z.errors,X}function Le(Z,X,ce,De){var fe=!X||X&&X.schema==Z;if(X.schema!=w.schema)return u.call(k,Z,X,ce,De);var $e=Z.$async===!0,Ve=n({isTop:!0,schema:Z,isRoot:fe,baseId:De,root:X,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:s.MissingRef,RULES:K,validate:n,util:t,resolve:r,resolveRef:he,usePattern:G,useDefault:re,useCustomRule:pe,opts:D,formats:Q,logger:k.logger,self:k});Ve=g(A,m)+g(N,v)+g(O,h)+g(F,y)+Ve,D.processCode&&(Ve=D.processCode(Ve,Z));var Se;try{var tt=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Ve);Se=tt(k,K,Q,w,A,O,F,l,o,c),A[0]=Se}catch(We){throw k.logger.error("Error compiling schema, function code:",Ve),We}return Se.schema=Z,Se.errors=null,Se.refs=$,Se.refVal=A,Se.root=fe?Se:X,$e&&(Se.$async=!0),D.sourceCode===!0&&(Se.source={code:Ve,patterns:N,defaults:O}),Se}function he(Z,X,ce){X=r.url(Z,X);var De=$[X],fe,$e;if(De!==void 0)return fe=A[De],$e="refVal["+De+"]",U(fe,$e);if(!ce&&w.refs){var Ve=w.refs[X];if(Ve!==void 0)return fe=w.refVal[Ve],$e=Ee(X,fe),U(fe,$e)}$e=Ee(X);var Se=r.call(k,Le,w,X);if(Se===void 0){var tt=P&&P[X];tt&&(Se=r.inlineRef(tt,D.inlineRefs)?tt:u.call(k,tt,w,P,Z))}if(Se===void 0)be(X);else return Te(X,Se),U(Se,$e)}function Ee(Z,X){var ce=A.length;return A[ce]=X,$[Z]=ce,"refVal"+ce}function be(Z){delete $[Z]}function Te(Z,X){var ce=$[Z];A[ce]=X}function U(Z,X){return typeof Z=="object"||typeof Z=="boolean"?{code:X,schema:Z,inline:!0}:{code:X,$async:Z&&!!Z.$async}}function G(Z){var X=C[Z];return X===void 0&&(X=C[Z]=N.length,N[X]=Z),"pattern"+X}function re(Z){switch(typeof Z){case"boolean":case"number":return""+Z;case"string":return t.toQuotedString(Z);case"object":if(Z===null)return"null";var X=i(Z),ce=j[X];return ce===void 0&&(ce=j[X]=O.length,O[ce]=Z),"default"+ce}}function pe(Z,X,ce,De){if(k._opts.validateSchema!==!1){var fe=Z.definition.dependencies;if(fe&&!fe.every(function(Et){return Object.prototype.hasOwnProperty.call(ce,Et)}))throw new Error("parent schema must have all required keywords: "+fe.join(","));var $e=Z.definition.validateSchema;if($e){var Ve=$e(X);if(!Ve){var Se="keyword schema is invalid: "+k.errorsText($e.errors);if(k._opts.validateSchema=="log")k.logger.error(Se);else throw new Error(Se)}}}var tt=Z.definition.compile,We=Z.definition.inline,Je=Z.definition.macro,Ke;if(tt)Ke=tt.call(k,X,ce,De);else if(Je)Ke=Je.call(k,X,ce,De),D.validateSchema!==!1&&k.validateSchema(Ke,!0);else if(We)Ke=We.call(k,De,Z.keyword,X,ce);else if(Ke=Z.definition.validate,!Ke)return;if(Ke===void 0)throw new Error('custom keyword "'+Z.keyword+'"failed to compile');var Qe=F.length;return F[Qe]=Ke,{code:"customRule"+Qe,validate:Ke}}}function p(b,w,P){var T=d.call(this,b,w,P);return T>=0?{index:T,compiling:!0}:(T=this._compilations.length,this._compilations[T]={schema:b,root:w,baseId:P},{index:T,compiling:!1})}function f(b,w,P){var T=d.call(this,b,w,P);T>=0&&this._compilations.splice(T,1)}function d(b,w,P){for(var T=0;T{var r=e.exports=function(){this._cache={}};r.prototype.put=function(s,i){this._cache[s]=i},r.prototype.get=function(s){return this._cache[s]},r.prototype.del=function(s){delete this._cache[s]},r.prototype.clear=function(){this._cache={}}}),w$=Ne((a,e)=>{var r=Mn(),t=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,s=[0,31,28,31,30,31,30,31,31,30,31,30,31],i=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,n=/^(?=.{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,o=/^(?:[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,l=/^(?:[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,c=/^(?:(?:[^\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,u=/^(?:(?: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,p=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,f=/^(?:\/(?:[^~/]|~0|~1)*)*$/,d=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,v=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;e.exports=h;function h(A){return A=A=="full"?"full":"fast",r.copy(h[A])}h.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":c,url:u,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:n,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:D,uuid:p,"json-pointer":f,"json-pointer-uri-fragment":d,"relative-json-pointer":v},h.full={date:y,time:g,"date-time":w,uri:T,"uri-reference":l,"uri-template":c,url:u,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:n,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:D,uuid:p,"json-pointer":f,"json-pointer-uri-fragment":d,"relative-json-pointer":v};function m(A){return A%4===0&&(A%100!==0||A%400===0)}function y(A){var $=A.match(t);if(!$)return!1;var N=+$[1],C=+$[2],O=+$[3];return C>=1&&C<=12&&O>=1&&O<=(C==2&&m(N)?29:s[C])}function g(A,$){var N=A.match(i);if(!N)return!1;var C=N[1],O=N[2],j=N[3],F=N[5];return(C<=23&&O<=59&&j<=59||C==23&&O==59&&j==60)&&(!$||F)}var b=/t|\s/i;function w(A){var $=A.split(b);return $.length==2&&y($[0])&&g($[1],!0)}var P=/\/|:/;function T(A){return P.test(A)&&o.test(A)}var k=/[^\\]\\Z/;function D(A){if(k.test(A))return!1;try{return new RegExp(A),!0}catch{return!1}}}),T$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.errSchemaPath+"/"+s,p=!t.opts.allErrors,f="data"+(l||""),d="valid"+o,v,h;if(c=="#"||c=="#/")t.isRoot?(v=t.async,h="validate"):(v=t.root.schema.$async===!0,h="root.refVal[0]");else{var m=t.resolveRef(t.baseId,c,t.isRoot);if(m===void 0){var y=t.MissingRefError.message(t.baseId,c);if(t.opts.missingRefs=="fail"){t.logger.error(y);var g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { ref: '"+t.util.escapeQuotes(c)+"' } ",t.opts.messages!==!1&&(n+=" , message: 'can\\'t resolve reference "+t.util.escapeQuotes(c)+"' "),t.opts.verbose&&(n+=" , schema: "+t.util.toQuotedString(c)+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var b=n;n=g.pop(),!t.compositeRule&&p?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p&&(n+=" if (false) { ")}else if(t.opts.missingRefs=="ignore")t.logger.warn(y),p&&(n+=" if (true) { ");else throw new t.MissingRefError(t.baseId,c,y)}else if(m.inline){var w=t.util.copy(t);w.level++;var P="valid"+w.level;w.schema=m.schema,w.schemaPath="",w.errSchemaPath=c;var T=t.validate(w).replace(/validate\.schema/g,m.code);n+=" "+T+" ",p&&(n+=" if ("+P+") { ")}else v=m.$async===!0||t.async&&m.$async!==!1,h=m.code}if(h){var g=g||[];g.push(n),n="",t.opts.passContext?n+=" "+h+".call(this, ":n+=" "+h+"( ",n+=" "+f+", (dataPath || '')",t.errorPath!='""'&&(n+=" + "+t.errorPath);var k=l?"data"+(l-1||""):"parentData",D=l?t.dataPathArr[l]:"parentDataProperty";n+=" , "+k+" , "+D+", rootData) ";var A=n;if(n=g.pop(),v){if(!t.async)throw new Error("async schema referenced by sync schema");p&&(n+=" var "+d+"; "),n+=" try { await "+A+"; ",p&&(n+=" "+d+" = true; "),n+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",p&&(n+=" "+d+" = false; "),n+=" } ",p&&(n+=" if ("+d+") { ")}else n+=" if (!"+A+") { if (vErrors === null) vErrors = "+h+".errors; else vErrors = vErrors.concat("+h+".errors); errors = vErrors.length; } ",p&&(n+=" else { ")}return n}}),R$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.schema[s],l=t.schemaPath+t.util.getProperty(s),c=t.errSchemaPath+"/"+s,u=!t.opts.allErrors,p=t.util.copy(t),f="";p.level++;var d="valid"+p.level,v=p.baseId,h=!0,m=o;if(m)for(var y,g=-1,b=m.length-1;g0||y===!1:t.util.schemaHasRules(y,t.RULES.all))&&(h=!1,p.schema=y,p.schemaPath=l+"["+g+"]",p.errSchemaPath=c+"/"+g,n+=" "+t.validate(p)+" ",p.baseId=v,u&&(n+=" if ("+d+") { ",f+="}"));return u&&(h?n+=" if (true) { ":n+=" "+f.slice(0,-1)+" "),n}}),P$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b=c.every(function($){return t.opts.strictKeywords?typeof $=="object"&&Object.keys($).length>0||$===!1:t.util.schemaHasRules($,t.RULES.all)});if(b){var w=m.baseId;n+=" var "+h+" = errors; var "+v+" = false; ";var P=t.compositeRule;t.compositeRule=m.compositeRule=!0;var T=c;if(T)for(var k,D=-1,A=T.length-1;D{e.exports=function(t,s,i){var n=" ",o=t.schema[s],l=t.errSchemaPath+"/"+s,c=!t.opts.allErrors,u=t.util.toQuotedString(o);return t.opts.$comment===!0?n+=" console.log("+u+");":typeof t.opts.$comment=="function"&&(n+=" self._opts.$comment("+u+", "+t.util.toQuotedString(l)+", validate.root.schema);"),n}}),C$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c,h||(n+=" var schema"+o+" = validate.schema"+u+";"),n+="var "+v+" = equal("+d+", schema"+o+"); if (!"+v+") { ";var y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { allowedValue: schema"+o+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be equal to constant' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var g=n;return n=y.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",f&&(n+=" else { "),n}}),k$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b="i"+o,w=m.dataLevel=t.dataLevel+1,P="data"+w,T=t.baseId,k=t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all);if(n+="var "+h+" = errors;var "+v+";",k){var D=t.compositeRule;t.compositeRule=m.compositeRule=!0,m.schema=c,m.schemaPath=u,m.errSchemaPath=p,n+=" var "+g+" = false; for (var "+b+" = 0; "+b+" < "+d+".length; "+b+"++) { ",m.errorPath=t.util.getPathExpr(t.errorPath,b,t.opts.jsonPointers,!0);var A=d+"["+b+"]";m.dataPathArr[w]=b;var $=t.validate(m);m.baseId=T,t.util.varOccurences($,P)<2?n+=" "+t.util.varReplace($,P,A)+" ":n+=" var "+P+" = "+A+"; "+$+" ",n+=" if ("+g+") break; } ",t.compositeRule=m.compositeRule=D,n+=" "+y+" if (!"+g+") {"}else n+=" if ("+d+".length == 0) {";var N=N||[];N.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should contain a valid item' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var C=n;return n=N.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+C+"]); ":n+=" validate.errors = ["+C+"]; return false; ":n+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { ",k&&(n+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),t.opts.allErrors&&(n+=" } "),n}}),I$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t),m="";h.level++;var y="valid"+h.level,g={},b={},w=t.opts.ownProperties;for(D in c)if(D!="__proto__"){var P=c[D],T=Array.isArray(P)?b:g;T[D]=P}n+="var "+v+" = errors;";var k=t.errorPath;n+="var missing"+o+";";for(var D in b)if(T=b[D],T.length){if(n+=" if ( "+d+t.util.getProperty(D)+" !== undefined ",w&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(D)+"') "),f){n+=" && ( ";var A=T;if(A)for(var $,N=-1,C=A.length-1;N0||P===!1:t.util.schemaHasRules(P,t.RULES.all))&&(n+=" "+y+" = true; if ( "+d+t.util.getProperty(D)+" !== undefined ",w&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(D)+"') "),n+=") { ",h.schema=P,h.schemaPath=u+t.util.getProperty(D),h.errSchemaPath=p+"/"+t.util.escapeFragment(D),n+=" "+t.validate(h)+" ",h.baseId=ee,n+=" } ",f&&(n+=" if ("+y+") { ",m+="}"))}return f&&(n+=" "+m+" if ("+v+" == errors) {"),n}}),A$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c;var y="i"+o,g="schema"+o;h||(n+=" var "+g+" = validate.schema"+u+";"),n+="var "+v+";",h&&(n+=" if (schema"+o+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+o+")) "+v+" = false; else {"),n+=""+v+" = false;for (var "+y+"=0; "+y+"<"+g+".length; "+y+"++) if (equal("+d+", "+g+"["+y+"])) { "+v+" = true; break; }",h&&(n+=" } "),n+=" if (!"+v+") { ";var b=b||[];b.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { allowedValues: schema"+o+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be equal to one of the allowed values' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var w=n;return n=b.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",f&&(n+=" else { "),n}}),N$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||"");if(t.opts.format===!1)return f&&(n+=" if (true) { "),n;var v=t.opts.$data&&c&&c.$data,h;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c;var m=t.opts.unknownFormats,y=Array.isArray(m);if(v){var g="format"+o,b="isObject"+o,w="formatType"+o;n+=" var "+g+" = formats["+h+"]; var "+b+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+w+" = "+b+" && "+g+".type || 'string'; if ("+b+") { ",t.async&&(n+=" var async"+o+" = "+g+".async; "),n+=" "+g+" = "+g+".validate; } if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),n+=" (",m!="ignore"&&(n+=" ("+h+" && !"+g+" ",y&&(n+=" && self._opts.unknownFormats.indexOf("+h+") == -1 "),n+=") || "),n+=" ("+g+" && "+w+" == '"+i+"' && !(typeof "+g+" == 'function' ? ",t.async?n+=" (async"+o+" ? await "+g+"("+d+") : "+g+"("+d+")) ":n+=" "+g+"("+d+") ",n+=" : "+g+".test("+d+"))))) {"}else{var g=t.formats[c];if(!g){if(m=="ignore")return t.logger.warn('unknown format "'+c+'" ignored in schema at path "'+t.errSchemaPath+'"'),f&&(n+=" if (true) { "),n;if(y&&m.indexOf(c)>=0)return f&&(n+=" if (true) { "),n;throw new Error('unknown format "'+c+'" is used in schema at path "'+t.errSchemaPath+'"')}var b=typeof g=="object"&&!(g instanceof RegExp)&&g.validate,w=b&&g.type||"string";if(b){var P=g.async===!0;g=g.validate}if(w!=i)return f&&(n+=" if (true) { "),n;if(P){if(!t.async)throw new Error("async format in sync schema");var T="formats"+t.util.getProperty(c)+".validate";n+=" if (!(await "+T+"("+d+"))) { "}else{n+=" if (! ";var T="formats"+t.util.getProperty(c);b&&(T+=".validate"),typeof g=="function"?n+=" "+T+"("+d+") ":n+=" "+T+".test("+d+") ",n+=") { "}}var k=k||[];k.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { format: ",v?n+=""+h:n+=""+t.util.toQuotedString(c),n+=" } ",t.opts.messages!==!1&&(n+=` , message: 'should match format "`,v?n+="' + "+h+" + '":n+=""+t.util.escapeQuotes(c),n+=`"' `),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+t.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var D=n;return n=k.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+D+"]); ":n+=" validate.errors = ["+D+"]; return false; ":n+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { "),n}}),D$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t);m.level++;var y="valid"+m.level,g=t.schema.then,b=t.schema.else,w=g!==void 0&&(t.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:t.util.schemaHasRules(g,t.RULES.all)),P=b!==void 0&&(t.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:t.util.schemaHasRules(b,t.RULES.all)),T=m.baseId;if(w||P){var k;m.createErrors=!1,m.schema=c,m.schemaPath=u,m.errSchemaPath=p,n+=" var "+h+" = errors; var "+v+" = true; ";var D=t.compositeRule;t.compositeRule=m.compositeRule=!0,n+=" "+t.validate(m)+" ",m.baseId=T,m.createErrors=!0,n+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",t.compositeRule=m.compositeRule=D,w?(n+=" if ("+y+") { ",m.schema=t.schema.then,m.schemaPath=t.schemaPath+".then",m.errSchemaPath=t.errSchemaPath+"/then",n+=" "+t.validate(m)+" ",m.baseId=T,n+=" "+v+" = "+y+"; ",w&&P?(k="ifClause"+o,n+=" var "+k+" = 'then'; "):k="'then'",n+=" } ",P&&(n+=" else { ")):n+=" if (!"+y+") { ",P&&(m.schema=t.schema.else,m.schemaPath=t.schemaPath+".else",m.errSchemaPath=t.errSchemaPath+"/else",n+=" "+t.validate(m)+" ",m.baseId=T,n+=" "+v+" = "+y+"; ",w&&P?(k="ifClause"+o,n+=" var "+k+" = 'else'; "):k="'else'",n+=" } "),n+=" if (!"+v+") { var err = ",t.createErrors!==!1?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { failingKeyword: "+k+" } ",t.opts.messages!==!1&&(n+=` , message: 'should match "' + `+k+` + '" schema' `),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&f&&(t.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } ",f&&(n+=" else { ")}else f&&(n+=" if (true) { ");return n}}),j$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b="i"+o,w=m.dataLevel=t.dataLevel+1,P="data"+w,T=t.baseId;if(n+="var "+h+" = errors;var "+v+";",Array.isArray(c)){var k=t.schema.additionalItems;if(k===!1){n+=" "+v+" = "+d+".length <= "+c.length+"; ";var D=p;p=t.errSchemaPath+"/additionalItems",n+=" if (!"+v+") { ";var A=A||[];A.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+c.length+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have more than "+c.length+" items' "),t.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var $=n;n=A.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+$+"]); ":n+=" validate.errors = ["+$+"]; return false; ":n+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",p=D,f&&(y+="}",n+=" else { ")}var N=c;if(N){for(var C,O=-1,j=N.length-1;O0||C===!1:t.util.schemaHasRules(C,t.RULES.all)){n+=" "+g+" = true; if ("+d+".length > "+O+") { ";var F=d+"["+O+"]";m.schema=C,m.schemaPath=u+"["+O+"]",m.errSchemaPath=p+"/"+O,m.errorPath=t.util.getPathExpr(t.errorPath,O,t.opts.jsonPointers,!0),m.dataPathArr[w]=O;var B=t.validate(m);m.baseId=T,t.util.varOccurences(B,P)<2?n+=" "+t.util.varReplace(B,P,F)+" ":n+=" var "+P+" = "+F+"; "+B+" ",n+=" } ",f&&(n+=" if ("+g+") { ",y+="}")}}if(typeof k=="object"&&(t.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:t.util.schemaHasRules(k,t.RULES.all))){m.schema=k,m.schemaPath=t.schemaPath+".additionalItems",m.errSchemaPath=t.errSchemaPath+"/additionalItems",n+=" "+g+" = true; if ("+d+".length > "+c.length+") { for (var "+b+" = "+c.length+"; "+b+" < "+d+".length; "+b+"++) { ",m.errorPath=t.util.getPathExpr(t.errorPath,b,t.opts.jsonPointers,!0);var F=d+"["+b+"]";m.dataPathArr[w]=b;var B=t.validate(m);m.baseId=T,t.util.varOccurences(B,P)<2?n+=" "+t.util.varReplace(B,P,F)+" ":n+=" var "+P+" = "+F+"; "+B+" ",f&&(n+=" if (!"+g+") break; "),n+=" } } ",f&&(n+=" if ("+g+") { ",y+="}")}}else if(t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){m.schema=c,m.schemaPath=u,m.errSchemaPath=p,n+=" for (var "+b+" = 0; "+b+" < "+d+".length; "+b+"++) { ",m.errorPath=t.util.getPathExpr(t.errorPath,b,t.opts.jsonPointers,!0);var F=d+"["+b+"]";m.dataPathArr[w]=b;var B=t.validate(m);m.baseId=T,t.util.varOccurences(B,P)<2?n+=" "+t.util.varReplace(B,P,F)+" ":n+=" var "+P+" = "+F+"; "+B+" ",f&&(n+=" if (!"+g+") break; "),n+=" }"}return f&&(n+=" "+y+" if ("+h+" == errors) {"),n}}),pS=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,T,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c;var m=s=="maximum",y=m?"exclusiveMaximum":"exclusiveMinimum",g=t.schema[y],b=t.opts.$data&&g&&g.$data,w=m?"<":">",P=m?">":"<",T=void 0;if(!(v||typeof c=="number"||c===void 0))throw new Error(s+" must be number");if(!(b||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(y+" must be number or boolean");if(b){var k=t.util.getData(g.$data,l,t.dataPathArr),D="exclusive"+o,A="exclType"+o,$="exclIsNumber"+o,N="op"+o,C="' + "+N+" + '";n+=" var schemaExcl"+o+" = "+k+"; ",k="schemaExcl"+o,n+=" var "+D+"; var "+A+" = typeof "+k+"; if ("+A+" != 'boolean' && "+A+" != 'undefined' && "+A+" != 'number') { ";var T=y,O=O||[];O.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(T||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: '"+y+" should be boolean' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var j=n;n=O.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+j+"]); ":n+=" validate.errors = ["+j+"]; return false; ":n+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+A+" == 'number' ? ( ("+D+" = "+h+" === undefined || "+k+" "+w+"= "+h+") ? "+d+" "+P+"= "+k+" : "+d+" "+P+" "+h+" ) : ( ("+D+" = "+k+" === true) ? "+d+" "+P+"= "+h+" : "+d+" "+P+" "+h+" ) || "+d+" !== "+d+") { var op"+o+" = "+D+" ? '"+w+"' : '"+w+"='; ",c===void 0&&(T=y,p=t.errSchemaPath+"/"+y,h=k,v=b)}else{var $=typeof g=="number",C=w;if($&&v){var N="'"+C+"'";n+=" if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" ( "+h+" === undefined || "+g+" "+w+"= "+h+" ? "+d+" "+P+"= "+g+" : "+d+" "+P+" "+h+" ) || "+d+" !== "+d+") { "}else{$&&c===void 0?(D=!0,T=y,p=t.errSchemaPath+"/"+y,h=g,P+="="):($&&(h=Math[m?"min":"max"](g,c)),g===($?h:!0)?(D=!0,T=y,p=t.errSchemaPath+"/"+y,P+="="):(D=!1,C+="="));var N="'"+C+"'";n+=" if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+d+" "+P+" "+h+" || "+d+" !== "+d+") { "}}T=T||s;var O=O||[];O.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(T||"_limit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { comparison: "+N+", limit: "+h+", exclusive: "+D+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be "+C+" ",v?n+="' + "+h:n+=""+h+"'"),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var j=n;return n=O.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+j+"]); ":n+=" validate.errors = ["+j+"]; return false; ":n+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { "),n}}),dS=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,y,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");var m=s=="maxItems"?">":"<";n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" "+d+".length "+m+" "+h+") { ";var y=s,g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(y||"_limitItems")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have ",s=="maxItems"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+h+" + '":n+=""+c,n+=" items' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),fS=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,y,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");var m=s=="maxLength"?">":"<";n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),t.opts.unicode===!1?n+=" "+d+".length ":n+=" ucs2length("+d+") ",n+=" "+m+" "+h+") { ";var y=s,g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(y||"_limitLength")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be ",s=="maxLength"?n+="longer":n+="shorter",n+=" than ",v?n+="' + "+h+" + '":n+=""+c,n+=" characters' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),mS=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,y,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");var m=s=="maxProperties"?">":"<";n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),n+=" Object.keys("+d+").length "+m+" "+h+") { ";var y=s,g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(y||"_limitProperties")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { limit: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have ",s=="maxProperties"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+h+" + '":n+=""+c,n+=" properties' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),$$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c,!(v||typeof c=="number"))throw new Error(s+" must be number");n+="var division"+o+";if (",v&&(n+=" "+h+" !== undefined && ( typeof "+h+" != 'number' || "),n+=" (division"+o+" = "+d+" / "+h+", ",t.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+t.opts.multipleOfPrecision+" ":n+=" division"+o+" !== parseInt(division"+o+") ",n+=" ) ",v&&(n+=" ) "),n+=" ) { ";var m=m||[];m.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { multipleOf: "+h+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",v?n+="' + "+h:n+=""+h+"'"),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var y=n;return n=m.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),M$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t);h.level++;var m="valid"+h.level;if(t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){h.schema=c,h.schemaPath=u,h.errSchemaPath=p,n+=" var "+v+" = errors; ";var y=t.compositeRule;t.compositeRule=h.compositeRule=!0,h.createErrors=!1;var g;h.opts.allErrors&&(g=h.opts.allErrors,h.opts.allErrors=!1),n+=" "+t.validate(h)+" ",h.createErrors=!0,g&&(h.opts.allErrors=g),t.compositeRule=h.compositeRule=y,n+=" if ("+m+") { ";var b=b||[];b.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var w=n;n=b.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { errors = "+v+"; if (vErrors !== null) { if ("+v+") vErrors.length = "+v+"; else vErrors = null; } ",t.opts.allErrors&&(n+=" } ")}else n+=" var err = ",t.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(n+=" if (false) { ");return n}}),L$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h="errs__"+o,m=t.util.copy(t),y="";m.level++;var g="valid"+m.level,b=m.baseId,w="prevValid"+o,P="passingSchemas"+o;n+="var "+h+" = errors , "+w+" = false , "+v+" = false , "+P+" = null; ";var T=t.compositeRule;t.compositeRule=m.compositeRule=!0;var k=c;if(k)for(var D,A=-1,$=k.length-1;A<$;)D=k[A+=1],(t.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:t.util.schemaHasRules(D,t.RULES.all))?(m.schema=D,m.schemaPath=u+"["+A+"]",m.errSchemaPath=p+"/"+A,n+=" "+t.validate(m)+" ",m.baseId=b):n+=" var "+g+" = true; ",A&&(n+=" if ("+g+" && "+w+") { "+v+" = false; "+P+" = ["+P+", "+A+"]; } else { ",y+="}"),n+=" if ("+g+") { "+v+" = "+w+" = true; "+P+" = "+A+"; }";return t.compositeRule=m.compositeRule=T,n+=""+y+"if (!"+v+") { var err = ",t.createErrors!==!1?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { passingSchemas: "+P+" } ",t.opts.messages!==!1&&(n+=" , message: 'should match exactly one schema in oneOf' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&f&&(t.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+="} else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }",t.opts.allErrors&&(n+=" } "),n}}),q$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v=t.opts.$data&&c&&c.$data,h;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",h="schema"+o):h=c;var m=v?"(new RegExp("+h+"))":t.usePattern(c);n+="if ( ",v&&(n+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),n+=" !"+m+".test("+d+") ) { ";var y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { pattern: ",v?n+=""+h:n+=""+t.util.toQuotedString(c),n+=" } ",t.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,v?n+="' + "+h+" + '":n+=""+t.util.escapeQuotes(c),n+=`"' `),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+u:n+=""+t.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var g=n;return n=y.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+g+"]); ":n+=" validate.errors = ["+g+"]; return false; ":n+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",f&&(n+=" else { "),n}}),F$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t),m="";h.level++;var y="valid"+h.level,g="key"+o,b="idx"+o,w=h.dataLevel=t.dataLevel+1,P="data"+w,T="dataProperties"+o,k=Object.keys(c||{}).filter(W),D=t.schema.patternProperties||{},A=Object.keys(D).filter(W),$=t.schema.additionalProperties,N=k.length||A.length,C=$===!1,O=typeof $=="object"&&Object.keys($).length,j=t.opts.removeAdditional,F=C||O||j,B=t.opts.ownProperties,V=t.baseId,Q=t.schema.required;if(Q&&!(t.opts.$data&&Q.$data)&&Q.length8)n+=" || validate.schema"+u+".hasOwnProperty("+g+") ";else{var ae=k;if(ae)for(var ee,Le=-1,he=ae.length-1;Le0||We===!1:t.util.schemaHasRules(We,t.RULES.all)){var Je=t.util.getProperty(ee),De=d+Je,Ke=$e&&We.default!==void 0;h.schema=We,h.schemaPath=u+Je,h.errSchemaPath=p+"/"+t.util.escapeFragment(ee),h.errorPath=t.util.getPath(t.errorPath,ee,t.opts.jsonPointers),h.dataPathArr[w]=t.util.toQuotedString(ee);var fe=t.validate(h);if(h.baseId=V,t.util.varOccurences(fe,P)<2){fe=t.util.varReplace(fe,P,De);var Qe=De}else{var Qe=P;n+=" var "+P+" = "+De+"; "}if(Ke)n+=" "+fe+" ";else{if(K&&K[ee]){n+=" if ( "+Qe+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(ee)+"') "),n+=") { "+y+" = false; ";var G=t.errorPath,pe=p,Et=t.util.escapeQuotes(ee);t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPath(G,ee,t.opts.jsonPointers)),p=t.errSchemaPath+"/required";var Z=Z||[];Z.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { missingProperty: '"+Et+"' } ",t.opts.messages!==!1&&(n+=" , message: '",t.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+Et+"\\'",n+="' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var X=n;n=Z.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+X+"]); ":n+=" validate.errors = ["+X+"]; return false; ":n+=" var err = "+X+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p=pe,t.errorPath=G,n+=" } else { "}else f?(n+=" if ( "+Qe+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(ee)+"') "),n+=") { "+y+" = true; } else { "):(n+=" if ("+Qe+" !== undefined ",B&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", '"+t.util.escapeQuotes(ee)+"') "),n+=" ) { ");n+=" "+fe+" } "}}f&&(n+=" if ("+y+") { ",m+="}")}}if(A.length){var St=A;if(St)for(var be,Rt=-1,Gr=St.length-1;Rt0||We===!1:t.util.schemaHasRules(We,t.RULES.all)){h.schema=We,h.schemaPath=t.schemaPath+".patternProperties"+t.util.getProperty(be),h.errSchemaPath=t.errSchemaPath+"/patternProperties/"+t.util.escapeFragment(be),B?n+=" "+T+" = "+T+" || Object.keys("+d+"); for (var "+b+"=0; "+b+"<"+T+".length; "+b+"++) { var "+g+" = "+T+"["+b+"]; ":n+=" for (var "+g+" in "+d+") { ",n+=" if ("+t.usePattern(be)+".test("+g+")) { ",h.errorPath=t.util.getPathExpr(t.errorPath,g,t.opts.jsonPointers);var De=d+"["+g+"]";h.dataPathArr[w]=g;var fe=t.validate(h);h.baseId=V,t.util.varOccurences(fe,P)<2?n+=" "+t.util.varReplace(fe,P,De)+" ":n+=" var "+P+" = "+De+"; "+fe+" ",f&&(n+=" if (!"+y+") break; "),n+=" } ",f&&(n+=" else "+y+" = true; "),n+=" } ",f&&(n+=" if ("+y+") { ",m+="}")}}}return f&&(n+=" "+m+" if ("+v+" == errors) {"),n}}),U$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="errs__"+o,h=t.util.copy(t),m="";h.level++;var y="valid"+h.level;if(n+="var "+v+" = errors;",t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){h.schema=c,h.schemaPath=u,h.errSchemaPath=p;var g="key"+o,b="idx"+o,w="i"+o,P="' + "+g+" + '",T=h.dataLevel=t.dataLevel+1,k="data"+T,D="dataProperties"+o,A=t.opts.ownProperties,$=t.baseId;A&&(n+=" var "+D+" = undefined; "),A?n+=" "+D+" = "+D+" || Object.keys("+d+"); for (var "+b+"=0; "+b+"<"+D+".length; "+b+"++) { var "+g+" = "+D+"["+b+"]; ":n+=" for (var "+g+" in "+d+") { ",n+=" var startErrs"+o+" = errors; ";var N=g,C=t.compositeRule;t.compositeRule=h.compositeRule=!0;var O=t.validate(h);h.baseId=$,t.util.varOccurences(O,k)<2?n+=" "+t.util.varReplace(O,k,N)+" ":n+=" var "+k+" = "+N+"; "+O+" ",t.compositeRule=h.compositeRule=C,n+=" if (!"+y+") { for (var "+w+"=startErrs"+o+"; "+w+"{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c;var y="schema"+o;if(!h)if(c.length0||k===!1:t.util.schemaHasRules(k,t.RULES.all))||(g[g.length]=w)}}else var g=c;if(h||g.length){var D=t.errorPath,A=h||g.length>=t.opts.loopRequired,$=t.opts.ownProperties;if(f)if(n+=" var missing"+o+"; ",A){h||(n+=" var "+y+" = validate.schema"+u+"; ");var N="i"+o,C="schema"+o+"["+N+"]",O="' + "+C+" + '";t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPathExpr(D,C,t.opts.jsonPointers)),n+=" var "+v+" = true; ",h&&(n+=" if (schema"+o+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+o+")) "+v+" = false; else {"),n+=" for (var "+N+" = 0; "+N+" < "+y+".length; "+N+"++) { "+v+" = "+d+"["+y+"["+N+"]] !== undefined ",$&&(n+=" && Object.prototype.hasOwnProperty.call("+d+", "+y+"["+N+"]) "),n+="; if (!"+v+") break; } ",h&&(n+=" } "),n+=" if (!"+v+") { ";var j=j||[];j.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { missingProperty: '"+O+"' } ",t.opts.messages!==!1&&(n+=" , message: '",t.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+O+"\\'",n+="' "),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var F=n;n=j.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+F+"]); ":n+=" validate.errors = ["+F+"]; return false; ":n+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var B=g;if(B)for(var V,N=-1,Q=B.length-1;N{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d="data"+(l||""),v="valid"+o,h=t.opts.$data&&c&&c.$data,m;if(h?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",m="schema"+o):m=c,(c||h)&&t.opts.uniqueItems!==!1){h&&(n+=" var "+v+"; if ("+m+" === false || "+m+" === undefined) "+v+" = true; else if (typeof "+m+" != 'boolean') "+v+" = false; else { "),n+=" var i = "+d+".length , "+v+" = true , j; if (i > 1) { ";var y=t.schema.items&&t.schema.items.type,g=Array.isArray(y);if(!y||y=="object"||y=="array"||g&&(y.indexOf("object")>=0||y.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+d+"[i], "+d+"[j])) { "+v+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+d+"[i]; ";var b="checkDataType"+(g?"s":"");n+=" if ("+t.util[b](y,"item",t.opts.strictNumbers,!0)+") continue; ",g&&(n+=` if (typeof item == 'string') item = '"' + item; `),n+=" if (typeof itemIndices[item] == 'number') { "+v+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",h&&(n+=" } "),n+=" if (!"+v+") { ";var w=w||[];w.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { i: i, j: j } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),t.opts.verbose&&(n+=" , schema: ",h?n+="validate.schema"+u:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var P=n;n=w.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+P+"]); ":n+=" validate.errors = ["+P+"]; return false; ":n+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",f&&(n+=" else { ")}else f&&(n+=" if (true) { ");return n}}),H$=Ne((a,e)=>{e.exports={$ref:T$(),allOf:R$(),anyOf:P$(),$comment:O$(),const:C$(),contains:k$(),dependencies:I$(),enum:A$(),format:N$(),if:D$(),items:j$(),maximum:pS(),minimum:pS(),maxItems:dS(),minItems:dS(),maxLength:fS(),minLength:fS(),maxProperties:mS(),minProperties:mS(),multipleOf:$$(),not:M$(),oneOf:L$(),pattern:q$(),properties:F$(),propertyNames:U$(),required:z$(),uniqueItems:B$(),validate:PS()}}),V$=Ne((a,e)=>{var r=H$(),t=Mn().toHash;e.exports=function(){var i=[{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"]}],n=["type","$comment"],o=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],l=["number","integer","string","array","object","boolean","null"];return i.all=t(n),i.types=t(l),i.forEach(function(c){c.rules=c.rules.map(function(u){var p;if(typeof u=="object"){var f=Object.keys(u)[0];p=u[f],u=f,p.forEach(function(v){n.push(v),i.all[v]=!0})}n.push(u);var d=i.all[u]={keyword:u,code:r[u],implements:p};return d}),i.all.$comment={keyword:"$comment",code:r.$comment},c.type&&(i.types[c.type]=c)}),i.keywords=t(n.concat(o)),i.custom={},i}}),W$=Ne((a,e)=>{var r=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];e.exports=function(t,s){for(var i=0;i{var r=of().MissingRef;e.exports=t;function t(s,i,n){var o=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof i=="function"&&(n=i,i=void 0);var l=c(s).then(function(){var p=o._addSchema(s,void 0,i);return p.validate||u(p)});return n&&l.then(function(p){n(null,p)},n),l;function c(p){var f=p.$schema;return f&&!o.getSchema(f)?t.call(o,{$ref:f},!0):Promise.resolve()}function u(p){try{return o._compile(p)}catch(d){if(d instanceof r)return f(d);throw d}function f(d){var v=d.missingSchema;if(y(v))throw new Error("Schema "+v+" is loaded but "+d.missingRef+" cannot be resolved");var h=o._loadingSchemas[v];return h||(h=o._loadingSchemas[v]=o._opts.loadSchema(v),h.then(m,m)),h.then(function(g){if(!y(v))return c(g).then(function(){y(v)||o.addSchema(g,v,void 0,i)})}).then(function(){return u(p)});function m(){delete o._loadingSchemas[v]}function y(g){return o._refs[g]||o._schemas[g]}}}}}),Z$=Ne((a,e)=>{e.exports=function(t,s,i){var n=" ",o=t.level,l=t.dataLevel,c=t.schema[s],u=t.schemaPath+t.util.getProperty(s),p=t.errSchemaPath+"/"+s,f=!t.opts.allErrors,d,v="data"+(l||""),h="valid"+o,m="errs__"+o,y=t.opts.$data&&c&&c.$data,g;y?(n+=" var schema"+o+" = "+t.util.getData(c.$data,l,t.dataPathArr)+"; ",g="schema"+o):g=c;var b=this,w="definition"+o,P=b.definition,T="",k,D,A,$,N;if(y&&P.$data){N="keywordValidate"+o;var C=P.validateSchema;n+=" var "+w+" = RULES.custom['"+s+"'].definition; var "+N+" = "+w+".validate;"}else{if($=t.useCustomRule(b,c,t.schema,t),!$)return;g="validate.schema"+u,N=$.code,k=P.compile,D=P.inline,A=P.macro}var O=N+".errors",j="i"+o,F="ruleErr"+o,B=P.async;if(B&&!t.async)throw new Error("async keyword in sync schema");if(D||A||(n+=""+O+" = null;"),n+="var "+m+" = errors;var "+h+";",y&&P.$data&&(T+="}",n+=" if ("+g+" === undefined) { "+h+" = true; } else { ",C&&(T+="}",n+=" "+h+" = "+w+".validateSchema("+g+"); if ("+h+") { ")),D)P.statements?n+=" "+$.validate+" ":n+=" "+h+" = "+$.validate+"; ";else if(A){var V=t.util.copy(t),T="";V.level++;var Q="valid"+V.level;V.schema=$.validate,V.schemaPath="";var K=t.compositeRule;t.compositeRule=V.compositeRule=!0;var W=t.validate(V).replace(/validate\.schema/g,N);t.compositeRule=V.compositeRule=K,n+=" "+W}else{var ae=ae||[];ae.push(n),n="",n+=" "+N+".call( ",t.opts.passContext?n+="this":n+="self",k||P.schema===!1?n+=" , "+v+" ":n+=" , "+g+" , "+v+" , validate.schema"+t.schemaPath+" ",n+=" , (dataPath || '')",t.errorPath!='""'&&(n+=" + "+t.errorPath);var ee=l?"data"+(l-1||""):"parentData",Le=l?t.dataPathArr[l]:"parentDataProperty";n+=" , "+ee+" , "+Le+" , rootData ) ";var he=n;n=ae.pop(),P.errors===!1?(n+=" "+h+" = ",B&&(n+="await "),n+=""+he+"; "):B?(O="customErrors"+o,n+=" var "+O+" = null; try { "+h+" = await "+he+"; } catch (e) { "+h+" = false; if (e instanceof ValidationError) "+O+" = e.errors; else throw e; } "):n+=" "+O+" = null; "+h+" = "+he+"; "}if(P.modifying&&(n+=" if ("+ee+") "+v+" = "+ee+"["+Le+"];"),n+=""+T,P.valid)f&&(n+=" if (true) { ");else{n+=" if ( ",P.valid===void 0?(n+=" !",A?n+=""+Q:n+=""+h):n+=" "+!P.valid+" ",n+=") { ",d=b.keyword;var ae=ae||[];ae.push(n),n="";var ae=ae||[];ae.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(p)+" , params: { keyword: '"+b.keyword+"' } ",t.opts.messages!==!1&&(n+=` , message: 'should pass "`+b.keyword+`" keyword validation' `),t.opts.verbose&&(n+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+v+" "),n+=" } "):n+=" {} ";var Ee=n;n=ae.pop(),!t.compositeRule&&f?t.async?n+=" throw new ValidationError(["+Ee+"]); ":n+=" validate.errors = ["+Ee+"]; return false; ":n+=" var err = "+Ee+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var be=n;n=ae.pop(),D?P.errors?P.errors!="full"&&(n+=" for (var "+j+"="+m+"; "+j+"{e.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}}),K$=Ne((a,e)=>{var r=OS();e.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:r.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:r.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"}]}}}}),X$=Ne((a,e)=>{var r=/^[a-z_$][a-z0-9_$-]*$/i,t=Z$(),s=K$();e.exports={add:i,get:n,remove:o,validate:l};function i(c,u){var p=this.RULES;if(p.keywords[c])throw new Error("Keyword "+c+" is already defined");if(!r.test(c))throw new Error("Keyword "+c+" is not a valid identifier");if(u){this.validateKeyword(u,!0);var f=u.type;if(Array.isArray(f))for(var d=0;d{e.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}}),J$=Ne((a,e)=>{var r=E$(),t=nf(),s=S$(),i=TS(),n=RS(),o=w$(),l=V$(),c=W$(),u=Mn();e.exports=m,m.prototype.validate=y,m.prototype.compile=g,m.prototype.addSchema=b,m.prototype.addMetaSchema=w,m.prototype.validateSchema=P,m.prototype.getSchema=k,m.prototype.removeSchema=$,m.prototype.addFormat=K,m.prototype.errorsText=Q,m.prototype._addSchema=C,m.prototype._compile=O,m.prototype.compileAsync=G$();var p=X$();m.prototype.addKeyword=p.add,m.prototype.getKeyword=p.get,m.prototype.removeKeyword=p.remove,m.prototype.validateKeyword=p.validate;var f=of();m.ValidationError=f.Validation,m.MissingRefError=f.MissingRef,m.$dataMetaSchema=c;var d="http://json-schema.org/draft-07/schema",v=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],h=["/properties"];function m(U){if(!(this instanceof m))return new m(U);U=this._opts=u.copy(U)||{},be(this),this._schemas={},this._refs={},this._fragments={},this._formats=o(U.format),this._cache=U.cache||new s,this._loadingSchemas={},this._compilations=[],this.RULES=l(),this._getId=j(U),U.loopRequired=U.loopRequired||1/0,U.errorDataPath=="property"&&(U._errorDataPathProperty=!0),U.serialize===void 0&&(U.serialize=n),this._metaOpts=Ee(this),U.formats&&ee(this),U.keywords&&Le(this),W(this),typeof U.meta=="object"&&this.addMetaSchema(U.meta),U.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),ae(this)}function y(U,G){var re;if(typeof U=="string"){if(re=this.getSchema(U),!re)throw new Error('no schema with key or ref "'+U+'"')}else{var pe=this._addSchema(U);re=pe.validate||this._compile(pe)}var Z=re(G);return re.$async!==!0&&(this.errors=re.errors),Z}function g(U,G){var re=this._addSchema(U,void 0,G);return re.validate||this._compile(re)}function b(U,G,re,pe){if(Array.isArray(U)){for(var Z=0;Z0&&O.push("--allowedTools",T.join(",")),k.length>0&&O.push("--disallowedTools",k.join(",")),D&&Object.keys(D).length>0&&O.push("--mcp-config",JSON.stringify({mcpServers:D})),r&&Object.keys(r).length>0&&O.push("--agents",JSON.stringify(r)),P&&O.push("--setting-sources",P.join(",")),A&&O.push("--strict-mcp-config"),m&&O.push("--permission-mode",m),y&&O.push("--allow-dangerously-skip-permissions"),h){if(v&&h===v)throw new Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");O.push("--fallback-model",h)}N&&O.push("--include-partial-messages");for(let W of e)O.push("--add-dir",W);if(C&&C.length>0)for(let W of C)if(W.type==="local")O.push("--plugin-dir",W.path);else throw new Error(`Unsupported plugin type: ${W.type}`);this.options.forkSession&&O.push("--fork-session"),this.options.resumeSessionAt&&O.push("--resume-session-at",this.options.resumeSessionAt);for(let[W,ae]of Object.entries(n))ae===null?O.push(`--${W}`):O.push(`--${W}`,ae);if(l.CLAUDE_CODE_ENTRYPOINT||(l.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),!ia().existsSync(o)){let W=hS(o)?`Claude Code native binary not found at ${o}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${o}. Is options.pathToClaudeCodeExecutable set?`;throw new ReferenceError(W)}let F=hS(o),B=F?o:s,V=F?[...i,...O]:[...i,o,...O];this.logForDebugging(F?`Spawning Claude Code native binary: ${B} ${V.join(" ")}`:`Spawning Claude Code process: ${B} ${V.join(" ")}`);let Q=l.DEBUG||c?"pipe":"ignore";this.child=(0,AS.spawn)(B,V,{cwd:t,stdio:["pipe","pipe",Q],signal:this.abortController.signal,env:l}),this.childStdin=this.child.stdin,this.childStdout=this.child.stdout,(l.DEBUG||c)&&this.child.stderr.on("data",W=>{this.logForDebugging(W.toString())});let K=()=>{this.child&&!this.child.killed&&this.child.kill("SIGTERM")};this.processExitHandler=K,this.abortHandler=K,process.on("exit",this.processExitHandler),this.abortController.signal.addEventListener("abort",this.abortHandler),this.child.on("error",W=>{this.ready=!1,this.abortController.signal.aborted?this.exitError=new xs("Claude Code process aborted by user"):(this.exitError=new Error(`Failed to spawn Claude Code process: ${W.message}`),this.logForDebugging(this.exitError.message))}),this.child.on("close",(W,ae)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new xs("Claude Code process aborted by user");else{let ee=this.getProcessExitError(W,ae);ee&&(this.exitError=ee,this.logForDebugging(ee.message))}}),this.ready=!0}catch(e){throw this.ready=!1,e}}getProcessExitError(e,r){if(e!==0&&e!==null)return new Error(`Claude Code process exited with code ${e}`);if(r)return new Error(`Claude Code process terminated by signal ${r}`)}logForDebugging(e){process.env.DEBUG&&process.stderr.write(`${e} `),this.options.stderr&&this.options.stderr(e)}write(e){if(this.abortController.signal.aborted)throw new xs("Operation aborted");if(!this.ready||!this.childStdin)throw new Error("ProcessTransport is not ready for writing");if(this.child?.killed||this.child?.exitCode!==null)throw new Error("Cannot write to terminated process");if(this.exitError)throw new Error(`Cannot write to process that exited with error: ${this.exitError.message}`);process.env.DEBUG_SDK&&process.stderr.write(`[ProcessTransport] Writing to stdin: ${e.substring(0,100)} `);try{!this.childStdin.write(e)&&process.env.DEBUG_SDK&&console.warn("[ProcessTransport] Write buffer full, data queued")}catch(r){throw this.ready=!1,new Error(`Failed to write to process stdin: ${r.message}`)}}close(){this.childStdin&&(this.childStdin.end(),this.childStdin=void 0),this.processExitHandler&&(process.off("exit",this.processExitHandler),this.processExitHandler=void 0),this.abortHandler&&(this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0);for(let{handler:e}of this.exitListeners)this.child?.off("exit",e);this.exitListeners=[],this.child&&!this.child.killed&&(this.child.kill("SIGTERM"),setTimeout(()=>{this.child&&!this.child.killed&&this.child.kill("SIGKILL")},5e3)),this.ready=!1}isReady(){return this.ready}async*readMessages(){if(!this.childStdout)throw new Error("ProcessTransport output stream not available");let e=(0,NS.createInterface)({input:this.childStdout});try{for await(let r of e)r.trim()&&(yield JSON.parse(r));await this.waitForExit()}catch(r){throw r}finally{e.close()}}endInput(){this.childStdin&&this.childStdin.end()}getInputStream(){return this.childStdin}onExit(e){if(!this.child)return()=>{};let r=(t,s)=>{let i=this.getProcessExitError(t,s);e(i)};return this.child.on("exit",r),this.exitListeners.push({callback:e,handler:r}),()=>{this.child&&this.child.off("exit",r);let t=this.exitListeners.findIndex(s=>s.handler===r);t!==-1&&this.exitListeners.splice(t,1)}}async waitForExit(){if(!this.child){if(this.exitError)throw this.exitError;return}if(this.child.exitCode!==null||this.child.killed){if(this.exitError)throw this.exitError;return}return new Promise((e,r)=>{let t=(i,n)=>{if(this.abortController.signal.aborted){r(new xs("Operation aborted"));return}let o=this.getProcessExitError(i,n);o?r(o):e()};this.child.once("exit",t);let s=i=>{this.child.off("exit",t),r(i)};this.child.once("error",s),this.child.once("exit",()=>{this.child.off("error",s)})})}};function hS(a){return![".js",".mjs",".tsx",".ts",".jsx"].some(r=>a.endsWith(r))}var Kd=class{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(e){this.returned=e}[Symbol.asyncIterator](){if(this.started)throw new Error("Stream can only be iterated once");return this.started=!0,this}next(){return this.queue.length>0?Promise.resolve({done:!1,value:this.queue.shift()}):this.isDone?Promise.resolve({done:!0,value:void 0}):this.hasError?Promise.reject(this.hasError):new Promise((e,r)=>{this.readResolve=e,this.readReject=r})}enqueue(e){if(this.readResolve){let r=this.readResolve;this.readResolve=void 0,this.readReject=void 0,r({done:!1,value:e})}else this.queue.push(e)}done(){if(this.isDone=!0,this.readResolve){let e=this.readResolve;this.readResolve=void 0,this.readReject=void 0,e({done:!0,value:void 0})}}error(e){if(this.hasError=e,this.readReject){let r=this.readReject;this.readResolve=void 0,this.readReject=void 0,r(e)}}return(){return this.isDone=!0,this.returned&&this.returned(),Promise.resolve({done:!0,value:void 0})}},Xd=class{sendMcpMessage;isClosed=!1;constructor(e){this.sendMcpMessage=e}onclose;onerror;onmessage;async start(){}async send(e){if(this.isClosed)throw new Error("Transport is closed");this.sendMcpMessage(e)}async close(){this.isClosed||(this.isClosed=!0,this.onclose?.())}},r8=typeof global=="object"&&global&&global.Object===Object&&global,a8=r8,s8=typeof self=="object"&&self&&self.Object===Object&&self,n8=a8||s8||Function("return this")(),cf=n8,i8=cf.Symbol,al=i8,$S=Object.prototype,o8=$S.hasOwnProperty,c8=$S.toString,Fi=al?al.toStringTag:void 0;function l8(a){var e=o8.call(a,Fi),r=a[Fi];try{a[Fi]=void 0;var t=!0}catch{}var s=c8.call(a);return t&&(e?a[Fi]=r:delete a[Fi]),s}var u8=l8,p8=Object.prototype,d8=p8.toString;function f8(a){return d8.call(a)}var m8=f8,h8="[object Null]",v8="[object Undefined]",vS=al?al.toStringTag:void 0;function g8(a){return a==null?a===void 0?v8:h8:vS&&vS in Object(a)?u8(a):m8(a)}var y8=g8;function b8(a){var e=typeof a;return a!=null&&(e=="object"||e=="function")}var MS=b8,x8="[object AsyncFunction]",_8="[object Function]",E8="[object GeneratorFunction]",S8="[object Proxy]";function w8(a){if(!MS(a))return!1;var e=y8(a);return e==_8||e==E8||e==x8||e==S8}var T8=w8,R8=cf["__core-js_shared__"],Hd=R8,gS=(function(){var a=/[^.]+$/.exec(Hd&&Hd.keys&&Hd.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function P8(a){return!!gS&&gS in a}var O8=P8,C8=Function.prototype,k8=C8.toString;function I8(a){if(a!=null){try{return k8.call(a)}catch{}try{return a+""}catch{}}return""}var A8=I8,N8=/[\\^$.*+?()[\]{}|]/g,D8=/^\[object .+?Constructor\]$/,j8=Function.prototype,$8=Object.prototype,M8=j8.toString,L8=$8.hasOwnProperty,q8=RegExp("^"+M8.call(L8).replace(N8,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function F8(a){if(!MS(a)||O8(a))return!1;var e=T8(a)?q8:D8;return e.test(A8(a))}var U8=F8;function z8(a,e){return a?.[e]}var B8=z8;function H8(a,e){var r=B8(a,e);return U8(r)?r:void 0}var LS=H8;function V8(a,e){return a===e||a!==a&&e!==e}var W8=V8,G8=LS(Object,"create"),Ui=G8;function Z8(){this.__data__=Ui?Ui(null):{},this.size=0}var K8=Z8;function X8(a){var e=this.has(a)&&delete this.__data__[a];return this.size-=e?1:0,e}var Q8=X8,J8="__lodash_hash_undefined__",Y8=Object.prototype,e9=Y8.hasOwnProperty;function t9(a){var e=this.__data__;if(Ui){var r=e[a];return r===J8?void 0:r}return e9.call(e,a)?e[a]:void 0}var r9=t9,a9=Object.prototype,s9=a9.hasOwnProperty;function n9(a){var e=this.__data__;return Ui?e[a]!==void 0:s9.call(e,a)}var i9=n9,o9="__lodash_hash_undefined__";function c9(a,e){var r=this.__data__;return this.size+=this.has(a)?0:1,r[a]=Ui&&e===void 0?o9:e,this}var l9=c9;function Ln(a){var e=-1,r=a==null?0:a.length;for(this.clear();++e-1}var x9=b9;function _9(a,e){var r=this.__data__,t=ul(r,a);return t<0?(++this.size,r.push([a,e])):r[t][1]=e,this}var E9=_9;function qn(a){var e=-1,r=a==null?0:a.length;for(this.clear();++e{if(!a||a.trim()==="")return null;let e=a.split(",").map(i=>i.trim()).filter(Boolean);if(e.length===0)return null;let r=e.some(i=>i.startsWith("!")),t=e.some(i=>!i.startsWith("!"));if(r&&t)return null;let s=e.map(i=>i.replace(/^!/,"").toLowerCase());return{include:r?[]:s,exclude:r?s:[],isExclusive:r}});function z9(a){let e=[],r=a.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])e.push("mcp"),e.push(r[1].toLowerCase());else{let i=a.match(/^([^:[]+):/);i&&i[1]&&e.push(i[1].trim().toLowerCase())}let t=a.match(/^\[([^\]]+)]/);t&&t[1]&&e.push(t[1].trim().toLowerCase()),a.toLowerCase().includes("statsig event:")&&e.push("statsig");let s=a.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(s&&s[1]){let i=s[1].trim().toLowerCase();i.length<30&&!i.includes(" ")&&e.push(i)}return Array.from(new Set(e))}function B9(a,e){return e?a.length===0?!1:e.isExclusive?!a.some(r=>e.exclude.includes(r)):a.some(r=>e.include.includes(r)):!0}function H9(a,e){if(!e)return!0;let r=z9(a);return B9(r,e)}function V9(){return process.env.CLAUDE_CONFIG_DIR??(0,FS.join)((0,US.homedir)(),".claude")}function xS(a){if(!a)return!1;if(typeof a=="boolean")return a;let e=a.toLowerCase().trim();return["1","true","yes","on"].includes(e)}var W9={name:"BASH_MAX_OUTPUT_LENGTH",default:3e4,validate:a=>{if(!a)return{effective:3e4,status:"valid"};let t=parseInt(a,10);return isNaN(t)||t<=0?{effective:3e4,status:"invalid",message:`Invalid value "${a}" (using default: 30000)`}:t>15e4?{effective:15e4,status:"capped",message:`Capped from ${t} to 150000`}:{effective:t,status:"valid"}}},G9={name:"CLAUDE_CODE_MAX_OUTPUT_TOKENS",default:32e3,validate:a=>{if(!a)return{effective:32e3,status:"valid"};let e=parseInt(a,10);return isNaN(e)||e<=0?{effective:32e3,status:"invalid",message:`Invalid value "${a}" (using default: 32000)`}:e>32e3?{effective:32e3,status:"capped",message:`Capped from ${e} to 32000`}:{effective:e,status:"valid"}}};function Z9(){return{originalCwd:(0,Qd.cwd)(),totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:(0,Qd.cwd)(),modelUsage:{},mainLoopModelOverride:void 0,maxRateLimitFallbackActive:!1,initialMainLoopModel:null,modelStrings:null,isNonInteractiveSession:!0,isInteractive:!1,clientType:"cli",sessionIngressToken:void 0,oauthTokenFromFd:void 0,apiKeyFromFd:void 0,flagSettingsPath:void 0,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,sessionId:(0,zS.randomUUID)(),loggerProvider:null,eventLogger:null,meterProvider:null,tracerProvider:null,agentColorMap:new Map,agentColorIndex:0,envVarValidators:[W9,G9],lastAPIRequest:null,inMemoryErrorLog:[],inlinePlugins:[]}}var K9=Z9();function X9(){return K9.sessionId}var BU=Vi(()=>xS(process.env.DEBUG)||xS(process.env.DEBUG_SDK)||process.argv.includes("--debug")||process.argv.includes("-d")||BS()||process.argv.some(a=>a.startsWith("--debug="))),Q9=Vi(()=>{let a=process.argv.find(r=>r.startsWith("--debug="));if(!a)return null;let e=a.substring(8);return U9(e)}),BS=Vi(()=>process.argv.includes("--debug-to-stderr")||process.argv.includes("-d2e"));function J9(a){if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let e=Q9();return H9(a,e)}var Y9=!1;function aa(a,{level:e}={level:"debug"}){if(!J9(a))return;Y9&&a.includes(` `)&&(a=JSON.stringify(a));let r=`[${e.toUpperCase()}] ${a.trim()} @@ -1031,14 +1031,13 @@ Other tips: `)}formatSessionResult(e){let r=e.request||`Session ${e.sdk_session_id?.substring(0,8)||"unknown"}`,t=[];t.push(`## ${r}`),t.push(`*Source: claude-mem://session/${e.sdk_session_id}*`),t.push(""),e.completed&&(t.push(`**Completed:** ${e.completed}`),t.push("")),e.learned&&(t.push(`**Learned:** ${e.learned}`),t.push("")),e.investigated&&(t.push(`**Investigated:** ${e.investigated}`),t.push("")),e.next_steps&&(t.push(`**Next Steps:** ${e.next_steps}`),t.push("")),e.notes&&(t.push(`**Notes:** ${e.notes}`),t.push(""));let s=[];if(e.files_read||e.files_edited){let n=[];if(e.files_read)try{n.push(...JSON.parse(e.files_read))}catch{}if(e.files_edited)try{n.push(...JSON.parse(e.files_edited))}catch{}n.length>0&&s.push(`Files: ${[...new Set(n)].join(", ")}`)}let i=new Date(e.created_at_epoch).toLocaleDateString();return s.push(`Date: ${i}`),s.length>0&&(t.push("---"),t.push(s.join(" | "))),t.join(` `)}formatUserPromptResult(e){let r=[];r.push(`## User Prompt #${e.prompt_number}`),r.push(`*Source: claude-mem://user-prompt/${e.id}*`),r.push(""),r.push(e.prompt_text),r.push(""),r.push("---");let t=new Date(e.created_at_epoch).toLocaleString();return r.push(`Date: ${t}`),r.join(` `)}};var El=class{buildTimeline(e){let r=[...e.observations.map(t=>({type:"observation",data:t,epoch:t.created_at_epoch})),...e.sessions.map(t=>({type:"session",data:t,epoch:t.created_at_epoch})),...e.prompts.map(t=>({type:"prompt",data:t,epoch:t.created_at_epoch}))];return r.sort((t,s)=>t.epoch-s.epoch),r}filterByDepth(e,r,t,s,i){if(e.length===0)return e;let n=-1;if(typeof r=="number")n=e.findIndex(c=>c.type==="observation"&&c.data.id===r);else if(typeof r=="string"&&r.startsWith("S")){let c=parseInt(r.slice(1),10);n=e.findIndex(u=>u.type==="session"&&u.data.id===c)}else n=e.findIndex(c=>c.epoch>=t),n===-1&&(n=e.length-1);if(n===-1)return e;let o=Math.max(0,n-s),l=Math.min(e.length,n+i+1);return e.slice(o,l)}formatTimeline(e,r,t,s,i){if(e.length===0)return t?`Found observation matching "${t}", but no timeline context available.`:"No timeline items found";let n=[];if(t&&r){let c=e.find(p=>p.type==="observation"&&p.data.id===r),u=c?c.data.title||"Untitled":"Unknown";n.push(`# Timeline for query: "${t}"`),n.push(`**Anchor:** Observation #${r} - ${u}`)}else r?n.push(`# Timeline around anchor: ${r}`):n.push("# Timeline");s!==void 0&&i!==void 0?n.push(`**Window:** ${s} records before \u2192 ${i} records after | **Items:** ${e.length}`):n.push(`**Items:** ${e.length}`),n.push(""),n.push("**Legend:** \u{1F3AF} session-request | \u{1F534} bugfix | \u{1F7E3} feature | \u{1F504} refactor | \u2705 change | \u{1F535} discovery | \u{1F9E0} decision"),n.push("");let o=new Map;for(let c of e){let u=this.formatDate(c.epoch);o.has(u)||o.set(u,[]),o.get(u).push(c)}let l=Array.from(o.entries()).sort((c,u)=>{let p=new Date(c[0]).getTime(),f=new Date(u[0]).getTime();return p-f});for(let[c,u]of l){n.push(`### ${c}`),n.push("");let p=null,f="",d=!1;for(let v of u){let h=typeof r=="number"&&v.type==="observation"&&v.data.id===r||typeof r=="string"&&r.startsWith("S")&&v.type==="session"&&`S${v.data.id}`===r;if(v.type==="session"){d&&(n.push(""),d=!1,p=null,f="");let m=v.data,y=m.request||"Session summary",g=`claude-mem://session-summary/${m.id}`,b=h?" \u2190 **ANCHOR**":"";n.push(`**\u{1F3AF} #S${m.id}** ${y} (${this.formatDateTime(v.epoch)}) [\u2192](${g})${b}`),n.push("")}else if(v.type==="prompt"){d&&(n.push(""),d=!1,p=null,f="");let m=v.data,y=m.prompt_text.length>100?m.prompt_text.substring(0,100)+"...":m.prompt_text;n.push(`**\u{1F4AC} User Prompt #${m.prompt_number}** (${this.formatDateTime(v.epoch)})`),n.push(`> ${y}`),n.push("")}else if(v.type==="observation"){let m=v.data,y="General";y!==p&&(d&&n.push(""),n.push(`**${y}**`),n.push("| ID | Time | T | Title | Tokens |"),n.push("|----|------|---|-------|--------|"),p=y,d=!0,f="");let g=this.getTypeIcon(m.type),b=this.formatTime(v.epoch),w=m.title||"Untitled",P=this.estimateTokens(m.narrative),k=b!==f?b:"\u2033";f=b;let D=h?" \u2190 **ANCHOR**":"";n.push(`| #${m.id} | ${k} | ${g} | ${w}${D} | ~${P} |`)}}d&&n.push("")}return n.join(` -`)}getTypeIcon(e){switch(e){case"bugfix":return"\u{1F534}";case"feature":return"\u{1F7E3}";case"refactor":return"\u{1F504}";case"change":return"\u2705";case"discovery":return"\u{1F535}";case"decision":return"\u{1F9E0}";default:return"\u2022"}}formatDate(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"})}formatTime(e){return new Date(e).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}formatDateTime(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}estimateTokens(e){return e?Math.ceil(e.length/4):0}};var mf=vt(zp(),1),Sw=vt(Ew(),1),ww=vt(require("path"),1);Ia();_t();function Tw(a){let e=[];e.push(mf.default.json({limit:"50mb"})),e.push((0,Sw.default)()),e.push((s,i,n)=>{if(s.path.startsWith("/health")||s.path==="/"||s.path.includes("."))return n();let o=Date.now(),l=`${s.method}-${Date.now()}`,c=a(s.method,s.path,s.body);H.info("HTTP",`\u2192 ${s.method} ${s.path}`,{requestId:l},c);let u=i.send.bind(i);i.send=function(p){let f=Date.now()-o;return H.info("HTTP",`\u2190 ${i.statusCode} ${s.path}`,{requestId:l,duration:`${f}ms`}),u(p)},n()});let r=zr(),t=ww.default.join(r,"plugin","ui");return e.push(mf.default.static(t)),e}function Rw(a,e,r){if(!r||Object.keys(r).length===0||e.includes("/init"))return"";if(e.includes("/observations")){let t=r.tool_name||"?",s=r.tool_input;return`tool=${H.formatTool(t,s)}`}return e.includes("/summarize")?"requesting summary":""}var Pw=vt(require("path"),1),Ow=require("fs");Ia();_t();var Sl=class{constructor(e,r,t){this.sseBroadcaster=e;this.dbManager=r;this.sessionManager=t}setupRoutes(e){e.get("/health",this.handleHealth.bind(this)),e.get("/",this.handleViewerUI.bind(this)),e.get("/stream",this.handleSSEStream.bind(this))}handleHealth(e,r){r.json({status:"ok",timestamp:Date.now()})}handleViewerUI(e,r){try{let t=zr(),s=Pw.default.join(t,"plugin","ui","viewer.html"),i=(0,Ow.readFileSync)(s,"utf-8");r.setHeader("Content-Type","text/html"),r.send(i)}catch(t){H.failure("WORKER","Viewer UI error",{},t),r.status(500).json({error:"Failed to load viewer UI"})}}handleSSEStream(e,r){r.setHeader("Content-Type","text/event-stream"),r.setHeader("Cache-Control","no-cache"),r.setHeader("Connection","keep-alive"),this.sseBroadcaster.addClient(r);let t=this.dbManager.getSessionStore().getAllProjects();this.sseBroadcaster.broadcast({type:"initial_load",projects:t,timestamp:Date.now()});let s=this.sessionManager.isAnySessionProcessing(),i=this.sessionManager.getTotalActiveWork();this.sseBroadcaster.broadcast({type:"processing_status",isProcessing:s,queueDepth:i})}};_t();var Cw=100;function E6(a){let e=(a.match(//g)||[]).length,r=(a.match(//g)||[]).length;return e+r}function hf(a){if(typeof a!="string")return ie("[tag-stripping] received non-string for JSON context:",{type:typeof a}),"{}";let e=E6(a);return e>Cw&&ie("[tag-stripping] tag count exceeds limit, truncating:",{tagCount:e,maxAllowed:Cw,contentLength:a.length}),a.replace(/[\s\S]*?<\/claude-mem-context>/g,"").replace(/[\s\S]*?<\/private>/g,"").trim()}var wl=class{constructor(e,r,t,s,i){this.sessionManager=e;this.dbManager=r;this.sdkAgent=t;this.sseBroadcaster=s;this.workerService=i}ensureGeneratorRunning(e,r){let t=this.sessionManager.getSession(e);t&&!t.generatorPromise&&(H.info("SESSION",`Generator auto-starting (${r})`,{sessionId:e,queueDepth:t.pendingMessages.length}),t.generatorPromise=this.sdkAgent.startSession(t,this.workerService).catch(s=>{H.failure("SDK","SDK agent error",{sessionId:e},s)}).finally(()=>{H.info("SESSION","Generator finished",{sessionId:e}),t.generatorPromise=null,this.workerService.broadcastProcessingStatus()}))}setupRoutes(e){e.post("/sessions/:sessionDbId/init",this.handleSessionInit.bind(this)),e.post("/sessions/:sessionDbId/observations",this.handleObservations.bind(this)),e.post("/sessions/:sessionDbId/summarize",this.handleSummarize.bind(this)),e.get("/sessions/:sessionDbId/status",this.handleSessionStatus.bind(this)),e.delete("/sessions/:sessionDbId",this.handleSessionDelete.bind(this)),e.post("/sessions/:sessionDbId/complete",this.handleSessionComplete.bind(this)),e.post("/api/sessions/observations",this.handleObservationsByClaudeId.bind(this)),e.post("/api/sessions/summarize",this.handleSummarizeByClaudeId.bind(this)),e.post("/api/sessions/complete",this.handleSessionCompleteByClaudeId.bind(this))}handleSessionInit(e,r){try{let t=parseInt(e.params.sessionDbId,10),{userPrompt:s,promptNumber:i}=e.body,n=this.sessionManager.initializeSession(t,s,i),o=this.dbManager.getSessionStore().getLatestUserPrompt(n.claudeSessionId);if(o){this.sseBroadcaster.broadcast({type:"new_prompt",prompt:{id:o.id,claude_session_id:o.claude_session_id,project:o.project,prompt_number:o.prompt_number,prompt_text:o.prompt_text,created_at_epoch:o.created_at_epoch}}),this.sseBroadcaster.broadcast({type:"processing_status",isProcessing:!0});let l=Date.now(),c=o.prompt_text;this.dbManager.getChromaSync().syncUserPrompt(o.id,o.sdk_session_id,o.project,c,o.prompt_number,o.created_at_epoch).then(()=>{let u=Date.now()-l,p=c.length>60?c.substring(0,60)+"...":c;H.debug("CHROMA","User prompt synced",{promptId:o.id,duration:`${u}ms`,prompt:p})}).catch(u=>{H.error("CHROMA","Failed to sync user_prompt",{promptId:o.id,sessionId:t},u)})}this.workerService.broadcastProcessingStatus(),H.info("SESSION","Generator starting",{sessionId:t,project:n.project,promptNum:n.lastPromptNumber}),n.generatorPromise=this.sdkAgent.startSession(n,this.workerService).catch(l=>{H.failure("SDK","SDK agent error",{sessionId:t},l)}).finally(()=>{H.info("SESSION","Generator finished",{sessionId:t}),n.generatorPromise=null,this.workerService.broadcastProcessingStatus()}),this.sseBroadcaster.broadcast({type:"session_started",sessionDbId:t,project:n.project}),r.json({status:"initialized",sessionDbId:t,port:On()})}catch(t){H.failure("WORKER","Session init failed",{},t),r.status(500).json({error:t.message})}}handleObservations(e,r){try{let t=parseInt(e.params.sessionDbId,10),{tool_name:s,tool_input:i,tool_response:n,prompt_number:o,cwd:l}=e.body;this.sessionManager.queueObservation(t,{tool_name:s,tool_input:i,tool_response:n,prompt_number:o,cwd:l}),this.ensureGeneratorRunning(t,"observation"),this.workerService.broadcastProcessingStatus(),this.sseBroadcaster.broadcast({type:"observation_queued",sessionDbId:t}),r.json({status:"queued"})}catch(t){H.failure("WORKER","Observation queuing failed",{},t),r.status(500).json({error:t.message})}}handleSummarize(e,r){try{let t=parseInt(e.params.sessionDbId,10),{last_user_message:s,last_assistant_message:i}=e.body;this.sessionManager.queueSummarize(t,s,i),this.ensureGeneratorRunning(t,"summarize"),this.workerService.broadcastProcessingStatus(),r.json({status:"queued"})}catch(t){H.failure("WORKER","Summarize queuing failed",{},t),r.status(500).json({error:t.message})}}handleSessionStatus(e,r){try{let t=parseInt(e.params.sessionDbId,10),s=this.sessionManager.getSession(t);if(!s){r.json({status:"not_found"});return}r.json({status:"active",sessionDbId:t,project:s.project,queueLength:s.pendingMessages.length,uptime:Date.now()-s.startTime})}catch(t){H.failure("WORKER","Session status failed",{},t),r.status(500).json({error:t.message})}}async handleSessionDelete(e,r){try{let t=parseInt(e.params.sessionDbId,10);await this.sessionManager.deleteSession(t),this.dbManager.markSessionComplete(t),this.sseBroadcaster.broadcast({type:"session_completed",sessionDbId:t}),r.json({status:"deleted"})}catch(t){H.failure("WORKER","Session delete failed",{},t),r.status(500).json({error:t.message})}}async handleSessionComplete(e,r){try{let t=parseInt(e.params.sessionDbId,10);if(isNaN(t)){r.status(400).json({success:!1,error:"Invalid session ID"});return}await this.sessionManager.deleteSession(t),this.dbManager.markSessionComplete(t),this.workerService.broadcastProcessingStatus(),this.sseBroadcaster.broadcast({type:"session_completed",timestamp:Date.now(),sessionDbId:t}),r.json({success:!0})}catch(t){H.failure("WORKER","Session complete failed",{},t),r.status(500).json({success:!1,error:String(t)})}}handleObservationsByClaudeId(e,r){try{let{claudeSessionId:t,tool_name:s,tool_input:i,tool_response:n,cwd:o}=e.body;if(!t){r.status(400).json({error:"Missing claudeSessionId"});return}let l=this.dbManager.getSessionStore(),c=l.createSDKSession(t,"",""),u=l.getPromptCounter(c),p=l.getUserPrompt(t,u);if(!p||p.trim()===""){H.debug("HOOK","Skipping observation - user prompt was entirely private",{sessionId:c,promptNumber:u,tool_name:s}),r.json({status:"skipped",reason:"private"});return}let f="{}",d="{}";try{f=i!==void 0?hf(JSON.stringify(i)):"{}"}catch{f='{"error": "Failed to serialize tool_input"}'}try{d=n!==void 0?hf(JSON.stringify(n)):"{}"}catch{d='{"error": "Failed to serialize tool_response"}'}this.sessionManager.queueObservation(c,{tool_name:s,tool_input:f,tool_response:d,prompt_number:u,cwd:o||""}),this.ensureGeneratorRunning(c,"observation"),this.workerService.broadcastProcessingStatus(),this.sseBroadcaster.broadcast({type:"observation_queued",sessionDbId:c}),r.json({status:"queued"})}catch(t){H.failure("WORKER","Observation by claudeId failed",{},t),r.status(500).json({error:t.message})}}handleSummarizeByClaudeId(e,r){try{let{claudeSessionId:t,last_user_message:s,last_assistant_message:i}=e.body;if(!t){r.status(400).json({error:"Missing claudeSessionId"});return}let n=this.dbManager.getSessionStore(),o=n.createSDKSession(t,"",""),l=n.getPromptCounter(o),c=n.getUserPrompt(t,l);if(!c||c.trim()===""){H.debug("HOOK","Skipping summary - user prompt was entirely private",{sessionId:o,promptNumber:l}),r.json({status:"skipped",reason:"private"});return}this.sessionManager.queueSummarize(o,s||"",i),this.ensureGeneratorRunning(o,"summarize"),this.workerService.broadcastProcessingStatus(),r.json({status:"queued"})}catch(t){H.failure("WORKER","Summarize by claudeId failed",{},t),r.status(500).json({error:t.message})}}async handleSessionCompleteByClaudeId(e,r){try{let{claudeSessionId:t}=e.body;if(!t){r.status(400).json({success:!1,error:"Missing claudeSessionId"});return}let i=this.dbManager.getSessionStore().findActiveSDKSession(t);if(!i){r.json({success:!0,message:"No active session found"});return}let n=i.id;await this.sessionManager.deleteSession(n),this.dbManager.markSessionComplete(n),this.workerService.broadcastProcessingStatus(),this.sseBroadcaster.broadcast({type:"session_completed",timestamp:Date.now(),sessionDbId:n}),r.json({success:!0})}catch(t){H.failure("WORKER","Session complete by claudeId failed",{},t),r.status(500).json({success:!1,error:String(t)})}}};var vf=vt(require("path"),1),Un=require("fs"),kw=require("os");Ia();_t();var Tl=class{constructor(e,r,t,s,i,n){this.paginationHelper=e;this.dbManager=r;this.sessionManager=t;this.sseBroadcaster=s;this.workerService=i;this.startTime=n}setupRoutes(e){e.get("/api/observations",this.handleGetObservations.bind(this)),e.get("/api/summaries",this.handleGetSummaries.bind(this)),e.get("/api/prompts",this.handleGetPrompts.bind(this)),e.get("/api/observation/:id",this.handleGetObservationById.bind(this)),e.get("/api/session/:id",this.handleGetSessionById.bind(this)),e.get("/api/prompt/:id",this.handleGetPromptById.bind(this)),e.get("/api/stats",this.handleGetStats.bind(this)),e.get("/api/projects",this.handleGetProjects.bind(this)),e.get("/api/processing-status",this.handleGetProcessingStatus.bind(this)),e.post("/api/processing",this.handleSetProcessing.bind(this))}handleGetObservations(e,r){try{let{offset:t,limit:s,project:i}=this.parsePaginationParams(e),n=this.paginationHelper.getObservations(t,s,i);r.json(n)}catch(t){H.failure("WORKER","Get observations failed",{},t),r.status(500).json({error:t.message})}}handleGetSummaries(e,r){try{let{offset:t,limit:s,project:i}=this.parsePaginationParams(e),n=this.paginationHelper.getSummaries(t,s,i);r.json(n)}catch(t){H.failure("WORKER","Get summaries failed",{},t),r.status(500).json({error:t.message})}}handleGetPrompts(e,r){try{let{offset:t,limit:s,project:i}=this.parsePaginationParams(e),n=this.paginationHelper.getPrompts(t,s,i);r.json(n)}catch(t){H.failure("WORKER","Get prompts failed",{},t),r.status(500).json({error:t.message})}}handleGetObservationById(e,r){try{let t=parseInt(e.params.id,10);if(isNaN(t)){r.status(400).json({error:"Invalid observation ID"});return}let i=this.dbManager.getSessionStore().getObservationById(t);if(!i){r.status(404).json({error:`Observation #${t} not found`});return}r.json(i)}catch(t){H.failure("WORKER","Get observation by ID failed",{},t),r.status(500).json({error:t.message})}}handleGetSessionById(e,r){try{let t=parseInt(e.params.id,10);if(isNaN(t)){r.status(400).json({error:"Invalid session ID"});return}let i=this.dbManager.getSessionStore().getSessionSummariesByIds([t]);if(i.length===0){r.status(404).json({error:`Session #${t} not found`});return}r.json(i[0])}catch(t){H.failure("WORKER","Get session by ID failed",{},t),r.status(500).json({error:t.message})}}handleGetPromptById(e,r){try{let t=parseInt(e.params.id,10);if(isNaN(t)){r.status(400).json({error:"Invalid prompt ID"});return}let i=this.dbManager.getSessionStore().getUserPromptsByIds([t]);if(i.length===0){r.status(404).json({error:`Prompt #${t} not found`});return}r.json(i[0])}catch(t){H.failure("WORKER","Get prompt by ID failed",{},t),r.status(500).json({error:t.message})}}handleGetStats(e,r){try{let t=this.dbManager.getSessionStore().db,s=zr(),i=vf.default.join(s,"package.json"),o=JSON.parse((0,Un.readFileSync)(i,"utf-8")).version,l=t.prepare("SELECT COUNT(*) as count FROM observations").get(),c=t.prepare("SELECT COUNT(*) as count FROM sdk_sessions").get(),u=t.prepare("SELECT COUNT(*) as count FROM session_summaries").get(),p=vf.default.join((0,kw.homedir)(),".claude-mem","claude-mem.db"),f=0;(0,Un.existsSync)(p)&&(f=(0,Un.statSync)(p).size);let d=Math.floor((Date.now()-this.startTime)/1e3),v=this.sessionManager.getActiveSessionCount(),h=this.sseBroadcaster.getClientCount();r.json({worker:{version:o,uptime:d,activeSessions:v,sseClients:h,port:On()},database:{path:p,size:f,observations:l.count,sessions:c.count,summaries:u.count}})}catch(t){H.failure("WORKER","Get stats failed",{},t),r.status(500).json({error:t.message})}}handleGetProjects(e,r){try{let i=this.dbManager.getSessionStore().db.prepare(` +`)}getTypeIcon(e){switch(e){case"bugfix":return"\u{1F534}";case"feature":return"\u{1F7E3}";case"refactor":return"\u{1F504}";case"change":return"\u2705";case"discovery":return"\u{1F535}";case"decision":return"\u{1F9E0}";default:return"\u2022"}}formatDate(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"})}formatTime(e){return new Date(e).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}formatDateTime(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}estimateTokens(e){return e?Math.ceil(e.length/4):0}};var mf=gt(zp(),1),Sw=gt(Ew(),1),ww=gt(require("path"),1);Ia();_t();function Tw(a){let e=[];e.push(mf.default.json({limit:"50mb"})),e.push((0,Sw.default)()),e.push((s,i,n)=>{if(s.path.startsWith("/health")||s.path==="/"||s.path.includes("."))return n();let o=Date.now(),l=`${s.method}-${Date.now()}`,c=a(s.method,s.path,s.body);H.info("HTTP",`\u2192 ${s.method} ${s.path}`,{requestId:l},c);let u=i.send.bind(i);i.send=function(p){let f=Date.now()-o;return H.info("HTTP",`\u2190 ${i.statusCode} ${s.path}`,{requestId:l,duration:`${f}ms`}),u(p)},n()});let r=zr(),t=ww.default.join(r,"plugin","ui");return e.push(mf.default.static(t)),e}function Rw(a,e,r){if(!r||Object.keys(r).length===0||e.includes("/init"))return"";if(e.includes("/observations")){let t=r.tool_name||"?",s=r.tool_input;return`tool=${H.formatTool(t,s)}`}return e.includes("/summarize")?"requesting summary":""}var Pw=gt(require("path"),1),Ow=require("fs");Ia();_t();var Sl=class{constructor(e,r,t){this.sseBroadcaster=e;this.dbManager=r;this.sessionManager=t}setupRoutes(e){e.get("/health",this.handleHealth.bind(this)),e.get("/",this.handleViewerUI.bind(this)),e.get("/stream",this.handleSSEStream.bind(this))}handleHealth(e,r){r.json({status:"ok",timestamp:Date.now()})}handleViewerUI(e,r){try{let t=zr(),s=Pw.default.join(t,"plugin","ui","viewer.html"),i=(0,Ow.readFileSync)(s,"utf-8");r.setHeader("Content-Type","text/html"),r.send(i)}catch(t){H.failure("WORKER","Viewer UI error",{},t),r.status(500).json({error:"Failed to load viewer UI"})}}handleSSEStream(e,r){r.setHeader("Content-Type","text/event-stream"),r.setHeader("Cache-Control","no-cache"),r.setHeader("Connection","keep-alive"),this.sseBroadcaster.addClient(r);let t=this.dbManager.getSessionStore().getAllProjects();this.sseBroadcaster.broadcast({type:"initial_load",projects:t,timestamp:Date.now()});let s=this.sessionManager.isAnySessionProcessing(),i=this.sessionManager.getTotalActiveWork();this.sseBroadcaster.broadcast({type:"processing_status",isProcessing:s,queueDepth:i})}};_t();var Cw=100;function E6(a){let e=(a.match(//g)||[]).length,r=(a.match(//g)||[]).length;return e+r}function hf(a){if(typeof a!="string")return ie("[tag-stripping] received non-string for JSON context:",{type:typeof a}),"{}";let e=E6(a);return e>Cw&&ie("[tag-stripping] tag count exceeds limit, truncating:",{tagCount:e,maxAllowed:Cw,contentLength:a.length}),a.replace(/[\s\S]*?<\/claude-mem-context>/g,"").replace(/[\s\S]*?<\/private>/g,"").trim()}var wl=class{constructor(e,r,t,s,i){this.sessionManager=e;this.dbManager=r;this.sdkAgent=t;this.sseBroadcaster=s;this.workerService=i}ensureGeneratorRunning(e,r){let t=this.sessionManager.getSession(e);t&&!t.generatorPromise&&(H.info("SESSION",`Generator auto-starting (${r})`,{sessionId:e,queueDepth:t.pendingMessages.length}),t.generatorPromise=this.sdkAgent.startSession(t,this.workerService).catch(s=>{H.failure("SDK","SDK agent error",{sessionId:e},s)}).finally(()=>{H.info("SESSION","Generator finished",{sessionId:e}),t.generatorPromise=null,this.workerService.broadcastProcessingStatus()}))}setupRoutes(e){e.post("/sessions/:sessionDbId/init",this.handleSessionInit.bind(this)),e.post("/sessions/:sessionDbId/observations",this.handleObservations.bind(this)),e.post("/sessions/:sessionDbId/summarize",this.handleSummarize.bind(this)),e.get("/sessions/:sessionDbId/status",this.handleSessionStatus.bind(this)),e.delete("/sessions/:sessionDbId",this.handleSessionDelete.bind(this)),e.post("/sessions/:sessionDbId/complete",this.handleSessionComplete.bind(this)),e.post("/api/sessions/observations",this.handleObservationsByClaudeId.bind(this)),e.post("/api/sessions/summarize",this.handleSummarizeByClaudeId.bind(this)),e.post("/api/sessions/complete",this.handleSessionCompleteByClaudeId.bind(this))}handleSessionInit(e,r){try{let t=parseInt(e.params.sessionDbId,10),{userPrompt:s,promptNumber:i}=e.body,n=this.sessionManager.initializeSession(t,s,i),o=this.dbManager.getSessionStore().getLatestUserPrompt(n.claudeSessionId);if(o){this.sseBroadcaster.broadcast({type:"new_prompt",prompt:{id:o.id,claude_session_id:o.claude_session_id,project:o.project,prompt_number:o.prompt_number,prompt_text:o.prompt_text,created_at_epoch:o.created_at_epoch}}),this.sseBroadcaster.broadcast({type:"processing_status",isProcessing:!0});let l=Date.now(),c=o.prompt_text;this.dbManager.getChromaSync().syncUserPrompt(o.id,o.sdk_session_id,o.project,c,o.prompt_number,o.created_at_epoch).then(()=>{let u=Date.now()-l,p=c.length>60?c.substring(0,60)+"...":c;H.debug("CHROMA","User prompt synced",{promptId:o.id,duration:`${u}ms`,prompt:p})}).catch(u=>{H.error("CHROMA","Failed to sync user_prompt",{promptId:o.id,sessionId:t},u)})}this.workerService.broadcastProcessingStatus(),H.info("SESSION","Generator starting",{sessionId:t,project:n.project,promptNum:n.lastPromptNumber}),n.generatorPromise=this.sdkAgent.startSession(n,this.workerService).catch(l=>{H.failure("SDK","SDK agent error",{sessionId:t},l)}).finally(()=>{H.info("SESSION","Generator finished",{sessionId:t}),n.generatorPromise=null,this.workerService.broadcastProcessingStatus()}),this.sseBroadcaster.broadcast({type:"session_started",sessionDbId:t,project:n.project}),r.json({status:"initialized",sessionDbId:t,port:On()})}catch(t){H.failure("WORKER","Session init failed",{},t),r.status(500).json({error:t.message})}}handleObservations(e,r){try{let t=parseInt(e.params.sessionDbId,10),{tool_name:s,tool_input:i,tool_response:n,prompt_number:o,cwd:l}=e.body;this.sessionManager.queueObservation(t,{tool_name:s,tool_input:i,tool_response:n,prompt_number:o,cwd:l}),this.ensureGeneratorRunning(t,"observation"),this.workerService.broadcastProcessingStatus(),this.sseBroadcaster.broadcast({type:"observation_queued",sessionDbId:t}),r.json({status:"queued"})}catch(t){H.failure("WORKER","Observation queuing failed",{},t),r.status(500).json({error:t.message})}}handleSummarize(e,r){try{let t=parseInt(e.params.sessionDbId,10),{last_user_message:s,last_assistant_message:i}=e.body;this.sessionManager.queueSummarize(t,s,i),this.ensureGeneratorRunning(t,"summarize"),this.workerService.broadcastProcessingStatus(),r.json({status:"queued"})}catch(t){H.failure("WORKER","Summarize queuing failed",{},t),r.status(500).json({error:t.message})}}handleSessionStatus(e,r){try{let t=parseInt(e.params.sessionDbId,10),s=this.sessionManager.getSession(t);if(!s){r.json({status:"not_found"});return}r.json({status:"active",sessionDbId:t,project:s.project,queueLength:s.pendingMessages.length,uptime:Date.now()-s.startTime})}catch(t){H.failure("WORKER","Session status failed",{},t),r.status(500).json({error:t.message})}}async handleSessionDelete(e,r){try{let t=parseInt(e.params.sessionDbId,10);await this.sessionManager.deleteSession(t),this.dbManager.markSessionComplete(t),this.sseBroadcaster.broadcast({type:"session_completed",sessionDbId:t}),r.json({status:"deleted"})}catch(t){H.failure("WORKER","Session delete failed",{},t),r.status(500).json({error:t.message})}}async handleSessionComplete(e,r){try{let t=parseInt(e.params.sessionDbId,10);if(isNaN(t)){r.status(400).json({success:!1,error:"Invalid session ID"});return}await this.sessionManager.deleteSession(t),this.dbManager.markSessionComplete(t),this.workerService.broadcastProcessingStatus(),this.sseBroadcaster.broadcast({type:"session_completed",timestamp:Date.now(),sessionDbId:t}),r.json({success:!0})}catch(t){H.failure("WORKER","Session complete failed",{},t),r.status(500).json({success:!1,error:String(t)})}}handleObservationsByClaudeId(e,r){try{let{claudeSessionId:t,tool_name:s,tool_input:i,tool_response:n,cwd:o}=e.body;if(!t){r.status(400).json({error:"Missing claudeSessionId"});return}let l=this.dbManager.getSessionStore(),c=l.createSDKSession(t,"",""),u=l.getPromptCounter(c),p=l.getUserPrompt(t,u);if(!p||p.trim()===""){H.debug("HOOK","Skipping observation - user prompt was entirely private",{sessionId:c,promptNumber:u,tool_name:s}),r.json({status:"skipped",reason:"private"});return}let f="{}",d="{}";try{f=i!==void 0?hf(JSON.stringify(i)):"{}"}catch{f='{"error": "Failed to serialize tool_input"}'}try{d=n!==void 0?hf(JSON.stringify(n)):"{}"}catch{d='{"error": "Failed to serialize tool_response"}'}this.sessionManager.queueObservation(c,{tool_name:s,tool_input:f,tool_response:d,prompt_number:u,cwd:o||""}),this.ensureGeneratorRunning(c,"observation"),this.workerService.broadcastProcessingStatus(),this.sseBroadcaster.broadcast({type:"observation_queued",sessionDbId:c}),r.json({status:"queued"})}catch(t){H.failure("WORKER","Observation by claudeId failed",{},t),r.status(500).json({error:t.message})}}handleSummarizeByClaudeId(e,r){try{let{claudeSessionId:t,last_user_message:s,last_assistant_message:i}=e.body;if(!t){r.status(400).json({error:"Missing claudeSessionId"});return}let n=this.dbManager.getSessionStore(),o=n.createSDKSession(t,"",""),l=n.getPromptCounter(o),c=n.getUserPrompt(t,l);if(!c||c.trim()===""){H.debug("HOOK","Skipping summary - user prompt was entirely private",{sessionId:o,promptNumber:l}),r.json({status:"skipped",reason:"private"});return}this.sessionManager.queueSummarize(o,s||"",i),this.ensureGeneratorRunning(o,"summarize"),this.workerService.broadcastProcessingStatus(),r.json({status:"queued"})}catch(t){H.failure("WORKER","Summarize by claudeId failed",{},t),r.status(500).json({error:t.message})}}async handleSessionCompleteByClaudeId(e,r){try{let{claudeSessionId:t}=e.body;if(!t){r.status(400).json({success:!1,error:"Missing claudeSessionId"});return}let i=this.dbManager.getSessionStore().findActiveSDKSession(t);if(!i){r.json({success:!0,message:"No active session found"});return}let n=i.id;await this.sessionManager.deleteSession(n),this.dbManager.markSessionComplete(n),this.workerService.broadcastProcessingStatus(),this.sseBroadcaster.broadcast({type:"session_completed",timestamp:Date.now(),sessionDbId:n}),r.json({success:!0})}catch(t){H.failure("WORKER","Session complete by claudeId failed",{},t),r.status(500).json({success:!1,error:String(t)})}}};var vf=gt(require("path"),1),Un=require("fs"),kw=require("os");Ia();_t();var Tl=class{constructor(e,r,t,s,i,n){this.paginationHelper=e;this.dbManager=r;this.sessionManager=t;this.sseBroadcaster=s;this.workerService=i;this.startTime=n}setupRoutes(e){e.get("/api/observations",this.handleGetObservations.bind(this)),e.get("/api/summaries",this.handleGetSummaries.bind(this)),e.get("/api/prompts",this.handleGetPrompts.bind(this)),e.get("/api/observation/:id",this.handleGetObservationById.bind(this)),e.get("/api/session/:id",this.handleGetSessionById.bind(this)),e.get("/api/prompt/:id",this.handleGetPromptById.bind(this)),e.get("/api/stats",this.handleGetStats.bind(this)),e.get("/api/projects",this.handleGetProjects.bind(this)),e.get("/api/processing-status",this.handleGetProcessingStatus.bind(this)),e.post("/api/processing",this.handleSetProcessing.bind(this))}handleGetObservations(e,r){try{let{offset:t,limit:s,project:i}=this.parsePaginationParams(e),n=this.paginationHelper.getObservations(t,s,i);r.json(n)}catch(t){H.failure("WORKER","Get observations failed",{},t),r.status(500).json({error:t.message})}}handleGetSummaries(e,r){try{let{offset:t,limit:s,project:i}=this.parsePaginationParams(e),n=this.paginationHelper.getSummaries(t,s,i);r.json(n)}catch(t){H.failure("WORKER","Get summaries failed",{},t),r.status(500).json({error:t.message})}}handleGetPrompts(e,r){try{let{offset:t,limit:s,project:i}=this.parsePaginationParams(e),n=this.paginationHelper.getPrompts(t,s,i);r.json(n)}catch(t){H.failure("WORKER","Get prompts failed",{},t),r.status(500).json({error:t.message})}}handleGetObservationById(e,r){try{let t=parseInt(e.params.id,10);if(isNaN(t)){r.status(400).json({error:"Invalid observation ID"});return}let i=this.dbManager.getSessionStore().getObservationById(t);if(!i){r.status(404).json({error:`Observation #${t} not found`});return}r.json(i)}catch(t){H.failure("WORKER","Get observation by ID failed",{},t),r.status(500).json({error:t.message})}}handleGetSessionById(e,r){try{let t=parseInt(e.params.id,10);if(isNaN(t)){r.status(400).json({error:"Invalid session ID"});return}let i=this.dbManager.getSessionStore().getSessionSummariesByIds([t]);if(i.length===0){r.status(404).json({error:`Session #${t} not found`});return}r.json(i[0])}catch(t){H.failure("WORKER","Get session by ID failed",{},t),r.status(500).json({error:t.message})}}handleGetPromptById(e,r){try{let t=parseInt(e.params.id,10);if(isNaN(t)){r.status(400).json({error:"Invalid prompt ID"});return}let i=this.dbManager.getSessionStore().getUserPromptsByIds([t]);if(i.length===0){r.status(404).json({error:`Prompt #${t} not found`});return}r.json(i[0])}catch(t){H.failure("WORKER","Get prompt by ID failed",{},t),r.status(500).json({error:t.message})}}handleGetStats(e,r){try{let t=this.dbManager.getSessionStore().db,s=zr(),i=vf.default.join(s,"package.json"),o=JSON.parse((0,Un.readFileSync)(i,"utf-8")).version,l=t.prepare("SELECT COUNT(*) as count FROM observations").get(),c=t.prepare("SELECT COUNT(*) as count FROM sdk_sessions").get(),u=t.prepare("SELECT COUNT(*) as count FROM session_summaries").get(),p=vf.default.join((0,kw.homedir)(),".claude-mem","claude-mem.db"),f=0;(0,Un.existsSync)(p)&&(f=(0,Un.statSync)(p).size);let d=Math.floor((Date.now()-this.startTime)/1e3),v=this.sessionManager.getActiveSessionCount(),h=this.sseBroadcaster.getClientCount();r.json({worker:{version:o,uptime:d,activeSessions:v,sseClients:h,port:On()},database:{path:p,size:f,observations:l.count,sessions:c.count,summaries:u.count}})}catch(t){H.failure("WORKER","Get stats failed",{},t),r.status(500).json({error:t.message})}}handleGetProjects(e,r){try{let i=this.dbManager.getSessionStore().db.prepare(` SELECT DISTINCT project FROM observations WHERE project IS NOT NULL GROUP BY project ORDER BY MAX(created_at_epoch) DESC - `).all().map(n=>n.project);r.json({projects:i})}catch(t){H.failure("WORKER","Get projects failed",{},t),r.status(500).json({error:t.message})}}handleGetProcessingStatus(e,r){let t=this.sessionManager.isAnySessionProcessing(),s=this.sessionManager.getTotalActiveWork();r.json({isProcessing:t,queueDepth:s})}handleSetProcessing(e,r){try{this.workerService.broadcastProcessingStatus();let t=this.sessionManager.isAnySessionProcessing(),s=this.sessionManager.getTotalQueueDepth(),i=this.sessionManager.getActiveSessionCount();H.debug("WORKER","Processing status broadcast",{isProcessing:t,queueDepth:s,activeSessions:i}),r.json({status:"ok",isProcessing:t})}catch(t){H.failure("WORKER","Failed to broadcast processing status",{},t),r.status(500).json({error:t.message})}}parsePaginationParams(e){let r=parseInt(e.query.offset,10)||0,t=Math.min(parseInt(e.query.limit,10)||20,100),s=e.query.project;return{offset:r,limit:t,project:s}}};_t();var Ol=class{constructor(e){this.searchManager=e}setupRoutes(e){e.get("/api/search",this.handleUnifiedSearch.bind(this)),e.get("/api/timeline",this.handleUnifiedTimeline.bind(this)),e.get("/api/decisions",this.handleDecisions.bind(this)),e.get("/api/changes",this.handleChanges.bind(this)),e.get("/api/how-it-works",this.handleHowItWorks.bind(this)),e.get("/api/search/observations",this.handleSearchObservations.bind(this)),e.get("/api/search/sessions",this.handleSearchSessions.bind(this)),e.get("/api/search/prompts",this.handleSearchPrompts.bind(this)),e.get("/api/search/by-concept",this.handleSearchByConcept.bind(this)),e.get("/api/search/by-file",this.handleSearchByFile.bind(this)),e.get("/api/search/by-type",this.handleSearchByType.bind(this)),e.get("/api/context/recent",this.handleGetRecentContext.bind(this)),e.get("/api/context/timeline",this.handleGetContextTimeline.bind(this)),e.get("/api/context/preview",this.handleContextPreview.bind(this)),e.get("/api/context/inject",this.handleContextInject.bind(this)),e.get("/api/timeline/by-query",this.handleGetTimelineByQuery.bind(this)),e.get("/api/search/help",this.handleSearchHelp.bind(this))}async handleUnifiedSearch(e,r){try{let t=await this.searchManager.search(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Unified search failed",{},t),r.status(500).json({error:t.message})}}async handleUnifiedTimeline(e,r){try{let t=await this.searchManager.timeline(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Unified timeline failed",{},t),r.status(500).json({error:t.message})}}async handleDecisions(e,r){try{let t=await this.searchManager.decisions(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Decisions search failed",{},t),r.status(500).json({error:t.message})}}async handleChanges(e,r){try{let t=await this.searchManager.changes(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Changes search failed",{},t),r.status(500).json({error:t.message})}}async handleHowItWorks(e,r){try{let t=await this.searchManager.howItWorks(e.query);r.json(t.content)}catch(t){H.failure("WORKER","How it works search failed",{},t),r.status(500).json({error:t.message})}}async handleSearchObservations(e,r){try{let t=await this.searchManager.searchObservations(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleSearchSessions(e,r){try{let t=await this.searchManager.searchSessions(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleSearchPrompts(e,r){try{let t=await this.searchManager.searchUserPrompts(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleSearchByConcept(e,r){try{let t=await this.searchManager.findByConcept(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleSearchByFile(e,r){try{let t=await this.searchManager.findByFile(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleSearchByType(e,r){try{let t=await this.searchManager.findByType(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleGetRecentContext(e,r){try{let t=await this.searchManager.getRecentContext(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleGetContextTimeline(e,r){try{let t=await this.searchManager.getContextTimeline(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleContextPreview(e,r){try{let t=e.query.project;if(!t){r.status(400).json({error:"Project parameter is required"});return}let{generateContext:s}=await Promise.resolve().then(()=>(bf(),yf)),i=`/preview/${t}`,n=await s({session_id:"preview-"+Date.now(),cwd:i},!0);r.setHeader("Content-Type","text/plain; charset=utf-8"),r.send(n)}catch(t){H.failure("WORKER","Context preview generation failed",{},t),r.status(500).json({error:"Failed to generate context preview",message:t.message})}}async handleContextInject(e,r){try{let t=e.query.project,s=e.query.colors==="true";if(!t){r.status(400).json({error:"Project parameter is required"});return}let{generateContext:i}=await Promise.resolve().then(()=>(bf(),yf)),n=`/context/${t}`,o=await i({session_id:"context-inject-"+Date.now(),cwd:n},s);r.setHeader("Content-Type","text/plain; charset=utf-8"),r.send(o)}catch(t){H.failure("WORKER","Context injection failed",{},t),r.status(500).json({error:"Failed to generate context",message:t.message})}}async handleGetTimelineByQuery(e,r){try{let t=await this.searchManager.getTimelineByQuery(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}handleSearchHelp(e,r){r.json({title:"Claude-Mem Search API",description:"HTTP API for searching persistent memory",endpoints:[{path:"/api/search/observations",method:"GET",description:"Search observations using full-text search",parameters:{query:"Search query (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 20)",project:"Filter by project name (optional)"}},{path:"/api/search/sessions",method:"GET",description:"Search session summaries using full-text search",parameters:{query:"Search query (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 20)"}},{path:"/api/search/prompts",method:"GET",description:"Search user prompts using full-text search",parameters:{query:"Search query (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 20)",project:"Filter by project name (optional)"}},{path:"/api/search/by-concept",method:"GET",description:"Find observations by concept tag",parameters:{concept:"Concept tag (required): discovery, decision, bugfix, feature, refactor",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/search/by-file",method:"GET",description:"Find observations and sessions by file path",parameters:{filePath:"File path or partial path (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results per type (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/search/by-type",method:"GET",description:"Find observations by type",parameters:{type:"Observation type (required): discovery, decision, bugfix, feature, refactor",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/context/recent",method:"GET",description:"Get recent session context including summaries and observations",parameters:{project:"Project name (default: current directory)",limit:"Number of recent sessions (default: 3)"}},{path:"/api/context/timeline",method:"GET",description:"Get unified timeline around a specific point in time",parameters:{anchor:'Anchor point: observation ID, session ID (e.g., "S123"), or ISO timestamp (required)',depth_before:"Number of records before anchor (default: 10)",depth_after:"Number of records after anchor (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/timeline/by-query",method:"GET",description:"Search for best match, then get timeline around it",parameters:{query:"Search query (required)",mode:'Search mode: "auto", "observations", or "sessions" (default: "auto")',depth_before:"Number of records before match (default: 10)",depth_after:"Number of records after match (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/search/help",method:"GET",description:"Get this help documentation"}],examples:['curl "http://localhost:37777/api/search/observations?query=authentication&format=index&limit=5"','curl "http://localhost:37777/api/search/by-type?type=bugfix&limit=10"','curl "http://localhost:37777/api/context/recent?project=claude-mem&limit=3"','curl "http://localhost:37777/api/context/timeline?anchor=123&depth_before=5&depth_after=5"']})}};var Hn=vt(require("path"),1),Vt=require("fs"),_f=require("os");Ia();_t();var xf=require("child_process"),qs=require("fs"),jw=require("os"),Xi=require("path");_t();var Qi=(0,Xi.join)((0,jw.homedir)(),".claude","plugins","marketplaces","thedotmack");function yr(a){return(0,xf.execSync)(`git ${a}`,{cwd:Qi,encoding:"utf-8",timeout:3e4}).trim()}function $w(a,e=6e4){return(0,xf.execSync)(a,{cwd:Qi,encoding:"utf-8",timeout:e}).trim()}function Cl(){let a=(0,Xi.join)(Qi,".git");if(!(0,qs.existsSync)(a))return{branch:null,isBeta:!1,isGitRepo:!1,isDirty:!1,canSwitch:!1,error:"Installed plugin is not a git repository"};try{let e=yr("rev-parse --abbrev-ref HEAD"),t=yr("status --porcelain").length>0,s=e.startsWith("beta");return{branch:e,isBeta:s,isGitRepo:!0,isDirty:t,canSwitch:!0}}catch(e){return H.error("BRANCH","Failed to get branch info",{},e),{branch:null,isBeta:!1,isGitRepo:!0,isDirty:!1,canSwitch:!1,error:e.message}}}async function Mw(a){let e=Cl();if(!e.isGitRepo)return{success:!1,error:"Installed plugin is not a git repository. Please reinstall."};if(e.branch===a)return{success:!0,branch:a,message:`Already on branch ${a}`};try{H.info("BRANCH","Starting branch switch",{from:e.branch,to:a}),H.debug("BRANCH","Discarding local changes"),yr("checkout -- ."),yr("clean -fd"),H.debug("BRANCH","Fetching from origin"),yr("fetch origin"),H.debug("BRANCH","Checking out branch",{branch:a});try{yr(`checkout ${a}`)}catch{yr(`checkout -b ${a} origin/${a}`)}H.debug("BRANCH","Pulling latest"),yr(`pull origin ${a}`);let r=(0,Xi.join)(Qi,".install-version");return(0,qs.existsSync)(r)&&(0,qs.unlinkSync)(r),H.debug("BRANCH","Running npm install"),$w("npm install",12e4),H.success("BRANCH","Branch switch complete",{branch:a}),{success:!0,branch:a,message:`Switched to ${a}. Worker will restart automatically.`}}catch(r){H.error("BRANCH","Branch switch failed",{targetBranch:a},r);try{e.branch&&yr(`checkout ${e.branch}`)}catch{}return{success:!1,error:`Branch switch failed: ${r.message}`}}}async function Lw(){let a=Cl();if(!a.isGitRepo||!a.branch)return{success:!1,error:"Cannot pull updates: not a git repository"};try{H.info("BRANCH","Pulling updates",{branch:a.branch}),yr("checkout -- ."),yr("fetch origin"),yr(`pull origin ${a.branch}`);let e=(0,Xi.join)(Qi,".install-version");return(0,qs.existsSync)(e)&&(0,qs.unlinkSync)(e),$w("npm install",12e4),H.success("BRANCH","Updates pulled",{branch:a.branch}),{success:!0,branch:a.branch,message:`Updated ${a.branch}. Worker will restart automatically.`}}catch(e){return H.error("BRANCH","Pull failed",{},e),{success:!1,error:`Pull failed: ${e.message}`}}}gf();var kl=class{constructor(e){this.settingsManager=e}setupRoutes(e){e.get("/api/settings",this.handleGetSettings.bind(this)),e.post("/api/settings",this.handleUpdateSettings.bind(this)),e.get("/api/mcp/status",this.handleGetMcpStatus.bind(this)),e.post("/api/mcp/toggle",this.handleToggleMcp.bind(this)),e.get("/api/branch/status",this.handleGetBranchStatus.bind(this)),e.post("/api/branch/switch",this.handleSwitchBranch.bind(this)),e.post("/api/branch/update",this.handleUpdateBranch.bind(this))}handleGetSettings(e,r){try{let t=Hn.default.join((0,_f.homedir)(),".claude-mem","settings.json");if(!(0,Vt.existsSync)(t)){r.json({CLAUDE_MEM_MODEL:"claude-haiku-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",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:Zi,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:Ki,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"});return}let s=(0,Vt.readFileSync)(t,"utf-8"),n=JSON.parse(s).env||{};r.json({CLAUDE_MEM_MODEL:n.CLAUDE_MEM_MODEL||"claude-haiku-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:n.CLAUDE_MEM_CONTEXT_OBSERVATIONS||"50",CLAUDE_MEM_WORKER_PORT:n.CLAUDE_MEM_WORKER_PORT||"37777",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:n.CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS||"true",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:n.CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS||"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:n.CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT||"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:n.CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT||"true",CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES:n.CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES||Zi,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:n.CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS||Ki,CLAUDE_MEM_CONTEXT_FULL_COUNT:n.CLAUDE_MEM_CONTEXT_FULL_COUNT||"5",CLAUDE_MEM_CONTEXT_FULL_FIELD:n.CLAUDE_MEM_CONTEXT_FULL_FIELD||"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:n.CLAUDE_MEM_CONTEXT_SESSION_COUNT||"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:n.CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY||"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:n.CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE||"false"})}catch(t){H.failure("WORKER","Get settings failed",{},t),r.status(500).json({error:t.message})}}handleUpdateSettings(e,r){try{if(e.body.CLAUDE_MEM_CONTEXT_OBSERVATIONS){let o=parseInt(e.body.CLAUDE_MEM_CONTEXT_OBSERVATIONS,10);if(isNaN(o)||o<1||o>200){r.status(400).json({success:!1,error:"CLAUDE_MEM_CONTEXT_OBSERVATIONS must be between 1 and 200"});return}}if(e.body.CLAUDE_MEM_WORKER_PORT){let o=parseInt(e.body.CLAUDE_MEM_WORKER_PORT,10);if(isNaN(o)||o<1024||o>65535){r.status(400).json({success:!1,error:"CLAUDE_MEM_WORKER_PORT must be between 1024 and 65535"});return}}let t=this.validateContextSettings(e.body);if(!t.valid){r.status(400).json({success:!1,error:t.error});return}let s=Hn.default.join((0,_f.homedir)(),".claude-mem","settings.json"),i={env:{}};if((0,Vt.existsSync)(s)){let o=(0,Vt.readFileSync)(s,"utf-8");i=JSON.parse(o),i.env||(i.env={})}let n=["CLAUDE_MEM_MODEL","CLAUDE_MEM_CONTEXT_OBSERVATIONS","CLAUDE_MEM_WORKER_PORT","CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT","CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES","CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS","CLAUDE_MEM_CONTEXT_FULL_COUNT","CLAUDE_MEM_CONTEXT_FULL_FIELD","CLAUDE_MEM_CONTEXT_SESSION_COUNT","CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY","CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE"];for(let o of n)e.body[o]!==void 0&&(i.env[o]=e.body[o]);(0,Vt.writeFileSync)(s,JSON.stringify(i,null,2),"utf-8"),H.info("WORKER","Settings updated"),r.json({success:!0,message:"Settings updated successfully"})}catch(t){H.failure("WORKER","Update settings failed",{},t),r.status(500).json({success:!1,error:String(t)})}}handleGetMcpStatus(e,r){try{let t=this.isMcpEnabled();r.json({enabled:t})}catch(t){H.failure("WORKER","Get MCP status failed",{},t),r.status(500).json({error:t.message})}}handleToggleMcp(e,r){try{let{enabled:t}=e.body;if(typeof t!="boolean"){r.status(400).json({error:"enabled must be a boolean"});return}this.toggleMcp(t),r.json({success:!0,enabled:this.isMcpEnabled()})}catch(t){H.failure("WORKER","Toggle MCP failed",{},t),r.status(500).json({success:!1,error:t.message})}}handleGetBranchStatus(e,r){try{let t=Cl();r.json(t)}catch(t){H.failure("WORKER","Failed to get branch status",{},t),r.status(500).json({error:t.message})}}async handleSwitchBranch(e,r){try{let{branch:t}=e.body;if(!t){r.status(400).json({success:!1,error:"Missing branch parameter"});return}let s=["main","beta/7.0"];if(!s.includes(t)){r.status(400).json({success:!1,error:`Invalid branch. Allowed: ${s.join(", ")}`});return}H.info("WORKER","Branch switch requested",{branch:t});let i=await Mw(t);i.success&&setTimeout(()=>{H.info("WORKER","Restarting worker after branch switch"),process.exit(0)},1e3),r.json(i)}catch(t){H.failure("WORKER","Branch switch failed",{},t),r.status(500).json({success:!1,error:t.message})}}async handleUpdateBranch(e,r){try{H.info("WORKER","Branch update requested");let t=await Lw();t.success&&setTimeout(()=>{H.info("WORKER","Restarting worker after branch update"),process.exit(0)},1e3),r.json(t)}catch(t){H.failure("WORKER","Branch update failed",{},t),r.status(500).json({success:!1,error:t.message})}}validateContextSettings(e){let r=["CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT","CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY","CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE"];for(let t of r)if(e[t]&&!["true","false"].includes(e[t]))return{valid:!1,error:`${t} must be "true" or "false"`};if(e.CLAUDE_MEM_CONTEXT_FULL_COUNT){let t=parseInt(e.CLAUDE_MEM_CONTEXT_FULL_COUNT,10);if(isNaN(t)||t<0||t>20)return{valid:!1,error:"CLAUDE_MEM_CONTEXT_FULL_COUNT must be between 0 and 20"}}if(e.CLAUDE_MEM_CONTEXT_SESSION_COUNT){let t=parseInt(e.CLAUDE_MEM_CONTEXT_SESSION_COUNT,10);if(isNaN(t)||t<1||t>50)return{valid:!1,error:"CLAUDE_MEM_CONTEXT_SESSION_COUNT must be between 1 and 50"}}if(e.CLAUDE_MEM_CONTEXT_FULL_FIELD&&!["narrative","facts"].includes(e.CLAUDE_MEM_CONTEXT_FULL_FIELD))return{valid:!1,error:'CLAUDE_MEM_CONTEXT_FULL_FIELD must be "narrative" or "facts"'};if(e.CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES){let t=e.CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES.split(",").map(s=>s.trim());for(let s of t)if(s&&!zn.includes(s))return{valid:!1,error:`Invalid observation type: ${s}. Valid types: ${zn.join(", ")}`}}if(e.CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS){let t=e.CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS.split(",").map(s=>s.trim());for(let s of t)if(s&&!Bn.includes(s))return{valid:!1,error:`Invalid observation concept: ${s}. Valid concepts: ${Bn.join(", ")}`}}return{valid:!0}}isMcpEnabled(){let e=zr(),r=Hn.default.join(e,"plugin",".mcp.json");return(0,Vt.existsSync)(r)}toggleMcp(e){try{let r=zr(),t=Hn.default.join(r,"plugin",".mcp.json"),s=Hn.default.join(r,"plugin",".mcp.json.disabled");e&&(0,Vt.existsSync)(s)?((0,Vt.renameSync)(s,t),H.info("WORKER","MCP search server enabled")):!e&&(0,Vt.existsSync)(t)?((0,Vt.renameSync)(t,s),H.info("WORKER","MCP search server disabled")):H.debug("WORKER","MCP toggle no-op (already in desired state)",{enabled:e})}catch(r){throw H.failure("WORKER","Failed to toggle MCP",{enabled:e},r),r}}};var Il=class{app;server=null;startTime=Date.now();mcpClient;dbManager;sessionManager;sseBroadcaster;sdkAgent;paginationHelper;settingsManager;viewerRoutes;sessionRoutes;dataRoutes;searchRoutes;settingsRoutes;constructor(){this.app=(0,qw.default)(),this.dbManager=new Jc,this.sessionManager=new Yc(this.dbManager),this.sseBroadcaster=new el,this.sdkAgent=new vl(this.dbManager,this.sessionManager),this.paginationHelper=new yl(this.dbManager),this.settingsManager=new bl(this.dbManager),this.sessionManager.setOnSessionDeleted(()=>{this.broadcastProcessingStatus()}),this.mcpClient=new wn({name:"worker-search-proxy",version:"1.0.0"},{capabilities:{}}),this.viewerRoutes=new Sl(this.sseBroadcaster,this.dbManager,this.sessionManager),this.sessionRoutes=new wl(this.sessionManager,this.dbManager,this.sdkAgent,this.sseBroadcaster,this),this.dataRoutes=new Tl(this.paginationHelper,this.dbManager,this.sessionManager,this.sseBroadcaster,this,this.startTime),this.searchRoutes=null,this.settingsRoutes=new kl(this.settingsManager),this.setupMiddleware(),this.setupRoutes()}setupMiddleware(){Tw(this.summarizeRequestBody.bind(this)).forEach(r=>this.app.use(r))}setupRoutes(){this.app.get("/api/health",(e,r)=>{r.status(200).json({status:"ok"})}),this.viewerRoutes.setupRoutes(this.app),this.sessionRoutes.setupRoutes(this.app),this.dataRoutes.setupRoutes(this.app),this.settingsRoutes.setupRoutes(this.app)}async cleanupOrphanedProcesses(){try{let{execSync:e}=await import("child_process");try{let r=e("pgrep -fl uvx",{encoding:"utf-8",stdio:"pipe",windowsHide:!0}).trim();if(r){let t=r.split(` -`).length;H.info("WORKER","Cleaning up orphaned MCP processes",{count:t}),e("pkill -f uvx",{stdio:"pipe",windowsHide:!0}),H.success("WORKER",`Cleaned up ${t} orphaned MCP server processes`)}}catch(r){if(r.status===1)H.debug("WORKER","No orphaned MCP processes to clean up");else throw r}}catch(e){H.warn("WORKER","Failed to cleanup orphaned processes (non-fatal)",{},e)}}async start(){let e=On();this.server=await new Promise((r,t)=>{let s=this.app.listen(e,()=>r(s));s.on("error",t)}),H.info("SYSTEM","Worker started",{port:e,pid:process.pid}),this.initializeBackground().catch(r=>{H.error("SYSTEM","Background initialization failed",{},r)})}async initializeBackground(){await this.cleanupOrphanedProcesses(),await this.dbManager.initialize();let e=new _l,r=new El,t=new xl(this.dbManager.getSessionSearch(),this.dbManager.getSessionStore(),this.dbManager.getChromaSync(),e,r);this.searchRoutes=new Ol(t),this.searchRoutes.setupRoutes(this.app),H.info("WORKER","SearchManager initialized and search routes registered");let s=Fw.default.join(__dirname,"..","..","plugin","scripts","mcp-server.cjs"),i=new Pn({command:"node",args:[s],env:process.env});await this.mcpClient.connect(i),H.success("WORKER","Connected to MCP server")}async shutdown(){if(await this.sessionManager.shutdownAll(),this.mcpClient)try{await this.mcpClient.close(),H.info("SYSTEM","MCP client closed")}catch(e){H.error("SYSTEM","Failed to close MCP client",{},e)}this.server&&await new Promise((e,r)=>{this.server.close(t=>t?r(t):e())}),await this.dbManager.close(),H.info("SYSTEM","Worker shutdown complete")}summarizeRequestBody(e,r,t){return Rw(e,r,t)}broadcastProcessingStatus(){let e=this.sessionManager.isAnySessionProcessing(),r=this.sessionManager.getTotalActiveWork(),t=this.sessionManager.getActiveSessionCount();H.info("WORKER","Broadcasting processing status",{isProcessing:e,queueDepth:r,activeSessions:t}),this.sseBroadcaster.broadcast({type:"processing_status",isProcessing:e,queueDepth:r})}};if(require.main===module||!module.parent){let a=new Il;process.on("SIGTERM",async()=>{H.info("SYSTEM","Received SIGTERM, shutting down gracefully"),await a.shutdown(),process.exit(0)}),process.on("SIGINT",async()=>{H.info("SYSTEM","Received SIGINT, shutting down gracefully"),await a.shutdown(),process.exit(0)}),a.start().catch(e=>{H.failure("SYSTEM","Worker failed to start",{},e),process.exit(1)})}0&&(module.exports={WorkerService}); + `).all().map(n=>n.project);r.json({projects:i})}catch(t){H.failure("WORKER","Get projects failed",{},t),r.status(500).json({error:t.message})}}handleGetProcessingStatus(e,r){let t=this.sessionManager.isAnySessionProcessing(),s=this.sessionManager.getTotalActiveWork();r.json({isProcessing:t,queueDepth:s})}handleSetProcessing(e,r){try{this.workerService.broadcastProcessingStatus();let t=this.sessionManager.isAnySessionProcessing(),s=this.sessionManager.getTotalQueueDepth(),i=this.sessionManager.getActiveSessionCount();H.debug("WORKER","Processing status broadcast",{isProcessing:t,queueDepth:s,activeSessions:i}),r.json({status:"ok",isProcessing:t})}catch(t){H.failure("WORKER","Failed to broadcast processing status",{},t),r.status(500).json({error:t.message})}}parsePaginationParams(e){let r=parseInt(e.query.offset,10)||0,t=Math.min(parseInt(e.query.limit,10)||20,100),s=e.query.project;return{offset:r,limit:t,project:s}}};_t();var Ol=class{constructor(e){this.searchManager=e}setupRoutes(e){e.get("/api/search",this.handleUnifiedSearch.bind(this)),e.get("/api/timeline",this.handleUnifiedTimeline.bind(this)),e.get("/api/decisions",this.handleDecisions.bind(this)),e.get("/api/changes",this.handleChanges.bind(this)),e.get("/api/how-it-works",this.handleHowItWorks.bind(this)),e.get("/api/search/observations",this.handleSearchObservations.bind(this)),e.get("/api/search/sessions",this.handleSearchSessions.bind(this)),e.get("/api/search/prompts",this.handleSearchPrompts.bind(this)),e.get("/api/search/by-concept",this.handleSearchByConcept.bind(this)),e.get("/api/search/by-file",this.handleSearchByFile.bind(this)),e.get("/api/search/by-type",this.handleSearchByType.bind(this)),e.get("/api/context/recent",this.handleGetRecentContext.bind(this)),e.get("/api/context/timeline",this.handleGetContextTimeline.bind(this)),e.get("/api/context/preview",this.handleContextPreview.bind(this)),e.get("/api/context/inject",this.handleContextInject.bind(this)),e.get("/api/timeline/by-query",this.handleGetTimelineByQuery.bind(this)),e.get("/api/search/help",this.handleSearchHelp.bind(this))}async handleUnifiedSearch(e,r){try{let t=await this.searchManager.search(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Unified search failed",{},t),r.status(500).json({error:t.message})}}async handleUnifiedTimeline(e,r){try{let t=await this.searchManager.timeline(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Unified timeline failed",{},t),r.status(500).json({error:t.message})}}async handleDecisions(e,r){try{let t=await this.searchManager.decisions(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Decisions search failed",{},t),r.status(500).json({error:t.message})}}async handleChanges(e,r){try{let t=await this.searchManager.changes(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Changes search failed",{},t),r.status(500).json({error:t.message})}}async handleHowItWorks(e,r){try{let t=await this.searchManager.howItWorks(e.query);r.json(t.content)}catch(t){H.failure("WORKER","How it works search failed",{},t),r.status(500).json({error:t.message})}}async handleSearchObservations(e,r){try{let t=await this.searchManager.searchObservations(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleSearchSessions(e,r){try{let t=await this.searchManager.searchSessions(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleSearchPrompts(e,r){try{let t=await this.searchManager.searchUserPrompts(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleSearchByConcept(e,r){try{let t=await this.searchManager.findByConcept(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleSearchByFile(e,r){try{let t=await this.searchManager.findByFile(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleSearchByType(e,r){try{let t=await this.searchManager.findByType(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleGetRecentContext(e,r){try{let t=await this.searchManager.getRecentContext(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleGetContextTimeline(e,r){try{let t=await this.searchManager.getContextTimeline(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}async handleContextPreview(e,r){try{let t=e.query.project;if(!t){r.status(400).json({error:"Project parameter is required"});return}let{generateContext:s}=await Promise.resolve().then(()=>(bf(),yf)),i=`/preview/${t}`,n=await s({session_id:"preview-"+Date.now(),cwd:i},!0);r.setHeader("Content-Type","text/plain; charset=utf-8"),r.send(n)}catch(t){H.failure("WORKER","Context preview generation failed",{},t),r.status(500).json({error:"Failed to generate context preview",message:t.message})}}async handleContextInject(e,r){try{let t=e.query.project,s=e.query.colors==="true";if(!t){r.status(400).json({error:"Project parameter is required"});return}let{generateContext:i}=await Promise.resolve().then(()=>(bf(),yf)),n=`/context/${t}`,o=await i({session_id:"context-inject-"+Date.now(),cwd:n},s);r.setHeader("Content-Type","text/plain; charset=utf-8"),r.send(o)}catch(t){H.failure("WORKER","Context injection failed",{},t),r.status(500).json({error:"Failed to generate context",message:t.message})}}async handleGetTimelineByQuery(e,r){try{let t=await this.searchManager.getTimelineByQuery(e.query);r.json(t.content)}catch(t){H.failure("WORKER","Search failed",{},t),r.status(500).json({error:t.message})}}handleSearchHelp(e,r){r.json({title:"Claude-Mem Search API",description:"HTTP API for searching persistent memory",endpoints:[{path:"/api/search/observations",method:"GET",description:"Search observations using full-text search",parameters:{query:"Search query (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 20)",project:"Filter by project name (optional)"}},{path:"/api/search/sessions",method:"GET",description:"Search session summaries using full-text search",parameters:{query:"Search query (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 20)"}},{path:"/api/search/prompts",method:"GET",description:"Search user prompts using full-text search",parameters:{query:"Search query (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 20)",project:"Filter by project name (optional)"}},{path:"/api/search/by-concept",method:"GET",description:"Find observations by concept tag",parameters:{concept:"Concept tag (required): discovery, decision, bugfix, feature, refactor",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/search/by-file",method:"GET",description:"Find observations and sessions by file path",parameters:{filePath:"File path or partial path (required)",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results per type (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/search/by-type",method:"GET",description:"Find observations by type",parameters:{type:"Observation type (required): discovery, decision, bugfix, feature, refactor",format:'Response format: "index" or "full" (default: "full")',limit:"Number of results (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/context/recent",method:"GET",description:"Get recent session context including summaries and observations",parameters:{project:"Project name (default: current directory)",limit:"Number of recent sessions (default: 3)"}},{path:"/api/context/timeline",method:"GET",description:"Get unified timeline around a specific point in time",parameters:{anchor:'Anchor point: observation ID, session ID (e.g., "S123"), or ISO timestamp (required)',depth_before:"Number of records before anchor (default: 10)",depth_after:"Number of records after anchor (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/timeline/by-query",method:"GET",description:"Search for best match, then get timeline around it",parameters:{query:"Search query (required)",mode:'Search mode: "auto", "observations", or "sessions" (default: "auto")',depth_before:"Number of records before match (default: 10)",depth_after:"Number of records after match (default: 10)",project:"Filter by project name (optional)"}},{path:"/api/search/help",method:"GET",description:"Get this help documentation"}],examples:['curl "http://localhost:37777/api/search/observations?query=authentication&format=index&limit=5"','curl "http://localhost:37777/api/search/by-type?type=bugfix&limit=10"','curl "http://localhost:37777/api/context/recent?project=claude-mem&limit=3"','curl "http://localhost:37777/api/context/timeline?anchor=123&depth_before=5&depth_after=5"']})}};var Hn=gt(require("path"),1),Vt=require("fs"),_f=require("os");Ia();_t();var xf=require("child_process"),qs=require("fs"),jw=require("os"),Xi=require("path");_t();var Qi=(0,Xi.join)((0,jw.homedir)(),".claude","plugins","marketplaces","thedotmack");function yr(a){return(0,xf.execSync)(`git ${a}`,{cwd:Qi,encoding:"utf-8",timeout:3e4}).trim()}function $w(a,e=6e4){return(0,xf.execSync)(a,{cwd:Qi,encoding:"utf-8",timeout:e}).trim()}function Cl(){let a=(0,Xi.join)(Qi,".git");if(!(0,qs.existsSync)(a))return{branch:null,isBeta:!1,isGitRepo:!1,isDirty:!1,canSwitch:!1,error:"Installed plugin is not a git repository"};try{let e=yr("rev-parse --abbrev-ref HEAD"),t=yr("status --porcelain").length>0,s=e.startsWith("beta");return{branch:e,isBeta:s,isGitRepo:!0,isDirty:t,canSwitch:!0}}catch(e){return H.error("BRANCH","Failed to get branch info",{},e),{branch:null,isBeta:!1,isGitRepo:!0,isDirty:!1,canSwitch:!1,error:e.message}}}async function Mw(a){let e=Cl();if(!e.isGitRepo)return{success:!1,error:"Installed plugin is not a git repository. Please reinstall."};if(e.branch===a)return{success:!0,branch:a,message:`Already on branch ${a}`};try{H.info("BRANCH","Starting branch switch",{from:e.branch,to:a}),H.debug("BRANCH","Discarding local changes"),yr("checkout -- ."),yr("clean -fd"),H.debug("BRANCH","Fetching from origin"),yr("fetch origin"),H.debug("BRANCH","Checking out branch",{branch:a});try{yr(`checkout ${a}`)}catch{yr(`checkout -b ${a} origin/${a}`)}H.debug("BRANCH","Pulling latest"),yr(`pull origin ${a}`);let r=(0,Xi.join)(Qi,".install-version");return(0,qs.existsSync)(r)&&(0,qs.unlinkSync)(r),H.debug("BRANCH","Running npm install"),$w("npm install",12e4),H.success("BRANCH","Branch switch complete",{branch:a}),{success:!0,branch:a,message:`Switched to ${a}. Worker will restart automatically.`}}catch(r){H.error("BRANCH","Branch switch failed",{targetBranch:a},r);try{e.branch&&yr(`checkout ${e.branch}`)}catch{}return{success:!1,error:`Branch switch failed: ${r.message}`}}}async function Lw(){let a=Cl();if(!a.isGitRepo||!a.branch)return{success:!1,error:"Cannot pull updates: not a git repository"};try{H.info("BRANCH","Pulling updates",{branch:a.branch}),yr("checkout -- ."),yr("fetch origin"),yr(`pull origin ${a.branch}`);let e=(0,Xi.join)(Qi,".install-version");return(0,qs.existsSync)(e)&&(0,qs.unlinkSync)(e),$w("npm install",12e4),H.success("BRANCH","Updates pulled",{branch:a.branch}),{success:!0,branch:a.branch,message:`Updated ${a.branch}. Worker will restart automatically.`}}catch(e){return H.error("BRANCH","Pull failed",{},e),{success:!1,error:`Pull failed: ${e.message}`}}}gf();var kl=class{constructor(e){this.settingsManager=e}setupRoutes(e){e.get("/api/settings",this.handleGetSettings.bind(this)),e.post("/api/settings",this.handleUpdateSettings.bind(this)),e.get("/api/mcp/status",this.handleGetMcpStatus.bind(this)),e.post("/api/mcp/toggle",this.handleToggleMcp.bind(this)),e.get("/api/branch/status",this.handleGetBranchStatus.bind(this)),e.post("/api/branch/switch",this.handleSwitchBranch.bind(this)),e.post("/api/branch/update",this.handleUpdateBranch.bind(this))}handleGetSettings(e,r){try{let t=Hn.default.join((0,_f.homedir)(),".claude-mem","settings.json");if(!(0,Vt.existsSync)(t)){r.json({CLAUDE_MEM_MODEL:"claude-haiku-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",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:Zi,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:Ki,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"});return}let s=(0,Vt.readFileSync)(t,"utf-8"),n=JSON.parse(s).env||{};r.json({CLAUDE_MEM_MODEL:n.CLAUDE_MEM_MODEL||"claude-haiku-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:n.CLAUDE_MEM_CONTEXT_OBSERVATIONS||"50",CLAUDE_MEM_WORKER_PORT:n.CLAUDE_MEM_WORKER_PORT||"37777",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:n.CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS||"true",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:n.CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS||"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:n.CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT||"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:n.CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT||"true",CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES:n.CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES||Zi,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:n.CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS||Ki,CLAUDE_MEM_CONTEXT_FULL_COUNT:n.CLAUDE_MEM_CONTEXT_FULL_COUNT||"5",CLAUDE_MEM_CONTEXT_FULL_FIELD:n.CLAUDE_MEM_CONTEXT_FULL_FIELD||"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:n.CLAUDE_MEM_CONTEXT_SESSION_COUNT||"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:n.CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY||"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:n.CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE||"false"})}catch(t){H.failure("WORKER","Get settings failed",{},t),r.status(500).json({error:t.message})}}handleUpdateSettings(e,r){try{if(e.body.CLAUDE_MEM_CONTEXT_OBSERVATIONS){let o=parseInt(e.body.CLAUDE_MEM_CONTEXT_OBSERVATIONS,10);if(isNaN(o)||o<1||o>200){r.status(400).json({success:!1,error:"CLAUDE_MEM_CONTEXT_OBSERVATIONS must be between 1 and 200"});return}}if(e.body.CLAUDE_MEM_WORKER_PORT){let o=parseInt(e.body.CLAUDE_MEM_WORKER_PORT,10);if(isNaN(o)||o<1024||o>65535){r.status(400).json({success:!1,error:"CLAUDE_MEM_WORKER_PORT must be between 1024 and 65535"});return}}let t=this.validateContextSettings(e.body);if(!t.valid){r.status(400).json({success:!1,error:t.error});return}let s=Hn.default.join((0,_f.homedir)(),".claude-mem","settings.json"),i={env:{}};if((0,Vt.existsSync)(s)){let o=(0,Vt.readFileSync)(s,"utf-8");i=JSON.parse(o),i.env||(i.env={})}let n=["CLAUDE_MEM_MODEL","CLAUDE_MEM_CONTEXT_OBSERVATIONS","CLAUDE_MEM_WORKER_PORT","CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT","CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES","CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS","CLAUDE_MEM_CONTEXT_FULL_COUNT","CLAUDE_MEM_CONTEXT_FULL_FIELD","CLAUDE_MEM_CONTEXT_SESSION_COUNT","CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY","CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE"];for(let o of n)e.body[o]!==void 0&&(i.env[o]=e.body[o]);(0,Vt.writeFileSync)(s,JSON.stringify(i,null,2),"utf-8"),H.info("WORKER","Settings updated"),r.json({success:!0,message:"Settings updated successfully"})}catch(t){H.failure("WORKER","Update settings failed",{},t),r.status(500).json({success:!1,error:String(t)})}}handleGetMcpStatus(e,r){try{let t=this.isMcpEnabled();r.json({enabled:t})}catch(t){H.failure("WORKER","Get MCP status failed",{},t),r.status(500).json({error:t.message})}}handleToggleMcp(e,r){try{let{enabled:t}=e.body;if(typeof t!="boolean"){r.status(400).json({error:"enabled must be a boolean"});return}this.toggleMcp(t),r.json({success:!0,enabled:this.isMcpEnabled()})}catch(t){H.failure("WORKER","Toggle MCP failed",{},t),r.status(500).json({success:!1,error:t.message})}}handleGetBranchStatus(e,r){try{let t=Cl();r.json(t)}catch(t){H.failure("WORKER","Failed to get branch status",{},t),r.status(500).json({error:t.message})}}async handleSwitchBranch(e,r){try{let{branch:t}=e.body;if(!t){r.status(400).json({success:!1,error:"Missing branch parameter"});return}let s=["main","beta/7.0"];if(!s.includes(t)){r.status(400).json({success:!1,error:`Invalid branch. Allowed: ${s.join(", ")}`});return}H.info("WORKER","Branch switch requested",{branch:t});let i=await Mw(t);i.success&&setTimeout(()=>{H.info("WORKER","Restarting worker after branch switch"),process.exit(0)},1e3),r.json(i)}catch(t){H.failure("WORKER","Branch switch failed",{},t),r.status(500).json({success:!1,error:t.message})}}async handleUpdateBranch(e,r){try{H.info("WORKER","Branch update requested");let t=await Lw();t.success&&setTimeout(()=>{H.info("WORKER","Restarting worker after branch update"),process.exit(0)},1e3),r.json(t)}catch(t){H.failure("WORKER","Branch update failed",{},t),r.status(500).json({success:!1,error:t.message})}}validateContextSettings(e){let r=["CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT","CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT","CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY","CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE"];for(let t of r)if(e[t]&&!["true","false"].includes(e[t]))return{valid:!1,error:`${t} must be "true" or "false"`};if(e.CLAUDE_MEM_CONTEXT_FULL_COUNT){let t=parseInt(e.CLAUDE_MEM_CONTEXT_FULL_COUNT,10);if(isNaN(t)||t<0||t>20)return{valid:!1,error:"CLAUDE_MEM_CONTEXT_FULL_COUNT must be between 0 and 20"}}if(e.CLAUDE_MEM_CONTEXT_SESSION_COUNT){let t=parseInt(e.CLAUDE_MEM_CONTEXT_SESSION_COUNT,10);if(isNaN(t)||t<1||t>50)return{valid:!1,error:"CLAUDE_MEM_CONTEXT_SESSION_COUNT must be between 1 and 50"}}if(e.CLAUDE_MEM_CONTEXT_FULL_FIELD&&!["narrative","facts"].includes(e.CLAUDE_MEM_CONTEXT_FULL_FIELD))return{valid:!1,error:'CLAUDE_MEM_CONTEXT_FULL_FIELD must be "narrative" or "facts"'};if(e.CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES){let t=e.CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES.split(",").map(s=>s.trim());for(let s of t)if(s&&!zn.includes(s))return{valid:!1,error:`Invalid observation type: ${s}. Valid types: ${zn.join(", ")}`}}if(e.CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS){let t=e.CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS.split(",").map(s=>s.trim());for(let s of t)if(s&&!Bn.includes(s))return{valid:!1,error:`Invalid observation concept: ${s}. Valid concepts: ${Bn.join(", ")}`}}return{valid:!0}}isMcpEnabled(){let e=zr(),r=Hn.default.join(e,"plugin",".mcp.json");return(0,Vt.existsSync)(r)}toggleMcp(e){try{let r=zr(),t=Hn.default.join(r,"plugin",".mcp.json"),s=Hn.default.join(r,"plugin",".mcp.json.disabled");e&&(0,Vt.existsSync)(s)?((0,Vt.renameSync)(s,t),H.info("WORKER","MCP search server enabled")):!e&&(0,Vt.existsSync)(t)?((0,Vt.renameSync)(t,s),H.info("WORKER","MCP search server disabled")):H.debug("WORKER","MCP toggle no-op (already in desired state)",{enabled:e})}catch(r){throw H.failure("WORKER","Failed to toggle MCP",{enabled:e},r),r}}};var Il=class{app;server=null;startTime=Date.now();mcpClient;dbManager;sessionManager;sseBroadcaster;sdkAgent;paginationHelper;settingsManager;viewerRoutes;sessionRoutes;dataRoutes;searchRoutes;settingsRoutes;constructor(){this.app=(0,qw.default)(),this.dbManager=new Jc,this.sessionManager=new Yc(this.dbManager),this.sseBroadcaster=new el,this.sdkAgent=new vl(this.dbManager,this.sessionManager),this.paginationHelper=new yl(this.dbManager),this.settingsManager=new bl(this.dbManager),this.sessionManager.setOnSessionDeleted(()=>{this.broadcastProcessingStatus()}),this.mcpClient=new wn({name:"worker-search-proxy",version:"1.0.0"},{capabilities:{}}),this.viewerRoutes=new Sl(this.sseBroadcaster,this.dbManager,this.sessionManager),this.sessionRoutes=new wl(this.sessionManager,this.dbManager,this.sdkAgent,this.sseBroadcaster,this),this.dataRoutes=new Tl(this.paginationHelper,this.dbManager,this.sessionManager,this.sseBroadcaster,this,this.startTime),this.searchRoutes=null,this.settingsRoutes=new kl(this.settingsManager),this.setupMiddleware(),this.setupRoutes()}setupMiddleware(){Tw(this.summarizeRequestBody.bind(this)).forEach(r=>this.app.use(r))}setupRoutes(){this.app.get("/api/health",(e,r)=>{r.status(200).json({status:"ok"})}),this.viewerRoutes.setupRoutes(this.app),this.sessionRoutes.setupRoutes(this.app),this.dataRoutes.setupRoutes(this.app),this.settingsRoutes.setupRoutes(this.app)}async start(){let e=On();this.server=await new Promise((r,t)=>{let s=this.app.listen(e,()=>r(s));s.on("error",t)}),H.info("SYSTEM","Worker started",{port:e,pid:process.pid}),this.initializeBackground().catch(r=>{H.error("SYSTEM","Background initialization failed",{},r)})}async initializeBackground(){await this.dbManager.initialize();let e=new _l,r=new El,t=new xl(this.dbManager.getSessionSearch(),this.dbManager.getSessionStore(),this.dbManager.getChromaSync(),e,r);this.searchRoutes=new Ol(t),this.searchRoutes.setupRoutes(this.app),H.info("WORKER","SearchManager initialized and search routes registered");let s=Fw.default.join(__dirname,"..","..","plugin","scripts","mcp-server.cjs"),i=new Pn({command:"node",args:[s],env:process.env});await this.mcpClient.connect(i),H.success("WORKER","Connected to MCP server")}async shutdown(){if(await this.sessionManager.shutdownAll(),this.mcpClient)try{await this.mcpClient.close(),H.info("SYSTEM","MCP client closed")}catch(e){H.error("SYSTEM","Failed to close MCP client",{},e)}this.server&&await new Promise((e,r)=>{this.server.close(t=>t?r(t):e())}),await this.dbManager.close(),H.info("SYSTEM","Worker shutdown complete")}summarizeRequestBody(e,r,t){return Rw(e,r,t)}broadcastProcessingStatus(){let e=this.sessionManager.isAnySessionProcessing(),r=this.sessionManager.getTotalActiveWork(),t=this.sessionManager.getActiveSessionCount();H.info("WORKER","Broadcasting processing status",{isProcessing:e,queueDepth:r,activeSessions:t}),this.sseBroadcaster.broadcast({type:"processing_status",isProcessing:e,queueDepth:r})}};if(require.main===module||!module.parent){let a=new Il;process.on("SIGTERM",async()=>{H.info("SYSTEM","Received SIGTERM, shutting down gracefully"),await a.shutdown(),process.exit(0)}),process.on("SIGINT",async()=>{H.info("SYSTEM","Received SIGINT, shutting down gracefully"),await a.shutdown(),process.exit(0)}),a.start().catch(e=>{H.failure("SYSTEM","Worker failed to start",{},e),process.exit(1)})}0&&(module.exports={WorkerService}); /*! Bundled license information: depd/index.js: diff --git a/src/services/worker-service.ts b/src/services/worker-service.ts index 3ddf5b5c..f148c956 100644 --- a/src/services/worker-service.ts +++ b/src/services/worker-service.ts @@ -112,37 +112,6 @@ export class WorkerService { this.settingsRoutes.setupRoutes(this.app); } - /** - * Cleanup orphaned MCP server processes (uvx/chroma) from previous sessions - */ - private async cleanupOrphanedProcesses(): Promise { - try { - const { execSync } = await import('child_process'); - - // Find orphaned uvx processes (which spawn chroma servers) - try { - const processes = execSync('pgrep -fl uvx', { encoding: 'utf-8', stdio: 'pipe', windowsHide: true }).trim(); - if (processes) { - const processCount = processes.split('\n').length; - logger.info('WORKER', 'Cleaning up orphaned MCP processes', { count: processCount }); - - // Kill the processes - execSync('pkill -f uvx', { stdio: 'pipe', windowsHide: true }); - logger.success('WORKER', `Cleaned up ${processCount} orphaned MCP server processes`); - } - } catch (error: any) { - // pgrep returns exit code 1 if no processes found (not an error) - if (error.status === 1) { - logger.debug('WORKER', 'No orphaned MCP processes to clean up'); - } else { - throw error; - } - } - } catch (error) { - // Don't fail startup if cleanup fails - logger.warn('WORKER', 'Failed to cleanup orphaned processes (non-fatal)', {}, error as Error); - } - } /** * Start the worker service @@ -167,9 +136,6 @@ export class WorkerService { * Background initialization - runs after HTTP server is listening */ private async initializeBackground(): Promise { - // Cleanup orphaned processes from previous sessions - await this.cleanupOrphanedProcesses(); - // Initialize database (once, stays open) await this.dbManager.initialize();