@kelceyp/swic 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,19 @@
1
1
  // @bun
2
- var K6=Object.create;var{getPrototypeOf:z6,defineProperty:IQ,getOwnPropertyNames:$6}=Object;var L6=Object.prototype.hasOwnProperty;var ZQ=(f,v,W)=>{W=f!=null?K6(z6(f)):{};let J=v||!f||!f.__esModule?IQ(W,"default",{value:f,enumerable:!0}):W;for(let Q of $6(f))if(!L6.call(J,Q))IQ(J,Q,{get:()=>f[Q],enumerable:!0});return J};var s=(f,v)=>()=>(v||f((v={exports:{}}).exports,v),v.exports);var CQ=(f,v)=>{for(var W in v)IQ(f,W,{get:v[W],enumerable:!0,configurable:!0,set:(J)=>v[W]=()=>J})};var Ef=(f,v)=>()=>(f&&(v=f(f=0)),v);var f8=import.meta.require;var S8=s((JQ,k8)=>{(function(f,v){typeof JQ==="object"&&typeof k8!=="undefined"?v(JQ):typeof define==="function"&&define.amd?define(["exports"],v):v(f.URI=f.URI||{})})(JQ,function(f){function v(){for(var V=arguments.length,P=Array(V),j=0;j<V;j++)P[j]=arguments[j];if(P.length>1){P[0]=P[0].slice(0,-1);var F=P.length-1;for(var A=1;A<F;++A)P[A]=P[A].slice(1,-1);return P[F]=P[F].slice(1),P.join("")}else return P[0]}function W(V){return"(?:"+V+")"}function J(V){return V===void 0?"undefined":V===null?"null":Object.prototype.toString.call(V).split(" ").pop().split("]").shift().toLowerCase()}function Q(V){return V.toUpperCase()}function X(V){return V!==void 0&&V!==null?V instanceof Array?V:typeof V.length!=="number"||V.split||V.setInterval||V.call?[V]:Array.prototype.slice.call(V):[]}function Y(V,P){var j=V;if(P)for(var F in P)j[F]=P[F];return j}function w(V){var P="[A-Za-z]",j="[\\x0D]",F="[0-9]",A="[\\x22]",m=v(F,"[A-Fa-f]"),e="[\\x0A]",Xv="[\\x20]",Bv=W(W("%[EFef]"+m+"%"+m+m+"%"+m+m)+"|"+W("%[89A-Fa-f]"+m+"%"+m+m)+"|"+W("%"+m+m)),Hv="[\\:\\/\\?\\#\\[\\]\\@]",Jv="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Nv=v(Hv,Jv),Fv=V?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Lv=V?"[\\uE000-\\uF8FF]":"[]",wv=v(P,F,"[\\-\\.\\_\\~]",Fv),Dv=W(P+v(P,F,"[\\+\\-\\.]")+"*"),qv=W(W(Bv+"|"+v(wv,Jv,"[\\:]"))+"*"),Sf=W(W("25[0-5]")+"|"+W("2[0-4]"+F)+"|"+W("1"+F+F)+"|"+W("[1-9]"+F)+"|"+F),uv=W(W("25[0-5]")+"|"+W("2[0-4]"+F)+"|"+W("1"+F+F)+"|"+W("0?[1-9]"+F)+"|0?0?"+F),av=W(uv+"\\."+uv+"\\."+uv+"\\."+uv),Pv=W(m+"{1,4}"),rv=W(W(Pv+"\\:"+Pv)+"|"+av),cv=W(W(Pv+"\\:")+"{6}"+rv),Yf=W("\\:\\:"+W(Pv+"\\:")+"{5}"+rv),yf=W(W(Pv)+"?\\:\\:"+W(Pv+"\\:")+"{4}"+rv),zf=W(W(W(Pv+"\\:")+"{0,1}"+Pv)+"?\\:\\:"+W(Pv+"\\:")+"{3}"+rv),L1=W(W(W(Pv+"\\:")+"{0,2}"+Pv)+"?\\:\\:"+W(Pv+"\\:")+"{2}"+rv),l1=W(W(W(Pv+"\\:")+"{0,3}"+Pv)+"?\\:\\:"+Pv+"\\:"+rv),I1=W(W(W(Pv+"\\:")+"{0,4}"+Pv)+"?\\:\\:"+rv),af=W(W(W(Pv+"\\:")+"{0,5}"+Pv)+"?\\:\\:"+Pv),cf=W(W(W(Pv+"\\:")+"{0,6}"+Pv)+"?\\:\\:"),$f=W([cv,Yf,yf,zf,L1,l1,I1,af,cf].join("|")),nf=W(W(wv+"|"+Bv)+"+"),yQ=W($f+"\\%25"+nf),lf=W($f+W("\\%25|\\%(?!"+m+"{2})")+nf),X6=W("[vV]"+m+"+\\."+v(wv,Jv,"[\\:]")+"+"),Y6=W("\\["+W(lf+"|"+$f+"|"+X6)+"\\]"),s0=W(W(Bv+"|"+v(wv,Jv))+"*"),M1=W(Y6+"|"+av+"(?!"+s0+")|"+s0),N1=W(F+"*"),t0=W(W(qv+"@")+"?"+M1+W("\\:"+N1)+"?"),D1=W(Bv+"|"+v(wv,Jv,"[\\:\\@]")),w6=W(D1+"*"),e0=W(D1+"+"),G6=W(W(Bv+"|"+v(wv,Jv,"[\\@]"))+"+"),Lf=W(W("\\/"+w6)+"*"),pf=W("\\/"+W(e0+Lf)+"?"),lQ=W(G6+Lf),Z1=W(e0+Lf),df="(?!"+D1+")",G2=W(Lf+"|"+pf+"|"+lQ+"|"+Z1+"|"+df),of=W(W(D1+"|"+v("[\\/\\?]",Lv))+"*"),V1=W(W(D1+"|[\\/\\?]")+"*"),v8=W(W("\\/\\/"+t0+Lf)+"|"+pf+"|"+Z1+"|"+df),B6=W(Dv+"\\:"+v8+W("\\?"+of)+"?"+W("\\#"+V1)+"?"),q6=W(W("\\/\\/"+t0+Lf)+"|"+pf+"|"+lQ+"|"+df),P6=W(q6+W("\\?"+of)+"?"+W("\\#"+V1)+"?"),B2=W(B6+"|"+P6),q2=W(Dv+"\\:"+v8+W("\\?"+of)+"?"),P2="^("+Dv+")\\:"+W(W("\\/\\/("+W("("+qv+")@")+"?("+M1+")"+W("\\:("+N1+")")+"?)")+"?("+Lf+"|"+pf+"|"+Z1+"|"+df+")")+W("\\?("+of+")")+"?"+W("\\#("+V1+")")+"?$",K2="^(){0}"+W(W("\\/\\/("+W("("+qv+")@")+"?("+M1+")"+W("\\:("+N1+")")+"?)")+"?("+Lf+"|"+pf+"|"+lQ+"|"+df+")")+W("\\?("+of+")")+"?"+W("\\#("+V1+")")+"?$",z2="^("+Dv+")\\:"+W(W("\\/\\/("+W("("+qv+")@")+"?("+M1+")"+W("\\:("+N1+")")+"?)")+"?("+Lf+"|"+pf+"|"+Z1+"|"+df+")")+W("\\?("+of+")")+"?$",$2="^"+W("\\#("+V1+")")+"?$",L2="^"+W("("+qv+")@")+"?("+M1+")"+W("\\:("+N1+")")+"?$";return{NOT_SCHEME:new RegExp(v("[^]",P,F,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(v("[^\\%\\:]",wv,Jv),"g"),NOT_HOST:new RegExp(v("[^\\%\\[\\]\\:]",wv,Jv),"g"),NOT_PATH:new RegExp(v("[^\\%\\/\\:\\@]",wv,Jv),"g"),NOT_PATH_NOSCHEME:new RegExp(v("[^\\%\\/\\@]",wv,Jv),"g"),NOT_QUERY:new RegExp(v("[^\\%]",wv,Jv,"[\\:\\@\\/\\?]",Lv),"g"),NOT_FRAGMENT:new RegExp(v("[^\\%]",wv,Jv,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(v("[^]",wv,Jv),"g"),UNRESERVED:new RegExp(wv,"g"),OTHER_CHARS:new RegExp(v("[^\\%]",wv,Nv),"g"),PCT_ENCODED:new RegExp(Bv,"g"),IPV4ADDRESS:new RegExp("^("+av+")$"),IPV6ADDRESS:new RegExp("^\\[?("+$f+")"+W(W("\\%25|\\%(?!"+m+"{2})")+"("+nf+")")+"?\\]?$")}}var B=w(!1),z=w(!0),K=function(){function V(P,j){var F=[],A=!0,m=!1,e=void 0;try{for(var Xv=P[Symbol.iterator](),Bv;!(A=(Bv=Xv.next()).done);A=!0)if(F.push(Bv.value),j&&F.length===j)break}catch(Hv){m=!0,e=Hv}finally{try{if(!A&&Xv.return)Xv.return()}finally{if(m)throw e}}return F}return function(P,j){if(Array.isArray(P))return P;else if(Symbol.iterator in Object(P))return V(P,j);else throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),L=function(V){if(Array.isArray(V)){for(var P=0,j=Array(V.length);P<V.length;P++)j[P]=V[P];return j}else return Array.from(V)},D=2147483647,q=36,M=1,N=26,$=38,O=700,h=72,H=128,k="-",l=/^xn--/,T=/[^\0-\x7E]/,E=/[\x2E\u3002\uFF0E\uFF61]/g,g={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},U=q-M,b=Math.floor,I=String.fromCharCode;function S(V){throw new RangeError(g[V])}function _(V,P){var j=[],F=V.length;while(F--)j[F]=P(V[F]);return j}function R(V,P){var j=V.split("@"),F="";if(j.length>1)F=j[0]+"@",V=j[1];V=V.replace(E,".");var A=V.split("."),m=_(A,P).join(".");return F+m}function y(V){var P=[],j=0,F=V.length;while(j<F){var A=V.charCodeAt(j++);if(A>=55296&&A<=56319&&j<F){var m=V.charCodeAt(j++);if((m&64512)==56320)P.push(((A&1023)<<10)+(m&1023)+65536);else P.push(A),j--}else P.push(A)}return P}var r=function V(P){return String.fromCodePoint.apply(String,L(P))},a=function V(P){if(P-48<10)return P-22;if(P-65<26)return P-65;if(P-97<26)return P-97;return q},i=function V(P,j){return P+22+75*(P<26)-((j!=0)<<5)},p=function V(P,j,F){var A=0;P=F?b(P/O):P>>1,P+=b(P/j);for(;P>U*N>>1;A+=q)P=b(P/U);return b(A+(U+1)*P/(P+$))},n=function V(P){var j=[],F=P.length,A=0,m=H,e=h,Xv=P.lastIndexOf(k);if(Xv<0)Xv=0;for(var Bv=0;Bv<Xv;++Bv){if(P.charCodeAt(Bv)>=128)S("not-basic");j.push(P.charCodeAt(Bv))}for(var Hv=Xv>0?Xv+1:0;Hv<F;){var Jv=A;for(var Nv=1,Fv=q;;Fv+=q){if(Hv>=F)S("invalid-input");var Lv=a(P.charCodeAt(Hv++));if(Lv>=q||Lv>b((D-A)/Nv))S("overflow");A+=Lv*Nv;var wv=Fv<=e?M:Fv>=e+N?N:Fv-e;if(Lv<wv)break;var Dv=q-wv;if(Nv>b(D/Dv))S("overflow");Nv*=Dv}var qv=j.length+1;if(e=p(A-Jv,qv,Jv==0),b(A/qv)>D-m)S("overflow");m+=b(A/qv),A%=qv,j.splice(A++,0,m)}return String.fromCodePoint.apply(String,j)},$v=function V(P){var j=[];P=y(P);var F=P.length,A=H,m=0,e=h,Xv=!0,Bv=!1,Hv=void 0;try{for(var Jv=P[Symbol.iterator](),Nv;!(Xv=(Nv=Jv.next()).done);Xv=!0){var Fv=Nv.value;if(Fv<128)j.push(I(Fv))}}catch(lf){Bv=!0,Hv=lf}finally{try{if(!Xv&&Jv.return)Jv.return()}finally{if(Bv)throw Hv}}var Lv=j.length,wv=Lv;if(Lv)j.push(k);while(wv<F){var Dv=D,qv=!0,Sf=!1,uv=void 0;try{for(var av=P[Symbol.iterator](),Pv;!(qv=(Pv=av.next()).done);qv=!0){var rv=Pv.value;if(rv>=A&&rv<Dv)Dv=rv}}catch(lf){Sf=!0,uv=lf}finally{try{if(!qv&&av.return)av.return()}finally{if(Sf)throw uv}}var cv=wv+1;if(Dv-A>b((D-m)/cv))S("overflow");m+=(Dv-A)*cv,A=Dv;var Yf=!0,yf=!1,zf=void 0;try{for(var L1=P[Symbol.iterator](),l1;!(Yf=(l1=L1.next()).done);Yf=!0){var I1=l1.value;if(I1<A&&++m>D)S("overflow");if(I1==A){var af=m;for(var cf=q;;cf+=q){var $f=cf<=e?M:cf>=e+N?N:cf-e;if(af<$f)break;var nf=af-$f,yQ=q-$f;j.push(I(i($f+nf%yQ,0))),af=b(nf/yQ)}j.push(I(i(af,0))),e=p(m,cv,wv==Lv),m=0,++wv}}}catch(lf){yf=!0,zf=lf}finally{try{if(!Yf&&L1.return)L1.return()}finally{if(yf)throw zf}}++m,++A}return j.join("")},bv=function V(P){return R(P,function(j){return l.test(j)?n(j.slice(4).toLowerCase()):j})},Sv=function V(P){return R(P,function(j){return T.test(j)?"xn--"+$v(j):j})},Yv={version:"2.1.0",ucs2:{decode:y,encode:r},decode:n,encode:$v,toASCII:Sv,toUnicode:bv},Ov={};function gv(V){var P=V.charCodeAt(0),j=void 0;if(P<16)j="%0"+P.toString(16).toUpperCase();else if(P<128)j="%"+P.toString(16).toUpperCase();else if(P<2048)j="%"+(P>>6|192).toString(16).toUpperCase()+"%"+(P&63|128).toString(16).toUpperCase();else j="%"+(P>>12|224).toString(16).toUpperCase()+"%"+(P>>6&63|128).toString(16).toUpperCase()+"%"+(P&63|128).toString(16).toUpperCase();return j}function yv(V){var P="",j=0,F=V.length;while(j<F){var A=parseInt(V.substr(j+1,2),16);if(A<128)P+=String.fromCharCode(A),j+=3;else if(A>=194&&A<224){if(F-j>=6){var m=parseInt(V.substr(j+4,2),16);P+=String.fromCharCode((A&31)<<6|m&63)}else P+=V.substr(j,6);j+=6}else if(A>=224){if(F-j>=9){var e=parseInt(V.substr(j+4,2),16),Xv=parseInt(V.substr(j+7,2),16);P+=String.fromCharCode((A&15)<<12|(e&63)<<6|Xv&63)}else P+=V.substr(j,9);j+=9}else P+=V.substr(j,3),j+=3}return P}function Vf(V,P){function j(F){var A=yv(F);return!A.match(P.UNRESERVED)?F:A}if(V.scheme)V.scheme=String(V.scheme).replace(P.PCT_ENCODED,j).toLowerCase().replace(P.NOT_SCHEME,"");if(V.userinfo!==void 0)V.userinfo=String(V.userinfo).replace(P.PCT_ENCODED,j).replace(P.NOT_USERINFO,gv).replace(P.PCT_ENCODED,Q);if(V.host!==void 0)V.host=String(V.host).replace(P.PCT_ENCODED,j).toLowerCase().replace(P.NOT_HOST,gv).replace(P.PCT_ENCODED,Q);if(V.path!==void 0)V.path=String(V.path).replace(P.PCT_ENCODED,j).replace(V.scheme?P.NOT_PATH:P.NOT_PATH_NOSCHEME,gv).replace(P.PCT_ENCODED,Q);if(V.query!==void 0)V.query=String(V.query).replace(P.PCT_ENCODED,j).replace(P.NOT_QUERY,gv).replace(P.PCT_ENCODED,Q);if(V.fragment!==void 0)V.fragment=String(V.fragment).replace(P.PCT_ENCODED,j).replace(P.NOT_FRAGMENT,gv).replace(P.PCT_ENCODED,Q);return V}function Pf(V){return V.replace(/^0*(.*)/,"$1")||"0"}function Uv(V,P){var j=V.match(P.IPV4ADDRESS)||[],F=K(j,2),A=F[1];if(A)return A.split(".").map(Pf).join(".");else return V}function jv(V,P){var j=V.match(P.IPV6ADDRESS)||[],F=K(j,3),A=F[1],m=F[2];if(A){var e=A.toLowerCase().split("::").reverse(),Xv=K(e,2),Bv=Xv[0],Hv=Xv[1],Jv=Hv?Hv.split(":").map(Pf):[],Nv=Bv.split(":").map(Pf),Fv=P.IPV4ADDRESS.test(Nv[Nv.length-1]),Lv=Fv?7:8,wv=Nv.length-Lv,Dv=Array(Lv);for(var qv=0;qv<Lv;++qv)Dv[qv]=Jv[qv]||Nv[wv+qv]||"";if(Fv)Dv[Lv-1]=Uv(Dv[Lv-1],P);var Sf=Dv.reduce(function(cv,Yf,yf){if(!Yf||Yf==="0"){var zf=cv[cv.length-1];if(zf&&zf.index+zf.length===yf)zf.length++;else cv.push({index:yf,length:1})}return cv},[]),uv=Sf.sort(function(cv,Yf){return Yf.length-cv.length})[0],av=void 0;if(uv&&uv.length>1){var Pv=Dv.slice(0,uv.index),rv=Dv.slice(uv.index+uv.length);av=Pv.join(":")+"::"+rv.join(":")}else av=Dv.join(":");if(m)av+="%"+m;return av}else return V}var bf=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Rv="".match(/(){0}/)[1]===void 0;function Gv(V){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j={},F=P.iri!==!1?z:B;if(P.reference==="suffix")V=(P.scheme?P.scheme+":":"")+"//"+V;var A=V.match(bf);if(A){if(Rv){if(j.scheme=A[1],j.userinfo=A[3],j.host=A[4],j.port=parseInt(A[5],10),j.path=A[6]||"",j.query=A[7],j.fragment=A[8],isNaN(j.port))j.port=A[5]}else if(j.scheme=A[1]||void 0,j.userinfo=V.indexOf("@")!==-1?A[3]:void 0,j.host=V.indexOf("//")!==-1?A[4]:void 0,j.port=parseInt(A[5],10),j.path=A[6]||"",j.query=V.indexOf("?")!==-1?A[7]:void 0,j.fragment=V.indexOf("#")!==-1?A[8]:void 0,isNaN(j.port))j.port=V.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?A[4]:void 0;if(j.host)j.host=jv(Uv(j.host,F),F);if(j.scheme===void 0&&j.userinfo===void 0&&j.host===void 0&&j.port===void 0&&!j.path&&j.query===void 0)j.reference="same-document";else if(j.scheme===void 0)j.reference="relative";else if(j.fragment===void 0)j.reference="absolute";else j.reference="uri";if(P.reference&&P.reference!=="suffix"&&P.reference!==j.reference)j.error=j.error||"URI is not a "+P.reference+" reference.";var m=Ov[(P.scheme||j.scheme||"").toLowerCase()];if(!P.unicodeSupport&&(!m||!m.unicodeSupport)){if(j.host&&(P.domainHost||m&&m.domainHost))try{j.host=Yv.toASCII(j.host.replace(F.PCT_ENCODED,yv).toLowerCase())}catch(e){j.error=j.error||"Host's domain name can not be converted to ASCII via punycode: "+e}Vf(j,B)}else Vf(j,F);if(m&&m.parse)m.parse(j,P)}else j.error=j.error||"URI can not be parsed.";return j}function jf(V,P){var j=P.iri!==!1?z:B,F=[];if(V.userinfo!==void 0)F.push(V.userinfo),F.push("@");if(V.host!==void 0)F.push(jv(Uv(String(V.host),j),j).replace(j.IPV6ADDRESS,function(A,m,e){return"["+m+(e?"%25"+e:"")+"]"}));if(typeof V.port==="number"||typeof V.port==="string")F.push(":"),F.push(String(V.port));return F.length?F.join(""):void 0}var Kf=/^\.\.?\//,Rf=/^\/\.(\/|$)/,kf=/^\/\.\.(\/|$)/,_v=/^\/?(?:.|\n)*?(?=\/|$)/;function mv(V){var P=[];while(V.length)if(V.match(Kf))V=V.replace(Kf,"");else if(V.match(Rf))V=V.replace(Rf,"/");else if(V.match(kf))V=V.replace(kf,"/"),P.pop();else if(V==="."||V==="..")V="";else{var j=V.match(_v);if(j){var F=j[0];V=V.slice(F.length),P.push(F)}else throw new Error("Unexpected dot segment condition")}return P.join("")}function Zv(V){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j=P.iri?z:B,F=[],A=Ov[(P.scheme||V.scheme||"").toLowerCase()];if(A&&A.serialize)A.serialize(V,P);if(V.host){if(j.IPV6ADDRESS.test(V.host));else if(P.domainHost||A&&A.domainHost)try{V.host=!P.iri?Yv.toASCII(V.host.replace(j.PCT_ENCODED,yv).toLowerCase()):Yv.toUnicode(V.host)}catch(Xv){V.error=V.error||"Host's domain name can not be converted to "+(!P.iri?"ASCII":"Unicode")+" via punycode: "+Xv}}if(Vf(V,j),P.reference!=="suffix"&&V.scheme)F.push(V.scheme),F.push(":");var m=jf(V,P);if(m!==void 0){if(P.reference!=="suffix")F.push("//");if(F.push(m),V.path&&V.path.charAt(0)!=="/")F.push("/")}if(V.path!==void 0){var e=V.path;if(!P.absolutePath&&(!A||!A.absolutePath))e=mv(e);if(m===void 0)e=e.replace(/^\/\//,"/%2F");F.push(e)}if(V.query!==void 0)F.push("?"),F.push(V.query);if(V.fragment!==void 0)F.push("#"),F.push(V.fragment);return F.join("")}function lv(V,P){var j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},F=arguments[3],A={};if(!F)V=Gv(Zv(V,j),j),P=Gv(Zv(P,j),j);if(j=j||{},!j.tolerant&&P.scheme)A.scheme=P.scheme,A.userinfo=P.userinfo,A.host=P.host,A.port=P.port,A.path=mv(P.path||""),A.query=P.query;else{if(P.userinfo!==void 0||P.host!==void 0||P.port!==void 0)A.userinfo=P.userinfo,A.host=P.host,A.port=P.port,A.path=mv(P.path||""),A.query=P.query;else{if(!P.path)if(A.path=V.path,P.query!==void 0)A.query=P.query;else A.query=V.query;else{if(P.path.charAt(0)==="/")A.path=mv(P.path);else{if((V.userinfo!==void 0||V.host!==void 0||V.port!==void 0)&&!V.path)A.path="/"+P.path;else if(!V.path)A.path=P.path;else A.path=V.path.slice(0,V.path.lastIndexOf("/")+1)+P.path;A.path=mv(A.path)}A.query=P.query}A.userinfo=V.userinfo,A.host=V.host,A.port=V.port}A.scheme=V.scheme}return A.fragment=P.fragment,A}function Jf(V,P,j){var F=Y({scheme:"null"},j);return Zv(lv(Gv(V,F),Gv(P,F),F,!0),F)}function xv(V,P){if(typeof V==="string")V=Zv(Gv(V,P),P);else if(J(V)==="object")V=Gv(Zv(V,P),P);return V}function y1(V,P,j){if(typeof V==="string")V=Zv(Gv(V,j),j);else if(J(V)==="object")V=Zv(V,j);if(typeof P==="string")P=Zv(Gv(P,j),j);else if(J(P)==="object")P=Zv(P,j);return V===P}function kQ(V,P){return V&&V.toString().replace(!P||!P.iri?B.ESCAPE:z.ESCAPE,gv)}function iv(V,P){return V&&V.toString().replace(!P||!P.iri?B.PCT_ENCODED:z.PCT_ENCODED,yv)}var z1={scheme:"http",domainHost:!0,parse:function V(P,j){if(!P.host)P.error=P.error||"HTTP URIs must have a host.";return P},serialize:function V(P,j){var F=String(P.scheme).toLowerCase()==="https";if(P.port===(F?443:80)||P.port==="")P.port=void 0;if(!P.path)P.path="/";return P}},m0={scheme:"https",domainHost:z1.domainHost,parse:z1.parse,serialize:z1.serialize};function a0(V){return typeof V.secure==="boolean"?V.secure:String(V.scheme).toLowerCase()==="wss"}var $1={scheme:"ws",domainHost:!0,parse:function V(P,j){var F=P;return F.secure=a0(F),F.resourceName=(F.path||"/")+(F.query?"?"+F.query:""),F.path=void 0,F.query=void 0,F},serialize:function V(P,j){if(P.port===(a0(P)?443:80)||P.port==="")P.port=void 0;if(typeof P.secure==="boolean")P.scheme=P.secure?"wss":"ws",P.secure=void 0;if(P.resourceName){var F=P.resourceName.split("?"),A=K(F,2),m=A[0],e=A[1];P.path=m&&m!=="/"?m:void 0,P.query=e,P.resourceName=void 0}return P.fragment=void 0,P}},c0={scheme:"wss",domainHost:$1.domainHost,parse:$1.parse,serialize:$1.serialize},pJ={},iJ=!0,n0="[A-Za-z0-9\\-\\.\\_\\~"+(iJ?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Xf="[0-9A-Fa-f]",dJ=W(W("%[EFef]"+Xf+"%"+Xf+Xf+"%"+Xf+Xf)+"|"+W("%[89A-Fa-f]"+Xf+"%"+Xf+Xf)+"|"+W("%"+Xf+Xf)),oJ="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",sJ="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",tJ=v(sJ,"[\\\"\\\\]"),eJ="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",v6=new RegExp(n0,"g"),mf=new RegExp(dJ,"g"),f6=new RegExp(v("[^]",oJ,"[\\.]","[\\\"]",tJ),"g"),p0=new RegExp(v("[^]",n0,eJ),"g"),Q6=p0;function SQ(V){var P=yv(V);return!P.match(v6)?V:P}var i0={scheme:"mailto",parse:function V(P,j){var F=P,A=F.to=F.path?F.path.split(","):[];if(F.path=void 0,F.query){var m=!1,e={},Xv=F.query.split("&");for(var Bv=0,Hv=Xv.length;Bv<Hv;++Bv){var Jv=Xv[Bv].split("=");switch(Jv[0]){case"to":var Nv=Jv[1].split(",");for(var Fv=0,Lv=Nv.length;Fv<Lv;++Fv)A.push(Nv[Fv]);break;case"subject":F.subject=iv(Jv[1],j);break;case"body":F.body=iv(Jv[1],j);break;default:m=!0,e[iv(Jv[0],j)]=iv(Jv[1],j);break}}if(m)F.headers=e}F.query=void 0;for(var wv=0,Dv=A.length;wv<Dv;++wv){var qv=A[wv].split("@");if(qv[0]=iv(qv[0]),!j.unicodeSupport)try{qv[1]=Yv.toASCII(iv(qv[1],j).toLowerCase())}catch(Sf){F.error=F.error||"Email address's domain name can not be converted to ASCII via punycode: "+Sf}else qv[1]=iv(qv[1],j).toLowerCase();A[wv]=qv.join("@")}return F},serialize:function V(P,j){var F=P,A=X(P.to);if(A){for(var m=0,e=A.length;m<e;++m){var Xv=String(A[m]),Bv=Xv.lastIndexOf("@"),Hv=Xv.slice(0,Bv).replace(mf,SQ).replace(mf,Q).replace(f6,gv),Jv=Xv.slice(Bv+1);try{Jv=!j.iri?Yv.toASCII(iv(Jv,j).toLowerCase()):Yv.toUnicode(Jv)}catch(wv){F.error=F.error||"Email address's domain name can not be converted to "+(!j.iri?"ASCII":"Unicode")+" via punycode: "+wv}A[m]=Hv+"@"+Jv}F.path=A.join(",")}var Nv=P.headers=P.headers||{};if(P.subject)Nv.subject=P.subject;if(P.body)Nv.body=P.body;var Fv=[];for(var Lv in Nv)if(Nv[Lv]!==pJ[Lv])Fv.push(Lv.replace(mf,SQ).replace(mf,Q).replace(p0,gv)+"="+Nv[Lv].replace(mf,SQ).replace(mf,Q).replace(Q6,gv));if(Fv.length)F.query=Fv.join("&");return F}},W6=/^([^\:]+)\:(.*)/,d0={scheme:"urn",parse:function V(P,j){var F=P.path&&P.path.match(W6),A=P;if(F){var m=j.scheme||A.scheme||"urn",e=F[1].toLowerCase(),Xv=F[2],Bv=m+":"+(j.nid||e),Hv=Ov[Bv];if(A.nid=e,A.nss=Xv,A.path=void 0,Hv)A=Hv.parse(A,j)}else A.error=A.error||"URN can not be parsed.";return A},serialize:function V(P,j){var F=j.scheme||P.scheme||"urn",A=P.nid,m=F+":"+(j.nid||A),e=Ov[m];if(e)P=e.serialize(P,j);var Xv=P,Bv=P.nss;return Xv.path=(A||j.nid)+":"+Bv,Xv}},J6=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,o0={scheme:"urn:uuid",parse:function V(P,j){var F=P;if(F.uuid=F.nss,F.nss=void 0,!j.tolerant&&(!F.uuid||!F.uuid.match(J6)))F.error=F.error||"UUID is not valid.";return F},serialize:function V(P,j){var F=P;return F.nss=(P.uuid||"").toLowerCase(),F}};Ov[z1.scheme]=z1,Ov[m0.scheme]=m0,Ov[$1.scheme]=$1,Ov[c0.scheme]=c0,Ov[i0.scheme]=i0,Ov[d0.scheme]=d0,Ov[o0.scheme]=o0,f.SCHEMES=Ov,f.pctEncChar=gv,f.pctDecChars=yv,f.parse=Gv,f.removeDotSegments=mv,f.serialize=Zv,f.resolveComponents=lv,f.resolve=Jf,f.normalize=xv,f.equal=y1,f.escapeComponent=kQ,f.unescapeComponent=iv,Object.defineProperty(f,"__esModule",{value:!0})})});var XQ=s((v4,y8)=>{y8.exports=function f(v,W){if(v===W)return!0;if(v&&W&&typeof v=="object"&&typeof W=="object"){if(v.constructor!==W.constructor)return!1;var J,Q,X;if(Array.isArray(v)){if(J=v.length,J!=W.length)return!1;for(Q=J;Q--!==0;)if(!f(v[Q],W[Q]))return!1;return!0}if(v.constructor===RegExp)return v.source===W.source&&v.flags===W.flags;if(v.valueOf!==Object.prototype.valueOf)return v.valueOf()===W.valueOf();if(v.toString!==Object.prototype.toString)return v.toString()===W.toString();if(X=Object.keys(v),J=X.length,J!==Object.keys(W).length)return!1;for(Q=J;Q--!==0;)if(!Object.prototype.hasOwnProperty.call(W,X[Q]))return!1;for(Q=J;Q--!==0;){var Y=X[Q];if(!f(v[Y],W[Y]))return!1}return!0}return v!==v&&W!==W}});var I8=s((f4,l8)=>{l8.exports=function f(v){var W=0,J=v.length,Q=0,X;while(Q<J)if(W++,X=v.charCodeAt(Q++),X>=55296&&X<=56319&&Q<J){if(X=v.charCodeAt(Q),(X&64512)==56320)Q++}return W}});var uf=s((Q4,T8)=>{T8.exports={copy:MX,checkDataType:f0,checkDataTypes:NX,coerceToTypes:DX,toHash:W0,getProperty:J0,escapeQuotes:X0,equal:XQ(),ucs2length:I8(),varOccurences:EX,varReplace:OX,schemaHasRules:UX,schemaHasRulesExcept:HX,schemaUnknownRules:FX,toQuotedString:Q0,getPathExpr:AX,getPath:gX,getData:bX,unescapeFragment:RX,unescapeJsonPointer:w0,escapeFragment:kX,escapeJsonPointer:Y0};function MX(f,v){v=v||{};for(var W in f)v[W]=f[W];return v}function f0(f,v,W,J){var Q=J?" !== ":" === ",X=J?" || ":" && ",Y=J?"!":"",w=J?"":"!";switch(f){case"null":return v+Q+"null";case"array":return Y+"Array.isArray("+v+")";case"object":return"("+Y+v+X+"typeof "+v+Q+'"object"'+X+w+"Array.isArray("+v+"))";case"integer":return"(typeof "+v+Q+'"number"'+X+w+"("+v+" % 1)"+X+v+Q+v+(W?X+Y+"isFinite("+v+")":"")+")";case"number":return"(typeof "+v+Q+'"'+f+'"'+(W?X+Y+"isFinite("+v+")":"")+")";default:return"typeof "+v+Q+'"'+f+'"'}}function NX(f,v,W){switch(f.length){case 1:return f0(f[0],v,W,!0);default:var J="",Q=W0(f);if(Q.array&&Q.object)J=Q.null?"(":"(!"+v+" || ",J+="typeof "+v+' !== "object")',delete Q.null,delete Q.array,delete Q.object;if(Q.number)delete Q.integer;for(var X in Q)J+=(J?" && ":"")+f0(X,v,W,!0);return J}}var Z8=W0(["string","number","integer","boolean","null"]);function DX(f,v){if(Array.isArray(v)){var W=[];for(var J=0;J<v.length;J++){var Q=v[J];if(Z8[Q])W[W.length]=Q;else if(f==="array"&&Q==="array")W[W.length]=Q}if(W.length)return W}else if(Z8[v])return[v];else if(f==="array"&&v==="array")return["array"]}function W0(f){var v={};for(var W=0;W<f.length;W++)v[f[W]]=!0;return v}var VX=/^[a-z$_][a-z$_0-9]*$/i,jX=/'|\\/g;function J0(f){return typeof f=="number"?"["+f+"]":VX.test(f)?"."+f:"['"+X0(f)+"']"}function X0(f){return f.replace(jX,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function EX(f,v){v+="[^0-9]";var W=f.match(new RegExp(v,"g"));return W?W.length:0}function OX(f,v,W){return v+="([^0-9])",W=W.replace(/\$/g,"$$$$"),f.replace(new RegExp(v,"g"),W+"$1")}function UX(f,v){if(typeof f=="boolean")return!f;for(var W in f)if(v[W])return!0}function HX(f,v,W){if(typeof f=="boolean")return!f&&W!="not";for(var J in f)if(J!=W&&v[J])return!0}function FX(f,v){if(typeof f=="boolean")return;for(var W in f)if(!v[W])return W}function Q0(f){return"'"+X0(f)+"'"}function AX(f,v,W,J){var Q=W?"'/' + "+v+(J?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):J?"'[' + "+v+" + ']'":"'[\\'' + "+v+" + '\\']'";return C8(f,Q)}function gX(f,v,W){var J=W?Q0("/"+Y0(v)):Q0(J0(v));return C8(f,J)}var _X=/^\/(?:[^~]|~0|~1)*$/,hX=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function bX(f,v,W){var J,Q,X,Y;if(f==="")return"rootData";if(f[0]=="/"){if(!_X.test(f))throw new Error("Invalid JSON-pointer: "+f);Q=f,X="rootData"}else{if(Y=f.match(hX),!Y)throw new Error("Invalid JSON-pointer: "+f);if(J=+Y[1],Q=Y[2],Q=="#"){if(J>=v)throw new Error("Cannot access property/index "+J+" levels up, current level is "+v);return W[v-J]}if(J>v)throw new Error("Cannot access data "+J+" levels up, current level is "+v);if(X="data"+(v-J||""),!Q)return X}var w=X,B=Q.split("/");for(var z=0;z<B.length;z++){var K=B[z];if(K)X+=J0(w0(K)),w+=" && "+X}return w}function C8(f,v){if(f=='""')return v;return(f+" + "+v).replace(/([^\\])' \+ '/g,"$1")}function RX(f){return w0(decodeURIComponent(f))}function kX(f){return encodeURIComponent(Y0(f))}function Y0(f){return f.replace(/~/g,"~0").replace(/\//g,"~1")}function w0(f){return f.replace(/~1/g,"/").replace(/~0/g,"~")}});var G0=s((W4,x8)=>{var SX=uf();x8.exports=yX;function yX(f){SX.copy(f,this)}});var r8=s((J4,u8)=>{var gf=u8.exports=function(f,v,W){if(typeof v=="function")W=v,v={};W=v.cb||W;var J=typeof W=="function"?W:W.pre||function(){},Q=W.post||function(){};YQ(v,J,Q,f,"",f)};gf.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};gf.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};gf.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};gf.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 YQ(f,v,W,J,Q,X,Y,w,B,z){if(J&&typeof J=="object"&&!Array.isArray(J)){v(J,Q,X,Y,w,B,z);for(var K in J){var L=J[K];if(Array.isArray(L)){if(K in gf.arrayKeywords)for(var D=0;D<L.length;D++)YQ(f,v,W,L[D],Q+"/"+K+"/"+D,X,Q,K,J,D)}else if(K in gf.propsKeywords){if(L&&typeof L=="object")for(var q in L)YQ(f,v,W,L[q],Q+"/"+K+"/"+lX(q),X,Q,K,J,q)}else if(K in gf.keywords||f.allKeys&&!(K in gf.skipKeywords))YQ(f,v,W,L,Q+"/"+K,X,Q,K,J)}W(J,Q,X,Y,w,B,z)}}function lX(f){return f.replace(/~/g,"~0").replace(/\//g,"~1")}});var KQ=s((X4,n8)=>{var R1=S8(),m8=XQ(),qQ=uf(),wQ=G0(),IX=r8();n8.exports=hf;hf.normalizeId=_f;hf.fullPath=GQ;hf.url=BQ;hf.ids=uX;hf.inlineRef=B0;hf.schema=PQ;function hf(f,v,W){var J=this._refs[W];if(typeof J=="string")if(this._refs[J])J=this._refs[J];else return hf.call(this,f,v,J);if(J=J||this._schemas[W],J instanceof wQ)return B0(J.schema,this._opts.inlineRefs)?J.schema:J.validate||this._compile(J);var Q=PQ.call(this,v,W),X,Y,w;if(Q)X=Q.schema,v=Q.root,w=Q.baseId;if(X instanceof wQ)Y=X.validate||f.call(this,X.schema,v,void 0,w);else if(X!==void 0)Y=B0(X,this._opts.inlineRefs)?X:f.call(this,X,v,void 0,w);return Y}function PQ(f,v){var W=R1.parse(v),J=c8(W),Q=GQ(this._getId(f.schema));if(Object.keys(f.schema).length===0||J!==Q){var X=_f(J),Y=this._refs[X];if(typeof Y=="string")return ZX.call(this,f,Y,W);else if(Y instanceof wQ){if(!Y.validate)this._compile(Y);f=Y}else if(Y=this._schemas[X],Y instanceof wQ){if(!Y.validate)this._compile(Y);if(X==_f(v))return{schema:Y,root:f,baseId:Q};f=Y}else return;if(!f.schema)return;Q=GQ(this._getId(f.schema))}return a8.call(this,W,Q,f.schema,f)}function ZX(f,v,W){var J=PQ.call(this,f,v);if(J){var{schema:Q,baseId:X}=J;f=J.root;var Y=this._getId(Q);if(Y)X=BQ(X,Y);return a8.call(this,W,X,Q,f)}}var CX=qQ.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function a8(f,v,W,J){if(f.fragment=f.fragment||"",f.fragment.slice(0,1)!="/")return;var Q=f.fragment.split("/");for(var X=1;X<Q.length;X++){var Y=Q[X];if(Y){if(Y=qQ.unescapeFragment(Y),W=W[Y],W===void 0)break;var w;if(!CX[Y]){if(w=this._getId(W),w)v=BQ(v,w);if(W.$ref){var B=BQ(v,W.$ref),z=PQ.call(this,J,B);if(z)W=z.schema,J=z.root,v=z.baseId}}}}if(W!==void 0&&W!==J.schema)return{schema:W,root:J,baseId:v}}var TX=qQ.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function B0(f,v){if(v===!1)return!1;if(v===void 0||v===!0)return q0(f);else if(v)return P0(f)<=v}function q0(f){var v;if(Array.isArray(f)){for(var W=0;W<f.length;W++)if(v=f[W],typeof v=="object"&&!q0(v))return!1}else for(var J in f){if(J=="$ref")return!1;if(v=f[J],typeof v=="object"&&!q0(v))return!1}return!0}function P0(f){var v=0,W;if(Array.isArray(f))for(var J=0;J<f.length;J++){if(W=f[J],typeof W=="object")v+=P0(W);if(v==1/0)return 1/0}else for(var Q in f){if(Q=="$ref")return 1/0;if(TX[Q])v++;else{if(W=f[Q],typeof W=="object")v+=P0(W)+1;if(v==1/0)return 1/0}}return v}function GQ(f,v){if(v!==!1)f=_f(f);var W=R1.parse(f);return c8(W)}function c8(f){return R1.serialize(f).split("#")[0]+"#"}var xX=/#\/?$/;function _f(f){return f?f.replace(xX,""):""}function BQ(f,v){return v=_f(v),R1.resolve(f,v)}function uX(f){var v=_f(this._getId(f)),W={"":v},J={"":GQ(v,!1)},Q={},X=this;return IX(f,{allKeys:!0},function(Y,w,B,z,K,L,D){if(w==="")return;var q=X._getId(Y),M=W[z],N=J[z]+"/"+K;if(D!==void 0)N+="/"+(typeof D=="number"?D:qQ.escapeFragment(D));if(typeof q=="string"){q=M=_f(M?R1.resolve(M,q):q);var $=X._refs[q];if(typeof $=="string")$=X._refs[$];if($&&$.schema){if(!m8(Y,$.schema))throw new Error('id "'+q+'" resolves to more than one schema')}else if(q!=_f(N))if(q[0]=="#"){if(Q[q]&&!m8(Y,Q[q]))throw new Error('id "'+q+'" resolves to more than one schema');Q[q]=Y}else X._refs[q]=N}W[w]=M,J[w]=N}),Q}});var zQ=s((Y4,i8)=>{var K0=KQ();i8.exports={Validation:p8(rX),MissingRef:p8(z0)};function rX(f){this.message="validation failed",this.errors=f,this.ajv=this.validation=!0}z0.message=function(f,v){return"can't resolve reference "+v+" from id "+f};function z0(f,v,W){this.message=W||z0.message(f,v),this.missingRef=K0.url(f,v),this.missingSchema=K0.normalizeId(K0.fullPath(this.missingRef))}function p8(f){return f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f}});var $0=s((w4,d8)=>{d8.exports=function(f,v){if(!v)v={};if(typeof v==="function")v={cmp:v};var W=typeof v.cycles==="boolean"?v.cycles:!1,J=v.cmp&&function(X){return function(Y){return function(w,B){var z={key:w,value:Y[w]},K={key:B,value:Y[B]};return X(z,K)}}}(v.cmp),Q=[];return function X(Y){if(Y&&Y.toJSON&&typeof Y.toJSON==="function")Y=Y.toJSON();if(Y===void 0)return;if(typeof Y=="number")return isFinite(Y)?""+Y:"null";if(typeof Y!=="object")return JSON.stringify(Y);var w,B;if(Array.isArray(Y)){B="[";for(w=0;w<Y.length;w++){if(w)B+=",";B+=X(Y[w])||"null"}return B+"]"}if(Y===null)return"null";if(Q.indexOf(Y)!==-1){if(W)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var z=Q.push(Y)-1,K=Object.keys(Y).sort(J&&J(Y));B="";for(w=0;w<K.length;w++){var L=K[w],D=X(Y[L]);if(!D)continue;if(B)B+=",";B+=JSON.stringify(L)+":"+D}return Q.splice(z,1),"{"+B+"}"}(f)}});var L0=s((G4,o8)=>{o8.exports=function f(v,W,J){var Q="",X=v.schema.$async===!0,Y=v.util.schemaHasRulesExcept(v.schema,v.RULES.all,"$ref"),w=v.self._getId(v.schema);if(v.opts.strictKeywords){var B=v.util.schemaUnknownRules(v.schema,v.RULES.keywords);if(B){var z="unknown keyword: "+B;if(v.opts.strictKeywords==="log")v.logger.warn(z);else throw new Error(z)}}if(v.isTop){if(Q+=" var validate = ",X)v.async=!0,Q+="async ";if(Q+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",w&&(v.opts.sourceCode||v.opts.processCode))Q+=" "+("/*# sourceURL="+w+" */")+" "}if(typeof v.schema=="boolean"||!(Y||v.schema.$ref)){var W="false schema",K=v.level,L=v.dataLevel,D=v.schema[W],q=v.schemaPath+v.util.getProperty(W),M=v.errSchemaPath+"/"+W,l=!v.opts.allErrors,g,N="data"+(L||""),k="valid"+K;if(v.schema===!1){if(v.isTop)l=!0;else Q+=" var "+k+" = false; ";var $=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(g||"false schema")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(M)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'boolean schema is false' ";if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+N+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&l)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else if(v.isTop)if(X)Q+=" return data; ";else Q+=" validate.errors = null; return true; ";else Q+=" var "+k+" = true; ";if(v.isTop)Q+=" }; return validate; ";return Q}if(v.isTop){var h=v.isTop,K=v.level=0,L=v.dataLevel=0,N="data";if(v.rootId=v.resolve.fullPath(v.self._getId(v.root.schema)),v.baseId=v.baseId||v.rootId,delete v.isTop,v.dataPathArr=[""],v.schema.default!==void 0&&v.opts.useDefaults&&v.opts.strictDefaults){var H="default is ignored in the schema root";if(v.opts.strictDefaults==="log")v.logger.warn(H);else throw new Error(H)}Q+=" var vErrors = null; ",Q+=" var errors = 0; ",Q+=" if (rootData === undefined) rootData = data; "}else{var{level:K,dataLevel:L}=v,N="data"+(L||"");if(w)v.baseId=v.resolve.url(v.baseId,w);if(X&&!v.async)throw new Error("async schema in sync schema");Q+=" var errs_"+K+" = errors;"}var k="valid"+K,l=!v.opts.allErrors,T="",E="",g,U=v.schema.type,b=Array.isArray(U);if(U&&v.opts.nullable&&v.schema.nullable===!0){if(b){if(U.indexOf("null")==-1)U=U.concat("null")}else if(U!="null")U=[U,"null"],b=!0}if(b&&U.length==1)U=U[0],b=!1;if(v.schema.$ref&&Y){if(v.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+v.errSchemaPath+'" (see option extendRefs)');else if(v.opts.extendRefs!==!0)Y=!1,v.logger.warn('$ref: keywords ignored in schema at path "'+v.errSchemaPath+'"')}if(v.schema.$comment&&v.opts.$comment)Q+=" "+v.RULES.all.$comment.code(v,"$comment");if(U){if(v.opts.coerceTypes)var I=v.util.coerceToTypes(v.opts.coerceTypes,U);var S=v.RULES.types[U];if(I||b||S===!0||S&&!_v(S)){var q=v.schemaPath+".type",M=v.errSchemaPath+"/type",q=v.schemaPath+".type",M=v.errSchemaPath+"/type",_=b?"checkDataTypes":"checkDataType";if(Q+=" if ("+v.util[_](U,N,v.opts.strictNumbers,!0)+") { ",I){var R="dataType"+K,y="coerced"+K;if(Q+=" var "+R+" = typeof "+N+"; var "+y+" = undefined; ",v.opts.coerceTypes=="array")Q+=" if ("+R+" == 'object' && Array.isArray("+N+") && "+N+".length == 1) { "+N+" = "+N+"[0]; "+R+" = typeof "+N+"; if ("+v.util.checkDataType(v.schema.type,N,v.opts.strictNumbers)+") "+y+" = "+N+"; } ";Q+=" if ("+y+" !== undefined) ; ";var r=I;if(r){var a,i=-1,p=r.length-1;while(i<p)if(a=r[i+=1],a=="string")Q+=" else if ("+R+" == 'number' || "+R+" == 'boolean') "+y+" = '' + "+N+"; else if ("+N+" === null) "+y+" = ''; ";else if(a=="number"||a=="integer"){if(Q+=" else if ("+R+" == 'boolean' || "+N+" === null || ("+R+" == 'string' && "+N+" && "+N+" == +"+N+" ",a=="integer")Q+=" && !("+N+" % 1)";Q+=")) "+y+" = +"+N+"; "}else if(a=="boolean")Q+=" else if ("+N+" === 'false' || "+N+" === 0 || "+N+" === null) "+y+" = false; else if ("+N+" === 'true' || "+N+" === 1) "+y+" = true; ";else if(a=="null")Q+=" else if ("+N+" === '' || "+N+" === 0 || "+N+" === false) "+y+" = null; ";else if(v.opts.coerceTypes=="array"&&a=="array")Q+=" else if ("+R+" == 'string' || "+R+" == 'number' || "+R+" == 'boolean' || "+N+" == null) "+y+" = ["+N+"]; "}Q+=" else { ";var $=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(g||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(M)+" , params: { type: '",b)Q+=""+U.join(",");else Q+=""+U;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",b)Q+=""+U.join(",");else Q+=""+U;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+q+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+N+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&l)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } if ("+y+" !== undefined) { ";var n=L?"data"+(L-1||""):"parentData",$v=L?v.dataPathArr[L]:"parentDataProperty";if(Q+=" "+N+" = "+y+"; ",!L)Q+="if ("+n+" !== undefined)";Q+=" "+n+"["+$v+"] = "+y+"; } "}else{var $=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(g||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(M)+" , params: { type: '",b)Q+=""+U.join(",");else Q+=""+U;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",b)Q+=""+U.join(",");else Q+=""+U;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+q+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+N+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&l)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}Q+=" } "}}if(v.schema.$ref&&!Y){if(Q+=" "+v.RULES.all.$ref.code(v,"$ref")+" ",l){if(Q+=" } if (errors === ",h)Q+="0";else Q+="errs_"+K;Q+=") { ",E+="}"}}else{var bv=v.RULES;if(bv){var S,Sv=-1,Yv=bv.length-1;while(Sv<Yv)if(S=bv[Sv+=1],_v(S)){if(S.type)Q+=" if ("+v.util.checkDataType(S.type,N,v.opts.strictNumbers)+") { ";if(v.opts.useDefaults){if(S.type=="object"&&v.schema.properties){var D=v.schema.properties,Ov=Object.keys(D),gv=Ov;if(gv){var yv,Vf=-1,Pf=gv.length-1;while(Vf<Pf){yv=gv[Vf+=1];var Uv=D[yv];if(Uv.default!==void 0){var jv=N+v.util.getProperty(yv);if(v.compositeRule){if(v.opts.strictDefaults){var H="default is ignored for: "+jv;if(v.opts.strictDefaults==="log")v.logger.warn(H);else throw new Error(H)}}else{if(Q+=" if ("+jv+" === undefined ",v.opts.useDefaults=="empty")Q+=" || "+jv+" === null || "+jv+" === '' ";if(Q+=" ) "+jv+" = ",v.opts.useDefaults=="shared")Q+=" "+v.useDefault(Uv.default)+" ";else Q+=" "+JSON.stringify(Uv.default)+" ";Q+="; "}}}}}else if(S.type=="array"&&Array.isArray(v.schema.items)){var bf=v.schema.items;if(bf){var Uv,i=-1,Rv=bf.length-1;while(i<Rv)if(Uv=bf[i+=1],Uv.default!==void 0){var jv=N+"["+i+"]";if(v.compositeRule){if(v.opts.strictDefaults){var H="default is ignored for: "+jv;if(v.opts.strictDefaults==="log")v.logger.warn(H);else throw new Error(H)}}else{if(Q+=" if ("+jv+" === undefined ",v.opts.useDefaults=="empty")Q+=" || "+jv+" === null || "+jv+" === '' ";if(Q+=" ) "+jv+" = ",v.opts.useDefaults=="shared")Q+=" "+v.useDefault(Uv.default)+" ";else Q+=" "+JSON.stringify(Uv.default)+" ";Q+="; "}}}}}var Gv=S.rules;if(Gv){var jf,Kf=-1,Rf=Gv.length-1;while(Kf<Rf)if(jf=Gv[Kf+=1],mv(jf)){var kf=jf.code(v,jf.keyword,S.type);if(kf){if(Q+=" "+kf+" ",l)T+="}"}}}if(l)Q+=" "+T+" ",T="";if(S.type){if(Q+=" } ",U&&U===S.type&&!I){Q+=" else { ";var q=v.schemaPath+".type",M=v.errSchemaPath+"/type",$=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(g||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(M)+" , params: { type: '",b)Q+=""+U.join(",");else Q+=""+U;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",b)Q+=""+U.join(",");else Q+=""+U;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+q+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+N+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&l)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } "}}if(l){if(Q+=" if (errors === ",h)Q+="0";else Q+="errs_"+K;Q+=") { ",E+="}"}}}}if(l)Q+=" "+E+" ";if(h){if(X)Q+=" if (errors === 0) return data; ",Q+=" else throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; ",Q+=" return errors === 0; ";Q+=" }; return validate;"}else Q+=" var "+k+" = errors === errs_"+K+";";function _v(lv){var Jf=lv.rules;for(var xv=0;xv<Jf.length;xv++)if(mv(Jf[xv]))return!0}function mv(lv){return v.schema[lv.keyword]!==void 0||lv.implements&&Zv(lv)}function Zv(lv){var Jf=lv.implements;for(var xv=0;xv<Jf.length;xv++)if(v.schema[Jf[xv]]!==void 0)return!0}return Q}});var fW=s((B4,vW)=>{var $Q=KQ(),MQ=uf(),t8=zQ(),mX=$0(),s8=L0(),aX=MQ.ucs2length,cX=XQ(),nX=t8.Validation;vW.exports=M0;function M0(f,v,W,J){var Q=this,X=this._opts,Y=[void 0],w={},B=[],z={},K=[],L={},D=[];v=v||{schema:f,refVal:Y,refs:w};var q=pX.call(this,f,v,J),M=this._compilations[q.index];if(q.compiling)return M.callValidate=H;var N=this._formats,$=this.RULES;try{var O=k(f,v,W,J);M.validate=O;var h=M.callValidate;if(h){if(h.schema=O.schema,h.errors=null,h.refs=O.refs,h.refVal=O.refVal,h.root=O.root,h.$async=O.$async,X.sourceCode)h.source=O.source}return O}finally{iX.call(this,f,v,J)}function H(){var _=M.validate,R=_.apply(this,arguments);return H.errors=_.errors,R}function k(_,R,y,r){var a=!R||R&&R.schema==_;if(R.schema!=v.schema)return M0.call(Q,_,R,y,r);var i=_.$async===!0,p=s8({isTop:!0,schema:_,isRoot:a,baseId:r,root:R,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:t8.MissingRef,RULES:$,validate:s8,util:MQ,resolve:$Q,resolveRef:l,usePattern:b,useDefault:I,useCustomRule:S,opts:X,formats:N,logger:Q.logger,self:Q});if(p=LQ(Y,sX)+LQ(B,dX)+LQ(K,oX)+LQ(D,tX)+p,X.processCode)p=X.processCode(p,_);var n;try{var $v=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",p);n=$v(Q,$,N,v,Y,K,D,cX,aX,nX),Y[0]=n}catch(bv){throw Q.logger.error("Error compiling schema, function code:",p),bv}if(n.schema=_,n.errors=null,n.refs=w,n.refVal=Y,n.root=a?n:R,i)n.$async=!0;if(X.sourceCode===!0)n.source={code:p,patterns:B,defaults:K};return n}function l(_,R,y){R=$Q.url(_,R);var r=w[R],a,i;if(r!==void 0)return a=Y[r],i="refVal["+r+"]",U(a,i);if(!y&&v.refs){var p=v.refs[R];if(p!==void 0)return a=v.refVal[p],i=T(R,a),U(a,i)}i=T(R);var n=$Q.call(Q,k,v,R);if(n===void 0){var $v=W&&W[R];if($v)n=$Q.inlineRef($v,X.inlineRefs)?$v:M0.call(Q,$v,v,W,_)}if(n===void 0)E(R);else return g(R,n),U(n,i)}function T(_,R){var y=Y.length;return Y[y]=R,w[_]=y,"refVal"+y}function E(_){delete w[_]}function g(_,R){var y=w[_];Y[y]=R}function U(_,R){return typeof _=="object"||typeof _=="boolean"?{code:R,schema:_,inline:!0}:{code:R,$async:_&&!!_.$async}}function b(_){var R=z[_];if(R===void 0)R=z[_]=B.length,B[R]=_;return"pattern"+R}function I(_){switch(typeof _){case"boolean":case"number":return""+_;case"string":return MQ.toQuotedString(_);case"object":if(_===null)return"null";var R=mX(_),y=L[R];if(y===void 0)y=L[R]=K.length,K[y]=_;return"default"+y}}function S(_,R,y,r){if(Q._opts.validateSchema!==!1){var a=_.definition.dependencies;if(a&&!a.every(function(gv){return Object.prototype.hasOwnProperty.call(y,gv)}))throw new Error("parent schema must have all required keywords: "+a.join(","));var i=_.definition.validateSchema;if(i){var p=i(R);if(!p){var n="keyword schema is invalid: "+Q.errorsText(i.errors);if(Q._opts.validateSchema=="log")Q.logger.error(n);else throw new Error(n)}}}var $v=_.definition.compile,bv=_.definition.inline,Sv=_.definition.macro,Yv;if($v)Yv=$v.call(Q,R,y,r);else if(Sv){if(Yv=Sv.call(Q,R,y,r),X.validateSchema!==!1)Q.validateSchema(Yv,!0)}else if(bv)Yv=bv.call(Q,r,_.keyword,R,y);else if(Yv=_.definition.validate,!Yv)return;if(Yv===void 0)throw new Error('custom keyword "'+_.keyword+'"failed to compile');var Ov=D.length;return D[Ov]=Yv,{code:"customRule"+Ov,validate:Yv}}}function pX(f,v,W){var J=e8.call(this,f,v,W);if(J>=0)return{index:J,compiling:!0};return J=this._compilations.length,this._compilations[J]={schema:f,root:v,baseId:W},{index:J,compiling:!1}}function iX(f,v,W){var J=e8.call(this,f,v,W);if(J>=0)this._compilations.splice(J,1)}function e8(f,v,W){for(var J=0;J<this._compilations.length;J++){var Q=this._compilations[J];if(Q.schema==f&&Q.root==v&&Q.baseId==W)return J}return-1}function dX(f,v){return"var pattern"+f+" = new RegExp("+MQ.toQuotedString(v[f])+");"}function oX(f){return"var default"+f+" = defaults["+f+"];"}function sX(f,v){return v[f]===void 0?"":"var refVal"+f+" = refVal["+f+"];"}function tX(f){return"var customRule"+f+" = customRules["+f+"];"}function LQ(f,v){if(!f.length)return"";var W="";for(var J=0;J<f.length;J++)W+=v(J,f);return W}});var WW=s((q4,QW)=>{var NQ=QW.exports=function f(){this._cache={}};NQ.prototype.put=function f(v,W){this._cache[v]=W};NQ.prototype.get=function f(v){return this._cache[v]};NQ.prototype.del=function f(v){delete this._cache[v]};NQ.prototype.clear=function f(){this._cache={}}});var LW=s((P4,$W)=>{var eX=uf(),vY=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,fY=[0,31,28,31,30,31,30,31,31,30,31,30,31],QY=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,JW=/^(?=.{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,WY=/^(?:[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,JY=/^(?:[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,XW=/^(?:(?:[^\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,YW=/^(?:(?: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,wW=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,GW=/^(?:\/(?:[^~/]|~0|~1)*)*$/,BW=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,qW=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;$W.exports=DQ;function DQ(f){return f=f=="full"?"full":"fast",eX.copy(DQ[f])}DQ.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":XW,url:YW,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:JW,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:zW,uuid:wW,"json-pointer":GW,"json-pointer-uri-fragment":BW,"relative-json-pointer":qW};DQ.full={date:PW,time:KW,"date-time":wY,uri:BY,"uri-reference":JY,"uri-template":XW,url:YW,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:JW,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:zW,uuid:wW,"json-pointer":GW,"json-pointer-uri-fragment":BW,"relative-json-pointer":qW};function XY(f){return f%4===0&&(f%100!==0||f%400===0)}function PW(f){var v=f.match(vY);if(!v)return!1;var W=+v[1],J=+v[2],Q=+v[3];return J>=1&&J<=12&&Q>=1&&Q<=(J==2&&XY(W)?29:fY[J])}function KW(f,v){var W=f.match(QY);if(!W)return!1;var J=W[1],Q=W[2],X=W[3],Y=W[5];return(J<=23&&Q<=59&&X<=59||J==23&&Q==59&&X==60)&&(!v||Y)}var YY=/t|\s/i;function wY(f){var v=f.split(YY);return v.length==2&&PW(v[0])&&KW(v[1],!0)}var GY=/\/|:/;function BY(f){return GY.test(f)&&WY.test(f)}var qY=/[^\\]\\Z/;function zW(f){if(qY.test(f))return!1;try{return new RegExp(f),!0}catch(v){return!1}}});var NW=s((K4,MW)=>{MW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.errSchemaPath+"/"+W,z=!v.opts.allErrors,K="data"+(Y||""),L="valid"+X,D,q;if(w=="#"||w=="#/")if(v.isRoot)D=v.async,q="validate";else D=v.root.schema.$async===!0,q="root.refVal[0]";else{var M=v.resolveRef(v.baseId,w,v.isRoot);if(M===void 0){var N=v.MissingRefError.message(v.baseId,w);if(v.opts.missingRefs=="fail"){v.logger.error(N);var $=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(B)+" , params: { ref: '"+v.util.escapeQuotes(w)+"' } ",v.opts.messages!==!1)Q+=" , message: 'can\\'t resolve reference "+v.util.escapeQuotes(w)+"' ";if(v.opts.verbose)Q+=" , schema: "+v.util.toQuotedString(w)+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+K+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&z)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(z)Q+=" if (false) { "}else if(v.opts.missingRefs=="ignore"){if(v.logger.warn(N),z)Q+=" if (true) { "}else throw new v.MissingRefError(v.baseId,w,N)}else if(M.inline){var h=v.util.copy(v);h.level++;var H="valid"+h.level;h.schema=M.schema,h.schemaPath="",h.errSchemaPath=w;var k=v.validate(h).replace(/validate\.schema/g,M.code);if(Q+=" "+k+" ",z)Q+=" if ("+H+") { "}else D=M.$async===!0||v.async&&M.$async!==!1,q=M.code}if(q){var $=$||[];if($.push(Q),Q="",v.opts.passContext)Q+=" "+q+".call(this, ";else Q+=" "+q+"( ";if(Q+=" "+K+", (dataPath || '')",v.errorPath!='""')Q+=" + "+v.errorPath;var l=Y?"data"+(Y-1||""):"parentData",T=Y?v.dataPathArr[Y]:"parentDataProperty";Q+=" , "+l+" , "+T+", rootData) ";var E=Q;if(Q=$.pop(),D){if(!v.async)throw new Error("async schema referenced by sync schema");if(z)Q+=" var "+L+"; ";if(Q+=" try { await "+E+"; ",z)Q+=" "+L+" = true; ";if(Q+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",z)Q+=" "+L+" = false; ";if(Q+=" } ",z)Q+=" if ("+L+") { "}else if(Q+=" if (!"+E+") { if (vErrors === null) vErrors = "+q+".errors; else vErrors = vErrors.concat("+q+".errors); errors = vErrors.length; } ",z)Q+=" else { "}return Q}});var VW=s((z4,DW)=>{DW.exports=function f(v,W,J){var Q=" ",X=v.schema[W],Y=v.schemaPath+v.util.getProperty(W),w=v.errSchemaPath+"/"+W,B=!v.opts.allErrors,z=v.util.copy(v),K="";z.level++;var L="valid"+z.level,D=z.baseId,q=!0,M=X;if(M){var N,$=-1,O=M.length-1;while($<O)if(N=M[$+=1],v.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:v.util.schemaHasRules(N,v.RULES.all)){if(q=!1,z.schema=N,z.schemaPath=Y+"["+$+"]",z.errSchemaPath=w+"/"+$,Q+=" "+v.validate(z)+" ",z.baseId=D,B)Q+=" if ("+L+") { ",K+="}"}}if(B)if(q)Q+=" if (true) { ";else Q+=" "+K.slice(0,-1)+" ";return Q}});var EW=s(($4,jW)=>{jW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),D="valid"+X,q="errs__"+X,M=v.util.copy(v),N="";M.level++;var $="valid"+M.level,O=w.every(function(g){return v.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:v.util.schemaHasRules(g,v.RULES.all)});if(O){var h=M.baseId;Q+=" var "+q+" = errors; var "+D+" = false; ";var H=v.compositeRule;v.compositeRule=M.compositeRule=!0;var k=w;if(k){var l,T=-1,E=k.length-1;while(T<E)l=k[T+=1],M.schema=l,M.schemaPath=B+"["+T+"]",M.errSchemaPath=z+"/"+T,Q+=" "+v.validate(M)+" ",M.baseId=h,Q+=" "+D+" = "+D+" || "+$+"; if (!"+D+") { ",N+="}"}if(v.compositeRule=M.compositeRule=H,Q+=" "+N+" if (!"+D+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should match some schema in anyOf' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+=" } else { errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; } ",v.opts.allErrors)Q+=" } "}else if(K)Q+=" if (true) { ";return Q}});var UW=s((L4,OW)=>{OW.exports=function f(v,W,J){var Q=" ",X=v.schema[W],Y=v.errSchemaPath+"/"+W,w=!v.opts.allErrors,B=v.util.toQuotedString(X);if(v.opts.$comment===!0)Q+=" console.log("+B+");";else if(typeof v.opts.$comment=="function")Q+=" self._opts.$comment("+B+", "+v.util.toQuotedString(Y)+", validate.root.schema);";return Q}});var FW=s((M4,HW)=>{HW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),D="valid"+X,q=v.opts.$data&&w&&w.$data,M;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",M="schema"+X;else M=w;if(!q)Q+=" var schema"+X+" = validate.schema"+B+";";Q+="var "+D+" = equal("+L+", schema"+X+"); if (!"+D+") { ";var N=N||[];if(N.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'const' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { allowedValue: schema"+X+" } ",v.opts.messages!==!1)Q+=" , message: 'should be equal to constant' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var $=Q;if(Q=N.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+$+"]); ";else Q+=" validate.errors = ["+$+"]; return false; ";else Q+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" }",K)Q+=" else { ";return Q}});var gW=s((N4,AW)=>{AW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),D="valid"+X,q="errs__"+X,M=v.util.copy(v),N="";M.level++;var $="valid"+M.level,O="i"+X,h=M.dataLevel=v.dataLevel+1,H="data"+h,k=v.baseId,l=v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all);if(Q+="var "+q+" = errors;var "+D+";",l){var T=v.compositeRule;v.compositeRule=M.compositeRule=!0,M.schema=w,M.schemaPath=B,M.errSchemaPath=z,Q+=" var "+$+" = false; for (var "+O+" = 0; "+O+" < "+L+".length; "+O+"++) { ",M.errorPath=v.util.getPathExpr(v.errorPath,O,v.opts.jsonPointers,!0);var E=L+"["+O+"]";M.dataPathArr[h]=O;var g=v.validate(M);if(M.baseId=k,v.util.varOccurences(g,H)<2)Q+=" "+v.util.varReplace(g,H,E)+" ";else Q+=" var "+H+" = "+E+"; "+g+" ";Q+=" if ("+$+") break; } ",v.compositeRule=M.compositeRule=T,Q+=" "+N+" if (!"+$+") {"}else Q+=" if ("+L+".length == 0) {";var U=U||[];if(U.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should contain a valid item' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var b=Q;if(Q=U.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+b+"]); ";else Q+=" validate.errors = ["+b+"]; return false; ";else Q+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else { ",l)Q+=" errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; } ";if(v.opts.allErrors)Q+=" } ";return Q}});var hW=s((D4,_W)=>{_W.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),D="errs__"+X,q=v.util.copy(v),M="";q.level++;var N="valid"+q.level,$={},O={},h=v.opts.ownProperties;for(T in w){if(T=="__proto__")continue;var H=w[T],k=Array.isArray(H)?O:$;k[T]=H}Q+="var "+D+" = errors;";var l=v.errorPath;Q+="var missing"+X+";";for(var T in O)if(k=O[T],k.length){if(Q+=" if ( "+L+v.util.getProperty(T)+" !== undefined ",h)Q+=" && Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(T)+"') ";if(K){Q+=" && ( ";var E=k;if(E){var g,U=-1,b=E.length-1;while(U<b){if(g=E[U+=1],U)Q+=" || ";var I=v.util.getProperty(g),S=L+I;if(Q+=" ( ( "+S+" === undefined ",h)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(g)+"') ";Q+=") && (missing"+X+" = "+v.util.toQuotedString(v.opts.jsonPointers?g:I)+") ) "}}Q+=")) { ";var _="missing"+X,R="' + "+_+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.opts.jsonPointers?v.util.getPathExpr(l,_,!0):l+" + "+_;var y=y||[];if(y.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { property: '"+v.util.escapeQuotes(T)+"', missingProperty: '"+R+"', depsCount: "+k.length+", deps: '"+v.util.escapeQuotes(k.length==1?k[0]:k.join(", "))+"' } ",v.opts.messages!==!1){if(Q+=" , message: 'should have ",k.length==1)Q+="property "+v.util.escapeQuotes(k[0]);else Q+="properties "+v.util.escapeQuotes(k.join(", "));Q+=" when property "+v.util.escapeQuotes(T)+" is present' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var r=Q;if(Q=y.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+r+"]); ";else Q+=" validate.errors = ["+r+"]; return false; ";else Q+=" var err = "+r+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{Q+=" ) { ";var a=k;if(a){var g,i=-1,p=a.length-1;while(i<p){g=a[i+=1];var I=v.util.getProperty(g),R=v.util.escapeQuotes(g),S=L+I;if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(l,g,v.opts.jsonPointers);if(Q+=" if ( "+S+" === undefined ",h)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(g)+"') ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { property: '"+v.util.escapeQuotes(T)+"', missingProperty: '"+R+"', depsCount: "+k.length+", deps: '"+v.util.escapeQuotes(k.length==1?k[0]:k.join(", "))+"' } ",v.opts.messages!==!1){if(Q+=" , message: 'should have ",k.length==1)Q+="property "+v.util.escapeQuotes(k[0]);else Q+="properties "+v.util.escapeQuotes(k.join(", "));Q+=" when property "+v.util.escapeQuotes(T)+" is present' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}if(Q+=" } ",K)M+="}",Q+=" else { "}v.errorPath=l;var n=q.baseId;for(var T in $){var H=$[T];if(v.opts.strictKeywords?typeof H=="object"&&Object.keys(H).length>0||H===!1:v.util.schemaHasRules(H,v.RULES.all)){if(Q+=" "+N+" = true; if ( "+L+v.util.getProperty(T)+" !== undefined ",h)Q+=" && Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(T)+"') ";if(Q+=") { ",q.schema=H,q.schemaPath=B+v.util.getProperty(T),q.errSchemaPath=z+"/"+v.util.escapeFragment(T),Q+=" "+v.validate(q)+" ",q.baseId=n,Q+=" } ",K)Q+=" if ("+N+") { ",M+="}"}}if(K)Q+=" "+M+" if ("+D+" == errors) {";return Q}});var RW=s((V4,bW)=>{bW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),D="valid"+X,q=v.opts.$data&&w&&w.$data,M;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",M="schema"+X;else M=w;var N="i"+X,$="schema"+X;if(!q)Q+=" var "+$+" = validate.schema"+B+";";if(Q+="var "+D+";",q)Q+=" if (schema"+X+" === undefined) "+D+" = true; else if (!Array.isArray(schema"+X+")) "+D+" = false; else {";if(Q+=""+D+" = false;for (var "+N+"=0; "+N+"<"+$+".length; "+N+"++) if (equal("+L+", "+$+"["+N+"])) { "+D+" = true; break; }",q)Q+=" } ";Q+=" if (!"+D+") { ";var O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { allowedValues: schema"+X+" } ",v.opts.messages!==!1)Q+=" , message: 'should be equal to one of the allowed values' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var h=Q;if(Q=O.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+h+"]); ";else Q+=" validate.errors = ["+h+"]; return false; ";else Q+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" }",K)Q+=" else { ";return Q}});var SW=s((j4,kW)=>{kW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||"");if(v.opts.format===!1){if(K)Q+=" if (true) { ";return Q}var D=v.opts.$data&&w&&w.$data,q;if(D)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;var M=v.opts.unknownFormats,N=Array.isArray(M);if(D){var $="format"+X,O="isObject"+X,h="formatType"+X;if(Q+=" var "+$+" = formats["+q+"]; var "+O+" = typeof "+$+" == 'object' && !("+$+" instanceof RegExp) && "+$+".validate; var "+h+" = "+O+" && "+$+".type || 'string'; if ("+O+") { ",v.async)Q+=" var async"+X+" = "+$+".async; ";if(Q+=" "+$+" = "+$+".validate; } if ( ",D)Q+=" ("+q+" !== undefined && typeof "+q+" != 'string') || ";if(Q+=" (",M!="ignore"){if(Q+=" ("+q+" && !"+$+" ",N)Q+=" && self._opts.unknownFormats.indexOf("+q+") == -1 ";Q+=") || "}if(Q+=" ("+$+" && "+h+" == '"+J+"' && !(typeof "+$+" == 'function' ? ",v.async)Q+=" (async"+X+" ? await "+$+"("+L+") : "+$+"("+L+")) ";else Q+=" "+$+"("+L+") ";Q+=" : "+$+".test("+L+"))))) {"}else{var $=v.formats[w];if(!$)if(M=="ignore"){if(v.logger.warn('unknown format "'+w+'" ignored in schema at path "'+v.errSchemaPath+'"'),K)Q+=" if (true) { ";return Q}else if(N&&M.indexOf(w)>=0){if(K)Q+=" if (true) { ";return Q}else throw new Error('unknown format "'+w+'" is used in schema at path "'+v.errSchemaPath+'"');var O=typeof $=="object"&&!($ instanceof RegExp)&&$.validate,h=O&&$.type||"string";if(O){var H=$.async===!0;$=$.validate}if(h!=J){if(K)Q+=" if (true) { ";return Q}if(H){if(!v.async)throw new Error("async format in sync schema");var k="formats"+v.util.getProperty(w)+".validate";Q+=" if (!(await "+k+"("+L+"))) { "}else{Q+=" if (! ";var k="formats"+v.util.getProperty(w);if(O)k+=".validate";if(typeof $=="function")Q+=" "+k+"("+L+") ";else Q+=" "+k+".test("+L+") ";Q+=") { "}}var l=l||[];if(l.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'format' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { format: ",D)Q+=""+q;else Q+=""+v.util.toQuotedString(w);if(Q+=" } ",v.opts.messages!==!1){if(Q+=` , message: 'should match format "`,D)Q+="' + "+q+" + '";else Q+=""+v.util.escapeQuotes(w);Q+=`"' `}if(v.opts.verbose){if(Q+=" , schema: ",D)Q+="validate.schema"+B;else Q+=""+v.util.toQuotedString(w);Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var T=Q;if(Q=l.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+T+"]); ";else Q+=" validate.errors = ["+T+"]; return false; ";else Q+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",K)Q+=" else { ";return Q}});var lW=s((E4,yW)=>{yW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),D="valid"+X,q="errs__"+X,M=v.util.copy(v);M.level++;var N="valid"+M.level,$=v.schema.then,O=v.schema.else,h=$!==void 0&&(v.opts.strictKeywords?typeof $=="object"&&Object.keys($).length>0||$===!1:v.util.schemaHasRules($,v.RULES.all)),H=O!==void 0&&(v.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:v.util.schemaHasRules(O,v.RULES.all)),k=M.baseId;if(h||H){var l;M.createErrors=!1,M.schema=w,M.schemaPath=B,M.errSchemaPath=z,Q+=" var "+q+" = errors; var "+D+" = true; ";var T=v.compositeRule;if(v.compositeRule=M.compositeRule=!0,Q+=" "+v.validate(M)+" ",M.baseId=k,M.createErrors=!0,Q+=" errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; } ",v.compositeRule=M.compositeRule=T,h){if(Q+=" if ("+N+") { ",M.schema=v.schema.then,M.schemaPath=v.schemaPath+".then",M.errSchemaPath=v.errSchemaPath+"/then",Q+=" "+v.validate(M)+" ",M.baseId=k,Q+=" "+D+" = "+N+"; ",h&&H)l="ifClause"+X,Q+=" var "+l+" = 'then'; ";else l="'then'";if(Q+=" } ",H)Q+=" else { "}else Q+=" if (!"+N+") { ";if(H){if(M.schema=v.schema.else,M.schemaPath=v.schemaPath+".else",M.errSchemaPath=v.errSchemaPath+"/else",Q+=" "+v.validate(M)+" ",M.baseId=k,Q+=" "+D+" = "+N+"; ",h&&H)l="ifClause"+X,Q+=" var "+l+" = 'else'; ";else l="'else'";Q+=" } "}if(Q+=" if (!"+D+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'if' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { failingKeyword: "+l+" } ",v.opts.messages!==!1)Q+=` , message: 'should match "' + `+l+` + '" schema' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+=" } ",K)Q+=" else { "}else if(K)Q+=" if (true) { ";return Q}});var ZW=s((O4,IW)=>{IW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),D="valid"+X,q="errs__"+X,M=v.util.copy(v),N="";M.level++;var $="valid"+M.level,O="i"+X,h=M.dataLevel=v.dataLevel+1,H="data"+h,k=v.baseId;if(Q+="var "+q+" = errors;var "+D+";",Array.isArray(w)){var l=v.schema.additionalItems;if(l===!1){Q+=" "+D+" = "+L+".length <= "+w.length+"; ";var T=z;z=v.errSchemaPath+"/additionalItems",Q+=" if (!"+D+") { ";var E=E||[];if(E.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+w.length+" } ",v.opts.messages!==!1)Q+=" , message: 'should NOT have more than "+w.length+" items' ";if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var g=Q;if(Q=E.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+g+"]); ";else Q+=" validate.errors = ["+g+"]; return false; ";else Q+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",z=T,K)N+="}",Q+=" else { "}var U=w;if(U){var b,I=-1,S=U.length-1;while(I<S)if(b=U[I+=1],v.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:v.util.schemaHasRules(b,v.RULES.all)){Q+=" "+$+" = true; if ("+L+".length > "+I+") { ";var _=L+"["+I+"]";M.schema=b,M.schemaPath=B+"["+I+"]",M.errSchemaPath=z+"/"+I,M.errorPath=v.util.getPathExpr(v.errorPath,I,v.opts.jsonPointers,!0),M.dataPathArr[h]=I;var R=v.validate(M);if(M.baseId=k,v.util.varOccurences(R,H)<2)Q+=" "+v.util.varReplace(R,H,_)+" ";else Q+=" var "+H+" = "+_+"; "+R+" ";if(Q+=" } ",K)Q+=" if ("+$+") { ",N+="}"}}if(typeof l=="object"&&(v.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:v.util.schemaHasRules(l,v.RULES.all))){M.schema=l,M.schemaPath=v.schemaPath+".additionalItems",M.errSchemaPath=v.errSchemaPath+"/additionalItems",Q+=" "+$+" = true; if ("+L+".length > "+w.length+") { for (var "+O+" = "+w.length+"; "+O+" < "+L+".length; "+O+"++) { ",M.errorPath=v.util.getPathExpr(v.errorPath,O,v.opts.jsonPointers,!0);var _=L+"["+O+"]";M.dataPathArr[h]=O;var R=v.validate(M);if(M.baseId=k,v.util.varOccurences(R,H)<2)Q+=" "+v.util.varReplace(R,H,_)+" ";else Q+=" var "+H+" = "+_+"; "+R+" ";if(K)Q+=" if (!"+$+") break; ";if(Q+=" } } ",K)Q+=" if ("+$+") { ",N+="}"}}else if(v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all)){M.schema=w,M.schemaPath=B,M.errSchemaPath=z,Q+=" for (var "+O+" = 0; "+O+" < "+L+".length; "+O+"++) { ",M.errorPath=v.util.getPathExpr(v.errorPath,O,v.opts.jsonPointers,!0);var _=L+"["+O+"]";M.dataPathArr[h]=O;var R=v.validate(M);if(M.baseId=k,v.util.varOccurences(R,H)<2)Q+=" "+v.util.varReplace(R,H,_)+" ";else Q+=" var "+H+" = "+_+"; "+R+" ";if(K)Q+=" if (!"+$+") break; ";Q+=" }"}if(K)Q+=" "+N+" if ("+q+" == errors) {";return Q}});var N0=s((U4,CW)=>{CW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,k,L="data"+(Y||""),D=v.opts.$data&&w&&w.$data,q;if(D)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;var M=W=="maximum",N=M?"exclusiveMaximum":"exclusiveMinimum",$=v.schema[N],O=v.opts.$data&&$&&$.$data,h=M?"<":">",H=M?">":"<",k=void 0;if(!(D||typeof w=="number"||w===void 0))throw new Error(W+" must be number");if(!(O||$===void 0||typeof $=="number"||typeof $=="boolean"))throw new Error(N+" must be number or boolean");if(O){var l=v.util.getData($.$data,Y,v.dataPathArr),T="exclusive"+X,E="exclType"+X,g="exclIsNumber"+X,U="op"+X,b="' + "+U+" + '";Q+=" var schemaExcl"+X+" = "+l+"; ",l="schemaExcl"+X,Q+=" var "+T+"; var "+E+" = typeof "+l+"; if ("+E+" != 'boolean' && "+E+" != 'undefined' && "+E+" != 'number') { ";var k=N,I=I||[];if(I.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(k||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: '"+N+" should be boolean' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var S=Q;if(Q=I.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+S+"]); ";else Q+=" validate.errors = ["+S+"]; return false; ";else Q+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else if ( ",D)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";if(Q+=" "+E+" == 'number' ? ( ("+T+" = "+q+" === undefined || "+l+" "+h+"= "+q+") ? "+L+" "+H+"= "+l+" : "+L+" "+H+" "+q+" ) : ( ("+T+" = "+l+" === true) ? "+L+" "+H+"= "+q+" : "+L+" "+H+" "+q+" ) || "+L+" !== "+L+") { var op"+X+" = "+T+" ? '"+h+"' : '"+h+"='; ",w===void 0)k=N,z=v.errSchemaPath+"/"+N,q=l,D=O}else{var g=typeof $=="number",b=h;if(g&&D){var U="'"+b+"'";if(Q+=" if ( ",D)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" ( "+q+" === undefined || "+$+" "+h+"= "+q+" ? "+L+" "+H+"= "+$+" : "+L+" "+H+" "+q+" ) || "+L+" !== "+L+") { "}else{if(g&&w===void 0)T=!0,k=N,z=v.errSchemaPath+"/"+N,q=$,H+="=";else{if(g)q=Math[M?"min":"max"]($,w);if($===(g?q:!0))T=!0,k=N,z=v.errSchemaPath+"/"+N,H+="=";else T=!1,b+="="}var U="'"+b+"'";if(Q+=" if ( ",D)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" "+L+" "+H+" "+q+" || "+L+" !== "+L+") { "}}k=k||W;var I=I||[];if(I.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(k||"_limit")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { comparison: "+U+", limit: "+q+", exclusive: "+T+" } ",v.opts.messages!==!1)if(Q+=" , message: 'should be "+b+" ",D)Q+="' + "+q;else Q+=""+q+"'";if(v.opts.verbose){if(Q+=" , schema: ",D)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var S=Q;if(Q=I.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+S+"]); ";else Q+=" validate.errors = ["+S+"]; return false; ";else Q+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",K)Q+=" else { ";return Q}});var D0=s((H4,TW)=>{TW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,N,L="data"+(Y||""),D=v.opts.$data&&w&&w.$data,q;if(D)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(D||typeof w=="number"))throw new Error(W+" must be number");var M=W=="maxItems"?">":"<";if(Q+="if ( ",D)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" "+L+".length "+M+" "+q+") { ";var N=W,$=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(N||"_limitItems")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+q+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT have ",W=="maxItems")Q+="more";else Q+="fewer";if(Q+=" than ",D)Q+="' + "+q+" + '";else Q+=""+w;Q+=" items' "}if(v.opts.verbose){if(Q+=" , schema: ",D)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",K)Q+=" else { ";return Q}});var V0=s((F4,xW)=>{xW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,N,L="data"+(Y||""),D=v.opts.$data&&w&&w.$data,q;if(D)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(D||typeof w=="number"))throw new Error(W+" must be number");var M=W=="maxLength"?">":"<";if(Q+="if ( ",D)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";if(v.opts.unicode===!1)Q+=" "+L+".length ";else Q+=" ucs2length("+L+") ";Q+=" "+M+" "+q+") { ";var N=W,$=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(N||"_limitLength")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+q+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT be ",W=="maxLength")Q+="longer";else Q+="shorter";if(Q+=" than ",D)Q+="' + "+q+" + '";else Q+=""+w;Q+=" characters' "}if(v.opts.verbose){if(Q+=" , schema: ",D)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",K)Q+=" else { ";return Q}});var j0=s((A4,uW)=>{uW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,N,L="data"+(Y||""),D=v.opts.$data&&w&&w.$data,q;if(D)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(D||typeof w=="number"))throw new Error(W+" must be number");var M=W=="maxProperties"?">":"<";if(Q+="if ( ",D)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" Object.keys("+L+").length "+M+" "+q+") { ";var N=W,$=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(N||"_limitProperties")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+q+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT have ",W=="maxProperties")Q+="more";else Q+="fewer";if(Q+=" than ",D)Q+="' + "+q+" + '";else Q+=""+w;Q+=" properties' "}if(v.opts.verbose){if(Q+=" , schema: ",D)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",K)Q+=" else { ";return Q}});var mW=s((g4,rW)=>{rW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),D=v.opts.$data&&w&&w.$data,q;if(D)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(D||typeof w=="number"))throw new Error(W+" must be number");if(Q+="var division"+X+";if (",D)Q+=" "+q+" !== undefined && ( typeof "+q+" != 'number' || ";if(Q+=" (division"+X+" = "+L+" / "+q+", ",v.opts.multipleOfPrecision)Q+=" Math.abs(Math.round(division"+X+") - division"+X+") > 1e-"+v.opts.multipleOfPrecision+" ";else Q+=" division"+X+" !== parseInt(division"+X+") ";if(Q+=" ) ",D)Q+=" ) ";Q+=" ) { ";var M=M||[];if(M.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { multipleOf: "+q+" } ",v.opts.messages!==!1)if(Q+=" , message: 'should be multiple of ",D)Q+="' + "+q;else Q+=""+q+"'";if(v.opts.verbose){if(Q+=" , schema: ",D)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var N=Q;if(Q=M.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+N+"]); ";else Q+=" validate.errors = ["+N+"]; return false; ";else Q+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",K)Q+=" else { ";return Q}});var cW=s((_4,aW)=>{aW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),D="errs__"+X,q=v.util.copy(v);q.level++;var M="valid"+q.level;if(v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all)){q.schema=w,q.schemaPath=B,q.errSchemaPath=z,Q+=" var "+D+" = errors; ";var N=v.compositeRule;v.compositeRule=q.compositeRule=!0,q.createErrors=!1;var $;if(q.opts.allErrors)$=q.opts.allErrors,q.opts.allErrors=!1;if(Q+=" "+v.validate(q)+" ",q.createErrors=!0,$)q.opts.allErrors=$;v.compositeRule=q.compositeRule=N,Q+=" if ("+M+") { ";var O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'not' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should NOT be valid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var h=Q;if(Q=O.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+h+"]); ";else Q+=" validate.errors = ["+h+"]; return false; ";else Q+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else { errors = "+D+"; if (vErrors !== null) { if ("+D+") vErrors.length = "+D+"; else vErrors = null; } ",v.opts.allErrors)Q+=" } "}else{if(Q+=" var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'not' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should NOT be valid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",K)Q+=" if (false) { "}return Q}});var pW=s((h4,nW)=>{nW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),D="valid"+X,q="errs__"+X,M=v.util.copy(v),N="";M.level++;var $="valid"+M.level,O=M.baseId,h="prevValid"+X,H="passingSchemas"+X;Q+="var "+q+" = errors , "+h+" = false , "+D+" = false , "+H+" = null; ";var k=v.compositeRule;v.compositeRule=M.compositeRule=!0;var l=w;if(l){var T,E=-1,g=l.length-1;while(E<g){if(T=l[E+=1],v.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:v.util.schemaHasRules(T,v.RULES.all))M.schema=T,M.schemaPath=B+"["+E+"]",M.errSchemaPath=z+"/"+E,Q+=" "+v.validate(M)+" ",M.baseId=O;else Q+=" var "+$+" = true; ";if(E)Q+=" if ("+$+" && "+h+") { "+D+" = false; "+H+" = ["+H+", "+E+"]; } else { ",N+="}";Q+=" if ("+$+") { "+D+" = "+h+" = true; "+H+" = "+E+"; }"}}if(v.compositeRule=M.compositeRule=k,Q+=""+N+"if (!"+D+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { passingSchemas: "+H+" } ",v.opts.messages!==!1)Q+=" , message: 'should match exactly one schema in oneOf' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+="} else { errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; }",v.opts.allErrors)Q+=" } ";return Q}});var dW=s((b4,iW)=>{iW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),D=v.opts.$data&&w&&w.$data,q;if(D)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;var M=D?"(new RegExp("+q+"))":v.usePattern(w);if(Q+="if ( ",D)Q+=" ("+q+" !== undefined && typeof "+q+" != 'string') || ";Q+=" !"+M+".test("+L+") ) { ";var N=N||[];if(N.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { pattern: ",D)Q+=""+q;else Q+=""+v.util.toQuotedString(w);if(Q+=" } ",v.opts.messages!==!1){if(Q+=` , message: 'should match pattern "`,D)Q+="' + "+q+" + '";else Q+=""+v.util.escapeQuotes(w);Q+=`"' `}if(v.opts.verbose){if(Q+=" , schema: ",D)Q+="validate.schema"+B;else Q+=""+v.util.toQuotedString(w);Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var $=Q;if(Q=N.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+$+"]); ";else Q+=" validate.errors = ["+$+"]; return false; ";else Q+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",K)Q+=" else { ";return Q}});var sW=s((R4,oW)=>{oW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),D="errs__"+X,q=v.util.copy(v),M="";q.level++;var N="valid"+q.level,$="key"+X,O="idx"+X,h=q.dataLevel=v.dataLevel+1,H="data"+h,k="dataProperties"+X,l=Object.keys(w||{}).filter(i),T=v.schema.patternProperties||{},E=Object.keys(T).filter(i),g=v.schema.additionalProperties,U=l.length||E.length,b=g===!1,I=typeof g=="object"&&Object.keys(g).length,S=v.opts.removeAdditional,_=b||I||S,R=v.opts.ownProperties,y=v.baseId,r=v.schema.required;if(r&&!(v.opts.$data&&r.$data)&&r.length<v.opts.loopRequired)var a=v.util.toHash(r);function i(iv){return iv!=="__proto__"}if(Q+="var "+D+" = errors;var "+N+" = true;",R)Q+=" var "+k+" = undefined;";if(_){if(R)Q+=" "+k+" = "+k+" || Object.keys("+L+"); for (var "+O+"=0; "+O+"<"+k+".length; "+O+"++) { var "+$+" = "+k+"["+O+"]; ";else Q+=" for (var "+$+" in "+L+") { ";if(U){if(Q+=" var isAdditional"+X+" = !(false ",l.length)if(l.length>8)Q+=" || validate.schema"+B+".hasOwnProperty("+$+") ";else{var p=l;if(p){var n,$v=-1,bv=p.length-1;while($v<bv)n=p[$v+=1],Q+=" || "+$+" == "+v.util.toQuotedString(n)+" "}}if(E.length){var Sv=E;if(Sv){var Yv,Ov=-1,gv=Sv.length-1;while(Ov<gv)Yv=Sv[Ov+=1],Q+=" || "+v.usePattern(Yv)+".test("+$+") "}}Q+=" ); if (isAdditional"+X+") { "}if(S=="all")Q+=" delete "+L+"["+$+"]; ";else{var yv=v.errorPath,Vf="' + "+$+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(v.errorPath,$,v.opts.jsonPointers);if(b)if(S)Q+=" delete "+L+"["+$+"]; ";else{Q+=" "+N+" = false; ";var Pf=z;z=v.errSchemaPath+"/additionalProperties";var Uv=Uv||[];if(Uv.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { additionalProperty: '"+Vf+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is an invalid additional property";else Q+="should NOT have additional properties";Q+="' "}if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var jv=Q;if(Q=Uv.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+jv+"]); ";else Q+=" validate.errors = ["+jv+"]; return false; ";else Q+=" var err = "+jv+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(z=Pf,K)Q+=" break; "}else if(I)if(S=="failing"){Q+=" var "+D+" = errors; ";var bf=v.compositeRule;v.compositeRule=q.compositeRule=!0,q.schema=g,q.schemaPath=v.schemaPath+".additionalProperties",q.errSchemaPath=v.errSchemaPath+"/additionalProperties",q.errorPath=v.opts._errorDataPathProperty?v.errorPath:v.util.getPathExpr(v.errorPath,$,v.opts.jsonPointers);var Rv=L+"["+$+"]";q.dataPathArr[h]=$;var Gv=v.validate(q);if(q.baseId=y,v.util.varOccurences(Gv,H)<2)Q+=" "+v.util.varReplace(Gv,H,Rv)+" ";else Q+=" var "+H+" = "+Rv+"; "+Gv+" ";Q+=" if (!"+N+") { errors = "+D+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+L+"["+$+"]; } ",v.compositeRule=q.compositeRule=bf}else{q.schema=g,q.schemaPath=v.schemaPath+".additionalProperties",q.errSchemaPath=v.errSchemaPath+"/additionalProperties",q.errorPath=v.opts._errorDataPathProperty?v.errorPath:v.util.getPathExpr(v.errorPath,$,v.opts.jsonPointers);var Rv=L+"["+$+"]";q.dataPathArr[h]=$;var Gv=v.validate(q);if(q.baseId=y,v.util.varOccurences(Gv,H)<2)Q+=" "+v.util.varReplace(Gv,H,Rv)+" ";else Q+=" var "+H+" = "+Rv+"; "+Gv+" ";if(K)Q+=" if (!"+N+") break; "}v.errorPath=yv}if(U)Q+=" } ";if(Q+=" } ",K)Q+=" if ("+N+") { ",M+="}"}var jf=v.opts.useDefaults&&!v.compositeRule;if(l.length){var Kf=l;if(Kf){var n,Rf=-1,kf=Kf.length-1;while(Rf<kf){n=Kf[Rf+=1];var _v=w[n];if(v.opts.strictKeywords?typeof _v=="object"&&Object.keys(_v).length>0||_v===!1:v.util.schemaHasRules(_v,v.RULES.all)){var mv=v.util.getProperty(n),Rv=L+mv,Zv=jf&&_v.default!==void 0;q.schema=_v,q.schemaPath=B+mv,q.errSchemaPath=z+"/"+v.util.escapeFragment(n),q.errorPath=v.util.getPath(v.errorPath,n,v.opts.jsonPointers),q.dataPathArr[h]=v.util.toQuotedString(n);var Gv=v.validate(q);if(q.baseId=y,v.util.varOccurences(Gv,H)<2){Gv=v.util.varReplace(Gv,H,Rv);var lv=Rv}else{var lv=H;Q+=" var "+H+" = "+Rv+"; "}if(Zv)Q+=" "+Gv+" ";else{if(a&&a[n]){if(Q+=" if ( "+lv+" === undefined ",R)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(n)+"') ";Q+=") { "+N+" = false; ";var yv=v.errorPath,Pf=z,Jf=v.util.escapeQuotes(n);if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(yv,n,v.opts.jsonPointers);z=v.errSchemaPath+"/required";var Uv=Uv||[];if(Uv.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+Jf+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+Jf+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var jv=Q;if(Q=Uv.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+jv+"]); ";else Q+=" validate.errors = ["+jv+"]; return false; ";else Q+=" var err = "+jv+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";z=Pf,v.errorPath=yv,Q+=" } else { "}else if(K){if(Q+=" if ( "+lv+" === undefined ",R)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(n)+"') ";Q+=") { "+N+" = true; } else { "}else{if(Q+=" if ("+lv+" !== undefined ",R)Q+=" && Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(n)+"') ";Q+=" ) { "}Q+=" "+Gv+" } "}}if(K)Q+=" if ("+N+") { ",M+="}"}}}if(E.length){var xv=E;if(xv){var Yv,y1=-1,kQ=xv.length-1;while(y1<kQ){Yv=xv[y1+=1];var _v=T[Yv];if(v.opts.strictKeywords?typeof _v=="object"&&Object.keys(_v).length>0||_v===!1:v.util.schemaHasRules(_v,v.RULES.all)){if(q.schema=_v,q.schemaPath=v.schemaPath+".patternProperties"+v.util.getProperty(Yv),q.errSchemaPath=v.errSchemaPath+"/patternProperties/"+v.util.escapeFragment(Yv),R)Q+=" "+k+" = "+k+" || Object.keys("+L+"); for (var "+O+"=0; "+O+"<"+k+".length; "+O+"++) { var "+$+" = "+k+"["+O+"]; ";else Q+=" for (var "+$+" in "+L+") { ";Q+=" if ("+v.usePattern(Yv)+".test("+$+")) { ",q.errorPath=v.util.getPathExpr(v.errorPath,$,v.opts.jsonPointers);var Rv=L+"["+$+"]";q.dataPathArr[h]=$;var Gv=v.validate(q);if(q.baseId=y,v.util.varOccurences(Gv,H)<2)Q+=" "+v.util.varReplace(Gv,H,Rv)+" ";else Q+=" var "+H+" = "+Rv+"; "+Gv+" ";if(K)Q+=" if (!"+N+") break; ";if(Q+=" } ",K)Q+=" else "+N+" = true; ";if(Q+=" } ",K)Q+=" if ("+N+") { ",M+="}"}}}}if(K)Q+=" "+M+" if ("+D+" == errors) {";return Q}});var eW=s((k4,tW)=>{tW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),D="errs__"+X,q=v.util.copy(v),M="";q.level++;var N="valid"+q.level;if(Q+="var "+D+" = errors;",v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all)){q.schema=w,q.schemaPath=B,q.errSchemaPath=z;var $="key"+X,O="idx"+X,h="i"+X,H="' + "+$+" + '",k=q.dataLevel=v.dataLevel+1,l="data"+k,T="dataProperties"+X,E=v.opts.ownProperties,g=v.baseId;if(E)Q+=" var "+T+" = undefined; ";if(E)Q+=" "+T+" = "+T+" || Object.keys("+L+"); for (var "+O+"=0; "+O+"<"+T+".length; "+O+"++) { var "+$+" = "+T+"["+O+"]; ";else Q+=" for (var "+$+" in "+L+") { ";Q+=" var startErrs"+X+" = errors; ";var U=$,b=v.compositeRule;v.compositeRule=q.compositeRule=!0;var I=v.validate(q);if(q.baseId=g,v.util.varOccurences(I,l)<2)Q+=" "+v.util.varReplace(I,l,U)+" ";else Q+=" var "+l+" = "+U+"; "+I+" ";if(v.compositeRule=q.compositeRule=b,Q+=" if (!"+N+") { for (var "+h+"=startErrs"+X+"; "+h+"<errors; "+h+"++) { vErrors["+h+"].propertyName = "+$+"; } var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { propertyName: '"+H+"' } ",v.opts.messages!==!1)Q+=" , message: 'property name \\'"+H+"\\' is invalid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(K)Q+=" break; ";Q+=" } }"}if(K)Q+=" "+M+" if ("+D+" == errors) {";return Q}});var f9=s((S4,v9)=>{v9.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),D="valid"+X,q=v.opts.$data&&w&&w.$data,M;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",M="schema"+X;else M=w;var N="schema"+X;if(!q)if(w.length<v.opts.loopRequired&&v.schema.properties&&Object.keys(v.schema.properties).length){var $=[],O=w;if(O){var h,H=-1,k=O.length-1;while(H<k){h=O[H+=1];var l=v.schema.properties[h];if(!(l&&(v.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:v.util.schemaHasRules(l,v.RULES.all))))$[$.length]=h}}}else var $=w;if(q||$.length){var T=v.errorPath,E=q||$.length>=v.opts.loopRequired,g=v.opts.ownProperties;if(K)if(Q+=" var missing"+X+"; ",E){if(!q)Q+=" var "+N+" = validate.schema"+B+"; ";var U="i"+X,b="schema"+X+"["+U+"]",I="' + "+b+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(T,b,v.opts.jsonPointers);if(Q+=" var "+D+" = true; ",q)Q+=" if (schema"+X+" === undefined) "+D+" = true; else if (!Array.isArray(schema"+X+")) "+D+" = false; else {";if(Q+=" for (var "+U+" = 0; "+U+" < "+N+".length; "+U+"++) { "+D+" = "+L+"["+N+"["+U+"]] !== undefined ",g)Q+=" && Object.prototype.hasOwnProperty.call("+L+", "+N+"["+U+"]) ";if(Q+="; if (!"+D+") break; } ",q)Q+=" } ";Q+=" if (!"+D+") { ";var S=S||[];if(S.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+I+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var _=Q;if(Q=S.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+_+"]); ";else Q+=" validate.errors = ["+_+"]; return false; ";else Q+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } else { "}else{Q+=" if ( ";var R=$;if(R){var y,U=-1,r=R.length-1;while(U<r){if(y=R[U+=1],U)Q+=" || ";var a=v.util.getProperty(y),i=L+a;if(Q+=" ( ( "+i+" === undefined ",g)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(y)+"') ";Q+=") && (missing"+X+" = "+v.util.toQuotedString(v.opts.jsonPointers?y:a)+") ) "}}Q+=") { ";var b="missing"+X,I="' + "+b+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.opts.jsonPointers?v.util.getPathExpr(T,b,!0):T+" + "+b;var S=S||[];if(S.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+I+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var _=Q;if(Q=S.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+_+"]); ";else Q+=" validate.errors = ["+_+"]; return false; ";else Q+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } else { "}else if(E){if(!q)Q+=" var "+N+" = validate.schema"+B+"; ";var U="i"+X,b="schema"+X+"["+U+"]",I="' + "+b+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(T,b,v.opts.jsonPointers);if(q){if(Q+=" if ("+N+" && !Array.isArray("+N+")) { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+I+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+N+" !== undefined) { "}if(Q+=" for (var "+U+" = 0; "+U+" < "+N+".length; "+U+"++) { if ("+L+"["+N+"["+U+"]] === undefined ",g)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", "+N+"["+U+"]) ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+I+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",q)Q+=" } "}else{var p=$;if(p){var y,n=-1,$v=p.length-1;while(n<$v){y=p[n+=1];var a=v.util.getProperty(y),I=v.util.escapeQuotes(y),i=L+a;if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(T,y,v.opts.jsonPointers);if(Q+=" if ( "+i+" === undefined ",g)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(y)+"') ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+I+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}v.errorPath=T}else if(K)Q+=" if (true) {";return Q}});var W9=s((y4,Q9)=>{Q9.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),D="valid"+X,q=v.opts.$data&&w&&w.$data,M;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",M="schema"+X;else M=w;if((w||q)&&v.opts.uniqueItems!==!1){if(q)Q+=" var "+D+"; if ("+M+" === false || "+M+" === undefined) "+D+" = true; else if (typeof "+M+" != 'boolean') "+D+" = false; else { ";Q+=" var i = "+L+".length , "+D+" = true , j; if (i > 1) { ";var N=v.schema.items&&v.schema.items.type,$=Array.isArray(N);if(!N||N=="object"||N=="array"||$&&(N.indexOf("object")>=0||N.indexOf("array")>=0))Q+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+L+"[i], "+L+"[j])) { "+D+" = false; break outer; } } } ";else{Q+=" var itemIndices = {}, item; for (;i--;) { var item = "+L+"[i]; ";var O="checkDataType"+($?"s":"");if(Q+=" if ("+v.util[O](N,"item",v.opts.strictNumbers,!0)+") continue; ",$)Q+=` if (typeof item == 'string') item = '"' + item; `;Q+=" if (typeof itemIndices[item] == 'number') { "+D+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}if(Q+=" } ",q)Q+=" } ";Q+=" if (!"+D+") { ";var h=h||[];if(h.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { i: i, j: j } ",v.opts.messages!==!1)Q+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' ";if(v.opts.verbose){if(Q+=" , schema: ",q)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var H=Q;if(Q=h.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+H+"]); ";else Q+=" validate.errors = ["+H+"]; return false; ";else Q+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",K)Q+=" else { "}else if(K)Q+=" if (true) { ";return Q}});var X9=s((l4,J9)=>{J9.exports={$ref:NW(),allOf:VW(),anyOf:EW(),$comment:UW(),const:FW(),contains:gW(),dependencies:hW(),enum:RW(),format:SW(),if:lW(),items:ZW(),maximum:N0(),minimum:N0(),maxItems:D0(),minItems:D0(),maxLength:V0(),minLength:V0(),maxProperties:j0(),minProperties:j0(),multipleOf:mW(),not:cW(),oneOf:pW(),pattern:dW(),properties:sW(),propertyNames:eW(),required:f9(),uniqueItems:W9(),validate:L0()}});var G9=s((I4,w9)=>{var Y9=X9(),E0=uf().toHash;w9.exports=function f(){var v=[{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"]}],W=["type","$comment"],J=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],Q=["number","integer","string","array","object","boolean","null"];return v.all=E0(W),v.types=E0(Q),v.forEach(function(X){if(X.rules=X.rules.map(function(Y){var w;if(typeof Y=="object"){var B=Object.keys(Y)[0];w=Y[B],Y=B,w.forEach(function(K){W.push(K),v.all[K]=!0})}W.push(Y);var z=v.all[Y]={keyword:Y,code:Y9[Y],implements:w};return z}),v.all.$comment={keyword:"$comment",code:Y9.$comment},X.type)v.types[X.type]=X}),v.keywords=E0(W.concat(J)),v.custom={},v}});var P9=s((Z4,q9)=>{var B9=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];q9.exports=function(f,v){for(var W=0;W<v.length;W++){f=JSON.parse(JSON.stringify(f));var J=v[W].split("/"),Q=f,X;for(X=1;X<J.length;X++)Q=Q[J[X]];for(X=0;X<B9.length;X++){var Y=B9[X],w=Q[Y];if(w)Q[Y]={anyOf:[w,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}}}return f}});var $9=s((C4,z9)=>{var PY=zQ().MissingRef;z9.exports=K9;function K9(f,v,W){var J=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");if(typeof v=="function")W=v,v=void 0;var Q=X(f).then(function(){var w=J._addSchema(f,void 0,v);return w.validate||Y(w)});if(W)Q.then(function(w){W(null,w)},W);return Q;function X(w){var B=w.$schema;return B&&!J.getSchema(B)?K9.call(J,{$ref:B},!0):Promise.resolve()}function Y(w){try{return J._compile(w)}catch(z){if(z instanceof PY)return B(z);throw z}function B(z){var K=z.missingSchema;if(q(K))throw new Error("Schema "+K+" is loaded but "+z.missingRef+" cannot be resolved");var L=J._loadingSchemas[K];if(!L)L=J._loadingSchemas[K]=J._opts.loadSchema(K),L.then(D,D);return L.then(function(M){if(!q(K))return X(M).then(function(){if(!q(K))J.addSchema(M,K,void 0,v)})}).then(function(){return Y(w)});function D(){delete J._loadingSchemas[K]}function q(M){return J._refs[M]||J._schemas[M]}}}}});var M9=s((T4,L9)=>{L9.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L,D="data"+(Y||""),q="valid"+X,M="errs__"+X,N=v.opts.$data&&w&&w.$data,$;if(N)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",$="schema"+X;else $=w;var O=this,h="definition"+X,H=O.definition,k="",l,T,E,g,U;if(N&&H.$data){U="keywordValidate"+X;var b=H.validateSchema;Q+=" var "+h+" = RULES.custom['"+W+"'].definition; var "+U+" = "+h+".validate;"}else{if(g=v.useCustomRule(O,w,v.schema,v),!g)return;$="validate.schema"+B,U=g.code,l=H.compile,T=H.inline,E=H.macro}var I=U+".errors",S="i"+X,_="ruleErr"+X,R=H.async;if(R&&!v.async)throw new Error("async keyword in sync schema");if(!(T||E))Q+=""+I+" = null;";if(Q+="var "+M+" = errors;var "+q+";",N&&H.$data){if(k+="}",Q+=" if ("+$+" === undefined) { "+q+" = true; } else { ",b)k+="}",Q+=" "+q+" = "+h+".validateSchema("+$+"); if ("+q+") { "}if(T)if(H.statements)Q+=" "+g.validate+" ";else Q+=" "+q+" = "+g.validate+"; ";else if(E){var y=v.util.copy(v),k="";y.level++;var r="valid"+y.level;y.schema=g.validate,y.schemaPath="";var a=v.compositeRule;v.compositeRule=y.compositeRule=!0;var i=v.validate(y).replace(/validate\.schema/g,U);v.compositeRule=y.compositeRule=a,Q+=" "+i}else{var p=p||[];if(p.push(Q),Q="",Q+=" "+U+".call( ",v.opts.passContext)Q+="this";else Q+="self";if(l||H.schema===!1)Q+=" , "+D+" ";else Q+=" , "+$+" , "+D+" , validate.schema"+v.schemaPath+" ";if(Q+=" , (dataPath || '')",v.errorPath!='""')Q+=" + "+v.errorPath;var n=Y?"data"+(Y-1||""):"parentData",$v=Y?v.dataPathArr[Y]:"parentDataProperty";Q+=" , "+n+" , "+$v+" , rootData ) ";var bv=Q;if(Q=p.pop(),H.errors===!1){if(Q+=" "+q+" = ",R)Q+="await ";Q+=""+bv+"; "}else if(R)I="customErrors"+X,Q+=" var "+I+" = null; try { "+q+" = await "+bv+"; } catch (e) { "+q+" = false; if (e instanceof ValidationError) "+I+" = e.errors; else throw e; } ";else Q+=" "+I+" = null; "+q+" = "+bv+"; "}if(H.modifying)Q+=" if ("+n+") "+D+" = "+n+"["+$v+"];";if(Q+=""+k,H.valid){if(K)Q+=" if (true) { "}else{if(Q+=" if ( ",H.valid===void 0)if(Q+=" !",E)Q+=""+r;else Q+=""+q;else Q+=" "+!H.valid+" ";Q+=") { ",L=O.keyword;var p=p||[];p.push(Q),Q="";var p=p||[];if(p.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(L||"custom")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { keyword: '"+O.keyword+"' } ",v.opts.messages!==!1)Q+=` , message: 'should pass "`+O.keyword+`" keyword validation' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+D+" ";Q+=" } "}else Q+=" {} ";var Sv=Q;if(Q=p.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+Sv+"]); ";else Q+=" validate.errors = ["+Sv+"]; return false; ";else Q+=" var err = "+Sv+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var Yv=Q;if(Q=p.pop(),T)if(H.errors){if(H.errors!="full"){if(Q+=" for (var "+S+"="+M+"; "+S+"<errors; "+S+"++) { var "+_+" = vErrors["+S+"]; if ("+_+".dataPath === undefined) "+_+".dataPath = (dataPath || '') + "+v.errorPath+"; if ("+_+".schemaPath === undefined) { "+_+'.schemaPath = "'+z+'"; } ',v.opts.verbose)Q+=" "+_+".schema = "+$+"; "+_+".data = "+D+"; ";Q+=" } "}}else if(H.errors===!1)Q+=" "+Yv+" ";else{if(Q+=" if ("+M+" == errors) { "+Yv+" } else { for (var "+S+"="+M+"; "+S+"<errors; "+S+"++) { var "+_+" = vErrors["+S+"]; if ("+_+".dataPath === undefined) "+_+".dataPath = (dataPath || '') + "+v.errorPath+"; if ("+_+".schemaPath === undefined) { "+_+'.schemaPath = "'+z+'"; } ',v.opts.verbose)Q+=" "+_+".schema = "+$+"; "+_+".data = "+D+"; ";Q+=" } } "}else if(E){if(Q+=" var err = ",v.createErrors!==!1){if(Q+=" { keyword: '"+(L||"custom")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { keyword: '"+O.keyword+"' } ",v.opts.messages!==!1)Q+=` , message: 'should pass "`+O.keyword+`" keyword validation' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+D+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; "}else if(H.errors===!1)Q+=" "+Yv+" ";else{if(Q+=" if (Array.isArray("+I+")) { if (vErrors === null) vErrors = "+I+"; else vErrors = vErrors.concat("+I+"); errors = vErrors.length; for (var "+S+"="+M+"; "+S+"<errors; "+S+"++) { var "+_+" = vErrors["+S+"]; if ("+_+".dataPath === undefined) "+_+".dataPath = (dataPath || '') + "+v.errorPath+"; "+_+'.schemaPath = "'+z+'"; ',v.opts.verbose)Q+=" "+_+".schema = "+$+"; "+_+".data = "+D+"; ";Q+=" } } else { "+Yv+" } "}if(Q+=" } ",K)Q+=" else { "}return Q}});var O0=s((x4,KY)=>{KY.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 V9=s((u4,D9)=>{var N9=O0();D9.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:N9.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:N9.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 E9=s((r4,j9)=>{var zY=/^[a-z_$][a-z0-9_$-]*$/i,$Y=M9(),LY=V9();j9.exports={add:MY,get:NY,remove:DY,validate:U0};function MY(f,v){var W=this.RULES;if(W.keywords[f])throw new Error("Keyword "+f+" is already defined");if(!zY.test(f))throw new Error("Keyword "+f+" is not a valid identifier");if(v){this.validateKeyword(v,!0);var J=v.type;if(Array.isArray(J))for(var Q=0;Q<J.length;Q++)Y(f,J[Q],v);else Y(f,J,v);var X=v.metaSchema;if(X){if(v.$data&&this._opts.$data)X={anyOf:[X,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]};v.validateSchema=this.compile(X,!0)}}W.keywords[f]=W.all[f]=!0;function Y(w,B,z){var K;for(var L=0;L<W.length;L++){var D=W[L];if(D.type==B){K=D;break}}if(!K)K={type:B,rules:[]},W.push(K);var q={keyword:w,definition:z,custom:!0,code:$Y,implements:z.implements};K.rules.push(q),W.custom[w]=q}return this}function NY(f){var v=this.RULES.custom[f];return v?v.definition:this.RULES.keywords[f]||!1}function DY(f){var v=this.RULES;delete v.keywords[f],delete v.all[f],delete v.custom[f];for(var W=0;W<v.length;W++){var J=v[W].rules;for(var Q=0;Q<J.length;Q++)if(J[Q].keyword==f){J.splice(Q,1);break}}return this}function U0(f,v){U0.errors=null;var W=this._validateKeyword=this._validateKeyword||this.compile(LY,!0);if(W(f))return!0;if(U0.errors=W.errors,v)throw new Error("custom keyword definition is invalid: "+this.errorsText(W.errors));else return!1}});var O9=s((m4,VY)=>{VY.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 k9=s((a4,R9)=>{var H9=fW(),rf=KQ(),jY=WW(),F9=G0(),EY=$0(),OY=LW(),UY=G9(),A9=P9(),g9=uf();R9.exports=Ev;Ev.prototype.validate=FY;Ev.prototype.compile=AY;Ev.prototype.addSchema=gY;Ev.prototype.addMetaSchema=_Y;Ev.prototype.validateSchema=hY;Ev.prototype.getSchema=RY;Ev.prototype.removeSchema=SY;Ev.prototype.addFormat=uY;Ev.prototype.errorsText=xY;Ev.prototype._addSchema=yY;Ev.prototype._compile=lY;Ev.prototype.compileAsync=$9();var EQ=E9();Ev.prototype.addKeyword=EQ.add;Ev.prototype.getKeyword=EQ.get;Ev.prototype.removeKeyword=EQ.remove;Ev.prototype.validateKeyword=EQ.validate;var _9=zQ();Ev.ValidationError=_9.Validation;Ev.MissingRefError=_9.MissingRef;Ev.$dataMetaSchema=A9;var jQ="http://json-schema.org/draft-07/schema",U9=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],HY=["/properties"];function Ev(f){if(!(this instanceof Ev))return new Ev(f);if(f=this._opts=g9.copy(f)||{},pY(this),this._schemas={},this._refs={},this._fragments={},this._formats=OY(f.format),this._cache=f.cache||new jY,this._loadingSchemas={},this._compilations=[],this.RULES=UY(),this._getId=IY(f),f.loopRequired=f.loopRequired||1/0,f.errorDataPath=="property")f._errorDataPathProperty=!0;if(f.serialize===void 0)f.serialize=EY;if(this._metaOpts=nY(this),f.formats)aY(this);if(f.keywords)cY(this);if(rY(this),typeof f.meta=="object")this.addMetaSchema(f.meta);if(f.nullable)this.addKeyword("nullable",{metaSchema:{type:"boolean"}});mY(this)}function FY(f,v){var W;if(typeof f=="string"){if(W=this.getSchema(f),!W)throw new Error('no schema with key or ref "'+f+'"')}else{var J=this._addSchema(f);W=J.validate||this._compile(J)}var Q=W(v);if(W.$async!==!0)this.errors=W.errors;return Q}function AY(f,v){var W=this._addSchema(f,void 0,v);return W.validate||this._compile(W)}function gY(f,v,W,J){if(Array.isArray(f)){for(var Q=0;Q<f.length;Q++)this.addSchema(f[Q],void 0,W,J);return this}var X=this._getId(f);if(X!==void 0&&typeof X!="string")throw new Error("schema id must be string");return v=rf.normalizeId(v||X),b9(this,v),this._schemas[v]=this._addSchema(f,W,J,!0),this}function _Y(f,v,W){return this.addSchema(f,v,W,!0),this}function hY(f,v){var W=f.$schema;if(W!==void 0&&typeof W!="string")throw new Error("$schema must be a string");if(W=W||this._opts.defaultMeta||bY(this),!W)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var J=this.validate(W,f);if(!J&&v){var Q="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(Q);else throw new Error(Q)}return J}function bY(f){var v=f._opts.meta;return f._opts.defaultMeta=typeof v=="object"?f._getId(v)||v:f.getSchema(jQ)?jQ:void 0,f._opts.defaultMeta}function RY(f){var v=h9(this,f);switch(typeof v){case"object":return v.validate||this._compile(v);case"string":return this.getSchema(v);case"undefined":return kY(this,f)}}function kY(f,v){var W=rf.schema.call(f,{schema:{}},v);if(W){var{schema:J,root:Q,baseId:X}=W,Y=H9.call(f,J,Q,void 0,X);return f._fragments[v]=new F9({ref:v,fragment:!0,schema:J,root:Q,baseId:X,validate:Y}),Y}}function h9(f,v){return v=rf.normalizeId(v),f._schemas[v]||f._refs[v]||f._fragments[v]}function SY(f){if(f instanceof RegExp)return VQ(this,this._schemas,f),VQ(this,this._refs,f),this;switch(typeof f){case"undefined":return VQ(this,this._schemas),VQ(this,this._refs),this._cache.clear(),this;case"string":var v=h9(this,f);if(v)this._cache.del(v.cacheKey);return delete this._schemas[f],delete this._refs[f],this;case"object":var W=this._opts.serialize,J=W?W(f):f;this._cache.del(J);var Q=this._getId(f);if(Q)Q=rf.normalizeId(Q),delete this._schemas[Q],delete this._refs[Q]}return this}function VQ(f,v,W){for(var J in v){var Q=v[J];if(!Q.meta&&(!W||W.test(J)))f._cache.del(Q.cacheKey),delete v[J]}}function yY(f,v,W,J){if(typeof f!="object"&&typeof f!="boolean")throw new Error("schema should be object or boolean");var Q=this._opts.serialize,X=Q?Q(f):f,Y=this._cache.get(X);if(Y)return Y;J=J||this._opts.addUsedSchema!==!1;var w=rf.normalizeId(this._getId(f));if(w&&J)b9(this,w);var B=this._opts.validateSchema!==!1&&!v,z;if(B&&!(z=w&&w==rf.normalizeId(f.$schema)))this.validateSchema(f,!0);var K=rf.ids.call(this,f),L=new F9({id:w,schema:f,localRefs:K,cacheKey:X,meta:W});if(w[0]!="#"&&J)this._refs[w]=L;if(this._cache.put(X,L),B&&z)this.validateSchema(f,!0);return L}function lY(f,v){if(f.compiling){if(f.validate=Q,Q.schema=f.schema,Q.errors=null,Q.root=v?v:Q,f.schema.$async===!0)Q.$async=!0;return Q}f.compiling=!0;var W;if(f.meta)W=this._opts,this._opts=this._metaOpts;var J;try{J=H9.call(this,f.schema,v,f.localRefs)}catch(X){throw delete f.validate,X}finally{if(f.compiling=!1,f.meta)this._opts=W}return f.validate=J,f.refs=J.refs,f.refVal=J.refVal,f.root=J.root,J;function Q(){var X=f.validate,Y=X.apply(this,arguments);return Q.errors=X.errors,Y}}function IY(f){switch(f.schemaId){case"auto":return TY;case"id":return ZY;default:return CY}}function ZY(f){if(f.$id)this.logger.warn("schema $id ignored",f.$id);return f.id}function CY(f){if(f.id)this.logger.warn("schema id ignored",f.id);return f.$id}function TY(f){if(f.$id&&f.id&&f.$id!=f.id)throw new Error("schema $id is different from id");return f.$id||f.id}function xY(f,v){if(f=f||this.errors,!f)return"No errors";v=v||{};var W=v.separator===void 0?", ":v.separator,J=v.dataVar===void 0?"data":v.dataVar,Q="";for(var X=0;X<f.length;X++){var Y=f[X];if(Y)Q+=J+Y.dataPath+" "+Y.message+W}return Q.slice(0,-W.length)}function uY(f,v){if(typeof v=="string")v=new RegExp(v);return this._formats[f]=v,this}function rY(f){var v;if(f._opts.$data)v=O9(),f.addMetaSchema(v,v.$id,!0);if(f._opts.meta===!1)return;var W=O0();if(f._opts.$data)W=A9(W,HY);f.addMetaSchema(W,jQ,!0),f._refs["http://json-schema.org/schema"]=jQ}function mY(f){var v=f._opts.schemas;if(!v)return;if(Array.isArray(v))f.addSchema(v);else for(var W in v)f.addSchema(v[W],W)}function aY(f){for(var v in f._opts.formats){var W=f._opts.formats[v];f.addFormat(v,W)}}function cY(f){for(var v in f._opts.keywords){var W=f._opts.keywords[v];f.addKeyword(v,W)}}function b9(f,v){if(f._schemas[v]||f._refs[v])throw new Error('schema with key or id "'+v+'" already exists')}function nY(f){var v=g9.copy(f._opts);for(var W=0;W<U9.length;W++)delete v[U9[W]];return v}function pY(f){var v=f._opts.logger;if(v===!1)f.logger={log:H0,warn:H0,error:H0};else{if(v===void 0)v=console;if(!(typeof v=="object"&&v.log&&v.warn&&v.error))throw new Error("logger must implement log, warn and error methods");f.logger=v}}function H0(){}});var q7=(f)=>{let{idPattern:v,entityName:W}=f,J=(B)=>{return v.test(B)};return Object.freeze({isId:J,validateId:(B)=>{return J(B)},resolve:(B)=>{if(J(B))return{kind:"id",value:B};return{kind:"path",value:B}},getPattern:()=>{return v},getEntityName:()=>{return W}})},P7,l0;var NJ=Ef(()=>{P7=Object.freeze({create:q7}),l0=P7});var hQ,bQ,I0=(f)=>{if(hQ.isId(f))return"project";if(bQ.isId(f))return"shared";return},K7=(f)=>{return hQ.isId(f)||bQ.isId(f)},DJ=(f)=>{return f==="project"?hQ:bQ},z7=(f,v)=>{return DJ(v).validateId(f)},$7,Qf;var K1=Ef(()=>{NJ();hQ=l0.create({idPattern:/^doc\d{3,}$/,entityName:"project-doc"}),bQ=l0.create({idPattern:/^sdoc\d{3,}$/,entityName:"shared-doc"}),$7=Object.freeze({project:hQ,shared:bQ,detectScopeFromId:I0,isdocId:K7,getResolverForScope:DJ,validateIdForScope:z7}),Qf=$7});import{resolve as FJ,relative as gJ,normalize as F7,isAbsolute as _J}from"path";import{realpath as AJ,lstat as A7}from"fs/promises";var Wf=(f,v,W)=>{let J=new Error(v);return J.name=f,J.code=f,J.details=W,J},hJ=(f)=>{if(!f)throw Wf("VALIDATION_ERROR","Empty path");if(_J(f))throw Wf("VALIDATION_ERROR","Absolute path not allowed",{path:f});let v=F7(f).replaceAll("\\","/");if(v.split("/").some((J)=>J===".."))throw Wf("BOUNDARY_VIOLATION","Path contains ..",{path:f});return v},Z0=(f,v)=>{let W=gJ(f,v);return W!==""&&!W.startsWith("..")&&!_J(W)},g7=async(f,v,W)=>{let J=hJ(v),Q=FJ(f),X=FJ(Q,J);if(W?.followSymlinks)try{X=await AJ(X)}catch(w){if(w.code!=="ENOENT")throw w}else try{if((await A7(X)).isSymbolicLink()){let B=await AJ(X);if(!Z0(Q,B))throw Wf("BOUNDARY_VIOLATION",`Symlink target escapes boundary: '${v}' \u2192 '${B}'`,{path:v,resolved:X,target:B})}}catch(w){if(w.code!=="ENOENT"&&w.code!=="BOUNDARY_VIOLATION")throw w;if(w.code==="BOUNDARY_VIOLATION")throw w}if(!Z0(Q,X)&&X!==Q)throw Wf("BOUNDARY_VIOLATION",`Path escapes boundary: '${v}' \u2192 '${X}'`,{path:v,resolved:X,boundary:Q});let Y=gJ(Q,X).replaceAll("\\","/");return{abs:X,rel:Y}},_7=(f,v)=>{let W=f.code,J=v?.path?v.resolved?`'${v.path}' \u2192 '${v.resolved}'`:`'${v.path}'`:"";switch(W){case"ENOENT":return Wf("NOT_FOUND",`File or directory not found${J?`: ${J}`:""}`,{...v,originalCode:W});case"ENOTEMPTY":return Wf("DIRECTORY_NOT_EMPTY",`Directory not empty${J?`: ${J}`:""}`,{...v,originalCode:W});case"ENOTDIR":case"EISDIR":return Wf("VALIDATION_ERROR",`Invalid path type${J?`: ${J}`:""}`,{...v,originalCode:W,reason:W==="ENOTDIR"?"not a directory":"is a directory"});case"EACCES":case"EPERM":return Wf("FS_ERROR",`Permission denied${J?`: ${J}`:""}`,{...v,originalCode:W});case"EBUSY":return Wf("FS_ERROR",`Resource busy or locked${J?`: ${J}`:""}`,{...v,originalCode:W});default:if(v)f.context=v;return f}},h7,fv;var C0=Ef(()=>{h7=Object.freeze({fsError:Wf,validateRelative:hJ,insideBoundary:Z0,resolveWithinBoundary:g7,mapOsError:_7}),fv=h7});import{readFile as b7,writeFile as R7,unlink as bJ,stat as T0,rename as k7,access as S7,mkdir as y7}from"fs/promises";import{constants as l7}from"fs";import{createHash as RJ}from"crypto";import{resolve as I7,dirname as x0,isAbsolute as Z7}from"path";var C7=(f)=>{let{boundaryDir:v}=f;if(!v)throw fv.fsError("VALIDATION_ERROR","boundaryDir is required (empty string)",{boundaryDir:v});if(!Z7(v))throw fv.fsError("VALIDATION_ERROR",`boundaryDir must be an absolute path: '${v}'`,{boundaryDir:v});let W=I7(v),J=async(N)=>{let{abs:$}=await fv.resolveWithinBoundary(W,N);return $},Q=(N,$,O=!1)=>{if(O&&N==="")return;if(!/^[a-f0-9]{64}$/.test(N)){let h=O?"empty string or 64-character lowercase hex SHA-256 hash":"64-character lowercase hex SHA-256 hash";throw fv.fsError("VALIDATION_ERROR",`Invalid ${$}: must be a ${h}`,{[$]:N})}},X=(N)=>{return RJ("sha256").update(N,"utf-8").digest("hex")},Y=(N)=>{return RJ("sha256").update(N).digest("hex")},w=async(N)=>{let $=await J(N);try{return await S7($,l7.F_OK),!0}catch{return!1}},B=async(N)=>{let $=await J(N);try{return await T0($)}catch(O){throw fv.mapOsError(O,{path:N,resolved:$,operation:"stat"})}},z=async(N)=>{let $=await J(N),O;try{O=await T0($)}catch(h){throw fv.mapOsError(h,{path:N,resolved:$,operation:"stat"})}if(!O.isFile())throw fv.fsError("VALIDATION_ERROR","Target is not a regular file",{path:N,resolved:$});try{let h=await b7($,"utf-8"),H=X(h);return{content:h,hash:H}}catch(h){throw fv.mapOsError(h,{path:N,resolved:$,operation:"readFile"})}},K=async(N,$,O)=>{Q($,"baseHash",!0);let h=await J(N),H=X(O),k;try{k=(await z(N)).hash}catch(T){if(T.code==="NOT_FOUND"){if($!=="")throw fv.fsError("HASH_MISMATCH",`Hash mismatch: expected '${$}' for new file, got '' (file does not exist)`,{path:N,expected:$,actual:""});let E;try{E=await T0(h)}catch(g){if(g.code==="ENOENT")E=null;else throw fv.mapOsError(g,{path:N,resolved:h,operation:"stat"})}if(E&&!E.isFile())throw fv.fsError("VALIDATION_ERROR","Target path exists and is not a regular file",{path:N,resolved:h});try{await y7(x0(h),{recursive:!0})}catch(g){throw fv.mapOsError(g,{path:x0(N),resolved:x0(h),operation:"mkdir"})}k=""}else throw T}if(k!==$)throw fv.fsError("HASH_MISMATCH",`Hash mismatch: expected '${$}', got '${k}'`,{path:N,expected:$,actual:k});if(H===$)return{newHash:$};let l=`${h}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{await R7(l,O,{encoding:"utf-8",mode:384}),await k7(l,h)}catch(T){try{await bJ(l)}catch{}throw fv.mapOsError(T,{path:N,resolved:h,operation:"writeTextAtomicIfUnchanged"})}return{newHash:H}},L=async(N,$)=>{Q($,"expectedHash",!1);let O=await J(N),h;try{h=(await z(N)).hash}catch(H){if(H.code==="NOT_FOUND")return{deleted:!1};throw H}if(h!==$)throw fv.fsError("HASH_MISMATCH",`Hash mismatch: expected '${$}', got '${h}'`,{path:N,expected:$,actual:h});try{return await bJ(O),{deleted:!0}}catch(H){throw fv.mapOsError(H,{path:N,resolved:O,operation:"deleteIfUnchanged"})}},D=(N,$,O)=>{for(let k=0;k<$.length;k++){let{oldText:l}=$[k];if(l.length===0)throw fv.fsError("VALIDATION_ERROR",`Empty oldText in replacement at index ${k} would cause infinite loop`,{index:k})}let h=N,H=0;for(let{oldText:k,newText:l}of $)if(h.includes(k))h=h.replace(k,l),H++;if(O?.requireAll&&H!==$.length)throw fv.fsError("VALIDATION_ERROR",`Only ${H} of ${$.length} replacements were applied (requireAll=true)`,{applied:H,total:$.length});return{wouldContent:h,wouldHash:X(h),applied:H}};return Object.freeze({exists:w,stat:B,readText:z,computeHashForText:X,computeHashForBytes:Y,resolveSafe:async(N)=>{return fv.resolveWithinBoundary(W,N)},writeTextAtomicIfUnchanged:K,deleteIfUnchanged:L,previewReplaceFirst:D,applyReplaceFirstIfUnchanged:async(N,$,O,h)=>{Q($,"expectedHash",!1);let{content:H,hash:k}=await z(N);if(k!==$)throw fv.fsError("HASH_MISMATCH",`Hash mismatch: expected '${$}', got '${k}'`,{path:N,expected:$,actual:k});let{wouldContent:l,wouldHash:T,applied:E}=D(H,O,h);if(E===0)return{newHash:k,applied:0};return await K(N,k,l),{newHash:T,applied:E}}})},T7,u0;var kJ=Ef(()=>{C0();T7=Object.freeze({create:C7}),u0=T7});import{mkdir as x7,rm as u7,rmdir as r7,stat as SJ,readdir as m7}from"fs/promises";import{resolve as yJ,dirname as a7,isAbsolute as lJ}from"path";var c7=(f)=>{let{boundaryDir:v}=f;if(!v)throw fv.fsError("VALIDATION_ERROR","boundaryDir is required (empty string)",{boundaryDir:v});if(!lJ(v))throw fv.fsError("VALIDATION_ERROR",`boundaryDir must be an absolute path: '${v}'`,{boundaryDir:v});let W=yJ(v),J=(K)=>{let L=K.toLowerCase().replace(/[^a-z0-9-_]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");if(!L)throw fv.fsError("VALIDATION_ERROR",`normalizeName produced empty result from input: '${K}'`,{name:K,normalized:L});return L},Q=async(K,L)=>{return await fv.resolveWithinBoundary(W,K,L)};return Object.freeze({normalizeName:J,resolve:Q,isInsideBoundary:(K)=>{if(!lJ(K))throw fv.fsError("VALIDATION_ERROR",`targetAbs must be an absolute path: '${K}'`,{targetAbs:K});let L=yJ(K);return fv.insideBoundary(W,L)},ensureDir:async(K)=>{let{abs:L}=await Q(K);try{await x7(L,{recursive:!0})}catch(D){throw fv.mapOsError(D,{path:K,resolved:L,operation:"ensureDir"})}},parentDir:(K)=>{let L=fv.validateRelative(K),D=a7(L);return D==="."?D:D.replaceAll("\\","/")},stat:async(K)=>{let{abs:L}=await Q(K);try{return await SJ(L)}catch(D){throw fv.mapOsError(D,{path:K,resolved:L,operation:"stat"})}},deleteDir:async(K,L)=>{if(L?.requireEmpty&&L?.recursive)throw fv.fsError("VALIDATION_ERROR","requireEmpty and recursive are mutually exclusive",{path:K});let{abs:D}=await Q(K);if(D===W)throw fv.fsError("VALIDATION_ERROR",`Cannot delete boundary root: '${K}' \u2192 '${D}'`,{path:K,resolved:D,boundary:W});let q;try{q=await SJ(D)}catch(M){if(M.code==="ENOENT")return{deleted:!1,reason:"NOT_FOUND"};throw fv.mapOsError(M,{path:K,resolved:D,operation:"stat"})}if(!q.isDirectory())return{deleted:!1,reason:"NOT_DIR"};if(L?.requireEmpty){let M;try{M=await m7(D)}catch(N){throw fv.mapOsError(N,{path:K,resolved:D,operation:"readdir"})}if(M.length>0)throw fv.fsError("DIRECTORY_NOT_EMPTY",`Directory not empty: '${K}' \u2192 '${D}'`,{path:K,resolved:D});try{return await r7(D),{deleted:!0}}catch(N){if(N.code==="ENOENT")return{deleted:!1,reason:"NOT_FOUND"};if(N.code==="ENOTEMPTY")throw fv.fsError("DIRECTORY_NOT_EMPTY",`Directory not empty (race condition): '${K}' \u2192 '${D}'`,{path:K,resolved:D});throw fv.mapOsError(N,{path:K,resolved:D,operation:"rmdir"})}}try{return await u7(D,{recursive:L?.recursive??!1}),{deleted:!0}}catch(M){if(M.code==="ENOENT")return{deleted:!1,reason:"NOT_FOUND"};if(M.code==="ENOTEMPTY"||M.code==="EISDIR"||M.code==="EACCES")throw fv.fsError("DIRECTORY_NOT_EMPTY",`Directory not empty: '${K}' \u2192 '${D}'`,{path:K,resolved:D,originalCode:M.code});throw fv.mapOsError(M,{path:K,resolved:D,operation:"deleteDir"})}}})},n7,r0;var IJ=Ef(()=>{C0();n7=Object.freeze({create:c7}),r0=n7});import{dirname as p7}from"path";var ZJ="---",Av=(f,v,W)=>{let J=new Error(v);if(J.code=f,W!==void 0)J.data=W;throw J},i7=(f)=>{let{fileServiceByScope:v,folderServiceByScope:W,indexFilename:J}=f,Q=(E)=>{if(E==="project")return v.project;if(E==="shared")return v.shared;return Av("INVALID_SCOPE",`Unknown scope '${E}'`,{scope:E})},X=(E)=>{if(E==="project")return W.project;if(E==="shared")return W.shared;return Av("INVALID_SCOPE",`Unknown scope '${E}'`,{scope:E})},Y=async(E)=>{if(E.scope)return{scope:E.scope};if(E.kind==="id"){let U=I0(E.id);if(!U)Av("INVALID_ID_FORMAT",`Invalid doc ID format: '${E.id}'. Expected docNNN or sdocNNN`,{id:E.id});return{scope:U}}if(E.kind==="path"){try{let U=await B("project");if(Object.entries(U.index).find(([I,S])=>S===E.path))return{scope:"project"}}catch{}try{let U=await B("shared");if(Object.entries(U.index).find(([I,S])=>S===E.path))return{scope:"shared",fallback:!0}}catch{}return{scope:"project"}}let g=E;return Av("VALIDATION_ERROR",`Unknown address kind: ${JSON.stringify(g)}`)},w=(E)=>{return J},B=async(E)=>{let g=w(E),U=Q(E);try{let{content:b,hash:I}=await U.readText(g);return{index:JSON.parse(b),hash:I}}catch(b){if(b.code==="NOT_FOUND")return{index:{},hash:""};throw b}},z=async(E,g,U)=>{let b=w(E),I=Q(E),S=JSON.stringify(g,null,2);try{let{newHash:_}=await I.writeTextAtomicIfUnchanged(b,U,S);return{hash:_}}catch(_){if(_.code==="HASH_MISMATCH"){let{index:R,hash:y}=await B(E),r={...R,...g},a=JSON.stringify(r,null,2),{newHash:i}=await I.writeTextAtomicIfUnchanged(b,y,a);return{hash:i}}throw _}},K=(E)=>{let g=E.split(`
3
- `);if(g.length<3||g[0].trim()!==ZJ)return{bodyContent:E};let U=-1;for(let y=1;y<g.length;y++)if(g[y].trim()===ZJ){U=y;break}if(U===-1)return{bodyContent:E};let b=g.slice(1,U),I=g.slice(0,U+1).join(`
2
+ var P6=Object.create;var{getPrototypeOf:K6,defineProperty:ZQ,getOwnPropertyNames:z6}=Object;var $6=Object.prototype.hasOwnProperty;var L6=(f,v,W)=>{W=f!=null?P6(K6(f)):{};let J=v||!f||!f.__esModule?ZQ(W,"default",{value:f,enumerable:!0}):W;for(let Q of z6(f))if(!$6.call(J,Q))ZQ(J,Q,{get:()=>f[Q],enumerable:!0});return J};var s=(f,v)=>()=>(v||f((v={exports:{}}).exports,v),v.exports);var v8=(f,v)=>{for(var W in v)ZQ(f,W,{get:v[W],enumerable:!0,configurable:!0,set:(J)=>v[W]=()=>J})};var Ef=(f,v)=>()=>(f&&(v=f(f=0)),v);var k8=s((JQ,R8)=>{(function(f,v){typeof JQ==="object"&&typeof R8!=="undefined"?v(JQ):typeof define==="function"&&define.amd?define(["exports"],v):v(f.URI=f.URI||{})})(JQ,function(f){function v(){for(var D=arguments.length,P=Array(D),j=0;j<D;j++)P[j]=arguments[j];if(P.length>1){P[0]=P[0].slice(0,-1);var F=P.length-1;for(var A=1;A<F;++A)P[A]=P[A].slice(1,-1);return P[F]=P[F].slice(1),P.join("")}else return P[0]}function W(D){return"(?:"+D+")"}function J(D){return D===void 0?"undefined":D===null?"null":Object.prototype.toString.call(D).split(" ").pop().split("]").shift().toLowerCase()}function Q(D){return D.toUpperCase()}function X(D){return D!==void 0&&D!==null?D instanceof Array?D:typeof D.length!=="number"||D.split||D.setInterval||D.call?[D]:Array.prototype.slice.call(D):[]}function Y(D,P){var j=D;if(P)for(var F in P)j[F]=P[F];return j}function w(D){var P="[A-Za-z]",j="[\\x0D]",F="[0-9]",A="[\\x22]",r=v(F,"[A-Fa-f]"),e="[\\x0A]",Xv="[\\x20]",Bv=W(W("%[EFef]"+r+"%"+r+r+"%"+r+r)+"|"+W("%[89A-Fa-f]"+r+"%"+r+r)+"|"+W("%"+r+r)),Hv="[\\:\\/\\?\\#\\[\\]\\@]",Jv="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Nv=v(Hv,Jv),Fv=D?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Lv=D?"[\\uE000-\\uF8FF]":"[]",wv=v(P,F,"[\\-\\.\\_\\~]",Fv),Vv=W(P+v(P,F,"[\\+\\-\\.]")+"*"),qv=W(W(Bv+"|"+v(wv,Jv,"[\\:]"))+"*"),Sf=W(W("25[0-5]")+"|"+W("2[0-4]"+F)+"|"+W("1"+F+F)+"|"+W("[1-9]"+F)+"|"+F),uv=W(W("25[0-5]")+"|"+W("2[0-4]"+F)+"|"+W("1"+F+F)+"|"+W("0?[1-9]"+F)+"|0?0?"+F),av=W(uv+"\\."+uv+"\\."+uv+"\\."+uv),Pv=W(r+"{1,4}"),mv=W(W(Pv+"\\:"+Pv)+"|"+av),cv=W(W(Pv+"\\:")+"{6}"+mv),Yf=W("\\:\\:"+W(Pv+"\\:")+"{5}"+mv),yf=W(W(Pv)+"?\\:\\:"+W(Pv+"\\:")+"{4}"+mv),zf=W(W(W(Pv+"\\:")+"{0,1}"+Pv)+"?\\:\\:"+W(Pv+"\\:")+"{3}"+mv),L1=W(W(W(Pv+"\\:")+"{0,2}"+Pv)+"?\\:\\:"+W(Pv+"\\:")+"{2}"+mv),l1=W(W(W(Pv+"\\:")+"{0,3}"+Pv)+"?\\:\\:"+Pv+"\\:"+mv),I1=W(W(W(Pv+"\\:")+"{0,4}"+Pv)+"?\\:\\:"+mv),af=W(W(W(Pv+"\\:")+"{0,5}"+Pv)+"?\\:\\:"+Pv),cf=W(W(W(Pv+"\\:")+"{0,6}"+Pv)+"?\\:\\:"),$f=W([cv,Yf,yf,zf,L1,l1,I1,af,cf].join("|")),nf=W(W(wv+"|"+Bv)+"+"),lQ=W($f+"\\%25"+nf),lf=W($f+W("\\%25|\\%(?!"+r+"{2})")+nf),J6=W("[vV]"+r+"+\\."+v(wv,Jv,"[\\:]")+"+"),X6=W("\\["+W(lf+"|"+$f+"|"+J6)+"\\]"),o0=W(W(Bv+"|"+v(wv,Jv))+"*"),M1=W(X6+"|"+av+"(?!"+o0+")|"+o0),N1=W(F+"*"),s0=W(W(qv+"@")+"?"+M1+W("\\:"+N1)+"?"),V1=W(Bv+"|"+v(wv,Jv,"[\\:\\@]")),Y6=W(V1+"*"),t0=W(V1+"+"),w6=W(W(Bv+"|"+v(wv,Jv,"[\\@]"))+"+"),Lf=W(W("\\/"+Y6)+"*"),pf=W("\\/"+W(t0+Lf)+"?"),IQ=W(w6+Lf),Z1=W(t0+Lf),df="(?!"+V1+")",B2=W(Lf+"|"+pf+"|"+IQ+"|"+Z1+"|"+df),of=W(W(V1+"|"+v("[\\/\\?]",Lv))+"*"),D1=W(W(V1+"|[\\/\\?]")+"*"),e0=W(W("\\/\\/"+s0+Lf)+"|"+pf+"|"+Z1+"|"+df),G6=W(Vv+"\\:"+e0+W("\\?"+of)+"?"+W("\\#"+D1)+"?"),B6=W(W("\\/\\/"+s0+Lf)+"|"+pf+"|"+IQ+"|"+df),q6=W(B6+W("\\?"+of)+"?"+W("\\#"+D1)+"?"),q2=W(G6+"|"+q6),P2=W(Vv+"\\:"+e0+W("\\?"+of)+"?"),K2="^("+Vv+")\\:"+W(W("\\/\\/("+W("("+qv+")@")+"?("+M1+")"+W("\\:("+N1+")")+"?)")+"?("+Lf+"|"+pf+"|"+Z1+"|"+df+")")+W("\\?("+of+")")+"?"+W("\\#("+D1+")")+"?$",z2="^(){0}"+W(W("\\/\\/("+W("("+qv+")@")+"?("+M1+")"+W("\\:("+N1+")")+"?)")+"?("+Lf+"|"+pf+"|"+IQ+"|"+df+")")+W("\\?("+of+")")+"?"+W("\\#("+D1+")")+"?$",$2="^("+Vv+")\\:"+W(W("\\/\\/("+W("("+qv+")@")+"?("+M1+")"+W("\\:("+N1+")")+"?)")+"?("+Lf+"|"+pf+"|"+Z1+"|"+df+")")+W("\\?("+of+")")+"?$",L2="^"+W("\\#("+D1+")")+"?$",M2="^"+W("("+qv+")@")+"?("+M1+")"+W("\\:("+N1+")")+"?$";return{NOT_SCHEME:new RegExp(v("[^]",P,F,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(v("[^\\%\\:]",wv,Jv),"g"),NOT_HOST:new RegExp(v("[^\\%\\[\\]\\:]",wv,Jv),"g"),NOT_PATH:new RegExp(v("[^\\%\\/\\:\\@]",wv,Jv),"g"),NOT_PATH_NOSCHEME:new RegExp(v("[^\\%\\/\\@]",wv,Jv),"g"),NOT_QUERY:new RegExp(v("[^\\%]",wv,Jv,"[\\:\\@\\/\\?]",Lv),"g"),NOT_FRAGMENT:new RegExp(v("[^\\%]",wv,Jv,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(v("[^]",wv,Jv),"g"),UNRESERVED:new RegExp(wv,"g"),OTHER_CHARS:new RegExp(v("[^\\%]",wv,Nv),"g"),PCT_ENCODED:new RegExp(Bv,"g"),IPV4ADDRESS:new RegExp("^("+av+")$"),IPV6ADDRESS:new RegExp("^\\[?("+$f+")"+W(W("\\%25|\\%(?!"+r+"{2})")+"("+nf+")")+"?\\]?$")}}var B=w(!1),z=w(!0),K=function(){function D(P,j){var F=[],A=!0,r=!1,e=void 0;try{for(var Xv=P[Symbol.iterator](),Bv;!(A=(Bv=Xv.next()).done);A=!0)if(F.push(Bv.value),j&&F.length===j)break}catch(Hv){r=!0,e=Hv}finally{try{if(!A&&Xv.return)Xv.return()}finally{if(r)throw e}}return F}return function(P,j){if(Array.isArray(P))return P;else if(Symbol.iterator in Object(P))return D(P,j);else throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),L=function(D){if(Array.isArray(D)){for(var P=0,j=Array(D.length);P<D.length;P++)j[P]=D[P];return j}else return Array.from(D)},V=2147483647,q=36,M=1,N=26,$=38,O=700,h=72,H=128,k="-",l=/^xn--/,T=/[^\0-\x7E]/,E=/[\x2E\u3002\uFF0E\uFF61]/g,g={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},U=q-M,b=Math.floor,I=String.fromCharCode;function S(D){throw new RangeError(g[D])}function _(D,P){var j=[],F=D.length;while(F--)j[F]=P(D[F]);return j}function R(D,P){var j=D.split("@"),F="";if(j.length>1)F=j[0]+"@",D=j[1];D=D.replace(E,".");var A=D.split("."),r=_(A,P).join(".");return F+r}function y(D){var P=[],j=0,F=D.length;while(j<F){var A=D.charCodeAt(j++);if(A>=55296&&A<=56319&&j<F){var r=D.charCodeAt(j++);if((r&64512)==56320)P.push(((A&1023)<<10)+(r&1023)+65536);else P.push(A),j--}else P.push(A)}return P}var m=function D(P){return String.fromCodePoint.apply(String,L(P))},a=function D(P){if(P-48<10)return P-22;if(P-65<26)return P-65;if(P-97<26)return P-97;return q},i=function D(P,j){return P+22+75*(P<26)-((j!=0)<<5)},p=function D(P,j,F){var A=0;P=F?b(P/O):P>>1,P+=b(P/j);for(;P>U*N>>1;A+=q)P=b(P/U);return b(A+(U+1)*P/(P+$))},n=function D(P){var j=[],F=P.length,A=0,r=H,e=h,Xv=P.lastIndexOf(k);if(Xv<0)Xv=0;for(var Bv=0;Bv<Xv;++Bv){if(P.charCodeAt(Bv)>=128)S("not-basic");j.push(P.charCodeAt(Bv))}for(var Hv=Xv>0?Xv+1:0;Hv<F;){var Jv=A;for(var Nv=1,Fv=q;;Fv+=q){if(Hv>=F)S("invalid-input");var Lv=a(P.charCodeAt(Hv++));if(Lv>=q||Lv>b((V-A)/Nv))S("overflow");A+=Lv*Nv;var wv=Fv<=e?M:Fv>=e+N?N:Fv-e;if(Lv<wv)break;var Vv=q-wv;if(Nv>b(V/Vv))S("overflow");Nv*=Vv}var qv=j.length+1;if(e=p(A-Jv,qv,Jv==0),b(A/qv)>V-r)S("overflow");r+=b(A/qv),A%=qv,j.splice(A++,0,r)}return String.fromCodePoint.apply(String,j)},$v=function D(P){var j=[];P=y(P);var F=P.length,A=H,r=0,e=h,Xv=!0,Bv=!1,Hv=void 0;try{for(var Jv=P[Symbol.iterator](),Nv;!(Xv=(Nv=Jv.next()).done);Xv=!0){var Fv=Nv.value;if(Fv<128)j.push(I(Fv))}}catch(lf){Bv=!0,Hv=lf}finally{try{if(!Xv&&Jv.return)Jv.return()}finally{if(Bv)throw Hv}}var Lv=j.length,wv=Lv;if(Lv)j.push(k);while(wv<F){var Vv=V,qv=!0,Sf=!1,uv=void 0;try{for(var av=P[Symbol.iterator](),Pv;!(qv=(Pv=av.next()).done);qv=!0){var mv=Pv.value;if(mv>=A&&mv<Vv)Vv=mv}}catch(lf){Sf=!0,uv=lf}finally{try{if(!qv&&av.return)av.return()}finally{if(Sf)throw uv}}var cv=wv+1;if(Vv-A>b((V-r)/cv))S("overflow");r+=(Vv-A)*cv,A=Vv;var Yf=!0,yf=!1,zf=void 0;try{for(var L1=P[Symbol.iterator](),l1;!(Yf=(l1=L1.next()).done);Yf=!0){var I1=l1.value;if(I1<A&&++r>V)S("overflow");if(I1==A){var af=r;for(var cf=q;;cf+=q){var $f=cf<=e?M:cf>=e+N?N:cf-e;if(af<$f)break;var nf=af-$f,lQ=q-$f;j.push(I(i($f+nf%lQ,0))),af=b(nf/lQ)}j.push(I(i(af,0))),e=p(r,cv,wv==Lv),r=0,++wv}}}catch(lf){yf=!0,zf=lf}finally{try{if(!Yf&&L1.return)L1.return()}finally{if(yf)throw zf}}++r,++A}return j.join("")},bv=function D(P){return R(P,function(j){return l.test(j)?n(j.slice(4).toLowerCase()):j})},Sv=function D(P){return R(P,function(j){return T.test(j)?"xn--"+$v(j):j})},Yv={version:"2.1.0",ucs2:{decode:y,encode:m},decode:n,encode:$v,toASCII:Sv,toUnicode:bv},Ov={};function gv(D){var P=D.charCodeAt(0),j=void 0;if(P<16)j="%0"+P.toString(16).toUpperCase();else if(P<128)j="%"+P.toString(16).toUpperCase();else if(P<2048)j="%"+(P>>6|192).toString(16).toUpperCase()+"%"+(P&63|128).toString(16).toUpperCase();else j="%"+(P>>12|224).toString(16).toUpperCase()+"%"+(P>>6&63|128).toString(16).toUpperCase()+"%"+(P&63|128).toString(16).toUpperCase();return j}function yv(D){var P="",j=0,F=D.length;while(j<F){var A=parseInt(D.substr(j+1,2),16);if(A<128)P+=String.fromCharCode(A),j+=3;else if(A>=194&&A<224){if(F-j>=6){var r=parseInt(D.substr(j+4,2),16);P+=String.fromCharCode((A&31)<<6|r&63)}else P+=D.substr(j,6);j+=6}else if(A>=224){if(F-j>=9){var e=parseInt(D.substr(j+4,2),16),Xv=parseInt(D.substr(j+7,2),16);P+=String.fromCharCode((A&15)<<12|(e&63)<<6|Xv&63)}else P+=D.substr(j,9);j+=9}else P+=D.substr(j,3),j+=3}return P}function Df(D,P){function j(F){var A=yv(F);return!A.match(P.UNRESERVED)?F:A}if(D.scheme)D.scheme=String(D.scheme).replace(P.PCT_ENCODED,j).toLowerCase().replace(P.NOT_SCHEME,"");if(D.userinfo!==void 0)D.userinfo=String(D.userinfo).replace(P.PCT_ENCODED,j).replace(P.NOT_USERINFO,gv).replace(P.PCT_ENCODED,Q);if(D.host!==void 0)D.host=String(D.host).replace(P.PCT_ENCODED,j).toLowerCase().replace(P.NOT_HOST,gv).replace(P.PCT_ENCODED,Q);if(D.path!==void 0)D.path=String(D.path).replace(P.PCT_ENCODED,j).replace(D.scheme?P.NOT_PATH:P.NOT_PATH_NOSCHEME,gv).replace(P.PCT_ENCODED,Q);if(D.query!==void 0)D.query=String(D.query).replace(P.PCT_ENCODED,j).replace(P.NOT_QUERY,gv).replace(P.PCT_ENCODED,Q);if(D.fragment!==void 0)D.fragment=String(D.fragment).replace(P.PCT_ENCODED,j).replace(P.NOT_FRAGMENT,gv).replace(P.PCT_ENCODED,Q);return D}function Pf(D){return D.replace(/^0*(.*)/,"$1")||"0"}function Uv(D,P){var j=D.match(P.IPV4ADDRESS)||[],F=K(j,2),A=F[1];if(A)return A.split(".").map(Pf).join(".");else return D}function jv(D,P){var j=D.match(P.IPV6ADDRESS)||[],F=K(j,3),A=F[1],r=F[2];if(A){var e=A.toLowerCase().split("::").reverse(),Xv=K(e,2),Bv=Xv[0],Hv=Xv[1],Jv=Hv?Hv.split(":").map(Pf):[],Nv=Bv.split(":").map(Pf),Fv=P.IPV4ADDRESS.test(Nv[Nv.length-1]),Lv=Fv?7:8,wv=Nv.length-Lv,Vv=Array(Lv);for(var qv=0;qv<Lv;++qv)Vv[qv]=Jv[qv]||Nv[wv+qv]||"";if(Fv)Vv[Lv-1]=Uv(Vv[Lv-1],P);var Sf=Vv.reduce(function(cv,Yf,yf){if(!Yf||Yf==="0"){var zf=cv[cv.length-1];if(zf&&zf.index+zf.length===yf)zf.length++;else cv.push({index:yf,length:1})}return cv},[]),uv=Sf.sort(function(cv,Yf){return Yf.length-cv.length})[0],av=void 0;if(uv&&uv.length>1){var Pv=Vv.slice(0,uv.index),mv=Vv.slice(uv.index+uv.length);av=Pv.join(":")+"::"+mv.join(":")}else av=Vv.join(":");if(r)av+="%"+r;return av}else return D}var bf=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Rv="".match(/(){0}/)[1]===void 0;function Gv(D){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j={},F=P.iri!==!1?z:B;if(P.reference==="suffix")D=(P.scheme?P.scheme+":":"")+"//"+D;var A=D.match(bf);if(A){if(Rv){if(j.scheme=A[1],j.userinfo=A[3],j.host=A[4],j.port=parseInt(A[5],10),j.path=A[6]||"",j.query=A[7],j.fragment=A[8],isNaN(j.port))j.port=A[5]}else if(j.scheme=A[1]||void 0,j.userinfo=D.indexOf("@")!==-1?A[3]:void 0,j.host=D.indexOf("//")!==-1?A[4]:void 0,j.port=parseInt(A[5],10),j.path=A[6]||"",j.query=D.indexOf("?")!==-1?A[7]:void 0,j.fragment=D.indexOf("#")!==-1?A[8]:void 0,isNaN(j.port))j.port=D.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?A[4]:void 0;if(j.host)j.host=jv(Uv(j.host,F),F);if(j.scheme===void 0&&j.userinfo===void 0&&j.host===void 0&&j.port===void 0&&!j.path&&j.query===void 0)j.reference="same-document";else if(j.scheme===void 0)j.reference="relative";else if(j.fragment===void 0)j.reference="absolute";else j.reference="uri";if(P.reference&&P.reference!=="suffix"&&P.reference!==j.reference)j.error=j.error||"URI is not a "+P.reference+" reference.";var r=Ov[(P.scheme||j.scheme||"").toLowerCase()];if(!P.unicodeSupport&&(!r||!r.unicodeSupport)){if(j.host&&(P.domainHost||r&&r.domainHost))try{j.host=Yv.toASCII(j.host.replace(F.PCT_ENCODED,yv).toLowerCase())}catch(e){j.error=j.error||"Host's domain name can not be converted to ASCII via punycode: "+e}Df(j,B)}else Df(j,F);if(r&&r.parse)r.parse(j,P)}else j.error=j.error||"URI can not be parsed.";return j}function jf(D,P){var j=P.iri!==!1?z:B,F=[];if(D.userinfo!==void 0)F.push(D.userinfo),F.push("@");if(D.host!==void 0)F.push(jv(Uv(String(D.host),j),j).replace(j.IPV6ADDRESS,function(A,r,e){return"["+r+(e?"%25"+e:"")+"]"}));if(typeof D.port==="number"||typeof D.port==="string")F.push(":"),F.push(String(D.port));return F.length?F.join(""):void 0}var Kf=/^\.\.?\//,Rf=/^\/\.(\/|$)/,kf=/^\/\.\.(\/|$)/,_v=/^\/?(?:.|\n)*?(?=\/|$)/;function rv(D){var P=[];while(D.length)if(D.match(Kf))D=D.replace(Kf,"");else if(D.match(Rf))D=D.replace(Rf,"/");else if(D.match(kf))D=D.replace(kf,"/"),P.pop();else if(D==="."||D==="..")D="";else{var j=D.match(_v);if(j){var F=j[0];D=D.slice(F.length),P.push(F)}else throw new Error("Unexpected dot segment condition")}return P.join("")}function Zv(D){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j=P.iri?z:B,F=[],A=Ov[(P.scheme||D.scheme||"").toLowerCase()];if(A&&A.serialize)A.serialize(D,P);if(D.host){if(j.IPV6ADDRESS.test(D.host));else if(P.domainHost||A&&A.domainHost)try{D.host=!P.iri?Yv.toASCII(D.host.replace(j.PCT_ENCODED,yv).toLowerCase()):Yv.toUnicode(D.host)}catch(Xv){D.error=D.error||"Host's domain name can not be converted to "+(!P.iri?"ASCII":"Unicode")+" via punycode: "+Xv}}if(Df(D,j),P.reference!=="suffix"&&D.scheme)F.push(D.scheme),F.push(":");var r=jf(D,P);if(r!==void 0){if(P.reference!=="suffix")F.push("//");if(F.push(r),D.path&&D.path.charAt(0)!=="/")F.push("/")}if(D.path!==void 0){var e=D.path;if(!P.absolutePath&&(!A||!A.absolutePath))e=rv(e);if(r===void 0)e=e.replace(/^\/\//,"/%2F");F.push(e)}if(D.query!==void 0)F.push("?"),F.push(D.query);if(D.fragment!==void 0)F.push("#"),F.push(D.fragment);return F.join("")}function lv(D,P){var j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},F=arguments[3],A={};if(!F)D=Gv(Zv(D,j),j),P=Gv(Zv(P,j),j);if(j=j||{},!j.tolerant&&P.scheme)A.scheme=P.scheme,A.userinfo=P.userinfo,A.host=P.host,A.port=P.port,A.path=rv(P.path||""),A.query=P.query;else{if(P.userinfo!==void 0||P.host!==void 0||P.port!==void 0)A.userinfo=P.userinfo,A.host=P.host,A.port=P.port,A.path=rv(P.path||""),A.query=P.query;else{if(!P.path)if(A.path=D.path,P.query!==void 0)A.query=P.query;else A.query=D.query;else{if(P.path.charAt(0)==="/")A.path=rv(P.path);else{if((D.userinfo!==void 0||D.host!==void 0||D.port!==void 0)&&!D.path)A.path="/"+P.path;else if(!D.path)A.path=P.path;else A.path=D.path.slice(0,D.path.lastIndexOf("/")+1)+P.path;A.path=rv(A.path)}A.query=P.query}A.userinfo=D.userinfo,A.host=D.host,A.port=D.port}A.scheme=D.scheme}return A.fragment=P.fragment,A}function Jf(D,P,j){var F=Y({scheme:"null"},j);return Zv(lv(Gv(D,F),Gv(P,F),F,!0),F)}function xv(D,P){if(typeof D==="string")D=Zv(Gv(D,P),P);else if(J(D)==="object")D=Gv(Zv(D,P),P);return D}function y1(D,P,j){if(typeof D==="string")D=Zv(Gv(D,j),j);else if(J(D)==="object")D=Zv(D,j);if(typeof P==="string")P=Zv(Gv(P,j),j);else if(J(P)==="object")P=Zv(P,j);return D===P}function SQ(D,P){return D&&D.toString().replace(!P||!P.iri?B.ESCAPE:z.ESCAPE,gv)}function iv(D,P){return D&&D.toString().replace(!P||!P.iri?B.PCT_ENCODED:z.PCT_ENCODED,yv)}var z1={scheme:"http",domainHost:!0,parse:function D(P,j){if(!P.host)P.error=P.error||"HTTP URIs must have a host.";return P},serialize:function D(P,j){var F=String(P.scheme).toLowerCase()==="https";if(P.port===(F?443:80)||P.port==="")P.port=void 0;if(!P.path)P.path="/";return P}},m0={scheme:"https",domainHost:z1.domainHost,parse:z1.parse,serialize:z1.serialize};function r0(D){return typeof D.secure==="boolean"?D.secure:String(D.scheme).toLowerCase()==="wss"}var $1={scheme:"ws",domainHost:!0,parse:function D(P,j){var F=P;return F.secure=r0(F),F.resourceName=(F.path||"/")+(F.query?"?"+F.query:""),F.path=void 0,F.query=void 0,F},serialize:function D(P,j){if(P.port===(r0(P)?443:80)||P.port==="")P.port=void 0;if(typeof P.secure==="boolean")P.scheme=P.secure?"wss":"ws",P.secure=void 0;if(P.resourceName){var F=P.resourceName.split("?"),A=K(F,2),r=A[0],e=A[1];P.path=r&&r!=="/"?r:void 0,P.query=e,P.resourceName=void 0}return P.fragment=void 0,P}},a0={scheme:"wss",domainHost:$1.domainHost,parse:$1.parse,serialize:$1.serialize},nJ={},pJ=!0,c0="[A-Za-z0-9\\-\\.\\_\\~"+(pJ?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Xf="[0-9A-Fa-f]",iJ=W(W("%[EFef]"+Xf+"%"+Xf+Xf+"%"+Xf+Xf)+"|"+W("%[89A-Fa-f]"+Xf+"%"+Xf+Xf)+"|"+W("%"+Xf+Xf)),dJ="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",oJ="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",sJ=v(oJ,"[\\\"\\\\]"),tJ="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",eJ=new RegExp(c0,"g"),rf=new RegExp(iJ,"g"),v6=new RegExp(v("[^]",dJ,"[\\.]","[\\\"]",sJ),"g"),n0=new RegExp(v("[^]",c0,tJ),"g"),f6=n0;function yQ(D){var P=yv(D);return!P.match(eJ)?D:P}var p0={scheme:"mailto",parse:function D(P,j){var F=P,A=F.to=F.path?F.path.split(","):[];if(F.path=void 0,F.query){var r=!1,e={},Xv=F.query.split("&");for(var Bv=0,Hv=Xv.length;Bv<Hv;++Bv){var Jv=Xv[Bv].split("=");switch(Jv[0]){case"to":var Nv=Jv[1].split(",");for(var Fv=0,Lv=Nv.length;Fv<Lv;++Fv)A.push(Nv[Fv]);break;case"subject":F.subject=iv(Jv[1],j);break;case"body":F.body=iv(Jv[1],j);break;default:r=!0,e[iv(Jv[0],j)]=iv(Jv[1],j);break}}if(r)F.headers=e}F.query=void 0;for(var wv=0,Vv=A.length;wv<Vv;++wv){var qv=A[wv].split("@");if(qv[0]=iv(qv[0]),!j.unicodeSupport)try{qv[1]=Yv.toASCII(iv(qv[1],j).toLowerCase())}catch(Sf){F.error=F.error||"Email address's domain name can not be converted to ASCII via punycode: "+Sf}else qv[1]=iv(qv[1],j).toLowerCase();A[wv]=qv.join("@")}return F},serialize:function D(P,j){var F=P,A=X(P.to);if(A){for(var r=0,e=A.length;r<e;++r){var Xv=String(A[r]),Bv=Xv.lastIndexOf("@"),Hv=Xv.slice(0,Bv).replace(rf,yQ).replace(rf,Q).replace(v6,gv),Jv=Xv.slice(Bv+1);try{Jv=!j.iri?Yv.toASCII(iv(Jv,j).toLowerCase()):Yv.toUnicode(Jv)}catch(wv){F.error=F.error||"Email address's domain name can not be converted to "+(!j.iri?"ASCII":"Unicode")+" via punycode: "+wv}A[r]=Hv+"@"+Jv}F.path=A.join(",")}var Nv=P.headers=P.headers||{};if(P.subject)Nv.subject=P.subject;if(P.body)Nv.body=P.body;var Fv=[];for(var Lv in Nv)if(Nv[Lv]!==nJ[Lv])Fv.push(Lv.replace(rf,yQ).replace(rf,Q).replace(n0,gv)+"="+Nv[Lv].replace(rf,yQ).replace(rf,Q).replace(f6,gv));if(Fv.length)F.query=Fv.join("&");return F}},Q6=/^([^\:]+)\:(.*)/,i0={scheme:"urn",parse:function D(P,j){var F=P.path&&P.path.match(Q6),A=P;if(F){var r=j.scheme||A.scheme||"urn",e=F[1].toLowerCase(),Xv=F[2],Bv=r+":"+(j.nid||e),Hv=Ov[Bv];if(A.nid=e,A.nss=Xv,A.path=void 0,Hv)A=Hv.parse(A,j)}else A.error=A.error||"URN can not be parsed.";return A},serialize:function D(P,j){var F=j.scheme||P.scheme||"urn",A=P.nid,r=F+":"+(j.nid||A),e=Ov[r];if(e)P=e.serialize(P,j);var Xv=P,Bv=P.nss;return Xv.path=(A||j.nid)+":"+Bv,Xv}},W6=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,d0={scheme:"urn:uuid",parse:function D(P,j){var F=P;if(F.uuid=F.nss,F.nss=void 0,!j.tolerant&&(!F.uuid||!F.uuid.match(W6)))F.error=F.error||"UUID is not valid.";return F},serialize:function D(P,j){var F=P;return F.nss=(P.uuid||"").toLowerCase(),F}};Ov[z1.scheme]=z1,Ov[m0.scheme]=m0,Ov[$1.scheme]=$1,Ov[a0.scheme]=a0,Ov[p0.scheme]=p0,Ov[i0.scheme]=i0,Ov[d0.scheme]=d0,f.SCHEMES=Ov,f.pctEncChar=gv,f.pctDecChars=yv,f.parse=Gv,f.removeDotSegments=rv,f.serialize=Zv,f.resolveComponents=lv,f.resolve=Jf,f.normalize=xv,f.equal=y1,f.escapeComponent=SQ,f.unescapeComponent=iv,Object.defineProperty(f,"__esModule",{value:!0})})});var XQ=s((f4,S8)=>{S8.exports=function f(v,W){if(v===W)return!0;if(v&&W&&typeof v=="object"&&typeof W=="object"){if(v.constructor!==W.constructor)return!1;var J,Q,X;if(Array.isArray(v)){if(J=v.length,J!=W.length)return!1;for(Q=J;Q--!==0;)if(!f(v[Q],W[Q]))return!1;return!0}if(v.constructor===RegExp)return v.source===W.source&&v.flags===W.flags;if(v.valueOf!==Object.prototype.valueOf)return v.valueOf()===W.valueOf();if(v.toString!==Object.prototype.toString)return v.toString()===W.toString();if(X=Object.keys(v),J=X.length,J!==Object.keys(W).length)return!1;for(Q=J;Q--!==0;)if(!Object.prototype.hasOwnProperty.call(W,X[Q]))return!1;for(Q=J;Q--!==0;){var Y=X[Q];if(!f(v[Y],W[Y]))return!1}return!0}return v!==v&&W!==W}});var l8=s((Q4,y8)=>{y8.exports=function f(v){var W=0,J=v.length,Q=0,X;while(Q<J)if(W++,X=v.charCodeAt(Q++),X>=55296&&X<=56319&&Q<J){if(X=v.charCodeAt(Q),(X&64512)==56320)Q++}return W}});var uf=s((W4,C8)=>{C8.exports={copy:MX,checkDataType:v0,checkDataTypes:NX,coerceToTypes:VX,toHash:Q0,getProperty:W0,escapeQuotes:J0,equal:XQ(),ucs2length:l8(),varOccurences:EX,varReplace:OX,schemaHasRules:UX,schemaHasRulesExcept:HX,schemaUnknownRules:FX,toQuotedString:f0,getPathExpr:AX,getPath:gX,getData:bX,unescapeFragment:RX,unescapeJsonPointer:Y0,escapeFragment:kX,escapeJsonPointer:X0};function MX(f,v){v=v||{};for(var W in f)v[W]=f[W];return v}function v0(f,v,W,J){var Q=J?" !== ":" === ",X=J?" || ":" && ",Y=J?"!":"",w=J?"":"!";switch(f){case"null":return v+Q+"null";case"array":return Y+"Array.isArray("+v+")";case"object":return"("+Y+v+X+"typeof "+v+Q+'"object"'+X+w+"Array.isArray("+v+"))";case"integer":return"(typeof "+v+Q+'"number"'+X+w+"("+v+" % 1)"+X+v+Q+v+(W?X+Y+"isFinite("+v+")":"")+")";case"number":return"(typeof "+v+Q+'"'+f+'"'+(W?X+Y+"isFinite("+v+")":"")+")";default:return"typeof "+v+Q+'"'+f+'"'}}function NX(f,v,W){switch(f.length){case 1:return v0(f[0],v,W,!0);default:var J="",Q=Q0(f);if(Q.array&&Q.object)J=Q.null?"(":"(!"+v+" || ",J+="typeof "+v+' !== "object")',delete Q.null,delete Q.array,delete Q.object;if(Q.number)delete Q.integer;for(var X in Q)J+=(J?" && ":"")+v0(X,v,W,!0);return J}}var I8=Q0(["string","number","integer","boolean","null"]);function VX(f,v){if(Array.isArray(v)){var W=[];for(var J=0;J<v.length;J++){var Q=v[J];if(I8[Q])W[W.length]=Q;else if(f==="array"&&Q==="array")W[W.length]=Q}if(W.length)return W}else if(I8[v])return[v];else if(f==="array"&&v==="array")return["array"]}function Q0(f){var v={};for(var W=0;W<f.length;W++)v[f[W]]=!0;return v}var DX=/^[a-z$_][a-z$_0-9]*$/i,jX=/'|\\/g;function W0(f){return typeof f=="number"?"["+f+"]":DX.test(f)?"."+f:"['"+J0(f)+"']"}function J0(f){return f.replace(jX,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function EX(f,v){v+="[^0-9]";var W=f.match(new RegExp(v,"g"));return W?W.length:0}function OX(f,v,W){return v+="([^0-9])",W=W.replace(/\$/g,"$$$$"),f.replace(new RegExp(v,"g"),W+"$1")}function UX(f,v){if(typeof f=="boolean")return!f;for(var W in f)if(v[W])return!0}function HX(f,v,W){if(typeof f=="boolean")return!f&&W!="not";for(var J in f)if(J!=W&&v[J])return!0}function FX(f,v){if(typeof f=="boolean")return;for(var W in f)if(!v[W])return W}function f0(f){return"'"+J0(f)+"'"}function AX(f,v,W,J){var Q=W?"'/' + "+v+(J?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):J?"'[' + "+v+" + ']'":"'[\\'' + "+v+" + '\\']'";return Z8(f,Q)}function gX(f,v,W){var J=W?f0("/"+X0(v)):f0(W0(v));return Z8(f,J)}var _X=/^\/(?:[^~]|~0|~1)*$/,hX=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function bX(f,v,W){var J,Q,X,Y;if(f==="")return"rootData";if(f[0]=="/"){if(!_X.test(f))throw new Error("Invalid JSON-pointer: "+f);Q=f,X="rootData"}else{if(Y=f.match(hX),!Y)throw new Error("Invalid JSON-pointer: "+f);if(J=+Y[1],Q=Y[2],Q=="#"){if(J>=v)throw new Error("Cannot access property/index "+J+" levels up, current level is "+v);return W[v-J]}if(J>v)throw new Error("Cannot access data "+J+" levels up, current level is "+v);if(X="data"+(v-J||""),!Q)return X}var w=X,B=Q.split("/");for(var z=0;z<B.length;z++){var K=B[z];if(K)X+=W0(Y0(K)),w+=" && "+X}return w}function Z8(f,v){if(f=='""')return v;return(f+" + "+v).replace(/([^\\])' \+ '/g,"$1")}function RX(f){return Y0(decodeURIComponent(f))}function kX(f){return encodeURIComponent(X0(f))}function X0(f){return f.replace(/~/g,"~0").replace(/\//g,"~1")}function Y0(f){return f.replace(/~1/g,"/").replace(/~0/g,"~")}});var w0=s((J4,T8)=>{var SX=uf();T8.exports=yX;function yX(f){SX.copy(f,this)}});var u8=s((X4,x8)=>{var gf=x8.exports=function(f,v,W){if(typeof v=="function")W=v,v={};W=v.cb||W;var J=typeof W=="function"?W:W.pre||function(){},Q=W.post||function(){};YQ(v,J,Q,f,"",f)};gf.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};gf.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};gf.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};gf.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 YQ(f,v,W,J,Q,X,Y,w,B,z){if(J&&typeof J=="object"&&!Array.isArray(J)){v(J,Q,X,Y,w,B,z);for(var K in J){var L=J[K];if(Array.isArray(L)){if(K in gf.arrayKeywords)for(var V=0;V<L.length;V++)YQ(f,v,W,L[V],Q+"/"+K+"/"+V,X,Q,K,J,V)}else if(K in gf.propsKeywords){if(L&&typeof L=="object")for(var q in L)YQ(f,v,W,L[q],Q+"/"+K+"/"+lX(q),X,Q,K,J,q)}else if(K in gf.keywords||f.allKeys&&!(K in gf.skipKeywords))YQ(f,v,W,L,Q+"/"+K,X,Q,K,J)}W(J,Q,X,Y,w,B,z)}}function lX(f){return f.replace(/~/g,"~0").replace(/\//g,"~1")}});var KQ=s((Y4,c8)=>{var R1=k8(),m8=XQ(),qQ=uf(),wQ=w0(),IX=u8();c8.exports=hf;hf.normalizeId=_f;hf.fullPath=GQ;hf.url=BQ;hf.ids=uX;hf.inlineRef=G0;hf.schema=PQ;function hf(f,v,W){var J=this._refs[W];if(typeof J=="string")if(this._refs[J])J=this._refs[J];else return hf.call(this,f,v,J);if(J=J||this._schemas[W],J instanceof wQ)return G0(J.schema,this._opts.inlineRefs)?J.schema:J.validate||this._compile(J);var Q=PQ.call(this,v,W),X,Y,w;if(Q)X=Q.schema,v=Q.root,w=Q.baseId;if(X instanceof wQ)Y=X.validate||f.call(this,X.schema,v,void 0,w);else if(X!==void 0)Y=G0(X,this._opts.inlineRefs)?X:f.call(this,X,v,void 0,w);return Y}function PQ(f,v){var W=R1.parse(v),J=a8(W),Q=GQ(this._getId(f.schema));if(Object.keys(f.schema).length===0||J!==Q){var X=_f(J),Y=this._refs[X];if(typeof Y=="string")return ZX.call(this,f,Y,W);else if(Y instanceof wQ){if(!Y.validate)this._compile(Y);f=Y}else if(Y=this._schemas[X],Y instanceof wQ){if(!Y.validate)this._compile(Y);if(X==_f(v))return{schema:Y,root:f,baseId:Q};f=Y}else return;if(!f.schema)return;Q=GQ(this._getId(f.schema))}return r8.call(this,W,Q,f.schema,f)}function ZX(f,v,W){var J=PQ.call(this,f,v);if(J){var{schema:Q,baseId:X}=J;f=J.root;var Y=this._getId(Q);if(Y)X=BQ(X,Y);return r8.call(this,W,X,Q,f)}}var CX=qQ.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function r8(f,v,W,J){if(f.fragment=f.fragment||"",f.fragment.slice(0,1)!="/")return;var Q=f.fragment.split("/");for(var X=1;X<Q.length;X++){var Y=Q[X];if(Y){if(Y=qQ.unescapeFragment(Y),W=W[Y],W===void 0)break;var w;if(!CX[Y]){if(w=this._getId(W),w)v=BQ(v,w);if(W.$ref){var B=BQ(v,W.$ref),z=PQ.call(this,J,B);if(z)W=z.schema,J=z.root,v=z.baseId}}}}if(W!==void 0&&W!==J.schema)return{schema:W,root:J,baseId:v}}var TX=qQ.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function G0(f,v){if(v===!1)return!1;if(v===void 0||v===!0)return B0(f);else if(v)return q0(f)<=v}function B0(f){var v;if(Array.isArray(f)){for(var W=0;W<f.length;W++)if(v=f[W],typeof v=="object"&&!B0(v))return!1}else for(var J in f){if(J=="$ref")return!1;if(v=f[J],typeof v=="object"&&!B0(v))return!1}return!0}function q0(f){var v=0,W;if(Array.isArray(f))for(var J=0;J<f.length;J++){if(W=f[J],typeof W=="object")v+=q0(W);if(v==1/0)return 1/0}else for(var Q in f){if(Q=="$ref")return 1/0;if(TX[Q])v++;else{if(W=f[Q],typeof W=="object")v+=q0(W)+1;if(v==1/0)return 1/0}}return v}function GQ(f,v){if(v!==!1)f=_f(f);var W=R1.parse(f);return a8(W)}function a8(f){return R1.serialize(f).split("#")[0]+"#"}var xX=/#\/?$/;function _f(f){return f?f.replace(xX,""):""}function BQ(f,v){return v=_f(v),R1.resolve(f,v)}function uX(f){var v=_f(this._getId(f)),W={"":v},J={"":GQ(v,!1)},Q={},X=this;return IX(f,{allKeys:!0},function(Y,w,B,z,K,L,V){if(w==="")return;var q=X._getId(Y),M=W[z],N=J[z]+"/"+K;if(V!==void 0)N+="/"+(typeof V=="number"?V:qQ.escapeFragment(V));if(typeof q=="string"){q=M=_f(M?R1.resolve(M,q):q);var $=X._refs[q];if(typeof $=="string")$=X._refs[$];if($&&$.schema){if(!m8(Y,$.schema))throw new Error('id "'+q+'" resolves to more than one schema')}else if(q!=_f(N))if(q[0]=="#"){if(Q[q]&&!m8(Y,Q[q]))throw new Error('id "'+q+'" resolves to more than one schema');Q[q]=Y}else X._refs[q]=N}W[w]=M,J[w]=N}),Q}});var zQ=s((w4,p8)=>{var P0=KQ();p8.exports={Validation:n8(mX),MissingRef:n8(K0)};function mX(f){this.message="validation failed",this.errors=f,this.ajv=this.validation=!0}K0.message=function(f,v){return"can't resolve reference "+v+" from id "+f};function K0(f,v,W){this.message=W||K0.message(f,v),this.missingRef=P0.url(f,v),this.missingSchema=P0.normalizeId(P0.fullPath(this.missingRef))}function n8(f){return f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f}});var z0=s((G4,i8)=>{i8.exports=function(f,v){if(!v)v={};if(typeof v==="function")v={cmp:v};var W=typeof v.cycles==="boolean"?v.cycles:!1,J=v.cmp&&function(X){return function(Y){return function(w,B){var z={key:w,value:Y[w]},K={key:B,value:Y[B]};return X(z,K)}}}(v.cmp),Q=[];return function X(Y){if(Y&&Y.toJSON&&typeof Y.toJSON==="function")Y=Y.toJSON();if(Y===void 0)return;if(typeof Y=="number")return isFinite(Y)?""+Y:"null";if(typeof Y!=="object")return JSON.stringify(Y);var w,B;if(Array.isArray(Y)){B="[";for(w=0;w<Y.length;w++){if(w)B+=",";B+=X(Y[w])||"null"}return B+"]"}if(Y===null)return"null";if(Q.indexOf(Y)!==-1){if(W)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var z=Q.push(Y)-1,K=Object.keys(Y).sort(J&&J(Y));B="";for(w=0;w<K.length;w++){var L=K[w],V=X(Y[L]);if(!V)continue;if(B)B+=",";B+=JSON.stringify(L)+":"+V}return Q.splice(z,1),"{"+B+"}"}(f)}});var $0=s((B4,d8)=>{d8.exports=function f(v,W,J){var Q="",X=v.schema.$async===!0,Y=v.util.schemaHasRulesExcept(v.schema,v.RULES.all,"$ref"),w=v.self._getId(v.schema);if(v.opts.strictKeywords){var B=v.util.schemaUnknownRules(v.schema,v.RULES.keywords);if(B){var z="unknown keyword: "+B;if(v.opts.strictKeywords==="log")v.logger.warn(z);else throw new Error(z)}}if(v.isTop){if(Q+=" var validate = ",X)v.async=!0,Q+="async ";if(Q+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",w&&(v.opts.sourceCode||v.opts.processCode))Q+=" "+("/*# sourceURL="+w+" */")+" "}if(typeof v.schema=="boolean"||!(Y||v.schema.$ref)){var W="false schema",K=v.level,L=v.dataLevel,V=v.schema[W],q=v.schemaPath+v.util.getProperty(W),M=v.errSchemaPath+"/"+W,l=!v.opts.allErrors,g,N="data"+(L||""),k="valid"+K;if(v.schema===!1){if(v.isTop)l=!0;else Q+=" var "+k+" = false; ";var $=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(g||"false schema")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(M)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'boolean schema is false' ";if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+N+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&l)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else if(v.isTop)if(X)Q+=" return data; ";else Q+=" validate.errors = null; return true; ";else Q+=" var "+k+" = true; ";if(v.isTop)Q+=" }; return validate; ";return Q}if(v.isTop){var h=v.isTop,K=v.level=0,L=v.dataLevel=0,N="data";if(v.rootId=v.resolve.fullPath(v.self._getId(v.root.schema)),v.baseId=v.baseId||v.rootId,delete v.isTop,v.dataPathArr=[""],v.schema.default!==void 0&&v.opts.useDefaults&&v.opts.strictDefaults){var H="default is ignored in the schema root";if(v.opts.strictDefaults==="log")v.logger.warn(H);else throw new Error(H)}Q+=" var vErrors = null; ",Q+=" var errors = 0; ",Q+=" if (rootData === undefined) rootData = data; "}else{var{level:K,dataLevel:L}=v,N="data"+(L||"");if(w)v.baseId=v.resolve.url(v.baseId,w);if(X&&!v.async)throw new Error("async schema in sync schema");Q+=" var errs_"+K+" = errors;"}var k="valid"+K,l=!v.opts.allErrors,T="",E="",g,U=v.schema.type,b=Array.isArray(U);if(U&&v.opts.nullable&&v.schema.nullable===!0){if(b){if(U.indexOf("null")==-1)U=U.concat("null")}else if(U!="null")U=[U,"null"],b=!0}if(b&&U.length==1)U=U[0],b=!1;if(v.schema.$ref&&Y){if(v.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+v.errSchemaPath+'" (see option extendRefs)');else if(v.opts.extendRefs!==!0)Y=!1,v.logger.warn('$ref: keywords ignored in schema at path "'+v.errSchemaPath+'"')}if(v.schema.$comment&&v.opts.$comment)Q+=" "+v.RULES.all.$comment.code(v,"$comment");if(U){if(v.opts.coerceTypes)var I=v.util.coerceToTypes(v.opts.coerceTypes,U);var S=v.RULES.types[U];if(I||b||S===!0||S&&!_v(S)){var q=v.schemaPath+".type",M=v.errSchemaPath+"/type",q=v.schemaPath+".type",M=v.errSchemaPath+"/type",_=b?"checkDataTypes":"checkDataType";if(Q+=" if ("+v.util[_](U,N,v.opts.strictNumbers,!0)+") { ",I){var R="dataType"+K,y="coerced"+K;if(Q+=" var "+R+" = typeof "+N+"; var "+y+" = undefined; ",v.opts.coerceTypes=="array")Q+=" if ("+R+" == 'object' && Array.isArray("+N+") && "+N+".length == 1) { "+N+" = "+N+"[0]; "+R+" = typeof "+N+"; if ("+v.util.checkDataType(v.schema.type,N,v.opts.strictNumbers)+") "+y+" = "+N+"; } ";Q+=" if ("+y+" !== undefined) ; ";var m=I;if(m){var a,i=-1,p=m.length-1;while(i<p)if(a=m[i+=1],a=="string")Q+=" else if ("+R+" == 'number' || "+R+" == 'boolean') "+y+" = '' + "+N+"; else if ("+N+" === null) "+y+" = ''; ";else if(a=="number"||a=="integer"){if(Q+=" else if ("+R+" == 'boolean' || "+N+" === null || ("+R+" == 'string' && "+N+" && "+N+" == +"+N+" ",a=="integer")Q+=" && !("+N+" % 1)";Q+=")) "+y+" = +"+N+"; "}else if(a=="boolean")Q+=" else if ("+N+" === 'false' || "+N+" === 0 || "+N+" === null) "+y+" = false; else if ("+N+" === 'true' || "+N+" === 1) "+y+" = true; ";else if(a=="null")Q+=" else if ("+N+" === '' || "+N+" === 0 || "+N+" === false) "+y+" = null; ";else if(v.opts.coerceTypes=="array"&&a=="array")Q+=" else if ("+R+" == 'string' || "+R+" == 'number' || "+R+" == 'boolean' || "+N+" == null) "+y+" = ["+N+"]; "}Q+=" else { ";var $=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(g||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(M)+" , params: { type: '",b)Q+=""+U.join(",");else Q+=""+U;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",b)Q+=""+U.join(",");else Q+=""+U;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+q+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+N+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&l)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } if ("+y+" !== undefined) { ";var n=L?"data"+(L-1||""):"parentData",$v=L?v.dataPathArr[L]:"parentDataProperty";if(Q+=" "+N+" = "+y+"; ",!L)Q+="if ("+n+" !== undefined)";Q+=" "+n+"["+$v+"] = "+y+"; } "}else{var $=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(g||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(M)+" , params: { type: '",b)Q+=""+U.join(",");else Q+=""+U;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",b)Q+=""+U.join(",");else Q+=""+U;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+q+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+N+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&l)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}Q+=" } "}}if(v.schema.$ref&&!Y){if(Q+=" "+v.RULES.all.$ref.code(v,"$ref")+" ",l){if(Q+=" } if (errors === ",h)Q+="0";else Q+="errs_"+K;Q+=") { ",E+="}"}}else{var bv=v.RULES;if(bv){var S,Sv=-1,Yv=bv.length-1;while(Sv<Yv)if(S=bv[Sv+=1],_v(S)){if(S.type)Q+=" if ("+v.util.checkDataType(S.type,N,v.opts.strictNumbers)+") { ";if(v.opts.useDefaults){if(S.type=="object"&&v.schema.properties){var V=v.schema.properties,Ov=Object.keys(V),gv=Ov;if(gv){var yv,Df=-1,Pf=gv.length-1;while(Df<Pf){yv=gv[Df+=1];var Uv=V[yv];if(Uv.default!==void 0){var jv=N+v.util.getProperty(yv);if(v.compositeRule){if(v.opts.strictDefaults){var H="default is ignored for: "+jv;if(v.opts.strictDefaults==="log")v.logger.warn(H);else throw new Error(H)}}else{if(Q+=" if ("+jv+" === undefined ",v.opts.useDefaults=="empty")Q+=" || "+jv+" === null || "+jv+" === '' ";if(Q+=" ) "+jv+" = ",v.opts.useDefaults=="shared")Q+=" "+v.useDefault(Uv.default)+" ";else Q+=" "+JSON.stringify(Uv.default)+" ";Q+="; "}}}}}else if(S.type=="array"&&Array.isArray(v.schema.items)){var bf=v.schema.items;if(bf){var Uv,i=-1,Rv=bf.length-1;while(i<Rv)if(Uv=bf[i+=1],Uv.default!==void 0){var jv=N+"["+i+"]";if(v.compositeRule){if(v.opts.strictDefaults){var H="default is ignored for: "+jv;if(v.opts.strictDefaults==="log")v.logger.warn(H);else throw new Error(H)}}else{if(Q+=" if ("+jv+" === undefined ",v.opts.useDefaults=="empty")Q+=" || "+jv+" === null || "+jv+" === '' ";if(Q+=" ) "+jv+" = ",v.opts.useDefaults=="shared")Q+=" "+v.useDefault(Uv.default)+" ";else Q+=" "+JSON.stringify(Uv.default)+" ";Q+="; "}}}}}var Gv=S.rules;if(Gv){var jf,Kf=-1,Rf=Gv.length-1;while(Kf<Rf)if(jf=Gv[Kf+=1],rv(jf)){var kf=jf.code(v,jf.keyword,S.type);if(kf){if(Q+=" "+kf+" ",l)T+="}"}}}if(l)Q+=" "+T+" ",T="";if(S.type){if(Q+=" } ",U&&U===S.type&&!I){Q+=" else { ";var q=v.schemaPath+".type",M=v.errSchemaPath+"/type",$=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(g||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(M)+" , params: { type: '",b)Q+=""+U.join(",");else Q+=""+U;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",b)Q+=""+U.join(",");else Q+=""+U;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+q+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+N+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&l)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } "}}if(l){if(Q+=" if (errors === ",h)Q+="0";else Q+="errs_"+K;Q+=") { ",E+="}"}}}}if(l)Q+=" "+E+" ";if(h){if(X)Q+=" if (errors === 0) return data; ",Q+=" else throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; ",Q+=" return errors === 0; ";Q+=" }; return validate;"}else Q+=" var "+k+" = errors === errs_"+K+";";function _v(lv){var Jf=lv.rules;for(var xv=0;xv<Jf.length;xv++)if(rv(Jf[xv]))return!0}function rv(lv){return v.schema[lv.keyword]!==void 0||lv.implements&&Zv(lv)}function Zv(lv){var Jf=lv.implements;for(var xv=0;xv<Jf.length;xv++)if(v.schema[Jf[xv]]!==void 0)return!0}return Q}});var vW=s((q4,e8)=>{var $Q=KQ(),MQ=uf(),s8=zQ(),rX=z0(),o8=$0(),aX=MQ.ucs2length,cX=XQ(),nX=s8.Validation;e8.exports=L0;function L0(f,v,W,J){var Q=this,X=this._opts,Y=[void 0],w={},B=[],z={},K=[],L={},V=[];v=v||{schema:f,refVal:Y,refs:w};var q=pX.call(this,f,v,J),M=this._compilations[q.index];if(q.compiling)return M.callValidate=H;var N=this._formats,$=this.RULES;try{var O=k(f,v,W,J);M.validate=O;var h=M.callValidate;if(h){if(h.schema=O.schema,h.errors=null,h.refs=O.refs,h.refVal=O.refVal,h.root=O.root,h.$async=O.$async,X.sourceCode)h.source=O.source}return O}finally{iX.call(this,f,v,J)}function H(){var _=M.validate,R=_.apply(this,arguments);return H.errors=_.errors,R}function k(_,R,y,m){var a=!R||R&&R.schema==_;if(R.schema!=v.schema)return L0.call(Q,_,R,y,m);var i=_.$async===!0,p=o8({isTop:!0,schema:_,isRoot:a,baseId:m,root:R,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:s8.MissingRef,RULES:$,validate:o8,util:MQ,resolve:$Q,resolveRef:l,usePattern:b,useDefault:I,useCustomRule:S,opts:X,formats:N,logger:Q.logger,self:Q});if(p=LQ(Y,sX)+LQ(B,dX)+LQ(K,oX)+LQ(V,tX)+p,X.processCode)p=X.processCode(p,_);var n;try{var $v=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",p);n=$v(Q,$,N,v,Y,K,V,cX,aX,nX),Y[0]=n}catch(bv){throw Q.logger.error("Error compiling schema, function code:",p),bv}if(n.schema=_,n.errors=null,n.refs=w,n.refVal=Y,n.root=a?n:R,i)n.$async=!0;if(X.sourceCode===!0)n.source={code:p,patterns:B,defaults:K};return n}function l(_,R,y){R=$Q.url(_,R);var m=w[R],a,i;if(m!==void 0)return a=Y[m],i="refVal["+m+"]",U(a,i);if(!y&&v.refs){var p=v.refs[R];if(p!==void 0)return a=v.refVal[p],i=T(R,a),U(a,i)}i=T(R);var n=$Q.call(Q,k,v,R);if(n===void 0){var $v=W&&W[R];if($v)n=$Q.inlineRef($v,X.inlineRefs)?$v:L0.call(Q,$v,v,W,_)}if(n===void 0)E(R);else return g(R,n),U(n,i)}function T(_,R){var y=Y.length;return Y[y]=R,w[_]=y,"refVal"+y}function E(_){delete w[_]}function g(_,R){var y=w[_];Y[y]=R}function U(_,R){return typeof _=="object"||typeof _=="boolean"?{code:R,schema:_,inline:!0}:{code:R,$async:_&&!!_.$async}}function b(_){var R=z[_];if(R===void 0)R=z[_]=B.length,B[R]=_;return"pattern"+R}function I(_){switch(typeof _){case"boolean":case"number":return""+_;case"string":return MQ.toQuotedString(_);case"object":if(_===null)return"null";var R=rX(_),y=L[R];if(y===void 0)y=L[R]=K.length,K[y]=_;return"default"+y}}function S(_,R,y,m){if(Q._opts.validateSchema!==!1){var a=_.definition.dependencies;if(a&&!a.every(function(gv){return Object.prototype.hasOwnProperty.call(y,gv)}))throw new Error("parent schema must have all required keywords: "+a.join(","));var i=_.definition.validateSchema;if(i){var p=i(R);if(!p){var n="keyword schema is invalid: "+Q.errorsText(i.errors);if(Q._opts.validateSchema=="log")Q.logger.error(n);else throw new Error(n)}}}var $v=_.definition.compile,bv=_.definition.inline,Sv=_.definition.macro,Yv;if($v)Yv=$v.call(Q,R,y,m);else if(Sv){if(Yv=Sv.call(Q,R,y,m),X.validateSchema!==!1)Q.validateSchema(Yv,!0)}else if(bv)Yv=bv.call(Q,m,_.keyword,R,y);else if(Yv=_.definition.validate,!Yv)return;if(Yv===void 0)throw new Error('custom keyword "'+_.keyword+'"failed to compile');var Ov=V.length;return V[Ov]=Yv,{code:"customRule"+Ov,validate:Yv}}}function pX(f,v,W){var J=t8.call(this,f,v,W);if(J>=0)return{index:J,compiling:!0};return J=this._compilations.length,this._compilations[J]={schema:f,root:v,baseId:W},{index:J,compiling:!1}}function iX(f,v,W){var J=t8.call(this,f,v,W);if(J>=0)this._compilations.splice(J,1)}function t8(f,v,W){for(var J=0;J<this._compilations.length;J++){var Q=this._compilations[J];if(Q.schema==f&&Q.root==v&&Q.baseId==W)return J}return-1}function dX(f,v){return"var pattern"+f+" = new RegExp("+MQ.toQuotedString(v[f])+");"}function oX(f){return"var default"+f+" = defaults["+f+"];"}function sX(f,v){return v[f]===void 0?"":"var refVal"+f+" = refVal["+f+"];"}function tX(f){return"var customRule"+f+" = customRules["+f+"];"}function LQ(f,v){if(!f.length)return"";var W="";for(var J=0;J<f.length;J++)W+=v(J,f);return W}});var QW=s((P4,fW)=>{var NQ=fW.exports=function f(){this._cache={}};NQ.prototype.put=function f(v,W){this._cache[v]=W};NQ.prototype.get=function f(v){return this._cache[v]};NQ.prototype.del=function f(v){delete this._cache[v]};NQ.prototype.clear=function f(){this._cache={}}});var $W=s((K4,zW)=>{var eX=uf(),vY=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,fY=[0,31,28,31,30,31,30,31,31,30,31,30,31],QY=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,WW=/^(?=.{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,WY=/^(?:[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,JY=/^(?:[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,JW=/^(?:(?:[^\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,XW=/^(?:(?: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,YW=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,wW=/^(?:\/(?:[^~/]|~0|~1)*)*$/,GW=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,BW=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;zW.exports=VQ;function VQ(f){return f=f=="full"?"full":"fast",eX.copy(VQ[f])}VQ.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":JW,url:XW,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:WW,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:KW,uuid:YW,"json-pointer":wW,"json-pointer-uri-fragment":GW,"relative-json-pointer":BW};VQ.full={date:qW,time:PW,"date-time":wY,uri:BY,"uri-reference":JY,"uri-template":JW,url:XW,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:WW,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:KW,uuid:YW,"json-pointer":wW,"json-pointer-uri-fragment":GW,"relative-json-pointer":BW};function XY(f){return f%4===0&&(f%100!==0||f%400===0)}function qW(f){var v=f.match(vY);if(!v)return!1;var W=+v[1],J=+v[2],Q=+v[3];return J>=1&&J<=12&&Q>=1&&Q<=(J==2&&XY(W)?29:fY[J])}function PW(f,v){var W=f.match(QY);if(!W)return!1;var J=W[1],Q=W[2],X=W[3],Y=W[5];return(J<=23&&Q<=59&&X<=59||J==23&&Q==59&&X==60)&&(!v||Y)}var YY=/t|\s/i;function wY(f){var v=f.split(YY);return v.length==2&&qW(v[0])&&PW(v[1],!0)}var GY=/\/|:/;function BY(f){return GY.test(f)&&WY.test(f)}var qY=/[^\\]\\Z/;function KW(f){if(qY.test(f))return!1;try{return new RegExp(f),!0}catch(v){return!1}}});var MW=s((z4,LW)=>{LW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.errSchemaPath+"/"+W,z=!v.opts.allErrors,K="data"+(Y||""),L="valid"+X,V,q;if(w=="#"||w=="#/")if(v.isRoot)V=v.async,q="validate";else V=v.root.schema.$async===!0,q="root.refVal[0]";else{var M=v.resolveRef(v.baseId,w,v.isRoot);if(M===void 0){var N=v.MissingRefError.message(v.baseId,w);if(v.opts.missingRefs=="fail"){v.logger.error(N);var $=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(B)+" , params: { ref: '"+v.util.escapeQuotes(w)+"' } ",v.opts.messages!==!1)Q+=" , message: 'can\\'t resolve reference "+v.util.escapeQuotes(w)+"' ";if(v.opts.verbose)Q+=" , schema: "+v.util.toQuotedString(w)+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+K+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&z)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(z)Q+=" if (false) { "}else if(v.opts.missingRefs=="ignore"){if(v.logger.warn(N),z)Q+=" if (true) { "}else throw new v.MissingRefError(v.baseId,w,N)}else if(M.inline){var h=v.util.copy(v);h.level++;var H="valid"+h.level;h.schema=M.schema,h.schemaPath="",h.errSchemaPath=w;var k=v.validate(h).replace(/validate\.schema/g,M.code);if(Q+=" "+k+" ",z)Q+=" if ("+H+") { "}else V=M.$async===!0||v.async&&M.$async!==!1,q=M.code}if(q){var $=$||[];if($.push(Q),Q="",v.opts.passContext)Q+=" "+q+".call(this, ";else Q+=" "+q+"( ";if(Q+=" "+K+", (dataPath || '')",v.errorPath!='""')Q+=" + "+v.errorPath;var l=Y?"data"+(Y-1||""):"parentData",T=Y?v.dataPathArr[Y]:"parentDataProperty";Q+=" , "+l+" , "+T+", rootData) ";var E=Q;if(Q=$.pop(),V){if(!v.async)throw new Error("async schema referenced by sync schema");if(z)Q+=" var "+L+"; ";if(Q+=" try { await "+E+"; ",z)Q+=" "+L+" = true; ";if(Q+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",z)Q+=" "+L+" = false; ";if(Q+=" } ",z)Q+=" if ("+L+") { "}else if(Q+=" if (!"+E+") { if (vErrors === null) vErrors = "+q+".errors; else vErrors = vErrors.concat("+q+".errors); errors = vErrors.length; } ",z)Q+=" else { "}return Q}});var VW=s(($4,NW)=>{NW.exports=function f(v,W,J){var Q=" ",X=v.schema[W],Y=v.schemaPath+v.util.getProperty(W),w=v.errSchemaPath+"/"+W,B=!v.opts.allErrors,z=v.util.copy(v),K="";z.level++;var L="valid"+z.level,V=z.baseId,q=!0,M=X;if(M){var N,$=-1,O=M.length-1;while($<O)if(N=M[$+=1],v.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:v.util.schemaHasRules(N,v.RULES.all)){if(q=!1,z.schema=N,z.schemaPath=Y+"["+$+"]",z.errSchemaPath=w+"/"+$,Q+=" "+v.validate(z)+" ",z.baseId=V,B)Q+=" if ("+L+") { ",K+="}"}}if(B)if(q)Q+=" if (true) { ";else Q+=" "+K.slice(0,-1)+" ";return Q}});var jW=s((L4,DW)=>{DW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q="errs__"+X,M=v.util.copy(v),N="";M.level++;var $="valid"+M.level,O=w.every(function(g){return v.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:v.util.schemaHasRules(g,v.RULES.all)});if(O){var h=M.baseId;Q+=" var "+q+" = errors; var "+V+" = false; ";var H=v.compositeRule;v.compositeRule=M.compositeRule=!0;var k=w;if(k){var l,T=-1,E=k.length-1;while(T<E)l=k[T+=1],M.schema=l,M.schemaPath=B+"["+T+"]",M.errSchemaPath=z+"/"+T,Q+=" "+v.validate(M)+" ",M.baseId=h,Q+=" "+V+" = "+V+" || "+$+"; if (!"+V+") { ",N+="}"}if(v.compositeRule=M.compositeRule=H,Q+=" "+N+" if (!"+V+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should match some schema in anyOf' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+=" } else { errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; } ",v.opts.allErrors)Q+=" } "}else if(K)Q+=" if (true) { ";return Q}});var OW=s((M4,EW)=>{EW.exports=function f(v,W,J){var Q=" ",X=v.schema[W],Y=v.errSchemaPath+"/"+W,w=!v.opts.allErrors,B=v.util.toQuotedString(X);if(v.opts.$comment===!0)Q+=" console.log("+B+");";else if(typeof v.opts.$comment=="function")Q+=" self._opts.$comment("+B+", "+v.util.toQuotedString(Y)+", validate.root.schema);";return Q}});var HW=s((N4,UW)=>{UW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q=v.opts.$data&&w&&w.$data,M;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",M="schema"+X;else M=w;if(!q)Q+=" var schema"+X+" = validate.schema"+B+";";Q+="var "+V+" = equal("+L+", schema"+X+"); if (!"+V+") { ";var N=N||[];if(N.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'const' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { allowedValue: schema"+X+" } ",v.opts.messages!==!1)Q+=" , message: 'should be equal to constant' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var $=Q;if(Q=N.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+$+"]); ";else Q+=" validate.errors = ["+$+"]; return false; ";else Q+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" }",K)Q+=" else { ";return Q}});var AW=s((V4,FW)=>{FW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q="errs__"+X,M=v.util.copy(v),N="";M.level++;var $="valid"+M.level,O="i"+X,h=M.dataLevel=v.dataLevel+1,H="data"+h,k=v.baseId,l=v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all);if(Q+="var "+q+" = errors;var "+V+";",l){var T=v.compositeRule;v.compositeRule=M.compositeRule=!0,M.schema=w,M.schemaPath=B,M.errSchemaPath=z,Q+=" var "+$+" = false; for (var "+O+" = 0; "+O+" < "+L+".length; "+O+"++) { ",M.errorPath=v.util.getPathExpr(v.errorPath,O,v.opts.jsonPointers,!0);var E=L+"["+O+"]";M.dataPathArr[h]=O;var g=v.validate(M);if(M.baseId=k,v.util.varOccurences(g,H)<2)Q+=" "+v.util.varReplace(g,H,E)+" ";else Q+=" var "+H+" = "+E+"; "+g+" ";Q+=" if ("+$+") break; } ",v.compositeRule=M.compositeRule=T,Q+=" "+N+" if (!"+$+") {"}else Q+=" if ("+L+".length == 0) {";var U=U||[];if(U.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should contain a valid item' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var b=Q;if(Q=U.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+b+"]); ";else Q+=" validate.errors = ["+b+"]; return false; ";else Q+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else { ",l)Q+=" errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; } ";if(v.opts.allErrors)Q+=" } ";return Q}});var _W=s((D4,gW)=>{gW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="errs__"+X,q=v.util.copy(v),M="";q.level++;var N="valid"+q.level,$={},O={},h=v.opts.ownProperties;for(T in w){if(T=="__proto__")continue;var H=w[T],k=Array.isArray(H)?O:$;k[T]=H}Q+="var "+V+" = errors;";var l=v.errorPath;Q+="var missing"+X+";";for(var T in O)if(k=O[T],k.length){if(Q+=" if ( "+L+v.util.getProperty(T)+" !== undefined ",h)Q+=" && Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(T)+"') ";if(K){Q+=" && ( ";var E=k;if(E){var g,U=-1,b=E.length-1;while(U<b){if(g=E[U+=1],U)Q+=" || ";var I=v.util.getProperty(g),S=L+I;if(Q+=" ( ( "+S+" === undefined ",h)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(g)+"') ";Q+=") && (missing"+X+" = "+v.util.toQuotedString(v.opts.jsonPointers?g:I)+") ) "}}Q+=")) { ";var _="missing"+X,R="' + "+_+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.opts.jsonPointers?v.util.getPathExpr(l,_,!0):l+" + "+_;var y=y||[];if(y.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { property: '"+v.util.escapeQuotes(T)+"', missingProperty: '"+R+"', depsCount: "+k.length+", deps: '"+v.util.escapeQuotes(k.length==1?k[0]:k.join(", "))+"' } ",v.opts.messages!==!1){if(Q+=" , message: 'should have ",k.length==1)Q+="property "+v.util.escapeQuotes(k[0]);else Q+="properties "+v.util.escapeQuotes(k.join(", "));Q+=" when property "+v.util.escapeQuotes(T)+" is present' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var m=Q;if(Q=y.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+m+"]); ";else Q+=" validate.errors = ["+m+"]; return false; ";else Q+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{Q+=" ) { ";var a=k;if(a){var g,i=-1,p=a.length-1;while(i<p){g=a[i+=1];var I=v.util.getProperty(g),R=v.util.escapeQuotes(g),S=L+I;if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(l,g,v.opts.jsonPointers);if(Q+=" if ( "+S+" === undefined ",h)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(g)+"') ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { property: '"+v.util.escapeQuotes(T)+"', missingProperty: '"+R+"', depsCount: "+k.length+", deps: '"+v.util.escapeQuotes(k.length==1?k[0]:k.join(", "))+"' } ",v.opts.messages!==!1){if(Q+=" , message: 'should have ",k.length==1)Q+="property "+v.util.escapeQuotes(k[0]);else Q+="properties "+v.util.escapeQuotes(k.join(", "));Q+=" when property "+v.util.escapeQuotes(T)+" is present' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}if(Q+=" } ",K)M+="}",Q+=" else { "}v.errorPath=l;var n=q.baseId;for(var T in $){var H=$[T];if(v.opts.strictKeywords?typeof H=="object"&&Object.keys(H).length>0||H===!1:v.util.schemaHasRules(H,v.RULES.all)){if(Q+=" "+N+" = true; if ( "+L+v.util.getProperty(T)+" !== undefined ",h)Q+=" && Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(T)+"') ";if(Q+=") { ",q.schema=H,q.schemaPath=B+v.util.getProperty(T),q.errSchemaPath=z+"/"+v.util.escapeFragment(T),Q+=" "+v.validate(q)+" ",q.baseId=n,Q+=" } ",K)Q+=" if ("+N+") { ",M+="}"}}if(K)Q+=" "+M+" if ("+V+" == errors) {";return Q}});var bW=s((j4,hW)=>{hW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q=v.opts.$data&&w&&w.$data,M;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",M="schema"+X;else M=w;var N="i"+X,$="schema"+X;if(!q)Q+=" var "+$+" = validate.schema"+B+";";if(Q+="var "+V+";",q)Q+=" if (schema"+X+" === undefined) "+V+" = true; else if (!Array.isArray(schema"+X+")) "+V+" = false; else {";if(Q+=""+V+" = false;for (var "+N+"=0; "+N+"<"+$+".length; "+N+"++) if (equal("+L+", "+$+"["+N+"])) { "+V+" = true; break; }",q)Q+=" } ";Q+=" if (!"+V+") { ";var O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { allowedValues: schema"+X+" } ",v.opts.messages!==!1)Q+=" , message: 'should be equal to one of the allowed values' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var h=Q;if(Q=O.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+h+"]); ";else Q+=" validate.errors = ["+h+"]; return false; ";else Q+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" }",K)Q+=" else { ";return Q}});var kW=s((E4,RW)=>{RW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||"");if(v.opts.format===!1){if(K)Q+=" if (true) { ";return Q}var V=v.opts.$data&&w&&w.$data,q;if(V)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;var M=v.opts.unknownFormats,N=Array.isArray(M);if(V){var $="format"+X,O="isObject"+X,h="formatType"+X;if(Q+=" var "+$+" = formats["+q+"]; var "+O+" = typeof "+$+" == 'object' && !("+$+" instanceof RegExp) && "+$+".validate; var "+h+" = "+O+" && "+$+".type || 'string'; if ("+O+") { ",v.async)Q+=" var async"+X+" = "+$+".async; ";if(Q+=" "+$+" = "+$+".validate; } if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'string') || ";if(Q+=" (",M!="ignore"){if(Q+=" ("+q+" && !"+$+" ",N)Q+=" && self._opts.unknownFormats.indexOf("+q+") == -1 ";Q+=") || "}if(Q+=" ("+$+" && "+h+" == '"+J+"' && !(typeof "+$+" == 'function' ? ",v.async)Q+=" (async"+X+" ? await "+$+"("+L+") : "+$+"("+L+")) ";else Q+=" "+$+"("+L+") ";Q+=" : "+$+".test("+L+"))))) {"}else{var $=v.formats[w];if(!$)if(M=="ignore"){if(v.logger.warn('unknown format "'+w+'" ignored in schema at path "'+v.errSchemaPath+'"'),K)Q+=" if (true) { ";return Q}else if(N&&M.indexOf(w)>=0){if(K)Q+=" if (true) { ";return Q}else throw new Error('unknown format "'+w+'" is used in schema at path "'+v.errSchemaPath+'"');var O=typeof $=="object"&&!($ instanceof RegExp)&&$.validate,h=O&&$.type||"string";if(O){var H=$.async===!0;$=$.validate}if(h!=J){if(K)Q+=" if (true) { ";return Q}if(H){if(!v.async)throw new Error("async format in sync schema");var k="formats"+v.util.getProperty(w)+".validate";Q+=" if (!(await "+k+"("+L+"))) { "}else{Q+=" if (! ";var k="formats"+v.util.getProperty(w);if(O)k+=".validate";if(typeof $=="function")Q+=" "+k+"("+L+") ";else Q+=" "+k+".test("+L+") ";Q+=") { "}}var l=l||[];if(l.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'format' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { format: ",V)Q+=""+q;else Q+=""+v.util.toQuotedString(w);if(Q+=" } ",v.opts.messages!==!1){if(Q+=` , message: 'should match format "`,V)Q+="' + "+q+" + '";else Q+=""+v.util.escapeQuotes(w);Q+=`"' `}if(v.opts.verbose){if(Q+=" , schema: ",V)Q+="validate.schema"+B;else Q+=""+v.util.toQuotedString(w);Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var T=Q;if(Q=l.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+T+"]); ";else Q+=" validate.errors = ["+T+"]; return false; ";else Q+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",K)Q+=" else { ";return Q}});var yW=s((O4,SW)=>{SW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q="errs__"+X,M=v.util.copy(v);M.level++;var N="valid"+M.level,$=v.schema.then,O=v.schema.else,h=$!==void 0&&(v.opts.strictKeywords?typeof $=="object"&&Object.keys($).length>0||$===!1:v.util.schemaHasRules($,v.RULES.all)),H=O!==void 0&&(v.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:v.util.schemaHasRules(O,v.RULES.all)),k=M.baseId;if(h||H){var l;M.createErrors=!1,M.schema=w,M.schemaPath=B,M.errSchemaPath=z,Q+=" var "+q+" = errors; var "+V+" = true; ";var T=v.compositeRule;if(v.compositeRule=M.compositeRule=!0,Q+=" "+v.validate(M)+" ",M.baseId=k,M.createErrors=!0,Q+=" errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; } ",v.compositeRule=M.compositeRule=T,h){if(Q+=" if ("+N+") { ",M.schema=v.schema.then,M.schemaPath=v.schemaPath+".then",M.errSchemaPath=v.errSchemaPath+"/then",Q+=" "+v.validate(M)+" ",M.baseId=k,Q+=" "+V+" = "+N+"; ",h&&H)l="ifClause"+X,Q+=" var "+l+" = 'then'; ";else l="'then'";if(Q+=" } ",H)Q+=" else { "}else Q+=" if (!"+N+") { ";if(H){if(M.schema=v.schema.else,M.schemaPath=v.schemaPath+".else",M.errSchemaPath=v.errSchemaPath+"/else",Q+=" "+v.validate(M)+" ",M.baseId=k,Q+=" "+V+" = "+N+"; ",h&&H)l="ifClause"+X,Q+=" var "+l+" = 'else'; ";else l="'else'";Q+=" } "}if(Q+=" if (!"+V+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'if' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { failingKeyword: "+l+" } ",v.opts.messages!==!1)Q+=` , message: 'should match "' + `+l+` + '" schema' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+=" } ",K)Q+=" else { "}else if(K)Q+=" if (true) { ";return Q}});var IW=s((U4,lW)=>{lW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q="errs__"+X,M=v.util.copy(v),N="";M.level++;var $="valid"+M.level,O="i"+X,h=M.dataLevel=v.dataLevel+1,H="data"+h,k=v.baseId;if(Q+="var "+q+" = errors;var "+V+";",Array.isArray(w)){var l=v.schema.additionalItems;if(l===!1){Q+=" "+V+" = "+L+".length <= "+w.length+"; ";var T=z;z=v.errSchemaPath+"/additionalItems",Q+=" if (!"+V+") { ";var E=E||[];if(E.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+w.length+" } ",v.opts.messages!==!1)Q+=" , message: 'should NOT have more than "+w.length+" items' ";if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var g=Q;if(Q=E.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+g+"]); ";else Q+=" validate.errors = ["+g+"]; return false; ";else Q+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",z=T,K)N+="}",Q+=" else { "}var U=w;if(U){var b,I=-1,S=U.length-1;while(I<S)if(b=U[I+=1],v.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:v.util.schemaHasRules(b,v.RULES.all)){Q+=" "+$+" = true; if ("+L+".length > "+I+") { ";var _=L+"["+I+"]";M.schema=b,M.schemaPath=B+"["+I+"]",M.errSchemaPath=z+"/"+I,M.errorPath=v.util.getPathExpr(v.errorPath,I,v.opts.jsonPointers,!0),M.dataPathArr[h]=I;var R=v.validate(M);if(M.baseId=k,v.util.varOccurences(R,H)<2)Q+=" "+v.util.varReplace(R,H,_)+" ";else Q+=" var "+H+" = "+_+"; "+R+" ";if(Q+=" } ",K)Q+=" if ("+$+") { ",N+="}"}}if(typeof l=="object"&&(v.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:v.util.schemaHasRules(l,v.RULES.all))){M.schema=l,M.schemaPath=v.schemaPath+".additionalItems",M.errSchemaPath=v.errSchemaPath+"/additionalItems",Q+=" "+$+" = true; if ("+L+".length > "+w.length+") { for (var "+O+" = "+w.length+"; "+O+" < "+L+".length; "+O+"++) { ",M.errorPath=v.util.getPathExpr(v.errorPath,O,v.opts.jsonPointers,!0);var _=L+"["+O+"]";M.dataPathArr[h]=O;var R=v.validate(M);if(M.baseId=k,v.util.varOccurences(R,H)<2)Q+=" "+v.util.varReplace(R,H,_)+" ";else Q+=" var "+H+" = "+_+"; "+R+" ";if(K)Q+=" if (!"+$+") break; ";if(Q+=" } } ",K)Q+=" if ("+$+") { ",N+="}"}}else if(v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all)){M.schema=w,M.schemaPath=B,M.errSchemaPath=z,Q+=" for (var "+O+" = 0; "+O+" < "+L+".length; "+O+"++) { ",M.errorPath=v.util.getPathExpr(v.errorPath,O,v.opts.jsonPointers,!0);var _=L+"["+O+"]";M.dataPathArr[h]=O;var R=v.validate(M);if(M.baseId=k,v.util.varOccurences(R,H)<2)Q+=" "+v.util.varReplace(R,H,_)+" ";else Q+=" var "+H+" = "+_+"; "+R+" ";if(K)Q+=" if (!"+$+") break; ";Q+=" }"}if(K)Q+=" "+N+" if ("+q+" == errors) {";return Q}});var M0=s((H4,ZW)=>{ZW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,k,L="data"+(Y||""),V=v.opts.$data&&w&&w.$data,q;if(V)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;var M=W=="maximum",N=M?"exclusiveMaximum":"exclusiveMinimum",$=v.schema[N],O=v.opts.$data&&$&&$.$data,h=M?"<":">",H=M?">":"<",k=void 0;if(!(V||typeof w=="number"||w===void 0))throw new Error(W+" must be number");if(!(O||$===void 0||typeof $=="number"||typeof $=="boolean"))throw new Error(N+" must be number or boolean");if(O){var l=v.util.getData($.$data,Y,v.dataPathArr),T="exclusive"+X,E="exclType"+X,g="exclIsNumber"+X,U="op"+X,b="' + "+U+" + '";Q+=" var schemaExcl"+X+" = "+l+"; ",l="schemaExcl"+X,Q+=" var "+T+"; var "+E+" = typeof "+l+"; if ("+E+" != 'boolean' && "+E+" != 'undefined' && "+E+" != 'number') { ";var k=N,I=I||[];if(I.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(k||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: '"+N+" should be boolean' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var S=Q;if(Q=I.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+S+"]); ";else Q+=" validate.errors = ["+S+"]; return false; ";else Q+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";if(Q+=" "+E+" == 'number' ? ( ("+T+" = "+q+" === undefined || "+l+" "+h+"= "+q+") ? "+L+" "+H+"= "+l+" : "+L+" "+H+" "+q+" ) : ( ("+T+" = "+l+" === true) ? "+L+" "+H+"= "+q+" : "+L+" "+H+" "+q+" ) || "+L+" !== "+L+") { var op"+X+" = "+T+" ? '"+h+"' : '"+h+"='; ",w===void 0)k=N,z=v.errSchemaPath+"/"+N,q=l,V=O}else{var g=typeof $=="number",b=h;if(g&&V){var U="'"+b+"'";if(Q+=" if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" ( "+q+" === undefined || "+$+" "+h+"= "+q+" ? "+L+" "+H+"= "+$+" : "+L+" "+H+" "+q+" ) || "+L+" !== "+L+") { "}else{if(g&&w===void 0)T=!0,k=N,z=v.errSchemaPath+"/"+N,q=$,H+="=";else{if(g)q=Math[M?"min":"max"]($,w);if($===(g?q:!0))T=!0,k=N,z=v.errSchemaPath+"/"+N,H+="=";else T=!1,b+="="}var U="'"+b+"'";if(Q+=" if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" "+L+" "+H+" "+q+" || "+L+" !== "+L+") { "}}k=k||W;var I=I||[];if(I.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(k||"_limit")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { comparison: "+U+", limit: "+q+", exclusive: "+T+" } ",v.opts.messages!==!1)if(Q+=" , message: 'should be "+b+" ",V)Q+="' + "+q;else Q+=""+q+"'";if(v.opts.verbose){if(Q+=" , schema: ",V)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var S=Q;if(Q=I.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+S+"]); ";else Q+=" validate.errors = ["+S+"]; return false; ";else Q+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",K)Q+=" else { ";return Q}});var N0=s((F4,CW)=>{CW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,N,L="data"+(Y||""),V=v.opts.$data&&w&&w.$data,q;if(V)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(V||typeof w=="number"))throw new Error(W+" must be number");var M=W=="maxItems"?">":"<";if(Q+="if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" "+L+".length "+M+" "+q+") { ";var N=W,$=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(N||"_limitItems")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+q+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT have ",W=="maxItems")Q+="more";else Q+="fewer";if(Q+=" than ",V)Q+="' + "+q+" + '";else Q+=""+w;Q+=" items' "}if(v.opts.verbose){if(Q+=" , schema: ",V)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",K)Q+=" else { ";return Q}});var V0=s((A4,TW)=>{TW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,N,L="data"+(Y||""),V=v.opts.$data&&w&&w.$data,q;if(V)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(V||typeof w=="number"))throw new Error(W+" must be number");var M=W=="maxLength"?">":"<";if(Q+="if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";if(v.opts.unicode===!1)Q+=" "+L+".length ";else Q+=" ucs2length("+L+") ";Q+=" "+M+" "+q+") { ";var N=W,$=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(N||"_limitLength")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+q+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT be ",W=="maxLength")Q+="longer";else Q+="shorter";if(Q+=" than ",V)Q+="' + "+q+" + '";else Q+=""+w;Q+=" characters' "}if(v.opts.verbose){if(Q+=" , schema: ",V)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",K)Q+=" else { ";return Q}});var D0=s((g4,xW)=>{xW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,N,L="data"+(Y||""),V=v.opts.$data&&w&&w.$data,q;if(V)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(V||typeof w=="number"))throw new Error(W+" must be number");var M=W=="maxProperties"?">":"<";if(Q+="if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" Object.keys("+L+").length "+M+" "+q+") { ";var N=W,$=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(N||"_limitProperties")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+q+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT have ",W=="maxProperties")Q+="more";else Q+="fewer";if(Q+=" than ",V)Q+="' + "+q+" + '";else Q+=""+w;Q+=" properties' "}if(v.opts.verbose){if(Q+=" , schema: ",V)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",K)Q+=" else { ";return Q}});var mW=s((_4,uW)=>{uW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V=v.opts.$data&&w&&w.$data,q;if(V)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(V||typeof w=="number"))throw new Error(W+" must be number");if(Q+="var division"+X+";if (",V)Q+=" "+q+" !== undefined && ( typeof "+q+" != 'number' || ";if(Q+=" (division"+X+" = "+L+" / "+q+", ",v.opts.multipleOfPrecision)Q+=" Math.abs(Math.round(division"+X+") - division"+X+") > 1e-"+v.opts.multipleOfPrecision+" ";else Q+=" division"+X+" !== parseInt(division"+X+") ";if(Q+=" ) ",V)Q+=" ) ";Q+=" ) { ";var M=M||[];if(M.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { multipleOf: "+q+" } ",v.opts.messages!==!1)if(Q+=" , message: 'should be multiple of ",V)Q+="' + "+q;else Q+=""+q+"'";if(v.opts.verbose){if(Q+=" , schema: ",V)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var N=Q;if(Q=M.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+N+"]); ";else Q+=" validate.errors = ["+N+"]; return false; ";else Q+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",K)Q+=" else { ";return Q}});var aW=s((h4,rW)=>{rW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="errs__"+X,q=v.util.copy(v);q.level++;var M="valid"+q.level;if(v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all)){q.schema=w,q.schemaPath=B,q.errSchemaPath=z,Q+=" var "+V+" = errors; ";var N=v.compositeRule;v.compositeRule=q.compositeRule=!0,q.createErrors=!1;var $;if(q.opts.allErrors)$=q.opts.allErrors,q.opts.allErrors=!1;if(Q+=" "+v.validate(q)+" ",q.createErrors=!0,$)q.opts.allErrors=$;v.compositeRule=q.compositeRule=N,Q+=" if ("+M+") { ";var O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'not' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should NOT be valid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var h=Q;if(Q=O.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+h+"]); ";else Q+=" validate.errors = ["+h+"]; return false; ";else Q+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else { errors = "+V+"; if (vErrors !== null) { if ("+V+") vErrors.length = "+V+"; else vErrors = null; } ",v.opts.allErrors)Q+=" } "}else{if(Q+=" var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'not' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should NOT be valid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",K)Q+=" if (false) { "}return Q}});var nW=s((b4,cW)=>{cW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q="errs__"+X,M=v.util.copy(v),N="";M.level++;var $="valid"+M.level,O=M.baseId,h="prevValid"+X,H="passingSchemas"+X;Q+="var "+q+" = errors , "+h+" = false , "+V+" = false , "+H+" = null; ";var k=v.compositeRule;v.compositeRule=M.compositeRule=!0;var l=w;if(l){var T,E=-1,g=l.length-1;while(E<g){if(T=l[E+=1],v.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:v.util.schemaHasRules(T,v.RULES.all))M.schema=T,M.schemaPath=B+"["+E+"]",M.errSchemaPath=z+"/"+E,Q+=" "+v.validate(M)+" ",M.baseId=O;else Q+=" var "+$+" = true; ";if(E)Q+=" if ("+$+" && "+h+") { "+V+" = false; "+H+" = ["+H+", "+E+"]; } else { ",N+="}";Q+=" if ("+$+") { "+V+" = "+h+" = true; "+H+" = "+E+"; }"}}if(v.compositeRule=M.compositeRule=k,Q+=""+N+"if (!"+V+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { passingSchemas: "+H+" } ",v.opts.messages!==!1)Q+=" , message: 'should match exactly one schema in oneOf' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+="} else { errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; }",v.opts.allErrors)Q+=" } ";return Q}});var iW=s((R4,pW)=>{pW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V=v.opts.$data&&w&&w.$data,q;if(V)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;var M=V?"(new RegExp("+q+"))":v.usePattern(w);if(Q+="if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'string') || ";Q+=" !"+M+".test("+L+") ) { ";var N=N||[];if(N.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { pattern: ",V)Q+=""+q;else Q+=""+v.util.toQuotedString(w);if(Q+=" } ",v.opts.messages!==!1){if(Q+=` , message: 'should match pattern "`,V)Q+="' + "+q+" + '";else Q+=""+v.util.escapeQuotes(w);Q+=`"' `}if(v.opts.verbose){if(Q+=" , schema: ",V)Q+="validate.schema"+B;else Q+=""+v.util.toQuotedString(w);Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var $=Q;if(Q=N.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+$+"]); ";else Q+=" validate.errors = ["+$+"]; return false; ";else Q+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",K)Q+=" else { ";return Q}});var oW=s((k4,dW)=>{dW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="errs__"+X,q=v.util.copy(v),M="";q.level++;var N="valid"+q.level,$="key"+X,O="idx"+X,h=q.dataLevel=v.dataLevel+1,H="data"+h,k="dataProperties"+X,l=Object.keys(w||{}).filter(i),T=v.schema.patternProperties||{},E=Object.keys(T).filter(i),g=v.schema.additionalProperties,U=l.length||E.length,b=g===!1,I=typeof g=="object"&&Object.keys(g).length,S=v.opts.removeAdditional,_=b||I||S,R=v.opts.ownProperties,y=v.baseId,m=v.schema.required;if(m&&!(v.opts.$data&&m.$data)&&m.length<v.opts.loopRequired)var a=v.util.toHash(m);function i(iv){return iv!=="__proto__"}if(Q+="var "+V+" = errors;var "+N+" = true;",R)Q+=" var "+k+" = undefined;";if(_){if(R)Q+=" "+k+" = "+k+" || Object.keys("+L+"); for (var "+O+"=0; "+O+"<"+k+".length; "+O+"++) { var "+$+" = "+k+"["+O+"]; ";else Q+=" for (var "+$+" in "+L+") { ";if(U){if(Q+=" var isAdditional"+X+" = !(false ",l.length)if(l.length>8)Q+=" || validate.schema"+B+".hasOwnProperty("+$+") ";else{var p=l;if(p){var n,$v=-1,bv=p.length-1;while($v<bv)n=p[$v+=1],Q+=" || "+$+" == "+v.util.toQuotedString(n)+" "}}if(E.length){var Sv=E;if(Sv){var Yv,Ov=-1,gv=Sv.length-1;while(Ov<gv)Yv=Sv[Ov+=1],Q+=" || "+v.usePattern(Yv)+".test("+$+") "}}Q+=" ); if (isAdditional"+X+") { "}if(S=="all")Q+=" delete "+L+"["+$+"]; ";else{var yv=v.errorPath,Df="' + "+$+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(v.errorPath,$,v.opts.jsonPointers);if(b)if(S)Q+=" delete "+L+"["+$+"]; ";else{Q+=" "+N+" = false; ";var Pf=z;z=v.errSchemaPath+"/additionalProperties";var Uv=Uv||[];if(Uv.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { additionalProperty: '"+Df+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is an invalid additional property";else Q+="should NOT have additional properties";Q+="' "}if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var jv=Q;if(Q=Uv.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+jv+"]); ";else Q+=" validate.errors = ["+jv+"]; return false; ";else Q+=" var err = "+jv+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(z=Pf,K)Q+=" break; "}else if(I)if(S=="failing"){Q+=" var "+V+" = errors; ";var bf=v.compositeRule;v.compositeRule=q.compositeRule=!0,q.schema=g,q.schemaPath=v.schemaPath+".additionalProperties",q.errSchemaPath=v.errSchemaPath+"/additionalProperties",q.errorPath=v.opts._errorDataPathProperty?v.errorPath:v.util.getPathExpr(v.errorPath,$,v.opts.jsonPointers);var Rv=L+"["+$+"]";q.dataPathArr[h]=$;var Gv=v.validate(q);if(q.baseId=y,v.util.varOccurences(Gv,H)<2)Q+=" "+v.util.varReplace(Gv,H,Rv)+" ";else Q+=" var "+H+" = "+Rv+"; "+Gv+" ";Q+=" if (!"+N+") { errors = "+V+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+L+"["+$+"]; } ",v.compositeRule=q.compositeRule=bf}else{q.schema=g,q.schemaPath=v.schemaPath+".additionalProperties",q.errSchemaPath=v.errSchemaPath+"/additionalProperties",q.errorPath=v.opts._errorDataPathProperty?v.errorPath:v.util.getPathExpr(v.errorPath,$,v.opts.jsonPointers);var Rv=L+"["+$+"]";q.dataPathArr[h]=$;var Gv=v.validate(q);if(q.baseId=y,v.util.varOccurences(Gv,H)<2)Q+=" "+v.util.varReplace(Gv,H,Rv)+" ";else Q+=" var "+H+" = "+Rv+"; "+Gv+" ";if(K)Q+=" if (!"+N+") break; "}v.errorPath=yv}if(U)Q+=" } ";if(Q+=" } ",K)Q+=" if ("+N+") { ",M+="}"}var jf=v.opts.useDefaults&&!v.compositeRule;if(l.length){var Kf=l;if(Kf){var n,Rf=-1,kf=Kf.length-1;while(Rf<kf){n=Kf[Rf+=1];var _v=w[n];if(v.opts.strictKeywords?typeof _v=="object"&&Object.keys(_v).length>0||_v===!1:v.util.schemaHasRules(_v,v.RULES.all)){var rv=v.util.getProperty(n),Rv=L+rv,Zv=jf&&_v.default!==void 0;q.schema=_v,q.schemaPath=B+rv,q.errSchemaPath=z+"/"+v.util.escapeFragment(n),q.errorPath=v.util.getPath(v.errorPath,n,v.opts.jsonPointers),q.dataPathArr[h]=v.util.toQuotedString(n);var Gv=v.validate(q);if(q.baseId=y,v.util.varOccurences(Gv,H)<2){Gv=v.util.varReplace(Gv,H,Rv);var lv=Rv}else{var lv=H;Q+=" var "+H+" = "+Rv+"; "}if(Zv)Q+=" "+Gv+" ";else{if(a&&a[n]){if(Q+=" if ( "+lv+" === undefined ",R)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(n)+"') ";Q+=") { "+N+" = false; ";var yv=v.errorPath,Pf=z,Jf=v.util.escapeQuotes(n);if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(yv,n,v.opts.jsonPointers);z=v.errSchemaPath+"/required";var Uv=Uv||[];if(Uv.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+Jf+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+Jf+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var jv=Q;if(Q=Uv.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+jv+"]); ";else Q+=" validate.errors = ["+jv+"]; return false; ";else Q+=" var err = "+jv+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";z=Pf,v.errorPath=yv,Q+=" } else { "}else if(K){if(Q+=" if ( "+lv+" === undefined ",R)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(n)+"') ";Q+=") { "+N+" = true; } else { "}else{if(Q+=" if ("+lv+" !== undefined ",R)Q+=" && Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(n)+"') ";Q+=" ) { "}Q+=" "+Gv+" } "}}if(K)Q+=" if ("+N+") { ",M+="}"}}}if(E.length){var xv=E;if(xv){var Yv,y1=-1,SQ=xv.length-1;while(y1<SQ){Yv=xv[y1+=1];var _v=T[Yv];if(v.opts.strictKeywords?typeof _v=="object"&&Object.keys(_v).length>0||_v===!1:v.util.schemaHasRules(_v,v.RULES.all)){if(q.schema=_v,q.schemaPath=v.schemaPath+".patternProperties"+v.util.getProperty(Yv),q.errSchemaPath=v.errSchemaPath+"/patternProperties/"+v.util.escapeFragment(Yv),R)Q+=" "+k+" = "+k+" || Object.keys("+L+"); for (var "+O+"=0; "+O+"<"+k+".length; "+O+"++) { var "+$+" = "+k+"["+O+"]; ";else Q+=" for (var "+$+" in "+L+") { ";Q+=" if ("+v.usePattern(Yv)+".test("+$+")) { ",q.errorPath=v.util.getPathExpr(v.errorPath,$,v.opts.jsonPointers);var Rv=L+"["+$+"]";q.dataPathArr[h]=$;var Gv=v.validate(q);if(q.baseId=y,v.util.varOccurences(Gv,H)<2)Q+=" "+v.util.varReplace(Gv,H,Rv)+" ";else Q+=" var "+H+" = "+Rv+"; "+Gv+" ";if(K)Q+=" if (!"+N+") break; ";if(Q+=" } ",K)Q+=" else "+N+" = true; ";if(Q+=" } ",K)Q+=" if ("+N+") { ",M+="}"}}}}if(K)Q+=" "+M+" if ("+V+" == errors) {";return Q}});var tW=s((S4,sW)=>{sW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="errs__"+X,q=v.util.copy(v),M="";q.level++;var N="valid"+q.level;if(Q+="var "+V+" = errors;",v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all)){q.schema=w,q.schemaPath=B,q.errSchemaPath=z;var $="key"+X,O="idx"+X,h="i"+X,H="' + "+$+" + '",k=q.dataLevel=v.dataLevel+1,l="data"+k,T="dataProperties"+X,E=v.opts.ownProperties,g=v.baseId;if(E)Q+=" var "+T+" = undefined; ";if(E)Q+=" "+T+" = "+T+" || Object.keys("+L+"); for (var "+O+"=0; "+O+"<"+T+".length; "+O+"++) { var "+$+" = "+T+"["+O+"]; ";else Q+=" for (var "+$+" in "+L+") { ";Q+=" var startErrs"+X+" = errors; ";var U=$,b=v.compositeRule;v.compositeRule=q.compositeRule=!0;var I=v.validate(q);if(q.baseId=g,v.util.varOccurences(I,l)<2)Q+=" "+v.util.varReplace(I,l,U)+" ";else Q+=" var "+l+" = "+U+"; "+I+" ";if(v.compositeRule=q.compositeRule=b,Q+=" if (!"+N+") { for (var "+h+"=startErrs"+X+"; "+h+"<errors; "+h+"++) { vErrors["+h+"].propertyName = "+$+"; } var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { propertyName: '"+H+"' } ",v.opts.messages!==!1)Q+=" , message: 'property name \\'"+H+"\\' is invalid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(K)Q+=" break; ";Q+=" } }"}if(K)Q+=" "+M+" if ("+V+" == errors) {";return Q}});var v9=s((y4,eW)=>{eW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q=v.opts.$data&&w&&w.$data,M;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",M="schema"+X;else M=w;var N="schema"+X;if(!q)if(w.length<v.opts.loopRequired&&v.schema.properties&&Object.keys(v.schema.properties).length){var $=[],O=w;if(O){var h,H=-1,k=O.length-1;while(H<k){h=O[H+=1];var l=v.schema.properties[h];if(!(l&&(v.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:v.util.schemaHasRules(l,v.RULES.all))))$[$.length]=h}}}else var $=w;if(q||$.length){var T=v.errorPath,E=q||$.length>=v.opts.loopRequired,g=v.opts.ownProperties;if(K)if(Q+=" var missing"+X+"; ",E){if(!q)Q+=" var "+N+" = validate.schema"+B+"; ";var U="i"+X,b="schema"+X+"["+U+"]",I="' + "+b+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(T,b,v.opts.jsonPointers);if(Q+=" var "+V+" = true; ",q)Q+=" if (schema"+X+" === undefined) "+V+" = true; else if (!Array.isArray(schema"+X+")) "+V+" = false; else {";if(Q+=" for (var "+U+" = 0; "+U+" < "+N+".length; "+U+"++) { "+V+" = "+L+"["+N+"["+U+"]] !== undefined ",g)Q+=" && Object.prototype.hasOwnProperty.call("+L+", "+N+"["+U+"]) ";if(Q+="; if (!"+V+") break; } ",q)Q+=" } ";Q+=" if (!"+V+") { ";var S=S||[];if(S.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+I+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var _=Q;if(Q=S.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+_+"]); ";else Q+=" validate.errors = ["+_+"]; return false; ";else Q+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } else { "}else{Q+=" if ( ";var R=$;if(R){var y,U=-1,m=R.length-1;while(U<m){if(y=R[U+=1],U)Q+=" || ";var a=v.util.getProperty(y),i=L+a;if(Q+=" ( ( "+i+" === undefined ",g)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(y)+"') ";Q+=") && (missing"+X+" = "+v.util.toQuotedString(v.opts.jsonPointers?y:a)+") ) "}}Q+=") { ";var b="missing"+X,I="' + "+b+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.opts.jsonPointers?v.util.getPathExpr(T,b,!0):T+" + "+b;var S=S||[];if(S.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+I+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var _=Q;if(Q=S.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+_+"]); ";else Q+=" validate.errors = ["+_+"]; return false; ";else Q+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } else { "}else if(E){if(!q)Q+=" var "+N+" = validate.schema"+B+"; ";var U="i"+X,b="schema"+X+"["+U+"]",I="' + "+b+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(T,b,v.opts.jsonPointers);if(q){if(Q+=" if ("+N+" && !Array.isArray("+N+")) { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+I+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+N+" !== undefined) { "}if(Q+=" for (var "+U+" = 0; "+U+" < "+N+".length; "+U+"++) { if ("+L+"["+N+"["+U+"]] === undefined ",g)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", "+N+"["+U+"]) ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+I+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",q)Q+=" } "}else{var p=$;if(p){var y,n=-1,$v=p.length-1;while(n<$v){y=p[n+=1];var a=v.util.getProperty(y),I=v.util.escapeQuotes(y),i=L+a;if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(T,y,v.opts.jsonPointers);if(Q+=" if ( "+i+" === undefined ",g)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(y)+"') ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+I+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}v.errorPath=T}else if(K)Q+=" if (true) {";return Q}});var Q9=s((l4,f9)=>{f9.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q=v.opts.$data&&w&&w.$data,M;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",M="schema"+X;else M=w;if((w||q)&&v.opts.uniqueItems!==!1){if(q)Q+=" var "+V+"; if ("+M+" === false || "+M+" === undefined) "+V+" = true; else if (typeof "+M+" != 'boolean') "+V+" = false; else { ";Q+=" var i = "+L+".length , "+V+" = true , j; if (i > 1) { ";var N=v.schema.items&&v.schema.items.type,$=Array.isArray(N);if(!N||N=="object"||N=="array"||$&&(N.indexOf("object")>=0||N.indexOf("array")>=0))Q+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+L+"[i], "+L+"[j])) { "+V+" = false; break outer; } } } ";else{Q+=" var itemIndices = {}, item; for (;i--;) { var item = "+L+"[i]; ";var O="checkDataType"+($?"s":"");if(Q+=" if ("+v.util[O](N,"item",v.opts.strictNumbers,!0)+") continue; ",$)Q+=` if (typeof item == 'string') item = '"' + item; `;Q+=" if (typeof itemIndices[item] == 'number') { "+V+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}if(Q+=" } ",q)Q+=" } ";Q+=" if (!"+V+") { ";var h=h||[];if(h.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { i: i, j: j } ",v.opts.messages!==!1)Q+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' ";if(v.opts.verbose){if(Q+=" , schema: ",q)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var H=Q;if(Q=h.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+H+"]); ";else Q+=" validate.errors = ["+H+"]; return false; ";else Q+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",K)Q+=" else { "}else if(K)Q+=" if (true) { ";return Q}});var J9=s((I4,W9)=>{W9.exports={$ref:MW(),allOf:VW(),anyOf:jW(),$comment:OW(),const:HW(),contains:AW(),dependencies:_W(),enum:bW(),format:kW(),if:yW(),items:IW(),maximum:M0(),minimum:M0(),maxItems:N0(),minItems:N0(),maxLength:V0(),minLength:V0(),maxProperties:D0(),minProperties:D0(),multipleOf:mW(),not:aW(),oneOf:nW(),pattern:iW(),properties:oW(),propertyNames:tW(),required:v9(),uniqueItems:Q9(),validate:$0()}});var w9=s((Z4,Y9)=>{var X9=J9(),j0=uf().toHash;Y9.exports=function f(){var v=[{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"]}],W=["type","$comment"],J=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],Q=["number","integer","string","array","object","boolean","null"];return v.all=j0(W),v.types=j0(Q),v.forEach(function(X){if(X.rules=X.rules.map(function(Y){var w;if(typeof Y=="object"){var B=Object.keys(Y)[0];w=Y[B],Y=B,w.forEach(function(K){W.push(K),v.all[K]=!0})}W.push(Y);var z=v.all[Y]={keyword:Y,code:X9[Y],implements:w};return z}),v.all.$comment={keyword:"$comment",code:X9.$comment},X.type)v.types[X.type]=X}),v.keywords=j0(W.concat(J)),v.custom={},v}});var q9=s((C4,B9)=>{var G9=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];B9.exports=function(f,v){for(var W=0;W<v.length;W++){f=JSON.parse(JSON.stringify(f));var J=v[W].split("/"),Q=f,X;for(X=1;X<J.length;X++)Q=Q[J[X]];for(X=0;X<G9.length;X++){var Y=G9[X],w=Q[Y];if(w)Q[Y]={anyOf:[w,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}}}return f}});var z9=s((T4,K9)=>{var PY=zQ().MissingRef;K9.exports=P9;function P9(f,v,W){var J=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");if(typeof v=="function")W=v,v=void 0;var Q=X(f).then(function(){var w=J._addSchema(f,void 0,v);return w.validate||Y(w)});if(W)Q.then(function(w){W(null,w)},W);return Q;function X(w){var B=w.$schema;return B&&!J.getSchema(B)?P9.call(J,{$ref:B},!0):Promise.resolve()}function Y(w){try{return J._compile(w)}catch(z){if(z instanceof PY)return B(z);throw z}function B(z){var K=z.missingSchema;if(q(K))throw new Error("Schema "+K+" is loaded but "+z.missingRef+" cannot be resolved");var L=J._loadingSchemas[K];if(!L)L=J._loadingSchemas[K]=J._opts.loadSchema(K),L.then(V,V);return L.then(function(M){if(!q(K))return X(M).then(function(){if(!q(K))J.addSchema(M,K,void 0,v)})}).then(function(){return Y(w)});function V(){delete J._loadingSchemas[K]}function q(M){return J._refs[M]||J._schemas[M]}}}}});var L9=s((x4,$9)=>{$9.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L,V="data"+(Y||""),q="valid"+X,M="errs__"+X,N=v.opts.$data&&w&&w.$data,$;if(N)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",$="schema"+X;else $=w;var O=this,h="definition"+X,H=O.definition,k="",l,T,E,g,U;if(N&&H.$data){U="keywordValidate"+X;var b=H.validateSchema;Q+=" var "+h+" = RULES.custom['"+W+"'].definition; var "+U+" = "+h+".validate;"}else{if(g=v.useCustomRule(O,w,v.schema,v),!g)return;$="validate.schema"+B,U=g.code,l=H.compile,T=H.inline,E=H.macro}var I=U+".errors",S="i"+X,_="ruleErr"+X,R=H.async;if(R&&!v.async)throw new Error("async keyword in sync schema");if(!(T||E))Q+=""+I+" = null;";if(Q+="var "+M+" = errors;var "+q+";",N&&H.$data){if(k+="}",Q+=" if ("+$+" === undefined) { "+q+" = true; } else { ",b)k+="}",Q+=" "+q+" = "+h+".validateSchema("+$+"); if ("+q+") { "}if(T)if(H.statements)Q+=" "+g.validate+" ";else Q+=" "+q+" = "+g.validate+"; ";else if(E){var y=v.util.copy(v),k="";y.level++;var m="valid"+y.level;y.schema=g.validate,y.schemaPath="";var a=v.compositeRule;v.compositeRule=y.compositeRule=!0;var i=v.validate(y).replace(/validate\.schema/g,U);v.compositeRule=y.compositeRule=a,Q+=" "+i}else{var p=p||[];if(p.push(Q),Q="",Q+=" "+U+".call( ",v.opts.passContext)Q+="this";else Q+="self";if(l||H.schema===!1)Q+=" , "+V+" ";else Q+=" , "+$+" , "+V+" , validate.schema"+v.schemaPath+" ";if(Q+=" , (dataPath || '')",v.errorPath!='""')Q+=" + "+v.errorPath;var n=Y?"data"+(Y-1||""):"parentData",$v=Y?v.dataPathArr[Y]:"parentDataProperty";Q+=" , "+n+" , "+$v+" , rootData ) ";var bv=Q;if(Q=p.pop(),H.errors===!1){if(Q+=" "+q+" = ",R)Q+="await ";Q+=""+bv+"; "}else if(R)I="customErrors"+X,Q+=" var "+I+" = null; try { "+q+" = await "+bv+"; } catch (e) { "+q+" = false; if (e instanceof ValidationError) "+I+" = e.errors; else throw e; } ";else Q+=" "+I+" = null; "+q+" = "+bv+"; "}if(H.modifying)Q+=" if ("+n+") "+V+" = "+n+"["+$v+"];";if(Q+=""+k,H.valid){if(K)Q+=" if (true) { "}else{if(Q+=" if ( ",H.valid===void 0)if(Q+=" !",E)Q+=""+m;else Q+=""+q;else Q+=" "+!H.valid+" ";Q+=") { ",L=O.keyword;var p=p||[];p.push(Q),Q="";var p=p||[];if(p.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(L||"custom")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { keyword: '"+O.keyword+"' } ",v.opts.messages!==!1)Q+=` , message: 'should pass "`+O.keyword+`" keyword validation' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+V+" ";Q+=" } "}else Q+=" {} ";var Sv=Q;if(Q=p.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+Sv+"]); ";else Q+=" validate.errors = ["+Sv+"]; return false; ";else Q+=" var err = "+Sv+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var Yv=Q;if(Q=p.pop(),T)if(H.errors){if(H.errors!="full"){if(Q+=" for (var "+S+"="+M+"; "+S+"<errors; "+S+"++) { var "+_+" = vErrors["+S+"]; if ("+_+".dataPath === undefined) "+_+".dataPath = (dataPath || '') + "+v.errorPath+"; if ("+_+".schemaPath === undefined) { "+_+'.schemaPath = "'+z+'"; } ',v.opts.verbose)Q+=" "+_+".schema = "+$+"; "+_+".data = "+V+"; ";Q+=" } "}}else if(H.errors===!1)Q+=" "+Yv+" ";else{if(Q+=" if ("+M+" == errors) { "+Yv+" } else { for (var "+S+"="+M+"; "+S+"<errors; "+S+"++) { var "+_+" = vErrors["+S+"]; if ("+_+".dataPath === undefined) "+_+".dataPath = (dataPath || '') + "+v.errorPath+"; if ("+_+".schemaPath === undefined) { "+_+'.schemaPath = "'+z+'"; } ',v.opts.verbose)Q+=" "+_+".schema = "+$+"; "+_+".data = "+V+"; ";Q+=" } } "}else if(E){if(Q+=" var err = ",v.createErrors!==!1){if(Q+=" { keyword: '"+(L||"custom")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { keyword: '"+O.keyword+"' } ",v.opts.messages!==!1)Q+=` , message: 'should pass "`+O.keyword+`" keyword validation' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+V+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; "}else if(H.errors===!1)Q+=" "+Yv+" ";else{if(Q+=" if (Array.isArray("+I+")) { if (vErrors === null) vErrors = "+I+"; else vErrors = vErrors.concat("+I+"); errors = vErrors.length; for (var "+S+"="+M+"; "+S+"<errors; "+S+"++) { var "+_+" = vErrors["+S+"]; if ("+_+".dataPath === undefined) "+_+".dataPath = (dataPath || '') + "+v.errorPath+"; "+_+'.schemaPath = "'+z+'"; ',v.opts.verbose)Q+=" "+_+".schema = "+$+"; "+_+".data = "+V+"; ";Q+=" } } else { "+Yv+" } "}if(Q+=" } ",K)Q+=" else { "}return Q}});var E0=s((u4,KY)=>{KY.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 V9=s((m4,N9)=>{var M9=E0();N9.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:M9.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:M9.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 j9=s((r4,D9)=>{var zY=/^[a-z_$][a-z0-9_$-]*$/i,$Y=L9(),LY=V9();D9.exports={add:MY,get:NY,remove:VY,validate:O0};function MY(f,v){var W=this.RULES;if(W.keywords[f])throw new Error("Keyword "+f+" is already defined");if(!zY.test(f))throw new Error("Keyword "+f+" is not a valid identifier");if(v){this.validateKeyword(v,!0);var J=v.type;if(Array.isArray(J))for(var Q=0;Q<J.length;Q++)Y(f,J[Q],v);else Y(f,J,v);var X=v.metaSchema;if(X){if(v.$data&&this._opts.$data)X={anyOf:[X,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]};v.validateSchema=this.compile(X,!0)}}W.keywords[f]=W.all[f]=!0;function Y(w,B,z){var K;for(var L=0;L<W.length;L++){var V=W[L];if(V.type==B){K=V;break}}if(!K)K={type:B,rules:[]},W.push(K);var q={keyword:w,definition:z,custom:!0,code:$Y,implements:z.implements};K.rules.push(q),W.custom[w]=q}return this}function NY(f){var v=this.RULES.custom[f];return v?v.definition:this.RULES.keywords[f]||!1}function VY(f){var v=this.RULES;delete v.keywords[f],delete v.all[f],delete v.custom[f];for(var W=0;W<v.length;W++){var J=v[W].rules;for(var Q=0;Q<J.length;Q++)if(J[Q].keyword==f){J.splice(Q,1);break}}return this}function O0(f,v){O0.errors=null;var W=this._validateKeyword=this._validateKeyword||this.compile(LY,!0);if(W(f))return!0;if(O0.errors=W.errors,v)throw new Error("custom keyword definition is invalid: "+this.errorsText(W.errors));else return!1}});var E9=s((a4,DY)=>{DY.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 R9=s((c4,b9)=>{var U9=vW(),mf=KQ(),jY=QW(),H9=w0(),EY=z0(),OY=$W(),UY=w9(),F9=q9(),A9=uf();b9.exports=Ev;Ev.prototype.validate=FY;Ev.prototype.compile=AY;Ev.prototype.addSchema=gY;Ev.prototype.addMetaSchema=_Y;Ev.prototype.validateSchema=hY;Ev.prototype.getSchema=RY;Ev.prototype.removeSchema=SY;Ev.prototype.addFormat=uY;Ev.prototype.errorsText=xY;Ev.prototype._addSchema=yY;Ev.prototype._compile=lY;Ev.prototype.compileAsync=z9();var EQ=j9();Ev.prototype.addKeyword=EQ.add;Ev.prototype.getKeyword=EQ.get;Ev.prototype.removeKeyword=EQ.remove;Ev.prototype.validateKeyword=EQ.validate;var g9=zQ();Ev.ValidationError=g9.Validation;Ev.MissingRefError=g9.MissingRef;Ev.$dataMetaSchema=F9;var jQ="http://json-schema.org/draft-07/schema",O9=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],HY=["/properties"];function Ev(f){if(!(this instanceof Ev))return new Ev(f);if(f=this._opts=A9.copy(f)||{},pY(this),this._schemas={},this._refs={},this._fragments={},this._formats=OY(f.format),this._cache=f.cache||new jY,this._loadingSchemas={},this._compilations=[],this.RULES=UY(),this._getId=IY(f),f.loopRequired=f.loopRequired||1/0,f.errorDataPath=="property")f._errorDataPathProperty=!0;if(f.serialize===void 0)f.serialize=EY;if(this._metaOpts=nY(this),f.formats)aY(this);if(f.keywords)cY(this);if(mY(this),typeof f.meta=="object")this.addMetaSchema(f.meta);if(f.nullable)this.addKeyword("nullable",{metaSchema:{type:"boolean"}});rY(this)}function FY(f,v){var W;if(typeof f=="string"){if(W=this.getSchema(f),!W)throw new Error('no schema with key or ref "'+f+'"')}else{var J=this._addSchema(f);W=J.validate||this._compile(J)}var Q=W(v);if(W.$async!==!0)this.errors=W.errors;return Q}function AY(f,v){var W=this._addSchema(f,void 0,v);return W.validate||this._compile(W)}function gY(f,v,W,J){if(Array.isArray(f)){for(var Q=0;Q<f.length;Q++)this.addSchema(f[Q],void 0,W,J);return this}var X=this._getId(f);if(X!==void 0&&typeof X!="string")throw new Error("schema id must be string");return v=mf.normalizeId(v||X),h9(this,v),this._schemas[v]=this._addSchema(f,W,J,!0),this}function _Y(f,v,W){return this.addSchema(f,v,W,!0),this}function hY(f,v){var W=f.$schema;if(W!==void 0&&typeof W!="string")throw new Error("$schema must be a string");if(W=W||this._opts.defaultMeta||bY(this),!W)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var J=this.validate(W,f);if(!J&&v){var Q="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(Q);else throw new Error(Q)}return J}function bY(f){var v=f._opts.meta;return f._opts.defaultMeta=typeof v=="object"?f._getId(v)||v:f.getSchema(jQ)?jQ:void 0,f._opts.defaultMeta}function RY(f){var v=_9(this,f);switch(typeof v){case"object":return v.validate||this._compile(v);case"string":return this.getSchema(v);case"undefined":return kY(this,f)}}function kY(f,v){var W=mf.schema.call(f,{schema:{}},v);if(W){var{schema:J,root:Q,baseId:X}=W,Y=U9.call(f,J,Q,void 0,X);return f._fragments[v]=new H9({ref:v,fragment:!0,schema:J,root:Q,baseId:X,validate:Y}),Y}}function _9(f,v){return v=mf.normalizeId(v),f._schemas[v]||f._refs[v]||f._fragments[v]}function SY(f){if(f instanceof RegExp)return DQ(this,this._schemas,f),DQ(this,this._refs,f),this;switch(typeof f){case"undefined":return DQ(this,this._schemas),DQ(this,this._refs),this._cache.clear(),this;case"string":var v=_9(this,f);if(v)this._cache.del(v.cacheKey);return delete this._schemas[f],delete this._refs[f],this;case"object":var W=this._opts.serialize,J=W?W(f):f;this._cache.del(J);var Q=this._getId(f);if(Q)Q=mf.normalizeId(Q),delete this._schemas[Q],delete this._refs[Q]}return this}function DQ(f,v,W){for(var J in v){var Q=v[J];if(!Q.meta&&(!W||W.test(J)))f._cache.del(Q.cacheKey),delete v[J]}}function yY(f,v,W,J){if(typeof f!="object"&&typeof f!="boolean")throw new Error("schema should be object or boolean");var Q=this._opts.serialize,X=Q?Q(f):f,Y=this._cache.get(X);if(Y)return Y;J=J||this._opts.addUsedSchema!==!1;var w=mf.normalizeId(this._getId(f));if(w&&J)h9(this,w);var B=this._opts.validateSchema!==!1&&!v,z;if(B&&!(z=w&&w==mf.normalizeId(f.$schema)))this.validateSchema(f,!0);var K=mf.ids.call(this,f),L=new H9({id:w,schema:f,localRefs:K,cacheKey:X,meta:W});if(w[0]!="#"&&J)this._refs[w]=L;if(this._cache.put(X,L),B&&z)this.validateSchema(f,!0);return L}function lY(f,v){if(f.compiling){if(f.validate=Q,Q.schema=f.schema,Q.errors=null,Q.root=v?v:Q,f.schema.$async===!0)Q.$async=!0;return Q}f.compiling=!0;var W;if(f.meta)W=this._opts,this._opts=this._metaOpts;var J;try{J=U9.call(this,f.schema,v,f.localRefs)}catch(X){throw delete f.validate,X}finally{if(f.compiling=!1,f.meta)this._opts=W}return f.validate=J,f.refs=J.refs,f.refVal=J.refVal,f.root=J.root,J;function Q(){var X=f.validate,Y=X.apply(this,arguments);return Q.errors=X.errors,Y}}function IY(f){switch(f.schemaId){case"auto":return TY;case"id":return ZY;default:return CY}}function ZY(f){if(f.$id)this.logger.warn("schema $id ignored",f.$id);return f.id}function CY(f){if(f.id)this.logger.warn("schema id ignored",f.id);return f.$id}function TY(f){if(f.$id&&f.id&&f.$id!=f.id)throw new Error("schema $id is different from id");return f.$id||f.id}function xY(f,v){if(f=f||this.errors,!f)return"No errors";v=v||{};var W=v.separator===void 0?", ":v.separator,J=v.dataVar===void 0?"data":v.dataVar,Q="";for(var X=0;X<f.length;X++){var Y=f[X];if(Y)Q+=J+Y.dataPath+" "+Y.message+W}return Q.slice(0,-W.length)}function uY(f,v){if(typeof v=="string")v=new RegExp(v);return this._formats[f]=v,this}function mY(f){var v;if(f._opts.$data)v=E9(),f.addMetaSchema(v,v.$id,!0);if(f._opts.meta===!1)return;var W=E0();if(f._opts.$data)W=F9(W,HY);f.addMetaSchema(W,jQ,!0),f._refs["http://json-schema.org/schema"]=jQ}function rY(f){var v=f._opts.schemas;if(!v)return;if(Array.isArray(v))f.addSchema(v);else for(var W in v)f.addSchema(v[W],W)}function aY(f){for(var v in f._opts.formats){var W=f._opts.formats[v];f.addFormat(v,W)}}function cY(f){for(var v in f._opts.keywords){var W=f._opts.keywords[v];f.addKeyword(v,W)}}function h9(f,v){if(f._schemas[v]||f._refs[v])throw new Error('schema with key or id "'+v+'" already exists')}function nY(f){var v=A9.copy(f._opts);for(var W=0;W<O9.length;W++)delete v[O9[W]];return v}function pY(f){var v=f._opts.logger;if(v===!1)f.logger={log:U0,warn:U0,error:U0};else{if(v===void 0)v=console;if(!(typeof v=="object"&&v.log&&v.warn&&v.error))throw new Error("logger must implement log, warn and error methods");f.logger=v}}function U0(){}});var q7=(f)=>{let{idPattern:v,entityName:W}=f,J=(B)=>{return v.test(B)};return Object.freeze({isId:J,validateId:(B)=>{return J(B)},resolve:(B)=>{if(J(B))return{kind:"id",value:B};return{kind:"path",value:B}},getPattern:()=>{return v},getEntityName:()=>{return W}})},P7,y0;var MJ=Ef(()=>{P7=Object.freeze({create:q7}),y0=P7});var hQ,bQ,l0=(f)=>{if(hQ.isId(f))return"project";if(bQ.isId(f))return"shared";return},K7=(f)=>{return hQ.isId(f)||bQ.isId(f)},NJ=(f)=>{return f==="project"?hQ:bQ},z7=(f,v)=>{return NJ(v).validateId(f)},$7,Qf;var K1=Ef(()=>{MJ();hQ=y0.create({idPattern:/^doc\d{3,}$/,entityName:"project-doc"}),bQ=y0.create({idPattern:/^sdoc\d{3,}$/,entityName:"shared-doc"}),$7=Object.freeze({project:hQ,shared:bQ,detectScopeFromId:l0,isdocId:K7,getResolverForScope:NJ,validateIdForScope:z7}),Qf=$7});import{resolve as HJ,relative as AJ,normalize as F7,isAbsolute as gJ}from"path";import{realpath as FJ,lstat as A7}from"fs/promises";var Wf=(f,v,W)=>{let J=new Error(v);return J.name=f,J.code=f,J.details=W,J},_J=(f)=>{if(!f)throw Wf("VALIDATION_ERROR","Empty path");if(gJ(f))throw Wf("VALIDATION_ERROR","Absolute path not allowed",{path:f});let v=F7(f).replaceAll("\\","/");if(v.split("/").some((J)=>J===".."))throw Wf("BOUNDARY_VIOLATION","Path contains ..",{path:f});return v},I0=(f,v)=>{let W=AJ(f,v);return W!==""&&!W.startsWith("..")&&!gJ(W)},g7=async(f,v,W)=>{let J=_J(v),Q=HJ(f),X=HJ(Q,J);if(W?.followSymlinks)try{X=await FJ(X)}catch(w){if(w.code!=="ENOENT")throw w}else try{if((await A7(X)).isSymbolicLink()){let B=await FJ(X);if(!I0(Q,B))throw Wf("BOUNDARY_VIOLATION",`Symlink target escapes boundary: '${v}' \u2192 '${B}'`,{path:v,resolved:X,target:B})}}catch(w){if(w.code!=="ENOENT"&&w.code!=="BOUNDARY_VIOLATION")throw w;if(w.code==="BOUNDARY_VIOLATION")throw w}if(!I0(Q,X)&&X!==Q)throw Wf("BOUNDARY_VIOLATION",`Path escapes boundary: '${v}' \u2192 '${X}'`,{path:v,resolved:X,boundary:Q});let Y=AJ(Q,X).replaceAll("\\","/");return{abs:X,rel:Y}},_7=(f,v)=>{let W=f.code,J=v?.path?v.resolved?`'${v.path}' \u2192 '${v.resolved}'`:`'${v.path}'`:"";switch(W){case"ENOENT":return Wf("NOT_FOUND",`File or directory not found${J?`: ${J}`:""}`,{...v,originalCode:W});case"ENOTEMPTY":return Wf("DIRECTORY_NOT_EMPTY",`Directory not empty${J?`: ${J}`:""}`,{...v,originalCode:W});case"ENOTDIR":case"EISDIR":return Wf("VALIDATION_ERROR",`Invalid path type${J?`: ${J}`:""}`,{...v,originalCode:W,reason:W==="ENOTDIR"?"not a directory":"is a directory"});case"EACCES":case"EPERM":return Wf("FS_ERROR",`Permission denied${J?`: ${J}`:""}`,{...v,originalCode:W});case"EBUSY":return Wf("FS_ERROR",`Resource busy or locked${J?`: ${J}`:""}`,{...v,originalCode:W});default:if(v)f.context=v;return f}},h7,fv;var Z0=Ef(()=>{h7=Object.freeze({fsError:Wf,validateRelative:_J,insideBoundary:I0,resolveWithinBoundary:g7,mapOsError:_7}),fv=h7});import{readFile as b7,writeFile as R7,unlink as hJ,stat as C0,rename as k7,access as S7,mkdir as y7}from"fs/promises";import{constants as l7}from"fs";import{createHash as bJ}from"crypto";import{resolve as I7,dirname as T0,isAbsolute as Z7}from"path";var C7=(f)=>{let{boundaryDir:v}=f;if(!v)throw fv.fsError("VALIDATION_ERROR","boundaryDir is required (empty string)",{boundaryDir:v});if(!Z7(v))throw fv.fsError("VALIDATION_ERROR",`boundaryDir must be an absolute path: '${v}'`,{boundaryDir:v});let W=I7(v),J=async(N)=>{let{abs:$}=await fv.resolveWithinBoundary(W,N);return $},Q=(N,$,O=!1)=>{if(O&&N==="")return;if(!/^[a-f0-9]{64}$/.test(N)){let h=O?"empty string or 64-character lowercase hex SHA-256 hash":"64-character lowercase hex SHA-256 hash";throw fv.fsError("VALIDATION_ERROR",`Invalid ${$}: must be a ${h}`,{[$]:N})}},X=(N)=>{return bJ("sha256").update(N,"utf-8").digest("hex")},Y=(N)=>{return bJ("sha256").update(N).digest("hex")},w=async(N)=>{let $=await J(N);try{return await S7($,l7.F_OK),!0}catch{return!1}},B=async(N)=>{let $=await J(N);try{return await C0($)}catch(O){throw fv.mapOsError(O,{path:N,resolved:$,operation:"stat"})}},z=async(N)=>{let $=await J(N),O;try{O=await C0($)}catch(h){throw fv.mapOsError(h,{path:N,resolved:$,operation:"stat"})}if(!O.isFile())throw fv.fsError("VALIDATION_ERROR","Target is not a regular file",{path:N,resolved:$});try{let h=await b7($,"utf-8"),H=X(h);return{content:h,hash:H}}catch(h){throw fv.mapOsError(h,{path:N,resolved:$,operation:"readFile"})}},K=async(N,$,O)=>{Q($,"baseHash",!0);let h=await J(N),H=X(O),k;try{k=(await z(N)).hash}catch(T){if(T.code==="NOT_FOUND"){if($!=="")throw fv.fsError("HASH_MISMATCH",`Hash mismatch: expected '${$}' for new file, got '' (file does not exist)`,{path:N,expected:$,actual:""});let E;try{E=await C0(h)}catch(g){if(g.code==="ENOENT")E=null;else throw fv.mapOsError(g,{path:N,resolved:h,operation:"stat"})}if(E&&!E.isFile())throw fv.fsError("VALIDATION_ERROR","Target path exists and is not a regular file",{path:N,resolved:h});try{await y7(T0(h),{recursive:!0})}catch(g){throw fv.mapOsError(g,{path:T0(N),resolved:T0(h),operation:"mkdir"})}k=""}else throw T}if(k!==$)throw fv.fsError("HASH_MISMATCH",`Hash mismatch: expected '${$}', got '${k}'`,{path:N,expected:$,actual:k});if(H===$)return{newHash:$};let l=`${h}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{await R7(l,O,{encoding:"utf-8",mode:384}),await k7(l,h)}catch(T){try{await hJ(l)}catch{}throw fv.mapOsError(T,{path:N,resolved:h,operation:"writeTextAtomicIfUnchanged"})}return{newHash:H}},L=async(N,$)=>{Q($,"expectedHash",!1);let O=await J(N),h;try{h=(await z(N)).hash}catch(H){if(H.code==="NOT_FOUND")return{deleted:!1};throw H}if(h!==$)throw fv.fsError("HASH_MISMATCH",`Hash mismatch: expected '${$}', got '${h}'`,{path:N,expected:$,actual:h});try{return await hJ(O),{deleted:!0}}catch(H){throw fv.mapOsError(H,{path:N,resolved:O,operation:"deleteIfUnchanged"})}},V=(N,$,O)=>{for(let k=0;k<$.length;k++){let{oldText:l}=$[k];if(l.length===0)throw fv.fsError("VALIDATION_ERROR",`Empty oldText in replacement at index ${k} would cause infinite loop`,{index:k})}let h=N,H=0;for(let{oldText:k,newText:l}of $)if(h.includes(k))h=h.replace(k,l),H++;if(O?.requireAll&&H!==$.length)throw fv.fsError("VALIDATION_ERROR",`Only ${H} of ${$.length} replacements were applied (requireAll=true)`,{applied:H,total:$.length});return{wouldContent:h,wouldHash:X(h),applied:H}};return Object.freeze({exists:w,stat:B,readText:z,computeHashForText:X,computeHashForBytes:Y,resolveSafe:async(N)=>{return fv.resolveWithinBoundary(W,N)},writeTextAtomicIfUnchanged:K,deleteIfUnchanged:L,previewReplaceFirst:V,applyReplaceFirstIfUnchanged:async(N,$,O,h)=>{Q($,"expectedHash",!1);let{content:H,hash:k}=await z(N);if(k!==$)throw fv.fsError("HASH_MISMATCH",`Hash mismatch: expected '${$}', got '${k}'`,{path:N,expected:$,actual:k});let{wouldContent:l,wouldHash:T,applied:E}=V(H,O,h);if(E===0)return{newHash:k,applied:0};return await K(N,k,l),{newHash:T,applied:E}}})},T7,x0;var RJ=Ef(()=>{Z0();T7=Object.freeze({create:C7}),x0=T7});import{mkdir as x7,rm as u7,rmdir as m7,stat as kJ,readdir as r7}from"fs/promises";import{resolve as SJ,dirname as a7,isAbsolute as yJ}from"path";var c7=(f)=>{let{boundaryDir:v}=f;if(!v)throw fv.fsError("VALIDATION_ERROR","boundaryDir is required (empty string)",{boundaryDir:v});if(!yJ(v))throw fv.fsError("VALIDATION_ERROR",`boundaryDir must be an absolute path: '${v}'`,{boundaryDir:v});let W=SJ(v),J=(K)=>{let L=K.toLowerCase().replace(/[^a-z0-9-_]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");if(!L)throw fv.fsError("VALIDATION_ERROR",`normalizeName produced empty result from input: '${K}'`,{name:K,normalized:L});return L},Q=async(K,L)=>{return await fv.resolveWithinBoundary(W,K,L)};return Object.freeze({normalizeName:J,resolve:Q,isInsideBoundary:(K)=>{if(!yJ(K))throw fv.fsError("VALIDATION_ERROR",`targetAbs must be an absolute path: '${K}'`,{targetAbs:K});let L=SJ(K);return fv.insideBoundary(W,L)},ensureDir:async(K)=>{let{abs:L}=await Q(K);try{await x7(L,{recursive:!0})}catch(V){throw fv.mapOsError(V,{path:K,resolved:L,operation:"ensureDir"})}},parentDir:(K)=>{let L=fv.validateRelative(K),V=a7(L);return V==="."?V:V.replaceAll("\\","/")},stat:async(K)=>{let{abs:L}=await Q(K);try{return await kJ(L)}catch(V){throw fv.mapOsError(V,{path:K,resolved:L,operation:"stat"})}},deleteDir:async(K,L)=>{if(L?.requireEmpty&&L?.recursive)throw fv.fsError("VALIDATION_ERROR","requireEmpty and recursive are mutually exclusive",{path:K});let{abs:V}=await Q(K);if(V===W)throw fv.fsError("VALIDATION_ERROR",`Cannot delete boundary root: '${K}' \u2192 '${V}'`,{path:K,resolved:V,boundary:W});let q;try{q=await kJ(V)}catch(M){if(M.code==="ENOENT")return{deleted:!1,reason:"NOT_FOUND"};throw fv.mapOsError(M,{path:K,resolved:V,operation:"stat"})}if(!q.isDirectory())return{deleted:!1,reason:"NOT_DIR"};if(L?.requireEmpty){let M;try{M=await r7(V)}catch(N){throw fv.mapOsError(N,{path:K,resolved:V,operation:"readdir"})}if(M.length>0)throw fv.fsError("DIRECTORY_NOT_EMPTY",`Directory not empty: '${K}' \u2192 '${V}'`,{path:K,resolved:V});try{return await m7(V),{deleted:!0}}catch(N){if(N.code==="ENOENT")return{deleted:!1,reason:"NOT_FOUND"};if(N.code==="ENOTEMPTY")throw fv.fsError("DIRECTORY_NOT_EMPTY",`Directory not empty (race condition): '${K}' \u2192 '${V}'`,{path:K,resolved:V});throw fv.mapOsError(N,{path:K,resolved:V,operation:"rmdir"})}}try{return await u7(V,{recursive:L?.recursive??!1}),{deleted:!0}}catch(M){if(M.code==="ENOENT")return{deleted:!1,reason:"NOT_FOUND"};if(M.code==="ENOTEMPTY"||M.code==="EISDIR"||M.code==="EACCES")throw fv.fsError("DIRECTORY_NOT_EMPTY",`Directory not empty: '${K}' \u2192 '${V}'`,{path:K,resolved:V,originalCode:M.code});throw fv.mapOsError(M,{path:K,resolved:V,operation:"deleteDir"})}}})},n7,u0;var lJ=Ef(()=>{Z0();n7=Object.freeze({create:c7}),u0=n7});import{dirname as p7}from"path";var IJ="---",Av=(f,v,W)=>{let J=new Error(v);if(J.code=f,W!==void 0)J.data=W;throw J},i7=(f)=>{let{fileServiceByScope:v,folderServiceByScope:W,indexFilename:J}=f,Q=(E)=>{if(E==="project")return v.project;if(E==="shared")return v.shared;return Av("INVALID_SCOPE",`Unknown scope '${E}'`,{scope:E})},X=(E)=>{if(E==="project")return W.project;if(E==="shared")return W.shared;return Av("INVALID_SCOPE",`Unknown scope '${E}'`,{scope:E})},Y=async(E)=>{if(E.scope)return{scope:E.scope};if(E.kind==="id"){let U=l0(E.id);if(!U)Av("INVALID_ID_FORMAT",`Invalid doc ID format: '${E.id}'. Expected docNNN or sdocNNN`,{id:E.id});return{scope:U}}if(E.kind==="path"){try{let U=await B("project");if(Object.entries(U.index).find(([I,S])=>S===E.path))return{scope:"project"}}catch{}try{let U=await B("shared");if(Object.entries(U.index).find(([I,S])=>S===E.path))return{scope:"shared",fallback:!0}}catch{}return{scope:"project"}}let g=E;return Av("VALIDATION_ERROR",`Unknown address kind: ${JSON.stringify(g)}`)},w=(E)=>{return J},B=async(E)=>{let g=w(E),U=Q(E);try{let{content:b,hash:I}=await U.readText(g);return{index:JSON.parse(b),hash:I}}catch(b){if(b.code==="NOT_FOUND")return{index:{},hash:""};throw b}},z=async(E,g,U)=>{let b=w(E),I=Q(E),S=JSON.stringify(g,null,2);try{let{newHash:_}=await I.writeTextAtomicIfUnchanged(b,U,S);return{hash:_}}catch(_){if(_.code==="HASH_MISMATCH"){let{index:R,hash:y}=await B(E),m={...R,...g},a=JSON.stringify(m,null,2),{newHash:i}=await I.writeTextAtomicIfUnchanged(b,y,a);return{hash:i}}throw _}},K=(E)=>{let g=E.split(`
3
+ `);if(g.length<3||g[0].trim()!==IJ)return{bodyContent:E};let U=-1;for(let y=1;y<g.length;y++)if(g[y].trim()===IJ){U=y;break}if(U===-1)return{bodyContent:E};let b=g.slice(1,U),I=g.slice(0,U+1).join(`
4
4
  `),S=g.slice(U+1).join(`
5
- `).trim(),_=(y)=>{if(y.startsWith('"')&&y.endsWith('"')||y.startsWith("'")&&y.endsWith("'"))return y.slice(1,-1);return y},R={};for(let y of b){let r=y.indexOf(":");if(r===-1)continue;let a=y.slice(0,r).trim(),i=y.slice(r+1).trim();R[a]=_(i)}return{rawFrontMatter:I,frontMatter:Object.keys(R).length>0?R:void 0,bodyContent:S}},L=(E,g)=>{switch(g.op){case"replaceOnce":{let{oldText:U,newText:b}=g;if(!E.includes(U))return{newContent:E,applied:!1};return{newContent:E.replace(U,b),applied:!0}}case"replaceAll":{let{oldText:U,newText:b}=g;if(!E.includes(U))return{newContent:E,applied:!1};let I=new RegExp(U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g");return{newContent:E.replace(I,b),applied:!0}}case"replaceRegex":{let{pattern:U,flags:b,replacement:I}=g,S=new RegExp(U,b);if(!S.test(E))return{newContent:E,applied:!1};return{newContent:E.replace(S,I),applied:!0}}case"replaceAllContent":{let{content:U}=g;return{newContent:U,applied:!0}}default:{let U=g;return Av("VALIDATION_ERROR",`Unknown edit operation: ${JSON.stringify(U)}`)}}},D=(E)=>{return docAddressResolver.isdocId(E)},q=(E)=>{if(!E||E.trim().length===0)return{valid:!1,reason:"Path cannot be empty"};if(E.startsWith("/"))return{valid:!1,reason:"Path must be relative (no leading slash)"};if(E.includes(".."))return{valid:!1,reason:'Path cannot contain ".." segments'};let U=E.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");if(/[<>:"|?*\0]/.test(U))return{valid:!1,reason:"Path contains invalid characters"};return{valid:!0,normalized:U}},M=(E)=>{let{scope:g,path:U}=E;if(g!=="project"&&g!=="shared")Av("INVALID_SCOPE",`Scope must be 'project' or 'shared', got '${g}'`,{scope:g});let b=q(U);if(!b.valid)Av("INVALID_PATH_FORMAT",b.reason,{path:U});return{scope:g,path:b.normalized}},N=async(E)=>{let{scope:g}=await Y(E),U=X(g),b;if(E.kind==="path")b=M({...E,scope:g}).path;else{let{id:S}=E;if(!D(S))Av("INVALID_ID_FORMAT",`ID must match pattern doc\\d{3,} or sdoc\\d{3,}, got '${S}'`,{id:S});let{index:_}=await B(g);if(!_[S])Av("doc_NOT_FOUND",`No doc with ID '${S}' in scope '${g}'`,{id:S,scope:g});b=_[S]}return{...await U.resolve(b),scope:g}},$=async(E)=>{if(E!=="project"&&E!=="shared")Av("INVALID_SCOPE",`Scope must be 'project' or 'shared', got '${E}'`,{scope:E});let{index:g}=await B(E),U=E==="project"?"doc":"sdoc",b=new RegExp(`^${U}(\\d{3,})$`),I=0;for(let R of Object.keys(g)){let y=R.match(b);if(y){let r=parseInt(y[1],10);if(r>I)I=r}}let S=I+1;return`${U}${S.toString().padStart(3,"0")}`},O=async(E)=>{let{address:g,content:U}=E;if(g.kind!=="path")Av("VALIDATION_ERROR","Create requires path-based addressing");let b=g.scope??"project",I=M({...g,scope:b}),{path:S}=I;if(docAddressResolver.isdocId(S))Av("INVALID_PATH_FORMAT",`Cannot create doc with path '${S}' - matches ID pattern`,{path:S,scope:b});let _=Q(b),R=X(b),y=await $(b);if(await _.exists(S))Av("doc_ALREADY_EXISTS",`doc already exists at path '${S}'`,{path:S,scope:b});let a=p7(S);if(a!==".")await R.ensureDir(a);let{newHash:i}=await _.writeTextAtomicIfUnchanged(S,"",U),{index:p,hash:n}=await B(b);return p[y]=S,await z(b,p,n),{id:y,hash:i,path:S}},h=async(E)=>{let{rel:g,scope:U}=await N(E),b=Q(U),{content:I,hash:S}=await b.readText(g),{frontMatter:_,bodyContent:R,rawFrontMatter:y}=K(I),r,a;if(E.kind==="path"){r=M({...E,scope:U}).path;let{index:p}=await B(U),n=Object.keys(p).find(($v)=>p[$v]===r);if(!n)return Av("doc_NOT_FOUND",`doc exists but not in index: '${r}'`,{path:r,scope:U});a=n}else if(E.kind==="id"){a=E.id;let{index:i}=await B(U),p=i[a];if(!p)return Av("doc_NOT_FOUND",`No doc with ID '${a}'`,{id:a,scope:U});r=p}else{let i=E;return Av("VALIDATION_ERROR",`Unknown address kind: ${JSON.stringify(i)}`)}return{address:E,content:I,hash:S,frontMatter:_,bodyContent:R,path:r,id:a}},H=async(E,g,U)=>{let{rel:b,scope:I}=await N(E),S=Q(I),{content:_,hash:R}=await S.readText(b);if(R!==g)Av("HASH_MISMATCH",`Expected hash '${g}', got '${R}'`,{expected:g,actual:R});let y=_,r=0;for(let i of U){let{newContent:p,applied:n}=L(y,i);if(y=p,n)r++}if(r===0)return{newHash:R,applied:0};let{newHash:a}=await S.writeTextAtomicIfUnchanged(b,R,y);return{newHash:a,applied:r}},k=async(E,g)=>{let{rel:U,scope:b}=await N(E),I=await(async()=>{if(E.kind==="id")return E.id;else if(E.kind==="path"){let a=M({...E,scope:b}),{index:i}=await B(b),p=Object.keys(i).find((n)=>i[n]===a.path);if(!p)return Av("doc_NOT_FOUND",`doc not in index: '${a.path}'`,{path:a.path,scope:b});return p}else{let r=E;return Av("VALIDATION_ERROR",`Unknown address kind: ${JSON.stringify(r)}`)}})(),S=Q(b),_=!1;try{_=(await S.deleteIfUnchanged(U,g)).deleted}catch(r){if(r.code==="NOT_FOUND")_=!1;else throw r}let{index:R,hash:y}=await B(b);if(R[I])delete R[I],await z(b,R,y);return{deleted:_}},l=async(E)=>{let{scope:g,pathPrefix:U,includeContent:b=!1}=E;if(g){if(g!=="project"&&g!=="shared")Av("INVALID_SCOPE",`Scope must be 'project' or 'shared', got '${g}'`,{scope:g});return await T(g,U,b)}let I=await T("project",U,b),S=await T("shared",U,b),_=new Set(I.map((r)=>r.path)),R=new Set(S.map((r)=>r.path));for(let r of I)if(R.has(r.path))r.override="overrides";for(let r of S)if(_.has(r.path))r.override="overridden";let y=[...I,...S];return y.sort((r,a)=>r.path.localeCompare(a.path)),y},T=async(E,g,U=!1)=>{let b=Q(E),I;try{I=(await B(E)).index}catch(_){if(_.code==="NOT_FOUND"||_.code==="ENOENT")return[];throw _}let S=[];for(let[_,R]of Object.entries(I)){if(g&&!R.startsWith(g))continue;try{if(U){let{content:y,hash:r}=await b.readText(R),a=await b.stat(R),{frontMatter:i}=K(y);S.push({scope:E,id:_,path:R,synopsis:i?.synopsis,hash:r,modifiedAt:a.mtime})}else{let y=await b.stat(R);S.push({scope:E,id:_,path:R,modifiedAt:y.mtime})}}catch{continue}}return S.sort((_,R)=>_.path.localeCompare(R.path)),S};return Object.freeze({create:O,read:h,editLatest:H,deleteLatest:k,list:l})},d7,CJ;var TJ=Ef(()=>{K1();d7=Object.freeze({create:i7}),CJ=d7});var rJ={};CQ(rJ,{default:()=>v2});import{mkdirSync as xJ}from"fs";var uJ="docs",o7=".index.json",s7=(f,v)=>{try{xJ(f,{recursive:!0}),xJ(v,{recursive:!0})}catch(W){let J=W instanceof Error?W.message:String(W);throw new Error(`Failed to create swic directories. Please check permissions.
5
+ `).trim(),_=(y)=>{if(y.startsWith('"')&&y.endsWith('"')||y.startsWith("'")&&y.endsWith("'"))return y.slice(1,-1);return y},R={};for(let y of b){let m=y.indexOf(":");if(m===-1)continue;let a=y.slice(0,m).trim(),i=y.slice(m+1).trim();R[a]=_(i)}return{rawFrontMatter:I,frontMatter:Object.keys(R).length>0?R:void 0,bodyContent:S}},L=(E,g)=>{switch(g.op){case"replaceOnce":{let{oldText:U,newText:b}=g;if(!E.includes(U))return{newContent:E,applied:!1};return{newContent:E.replace(U,b),applied:!0}}case"replaceAll":{let{oldText:U,newText:b}=g;if(!E.includes(U))return{newContent:E,applied:!1};let I=new RegExp(U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g");return{newContent:E.replace(I,b),applied:!0}}case"replaceRegex":{let{pattern:U,flags:b,replacement:I}=g,S=new RegExp(U,b);if(!S.test(E))return{newContent:E,applied:!1};return{newContent:E.replace(S,I),applied:!0}}case"replaceAllContent":{let{content:U}=g;return{newContent:U,applied:!0}}default:{let U=g;return Av("VALIDATION_ERROR",`Unknown edit operation: ${JSON.stringify(U)}`)}}},V=(E)=>{return docAddressResolver.isdocId(E)},q=(E)=>{if(!E||E.trim().length===0)return{valid:!1,reason:"Path cannot be empty"};if(E.startsWith("/"))return{valid:!1,reason:"Path must be relative (no leading slash)"};if(E.includes(".."))return{valid:!1,reason:'Path cannot contain ".." segments'};let U=E.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");if(/[<>:"|?*\0]/.test(U))return{valid:!1,reason:"Path contains invalid characters"};return{valid:!0,normalized:U}},M=(E)=>{let{scope:g,path:U}=E;if(g!=="project"&&g!=="shared")Av("INVALID_SCOPE",`Scope must be 'project' or 'shared', got '${g}'`,{scope:g});let b=q(U);if(!b.valid)Av("INVALID_PATH_FORMAT",b.reason,{path:U});return{scope:g,path:b.normalized}},N=async(E)=>{let{scope:g}=await Y(E),U=X(g),b;if(E.kind==="path")b=M({...E,scope:g}).path;else{let{id:S}=E;if(!V(S))Av("INVALID_ID_FORMAT",`ID must match pattern doc\\d{3,} or sdoc\\d{3,}, got '${S}'`,{id:S});let{index:_}=await B(g);if(!_[S])Av("doc_NOT_FOUND",`No doc with ID '${S}' in scope '${g}'`,{id:S,scope:g});b=_[S]}return{...await U.resolve(b),scope:g}},$=async(E)=>{if(E!=="project"&&E!=="shared")Av("INVALID_SCOPE",`Scope must be 'project' or 'shared', got '${E}'`,{scope:E});let{index:g}=await B(E),U=E==="project"?"doc":"sdoc",b=new RegExp(`^${U}(\\d{3,})$`),I=0;for(let R of Object.keys(g)){let y=R.match(b);if(y){let m=parseInt(y[1],10);if(m>I)I=m}}let S=I+1;return`${U}${S.toString().padStart(3,"0")}`},O=async(E)=>{let{address:g,content:U}=E;if(g.kind!=="path")Av("VALIDATION_ERROR","Create requires path-based addressing");let b=g.scope??"project",I=M({...g,scope:b}),{path:S}=I;if(docAddressResolver.isdocId(S))Av("INVALID_PATH_FORMAT",`Cannot create doc with path '${S}' - matches ID pattern`,{path:S,scope:b});let _=Q(b),R=X(b),y=await $(b);if(await _.exists(S))Av("doc_ALREADY_EXISTS",`doc already exists at path '${S}'`,{path:S,scope:b});let a=p7(S);if(a!==".")await R.ensureDir(a);let{newHash:i}=await _.writeTextAtomicIfUnchanged(S,"",U),{index:p,hash:n}=await B(b);return p[y]=S,await z(b,p,n),{id:y,hash:i,path:S}},h=async(E)=>{let{rel:g,scope:U}=await N(E),b=Q(U),{content:I,hash:S}=await b.readText(g),{frontMatter:_,bodyContent:R,rawFrontMatter:y}=K(I),m,a;if(E.kind==="path"){m=M({...E,scope:U}).path;let{index:p}=await B(U),n=Object.keys(p).find(($v)=>p[$v]===m);if(!n)return Av("doc_NOT_FOUND",`doc exists but not in index: '${m}'`,{path:m,scope:U});a=n}else if(E.kind==="id"){a=E.id;let{index:i}=await B(U),p=i[a];if(!p)return Av("doc_NOT_FOUND",`No doc with ID '${a}'`,{id:a,scope:U});m=p}else{let i=E;return Av("VALIDATION_ERROR",`Unknown address kind: ${JSON.stringify(i)}`)}return{address:E,content:I,hash:S,frontMatter:_,bodyContent:R,path:m,id:a}},H=async(E,g,U)=>{let{rel:b,scope:I}=await N(E),S=Q(I),{content:_,hash:R}=await S.readText(b);if(R!==g)Av("HASH_MISMATCH",`Expected hash '${g}', got '${R}'`,{expected:g,actual:R});let y=_,m=0;for(let i of U){let{newContent:p,applied:n}=L(y,i);if(y=p,n)m++}if(m===0)return{newHash:R,applied:0};let{newHash:a}=await S.writeTextAtomicIfUnchanged(b,R,y);return{newHash:a,applied:m}},k=async(E,g)=>{let{rel:U,scope:b}=await N(E),I=await(async()=>{if(E.kind==="id")return E.id;else if(E.kind==="path"){let a=M({...E,scope:b}),{index:i}=await B(b),p=Object.keys(i).find((n)=>i[n]===a.path);if(!p)return Av("doc_NOT_FOUND",`doc not in index: '${a.path}'`,{path:a.path,scope:b});return p}else{let m=E;return Av("VALIDATION_ERROR",`Unknown address kind: ${JSON.stringify(m)}`)}})(),S=Q(b),_=!1;try{_=(await S.deleteIfUnchanged(U,g)).deleted}catch(m){if(m.code==="NOT_FOUND")_=!1;else throw m}let{index:R,hash:y}=await B(b);if(R[I])delete R[I],await z(b,R,y);return{deleted:_}},l=async(E)=>{let{scope:g,pathPrefix:U,includeContent:b=!1}=E;if(g){if(g!=="project"&&g!=="shared")Av("INVALID_SCOPE",`Scope must be 'project' or 'shared', got '${g}'`,{scope:g});return await T(g,U,b)}let I=await T("project",U,b),S=await T("shared",U,b),_=new Set(I.map((m)=>m.path)),R=new Set(S.map((m)=>m.path));for(let m of I)if(R.has(m.path))m.override="overrides";for(let m of S)if(_.has(m.path))m.override="overridden";let y=[...I,...S];return y.sort((m,a)=>m.path.localeCompare(a.path)),y},T=async(E,g,U=!1)=>{let b=Q(E),I;try{I=(await B(E)).index}catch(_){if(_.code==="NOT_FOUND"||_.code==="ENOENT")return[];throw _}let S=[];for(let[_,R]of Object.entries(I)){if(g&&!R.startsWith(g))continue;try{if(U){let{content:y,hash:m}=await b.readText(R),a=await b.stat(R),{frontMatter:i}=K(y);S.push({scope:E,id:_,path:R,synopsis:i?.synopsis,hash:m,modifiedAt:a.mtime})}else{let y=await b.stat(R);S.push({scope:E,id:_,path:R,modifiedAt:y.mtime})}}catch{continue}}return S.sort((_,R)=>_.path.localeCompare(R.path)),S};return Object.freeze({create:O,read:h,editLatest:H,deleteLatest:k,list:l})},d7,ZJ;var CJ=Ef(()=>{K1();d7=Object.freeze({create:i7}),ZJ=d7});import{resolve as RQ,dirname as o7}from"path";import{homedir as s7}from"os";import{existsSync as t7}from"fs";var e7=(f=process.cwd())=>{let v=RQ(f),W=RQ("/"),J=RQ(s7(),".swic");while(v!==W){let Q=RQ(v,".swic");if(Q===J)throw new Error("Not in a project directory (found ~/.swic instead). Run swic from within a project.");if(t7(Q))return Q;v=o7(v)}throw new Error("Could not find .swic directory. Are you in a SWIC project?")},TJ;var xJ=Ef(()=>{TJ=Object.freeze({findProjectRoot:e7})});var rJ={};v8(rJ,{default:()=>Y2});import{mkdirSync as uJ}from"fs";import{resolve as mJ}from"path";import{homedir as v2}from"os";var kQ="docs",f2=".index.json",Q2=(f,v)=>{try{uJ(f,{recursive:!0}),uJ(v,{recursive:!0})}catch(W){let J=W instanceof Error?W.message:String(W);throw new Error(`Failed to create swic directories. Please check permissions.
6
6
  Project: ${f}
7
7
  Shared: ${v}
8
- Error: ${J}`)}},t7=(f)=>{let{projectBoundaryDir:v,sharedBoundaryDir:W}=f,J=`${v}/${uJ}`,Q=`${W}/${uJ}`;s7(J,Q);let X=u0.create({boundaryDir:J}),Y=u0.create({boundaryDir:Q}),w=r0.create({boundaryDir:J}),B=r0.create({boundaryDir:Q}),z=CJ.create({fileServiceByScope:{project:X,shared:Y},folderServiceByScope:{project:w,shared:B},indexFilename:o7});return Object.freeze({DocService:z})},e7,v2;var mJ=Ef(()=>{kJ();IJ();TJ();e7=Object.freeze({createServices:t7}),v2=e7});var aJ={};CQ(aJ,{default:()=>X2});import{resolve as RQ,dirname as f2}from"path";import{homedir as Q2}from"os";import{existsSync as W2}from"fs";var J2=(f=process.cwd())=>{let v=RQ(f),W=RQ("/"),J=RQ(Q2(),".swic");while(v!==W){let Q=RQ(v,".swic");if(Q===J)throw new Error("Not in a project directory (found ~/.swic instead). Run swic from within a project.");if(W2(Q))return Q;v=f2(v)}throw new Error("Could not find .swic directory. Are you in a SWIC project?")},X2;var cJ=Ef(()=>{X2=Object.freeze({findProjectRoot:J2})});var G={};CQ(G,{void:()=>e6,util:()=>Qv,unknown:()=>s6,union:()=>W5,undefined:()=>i6,tuple:()=>Y5,transformer:()=>M5,symbol:()=>p6,string:()=>q8,strictObject:()=>Q5,setErrorMap:()=>D6,set:()=>B5,record:()=>w5,quotelessJson:()=>M6,promise:()=>L5,preprocess:()=>V5,pipeline:()=>j5,ostring:()=>E5,optional:()=>N5,onumber:()=>O5,oboolean:()=>U5,objectUtil:()=>TQ,object:()=>f5,number:()=>P8,nullable:()=>D5,null:()=>d6,never:()=>t6,nativeEnum:()=>$5,nan:()=>a6,map:()=>G5,makeIssue:()=>j1,literal:()=>K5,lazy:()=>P5,late:()=>r6,isValid:()=>Of,isDirty:()=>T1,isAsync:()=>tf,isAborted:()=>C1,intersection:()=>X5,instanceof:()=>m6,getParsedType:()=>wf,getErrorMap:()=>sf,function:()=>q5,enum:()=>z5,effect:()=>M5,discriminatedUnion:()=>J5,defaultErrorMap:()=>Mf,datetimeRegex:()=>w8,date:()=>n6,custom:()=>B8,coerce:()=>H5,boolean:()=>K8,bigint:()=>c6,array:()=>v5,any:()=>o6,addIssueToContext:()=>u,ZodVoid:()=>O1,ZodUnknown:()=>Uf,ZodUnion:()=>J1,ZodUndefined:()=>Q1,ZodType:()=>vv,ZodTuple:()=>Bf,ZodTransformer:()=>ev,ZodSymbol:()=>E1,ZodString:()=>dv,ZodSet:()=>Tf,ZodSchema:()=>vv,ZodRecord:()=>U1,ZodReadonly:()=>P1,ZodPromise:()=>xf,ZodPipeline:()=>A1,ZodParsedType:()=>x,ZodOptional:()=>sv,ZodObject:()=>Vv,ZodNumber:()=>Hf,ZodNullable:()=>Df,ZodNull:()=>W1,ZodNever:()=>Gf,ZodNativeEnum:()=>G1,ZodNaN:()=>F1,ZodMap:()=>H1,ZodLiteral:()=>w1,ZodLazy:()=>Y1,ZodIssueCode:()=>Z,ZodIntersection:()=>X1,ZodFunction:()=>v1,ZodFirstPartyTypeKind:()=>C,ZodError:()=>Cv,ZodEnum:()=>Af,ZodEffects:()=>ev,ZodDiscriminatedUnion:()=>x1,ZodDefault:()=>B1,ZodDate:()=>Zf,ZodCatch:()=>q1,ZodBranded:()=>u1,ZodBoolean:()=>f1,ZodBigInt:()=>Ff,ZodArray:()=>ov,ZodAny:()=>Cf,Schema:()=>vv,ParseStatus:()=>hv,OK:()=>kv,NEVER:()=>F5,INVALID:()=>d,EMPTY_PATH:()=>V6,DIRTY:()=>If,BRAND:()=>u6});var Qv;(function(f){f.assertEqual=(Q)=>{};function v(Q){}f.assertIs=v;function W(Q){throw new Error}f.assertNever=W,f.arrayToEnum=(Q)=>{let X={};for(let Y of Q)X[Y]=Y;return X},f.getValidEnumValues=(Q)=>{let X=f.objectKeys(Q).filter((w)=>typeof Q[Q[w]]!=="number"),Y={};for(let w of X)Y[w]=Q[w];return f.objectValues(Y)},f.objectValues=(Q)=>{return f.objectKeys(Q).map(function(X){return Q[X]})},f.objectKeys=typeof Object.keys==="function"?(Q)=>Object.keys(Q):(Q)=>{let X=[];for(let Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y))X.push(Y);return X},f.find=(Q,X)=>{for(let Y of Q)if(X(Y))return Y;return},f.isInteger=typeof Number.isInteger==="function"?(Q)=>Number.isInteger(Q):(Q)=>typeof Q==="number"&&Number.isFinite(Q)&&Math.floor(Q)===Q;function J(Q,X=" | "){return Q.map((Y)=>typeof Y==="string"?`'${Y}'`:Y).join(X)}f.joinValues=J,f.jsonStringifyReplacer=(Q,X)=>{if(typeof X==="bigint")return X.toString();return X}})(Qv||(Qv={}));var TQ;(function(f){f.mergeShapes=(v,W)=>{return{...v,...W}}})(TQ||(TQ={}));var x=Qv.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wf=(f)=>{switch(typeof f){case"undefined":return x.undefined;case"string":return x.string;case"number":return Number.isNaN(f)?x.nan:x.number;case"boolean":return x.boolean;case"function":return x.function;case"bigint":return x.bigint;case"symbol":return x.symbol;case"object":if(Array.isArray(f))return x.array;if(f===null)return x.null;if(f.then&&typeof f.then==="function"&&f.catch&&typeof f.catch==="function")return x.promise;if(typeof Map!=="undefined"&&f instanceof Map)return x.map;if(typeof Set!=="undefined"&&f instanceof Set)return x.set;if(typeof Date!=="undefined"&&f instanceof Date)return x.date;return x.object;default:return x.unknown}};var Z=Qv.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"]),M6=(f)=>{return JSON.stringify(f,null,2).replace(/"([^"]+)":/g,"$1:")};class Cv extends Error{get errors(){return this.issues}constructor(f){super();this.issues=[],this.addIssue=(W)=>{this.issues=[...this.issues,W]},this.addIssues=(W=[])=>{this.issues=[...this.issues,...W]};let v=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,v);else this.__proto__=v;this.name="ZodError",this.issues=f}format(f){let v=f||function(Q){return Q.message},W={_errors:[]},J=(Q)=>{for(let X of Q.issues)if(X.code==="invalid_union")X.unionErrors.map(J);else if(X.code==="invalid_return_type")J(X.returnTypeError);else if(X.code==="invalid_arguments")J(X.argumentsError);else if(X.path.length===0)W._errors.push(v(X));else{let Y=W,w=0;while(w<X.path.length){let B=X.path[w];if(w!==X.path.length-1)Y[B]=Y[B]||{_errors:[]};else Y[B]=Y[B]||{_errors:[]},Y[B]._errors.push(v(X));Y=Y[B],w++}}};return J(this),W}static assert(f){if(!(f instanceof Cv))throw new Error(`Not a ZodError: ${f}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Qv.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(f=(v)=>v.message){let v={},W=[];for(let J of this.issues)if(J.path.length>0){let Q=J.path[0];v[Q]=v[Q]||[],v[Q].push(f(J))}else W.push(f(J));return{formErrors:W,fieldErrors:v}}get formErrors(){return this.flatten()}}Cv.create=(f)=>{return new Cv(f)};var N6=(f,v)=>{let W;switch(f.code){case Z.invalid_type:if(f.received===x.undefined)W="Required";else W=`Expected ${f.expected}, received ${f.received}`;break;case Z.invalid_literal:W=`Invalid literal value, expected ${JSON.stringify(f.expected,Qv.jsonStringifyReplacer)}`;break;case Z.unrecognized_keys:W=`Unrecognized key(s) in object: ${Qv.joinValues(f.keys,", ")}`;break;case Z.invalid_union:W="Invalid input";break;case Z.invalid_union_discriminator:W=`Invalid discriminator value. Expected ${Qv.joinValues(f.options)}`;break;case Z.invalid_enum_value:W=`Invalid enum value. Expected ${Qv.joinValues(f.options)}, received '${f.received}'`;break;case Z.invalid_arguments:W="Invalid function arguments";break;case Z.invalid_return_type:W="Invalid function return type";break;case Z.invalid_date:W="Invalid date";break;case Z.invalid_string:if(typeof f.validation==="object")if("includes"in f.validation){if(W=`Invalid input: must include "${f.validation.includes}"`,typeof f.validation.position==="number")W=`${W} at one or more positions greater than or equal to ${f.validation.position}`}else if("startsWith"in f.validation)W=`Invalid input: must start with "${f.validation.startsWith}"`;else if("endsWith"in f.validation)W=`Invalid input: must end with "${f.validation.endsWith}"`;else Qv.assertNever(f.validation);else if(f.validation!=="regex")W=`Invalid ${f.validation}`;else W="Invalid";break;case Z.too_small:if(f.type==="array")W=`Array must contain ${f.exact?"exactly":f.inclusive?"at least":"more than"} ${f.minimum} element(s)`;else if(f.type==="string")W=`String must contain ${f.exact?"exactly":f.inclusive?"at least":"over"} ${f.minimum} character(s)`;else if(f.type==="number")W=`Number must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${f.minimum}`;else if(f.type==="bigint")W=`Number must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${f.minimum}`;else if(f.type==="date")W=`Date must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(f.minimum))}`;else W="Invalid input";break;case Z.too_big:if(f.type==="array")W=`Array must contain ${f.exact?"exactly":f.inclusive?"at most":"less than"} ${f.maximum} element(s)`;else if(f.type==="string")W=`String must contain ${f.exact?"exactly":f.inclusive?"at most":"under"} ${f.maximum} character(s)`;else if(f.type==="number")W=`Number must be ${f.exact?"exactly":f.inclusive?"less than or equal to":"less than"} ${f.maximum}`;else if(f.type==="bigint")W=`BigInt must be ${f.exact?"exactly":f.inclusive?"less than or equal to":"less than"} ${f.maximum}`;else if(f.type==="date")W=`Date must be ${f.exact?"exactly":f.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(f.maximum))}`;else W="Invalid input";break;case Z.custom:W="Invalid input";break;case Z.invalid_intersection_types:W="Intersection results could not be merged";break;case Z.not_multiple_of:W=`Number must be a multiple of ${f.multipleOf}`;break;case Z.not_finite:W="Number must be finite";break;default:W=v.defaultError,Qv.assertNever(f)}return{message:W}},Mf=N6;var Q8=Mf;function D6(f){Q8=f}function sf(){return Q8}var j1=(f)=>{let{data:v,path:W,errorMaps:J,issueData:Q}=f,X=[...W,...Q.path||[]],Y={...Q,path:X};if(Q.message!==void 0)return{...Q,path:X,message:Q.message};let w="",B=J.filter((z)=>!!z).slice().reverse();for(let z of B)w=z(Y,{data:v,defaultError:w}).message;return{...Q,path:X,message:w}},V6=[];function u(f,v){let W=sf(),J=j1({issueData:v,data:f.data,path:f.path,errorMaps:[f.common.contextualErrorMap,f.schemaErrorMap,W,W===Mf?void 0:Mf].filter((Q)=>!!Q)});f.common.issues.push(J)}class hv{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(f,v){let W=[];for(let J of v){if(J.status==="aborted")return d;if(J.status==="dirty")f.dirty();W.push(J.value)}return{status:f.value,value:W}}static async mergeObjectAsync(f,v){let W=[];for(let J of v){let Q=await J.key,X=await J.value;W.push({key:Q,value:X})}return hv.mergeObjectSync(f,W)}static mergeObjectSync(f,v){let W={};for(let J of v){let{key:Q,value:X}=J;if(Q.status==="aborted")return d;if(X.status==="aborted")return d;if(Q.status==="dirty")f.dirty();if(X.status==="dirty")f.dirty();if(Q.value!=="__proto__"&&(typeof X.value!=="undefined"||J.alwaysSet))W[Q.value]=X.value}return{status:f.value,value:W}}}var d=Object.freeze({status:"aborted"}),If=(f)=>({status:"dirty",value:f}),kv=(f)=>({status:"valid",value:f}),C1=(f)=>f.status==="aborted",T1=(f)=>f.status==="dirty",Of=(f)=>f.status==="valid",tf=(f)=>typeof Promise!=="undefined"&&f instanceof Promise;var c;(function(f){f.errToObj=(v)=>typeof v==="string"?{message:v}:v||{},f.toString=(v)=>typeof v==="string"?v:v?.message})(c||(c={}));class tv{constructor(f,v,W,J){this._cachedPath=[],this.parent=f,this.data=v,this._path=W,this._key=J}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var W8=(f,v)=>{if(Of(v))return{success:!0,data:v.value};else{if(!f.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let W=new Cv(f.common.issues);return this._error=W,this._error}}}};function t(f){if(!f)return{};let{errorMap:v,invalid_type_error:W,required_error:J,description:Q}=f;if(v&&(W||J))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(v)return{errorMap:v,description:Q};return{errorMap:(Y,w)=>{let{message:B}=f;if(Y.code==="invalid_enum_value")return{message:B??w.defaultError};if(typeof w.data==="undefined")return{message:B??J??w.defaultError};if(Y.code!=="invalid_type")return{message:w.defaultError};return{message:B??W??w.defaultError}},description:Q}}class vv{get description(){return this._def.description}_getType(f){return wf(f.data)}_getOrReturnCtx(f,v){return v||{common:f.parent.common,data:f.data,parsedType:wf(f.data),schemaErrorMap:this._def.errorMap,path:f.path,parent:f.parent}}_processInputParams(f){return{status:new hv,ctx:{common:f.parent.common,data:f.data,parsedType:wf(f.data),schemaErrorMap:this._def.errorMap,path:f.path,parent:f.parent}}}_parseSync(f){let v=this._parse(f);if(tf(v))throw new Error("Synchronous parse encountered promise.");return v}_parseAsync(f){let v=this._parse(f);return Promise.resolve(v)}parse(f,v){let W=this.safeParse(f,v);if(W.success)return W.data;throw W.error}safeParse(f,v){let W={common:{issues:[],async:v?.async??!1,contextualErrorMap:v?.errorMap},path:v?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:wf(f)},J=this._parseSync({data:f,path:W.path,parent:W});return W8(W,J)}"~validate"(f){let v={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:wf(f)};if(!this["~standard"].async)try{let W=this._parseSync({data:f,path:[],parent:v});return Of(W)?{value:W.value}:{issues:v.common.issues}}catch(W){if(W?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;v.common={issues:[],async:!0}}return this._parseAsync({data:f,path:[],parent:v}).then((W)=>Of(W)?{value:W.value}:{issues:v.common.issues})}async parseAsync(f,v){let W=await this.safeParseAsync(f,v);if(W.success)return W.data;throw W.error}async safeParseAsync(f,v){let W={common:{issues:[],contextualErrorMap:v?.errorMap,async:!0},path:v?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:wf(f)},J=this._parse({data:f,path:W.path,parent:W}),Q=await(tf(J)?J:Promise.resolve(J));return W8(W,Q)}refine(f,v){let W=(J)=>{if(typeof v==="string"||typeof v==="undefined")return{message:v};else if(typeof v==="function")return v(J);else return v};return this._refinement((J,Q)=>{let X=f(J),Y=()=>Q.addIssue({code:Z.custom,...W(J)});if(typeof Promise!=="undefined"&&X instanceof Promise)return X.then((w)=>{if(!w)return Y(),!1;else return!0});if(!X)return Y(),!1;else return!0})}refinement(f,v){return this._refinement((W,J)=>{if(!f(W))return J.addIssue(typeof v==="function"?v(W,J):v),!1;else return!0})}_refinement(f){return new ev({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:f}})}superRefine(f){return this._refinement(f)}constructor(f){this.spa=this.safeParseAsync,this._def=f,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:(v)=>this["~validate"](v)}}optional(){return sv.create(this,this._def)}nullable(){return Df.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ov.create(this)}promise(){return xf.create(this,this._def)}or(f){return J1.create([this,f],this._def)}and(f){return X1.create(this,f,this._def)}transform(f){return new ev({...t(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:f}})}default(f){let v=typeof f==="function"?f:()=>f;return new B1({...t(this._def),innerType:this,defaultValue:v,typeName:C.ZodDefault})}brand(){return new u1({typeName:C.ZodBranded,type:this,...t(this._def)})}catch(f){let v=typeof f==="function"?f:()=>f;return new q1({...t(this._def),innerType:this,catchValue:v,typeName:C.ZodCatch})}describe(f){return new this.constructor({...this._def,description:f})}pipe(f){return A1.create(this,f)}readonly(){return P1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var j6=/^c[^\s-]{8,}$/i,E6=/^[0-9a-z]+$/,O6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,U6=/^[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,H6=/^[a-z0-9_-]{21}$/i,F6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,A6=/^[-+]?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)?)??$/,g6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",xQ,h6=/^(?:(?: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])$/,b6=/^(?:(?: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])$/,R6=/^(([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]))$/,k6=/^(([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])$/,S6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,y6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,X8="((\\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])))",l6=new RegExp(`^${X8}$`);function Y8(f){let v="[0-5]\\d";if(f.precision)v=`${v}\\.\\d{${f.precision}}`;else if(f.precision==null)v=`${v}(\\.\\d+)?`;let W=f.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${v})${W}`}function I6(f){return new RegExp(`^${Y8(f)}$`)}function w8(f){let v=`${X8}T${Y8(f)}`,W=[];if(W.push(f.local?"Z?":"Z"),f.offset)W.push("([+-]\\d{2}:?\\d{2})");return v=`${v}(${W.join("|")})`,new RegExp(`^${v}$`)}function Z6(f,v){if((v==="v4"||!v)&&h6.test(f))return!0;if((v==="v6"||!v)&&R6.test(f))return!0;return!1}function C6(f,v){if(!F6.test(f))return!1;try{let[W]=f.split(".");if(!W)return!1;let J=W.replace(/-/g,"+").replace(/_/g,"/").padEnd(W.length+(4-W.length%4)%4,"="),Q=JSON.parse(atob(J));if(typeof Q!=="object"||Q===null)return!1;if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(v&&Q.alg!==v)return!1;return!0}catch{return!1}}function T6(f,v){if((v==="v4"||!v)&&b6.test(f))return!0;if((v==="v6"||!v)&&k6.test(f))return!0;return!1}class dv extends vv{_parse(f){if(this._def.coerce)f.data=String(f.data);if(this._getType(f)!==x.string){let Q=this._getOrReturnCtx(f);return u(Q,{code:Z.invalid_type,expected:x.string,received:Q.parsedType}),d}let W=new hv,J=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if(f.data.length<Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:Z.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),W.dirty()}else if(Q.kind==="max"){if(f.data.length>Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:Z.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),W.dirty()}else if(Q.kind==="length"){let X=f.data.length>Q.value,Y=f.data.length<Q.value;if(X||Y){if(J=this._getOrReturnCtx(f,J),X)u(J,{code:Z.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});else if(Y)u(J,{code:Z.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});W.dirty()}}else if(Q.kind==="email"){if(!g6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"email",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="emoji"){if(!xQ)xQ=new RegExp(_6,"u");if(!xQ.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"emoji",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="uuid"){if(!U6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"uuid",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="nanoid"){if(!H6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"nanoid",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="cuid"){if(!j6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"cuid",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="cuid2"){if(!E6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"cuid2",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="ulid"){if(!O6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"ulid",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="url")try{new URL(f.data)}catch{J=this._getOrReturnCtx(f,J),u(J,{validation:"url",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="regex"){if(Q.regex.lastIndex=0,!Q.regex.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"regex",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="trim")f.data=f.data.trim();else if(Q.kind==="includes"){if(!f.data.includes(Q.value,Q.position))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:{includes:Q.value,position:Q.position},message:Q.message}),W.dirty()}else if(Q.kind==="toLowerCase")f.data=f.data.toLowerCase();else if(Q.kind==="toUpperCase")f.data=f.data.toUpperCase();else if(Q.kind==="startsWith"){if(!f.data.startsWith(Q.value))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:{startsWith:Q.value},message:Q.message}),W.dirty()}else if(Q.kind==="endsWith"){if(!f.data.endsWith(Q.value))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:{endsWith:Q.value},message:Q.message}),W.dirty()}else if(Q.kind==="datetime"){if(!w8(Q).test(f.data))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:"datetime",message:Q.message}),W.dirty()}else if(Q.kind==="date"){if(!l6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:"date",message:Q.message}),W.dirty()}else if(Q.kind==="time"){if(!I6(Q).test(f.data))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:"time",message:Q.message}),W.dirty()}else if(Q.kind==="duration"){if(!A6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"duration",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="ip"){if(!Z6(f.data,Q.version))J=this._getOrReturnCtx(f,J),u(J,{validation:"ip",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="jwt"){if(!C6(f.data,Q.alg))J=this._getOrReturnCtx(f,J),u(J,{validation:"jwt",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="cidr"){if(!T6(f.data,Q.version))J=this._getOrReturnCtx(f,J),u(J,{validation:"cidr",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="base64"){if(!S6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"base64",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="base64url"){if(!y6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"base64url",code:Z.invalid_string,message:Q.message}),W.dirty()}else Qv.assertNever(Q);return{status:W.value,value:f.data}}_regex(f,v,W){return this.refinement((J)=>f.test(J),{validation:v,code:Z.invalid_string,...c.errToObj(W)})}_addCheck(f){return new dv({...this._def,checks:[...this._def.checks,f]})}email(f){return this._addCheck({kind:"email",...c.errToObj(f)})}url(f){return this._addCheck({kind:"url",...c.errToObj(f)})}emoji(f){return this._addCheck({kind:"emoji",...c.errToObj(f)})}uuid(f){return this._addCheck({kind:"uuid",...c.errToObj(f)})}nanoid(f){return this._addCheck({kind:"nanoid",...c.errToObj(f)})}cuid(f){return this._addCheck({kind:"cuid",...c.errToObj(f)})}cuid2(f){return this._addCheck({kind:"cuid2",...c.errToObj(f)})}ulid(f){return this._addCheck({kind:"ulid",...c.errToObj(f)})}base64(f){return this._addCheck({kind:"base64",...c.errToObj(f)})}base64url(f){return this._addCheck({kind:"base64url",...c.errToObj(f)})}jwt(f){return this._addCheck({kind:"jwt",...c.errToObj(f)})}ip(f){return this._addCheck({kind:"ip",...c.errToObj(f)})}cidr(f){return this._addCheck({kind:"cidr",...c.errToObj(f)})}datetime(f){if(typeof f==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:f});return this._addCheck({kind:"datetime",precision:typeof f?.precision==="undefined"?null:f?.precision,offset:f?.offset??!1,local:f?.local??!1,...c.errToObj(f?.message)})}date(f){return this._addCheck({kind:"date",message:f})}time(f){if(typeof f==="string")return this._addCheck({kind:"time",precision:null,message:f});return this._addCheck({kind:"time",precision:typeof f?.precision==="undefined"?null:f?.precision,...c.errToObj(f?.message)})}duration(f){return this._addCheck({kind:"duration",...c.errToObj(f)})}regex(f,v){return this._addCheck({kind:"regex",regex:f,...c.errToObj(v)})}includes(f,v){return this._addCheck({kind:"includes",value:f,position:v?.position,...c.errToObj(v?.message)})}startsWith(f,v){return this._addCheck({kind:"startsWith",value:f,...c.errToObj(v)})}endsWith(f,v){return this._addCheck({kind:"endsWith",value:f,...c.errToObj(v)})}min(f,v){return this._addCheck({kind:"min",value:f,...c.errToObj(v)})}max(f,v){return this._addCheck({kind:"max",value:f,...c.errToObj(v)})}length(f,v){return this._addCheck({kind:"length",value:f,...c.errToObj(v)})}nonempty(f){return this.min(1,c.errToObj(f))}trim(){return new dv({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new dv({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new dv({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((f)=>f.kind==="datetime")}get isDate(){return!!this._def.checks.find((f)=>f.kind==="date")}get isTime(){return!!this._def.checks.find((f)=>f.kind==="time")}get isDuration(){return!!this._def.checks.find((f)=>f.kind==="duration")}get isEmail(){return!!this._def.checks.find((f)=>f.kind==="email")}get isURL(){return!!this._def.checks.find((f)=>f.kind==="url")}get isEmoji(){return!!this._def.checks.find((f)=>f.kind==="emoji")}get isUUID(){return!!this._def.checks.find((f)=>f.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((f)=>f.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((f)=>f.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((f)=>f.kind==="cuid2")}get isULID(){return!!this._def.checks.find((f)=>f.kind==="ulid")}get isIP(){return!!this._def.checks.find((f)=>f.kind==="ip")}get isCIDR(){return!!this._def.checks.find((f)=>f.kind==="cidr")}get isBase64(){return!!this._def.checks.find((f)=>f.kind==="base64")}get isBase64url(){return!!this._def.checks.find((f)=>f.kind==="base64url")}get minLength(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxLength(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}}dv.create=(f)=>{return new dv({checks:[],typeName:C.ZodString,coerce:f?.coerce??!1,...t(f)})};function x6(f,v){let W=(f.toString().split(".")[1]||"").length,J=(v.toString().split(".")[1]||"").length,Q=W>J?W:J,X=Number.parseInt(f.toFixed(Q).replace(".","")),Y=Number.parseInt(v.toFixed(Q).replace(".",""));return X%Y/10**Q}class Hf extends vv{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(f){if(this._def.coerce)f.data=Number(f.data);if(this._getType(f)!==x.number){let Q=this._getOrReturnCtx(f);return u(Q,{code:Z.invalid_type,expected:x.number,received:Q.parsedType}),d}let W=void 0,J=new hv;for(let Q of this._def.checks)if(Q.kind==="int"){if(!Qv.isInteger(f.data))W=this._getOrReturnCtx(f,W),u(W,{code:Z.invalid_type,expected:"integer",received:"float",message:Q.message}),J.dirty()}else if(Q.kind==="min"){if(Q.inclusive?f.data<Q.value:f.data<=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:Z.too_small,minimum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),J.dirty()}else if(Q.kind==="max"){if(Q.inclusive?f.data>Q.value:f.data>=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:Z.too_big,maximum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),J.dirty()}else if(Q.kind==="multipleOf"){if(x6(f.data,Q.value)!==0)W=this._getOrReturnCtx(f,W),u(W,{code:Z.not_multiple_of,multipleOf:Q.value,message:Q.message}),J.dirty()}else if(Q.kind==="finite"){if(!Number.isFinite(f.data))W=this._getOrReturnCtx(f,W),u(W,{code:Z.not_finite,message:Q.message}),J.dirty()}else Qv.assertNever(Q);return{status:J.value,value:f.data}}gte(f,v){return this.setLimit("min",f,!0,c.toString(v))}gt(f,v){return this.setLimit("min",f,!1,c.toString(v))}lte(f,v){return this.setLimit("max",f,!0,c.toString(v))}lt(f,v){return this.setLimit("max",f,!1,c.toString(v))}setLimit(f,v,W,J){return new Hf({...this._def,checks:[...this._def.checks,{kind:f,value:v,inclusive:W,message:c.toString(J)}]})}_addCheck(f){return new Hf({...this._def,checks:[...this._def.checks,f]})}int(f){return this._addCheck({kind:"int",message:c.toString(f)})}positive(f){return this._addCheck({kind:"min",value:0,inclusive:!1,message:c.toString(f)})}negative(f){return this._addCheck({kind:"max",value:0,inclusive:!1,message:c.toString(f)})}nonpositive(f){return this._addCheck({kind:"max",value:0,inclusive:!0,message:c.toString(f)})}nonnegative(f){return this._addCheck({kind:"min",value:0,inclusive:!0,message:c.toString(f)})}multipleOf(f,v){return this._addCheck({kind:"multipleOf",value:f,message:c.toString(v)})}finite(f){return this._addCheck({kind:"finite",message:c.toString(f)})}safe(f){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:c.toString(f)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:c.toString(f)})}get minValue(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxValue(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}get isInt(){return!!this._def.checks.find((f)=>f.kind==="int"||f.kind==="multipleOf"&&Qv.isInteger(f.value))}get isFinite(){let f=null,v=null;for(let W of this._def.checks)if(W.kind==="finite"||W.kind==="int"||W.kind==="multipleOf")return!0;else if(W.kind==="min"){if(v===null||W.value>v)v=W.value}else if(W.kind==="max"){if(f===null||W.value<f)f=W.value}return Number.isFinite(v)&&Number.isFinite(f)}}Hf.create=(f)=>{return new Hf({checks:[],typeName:C.ZodNumber,coerce:f?.coerce||!1,...t(f)})};class Ff extends vv{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(f){if(this._def.coerce)try{f.data=BigInt(f.data)}catch{return this._getInvalidInput(f)}if(this._getType(f)!==x.bigint)return this._getInvalidInput(f);let W=void 0,J=new hv;for(let Q of this._def.checks)if(Q.kind==="min"){if(Q.inclusive?f.data<Q.value:f.data<=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:Z.too_small,type:"bigint",minimum:Q.value,inclusive:Q.inclusive,message:Q.message}),J.dirty()}else if(Q.kind==="max"){if(Q.inclusive?f.data>Q.value:f.data>=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:Z.too_big,type:"bigint",maximum:Q.value,inclusive:Q.inclusive,message:Q.message}),J.dirty()}else if(Q.kind==="multipleOf"){if(f.data%Q.value!==BigInt(0))W=this._getOrReturnCtx(f,W),u(W,{code:Z.not_multiple_of,multipleOf:Q.value,message:Q.message}),J.dirty()}else Qv.assertNever(Q);return{status:J.value,value:f.data}}_getInvalidInput(f){let v=this._getOrReturnCtx(f);return u(v,{code:Z.invalid_type,expected:x.bigint,received:v.parsedType}),d}gte(f,v){return this.setLimit("min",f,!0,c.toString(v))}gt(f,v){return this.setLimit("min",f,!1,c.toString(v))}lte(f,v){return this.setLimit("max",f,!0,c.toString(v))}lt(f,v){return this.setLimit("max",f,!1,c.toString(v))}setLimit(f,v,W,J){return new Ff({...this._def,checks:[...this._def.checks,{kind:f,value:v,inclusive:W,message:c.toString(J)}]})}_addCheck(f){return new Ff({...this._def,checks:[...this._def.checks,f]})}positive(f){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:c.toString(f)})}negative(f){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:c.toString(f)})}nonpositive(f){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:c.toString(f)})}nonnegative(f){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:c.toString(f)})}multipleOf(f,v){return this._addCheck({kind:"multipleOf",value:f,message:c.toString(v)})}get minValue(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxValue(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}}Ff.create=(f)=>{return new Ff({checks:[],typeName:C.ZodBigInt,coerce:f?.coerce??!1,...t(f)})};class f1 extends vv{_parse(f){if(this._def.coerce)f.data=Boolean(f.data);if(this._getType(f)!==x.boolean){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.boolean,received:W.parsedType}),d}return kv(f.data)}}f1.create=(f)=>{return new f1({typeName:C.ZodBoolean,coerce:f?.coerce||!1,...t(f)})};class Zf extends vv{_parse(f){if(this._def.coerce)f.data=new Date(f.data);if(this._getType(f)!==x.date){let Q=this._getOrReturnCtx(f);return u(Q,{code:Z.invalid_type,expected:x.date,received:Q.parsedType}),d}if(Number.isNaN(f.data.getTime())){let Q=this._getOrReturnCtx(f);return u(Q,{code:Z.invalid_date}),d}let W=new hv,J=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if(f.data.getTime()<Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:Z.too_small,message:Q.message,inclusive:!0,exact:!1,minimum:Q.value,type:"date"}),W.dirty()}else if(Q.kind==="max"){if(f.data.getTime()>Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:Z.too_big,message:Q.message,inclusive:!0,exact:!1,maximum:Q.value,type:"date"}),W.dirty()}else Qv.assertNever(Q);return{status:W.value,value:new Date(f.data.getTime())}}_addCheck(f){return new Zf({...this._def,checks:[...this._def.checks,f]})}min(f,v){return this._addCheck({kind:"min",value:f.getTime(),message:c.toString(v)})}max(f,v){return this._addCheck({kind:"max",value:f.getTime(),message:c.toString(v)})}get minDate(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f!=null?new Date(f):null}get maxDate(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f!=null?new Date(f):null}}Zf.create=(f)=>{return new Zf({checks:[],coerce:f?.coerce||!1,typeName:C.ZodDate,...t(f)})};class E1 extends vv{_parse(f){if(this._getType(f)!==x.symbol){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.symbol,received:W.parsedType}),d}return kv(f.data)}}E1.create=(f)=>{return new E1({typeName:C.ZodSymbol,...t(f)})};class Q1 extends vv{_parse(f){if(this._getType(f)!==x.undefined){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.undefined,received:W.parsedType}),d}return kv(f.data)}}Q1.create=(f)=>{return new Q1({typeName:C.ZodUndefined,...t(f)})};class W1 extends vv{_parse(f){if(this._getType(f)!==x.null){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.null,received:W.parsedType}),d}return kv(f.data)}}W1.create=(f)=>{return new W1({typeName:C.ZodNull,...t(f)})};class Cf extends vv{constructor(){super(...arguments);this._any=!0}_parse(f){return kv(f.data)}}Cf.create=(f)=>{return new Cf({typeName:C.ZodAny,...t(f)})};class Uf extends vv{constructor(){super(...arguments);this._unknown=!0}_parse(f){return kv(f.data)}}Uf.create=(f)=>{return new Uf({typeName:C.ZodUnknown,...t(f)})};class Gf extends vv{_parse(f){let v=this._getOrReturnCtx(f);return u(v,{code:Z.invalid_type,expected:x.never,received:v.parsedType}),d}}Gf.create=(f)=>{return new Gf({typeName:C.ZodNever,...t(f)})};class O1 extends vv{_parse(f){if(this._getType(f)!==x.undefined){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.void,received:W.parsedType}),d}return kv(f.data)}}O1.create=(f)=>{return new O1({typeName:C.ZodVoid,...t(f)})};class ov extends vv{_parse(f){let{ctx:v,status:W}=this._processInputParams(f),J=this._def;if(v.parsedType!==x.array)return u(v,{code:Z.invalid_type,expected:x.array,received:v.parsedType}),d;if(J.exactLength!==null){let X=v.data.length>J.exactLength.value,Y=v.data.length<J.exactLength.value;if(X||Y)u(v,{code:X?Z.too_big:Z.too_small,minimum:Y?J.exactLength.value:void 0,maximum:X?J.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:J.exactLength.message}),W.dirty()}if(J.minLength!==null){if(v.data.length<J.minLength.value)u(v,{code:Z.too_small,minimum:J.minLength.value,type:"array",inclusive:!0,exact:!1,message:J.minLength.message}),W.dirty()}if(J.maxLength!==null){if(v.data.length>J.maxLength.value)u(v,{code:Z.too_big,maximum:J.maxLength.value,type:"array",inclusive:!0,exact:!1,message:J.maxLength.message}),W.dirty()}if(v.common.async)return Promise.all([...v.data].map((X,Y)=>{return J.type._parseAsync(new tv(v,X,v.path,Y))})).then((X)=>{return hv.mergeArray(W,X)});let Q=[...v.data].map((X,Y)=>{return J.type._parseSync(new tv(v,X,v.path,Y))});return hv.mergeArray(W,Q)}get element(){return this._def.type}min(f,v){return new ov({...this._def,minLength:{value:f,message:c.toString(v)}})}max(f,v){return new ov({...this._def,maxLength:{value:f,message:c.toString(v)}})}length(f,v){return new ov({...this._def,exactLength:{value:f,message:c.toString(v)}})}nonempty(f){return this.min(1,f)}}ov.create=(f,v)=>{return new ov({type:f,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...t(v)})};function ef(f){if(f instanceof Vv){let v={};for(let W in f.shape){let J=f.shape[W];v[W]=sv.create(ef(J))}return new Vv({...f._def,shape:()=>v})}else if(f instanceof ov)return new ov({...f._def,type:ef(f.element)});else if(f instanceof sv)return sv.create(ef(f.unwrap()));else if(f instanceof Df)return Df.create(ef(f.unwrap()));else if(f instanceof Bf)return Bf.create(f.items.map((v)=>ef(v)));else return f}class Vv extends vv{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let f=this._def.shape(),v=Qv.objectKeys(f);return this._cached={shape:f,keys:v},this._cached}_parse(f){if(this._getType(f)!==x.object){let B=this._getOrReturnCtx(f);return u(B,{code:Z.invalid_type,expected:x.object,received:B.parsedType}),d}let{status:W,ctx:J}=this._processInputParams(f),{shape:Q,keys:X}=this._getCached(),Y=[];if(!(this._def.catchall instanceof Gf&&this._def.unknownKeys==="strip")){for(let B in J.data)if(!X.includes(B))Y.push(B)}let w=[];for(let B of X){let z=Q[B],K=J.data[B];w.push({key:{status:"valid",value:B},value:z._parse(new tv(J,K,J.path,B)),alwaysSet:B in J.data})}if(this._def.catchall instanceof Gf){let B=this._def.unknownKeys;if(B==="passthrough")for(let z of Y)w.push({key:{status:"valid",value:z},value:{status:"valid",value:J.data[z]}});else if(B==="strict"){if(Y.length>0)u(J,{code:Z.unrecognized_keys,keys:Y}),W.dirty()}else if(B==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let B=this._def.catchall;for(let z of Y){let K=J.data[z];w.push({key:{status:"valid",value:z},value:B._parse(new tv(J,K,J.path,z)),alwaysSet:z in J.data})}}if(J.common.async)return Promise.resolve().then(async()=>{let B=[];for(let z of w){let K=await z.key,L=await z.value;B.push({key:K,value:L,alwaysSet:z.alwaysSet})}return B}).then((B)=>{return hv.mergeObjectSync(W,B)});else return hv.mergeObjectSync(W,w)}get shape(){return this._def.shape()}strict(f){return c.errToObj,new Vv({...this._def,unknownKeys:"strict",...f!==void 0?{errorMap:(v,W)=>{let J=this._def.errorMap?.(v,W).message??W.defaultError;if(v.code==="unrecognized_keys")return{message:c.errToObj(f).message??J};return{message:J}}}:{}})}strip(){return new Vv({...this._def,unknownKeys:"strip"})}passthrough(){return new Vv({...this._def,unknownKeys:"passthrough"})}extend(f){return new Vv({...this._def,shape:()=>({...this._def.shape(),...f})})}merge(f){return new Vv({unknownKeys:f._def.unknownKeys,catchall:f._def.catchall,shape:()=>({...this._def.shape(),...f._def.shape()}),typeName:C.ZodObject})}setKey(f,v){return this.augment({[f]:v})}catchall(f){return new Vv({...this._def,catchall:f})}pick(f){let v={};for(let W of Qv.objectKeys(f))if(f[W]&&this.shape[W])v[W]=this.shape[W];return new Vv({...this._def,shape:()=>v})}omit(f){let v={};for(let W of Qv.objectKeys(this.shape))if(!f[W])v[W]=this.shape[W];return new Vv({...this._def,shape:()=>v})}deepPartial(){return ef(this)}partial(f){let v={};for(let W of Qv.objectKeys(this.shape)){let J=this.shape[W];if(f&&!f[W])v[W]=J;else v[W]=J.optional()}return new Vv({...this._def,shape:()=>v})}required(f){let v={};for(let W of Qv.objectKeys(this.shape))if(f&&!f[W])v[W]=this.shape[W];else{let Q=this.shape[W];while(Q instanceof sv)Q=Q._def.innerType;v[W]=Q}return new Vv({...this._def,shape:()=>v})}keyof(){return G8(Qv.objectKeys(this.shape))}}Vv.create=(f,v)=>{return new Vv({shape:()=>f,unknownKeys:"strip",catchall:Gf.create(),typeName:C.ZodObject,...t(v)})};Vv.strictCreate=(f,v)=>{return new Vv({shape:()=>f,unknownKeys:"strict",catchall:Gf.create(),typeName:C.ZodObject,...t(v)})};Vv.lazycreate=(f,v)=>{return new Vv({shape:f,unknownKeys:"strip",catchall:Gf.create(),typeName:C.ZodObject,...t(v)})};class J1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=this._def.options;function J(Q){for(let Y of Q)if(Y.result.status==="valid")return Y.result;for(let Y of Q)if(Y.result.status==="dirty")return v.common.issues.push(...Y.ctx.common.issues),Y.result;let X=Q.map((Y)=>new Cv(Y.ctx.common.issues));return u(v,{code:Z.invalid_union,unionErrors:X}),d}if(v.common.async)return Promise.all(W.map(async(Q)=>{let X={...v,common:{...v.common,issues:[]},parent:null};return{result:await Q._parseAsync({data:v.data,path:v.path,parent:X}),ctx:X}})).then(J);else{let Q=void 0,X=[];for(let w of W){let B={...v,common:{...v.common,issues:[]},parent:null},z=w._parseSync({data:v.data,path:v.path,parent:B});if(z.status==="valid")return z;else if(z.status==="dirty"&&!Q)Q={result:z,ctx:B};if(B.common.issues.length)X.push(B.common.issues)}if(Q)return v.common.issues.push(...Q.ctx.common.issues),Q.result;let Y=X.map((w)=>new Cv(w));return u(v,{code:Z.invalid_union,unionErrors:Y}),d}}get options(){return this._def.options}}J1.create=(f,v)=>{return new J1({options:f,typeName:C.ZodUnion,...t(v)})};var Nf=(f)=>{if(f instanceof Y1)return Nf(f.schema);else if(f instanceof ev)return Nf(f.innerType());else if(f instanceof w1)return[f.value];else if(f instanceof Af)return f.options;else if(f instanceof G1)return Qv.objectValues(f.enum);else if(f instanceof B1)return Nf(f._def.innerType);else if(f instanceof Q1)return[void 0];else if(f instanceof W1)return[null];else if(f instanceof sv)return[void 0,...Nf(f.unwrap())];else if(f instanceof Df)return[null,...Nf(f.unwrap())];else if(f instanceof u1)return Nf(f.unwrap());else if(f instanceof P1)return Nf(f.unwrap());else if(f instanceof q1)return Nf(f._def.innerType);else return[]};class x1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==x.object)return u(v,{code:Z.invalid_type,expected:x.object,received:v.parsedType}),d;let W=this.discriminator,J=v.data[W],Q=this.optionsMap.get(J);if(!Q)return u(v,{code:Z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[W]}),d;if(v.common.async)return Q._parseAsync({data:v.data,path:v.path,parent:v});else return Q._parseSync({data:v.data,path:v.path,parent:v})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(f,v,W){let J=new Map;for(let Q of v){let X=Nf(Q.shape[f]);if(!X.length)throw new Error(`A discriminator value for key \`${f}\` could not be extracted from all schema options`);for(let Y of X){if(J.has(Y))throw new Error(`Discriminator property ${String(f)} has duplicate value ${String(Y)}`);J.set(Y,Q)}}return new x1({typeName:C.ZodDiscriminatedUnion,discriminator:f,options:v,optionsMap:J,...t(W)})}}function uQ(f,v){let W=wf(f),J=wf(v);if(f===v)return{valid:!0,data:f};else if(W===x.object&&J===x.object){let Q=Qv.objectKeys(v),X=Qv.objectKeys(f).filter((w)=>Q.indexOf(w)!==-1),Y={...f,...v};for(let w of X){let B=uQ(f[w],v[w]);if(!B.valid)return{valid:!1};Y[w]=B.data}return{valid:!0,data:Y}}else if(W===x.array&&J===x.array){if(f.length!==v.length)return{valid:!1};let Q=[];for(let X=0;X<f.length;X++){let Y=f[X],w=v[X],B=uQ(Y,w);if(!B.valid)return{valid:!1};Q.push(B.data)}return{valid:!0,data:Q}}else if(W===x.date&&J===x.date&&+f===+v)return{valid:!0,data:f};else return{valid:!1}}class X1 extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f),J=(Q,X)=>{if(C1(Q)||C1(X))return d;let Y=uQ(Q.value,X.value);if(!Y.valid)return u(W,{code:Z.invalid_intersection_types}),d;if(T1(Q)||T1(X))v.dirty();return{status:v.value,value:Y.data}};if(W.common.async)return Promise.all([this._def.left._parseAsync({data:W.data,path:W.path,parent:W}),this._def.right._parseAsync({data:W.data,path:W.path,parent:W})]).then(([Q,X])=>J(Q,X));else return J(this._def.left._parseSync({data:W.data,path:W.path,parent:W}),this._def.right._parseSync({data:W.data,path:W.path,parent:W}))}}X1.create=(f,v,W)=>{return new X1({left:f,right:v,typeName:C.ZodIntersection,...t(W)})};class Bf extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.array)return u(W,{code:Z.invalid_type,expected:x.array,received:W.parsedType}),d;if(W.data.length<this._def.items.length)return u(W,{code:Z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),d;if(!this._def.rest&&W.data.length>this._def.items.length)u(W,{code:Z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v.dirty();let Q=[...W.data].map((X,Y)=>{let w=this._def.items[Y]||this._def.rest;if(!w)return null;return w._parse(new tv(W,X,W.path,Y))}).filter((X)=>!!X);if(W.common.async)return Promise.all(Q).then((X)=>{return hv.mergeArray(v,X)});else return hv.mergeArray(v,Q)}get items(){return this._def.items}rest(f){return new Bf({...this._def,rest:f})}}Bf.create=(f,v)=>{if(!Array.isArray(f))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Bf({items:f,typeName:C.ZodTuple,rest:null,...t(v)})};class U1 extends vv{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.object)return u(W,{code:Z.invalid_type,expected:x.object,received:W.parsedType}),d;let J=[],Q=this._def.keyType,X=this._def.valueType;for(let Y in W.data)J.push({key:Q._parse(new tv(W,Y,W.path,Y)),value:X._parse(new tv(W,W.data[Y],W.path,Y)),alwaysSet:Y in W.data});if(W.common.async)return hv.mergeObjectAsync(v,J);else return hv.mergeObjectSync(v,J)}get element(){return this._def.valueType}static create(f,v,W){if(v instanceof vv)return new U1({keyType:f,valueType:v,typeName:C.ZodRecord,...t(W)});return new U1({keyType:dv.create(),valueType:f,typeName:C.ZodRecord,...t(v)})}}class H1 extends vv{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.map)return u(W,{code:Z.invalid_type,expected:x.map,received:W.parsedType}),d;let J=this._def.keyType,Q=this._def.valueType,X=[...W.data.entries()].map(([Y,w],B)=>{return{key:J._parse(new tv(W,Y,W.path,[B,"key"])),value:Q._parse(new tv(W,w,W.path,[B,"value"]))}});if(W.common.async){let Y=new Map;return Promise.resolve().then(async()=>{for(let w of X){let B=await w.key,z=await w.value;if(B.status==="aborted"||z.status==="aborted")return d;if(B.status==="dirty"||z.status==="dirty")v.dirty();Y.set(B.value,z.value)}return{status:v.value,value:Y}})}else{let Y=new Map;for(let w of X){let{key:B,value:z}=w;if(B.status==="aborted"||z.status==="aborted")return d;if(B.status==="dirty"||z.status==="dirty")v.dirty();Y.set(B.value,z.value)}return{status:v.value,value:Y}}}}H1.create=(f,v,W)=>{return new H1({valueType:v,keyType:f,typeName:C.ZodMap,...t(W)})};class Tf extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.set)return u(W,{code:Z.invalid_type,expected:x.set,received:W.parsedType}),d;let J=this._def;if(J.minSize!==null){if(W.data.size<J.minSize.value)u(W,{code:Z.too_small,minimum:J.minSize.value,type:"set",inclusive:!0,exact:!1,message:J.minSize.message}),v.dirty()}if(J.maxSize!==null){if(W.data.size>J.maxSize.value)u(W,{code:Z.too_big,maximum:J.maxSize.value,type:"set",inclusive:!0,exact:!1,message:J.maxSize.message}),v.dirty()}let Q=this._def.valueType;function X(w){let B=new Set;for(let z of w){if(z.status==="aborted")return d;if(z.status==="dirty")v.dirty();B.add(z.value)}return{status:v.value,value:B}}let Y=[...W.data.values()].map((w,B)=>Q._parse(new tv(W,w,W.path,B)));if(W.common.async)return Promise.all(Y).then((w)=>X(w));else return X(Y)}min(f,v){return new Tf({...this._def,minSize:{value:f,message:c.toString(v)}})}max(f,v){return new Tf({...this._def,maxSize:{value:f,message:c.toString(v)}})}size(f,v){return this.min(f,v).max(f,v)}nonempty(f){return this.min(1,f)}}Tf.create=(f,v)=>{return new Tf({valueType:f,minSize:null,maxSize:null,typeName:C.ZodSet,...t(v)})};class v1 extends vv{constructor(){super(...arguments);this.validate=this.implement}_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==x.function)return u(v,{code:Z.invalid_type,expected:x.function,received:v.parsedType}),d;function W(Y,w){return j1({data:Y,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,sf(),Mf].filter((B)=>!!B),issueData:{code:Z.invalid_arguments,argumentsError:w}})}function J(Y,w){return j1({data:Y,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,sf(),Mf].filter((B)=>!!B),issueData:{code:Z.invalid_return_type,returnTypeError:w}})}let Q={errorMap:v.common.contextualErrorMap},X=v.data;if(this._def.returns instanceof xf){let Y=this;return kv(async function(...w){let B=new Cv([]),z=await Y._def.args.parseAsync(w,Q).catch((D)=>{throw B.addIssue(W(w,D)),B}),K=await Reflect.apply(X,this,z);return await Y._def.returns._def.type.parseAsync(K,Q).catch((D)=>{throw B.addIssue(J(K,D)),B})})}else{let Y=this;return kv(function(...w){let B=Y._def.args.safeParse(w,Q);if(!B.success)throw new Cv([W(w,B.error)]);let z=Reflect.apply(X,this,B.data),K=Y._def.returns.safeParse(z,Q);if(!K.success)throw new Cv([J(z,K.error)]);return K.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...f){return new v1({...this._def,args:Bf.create(f).rest(Uf.create())})}returns(f){return new v1({...this._def,returns:f})}implement(f){return this.parse(f)}strictImplement(f){return this.parse(f)}static create(f,v,W){return new v1({args:f?f:Bf.create([]).rest(Uf.create()),returns:v||Uf.create(),typeName:C.ZodFunction,...t(W)})}}class Y1 extends vv{get schema(){return this._def.getter()}_parse(f){let{ctx:v}=this._processInputParams(f);return this._def.getter()._parse({data:v.data,path:v.path,parent:v})}}Y1.create=(f,v)=>{return new Y1({getter:f,typeName:C.ZodLazy,...t(v)})};class w1 extends vv{_parse(f){if(f.data!==this._def.value){let v=this._getOrReturnCtx(f);return u(v,{received:v.data,code:Z.invalid_literal,expected:this._def.value}),d}return{status:"valid",value:f.data}}get value(){return this._def.value}}w1.create=(f,v)=>{return new w1({value:f,typeName:C.ZodLiteral,...t(v)})};function G8(f,v){return new Af({values:f,typeName:C.ZodEnum,...t(v)})}class Af extends vv{_parse(f){if(typeof f.data!=="string"){let v=this._getOrReturnCtx(f),W=this._def.values;return u(v,{expected:Qv.joinValues(W),received:v.parsedType,code:Z.invalid_type}),d}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(f.data)){let v=this._getOrReturnCtx(f),W=this._def.values;return u(v,{received:v.data,code:Z.invalid_enum_value,options:W}),d}return kv(f.data)}get options(){return this._def.values}get enum(){let f={};for(let v of this._def.values)f[v]=v;return f}get Values(){let f={};for(let v of this._def.values)f[v]=v;return f}get Enum(){let f={};for(let v of this._def.values)f[v]=v;return f}extract(f,v=this._def){return Af.create(f,{...this._def,...v})}exclude(f,v=this._def){return Af.create(this.options.filter((W)=>!f.includes(W)),{...this._def,...v})}}Af.create=G8;class G1 extends vv{_parse(f){let v=Qv.getValidEnumValues(this._def.values),W=this._getOrReturnCtx(f);if(W.parsedType!==x.string&&W.parsedType!==x.number){let J=Qv.objectValues(v);return u(W,{expected:Qv.joinValues(J),received:W.parsedType,code:Z.invalid_type}),d}if(!this._cache)this._cache=new Set(Qv.getValidEnumValues(this._def.values));if(!this._cache.has(f.data)){let J=Qv.objectValues(v);return u(W,{received:W.data,code:Z.invalid_enum_value,options:J}),d}return kv(f.data)}get enum(){return this._def.values}}G1.create=(f,v)=>{return new G1({values:f,typeName:C.ZodNativeEnum,...t(v)})};class xf extends vv{unwrap(){return this._def.type}_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==x.promise&&v.common.async===!1)return u(v,{code:Z.invalid_type,expected:x.promise,received:v.parsedType}),d;let W=v.parsedType===x.promise?v.data:Promise.resolve(v.data);return kv(W.then((J)=>{return this._def.type.parseAsync(J,{path:v.path,errorMap:v.common.contextualErrorMap})}))}}xf.create=(f,v)=>{return new xf({type:f,typeName:C.ZodPromise,...t(v)})};class ev extends vv{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(f){let{status:v,ctx:W}=this._processInputParams(f),J=this._def.effect||null,Q={addIssue:(X)=>{if(u(W,X),X.fatal)v.abort();else v.dirty()},get path(){return W.path}};if(Q.addIssue=Q.addIssue.bind(Q),J.type==="preprocess"){let X=J.transform(W.data,Q);if(W.common.async)return Promise.resolve(X).then(async(Y)=>{if(v.value==="aborted")return d;let w=await this._def.schema._parseAsync({data:Y,path:W.path,parent:W});if(w.status==="aborted")return d;if(w.status==="dirty")return If(w.value);if(v.value==="dirty")return If(w.value);return w});else{if(v.value==="aborted")return d;let Y=this._def.schema._parseSync({data:X,path:W.path,parent:W});if(Y.status==="aborted")return d;if(Y.status==="dirty")return If(Y.value);if(v.value==="dirty")return If(Y.value);return Y}}if(J.type==="refinement"){let X=(Y)=>{let w=J.refinement(Y,Q);if(W.common.async)return Promise.resolve(w);if(w instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Y};if(W.common.async===!1){let Y=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(Y.status==="aborted")return d;if(Y.status==="dirty")v.dirty();return X(Y.value),{status:v.value,value:Y.value}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((Y)=>{if(Y.status==="aborted")return d;if(Y.status==="dirty")v.dirty();return X(Y.value).then(()=>{return{status:v.value,value:Y.value}})})}if(J.type==="transform")if(W.common.async===!1){let X=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(!Of(X))return d;let Y=J.transform(X.value,Q);if(Y instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:v.value,value:Y}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((X)=>{if(!Of(X))return d;return Promise.resolve(J.transform(X.value,Q)).then((Y)=>({status:v.value,value:Y}))});Qv.assertNever(J)}}ev.create=(f,v,W)=>{return new ev({schema:f,typeName:C.ZodEffects,effect:v,...t(W)})};ev.createWithPreprocess=(f,v,W)=>{return new ev({schema:v,effect:{type:"preprocess",transform:f},typeName:C.ZodEffects,...t(W)})};class sv extends vv{_parse(f){if(this._getType(f)===x.undefined)return kv(void 0);return this._def.innerType._parse(f)}unwrap(){return this._def.innerType}}sv.create=(f,v)=>{return new sv({innerType:f,typeName:C.ZodOptional,...t(v)})};class Df extends vv{_parse(f){if(this._getType(f)===x.null)return kv(null);return this._def.innerType._parse(f)}unwrap(){return this._def.innerType}}Df.create=(f,v)=>{return new Df({innerType:f,typeName:C.ZodNullable,...t(v)})};class B1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;if(v.parsedType===x.undefined)W=this._def.defaultValue();return this._def.innerType._parse({data:W,path:v.path,parent:v})}removeDefault(){return this._def.innerType}}B1.create=(f,v)=>{return new B1({innerType:f,typeName:C.ZodDefault,defaultValue:typeof v.default==="function"?v.default:()=>v.default,...t(v)})};class q1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W={...v,common:{...v.common,issues:[]}},J=this._def.innerType._parse({data:W.data,path:W.path,parent:{...W}});if(tf(J))return J.then((Q)=>{return{status:"valid",value:Q.status==="valid"?Q.value:this._def.catchValue({get error(){return new Cv(W.common.issues)},input:W.data})}});else return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new Cv(W.common.issues)},input:W.data})}}removeCatch(){return this._def.innerType}}q1.create=(f,v)=>{return new q1({innerType:f,typeName:C.ZodCatch,catchValue:typeof v.catch==="function"?v.catch:()=>v.catch,...t(v)})};class F1 extends vv{_parse(f){if(this._getType(f)!==x.nan){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.nan,received:W.parsedType}),d}return{status:"valid",value:f.data}}}F1.create=(f)=>{return new F1({typeName:C.ZodNaN,...t(f)})};var u6=Symbol("zod_brand");class u1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;return this._def.type._parse({data:W,path:v.path,parent:v})}unwrap(){return this._def.type}}class A1 extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.common.async)return(async()=>{let Q=await this._def.in._parseAsync({data:W.data,path:W.path,parent:W});if(Q.status==="aborted")return d;if(Q.status==="dirty")return v.dirty(),If(Q.value);else return this._def.out._parseAsync({data:Q.value,path:W.path,parent:W})})();else{let J=this._def.in._parseSync({data:W.data,path:W.path,parent:W});if(J.status==="aborted")return d;if(J.status==="dirty")return v.dirty(),{status:"dirty",value:J.value};else return this._def.out._parseSync({data:J.value,path:W.path,parent:W})}}static create(f,v){return new A1({in:f,out:v,typeName:C.ZodPipeline})}}class P1 extends vv{_parse(f){let v=this._def.innerType._parse(f),W=(J)=>{if(Of(J))J.value=Object.freeze(J.value);return J};return tf(v)?v.then((J)=>W(J)):W(v)}unwrap(){return this._def.innerType}}P1.create=(f,v)=>{return new P1({innerType:f,typeName:C.ZodReadonly,...t(v)})};function J8(f,v){let W=typeof f==="function"?f(v):typeof f==="string"?{message:f}:f;return typeof W==="string"?{message:W}:W}function B8(f,v={},W){if(f)return Cf.create().superRefine((J,Q)=>{let X=f(J);if(X instanceof Promise)return X.then((Y)=>{if(!Y){let w=J8(v,J),B=w.fatal??W??!0;Q.addIssue({code:"custom",...w,fatal:B})}});if(!X){let Y=J8(v,J),w=Y.fatal??W??!0;Q.addIssue({code:"custom",...Y,fatal:w})}return});return Cf.create()}var r6={object:Vv.lazycreate},C;(function(f){f.ZodString="ZodString",f.ZodNumber="ZodNumber",f.ZodNaN="ZodNaN",f.ZodBigInt="ZodBigInt",f.ZodBoolean="ZodBoolean",f.ZodDate="ZodDate",f.ZodSymbol="ZodSymbol",f.ZodUndefined="ZodUndefined",f.ZodNull="ZodNull",f.ZodAny="ZodAny",f.ZodUnknown="ZodUnknown",f.ZodNever="ZodNever",f.ZodVoid="ZodVoid",f.ZodArray="ZodArray",f.ZodObject="ZodObject",f.ZodUnion="ZodUnion",f.ZodDiscriminatedUnion="ZodDiscriminatedUnion",f.ZodIntersection="ZodIntersection",f.ZodTuple="ZodTuple",f.ZodRecord="ZodRecord",f.ZodMap="ZodMap",f.ZodSet="ZodSet",f.ZodFunction="ZodFunction",f.ZodLazy="ZodLazy",f.ZodLiteral="ZodLiteral",f.ZodEnum="ZodEnum",f.ZodEffects="ZodEffects",f.ZodNativeEnum="ZodNativeEnum",f.ZodOptional="ZodOptional",f.ZodNullable="ZodNullable",f.ZodDefault="ZodDefault",f.ZodCatch="ZodCatch",f.ZodPromise="ZodPromise",f.ZodBranded="ZodBranded",f.ZodPipeline="ZodPipeline",f.ZodReadonly="ZodReadonly"})(C||(C={}));var m6=(f,v={message:`Input not instance of ${f.name}`})=>B8((W)=>W instanceof f,v),q8=dv.create,P8=Hf.create,a6=F1.create,c6=Ff.create,K8=f1.create,n6=Zf.create,p6=E1.create,i6=Q1.create,d6=W1.create,o6=Cf.create,s6=Uf.create,t6=Gf.create,e6=O1.create,v5=ov.create,f5=Vv.create,Q5=Vv.strictCreate,W5=J1.create,J5=x1.create,X5=X1.create,Y5=Bf.create,w5=U1.create,G5=H1.create,B5=Tf.create,q5=v1.create,P5=Y1.create,K5=w1.create,z5=Af.create,$5=G1.create,L5=xf.create,M5=ev.create,N5=sv.create,D5=Df.create,V5=ev.createWithPreprocess,j5=A1.create,E5=()=>q8().optional(),O5=()=>P8().optional(),U5=()=>K8().optional(),H5={string:(f)=>dv.create({...f,coerce:!0}),number:(f)=>Hf.create({...f,coerce:!0}),boolean:(f)=>f1.create({...f,coerce:!0}),bigint:(f)=>Ff.create({...f,coerce:!0}),date:(f)=>Zf.create({...f,coerce:!0})};var F5=d;var rQ="2025-06-18";var z8=[rQ,"2025-03-26","2024-11-05","2024-10-07"],r1="2.0",$8=G.union([G.string(),G.number().int()]),L8=G.string(),A5=G.object({progressToken:G.optional($8)}).passthrough(),nv=G.object({_meta:G.optional(A5)}).passthrough(),Tv=G.object({method:G.string(),params:G.optional(nv)}),g1=G.object({_meta:G.optional(G.object({}).passthrough())}).passthrough(),qf=G.object({method:G.string(),params:G.optional(g1)}),pv=G.object({_meta:G.optional(G.object({}).passthrough())}).passthrough(),m1=G.union([G.string(),G.number().int()]),M8=G.object({jsonrpc:G.literal(r1),id:m1}).merge(Tv).strict(),N8=(f)=>M8.safeParse(f).success,D8=G.object({jsonrpc:G.literal(r1)}).merge(qf).strict(),V8=(f)=>D8.safeParse(f).success,j8=G.object({jsonrpc:G.literal(r1),id:m1,result:pv}).strict(),mQ=(f)=>j8.safeParse(f).success,Kv;(function(f){f[f.ConnectionClosed=-32000]="ConnectionClosed",f[f.RequestTimeout=-32001]="RequestTimeout",f[f.ParseError=-32700]="ParseError",f[f.InvalidRequest=-32600]="InvalidRequest",f[f.MethodNotFound=-32601]="MethodNotFound",f[f.InvalidParams=-32602]="InvalidParams",f[f.InternalError=-32603]="InternalError"})(Kv||(Kv={}));var E8=G.object({jsonrpc:G.literal(r1),id:m1,error:G.object({code:G.number().int(),message:G.string(),data:G.optional(G.unknown())})}).strict(),O8=(f)=>E8.safeParse(f).success,U8=G.union([M8,D8,j8,E8]),a1=pv.strict(),c1=qf.extend({method:G.literal("notifications/cancelled"),params:g1.extend({requestId:m1,reason:G.string().optional()})}),g5=G.object({src:G.string(),mimeType:G.optional(G.string()),sizes:G.optional(G.array(G.string()))}).passthrough(),_1=G.object({icons:G.array(g5).optional()}).passthrough(),h1=G.object({name:G.string(),title:G.optional(G.string())}).passthrough(),H8=h1.extend({version:G.string(),websiteUrl:G.optional(G.string())}).merge(_1),_5=G.object({experimental:G.optional(G.object({}).passthrough()),sampling:G.optional(G.object({}).passthrough()),elicitation:G.optional(G.object({}).passthrough()),roots:G.optional(G.object({listChanged:G.optional(G.boolean())}).passthrough())}).passthrough(),aQ=Tv.extend({method:G.literal("initialize"),params:nv.extend({protocolVersion:G.string(),capabilities:_5,clientInfo:H8})});var h5=G.object({experimental:G.optional(G.object({}).passthrough()),logging:G.optional(G.object({}).passthrough()),completions:G.optional(G.object({}).passthrough()),prompts:G.optional(G.object({listChanged:G.optional(G.boolean())}).passthrough()),resources:G.optional(G.object({subscribe:G.optional(G.boolean()),listChanged:G.optional(G.boolean())}).passthrough()),tools:G.optional(G.object({listChanged:G.optional(G.boolean())}).passthrough())}).passthrough(),b5=pv.extend({protocolVersion:G.string(),capabilities:h5,serverInfo:H8,instructions:G.optional(G.string())}),cQ=qf.extend({method:G.literal("notifications/initialized")});var n1=Tv.extend({method:G.literal("ping")}),R5=G.object({progress:G.number(),total:G.optional(G.number()),message:G.optional(G.string())}).passthrough(),p1=qf.extend({method:G.literal("notifications/progress"),params:g1.merge(R5).extend({progressToken:$8})}),i1=Tv.extend({params:nv.extend({cursor:G.optional(L8)}).optional()}),d1=pv.extend({nextCursor:G.optional(L8)}),F8=G.object({uri:G.string(),mimeType:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).passthrough(),A8=F8.extend({text:G.string()}),nQ=G.string().refine((f)=>{try{return atob(f),!0}catch(v){return!1}},{message:"Invalid Base64 string"}),g8=F8.extend({blob:nQ}),_8=h1.extend({uri:G.string(),description:G.optional(G.string()),mimeType:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).merge(_1),k5=h1.extend({uriTemplate:G.string(),description:G.optional(G.string()),mimeType:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).merge(_1),o1=i1.extend({method:G.literal("resources/list")}),S5=d1.extend({resources:G.array(_8)}),s1=i1.extend({method:G.literal("resources/templates/list")}),y5=d1.extend({resourceTemplates:G.array(k5)}),t1=Tv.extend({method:G.literal("resources/read"),params:nv.extend({uri:G.string()})}),l5=pv.extend({contents:G.array(G.union([A8,g8]))}),I5=qf.extend({method:G.literal("notifications/resources/list_changed")}),Z5=Tv.extend({method:G.literal("resources/subscribe"),params:nv.extend({uri:G.string()})}),C5=Tv.extend({method:G.literal("resources/unsubscribe"),params:nv.extend({uri:G.string()})}),T5=qf.extend({method:G.literal("notifications/resources/updated"),params:g1.extend({uri:G.string()})}),x5=G.object({name:G.string(),description:G.optional(G.string()),required:G.optional(G.boolean())}).passthrough(),u5=h1.extend({description:G.optional(G.string()),arguments:G.optional(G.array(x5)),_meta:G.optional(G.object({}).passthrough())}).merge(_1),e1=i1.extend({method:G.literal("prompts/list")}),r5=d1.extend({prompts:G.array(u5)}),vQ=Tv.extend({method:G.literal("prompts/get"),params:nv.extend({name:G.string(),arguments:G.optional(G.record(G.string()))})}),pQ=G.object({type:G.literal("text"),text:G.string(),_meta:G.optional(G.object({}).passthrough())}).passthrough(),iQ=G.object({type:G.literal("image"),data:nQ,mimeType:G.string(),_meta:G.optional(G.object({}).passthrough())}).passthrough(),dQ=G.object({type:G.literal("audio"),data:nQ,mimeType:G.string(),_meta:G.optional(G.object({}).passthrough())}).passthrough(),m5=G.object({type:G.literal("resource"),resource:G.union([A8,g8]),_meta:G.optional(G.object({}).passthrough())}).passthrough(),a5=_8.extend({type:G.literal("resource_link")}),h8=G.union([pQ,iQ,dQ,a5,m5]),c5=G.object({role:G.enum(["user","assistant"]),content:h8}).passthrough(),n5=pv.extend({description:G.optional(G.string()),messages:G.array(c5)}),p5=qf.extend({method:G.literal("notifications/prompts/list_changed")}),i5=G.object({title:G.optional(G.string()),readOnlyHint:G.optional(G.boolean()),destructiveHint:G.optional(G.boolean()),idempotentHint:G.optional(G.boolean()),openWorldHint:G.optional(G.boolean())}).passthrough(),d5=h1.extend({description:G.optional(G.string()),inputSchema:G.object({type:G.literal("object"),properties:G.optional(G.object({}).passthrough()),required:G.optional(G.array(G.string()))}).passthrough(),outputSchema:G.optional(G.object({type:G.literal("object"),properties:G.optional(G.object({}).passthrough()),required:G.optional(G.array(G.string()))}).passthrough()),annotations:G.optional(i5),_meta:G.optional(G.object({}).passthrough())}).merge(_1),fQ=i1.extend({method:G.literal("tools/list")}),o5=d1.extend({tools:G.array(d5)}),b8=pv.extend({content:G.array(h8).default([]),structuredContent:G.object({}).passthrough().optional(),isError:G.optional(G.boolean())}),a2=b8.or(pv.extend({toolResult:G.unknown()})),QQ=Tv.extend({method:G.literal("tools/call"),params:nv.extend({name:G.string(),arguments:G.optional(G.record(G.unknown()))})}),s5=qf.extend({method:G.literal("notifications/tools/list_changed")}),b1=G.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),oQ=Tv.extend({method:G.literal("logging/setLevel"),params:nv.extend({level:b1})}),t5=qf.extend({method:G.literal("notifications/message"),params:g1.extend({level:b1,logger:G.optional(G.string()),data:G.unknown()})}),e5=G.object({name:G.string().optional()}).passthrough(),vX=G.object({hints:G.optional(G.array(e5)),costPriority:G.optional(G.number().min(0).max(1)),speedPriority:G.optional(G.number().min(0).max(1)),intelligencePriority:G.optional(G.number().min(0).max(1))}).passthrough(),fX=G.object({role:G.enum(["user","assistant"]),content:G.union([pQ,iQ,dQ])}).passthrough(),QX=Tv.extend({method:G.literal("sampling/createMessage"),params:nv.extend({messages:G.array(fX),systemPrompt:G.optional(G.string()),includeContext:G.optional(G.enum(["none","thisServer","allServers"])),temperature:G.optional(G.number()),maxTokens:G.number().int(),stopSequences:G.optional(G.array(G.string())),metadata:G.optional(G.object({}).passthrough()),modelPreferences:G.optional(vX)})}),sQ=pv.extend({model:G.string(),stopReason:G.optional(G.enum(["endTurn","stopSequence","maxTokens"]).or(G.string())),role:G.enum(["user","assistant"]),content:G.discriminatedUnion("type",[pQ,iQ,dQ])}),WX=G.object({type:G.literal("boolean"),title:G.optional(G.string()),description:G.optional(G.string()),default:G.optional(G.boolean())}).passthrough(),JX=G.object({type:G.literal("string"),title:G.optional(G.string()),description:G.optional(G.string()),minLength:G.optional(G.number()),maxLength:G.optional(G.number()),format:G.optional(G.enum(["email","uri","date","date-time"]))}).passthrough(),XX=G.object({type:G.enum(["number","integer"]),title:G.optional(G.string()),description:G.optional(G.string()),minimum:G.optional(G.number()),maximum:G.optional(G.number())}).passthrough(),YX=G.object({type:G.literal("string"),title:G.optional(G.string()),description:G.optional(G.string()),enum:G.array(G.string()),enumNames:G.optional(G.array(G.string()))}).passthrough(),wX=G.union([WX,JX,XX,YX]),GX=Tv.extend({method:G.literal("elicitation/create"),params:nv.extend({message:G.string(),requestedSchema:G.object({type:G.literal("object"),properties:G.record(G.string(),wX),required:G.optional(G.array(G.string()))}).passthrough()})}),tQ=pv.extend({action:G.enum(["accept","decline","cancel"]),content:G.optional(G.record(G.string(),G.unknown()))}),BX=G.object({type:G.literal("ref/resource"),uri:G.string()}).passthrough();var qX=G.object({type:G.literal("ref/prompt"),name:G.string()}).passthrough(),WQ=Tv.extend({method:G.literal("completion/complete"),params:nv.extend({ref:G.union([qX,BX]),argument:G.object({name:G.string(),value:G.string()}).passthrough(),context:G.optional(G.object({arguments:G.optional(G.record(G.string(),G.string()))}))})}),PX=pv.extend({completion:G.object({values:G.array(G.string()).max(100),total:G.optional(G.number().int()),hasMore:G.optional(G.boolean())}).passthrough()}),KX=G.object({uri:G.string().startsWith("file://"),name:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).passthrough(),zX=Tv.extend({method:G.literal("roots/list")}),eQ=pv.extend({roots:G.array(KX)}),$X=qf.extend({method:G.literal("notifications/roots/list_changed")}),c2=G.union([n1,aQ,WQ,oQ,vQ,e1,o1,s1,t1,Z5,C5,QQ,fQ]),n2=G.union([c1,p1,cQ,$X]),p2=G.union([a1,sQ,tQ,eQ]),i2=G.union([n1,QX,GX,zX]),d2=G.union([c1,p1,t5,T5,I5,s5,p5]),o2=G.union([a1,b5,PX,n5,r5,S5,y5,l5,b8,o5]);class zv extends Error{constructor(f,v,W){super(`MCP error ${f}: ${v}`);this.code=f,this.data=W,this.name="McpError"}}var LX=60000;class v0{constructor(f){this._options=f,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(c1,(v)=>{let W=this._requestHandlerAbortControllers.get(v.params.requestId);W===null||W===void 0||W.abort(v.params.reason)}),this.setNotificationHandler(p1,(v)=>{this._onprogress(v)}),this.setRequestHandler(n1,(v)=>({}))}_setupTimeout(f,v,W,J,Q=!1){this._timeoutInfo.set(f,{timeoutId:setTimeout(J,v),startTime:Date.now(),timeout:v,maxTotalTimeout:W,resetTimeoutOnProgress:Q,onTimeout:J})}_resetTimeout(f){let v=this._timeoutInfo.get(f);if(!v)return!1;let W=Date.now()-v.startTime;if(v.maxTotalTimeout&&W>=v.maxTotalTimeout)throw this._timeoutInfo.delete(f),new zv(Kv.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:v.maxTotalTimeout,totalElapsed:W});return clearTimeout(v.timeoutId),v.timeoutId=setTimeout(v.onTimeout,v.timeout),!0}_cleanupTimeout(f){let v=this._timeoutInfo.get(f);if(v)clearTimeout(v.timeoutId),this._timeoutInfo.delete(f)}async connect(f){var v,W,J;this._transport=f;let Q=(v=this.transport)===null||v===void 0?void 0:v.onclose;this._transport.onclose=()=>{Q===null||Q===void 0||Q(),this._onclose()};let X=(W=this.transport)===null||W===void 0?void 0:W.onerror;this._transport.onerror=(w)=>{X===null||X===void 0||X(w),this._onerror(w)};let Y=(J=this._transport)===null||J===void 0?void 0:J.onmessage;this._transport.onmessage=(w,B)=>{if(Y===null||Y===void 0||Y(w,B),mQ(w)||O8(w))this._onresponse(w);else if(N8(w))this._onrequest(w,B);else if(V8(w))this._onnotification(w);else this._onerror(new Error(`Unknown message type: ${JSON.stringify(w)}`))},await this._transport.start()}_onclose(){var f;let v=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(f=this.onclose)===null||f===void 0||f.call(this);let W=new zv(Kv.ConnectionClosed,"Connection closed");for(let J of v.values())J(W)}_onerror(f){var v;(v=this.onerror)===null||v===void 0||v.call(this,f)}_onnotification(f){var v;let W=(v=this._notificationHandlers.get(f.method))!==null&&v!==void 0?v:this.fallbackNotificationHandler;if(W===void 0)return;Promise.resolve().then(()=>W(f)).catch((J)=>this._onerror(new Error(`Uncaught error in notification handler: ${J}`)))}_onrequest(f,v){var W,J;let Q=(W=this._requestHandlers.get(f.method))!==null&&W!==void 0?W:this.fallbackRequestHandler,X=this._transport;if(Q===void 0){X===null||X===void 0||X.send({jsonrpc:"2.0",id:f.id,error:{code:Kv.MethodNotFound,message:"Method not found"}}).catch((B)=>this._onerror(new Error(`Failed to send an error response: ${B}`)));return}let Y=new AbortController;this._requestHandlerAbortControllers.set(f.id,Y);let w={signal:Y.signal,sessionId:X===null||X===void 0?void 0:X.sessionId,_meta:(J=f.params)===null||J===void 0?void 0:J._meta,sendNotification:(B)=>this.notification(B,{relatedRequestId:f.id}),sendRequest:(B,z,K)=>this.request(B,z,{...K,relatedRequestId:f.id}),authInfo:v===null||v===void 0?void 0:v.authInfo,requestId:f.id,requestInfo:v===null||v===void 0?void 0:v.requestInfo};Promise.resolve().then(()=>Q(f,w)).then((B)=>{if(Y.signal.aborted)return;return X===null||X===void 0?void 0:X.send({result:B,jsonrpc:"2.0",id:f.id})},(B)=>{var z;if(Y.signal.aborted)return;return X===null||X===void 0?void 0:X.send({jsonrpc:"2.0",id:f.id,error:{code:Number.isSafeInteger(B.code)?B.code:Kv.InternalError,message:(z=B.message)!==null&&z!==void 0?z:"Internal error"}})}).catch((B)=>this._onerror(new Error(`Failed to send response: ${B}`))).finally(()=>{this._requestHandlerAbortControllers.delete(f.id)})}_onprogress(f){let{progressToken:v,...W}=f.params,J=Number(v),Q=this._progressHandlers.get(J);if(!Q){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(f)}`));return}let X=this._responseHandlers.get(J),Y=this._timeoutInfo.get(J);if(Y&&X&&Y.resetTimeoutOnProgress)try{this._resetTimeout(J)}catch(w){X(w);return}Q(W)}_onresponse(f){let v=Number(f.id),W=this._responseHandlers.get(v);if(W===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(f)}`));return}if(this._responseHandlers.delete(v),this._progressHandlers.delete(v),this._cleanupTimeout(v),mQ(f))W(f);else{let J=new zv(f.error.code,f.error.message,f.error.data);W(J)}}get transport(){return this._transport}async close(){var f;await((f=this._transport)===null||f===void 0?void 0:f.close())}request(f,v,W){let{relatedRequestId:J,resumptionToken:Q,onresumptiontoken:X}=W!==null&&W!==void 0?W:{};return new Promise((Y,w)=>{var B,z,K,L,D,q;if(!this._transport){w(new Error("Not connected"));return}if(((B=this._options)===null||B===void 0?void 0:B.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod(f.method);(z=W===null||W===void 0?void 0:W.signal)===null||z===void 0||z.throwIfAborted();let M=this._requestMessageId++,N={...f,jsonrpc:"2.0",id:M};if(W===null||W===void 0?void 0:W.onprogress)this._progressHandlers.set(M,W.onprogress),N.params={...f.params,_meta:{...((K=f.params)===null||K===void 0?void 0:K._meta)||{},progressToken:M}};let $=(H)=>{var k;this._responseHandlers.delete(M),this._progressHandlers.delete(M),this._cleanupTimeout(M),(k=this._transport)===null||k===void 0||k.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:M,reason:String(H)}},{relatedRequestId:J,resumptionToken:Q,onresumptiontoken:X}).catch((l)=>this._onerror(new Error(`Failed to send cancellation: ${l}`))),w(H)};this._responseHandlers.set(M,(H)=>{var k;if((k=W===null||W===void 0?void 0:W.signal)===null||k===void 0?void 0:k.aborted)return;if(H instanceof Error)return w(H);try{let l=v.parse(H.result);Y(l)}catch(l){w(l)}}),(L=W===null||W===void 0?void 0:W.signal)===null||L===void 0||L.addEventListener("abort",()=>{var H;$((H=W===null||W===void 0?void 0:W.signal)===null||H===void 0?void 0:H.reason)});let O=(D=W===null||W===void 0?void 0:W.timeout)!==null&&D!==void 0?D:LX,h=()=>$(new zv(Kv.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(M,O,W===null||W===void 0?void 0:W.maxTotalTimeout,h,(q=W===null||W===void 0?void 0:W.resetTimeoutOnProgress)!==null&&q!==void 0?q:!1),this._transport.send(N,{relatedRequestId:J,resumptionToken:Q,onresumptiontoken:X}).catch((H)=>{this._cleanupTimeout(M),w(H)})})}async notification(f,v){var W,J;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(f.method),((J=(W=this._options)===null||W===void 0?void 0:W.debouncedNotificationMethods)!==null&&J!==void 0?J:[]).includes(f.method)&&!f.params&&!(v===null||v===void 0?void 0:v.relatedRequestId)){if(this._pendingDebouncedNotifications.has(f.method))return;this._pendingDebouncedNotifications.add(f.method),Promise.resolve().then(()=>{var w;if(this._pendingDebouncedNotifications.delete(f.method),!this._transport)return;let B={...f,jsonrpc:"2.0"};(w=this._transport)===null||w===void 0||w.send(B,v).catch((z)=>this._onerror(z))});return}let Y={...f,jsonrpc:"2.0"};await this._transport.send(Y,v)}setRequestHandler(f,v){let W=f.shape.method.value;this.assertRequestHandlerCapability(W),this._requestHandlers.set(W,(J,Q)=>{return Promise.resolve(v(f.parse(J),Q))})}removeRequestHandler(f){this._requestHandlers.delete(f)}assertCanSetRequestHandler(f){if(this._requestHandlers.has(f))throw new Error(`A request handler for ${f} already exists, which would be overridden`)}setNotificationHandler(f,v){this._notificationHandlers.set(f.shape.method.value,(W)=>Promise.resolve(v(f.parse(W))))}removeNotificationHandler(f){this._notificationHandlers.delete(f)}}function R8(f,v){return Object.entries(v).reduce((W,[J,Q])=>{if(Q&&typeof Q==="object")W[J]=W[J]?{...W[J],...Q}:Q;else W[J]=Q;return W},{...f})}var S9=ZQ(k9(),1);class F0 extends v0{constructor(f,v){var W;super(v);if(this._serverInfo=f,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(b1.options.map((J,Q)=>[J,Q])),this.isMessageIgnored=(J,Q)=>{let X=this._loggingLevels.get(Q);return X?this.LOG_LEVEL_SEVERITY.get(J)<this.LOG_LEVEL_SEVERITY.get(X):!1},this._capabilities=(W=v===null||v===void 0?void 0:v.capabilities)!==null&&W!==void 0?W:{},this._instructions=v===null||v===void 0?void 0:v.instructions,this.setRequestHandler(aQ,(J)=>this._oninitialize(J)),this.setNotificationHandler(cQ,()=>{var J;return(J=this.oninitialized)===null||J===void 0?void 0:J.call(this)}),this._capabilities.logging)this.setRequestHandler(oQ,async(J,Q)=>{var X;let Y=Q.sessionId||((X=Q.requestInfo)===null||X===void 0?void 0:X.headers["mcp-session-id"])||void 0,{level:w}=J.params,B=b1.safeParse(w);if(B.success)this._loggingLevels.set(Y,B.data);return{}})}registerCapabilities(f){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=R8(this._capabilities,f)}assertCapabilityForMethod(f){var v,W,J;switch(f){case"sampling/createMessage":if(!((v=this._clientCapabilities)===null||v===void 0?void 0:v.sampling))throw new Error(`Client does not support sampling (required for ${f})`);break;case"elicitation/create":if(!((W=this._clientCapabilities)===null||W===void 0?void 0:W.elicitation))throw new Error(`Client does not support elicitation (required for ${f})`);break;case"roots/list":if(!((J=this._clientCapabilities)===null||J===void 0?void 0:J.roots))throw new Error(`Client does not support listing roots (required for ${f})`);break;case"ping":break}}assertNotificationCapability(f){switch(f){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${f})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${f})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${f})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${f})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(f){switch(f){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${f})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${f})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${f})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${f})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${f})`);break;case"ping":case"initialize":break}}async _oninitialize(f){let v=f.params.protocolVersion;return this._clientCapabilities=f.params.capabilities,this._clientVersion=f.params.clientInfo,{protocolVersion:z8.includes(v)?v:rQ,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},a1)}async createMessage(f,v){return this.request({method:"sampling/createMessage",params:f},sQ,v)}async elicitInput(f,v){let W=await this.request({method:"elicitation/create",params:f},tQ,v);if(W.action==="accept"&&W.content)try{let J=new S9.default,Q=J.compile(f.requestedSchema);if(!Q(W.content))throw new zv(Kv.InvalidParams,`Elicitation response content does not match requested schema: ${J.errorsText(Q.errors)}`)}catch(J){if(J instanceof zv)throw J;throw new zv(Kv.InternalError,`Error validating elicitation response: ${J}`)}return W}async listRoots(f,v){return this.request({method:"roots/list",params:f},eQ,v)}async sendLoggingMessage(f,v){if(this._capabilities.logging){if(!this.isMessageIgnored(f.level,v))return this.notification({method:"notifications/message",params:f})}}async sendResourceUpdated(f){return this.notification({method:"notifications/resources/updated",params:f})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var l9=Symbol("Let zodToJsonSchema decide on which parser to use");var y9={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},I9=(f)=>typeof f==="string"?{...y9,name:f}:{...y9,...f};var Z9=(f)=>{let v=I9(f),W=v.name!==void 0?[...v.basePath,v.definitionPath,v.name]:v.basePath;return{...v,flags:{hasReferencedOpenAiAnyType:!1},currentPath:W,propertyPath:void 0,seen:new Map(Object.entries(v.definitions).map(([J,Q])=>[Q._def,{def:Q._def,path:[...v.basePath,v.definitionPath,J],jsonSchema:void 0}]))}};function A0(f,v,W,J){if(!J?.errorMessages)return;if(W)f.errorMessage={...f.errorMessage,[v]:W}}function Wv(f,v,W,J,Q){f[v]=W,A0(f,v,J,Q)}var OQ=(f,v)=>{let W=0;for(;W<f.length&&W<v.length;W++)if(f[W]!==v[W])break;return[(f.length-W).toString(),...v.slice(W)].join("/")};function Mv(f){if(f.target!=="openAi")return{};let v=[...f.basePath,f.definitionPath,f.openAiAnyTypeName];return f.flags.hasReferencedOpenAiAnyType=!0,{$ref:f.$refStrategy==="relative"?OQ(v,f.currentPath):v.join("/")}}function C9(f,v){let W={type:"array"};if(f.type?._def&&f.type?._def?.typeName!==C.ZodAny)W.items=o(f.type._def,{...v,currentPath:[...v.currentPath,"items"]});if(f.minLength)Wv(W,"minItems",f.minLength.value,f.minLength.message,v);if(f.maxLength)Wv(W,"maxItems",f.maxLength.value,f.maxLength.message,v);if(f.exactLength)Wv(W,"minItems",f.exactLength.value,f.exactLength.message,v),Wv(W,"maxItems",f.exactLength.value,f.exactLength.message,v);return W}function T9(f,v){let W={type:"integer",format:"int64"};if(!f.checks)return W;for(let J of f.checks)switch(J.kind){case"min":if(v.target==="jsonSchema7")if(J.inclusive)Wv(W,"minimum",J.value,J.message,v);else Wv(W,"exclusiveMinimum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMinimum=!0;Wv(W,"minimum",J.value,J.message,v)}break;case"max":if(v.target==="jsonSchema7")if(J.inclusive)Wv(W,"maximum",J.value,J.message,v);else Wv(W,"exclusiveMaximum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMaximum=!0;Wv(W,"maximum",J.value,J.message,v)}break;case"multipleOf":Wv(W,"multipleOf",J.value,J.message,v);break}return W}function x9(){return{type:"boolean"}}function UQ(f,v){return o(f.type._def,v)}var u9=(f,v)=>{return o(f.innerType._def,v)};function g0(f,v,W){let J=W??v.dateStrategy;if(Array.isArray(J))return{anyOf:J.map((Q,X)=>g0(f,v,Q))};switch(J){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return iY(f,v)}}var iY=(f,v)=>{let W={type:"integer",format:"unix-time"};if(v.target==="openApi3")return W;for(let J of f.checks)switch(J.kind){case"min":Wv(W,"minimum",J.value,J.message,v);break;case"max":Wv(W,"maximum",J.value,J.message,v);break}return W};function r9(f,v){return{...o(f.innerType._def,v),default:f.defaultValue()}}function m9(f,v){return v.effectStrategy==="input"?o(f.schema._def,v):Mv(v)}function a9(f){return{type:"string",enum:Array.from(f.values)}}var dY=(f)=>{if("type"in f&&f.type==="string")return!1;return"allOf"in f};function c9(f,v){let W=[o(f.left._def,{...v,currentPath:[...v.currentPath,"allOf","0"]}),o(f.right._def,{...v,currentPath:[...v.currentPath,"allOf","1"]})].filter((X)=>!!X),J=v.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,Q=[];return W.forEach((X)=>{if(dY(X)){if(Q.push(...X.allOf),X.unevaluatedProperties===void 0)J=void 0}else{let Y=X;if("additionalProperties"in X&&X.additionalProperties===!1){let{additionalProperties:w,...B}=X;Y=B}else J=void 0;Q.push(Y)}}),Q.length?{allOf:Q,...J}:void 0}function n9(f,v){let W=typeof f.value;if(W!=="bigint"&&W!=="number"&&W!=="boolean"&&W!=="string")return{type:Array.isArray(f.value)?"array":"object"};if(v.target==="openApi3")return{type:W==="bigint"?"integer":W,enum:[f.value]};return{type:W==="bigint"?"integer":W,const:f.value}}var _0=void 0,vf={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(_0===void 0)_0=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return _0},uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function HQ(f,v){let W={type:"string"};if(f.checks)for(let J of f.checks)switch(J.kind){case"min":Wv(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,J.value):J.value,J.message,v);break;case"max":Wv(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,J.value):J.value,J.message,v);break;case"email":switch(v.emailStrategy){case"format:email":ff(W,"email",J.message,v);break;case"format:idn-email":ff(W,"idn-email",J.message,v);break;case"pattern:zod":Iv(W,vf.email,J.message,v);break}break;case"url":ff(W,"uri",J.message,v);break;case"uuid":ff(W,"uuid",J.message,v);break;case"regex":Iv(W,J.regex,J.message,v);break;case"cuid":Iv(W,vf.cuid,J.message,v);break;case"cuid2":Iv(W,vf.cuid2,J.message,v);break;case"startsWith":Iv(W,RegExp(`^${h0(J.value,v)}`),J.message,v);break;case"endsWith":Iv(W,RegExp(`${h0(J.value,v)}$`),J.message,v);break;case"datetime":ff(W,"date-time",J.message,v);break;case"date":ff(W,"date",J.message,v);break;case"time":ff(W,"time",J.message,v);break;case"duration":ff(W,"duration",J.message,v);break;case"length":Wv(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,J.value):J.value,J.message,v),Wv(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,J.value):J.value,J.message,v);break;case"includes":{Iv(W,RegExp(h0(J.value,v)),J.message,v);break}case"ip":{if(J.version!=="v6")ff(W,"ipv4",J.message,v);if(J.version!=="v4")ff(W,"ipv6",J.message,v);break}case"base64url":Iv(W,vf.base64url,J.message,v);break;case"jwt":Iv(W,vf.jwt,J.message,v);break;case"cidr":{if(J.version!=="v6")Iv(W,vf.ipv4Cidr,J.message,v);if(J.version!=="v4")Iv(W,vf.ipv6Cidr,J.message,v);break}case"emoji":Iv(W,vf.emoji(),J.message,v);break;case"ulid":{Iv(W,vf.ulid,J.message,v);break}case"base64":{switch(v.base64Strategy){case"format:binary":{ff(W,"binary",J.message,v);break}case"contentEncoding:base64":{Wv(W,"contentEncoding","base64",J.message,v);break}case"pattern:zod":{Iv(W,vf.base64,J.message,v);break}}break}case"nanoid":Iv(W,vf.nanoid,J.message,v);case"toLowerCase":case"toUpperCase":case"trim":break;default:((Q)=>{})(J)}return W}function h0(f,v){return v.patternStrategy==="escape"?sY(f):f}var oY=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function sY(f){let v="";for(let W=0;W<f.length;W++){if(!oY.has(f[W]))v+="\\";v+=f[W]}return v}function ff(f,v,W,J){if(f.format||f.anyOf?.some((Q)=>Q.format)){if(!f.anyOf)f.anyOf=[];if(f.format){if(f.anyOf.push({format:f.format,...f.errorMessage&&J.errorMessages&&{errorMessage:{format:f.errorMessage.format}}}),delete f.format,f.errorMessage){if(delete f.errorMessage.format,Object.keys(f.errorMessage).length===0)delete f.errorMessage}}f.anyOf.push({format:v,...W&&J.errorMessages&&{errorMessage:{format:W}}})}else Wv(f,"format",v,W,J)}function Iv(f,v,W,J){if(f.pattern||f.allOf?.some((Q)=>Q.pattern)){if(!f.allOf)f.allOf=[];if(f.pattern){if(f.allOf.push({pattern:f.pattern,...f.errorMessage&&J.errorMessages&&{errorMessage:{pattern:f.errorMessage.pattern}}}),delete f.pattern,f.errorMessage){if(delete f.errorMessage.pattern,Object.keys(f.errorMessage).length===0)delete f.errorMessage}}f.allOf.push({pattern:p9(v,J),...W&&J.errorMessages&&{errorMessage:{pattern:W}}})}else Wv(f,"pattern",p9(v,J),W,J)}function p9(f,v){if(!v.applyRegexFlags||!f.flags)return f.source;let W={i:f.flags.includes("i"),m:f.flags.includes("m"),s:f.flags.includes("s")},J=W.i?f.source.toLowerCase():f.source,Q="",X=!1,Y=!1,w=!1;for(let B=0;B<J.length;B++){if(X){Q+=J[B],X=!1;continue}if(W.i){if(Y){if(J[B].match(/[a-z]/)){if(w)Q+=J[B],Q+=`${J[B-2]}-${J[B]}`.toUpperCase(),w=!1;else if(J[B+1]==="-"&&J[B+2]?.match(/[a-z]/))Q+=J[B],w=!0;else Q+=`${J[B]}${J[B].toUpperCase()}`;continue}}else if(J[B].match(/[a-z]/)){Q+=`[${J[B]}${J[B].toUpperCase()}]`;continue}}if(W.m){if(J[B]==="^"){Q+=`(^|(?<=[\r
8
+ Error: ${J}`)}},W2=()=>{let f;try{f=TJ.findProjectRoot()}catch{f=mJ(process.cwd(),".swic")}let v=mJ(v2(),".swic"),W=`${f}/${kQ}`,J=`${v}/${kQ}`;return Q2(W,J),{projectDataDir:f,sharedDataDir:v}},J2=(f)=>{let{projectBoundaryDir:v,sharedBoundaryDir:W}=f,J=`${v}/${kQ}`,Q=`${W}/${kQ}`,X=x0.create({boundaryDir:J}),Y=x0.create({boundaryDir:Q}),w=u0.create({boundaryDir:J}),B=u0.create({boundaryDir:Q}),z=ZJ.create({fileServiceByScope:{project:X,shared:Y},folderServiceByScope:{project:w,shared:B},indexFilename:f2});return Object.freeze({DocService:z})},X2,Y2;var aJ=Ef(()=>{RJ();lJ();CJ();xJ();X2=Object.freeze({createServices:J2,lazilyGetDataDirs:W2}),Y2=X2});var G={};v8(G,{void:()=>e6,util:()=>Qv,unknown:()=>s6,union:()=>W5,undefined:()=>i6,tuple:()=>Y5,transformer:()=>M5,symbol:()=>p6,string:()=>B8,strictObject:()=>Q5,setErrorMap:()=>V6,set:()=>B5,record:()=>w5,quotelessJson:()=>M6,promise:()=>L5,preprocess:()=>D5,pipeline:()=>j5,ostring:()=>E5,optional:()=>N5,onumber:()=>O5,oboolean:()=>U5,objectUtil:()=>CQ,object:()=>f5,number:()=>q8,nullable:()=>V5,null:()=>d6,never:()=>t6,nativeEnum:()=>$5,nan:()=>a6,map:()=>G5,makeIssue:()=>j1,literal:()=>K5,lazy:()=>P5,late:()=>m6,isValid:()=>Of,isDirty:()=>T1,isAsync:()=>tf,isAborted:()=>C1,intersection:()=>X5,instanceof:()=>r6,getParsedType:()=>wf,getErrorMap:()=>sf,function:()=>q5,enum:()=>z5,effect:()=>M5,discriminatedUnion:()=>J5,defaultErrorMap:()=>Mf,datetimeRegex:()=>Y8,date:()=>n6,custom:()=>G8,coerce:()=>H5,boolean:()=>P8,bigint:()=>c6,array:()=>v5,any:()=>o6,addIssueToContext:()=>u,ZodVoid:()=>O1,ZodUnknown:()=>Uf,ZodUnion:()=>J1,ZodUndefined:()=>Q1,ZodType:()=>vv,ZodTuple:()=>Bf,ZodTransformer:()=>ev,ZodSymbol:()=>E1,ZodString:()=>dv,ZodSet:()=>Tf,ZodSchema:()=>vv,ZodRecord:()=>U1,ZodReadonly:()=>P1,ZodPromise:()=>xf,ZodPipeline:()=>A1,ZodParsedType:()=>x,ZodOptional:()=>sv,ZodObject:()=>Dv,ZodNumber:()=>Hf,ZodNullable:()=>Vf,ZodNull:()=>W1,ZodNever:()=>Gf,ZodNativeEnum:()=>G1,ZodNaN:()=>F1,ZodMap:()=>H1,ZodLiteral:()=>w1,ZodLazy:()=>Y1,ZodIssueCode:()=>Z,ZodIntersection:()=>X1,ZodFunction:()=>v1,ZodFirstPartyTypeKind:()=>C,ZodError:()=>Cv,ZodEnum:()=>Af,ZodEffects:()=>ev,ZodDiscriminatedUnion:()=>x1,ZodDefault:()=>B1,ZodDate:()=>Zf,ZodCatch:()=>q1,ZodBranded:()=>u1,ZodBoolean:()=>f1,ZodBigInt:()=>Ff,ZodArray:()=>ov,ZodAny:()=>Cf,Schema:()=>vv,ParseStatus:()=>hv,OK:()=>kv,NEVER:()=>F5,INVALID:()=>d,EMPTY_PATH:()=>D6,DIRTY:()=>If,BRAND:()=>u6});var Qv;(function(f){f.assertEqual=(Q)=>{};function v(Q){}f.assertIs=v;function W(Q){throw new Error}f.assertNever=W,f.arrayToEnum=(Q)=>{let X={};for(let Y of Q)X[Y]=Y;return X},f.getValidEnumValues=(Q)=>{let X=f.objectKeys(Q).filter((w)=>typeof Q[Q[w]]!=="number"),Y={};for(let w of X)Y[w]=Q[w];return f.objectValues(Y)},f.objectValues=(Q)=>{return f.objectKeys(Q).map(function(X){return Q[X]})},f.objectKeys=typeof Object.keys==="function"?(Q)=>Object.keys(Q):(Q)=>{let X=[];for(let Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y))X.push(Y);return X},f.find=(Q,X)=>{for(let Y of Q)if(X(Y))return Y;return},f.isInteger=typeof Number.isInteger==="function"?(Q)=>Number.isInteger(Q):(Q)=>typeof Q==="number"&&Number.isFinite(Q)&&Math.floor(Q)===Q;function J(Q,X=" | "){return Q.map((Y)=>typeof Y==="string"?`'${Y}'`:Y).join(X)}f.joinValues=J,f.jsonStringifyReplacer=(Q,X)=>{if(typeof X==="bigint")return X.toString();return X}})(Qv||(Qv={}));var CQ;(function(f){f.mergeShapes=(v,W)=>{return{...v,...W}}})(CQ||(CQ={}));var x=Qv.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wf=(f)=>{switch(typeof f){case"undefined":return x.undefined;case"string":return x.string;case"number":return Number.isNaN(f)?x.nan:x.number;case"boolean":return x.boolean;case"function":return x.function;case"bigint":return x.bigint;case"symbol":return x.symbol;case"object":if(Array.isArray(f))return x.array;if(f===null)return x.null;if(f.then&&typeof f.then==="function"&&f.catch&&typeof f.catch==="function")return x.promise;if(typeof Map!=="undefined"&&f instanceof Map)return x.map;if(typeof Set!=="undefined"&&f instanceof Set)return x.set;if(typeof Date!=="undefined"&&f instanceof Date)return x.date;return x.object;default:return x.unknown}};var Z=Qv.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"]),M6=(f)=>{return JSON.stringify(f,null,2).replace(/"([^"]+)":/g,"$1:")};class Cv extends Error{get errors(){return this.issues}constructor(f){super();this.issues=[],this.addIssue=(W)=>{this.issues=[...this.issues,W]},this.addIssues=(W=[])=>{this.issues=[...this.issues,...W]};let v=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,v);else this.__proto__=v;this.name="ZodError",this.issues=f}format(f){let v=f||function(Q){return Q.message},W={_errors:[]},J=(Q)=>{for(let X of Q.issues)if(X.code==="invalid_union")X.unionErrors.map(J);else if(X.code==="invalid_return_type")J(X.returnTypeError);else if(X.code==="invalid_arguments")J(X.argumentsError);else if(X.path.length===0)W._errors.push(v(X));else{let Y=W,w=0;while(w<X.path.length){let B=X.path[w];if(w!==X.path.length-1)Y[B]=Y[B]||{_errors:[]};else Y[B]=Y[B]||{_errors:[]},Y[B]._errors.push(v(X));Y=Y[B],w++}}};return J(this),W}static assert(f){if(!(f instanceof Cv))throw new Error(`Not a ZodError: ${f}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Qv.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(f=(v)=>v.message){let v={},W=[];for(let J of this.issues)if(J.path.length>0){let Q=J.path[0];v[Q]=v[Q]||[],v[Q].push(f(J))}else W.push(f(J));return{formErrors:W,fieldErrors:v}}get formErrors(){return this.flatten()}}Cv.create=(f)=>{return new Cv(f)};var N6=(f,v)=>{let W;switch(f.code){case Z.invalid_type:if(f.received===x.undefined)W="Required";else W=`Expected ${f.expected}, received ${f.received}`;break;case Z.invalid_literal:W=`Invalid literal value, expected ${JSON.stringify(f.expected,Qv.jsonStringifyReplacer)}`;break;case Z.unrecognized_keys:W=`Unrecognized key(s) in object: ${Qv.joinValues(f.keys,", ")}`;break;case Z.invalid_union:W="Invalid input";break;case Z.invalid_union_discriminator:W=`Invalid discriminator value. Expected ${Qv.joinValues(f.options)}`;break;case Z.invalid_enum_value:W=`Invalid enum value. Expected ${Qv.joinValues(f.options)}, received '${f.received}'`;break;case Z.invalid_arguments:W="Invalid function arguments";break;case Z.invalid_return_type:W="Invalid function return type";break;case Z.invalid_date:W="Invalid date";break;case Z.invalid_string:if(typeof f.validation==="object")if("includes"in f.validation){if(W=`Invalid input: must include "${f.validation.includes}"`,typeof f.validation.position==="number")W=`${W} at one or more positions greater than or equal to ${f.validation.position}`}else if("startsWith"in f.validation)W=`Invalid input: must start with "${f.validation.startsWith}"`;else if("endsWith"in f.validation)W=`Invalid input: must end with "${f.validation.endsWith}"`;else Qv.assertNever(f.validation);else if(f.validation!=="regex")W=`Invalid ${f.validation}`;else W="Invalid";break;case Z.too_small:if(f.type==="array")W=`Array must contain ${f.exact?"exactly":f.inclusive?"at least":"more than"} ${f.minimum} element(s)`;else if(f.type==="string")W=`String must contain ${f.exact?"exactly":f.inclusive?"at least":"over"} ${f.minimum} character(s)`;else if(f.type==="number")W=`Number must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${f.minimum}`;else if(f.type==="bigint")W=`Number must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${f.minimum}`;else if(f.type==="date")W=`Date must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(f.minimum))}`;else W="Invalid input";break;case Z.too_big:if(f.type==="array")W=`Array must contain ${f.exact?"exactly":f.inclusive?"at most":"less than"} ${f.maximum} element(s)`;else if(f.type==="string")W=`String must contain ${f.exact?"exactly":f.inclusive?"at most":"under"} ${f.maximum} character(s)`;else if(f.type==="number")W=`Number must be ${f.exact?"exactly":f.inclusive?"less than or equal to":"less than"} ${f.maximum}`;else if(f.type==="bigint")W=`BigInt must be ${f.exact?"exactly":f.inclusive?"less than or equal to":"less than"} ${f.maximum}`;else if(f.type==="date")W=`Date must be ${f.exact?"exactly":f.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(f.maximum))}`;else W="Invalid input";break;case Z.custom:W="Invalid input";break;case Z.invalid_intersection_types:W="Intersection results could not be merged";break;case Z.not_multiple_of:W=`Number must be a multiple of ${f.multipleOf}`;break;case Z.not_finite:W="Number must be finite";break;default:W=v.defaultError,Qv.assertNever(f)}return{message:W}},Mf=N6;var f8=Mf;function V6(f){f8=f}function sf(){return f8}var j1=(f)=>{let{data:v,path:W,errorMaps:J,issueData:Q}=f,X=[...W,...Q.path||[]],Y={...Q,path:X};if(Q.message!==void 0)return{...Q,path:X,message:Q.message};let w="",B=J.filter((z)=>!!z).slice().reverse();for(let z of B)w=z(Y,{data:v,defaultError:w}).message;return{...Q,path:X,message:w}},D6=[];function u(f,v){let W=sf(),J=j1({issueData:v,data:f.data,path:f.path,errorMaps:[f.common.contextualErrorMap,f.schemaErrorMap,W,W===Mf?void 0:Mf].filter((Q)=>!!Q)});f.common.issues.push(J)}class hv{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(f,v){let W=[];for(let J of v){if(J.status==="aborted")return d;if(J.status==="dirty")f.dirty();W.push(J.value)}return{status:f.value,value:W}}static async mergeObjectAsync(f,v){let W=[];for(let J of v){let Q=await J.key,X=await J.value;W.push({key:Q,value:X})}return hv.mergeObjectSync(f,W)}static mergeObjectSync(f,v){let W={};for(let J of v){let{key:Q,value:X}=J;if(Q.status==="aborted")return d;if(X.status==="aborted")return d;if(Q.status==="dirty")f.dirty();if(X.status==="dirty")f.dirty();if(Q.value!=="__proto__"&&(typeof X.value!=="undefined"||J.alwaysSet))W[Q.value]=X.value}return{status:f.value,value:W}}}var d=Object.freeze({status:"aborted"}),If=(f)=>({status:"dirty",value:f}),kv=(f)=>({status:"valid",value:f}),C1=(f)=>f.status==="aborted",T1=(f)=>f.status==="dirty",Of=(f)=>f.status==="valid",tf=(f)=>typeof Promise!=="undefined"&&f instanceof Promise;var c;(function(f){f.errToObj=(v)=>typeof v==="string"?{message:v}:v||{},f.toString=(v)=>typeof v==="string"?v:v?.message})(c||(c={}));class tv{constructor(f,v,W,J){this._cachedPath=[],this.parent=f,this.data=v,this._path=W,this._key=J}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var Q8=(f,v)=>{if(Of(v))return{success:!0,data:v.value};else{if(!f.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let W=new Cv(f.common.issues);return this._error=W,this._error}}}};function t(f){if(!f)return{};let{errorMap:v,invalid_type_error:W,required_error:J,description:Q}=f;if(v&&(W||J))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(v)return{errorMap:v,description:Q};return{errorMap:(Y,w)=>{let{message:B}=f;if(Y.code==="invalid_enum_value")return{message:B??w.defaultError};if(typeof w.data==="undefined")return{message:B??J??w.defaultError};if(Y.code!=="invalid_type")return{message:w.defaultError};return{message:B??W??w.defaultError}},description:Q}}class vv{get description(){return this._def.description}_getType(f){return wf(f.data)}_getOrReturnCtx(f,v){return v||{common:f.parent.common,data:f.data,parsedType:wf(f.data),schemaErrorMap:this._def.errorMap,path:f.path,parent:f.parent}}_processInputParams(f){return{status:new hv,ctx:{common:f.parent.common,data:f.data,parsedType:wf(f.data),schemaErrorMap:this._def.errorMap,path:f.path,parent:f.parent}}}_parseSync(f){let v=this._parse(f);if(tf(v))throw new Error("Synchronous parse encountered promise.");return v}_parseAsync(f){let v=this._parse(f);return Promise.resolve(v)}parse(f,v){let W=this.safeParse(f,v);if(W.success)return W.data;throw W.error}safeParse(f,v){let W={common:{issues:[],async:v?.async??!1,contextualErrorMap:v?.errorMap},path:v?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:wf(f)},J=this._parseSync({data:f,path:W.path,parent:W});return Q8(W,J)}"~validate"(f){let v={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:wf(f)};if(!this["~standard"].async)try{let W=this._parseSync({data:f,path:[],parent:v});return Of(W)?{value:W.value}:{issues:v.common.issues}}catch(W){if(W?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;v.common={issues:[],async:!0}}return this._parseAsync({data:f,path:[],parent:v}).then((W)=>Of(W)?{value:W.value}:{issues:v.common.issues})}async parseAsync(f,v){let W=await this.safeParseAsync(f,v);if(W.success)return W.data;throw W.error}async safeParseAsync(f,v){let W={common:{issues:[],contextualErrorMap:v?.errorMap,async:!0},path:v?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:wf(f)},J=this._parse({data:f,path:W.path,parent:W}),Q=await(tf(J)?J:Promise.resolve(J));return Q8(W,Q)}refine(f,v){let W=(J)=>{if(typeof v==="string"||typeof v==="undefined")return{message:v};else if(typeof v==="function")return v(J);else return v};return this._refinement((J,Q)=>{let X=f(J),Y=()=>Q.addIssue({code:Z.custom,...W(J)});if(typeof Promise!=="undefined"&&X instanceof Promise)return X.then((w)=>{if(!w)return Y(),!1;else return!0});if(!X)return Y(),!1;else return!0})}refinement(f,v){return this._refinement((W,J)=>{if(!f(W))return J.addIssue(typeof v==="function"?v(W,J):v),!1;else return!0})}_refinement(f){return new ev({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:f}})}superRefine(f){return this._refinement(f)}constructor(f){this.spa=this.safeParseAsync,this._def=f,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:(v)=>this["~validate"](v)}}optional(){return sv.create(this,this._def)}nullable(){return Vf.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ov.create(this)}promise(){return xf.create(this,this._def)}or(f){return J1.create([this,f],this._def)}and(f){return X1.create(this,f,this._def)}transform(f){return new ev({...t(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:f}})}default(f){let v=typeof f==="function"?f:()=>f;return new B1({...t(this._def),innerType:this,defaultValue:v,typeName:C.ZodDefault})}brand(){return new u1({typeName:C.ZodBranded,type:this,...t(this._def)})}catch(f){let v=typeof f==="function"?f:()=>f;return new q1({...t(this._def),innerType:this,catchValue:v,typeName:C.ZodCatch})}describe(f){return new this.constructor({...this._def,description:f})}pipe(f){return A1.create(this,f)}readonly(){return P1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var j6=/^c[^\s-]{8,}$/i,E6=/^[0-9a-z]+$/,O6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,U6=/^[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,H6=/^[a-z0-9_-]{21}$/i,F6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,A6=/^[-+]?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)?)??$/,g6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",TQ,h6=/^(?:(?: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])$/,b6=/^(?:(?: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])$/,R6=/^(([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]))$/,k6=/^(([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])$/,S6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,y6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,J8="((\\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])))",l6=new RegExp(`^${J8}$`);function X8(f){let v="[0-5]\\d";if(f.precision)v=`${v}\\.\\d{${f.precision}}`;else if(f.precision==null)v=`${v}(\\.\\d+)?`;let W=f.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${v})${W}`}function I6(f){return new RegExp(`^${X8(f)}$`)}function Y8(f){let v=`${J8}T${X8(f)}`,W=[];if(W.push(f.local?"Z?":"Z"),f.offset)W.push("([+-]\\d{2}:?\\d{2})");return v=`${v}(${W.join("|")})`,new RegExp(`^${v}$`)}function Z6(f,v){if((v==="v4"||!v)&&h6.test(f))return!0;if((v==="v6"||!v)&&R6.test(f))return!0;return!1}function C6(f,v){if(!F6.test(f))return!1;try{let[W]=f.split(".");if(!W)return!1;let J=W.replace(/-/g,"+").replace(/_/g,"/").padEnd(W.length+(4-W.length%4)%4,"="),Q=JSON.parse(atob(J));if(typeof Q!=="object"||Q===null)return!1;if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(v&&Q.alg!==v)return!1;return!0}catch{return!1}}function T6(f,v){if((v==="v4"||!v)&&b6.test(f))return!0;if((v==="v6"||!v)&&k6.test(f))return!0;return!1}class dv extends vv{_parse(f){if(this._def.coerce)f.data=String(f.data);if(this._getType(f)!==x.string){let Q=this._getOrReturnCtx(f);return u(Q,{code:Z.invalid_type,expected:x.string,received:Q.parsedType}),d}let W=new hv,J=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if(f.data.length<Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:Z.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),W.dirty()}else if(Q.kind==="max"){if(f.data.length>Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:Z.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),W.dirty()}else if(Q.kind==="length"){let X=f.data.length>Q.value,Y=f.data.length<Q.value;if(X||Y){if(J=this._getOrReturnCtx(f,J),X)u(J,{code:Z.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});else if(Y)u(J,{code:Z.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});W.dirty()}}else if(Q.kind==="email"){if(!g6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"email",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="emoji"){if(!TQ)TQ=new RegExp(_6,"u");if(!TQ.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"emoji",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="uuid"){if(!U6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"uuid",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="nanoid"){if(!H6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"nanoid",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="cuid"){if(!j6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"cuid",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="cuid2"){if(!E6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"cuid2",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="ulid"){if(!O6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"ulid",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="url")try{new URL(f.data)}catch{J=this._getOrReturnCtx(f,J),u(J,{validation:"url",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="regex"){if(Q.regex.lastIndex=0,!Q.regex.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"regex",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="trim")f.data=f.data.trim();else if(Q.kind==="includes"){if(!f.data.includes(Q.value,Q.position))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:{includes:Q.value,position:Q.position},message:Q.message}),W.dirty()}else if(Q.kind==="toLowerCase")f.data=f.data.toLowerCase();else if(Q.kind==="toUpperCase")f.data=f.data.toUpperCase();else if(Q.kind==="startsWith"){if(!f.data.startsWith(Q.value))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:{startsWith:Q.value},message:Q.message}),W.dirty()}else if(Q.kind==="endsWith"){if(!f.data.endsWith(Q.value))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:{endsWith:Q.value},message:Q.message}),W.dirty()}else if(Q.kind==="datetime"){if(!Y8(Q).test(f.data))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:"datetime",message:Q.message}),W.dirty()}else if(Q.kind==="date"){if(!l6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:"date",message:Q.message}),W.dirty()}else if(Q.kind==="time"){if(!I6(Q).test(f.data))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:"time",message:Q.message}),W.dirty()}else if(Q.kind==="duration"){if(!A6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"duration",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="ip"){if(!Z6(f.data,Q.version))J=this._getOrReturnCtx(f,J),u(J,{validation:"ip",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="jwt"){if(!C6(f.data,Q.alg))J=this._getOrReturnCtx(f,J),u(J,{validation:"jwt",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="cidr"){if(!T6(f.data,Q.version))J=this._getOrReturnCtx(f,J),u(J,{validation:"cidr",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="base64"){if(!S6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"base64",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="base64url"){if(!y6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"base64url",code:Z.invalid_string,message:Q.message}),W.dirty()}else Qv.assertNever(Q);return{status:W.value,value:f.data}}_regex(f,v,W){return this.refinement((J)=>f.test(J),{validation:v,code:Z.invalid_string,...c.errToObj(W)})}_addCheck(f){return new dv({...this._def,checks:[...this._def.checks,f]})}email(f){return this._addCheck({kind:"email",...c.errToObj(f)})}url(f){return this._addCheck({kind:"url",...c.errToObj(f)})}emoji(f){return this._addCheck({kind:"emoji",...c.errToObj(f)})}uuid(f){return this._addCheck({kind:"uuid",...c.errToObj(f)})}nanoid(f){return this._addCheck({kind:"nanoid",...c.errToObj(f)})}cuid(f){return this._addCheck({kind:"cuid",...c.errToObj(f)})}cuid2(f){return this._addCheck({kind:"cuid2",...c.errToObj(f)})}ulid(f){return this._addCheck({kind:"ulid",...c.errToObj(f)})}base64(f){return this._addCheck({kind:"base64",...c.errToObj(f)})}base64url(f){return this._addCheck({kind:"base64url",...c.errToObj(f)})}jwt(f){return this._addCheck({kind:"jwt",...c.errToObj(f)})}ip(f){return this._addCheck({kind:"ip",...c.errToObj(f)})}cidr(f){return this._addCheck({kind:"cidr",...c.errToObj(f)})}datetime(f){if(typeof f==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:f});return this._addCheck({kind:"datetime",precision:typeof f?.precision==="undefined"?null:f?.precision,offset:f?.offset??!1,local:f?.local??!1,...c.errToObj(f?.message)})}date(f){return this._addCheck({kind:"date",message:f})}time(f){if(typeof f==="string")return this._addCheck({kind:"time",precision:null,message:f});return this._addCheck({kind:"time",precision:typeof f?.precision==="undefined"?null:f?.precision,...c.errToObj(f?.message)})}duration(f){return this._addCheck({kind:"duration",...c.errToObj(f)})}regex(f,v){return this._addCheck({kind:"regex",regex:f,...c.errToObj(v)})}includes(f,v){return this._addCheck({kind:"includes",value:f,position:v?.position,...c.errToObj(v?.message)})}startsWith(f,v){return this._addCheck({kind:"startsWith",value:f,...c.errToObj(v)})}endsWith(f,v){return this._addCheck({kind:"endsWith",value:f,...c.errToObj(v)})}min(f,v){return this._addCheck({kind:"min",value:f,...c.errToObj(v)})}max(f,v){return this._addCheck({kind:"max",value:f,...c.errToObj(v)})}length(f,v){return this._addCheck({kind:"length",value:f,...c.errToObj(v)})}nonempty(f){return this.min(1,c.errToObj(f))}trim(){return new dv({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new dv({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new dv({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((f)=>f.kind==="datetime")}get isDate(){return!!this._def.checks.find((f)=>f.kind==="date")}get isTime(){return!!this._def.checks.find((f)=>f.kind==="time")}get isDuration(){return!!this._def.checks.find((f)=>f.kind==="duration")}get isEmail(){return!!this._def.checks.find((f)=>f.kind==="email")}get isURL(){return!!this._def.checks.find((f)=>f.kind==="url")}get isEmoji(){return!!this._def.checks.find((f)=>f.kind==="emoji")}get isUUID(){return!!this._def.checks.find((f)=>f.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((f)=>f.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((f)=>f.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((f)=>f.kind==="cuid2")}get isULID(){return!!this._def.checks.find((f)=>f.kind==="ulid")}get isIP(){return!!this._def.checks.find((f)=>f.kind==="ip")}get isCIDR(){return!!this._def.checks.find((f)=>f.kind==="cidr")}get isBase64(){return!!this._def.checks.find((f)=>f.kind==="base64")}get isBase64url(){return!!this._def.checks.find((f)=>f.kind==="base64url")}get minLength(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxLength(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}}dv.create=(f)=>{return new dv({checks:[],typeName:C.ZodString,coerce:f?.coerce??!1,...t(f)})};function x6(f,v){let W=(f.toString().split(".")[1]||"").length,J=(v.toString().split(".")[1]||"").length,Q=W>J?W:J,X=Number.parseInt(f.toFixed(Q).replace(".","")),Y=Number.parseInt(v.toFixed(Q).replace(".",""));return X%Y/10**Q}class Hf extends vv{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(f){if(this._def.coerce)f.data=Number(f.data);if(this._getType(f)!==x.number){let Q=this._getOrReturnCtx(f);return u(Q,{code:Z.invalid_type,expected:x.number,received:Q.parsedType}),d}let W=void 0,J=new hv;for(let Q of this._def.checks)if(Q.kind==="int"){if(!Qv.isInteger(f.data))W=this._getOrReturnCtx(f,W),u(W,{code:Z.invalid_type,expected:"integer",received:"float",message:Q.message}),J.dirty()}else if(Q.kind==="min"){if(Q.inclusive?f.data<Q.value:f.data<=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:Z.too_small,minimum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),J.dirty()}else if(Q.kind==="max"){if(Q.inclusive?f.data>Q.value:f.data>=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:Z.too_big,maximum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),J.dirty()}else if(Q.kind==="multipleOf"){if(x6(f.data,Q.value)!==0)W=this._getOrReturnCtx(f,W),u(W,{code:Z.not_multiple_of,multipleOf:Q.value,message:Q.message}),J.dirty()}else if(Q.kind==="finite"){if(!Number.isFinite(f.data))W=this._getOrReturnCtx(f,W),u(W,{code:Z.not_finite,message:Q.message}),J.dirty()}else Qv.assertNever(Q);return{status:J.value,value:f.data}}gte(f,v){return this.setLimit("min",f,!0,c.toString(v))}gt(f,v){return this.setLimit("min",f,!1,c.toString(v))}lte(f,v){return this.setLimit("max",f,!0,c.toString(v))}lt(f,v){return this.setLimit("max",f,!1,c.toString(v))}setLimit(f,v,W,J){return new Hf({...this._def,checks:[...this._def.checks,{kind:f,value:v,inclusive:W,message:c.toString(J)}]})}_addCheck(f){return new Hf({...this._def,checks:[...this._def.checks,f]})}int(f){return this._addCheck({kind:"int",message:c.toString(f)})}positive(f){return this._addCheck({kind:"min",value:0,inclusive:!1,message:c.toString(f)})}negative(f){return this._addCheck({kind:"max",value:0,inclusive:!1,message:c.toString(f)})}nonpositive(f){return this._addCheck({kind:"max",value:0,inclusive:!0,message:c.toString(f)})}nonnegative(f){return this._addCheck({kind:"min",value:0,inclusive:!0,message:c.toString(f)})}multipleOf(f,v){return this._addCheck({kind:"multipleOf",value:f,message:c.toString(v)})}finite(f){return this._addCheck({kind:"finite",message:c.toString(f)})}safe(f){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:c.toString(f)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:c.toString(f)})}get minValue(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxValue(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}get isInt(){return!!this._def.checks.find((f)=>f.kind==="int"||f.kind==="multipleOf"&&Qv.isInteger(f.value))}get isFinite(){let f=null,v=null;for(let W of this._def.checks)if(W.kind==="finite"||W.kind==="int"||W.kind==="multipleOf")return!0;else if(W.kind==="min"){if(v===null||W.value>v)v=W.value}else if(W.kind==="max"){if(f===null||W.value<f)f=W.value}return Number.isFinite(v)&&Number.isFinite(f)}}Hf.create=(f)=>{return new Hf({checks:[],typeName:C.ZodNumber,coerce:f?.coerce||!1,...t(f)})};class Ff extends vv{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(f){if(this._def.coerce)try{f.data=BigInt(f.data)}catch{return this._getInvalidInput(f)}if(this._getType(f)!==x.bigint)return this._getInvalidInput(f);let W=void 0,J=new hv;for(let Q of this._def.checks)if(Q.kind==="min"){if(Q.inclusive?f.data<Q.value:f.data<=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:Z.too_small,type:"bigint",minimum:Q.value,inclusive:Q.inclusive,message:Q.message}),J.dirty()}else if(Q.kind==="max"){if(Q.inclusive?f.data>Q.value:f.data>=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:Z.too_big,type:"bigint",maximum:Q.value,inclusive:Q.inclusive,message:Q.message}),J.dirty()}else if(Q.kind==="multipleOf"){if(f.data%Q.value!==BigInt(0))W=this._getOrReturnCtx(f,W),u(W,{code:Z.not_multiple_of,multipleOf:Q.value,message:Q.message}),J.dirty()}else Qv.assertNever(Q);return{status:J.value,value:f.data}}_getInvalidInput(f){let v=this._getOrReturnCtx(f);return u(v,{code:Z.invalid_type,expected:x.bigint,received:v.parsedType}),d}gte(f,v){return this.setLimit("min",f,!0,c.toString(v))}gt(f,v){return this.setLimit("min",f,!1,c.toString(v))}lte(f,v){return this.setLimit("max",f,!0,c.toString(v))}lt(f,v){return this.setLimit("max",f,!1,c.toString(v))}setLimit(f,v,W,J){return new Ff({...this._def,checks:[...this._def.checks,{kind:f,value:v,inclusive:W,message:c.toString(J)}]})}_addCheck(f){return new Ff({...this._def,checks:[...this._def.checks,f]})}positive(f){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:c.toString(f)})}negative(f){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:c.toString(f)})}nonpositive(f){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:c.toString(f)})}nonnegative(f){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:c.toString(f)})}multipleOf(f,v){return this._addCheck({kind:"multipleOf",value:f,message:c.toString(v)})}get minValue(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxValue(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}}Ff.create=(f)=>{return new Ff({checks:[],typeName:C.ZodBigInt,coerce:f?.coerce??!1,...t(f)})};class f1 extends vv{_parse(f){if(this._def.coerce)f.data=Boolean(f.data);if(this._getType(f)!==x.boolean){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.boolean,received:W.parsedType}),d}return kv(f.data)}}f1.create=(f)=>{return new f1({typeName:C.ZodBoolean,coerce:f?.coerce||!1,...t(f)})};class Zf extends vv{_parse(f){if(this._def.coerce)f.data=new Date(f.data);if(this._getType(f)!==x.date){let Q=this._getOrReturnCtx(f);return u(Q,{code:Z.invalid_type,expected:x.date,received:Q.parsedType}),d}if(Number.isNaN(f.data.getTime())){let Q=this._getOrReturnCtx(f);return u(Q,{code:Z.invalid_date}),d}let W=new hv,J=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if(f.data.getTime()<Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:Z.too_small,message:Q.message,inclusive:!0,exact:!1,minimum:Q.value,type:"date"}),W.dirty()}else if(Q.kind==="max"){if(f.data.getTime()>Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:Z.too_big,message:Q.message,inclusive:!0,exact:!1,maximum:Q.value,type:"date"}),W.dirty()}else Qv.assertNever(Q);return{status:W.value,value:new Date(f.data.getTime())}}_addCheck(f){return new Zf({...this._def,checks:[...this._def.checks,f]})}min(f,v){return this._addCheck({kind:"min",value:f.getTime(),message:c.toString(v)})}max(f,v){return this._addCheck({kind:"max",value:f.getTime(),message:c.toString(v)})}get minDate(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f!=null?new Date(f):null}get maxDate(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f!=null?new Date(f):null}}Zf.create=(f)=>{return new Zf({checks:[],coerce:f?.coerce||!1,typeName:C.ZodDate,...t(f)})};class E1 extends vv{_parse(f){if(this._getType(f)!==x.symbol){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.symbol,received:W.parsedType}),d}return kv(f.data)}}E1.create=(f)=>{return new E1({typeName:C.ZodSymbol,...t(f)})};class Q1 extends vv{_parse(f){if(this._getType(f)!==x.undefined){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.undefined,received:W.parsedType}),d}return kv(f.data)}}Q1.create=(f)=>{return new Q1({typeName:C.ZodUndefined,...t(f)})};class W1 extends vv{_parse(f){if(this._getType(f)!==x.null){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.null,received:W.parsedType}),d}return kv(f.data)}}W1.create=(f)=>{return new W1({typeName:C.ZodNull,...t(f)})};class Cf extends vv{constructor(){super(...arguments);this._any=!0}_parse(f){return kv(f.data)}}Cf.create=(f)=>{return new Cf({typeName:C.ZodAny,...t(f)})};class Uf extends vv{constructor(){super(...arguments);this._unknown=!0}_parse(f){return kv(f.data)}}Uf.create=(f)=>{return new Uf({typeName:C.ZodUnknown,...t(f)})};class Gf extends vv{_parse(f){let v=this._getOrReturnCtx(f);return u(v,{code:Z.invalid_type,expected:x.never,received:v.parsedType}),d}}Gf.create=(f)=>{return new Gf({typeName:C.ZodNever,...t(f)})};class O1 extends vv{_parse(f){if(this._getType(f)!==x.undefined){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.void,received:W.parsedType}),d}return kv(f.data)}}O1.create=(f)=>{return new O1({typeName:C.ZodVoid,...t(f)})};class ov extends vv{_parse(f){let{ctx:v,status:W}=this._processInputParams(f),J=this._def;if(v.parsedType!==x.array)return u(v,{code:Z.invalid_type,expected:x.array,received:v.parsedType}),d;if(J.exactLength!==null){let X=v.data.length>J.exactLength.value,Y=v.data.length<J.exactLength.value;if(X||Y)u(v,{code:X?Z.too_big:Z.too_small,minimum:Y?J.exactLength.value:void 0,maximum:X?J.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:J.exactLength.message}),W.dirty()}if(J.minLength!==null){if(v.data.length<J.minLength.value)u(v,{code:Z.too_small,minimum:J.minLength.value,type:"array",inclusive:!0,exact:!1,message:J.minLength.message}),W.dirty()}if(J.maxLength!==null){if(v.data.length>J.maxLength.value)u(v,{code:Z.too_big,maximum:J.maxLength.value,type:"array",inclusive:!0,exact:!1,message:J.maxLength.message}),W.dirty()}if(v.common.async)return Promise.all([...v.data].map((X,Y)=>{return J.type._parseAsync(new tv(v,X,v.path,Y))})).then((X)=>{return hv.mergeArray(W,X)});let Q=[...v.data].map((X,Y)=>{return J.type._parseSync(new tv(v,X,v.path,Y))});return hv.mergeArray(W,Q)}get element(){return this._def.type}min(f,v){return new ov({...this._def,minLength:{value:f,message:c.toString(v)}})}max(f,v){return new ov({...this._def,maxLength:{value:f,message:c.toString(v)}})}length(f,v){return new ov({...this._def,exactLength:{value:f,message:c.toString(v)}})}nonempty(f){return this.min(1,f)}}ov.create=(f,v)=>{return new ov({type:f,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...t(v)})};function ef(f){if(f instanceof Dv){let v={};for(let W in f.shape){let J=f.shape[W];v[W]=sv.create(ef(J))}return new Dv({...f._def,shape:()=>v})}else if(f instanceof ov)return new ov({...f._def,type:ef(f.element)});else if(f instanceof sv)return sv.create(ef(f.unwrap()));else if(f instanceof Vf)return Vf.create(ef(f.unwrap()));else if(f instanceof Bf)return Bf.create(f.items.map((v)=>ef(v)));else return f}class Dv extends vv{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let f=this._def.shape(),v=Qv.objectKeys(f);return this._cached={shape:f,keys:v},this._cached}_parse(f){if(this._getType(f)!==x.object){let B=this._getOrReturnCtx(f);return u(B,{code:Z.invalid_type,expected:x.object,received:B.parsedType}),d}let{status:W,ctx:J}=this._processInputParams(f),{shape:Q,keys:X}=this._getCached(),Y=[];if(!(this._def.catchall instanceof Gf&&this._def.unknownKeys==="strip")){for(let B in J.data)if(!X.includes(B))Y.push(B)}let w=[];for(let B of X){let z=Q[B],K=J.data[B];w.push({key:{status:"valid",value:B},value:z._parse(new tv(J,K,J.path,B)),alwaysSet:B in J.data})}if(this._def.catchall instanceof Gf){let B=this._def.unknownKeys;if(B==="passthrough")for(let z of Y)w.push({key:{status:"valid",value:z},value:{status:"valid",value:J.data[z]}});else if(B==="strict"){if(Y.length>0)u(J,{code:Z.unrecognized_keys,keys:Y}),W.dirty()}else if(B==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let B=this._def.catchall;for(let z of Y){let K=J.data[z];w.push({key:{status:"valid",value:z},value:B._parse(new tv(J,K,J.path,z)),alwaysSet:z in J.data})}}if(J.common.async)return Promise.resolve().then(async()=>{let B=[];for(let z of w){let K=await z.key,L=await z.value;B.push({key:K,value:L,alwaysSet:z.alwaysSet})}return B}).then((B)=>{return hv.mergeObjectSync(W,B)});else return hv.mergeObjectSync(W,w)}get shape(){return this._def.shape()}strict(f){return c.errToObj,new Dv({...this._def,unknownKeys:"strict",...f!==void 0?{errorMap:(v,W)=>{let J=this._def.errorMap?.(v,W).message??W.defaultError;if(v.code==="unrecognized_keys")return{message:c.errToObj(f).message??J};return{message:J}}}:{}})}strip(){return new Dv({...this._def,unknownKeys:"strip"})}passthrough(){return new Dv({...this._def,unknownKeys:"passthrough"})}extend(f){return new Dv({...this._def,shape:()=>({...this._def.shape(),...f})})}merge(f){return new Dv({unknownKeys:f._def.unknownKeys,catchall:f._def.catchall,shape:()=>({...this._def.shape(),...f._def.shape()}),typeName:C.ZodObject})}setKey(f,v){return this.augment({[f]:v})}catchall(f){return new Dv({...this._def,catchall:f})}pick(f){let v={};for(let W of Qv.objectKeys(f))if(f[W]&&this.shape[W])v[W]=this.shape[W];return new Dv({...this._def,shape:()=>v})}omit(f){let v={};for(let W of Qv.objectKeys(this.shape))if(!f[W])v[W]=this.shape[W];return new Dv({...this._def,shape:()=>v})}deepPartial(){return ef(this)}partial(f){let v={};for(let W of Qv.objectKeys(this.shape)){let J=this.shape[W];if(f&&!f[W])v[W]=J;else v[W]=J.optional()}return new Dv({...this._def,shape:()=>v})}required(f){let v={};for(let W of Qv.objectKeys(this.shape))if(f&&!f[W])v[W]=this.shape[W];else{let Q=this.shape[W];while(Q instanceof sv)Q=Q._def.innerType;v[W]=Q}return new Dv({...this._def,shape:()=>v})}keyof(){return w8(Qv.objectKeys(this.shape))}}Dv.create=(f,v)=>{return new Dv({shape:()=>f,unknownKeys:"strip",catchall:Gf.create(),typeName:C.ZodObject,...t(v)})};Dv.strictCreate=(f,v)=>{return new Dv({shape:()=>f,unknownKeys:"strict",catchall:Gf.create(),typeName:C.ZodObject,...t(v)})};Dv.lazycreate=(f,v)=>{return new Dv({shape:f,unknownKeys:"strip",catchall:Gf.create(),typeName:C.ZodObject,...t(v)})};class J1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=this._def.options;function J(Q){for(let Y of Q)if(Y.result.status==="valid")return Y.result;for(let Y of Q)if(Y.result.status==="dirty")return v.common.issues.push(...Y.ctx.common.issues),Y.result;let X=Q.map((Y)=>new Cv(Y.ctx.common.issues));return u(v,{code:Z.invalid_union,unionErrors:X}),d}if(v.common.async)return Promise.all(W.map(async(Q)=>{let X={...v,common:{...v.common,issues:[]},parent:null};return{result:await Q._parseAsync({data:v.data,path:v.path,parent:X}),ctx:X}})).then(J);else{let Q=void 0,X=[];for(let w of W){let B={...v,common:{...v.common,issues:[]},parent:null},z=w._parseSync({data:v.data,path:v.path,parent:B});if(z.status==="valid")return z;else if(z.status==="dirty"&&!Q)Q={result:z,ctx:B};if(B.common.issues.length)X.push(B.common.issues)}if(Q)return v.common.issues.push(...Q.ctx.common.issues),Q.result;let Y=X.map((w)=>new Cv(w));return u(v,{code:Z.invalid_union,unionErrors:Y}),d}}get options(){return this._def.options}}J1.create=(f,v)=>{return new J1({options:f,typeName:C.ZodUnion,...t(v)})};var Nf=(f)=>{if(f instanceof Y1)return Nf(f.schema);else if(f instanceof ev)return Nf(f.innerType());else if(f instanceof w1)return[f.value];else if(f instanceof Af)return f.options;else if(f instanceof G1)return Qv.objectValues(f.enum);else if(f instanceof B1)return Nf(f._def.innerType);else if(f instanceof Q1)return[void 0];else if(f instanceof W1)return[null];else if(f instanceof sv)return[void 0,...Nf(f.unwrap())];else if(f instanceof Vf)return[null,...Nf(f.unwrap())];else if(f instanceof u1)return Nf(f.unwrap());else if(f instanceof P1)return Nf(f.unwrap());else if(f instanceof q1)return Nf(f._def.innerType);else return[]};class x1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==x.object)return u(v,{code:Z.invalid_type,expected:x.object,received:v.parsedType}),d;let W=this.discriminator,J=v.data[W],Q=this.optionsMap.get(J);if(!Q)return u(v,{code:Z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[W]}),d;if(v.common.async)return Q._parseAsync({data:v.data,path:v.path,parent:v});else return Q._parseSync({data:v.data,path:v.path,parent:v})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(f,v,W){let J=new Map;for(let Q of v){let X=Nf(Q.shape[f]);if(!X.length)throw new Error(`A discriminator value for key \`${f}\` could not be extracted from all schema options`);for(let Y of X){if(J.has(Y))throw new Error(`Discriminator property ${String(f)} has duplicate value ${String(Y)}`);J.set(Y,Q)}}return new x1({typeName:C.ZodDiscriminatedUnion,discriminator:f,options:v,optionsMap:J,...t(W)})}}function xQ(f,v){let W=wf(f),J=wf(v);if(f===v)return{valid:!0,data:f};else if(W===x.object&&J===x.object){let Q=Qv.objectKeys(v),X=Qv.objectKeys(f).filter((w)=>Q.indexOf(w)!==-1),Y={...f,...v};for(let w of X){let B=xQ(f[w],v[w]);if(!B.valid)return{valid:!1};Y[w]=B.data}return{valid:!0,data:Y}}else if(W===x.array&&J===x.array){if(f.length!==v.length)return{valid:!1};let Q=[];for(let X=0;X<f.length;X++){let Y=f[X],w=v[X],B=xQ(Y,w);if(!B.valid)return{valid:!1};Q.push(B.data)}return{valid:!0,data:Q}}else if(W===x.date&&J===x.date&&+f===+v)return{valid:!0,data:f};else return{valid:!1}}class X1 extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f),J=(Q,X)=>{if(C1(Q)||C1(X))return d;let Y=xQ(Q.value,X.value);if(!Y.valid)return u(W,{code:Z.invalid_intersection_types}),d;if(T1(Q)||T1(X))v.dirty();return{status:v.value,value:Y.data}};if(W.common.async)return Promise.all([this._def.left._parseAsync({data:W.data,path:W.path,parent:W}),this._def.right._parseAsync({data:W.data,path:W.path,parent:W})]).then(([Q,X])=>J(Q,X));else return J(this._def.left._parseSync({data:W.data,path:W.path,parent:W}),this._def.right._parseSync({data:W.data,path:W.path,parent:W}))}}X1.create=(f,v,W)=>{return new X1({left:f,right:v,typeName:C.ZodIntersection,...t(W)})};class Bf extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.array)return u(W,{code:Z.invalid_type,expected:x.array,received:W.parsedType}),d;if(W.data.length<this._def.items.length)return u(W,{code:Z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),d;if(!this._def.rest&&W.data.length>this._def.items.length)u(W,{code:Z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v.dirty();let Q=[...W.data].map((X,Y)=>{let w=this._def.items[Y]||this._def.rest;if(!w)return null;return w._parse(new tv(W,X,W.path,Y))}).filter((X)=>!!X);if(W.common.async)return Promise.all(Q).then((X)=>{return hv.mergeArray(v,X)});else return hv.mergeArray(v,Q)}get items(){return this._def.items}rest(f){return new Bf({...this._def,rest:f})}}Bf.create=(f,v)=>{if(!Array.isArray(f))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Bf({items:f,typeName:C.ZodTuple,rest:null,...t(v)})};class U1 extends vv{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.object)return u(W,{code:Z.invalid_type,expected:x.object,received:W.parsedType}),d;let J=[],Q=this._def.keyType,X=this._def.valueType;for(let Y in W.data)J.push({key:Q._parse(new tv(W,Y,W.path,Y)),value:X._parse(new tv(W,W.data[Y],W.path,Y)),alwaysSet:Y in W.data});if(W.common.async)return hv.mergeObjectAsync(v,J);else return hv.mergeObjectSync(v,J)}get element(){return this._def.valueType}static create(f,v,W){if(v instanceof vv)return new U1({keyType:f,valueType:v,typeName:C.ZodRecord,...t(W)});return new U1({keyType:dv.create(),valueType:f,typeName:C.ZodRecord,...t(v)})}}class H1 extends vv{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.map)return u(W,{code:Z.invalid_type,expected:x.map,received:W.parsedType}),d;let J=this._def.keyType,Q=this._def.valueType,X=[...W.data.entries()].map(([Y,w],B)=>{return{key:J._parse(new tv(W,Y,W.path,[B,"key"])),value:Q._parse(new tv(W,w,W.path,[B,"value"]))}});if(W.common.async){let Y=new Map;return Promise.resolve().then(async()=>{for(let w of X){let B=await w.key,z=await w.value;if(B.status==="aborted"||z.status==="aborted")return d;if(B.status==="dirty"||z.status==="dirty")v.dirty();Y.set(B.value,z.value)}return{status:v.value,value:Y}})}else{let Y=new Map;for(let w of X){let{key:B,value:z}=w;if(B.status==="aborted"||z.status==="aborted")return d;if(B.status==="dirty"||z.status==="dirty")v.dirty();Y.set(B.value,z.value)}return{status:v.value,value:Y}}}}H1.create=(f,v,W)=>{return new H1({valueType:v,keyType:f,typeName:C.ZodMap,...t(W)})};class Tf extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.set)return u(W,{code:Z.invalid_type,expected:x.set,received:W.parsedType}),d;let J=this._def;if(J.minSize!==null){if(W.data.size<J.minSize.value)u(W,{code:Z.too_small,minimum:J.minSize.value,type:"set",inclusive:!0,exact:!1,message:J.minSize.message}),v.dirty()}if(J.maxSize!==null){if(W.data.size>J.maxSize.value)u(W,{code:Z.too_big,maximum:J.maxSize.value,type:"set",inclusive:!0,exact:!1,message:J.maxSize.message}),v.dirty()}let Q=this._def.valueType;function X(w){let B=new Set;for(let z of w){if(z.status==="aborted")return d;if(z.status==="dirty")v.dirty();B.add(z.value)}return{status:v.value,value:B}}let Y=[...W.data.values()].map((w,B)=>Q._parse(new tv(W,w,W.path,B)));if(W.common.async)return Promise.all(Y).then((w)=>X(w));else return X(Y)}min(f,v){return new Tf({...this._def,minSize:{value:f,message:c.toString(v)}})}max(f,v){return new Tf({...this._def,maxSize:{value:f,message:c.toString(v)}})}size(f,v){return this.min(f,v).max(f,v)}nonempty(f){return this.min(1,f)}}Tf.create=(f,v)=>{return new Tf({valueType:f,minSize:null,maxSize:null,typeName:C.ZodSet,...t(v)})};class v1 extends vv{constructor(){super(...arguments);this.validate=this.implement}_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==x.function)return u(v,{code:Z.invalid_type,expected:x.function,received:v.parsedType}),d;function W(Y,w){return j1({data:Y,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,sf(),Mf].filter((B)=>!!B),issueData:{code:Z.invalid_arguments,argumentsError:w}})}function J(Y,w){return j1({data:Y,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,sf(),Mf].filter((B)=>!!B),issueData:{code:Z.invalid_return_type,returnTypeError:w}})}let Q={errorMap:v.common.contextualErrorMap},X=v.data;if(this._def.returns instanceof xf){let Y=this;return kv(async function(...w){let B=new Cv([]),z=await Y._def.args.parseAsync(w,Q).catch((V)=>{throw B.addIssue(W(w,V)),B}),K=await Reflect.apply(X,this,z);return await Y._def.returns._def.type.parseAsync(K,Q).catch((V)=>{throw B.addIssue(J(K,V)),B})})}else{let Y=this;return kv(function(...w){let B=Y._def.args.safeParse(w,Q);if(!B.success)throw new Cv([W(w,B.error)]);let z=Reflect.apply(X,this,B.data),K=Y._def.returns.safeParse(z,Q);if(!K.success)throw new Cv([J(z,K.error)]);return K.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...f){return new v1({...this._def,args:Bf.create(f).rest(Uf.create())})}returns(f){return new v1({...this._def,returns:f})}implement(f){return this.parse(f)}strictImplement(f){return this.parse(f)}static create(f,v,W){return new v1({args:f?f:Bf.create([]).rest(Uf.create()),returns:v||Uf.create(),typeName:C.ZodFunction,...t(W)})}}class Y1 extends vv{get schema(){return this._def.getter()}_parse(f){let{ctx:v}=this._processInputParams(f);return this._def.getter()._parse({data:v.data,path:v.path,parent:v})}}Y1.create=(f,v)=>{return new Y1({getter:f,typeName:C.ZodLazy,...t(v)})};class w1 extends vv{_parse(f){if(f.data!==this._def.value){let v=this._getOrReturnCtx(f);return u(v,{received:v.data,code:Z.invalid_literal,expected:this._def.value}),d}return{status:"valid",value:f.data}}get value(){return this._def.value}}w1.create=(f,v)=>{return new w1({value:f,typeName:C.ZodLiteral,...t(v)})};function w8(f,v){return new Af({values:f,typeName:C.ZodEnum,...t(v)})}class Af extends vv{_parse(f){if(typeof f.data!=="string"){let v=this._getOrReturnCtx(f),W=this._def.values;return u(v,{expected:Qv.joinValues(W),received:v.parsedType,code:Z.invalid_type}),d}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(f.data)){let v=this._getOrReturnCtx(f),W=this._def.values;return u(v,{received:v.data,code:Z.invalid_enum_value,options:W}),d}return kv(f.data)}get options(){return this._def.values}get enum(){let f={};for(let v of this._def.values)f[v]=v;return f}get Values(){let f={};for(let v of this._def.values)f[v]=v;return f}get Enum(){let f={};for(let v of this._def.values)f[v]=v;return f}extract(f,v=this._def){return Af.create(f,{...this._def,...v})}exclude(f,v=this._def){return Af.create(this.options.filter((W)=>!f.includes(W)),{...this._def,...v})}}Af.create=w8;class G1 extends vv{_parse(f){let v=Qv.getValidEnumValues(this._def.values),W=this._getOrReturnCtx(f);if(W.parsedType!==x.string&&W.parsedType!==x.number){let J=Qv.objectValues(v);return u(W,{expected:Qv.joinValues(J),received:W.parsedType,code:Z.invalid_type}),d}if(!this._cache)this._cache=new Set(Qv.getValidEnumValues(this._def.values));if(!this._cache.has(f.data)){let J=Qv.objectValues(v);return u(W,{received:W.data,code:Z.invalid_enum_value,options:J}),d}return kv(f.data)}get enum(){return this._def.values}}G1.create=(f,v)=>{return new G1({values:f,typeName:C.ZodNativeEnum,...t(v)})};class xf extends vv{unwrap(){return this._def.type}_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==x.promise&&v.common.async===!1)return u(v,{code:Z.invalid_type,expected:x.promise,received:v.parsedType}),d;let W=v.parsedType===x.promise?v.data:Promise.resolve(v.data);return kv(W.then((J)=>{return this._def.type.parseAsync(J,{path:v.path,errorMap:v.common.contextualErrorMap})}))}}xf.create=(f,v)=>{return new xf({type:f,typeName:C.ZodPromise,...t(v)})};class ev extends vv{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(f){let{status:v,ctx:W}=this._processInputParams(f),J=this._def.effect||null,Q={addIssue:(X)=>{if(u(W,X),X.fatal)v.abort();else v.dirty()},get path(){return W.path}};if(Q.addIssue=Q.addIssue.bind(Q),J.type==="preprocess"){let X=J.transform(W.data,Q);if(W.common.async)return Promise.resolve(X).then(async(Y)=>{if(v.value==="aborted")return d;let w=await this._def.schema._parseAsync({data:Y,path:W.path,parent:W});if(w.status==="aborted")return d;if(w.status==="dirty")return If(w.value);if(v.value==="dirty")return If(w.value);return w});else{if(v.value==="aborted")return d;let Y=this._def.schema._parseSync({data:X,path:W.path,parent:W});if(Y.status==="aborted")return d;if(Y.status==="dirty")return If(Y.value);if(v.value==="dirty")return If(Y.value);return Y}}if(J.type==="refinement"){let X=(Y)=>{let w=J.refinement(Y,Q);if(W.common.async)return Promise.resolve(w);if(w instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Y};if(W.common.async===!1){let Y=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(Y.status==="aborted")return d;if(Y.status==="dirty")v.dirty();return X(Y.value),{status:v.value,value:Y.value}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((Y)=>{if(Y.status==="aborted")return d;if(Y.status==="dirty")v.dirty();return X(Y.value).then(()=>{return{status:v.value,value:Y.value}})})}if(J.type==="transform")if(W.common.async===!1){let X=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(!Of(X))return d;let Y=J.transform(X.value,Q);if(Y instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:v.value,value:Y}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((X)=>{if(!Of(X))return d;return Promise.resolve(J.transform(X.value,Q)).then((Y)=>({status:v.value,value:Y}))});Qv.assertNever(J)}}ev.create=(f,v,W)=>{return new ev({schema:f,typeName:C.ZodEffects,effect:v,...t(W)})};ev.createWithPreprocess=(f,v,W)=>{return new ev({schema:v,effect:{type:"preprocess",transform:f},typeName:C.ZodEffects,...t(W)})};class sv extends vv{_parse(f){if(this._getType(f)===x.undefined)return kv(void 0);return this._def.innerType._parse(f)}unwrap(){return this._def.innerType}}sv.create=(f,v)=>{return new sv({innerType:f,typeName:C.ZodOptional,...t(v)})};class Vf extends vv{_parse(f){if(this._getType(f)===x.null)return kv(null);return this._def.innerType._parse(f)}unwrap(){return this._def.innerType}}Vf.create=(f,v)=>{return new Vf({innerType:f,typeName:C.ZodNullable,...t(v)})};class B1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;if(v.parsedType===x.undefined)W=this._def.defaultValue();return this._def.innerType._parse({data:W,path:v.path,parent:v})}removeDefault(){return this._def.innerType}}B1.create=(f,v)=>{return new B1({innerType:f,typeName:C.ZodDefault,defaultValue:typeof v.default==="function"?v.default:()=>v.default,...t(v)})};class q1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W={...v,common:{...v.common,issues:[]}},J=this._def.innerType._parse({data:W.data,path:W.path,parent:{...W}});if(tf(J))return J.then((Q)=>{return{status:"valid",value:Q.status==="valid"?Q.value:this._def.catchValue({get error(){return new Cv(W.common.issues)},input:W.data})}});else return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new Cv(W.common.issues)},input:W.data})}}removeCatch(){return this._def.innerType}}q1.create=(f,v)=>{return new q1({innerType:f,typeName:C.ZodCatch,catchValue:typeof v.catch==="function"?v.catch:()=>v.catch,...t(v)})};class F1 extends vv{_parse(f){if(this._getType(f)!==x.nan){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.nan,received:W.parsedType}),d}return{status:"valid",value:f.data}}}F1.create=(f)=>{return new F1({typeName:C.ZodNaN,...t(f)})};var u6=Symbol("zod_brand");class u1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;return this._def.type._parse({data:W,path:v.path,parent:v})}unwrap(){return this._def.type}}class A1 extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.common.async)return(async()=>{let Q=await this._def.in._parseAsync({data:W.data,path:W.path,parent:W});if(Q.status==="aborted")return d;if(Q.status==="dirty")return v.dirty(),If(Q.value);else return this._def.out._parseAsync({data:Q.value,path:W.path,parent:W})})();else{let J=this._def.in._parseSync({data:W.data,path:W.path,parent:W});if(J.status==="aborted")return d;if(J.status==="dirty")return v.dirty(),{status:"dirty",value:J.value};else return this._def.out._parseSync({data:J.value,path:W.path,parent:W})}}static create(f,v){return new A1({in:f,out:v,typeName:C.ZodPipeline})}}class P1 extends vv{_parse(f){let v=this._def.innerType._parse(f),W=(J)=>{if(Of(J))J.value=Object.freeze(J.value);return J};return tf(v)?v.then((J)=>W(J)):W(v)}unwrap(){return this._def.innerType}}P1.create=(f,v)=>{return new P1({innerType:f,typeName:C.ZodReadonly,...t(v)})};function W8(f,v){let W=typeof f==="function"?f(v):typeof f==="string"?{message:f}:f;return typeof W==="string"?{message:W}:W}function G8(f,v={},W){if(f)return Cf.create().superRefine((J,Q)=>{let X=f(J);if(X instanceof Promise)return X.then((Y)=>{if(!Y){let w=W8(v,J),B=w.fatal??W??!0;Q.addIssue({code:"custom",...w,fatal:B})}});if(!X){let Y=W8(v,J),w=Y.fatal??W??!0;Q.addIssue({code:"custom",...Y,fatal:w})}return});return Cf.create()}var m6={object:Dv.lazycreate},C;(function(f){f.ZodString="ZodString",f.ZodNumber="ZodNumber",f.ZodNaN="ZodNaN",f.ZodBigInt="ZodBigInt",f.ZodBoolean="ZodBoolean",f.ZodDate="ZodDate",f.ZodSymbol="ZodSymbol",f.ZodUndefined="ZodUndefined",f.ZodNull="ZodNull",f.ZodAny="ZodAny",f.ZodUnknown="ZodUnknown",f.ZodNever="ZodNever",f.ZodVoid="ZodVoid",f.ZodArray="ZodArray",f.ZodObject="ZodObject",f.ZodUnion="ZodUnion",f.ZodDiscriminatedUnion="ZodDiscriminatedUnion",f.ZodIntersection="ZodIntersection",f.ZodTuple="ZodTuple",f.ZodRecord="ZodRecord",f.ZodMap="ZodMap",f.ZodSet="ZodSet",f.ZodFunction="ZodFunction",f.ZodLazy="ZodLazy",f.ZodLiteral="ZodLiteral",f.ZodEnum="ZodEnum",f.ZodEffects="ZodEffects",f.ZodNativeEnum="ZodNativeEnum",f.ZodOptional="ZodOptional",f.ZodNullable="ZodNullable",f.ZodDefault="ZodDefault",f.ZodCatch="ZodCatch",f.ZodPromise="ZodPromise",f.ZodBranded="ZodBranded",f.ZodPipeline="ZodPipeline",f.ZodReadonly="ZodReadonly"})(C||(C={}));var r6=(f,v={message:`Input not instance of ${f.name}`})=>G8((W)=>W instanceof f,v),B8=dv.create,q8=Hf.create,a6=F1.create,c6=Ff.create,P8=f1.create,n6=Zf.create,p6=E1.create,i6=Q1.create,d6=W1.create,o6=Cf.create,s6=Uf.create,t6=Gf.create,e6=O1.create,v5=ov.create,f5=Dv.create,Q5=Dv.strictCreate,W5=J1.create,J5=x1.create,X5=X1.create,Y5=Bf.create,w5=U1.create,G5=H1.create,B5=Tf.create,q5=v1.create,P5=Y1.create,K5=w1.create,z5=Af.create,$5=G1.create,L5=xf.create,M5=ev.create,N5=sv.create,V5=Vf.create,D5=ev.createWithPreprocess,j5=A1.create,E5=()=>B8().optional(),O5=()=>q8().optional(),U5=()=>P8().optional(),H5={string:(f)=>dv.create({...f,coerce:!0}),number:(f)=>Hf.create({...f,coerce:!0}),boolean:(f)=>f1.create({...f,coerce:!0}),bigint:(f)=>Ff.create({...f,coerce:!0}),date:(f)=>Zf.create({...f,coerce:!0})};var F5=d;var uQ="2025-06-18";var K8=[uQ,"2025-03-26","2024-11-05","2024-10-07"],m1="2.0",z8=G.union([G.string(),G.number().int()]),$8=G.string(),A5=G.object({progressToken:G.optional(z8)}).passthrough(),nv=G.object({_meta:G.optional(A5)}).passthrough(),Tv=G.object({method:G.string(),params:G.optional(nv)}),g1=G.object({_meta:G.optional(G.object({}).passthrough())}).passthrough(),qf=G.object({method:G.string(),params:G.optional(g1)}),pv=G.object({_meta:G.optional(G.object({}).passthrough())}).passthrough(),r1=G.union([G.string(),G.number().int()]),L8=G.object({jsonrpc:G.literal(m1),id:r1}).merge(Tv).strict(),M8=(f)=>L8.safeParse(f).success,N8=G.object({jsonrpc:G.literal(m1)}).merge(qf).strict(),V8=(f)=>N8.safeParse(f).success,D8=G.object({jsonrpc:G.literal(m1),id:r1,result:pv}).strict(),mQ=(f)=>D8.safeParse(f).success,Kv;(function(f){f[f.ConnectionClosed=-32000]="ConnectionClosed",f[f.RequestTimeout=-32001]="RequestTimeout",f[f.ParseError=-32700]="ParseError",f[f.InvalidRequest=-32600]="InvalidRequest",f[f.MethodNotFound=-32601]="MethodNotFound",f[f.InvalidParams=-32602]="InvalidParams",f[f.InternalError=-32603]="InternalError"})(Kv||(Kv={}));var j8=G.object({jsonrpc:G.literal(m1),id:r1,error:G.object({code:G.number().int(),message:G.string(),data:G.optional(G.unknown())})}).strict(),E8=(f)=>j8.safeParse(f).success,O8=G.union([L8,N8,D8,j8]),a1=pv.strict(),c1=qf.extend({method:G.literal("notifications/cancelled"),params:g1.extend({requestId:r1,reason:G.string().optional()})}),g5=G.object({src:G.string(),mimeType:G.optional(G.string()),sizes:G.optional(G.array(G.string()))}).passthrough(),_1=G.object({icons:G.array(g5).optional()}).passthrough(),h1=G.object({name:G.string(),title:G.optional(G.string())}).passthrough(),U8=h1.extend({version:G.string(),websiteUrl:G.optional(G.string())}).merge(_1),_5=G.object({experimental:G.optional(G.object({}).passthrough()),sampling:G.optional(G.object({}).passthrough()),elicitation:G.optional(G.object({}).passthrough()),roots:G.optional(G.object({listChanged:G.optional(G.boolean())}).passthrough())}).passthrough(),rQ=Tv.extend({method:G.literal("initialize"),params:nv.extend({protocolVersion:G.string(),capabilities:_5,clientInfo:U8})});var h5=G.object({experimental:G.optional(G.object({}).passthrough()),logging:G.optional(G.object({}).passthrough()),completions:G.optional(G.object({}).passthrough()),prompts:G.optional(G.object({listChanged:G.optional(G.boolean())}).passthrough()),resources:G.optional(G.object({subscribe:G.optional(G.boolean()),listChanged:G.optional(G.boolean())}).passthrough()),tools:G.optional(G.object({listChanged:G.optional(G.boolean())}).passthrough())}).passthrough(),b5=pv.extend({protocolVersion:G.string(),capabilities:h5,serverInfo:U8,instructions:G.optional(G.string())}),aQ=qf.extend({method:G.literal("notifications/initialized")});var n1=Tv.extend({method:G.literal("ping")}),R5=G.object({progress:G.number(),total:G.optional(G.number()),message:G.optional(G.string())}).passthrough(),p1=qf.extend({method:G.literal("notifications/progress"),params:g1.merge(R5).extend({progressToken:z8})}),i1=Tv.extend({params:nv.extend({cursor:G.optional($8)}).optional()}),d1=pv.extend({nextCursor:G.optional($8)}),H8=G.object({uri:G.string(),mimeType:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).passthrough(),F8=H8.extend({text:G.string()}),cQ=G.string().refine((f)=>{try{return atob(f),!0}catch(v){return!1}},{message:"Invalid Base64 string"}),A8=H8.extend({blob:cQ}),g8=h1.extend({uri:G.string(),description:G.optional(G.string()),mimeType:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).merge(_1),k5=h1.extend({uriTemplate:G.string(),description:G.optional(G.string()),mimeType:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).merge(_1),o1=i1.extend({method:G.literal("resources/list")}),S5=d1.extend({resources:G.array(g8)}),s1=i1.extend({method:G.literal("resources/templates/list")}),y5=d1.extend({resourceTemplates:G.array(k5)}),t1=Tv.extend({method:G.literal("resources/read"),params:nv.extend({uri:G.string()})}),l5=pv.extend({contents:G.array(G.union([F8,A8]))}),I5=qf.extend({method:G.literal("notifications/resources/list_changed")}),Z5=Tv.extend({method:G.literal("resources/subscribe"),params:nv.extend({uri:G.string()})}),C5=Tv.extend({method:G.literal("resources/unsubscribe"),params:nv.extend({uri:G.string()})}),T5=qf.extend({method:G.literal("notifications/resources/updated"),params:g1.extend({uri:G.string()})}),x5=G.object({name:G.string(),description:G.optional(G.string()),required:G.optional(G.boolean())}).passthrough(),u5=h1.extend({description:G.optional(G.string()),arguments:G.optional(G.array(x5)),_meta:G.optional(G.object({}).passthrough())}).merge(_1),e1=i1.extend({method:G.literal("prompts/list")}),m5=d1.extend({prompts:G.array(u5)}),vQ=Tv.extend({method:G.literal("prompts/get"),params:nv.extend({name:G.string(),arguments:G.optional(G.record(G.string()))})}),nQ=G.object({type:G.literal("text"),text:G.string(),_meta:G.optional(G.object({}).passthrough())}).passthrough(),pQ=G.object({type:G.literal("image"),data:cQ,mimeType:G.string(),_meta:G.optional(G.object({}).passthrough())}).passthrough(),iQ=G.object({type:G.literal("audio"),data:cQ,mimeType:G.string(),_meta:G.optional(G.object({}).passthrough())}).passthrough(),r5=G.object({type:G.literal("resource"),resource:G.union([F8,A8]),_meta:G.optional(G.object({}).passthrough())}).passthrough(),a5=g8.extend({type:G.literal("resource_link")}),_8=G.union([nQ,pQ,iQ,a5,r5]),c5=G.object({role:G.enum(["user","assistant"]),content:_8}).passthrough(),n5=pv.extend({description:G.optional(G.string()),messages:G.array(c5)}),p5=qf.extend({method:G.literal("notifications/prompts/list_changed")}),i5=G.object({title:G.optional(G.string()),readOnlyHint:G.optional(G.boolean()),destructiveHint:G.optional(G.boolean()),idempotentHint:G.optional(G.boolean()),openWorldHint:G.optional(G.boolean())}).passthrough(),d5=h1.extend({description:G.optional(G.string()),inputSchema:G.object({type:G.literal("object"),properties:G.optional(G.object({}).passthrough()),required:G.optional(G.array(G.string()))}).passthrough(),outputSchema:G.optional(G.object({type:G.literal("object"),properties:G.optional(G.object({}).passthrough()),required:G.optional(G.array(G.string()))}).passthrough()),annotations:G.optional(i5),_meta:G.optional(G.object({}).passthrough())}).merge(_1),fQ=i1.extend({method:G.literal("tools/list")}),o5=d1.extend({tools:G.array(d5)}),h8=pv.extend({content:G.array(_8).default([]),structuredContent:G.object({}).passthrough().optional(),isError:G.optional(G.boolean())}),c2=h8.or(pv.extend({toolResult:G.unknown()})),QQ=Tv.extend({method:G.literal("tools/call"),params:nv.extend({name:G.string(),arguments:G.optional(G.record(G.unknown()))})}),s5=qf.extend({method:G.literal("notifications/tools/list_changed")}),b1=G.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),dQ=Tv.extend({method:G.literal("logging/setLevel"),params:nv.extend({level:b1})}),t5=qf.extend({method:G.literal("notifications/message"),params:g1.extend({level:b1,logger:G.optional(G.string()),data:G.unknown()})}),e5=G.object({name:G.string().optional()}).passthrough(),vX=G.object({hints:G.optional(G.array(e5)),costPriority:G.optional(G.number().min(0).max(1)),speedPriority:G.optional(G.number().min(0).max(1)),intelligencePriority:G.optional(G.number().min(0).max(1))}).passthrough(),fX=G.object({role:G.enum(["user","assistant"]),content:G.union([nQ,pQ,iQ])}).passthrough(),QX=Tv.extend({method:G.literal("sampling/createMessage"),params:nv.extend({messages:G.array(fX),systemPrompt:G.optional(G.string()),includeContext:G.optional(G.enum(["none","thisServer","allServers"])),temperature:G.optional(G.number()),maxTokens:G.number().int(),stopSequences:G.optional(G.array(G.string())),metadata:G.optional(G.object({}).passthrough()),modelPreferences:G.optional(vX)})}),oQ=pv.extend({model:G.string(),stopReason:G.optional(G.enum(["endTurn","stopSequence","maxTokens"]).or(G.string())),role:G.enum(["user","assistant"]),content:G.discriminatedUnion("type",[nQ,pQ,iQ])}),WX=G.object({type:G.literal("boolean"),title:G.optional(G.string()),description:G.optional(G.string()),default:G.optional(G.boolean())}).passthrough(),JX=G.object({type:G.literal("string"),title:G.optional(G.string()),description:G.optional(G.string()),minLength:G.optional(G.number()),maxLength:G.optional(G.number()),format:G.optional(G.enum(["email","uri","date","date-time"]))}).passthrough(),XX=G.object({type:G.enum(["number","integer"]),title:G.optional(G.string()),description:G.optional(G.string()),minimum:G.optional(G.number()),maximum:G.optional(G.number())}).passthrough(),YX=G.object({type:G.literal("string"),title:G.optional(G.string()),description:G.optional(G.string()),enum:G.array(G.string()),enumNames:G.optional(G.array(G.string()))}).passthrough(),wX=G.union([WX,JX,XX,YX]),GX=Tv.extend({method:G.literal("elicitation/create"),params:nv.extend({message:G.string(),requestedSchema:G.object({type:G.literal("object"),properties:G.record(G.string(),wX),required:G.optional(G.array(G.string()))}).passthrough()})}),sQ=pv.extend({action:G.enum(["accept","decline","cancel"]),content:G.optional(G.record(G.string(),G.unknown()))}),BX=G.object({type:G.literal("ref/resource"),uri:G.string()}).passthrough();var qX=G.object({type:G.literal("ref/prompt"),name:G.string()}).passthrough(),WQ=Tv.extend({method:G.literal("completion/complete"),params:nv.extend({ref:G.union([qX,BX]),argument:G.object({name:G.string(),value:G.string()}).passthrough(),context:G.optional(G.object({arguments:G.optional(G.record(G.string(),G.string()))}))})}),PX=pv.extend({completion:G.object({values:G.array(G.string()).max(100),total:G.optional(G.number().int()),hasMore:G.optional(G.boolean())}).passthrough()}),KX=G.object({uri:G.string().startsWith("file://"),name:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).passthrough(),zX=Tv.extend({method:G.literal("roots/list")}),tQ=pv.extend({roots:G.array(KX)}),$X=qf.extend({method:G.literal("notifications/roots/list_changed")}),n2=G.union([n1,rQ,WQ,dQ,vQ,e1,o1,s1,t1,Z5,C5,QQ,fQ]),p2=G.union([c1,p1,aQ,$X]),i2=G.union([a1,oQ,sQ,tQ]),d2=G.union([n1,QX,GX,zX]),o2=G.union([c1,p1,t5,T5,I5,s5,p5]),s2=G.union([a1,b5,PX,n5,m5,S5,y5,l5,h8,o5]);class zv extends Error{constructor(f,v,W){super(`MCP error ${f}: ${v}`);this.code=f,this.data=W,this.name="McpError"}}var LX=60000;class eQ{constructor(f){this._options=f,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(c1,(v)=>{let W=this._requestHandlerAbortControllers.get(v.params.requestId);W===null||W===void 0||W.abort(v.params.reason)}),this.setNotificationHandler(p1,(v)=>{this._onprogress(v)}),this.setRequestHandler(n1,(v)=>({}))}_setupTimeout(f,v,W,J,Q=!1){this._timeoutInfo.set(f,{timeoutId:setTimeout(J,v),startTime:Date.now(),timeout:v,maxTotalTimeout:W,resetTimeoutOnProgress:Q,onTimeout:J})}_resetTimeout(f){let v=this._timeoutInfo.get(f);if(!v)return!1;let W=Date.now()-v.startTime;if(v.maxTotalTimeout&&W>=v.maxTotalTimeout)throw this._timeoutInfo.delete(f),new zv(Kv.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:v.maxTotalTimeout,totalElapsed:W});return clearTimeout(v.timeoutId),v.timeoutId=setTimeout(v.onTimeout,v.timeout),!0}_cleanupTimeout(f){let v=this._timeoutInfo.get(f);if(v)clearTimeout(v.timeoutId),this._timeoutInfo.delete(f)}async connect(f){var v,W,J;this._transport=f;let Q=(v=this.transport)===null||v===void 0?void 0:v.onclose;this._transport.onclose=()=>{Q===null||Q===void 0||Q(),this._onclose()};let X=(W=this.transport)===null||W===void 0?void 0:W.onerror;this._transport.onerror=(w)=>{X===null||X===void 0||X(w),this._onerror(w)};let Y=(J=this._transport)===null||J===void 0?void 0:J.onmessage;this._transport.onmessage=(w,B)=>{if(Y===null||Y===void 0||Y(w,B),mQ(w)||E8(w))this._onresponse(w);else if(M8(w))this._onrequest(w,B);else if(V8(w))this._onnotification(w);else this._onerror(new Error(`Unknown message type: ${JSON.stringify(w)}`))},await this._transport.start()}_onclose(){var f;let v=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(f=this.onclose)===null||f===void 0||f.call(this);let W=new zv(Kv.ConnectionClosed,"Connection closed");for(let J of v.values())J(W)}_onerror(f){var v;(v=this.onerror)===null||v===void 0||v.call(this,f)}_onnotification(f){var v;let W=(v=this._notificationHandlers.get(f.method))!==null&&v!==void 0?v:this.fallbackNotificationHandler;if(W===void 0)return;Promise.resolve().then(()=>W(f)).catch((J)=>this._onerror(new Error(`Uncaught error in notification handler: ${J}`)))}_onrequest(f,v){var W,J;let Q=(W=this._requestHandlers.get(f.method))!==null&&W!==void 0?W:this.fallbackRequestHandler,X=this._transport;if(Q===void 0){X===null||X===void 0||X.send({jsonrpc:"2.0",id:f.id,error:{code:Kv.MethodNotFound,message:"Method not found"}}).catch((B)=>this._onerror(new Error(`Failed to send an error response: ${B}`)));return}let Y=new AbortController;this._requestHandlerAbortControllers.set(f.id,Y);let w={signal:Y.signal,sessionId:X===null||X===void 0?void 0:X.sessionId,_meta:(J=f.params)===null||J===void 0?void 0:J._meta,sendNotification:(B)=>this.notification(B,{relatedRequestId:f.id}),sendRequest:(B,z,K)=>this.request(B,z,{...K,relatedRequestId:f.id}),authInfo:v===null||v===void 0?void 0:v.authInfo,requestId:f.id,requestInfo:v===null||v===void 0?void 0:v.requestInfo};Promise.resolve().then(()=>Q(f,w)).then((B)=>{if(Y.signal.aborted)return;return X===null||X===void 0?void 0:X.send({result:B,jsonrpc:"2.0",id:f.id})},(B)=>{var z;if(Y.signal.aborted)return;return X===null||X===void 0?void 0:X.send({jsonrpc:"2.0",id:f.id,error:{code:Number.isSafeInteger(B.code)?B.code:Kv.InternalError,message:(z=B.message)!==null&&z!==void 0?z:"Internal error"}})}).catch((B)=>this._onerror(new Error(`Failed to send response: ${B}`))).finally(()=>{this._requestHandlerAbortControllers.delete(f.id)})}_onprogress(f){let{progressToken:v,...W}=f.params,J=Number(v),Q=this._progressHandlers.get(J);if(!Q){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(f)}`));return}let X=this._responseHandlers.get(J),Y=this._timeoutInfo.get(J);if(Y&&X&&Y.resetTimeoutOnProgress)try{this._resetTimeout(J)}catch(w){X(w);return}Q(W)}_onresponse(f){let v=Number(f.id),W=this._responseHandlers.get(v);if(W===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(f)}`));return}if(this._responseHandlers.delete(v),this._progressHandlers.delete(v),this._cleanupTimeout(v),mQ(f))W(f);else{let J=new zv(f.error.code,f.error.message,f.error.data);W(J)}}get transport(){return this._transport}async close(){var f;await((f=this._transport)===null||f===void 0?void 0:f.close())}request(f,v,W){let{relatedRequestId:J,resumptionToken:Q,onresumptiontoken:X}=W!==null&&W!==void 0?W:{};return new Promise((Y,w)=>{var B,z,K,L,V,q;if(!this._transport){w(new Error("Not connected"));return}if(((B=this._options)===null||B===void 0?void 0:B.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod(f.method);(z=W===null||W===void 0?void 0:W.signal)===null||z===void 0||z.throwIfAborted();let M=this._requestMessageId++,N={...f,jsonrpc:"2.0",id:M};if(W===null||W===void 0?void 0:W.onprogress)this._progressHandlers.set(M,W.onprogress),N.params={...f.params,_meta:{...((K=f.params)===null||K===void 0?void 0:K._meta)||{},progressToken:M}};let $=(H)=>{var k;this._responseHandlers.delete(M),this._progressHandlers.delete(M),this._cleanupTimeout(M),(k=this._transport)===null||k===void 0||k.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:M,reason:String(H)}},{relatedRequestId:J,resumptionToken:Q,onresumptiontoken:X}).catch((l)=>this._onerror(new Error(`Failed to send cancellation: ${l}`))),w(H)};this._responseHandlers.set(M,(H)=>{var k;if((k=W===null||W===void 0?void 0:W.signal)===null||k===void 0?void 0:k.aborted)return;if(H instanceof Error)return w(H);try{let l=v.parse(H.result);Y(l)}catch(l){w(l)}}),(L=W===null||W===void 0?void 0:W.signal)===null||L===void 0||L.addEventListener("abort",()=>{var H;$((H=W===null||W===void 0?void 0:W.signal)===null||H===void 0?void 0:H.reason)});let O=(V=W===null||W===void 0?void 0:W.timeout)!==null&&V!==void 0?V:LX,h=()=>$(new zv(Kv.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(M,O,W===null||W===void 0?void 0:W.maxTotalTimeout,h,(q=W===null||W===void 0?void 0:W.resetTimeoutOnProgress)!==null&&q!==void 0?q:!1),this._transport.send(N,{relatedRequestId:J,resumptionToken:Q,onresumptiontoken:X}).catch((H)=>{this._cleanupTimeout(M),w(H)})})}async notification(f,v){var W,J;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(f.method),((J=(W=this._options)===null||W===void 0?void 0:W.debouncedNotificationMethods)!==null&&J!==void 0?J:[]).includes(f.method)&&!f.params&&!(v===null||v===void 0?void 0:v.relatedRequestId)){if(this._pendingDebouncedNotifications.has(f.method))return;this._pendingDebouncedNotifications.add(f.method),Promise.resolve().then(()=>{var w;if(this._pendingDebouncedNotifications.delete(f.method),!this._transport)return;let B={...f,jsonrpc:"2.0"};(w=this._transport)===null||w===void 0||w.send(B,v).catch((z)=>this._onerror(z))});return}let Y={...f,jsonrpc:"2.0"};await this._transport.send(Y,v)}setRequestHandler(f,v){let W=f.shape.method.value;this.assertRequestHandlerCapability(W),this._requestHandlers.set(W,(J,Q)=>{return Promise.resolve(v(f.parse(J),Q))})}removeRequestHandler(f){this._requestHandlers.delete(f)}assertCanSetRequestHandler(f){if(this._requestHandlers.has(f))throw new Error(`A request handler for ${f} already exists, which would be overridden`)}setNotificationHandler(f,v){this._notificationHandlers.set(f.shape.method.value,(W)=>Promise.resolve(v(f.parse(W))))}removeNotificationHandler(f){this._notificationHandlers.delete(f)}}function b8(f,v){return Object.entries(v).reduce((W,[J,Q])=>{if(Q&&typeof Q==="object")W[J]=W[J]?{...W[J],...Q}:Q;else W[J]=Q;return W},{...f})}var k9=L6(R9(),1);class H0 extends eQ{constructor(f,v){var W;super(v);if(this._serverInfo=f,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(b1.options.map((J,Q)=>[J,Q])),this.isMessageIgnored=(J,Q)=>{let X=this._loggingLevels.get(Q);return X?this.LOG_LEVEL_SEVERITY.get(J)<this.LOG_LEVEL_SEVERITY.get(X):!1},this._capabilities=(W=v===null||v===void 0?void 0:v.capabilities)!==null&&W!==void 0?W:{},this._instructions=v===null||v===void 0?void 0:v.instructions,this.setRequestHandler(rQ,(J)=>this._oninitialize(J)),this.setNotificationHandler(aQ,()=>{var J;return(J=this.oninitialized)===null||J===void 0?void 0:J.call(this)}),this._capabilities.logging)this.setRequestHandler(dQ,async(J,Q)=>{var X;let Y=Q.sessionId||((X=Q.requestInfo)===null||X===void 0?void 0:X.headers["mcp-session-id"])||void 0,{level:w}=J.params,B=b1.safeParse(w);if(B.success)this._loggingLevels.set(Y,B.data);return{}})}registerCapabilities(f){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=b8(this._capabilities,f)}assertCapabilityForMethod(f){var v,W,J;switch(f){case"sampling/createMessage":if(!((v=this._clientCapabilities)===null||v===void 0?void 0:v.sampling))throw new Error(`Client does not support sampling (required for ${f})`);break;case"elicitation/create":if(!((W=this._clientCapabilities)===null||W===void 0?void 0:W.elicitation))throw new Error(`Client does not support elicitation (required for ${f})`);break;case"roots/list":if(!((J=this._clientCapabilities)===null||J===void 0?void 0:J.roots))throw new Error(`Client does not support listing roots (required for ${f})`);break;case"ping":break}}assertNotificationCapability(f){switch(f){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${f})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${f})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${f})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${f})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(f){switch(f){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${f})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${f})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${f})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${f})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${f})`);break;case"ping":case"initialize":break}}async _oninitialize(f){let v=f.params.protocolVersion;return this._clientCapabilities=f.params.capabilities,this._clientVersion=f.params.clientInfo,{protocolVersion:K8.includes(v)?v:uQ,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},a1)}async createMessage(f,v){return this.request({method:"sampling/createMessage",params:f},oQ,v)}async elicitInput(f,v){let W=await this.request({method:"elicitation/create",params:f},sQ,v);if(W.action==="accept"&&W.content)try{let J=new k9.default,Q=J.compile(f.requestedSchema);if(!Q(W.content))throw new zv(Kv.InvalidParams,`Elicitation response content does not match requested schema: ${J.errorsText(Q.errors)}`)}catch(J){if(J instanceof zv)throw J;throw new zv(Kv.InternalError,`Error validating elicitation response: ${J}`)}return W}async listRoots(f,v){return this.request({method:"roots/list",params:f},tQ,v)}async sendLoggingMessage(f,v){if(this._capabilities.logging){if(!this.isMessageIgnored(f.level,v))return this.notification({method:"notifications/message",params:f})}}async sendResourceUpdated(f){return this.notification({method:"notifications/resources/updated",params:f})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var y9=Symbol("Let zodToJsonSchema decide on which parser to use");var S9={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},l9=(f)=>typeof f==="string"?{...S9,name:f}:{...S9,...f};var I9=(f)=>{let v=l9(f),W=v.name!==void 0?[...v.basePath,v.definitionPath,v.name]:v.basePath;return{...v,flags:{hasReferencedOpenAiAnyType:!1},currentPath:W,propertyPath:void 0,seen:new Map(Object.entries(v.definitions).map(([J,Q])=>[Q._def,{def:Q._def,path:[...v.basePath,v.definitionPath,J],jsonSchema:void 0}]))}};function F0(f,v,W,J){if(!J?.errorMessages)return;if(W)f.errorMessage={...f.errorMessage,[v]:W}}function Wv(f,v,W,J,Q){f[v]=W,F0(f,v,J,Q)}var OQ=(f,v)=>{let W=0;for(;W<f.length&&W<v.length;W++)if(f[W]!==v[W])break;return[(f.length-W).toString(),...v.slice(W)].join("/")};function Mv(f){if(f.target!=="openAi")return{};let v=[...f.basePath,f.definitionPath,f.openAiAnyTypeName];return f.flags.hasReferencedOpenAiAnyType=!0,{$ref:f.$refStrategy==="relative"?OQ(v,f.currentPath):v.join("/")}}function Z9(f,v){let W={type:"array"};if(f.type?._def&&f.type?._def?.typeName!==C.ZodAny)W.items=o(f.type._def,{...v,currentPath:[...v.currentPath,"items"]});if(f.minLength)Wv(W,"minItems",f.minLength.value,f.minLength.message,v);if(f.maxLength)Wv(W,"maxItems",f.maxLength.value,f.maxLength.message,v);if(f.exactLength)Wv(W,"minItems",f.exactLength.value,f.exactLength.message,v),Wv(W,"maxItems",f.exactLength.value,f.exactLength.message,v);return W}function C9(f,v){let W={type:"integer",format:"int64"};if(!f.checks)return W;for(let J of f.checks)switch(J.kind){case"min":if(v.target==="jsonSchema7")if(J.inclusive)Wv(W,"minimum",J.value,J.message,v);else Wv(W,"exclusiveMinimum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMinimum=!0;Wv(W,"minimum",J.value,J.message,v)}break;case"max":if(v.target==="jsonSchema7")if(J.inclusive)Wv(W,"maximum",J.value,J.message,v);else Wv(W,"exclusiveMaximum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMaximum=!0;Wv(W,"maximum",J.value,J.message,v)}break;case"multipleOf":Wv(W,"multipleOf",J.value,J.message,v);break}return W}function T9(){return{type:"boolean"}}function UQ(f,v){return o(f.type._def,v)}var x9=(f,v)=>{return o(f.innerType._def,v)};function A0(f,v,W){let J=W??v.dateStrategy;if(Array.isArray(J))return{anyOf:J.map((Q,X)=>A0(f,v,Q))};switch(J){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return iY(f,v)}}var iY=(f,v)=>{let W={type:"integer",format:"unix-time"};if(v.target==="openApi3")return W;for(let J of f.checks)switch(J.kind){case"min":Wv(W,"minimum",J.value,J.message,v);break;case"max":Wv(W,"maximum",J.value,J.message,v);break}return W};function u9(f,v){return{...o(f.innerType._def,v),default:f.defaultValue()}}function m9(f,v){return v.effectStrategy==="input"?o(f.schema._def,v):Mv(v)}function r9(f){return{type:"string",enum:Array.from(f.values)}}var dY=(f)=>{if("type"in f&&f.type==="string")return!1;return"allOf"in f};function a9(f,v){let W=[o(f.left._def,{...v,currentPath:[...v.currentPath,"allOf","0"]}),o(f.right._def,{...v,currentPath:[...v.currentPath,"allOf","1"]})].filter((X)=>!!X),J=v.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,Q=[];return W.forEach((X)=>{if(dY(X)){if(Q.push(...X.allOf),X.unevaluatedProperties===void 0)J=void 0}else{let Y=X;if("additionalProperties"in X&&X.additionalProperties===!1){let{additionalProperties:w,...B}=X;Y=B}else J=void 0;Q.push(Y)}}),Q.length?{allOf:Q,...J}:void 0}function c9(f,v){let W=typeof f.value;if(W!=="bigint"&&W!=="number"&&W!=="boolean"&&W!=="string")return{type:Array.isArray(f.value)?"array":"object"};if(v.target==="openApi3")return{type:W==="bigint"?"integer":W,enum:[f.value]};return{type:W==="bigint"?"integer":W,const:f.value}}var g0=void 0,vf={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(g0===void 0)g0=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return g0},uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function HQ(f,v){let W={type:"string"};if(f.checks)for(let J of f.checks)switch(J.kind){case"min":Wv(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,J.value):J.value,J.message,v);break;case"max":Wv(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,J.value):J.value,J.message,v);break;case"email":switch(v.emailStrategy){case"format:email":ff(W,"email",J.message,v);break;case"format:idn-email":ff(W,"idn-email",J.message,v);break;case"pattern:zod":Iv(W,vf.email,J.message,v);break}break;case"url":ff(W,"uri",J.message,v);break;case"uuid":ff(W,"uuid",J.message,v);break;case"regex":Iv(W,J.regex,J.message,v);break;case"cuid":Iv(W,vf.cuid,J.message,v);break;case"cuid2":Iv(W,vf.cuid2,J.message,v);break;case"startsWith":Iv(W,RegExp(`^${_0(J.value,v)}`),J.message,v);break;case"endsWith":Iv(W,RegExp(`${_0(J.value,v)}$`),J.message,v);break;case"datetime":ff(W,"date-time",J.message,v);break;case"date":ff(W,"date",J.message,v);break;case"time":ff(W,"time",J.message,v);break;case"duration":ff(W,"duration",J.message,v);break;case"length":Wv(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,J.value):J.value,J.message,v),Wv(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,J.value):J.value,J.message,v);break;case"includes":{Iv(W,RegExp(_0(J.value,v)),J.message,v);break}case"ip":{if(J.version!=="v6")ff(W,"ipv4",J.message,v);if(J.version!=="v4")ff(W,"ipv6",J.message,v);break}case"base64url":Iv(W,vf.base64url,J.message,v);break;case"jwt":Iv(W,vf.jwt,J.message,v);break;case"cidr":{if(J.version!=="v6")Iv(W,vf.ipv4Cidr,J.message,v);if(J.version!=="v4")Iv(W,vf.ipv6Cidr,J.message,v);break}case"emoji":Iv(W,vf.emoji(),J.message,v);break;case"ulid":{Iv(W,vf.ulid,J.message,v);break}case"base64":{switch(v.base64Strategy){case"format:binary":{ff(W,"binary",J.message,v);break}case"contentEncoding:base64":{Wv(W,"contentEncoding","base64",J.message,v);break}case"pattern:zod":{Iv(W,vf.base64,J.message,v);break}}break}case"nanoid":Iv(W,vf.nanoid,J.message,v);case"toLowerCase":case"toUpperCase":case"trim":break;default:((Q)=>{})(J)}return W}function _0(f,v){return v.patternStrategy==="escape"?sY(f):f}var oY=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function sY(f){let v="";for(let W=0;W<f.length;W++){if(!oY.has(f[W]))v+="\\";v+=f[W]}return v}function ff(f,v,W,J){if(f.format||f.anyOf?.some((Q)=>Q.format)){if(!f.anyOf)f.anyOf=[];if(f.format){if(f.anyOf.push({format:f.format,...f.errorMessage&&J.errorMessages&&{errorMessage:{format:f.errorMessage.format}}}),delete f.format,f.errorMessage){if(delete f.errorMessage.format,Object.keys(f.errorMessage).length===0)delete f.errorMessage}}f.anyOf.push({format:v,...W&&J.errorMessages&&{errorMessage:{format:W}}})}else Wv(f,"format",v,W,J)}function Iv(f,v,W,J){if(f.pattern||f.allOf?.some((Q)=>Q.pattern)){if(!f.allOf)f.allOf=[];if(f.pattern){if(f.allOf.push({pattern:f.pattern,...f.errorMessage&&J.errorMessages&&{errorMessage:{pattern:f.errorMessage.pattern}}}),delete f.pattern,f.errorMessage){if(delete f.errorMessage.pattern,Object.keys(f.errorMessage).length===0)delete f.errorMessage}}f.allOf.push({pattern:n9(v,J),...W&&J.errorMessages&&{errorMessage:{pattern:W}}})}else Wv(f,"pattern",n9(v,J),W,J)}function n9(f,v){if(!v.applyRegexFlags||!f.flags)return f.source;let W={i:f.flags.includes("i"),m:f.flags.includes("m"),s:f.flags.includes("s")},J=W.i?f.source.toLowerCase():f.source,Q="",X=!1,Y=!1,w=!1;for(let B=0;B<J.length;B++){if(X){Q+=J[B],X=!1;continue}if(W.i){if(Y){if(J[B].match(/[a-z]/)){if(w)Q+=J[B],Q+=`${J[B-2]}-${J[B]}`.toUpperCase(),w=!1;else if(J[B+1]==="-"&&J[B+2]?.match(/[a-z]/))Q+=J[B],w=!0;else Q+=`${J[B]}${J[B].toUpperCase()}`;continue}}else if(J[B].match(/[a-z]/)){Q+=`[${J[B]}${J[B].toUpperCase()}]`;continue}}if(W.m){if(J[B]==="^"){Q+=`(^|(?<=[\r
9
9
  ]))`;continue}else if(J[B]==="$"){Q+=`($|(?=[\r
10
10
  ]))`;continue}}if(W.s&&J[B]==="."){Q+=Y?`${J[B]}\r
11
11
  `:`[${J[B]}\r
12
- ]`;continue}if(Q+=J[B],J[B]==="\\")X=!0;else if(Y&&J[B]==="]")Y=!1;else if(!Y&&J[B]==="[")Y=!0}try{new RegExp(Q)}catch{return console.warn(`Could not convert regex pattern at ${v.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),f.source}return Q}function FQ(f,v){if(v.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(v.target==="openApi3"&&f.keyType?._def.typeName===C.ZodEnum)return{type:"object",required:f.keyType._def.values,properties:f.keyType._def.values.reduce((J,Q)=>({...J,[Q]:o(f.valueType._def,{...v,currentPath:[...v.currentPath,"properties",Q]})??Mv(v)}),{}),additionalProperties:v.rejectedAdditionalProperties};let W={type:"object",additionalProperties:o(f.valueType._def,{...v,currentPath:[...v.currentPath,"additionalProperties"]})??v.allowedAdditionalProperties};if(v.target==="openApi3")return W;if(f.keyType?._def.typeName===C.ZodString&&f.keyType._def.checks?.length){let{type:J,...Q}=HQ(f.keyType._def,v);return{...W,propertyNames:Q}}else if(f.keyType?._def.typeName===C.ZodEnum)return{...W,propertyNames:{enum:f.keyType._def.values}};else if(f.keyType?._def.typeName===C.ZodBranded&&f.keyType._def.type._def.typeName===C.ZodString&&f.keyType._def.type._def.checks?.length){let{type:J,...Q}=UQ(f.keyType._def,v);return{...W,propertyNames:Q}}return W}function i9(f,v){if(v.mapStrategy==="record")return FQ(f,v);let W=o(f.keyType._def,{...v,currentPath:[...v.currentPath,"items","items","0"]})||Mv(v),J=o(f.valueType._def,{...v,currentPath:[...v.currentPath,"items","items","1"]})||Mv(v);return{type:"array",maxItems:125,items:{type:"array",items:[W,J],minItems:2,maxItems:2}}}function d9(f){let v=f.values,J=Object.keys(f.values).filter((X)=>{return typeof v[v[X]]!=="number"}).map((X)=>v[X]),Q=Array.from(new Set(J.map((X)=>typeof X)));return{type:Q.length===1?Q[0]==="string"?"string":"number":["string","number"],enum:J}}function o9(f){return f.target==="openAi"?void 0:{not:Mv({...f,currentPath:[...f.currentPath,"not"]})}}function s9(f){return f.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var k1={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function e9(f,v){if(v.target==="openApi3")return t9(f,v);let W=f.options instanceof Map?Array.from(f.options.values()):f.options;if(W.every((J)=>(J._def.typeName in k1)&&(!J._def.checks||!J._def.checks.length))){let J=W.reduce((Q,X)=>{let Y=k1[X._def.typeName];return Y&&!Q.includes(Y)?[...Q,Y]:Q},[]);return{type:J.length>1?J:J[0]}}else if(W.every((J)=>J._def.typeName==="ZodLiteral"&&!J.description)){let J=W.reduce((Q,X)=>{let Y=typeof X._def.value;switch(Y){case"string":case"number":case"boolean":return[...Q,Y];case"bigint":return[...Q,"integer"];case"object":if(X._def.value===null)return[...Q,"null"];case"symbol":case"undefined":case"function":default:return Q}},[]);if(J.length===W.length){let Q=J.filter((X,Y,w)=>w.indexOf(X)===Y);return{type:Q.length>1?Q:Q[0],enum:W.reduce((X,Y)=>{return X.includes(Y._def.value)?X:[...X,Y._def.value]},[])}}}else if(W.every((J)=>J._def.typeName==="ZodEnum"))return{type:"string",enum:W.reduce((J,Q)=>[...J,...Q._def.values.filter((X)=>!J.includes(X))],[])};return t9(f,v)}var t9=(f,v)=>{let W=(f.options instanceof Map?Array.from(f.options.values()):f.options).map((J,Q)=>o(J._def,{...v,currentPath:[...v.currentPath,"anyOf",`${Q}`]})).filter((J)=>!!J&&(!v.strictUnions||typeof J==="object"&&Object.keys(J).length>0));return W.length?{anyOf:W}:void 0};function vJ(f,v){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(f.innerType._def.typeName)&&(!f.innerType._def.checks||!f.innerType._def.checks.length)){if(v.target==="openApi3")return{type:k1[f.innerType._def.typeName],nullable:!0};return{type:[k1[f.innerType._def.typeName],"null"]}}if(v.target==="openApi3"){let J=o(f.innerType._def,{...v,currentPath:[...v.currentPath]});if(J&&"$ref"in J)return{allOf:[J],nullable:!0};return J&&{...J,nullable:!0}}let W=o(f.innerType._def,{...v,currentPath:[...v.currentPath,"anyOf","0"]});return W&&{anyOf:[W,{type:"null"}]}}function fJ(f,v){let W={type:"number"};if(!f.checks)return W;for(let J of f.checks)switch(J.kind){case"int":W.type="integer",A0(W,"type",J.message,v);break;case"min":if(v.target==="jsonSchema7")if(J.inclusive)Wv(W,"minimum",J.value,J.message,v);else Wv(W,"exclusiveMinimum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMinimum=!0;Wv(W,"minimum",J.value,J.message,v)}break;case"max":if(v.target==="jsonSchema7")if(J.inclusive)Wv(W,"maximum",J.value,J.message,v);else Wv(W,"exclusiveMaximum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMaximum=!0;Wv(W,"maximum",J.value,J.message,v)}break;case"multipleOf":Wv(W,"multipleOf",J.value,J.message,v);break}return W}function QJ(f,v){let W=v.target==="openAi",J={type:"object",properties:{}},Q=[],X=f.shape();for(let w in X){let B=X[w];if(B===void 0||B._def===void 0)continue;let z=eY(B);if(z&&W){if(B._def.typeName==="ZodOptional")B=B._def.innerType;if(!B.isNullable())B=B.nullable();z=!1}let K=o(B._def,{...v,currentPath:[...v.currentPath,"properties",w],propertyPath:[...v.currentPath,"properties",w]});if(K===void 0)continue;if(J.properties[w]=K,!z)Q.push(w)}if(Q.length)J.required=Q;let Y=tY(f,v);if(Y!==void 0)J.additionalProperties=Y;return J}function tY(f,v){if(f.catchall._def.typeName!=="ZodNever")return o(f.catchall._def,{...v,currentPath:[...v.currentPath,"additionalProperties"]});switch(f.unknownKeys){case"passthrough":return v.allowedAdditionalProperties;case"strict":return v.rejectedAdditionalProperties;case"strip":return v.removeAdditionalStrategy==="strict"?v.allowedAdditionalProperties:v.rejectedAdditionalProperties}}function eY(f){try{return f.isOptional()}catch{return!0}}var WJ=(f,v)=>{if(v.currentPath.toString()===v.propertyPath?.toString())return o(f.innerType._def,v);let W=o(f.innerType._def,{...v,currentPath:[...v.currentPath,"anyOf","1"]});return W?{anyOf:[{not:Mv(v)},W]}:Mv(v)};var JJ=(f,v)=>{if(v.pipeStrategy==="input")return o(f.in._def,v);else if(v.pipeStrategy==="output")return o(f.out._def,v);let W=o(f.in._def,{...v,currentPath:[...v.currentPath,"allOf","0"]}),J=o(f.out._def,{...v,currentPath:[...v.currentPath,"allOf",W?"1":"0"]});return{allOf:[W,J].filter((Q)=>Q!==void 0)}};function XJ(f,v){return o(f.type._def,v)}function YJ(f,v){let J={type:"array",uniqueItems:!0,items:o(f.valueType._def,{...v,currentPath:[...v.currentPath,"items"]})};if(f.minSize)Wv(J,"minItems",f.minSize.value,f.minSize.message,v);if(f.maxSize)Wv(J,"maxItems",f.maxSize.value,f.maxSize.message,v);return J}function wJ(f,v){if(f.rest)return{type:"array",minItems:f.items.length,items:f.items.map((W,J)=>o(W._def,{...v,currentPath:[...v.currentPath,"items",`${J}`]})).reduce((W,J)=>J===void 0?W:[...W,J],[]),additionalItems:o(f.rest._def,{...v,currentPath:[...v.currentPath,"additionalItems"]})};else return{type:"array",minItems:f.items.length,maxItems:f.items.length,items:f.items.map((W,J)=>o(W._def,{...v,currentPath:[...v.currentPath,"items",`${J}`]})).reduce((W,J)=>J===void 0?W:[...W,J],[])}}function GJ(f){return{not:Mv(f)}}function BJ(f){return Mv(f)}var qJ=(f,v)=>{return o(f.innerType._def,v)};var PJ=(f,v,W)=>{switch(v){case C.ZodString:return HQ(f,W);case C.ZodNumber:return fJ(f,W);case C.ZodObject:return QJ(f,W);case C.ZodBigInt:return T9(f,W);case C.ZodBoolean:return x9();case C.ZodDate:return g0(f,W);case C.ZodUndefined:return GJ(W);case C.ZodNull:return s9(W);case C.ZodArray:return C9(f,W);case C.ZodUnion:case C.ZodDiscriminatedUnion:return e9(f,W);case C.ZodIntersection:return c9(f,W);case C.ZodTuple:return wJ(f,W);case C.ZodRecord:return FQ(f,W);case C.ZodLiteral:return n9(f,W);case C.ZodEnum:return a9(f);case C.ZodNativeEnum:return d9(f);case C.ZodNullable:return vJ(f,W);case C.ZodOptional:return WJ(f,W);case C.ZodMap:return i9(f,W);case C.ZodSet:return YJ(f,W);case C.ZodLazy:return()=>f.getter()._def;case C.ZodPromise:return XJ(f,W);case C.ZodNaN:case C.ZodNever:return o9(W);case C.ZodEffects:return m9(f,W);case C.ZodAny:return Mv(W);case C.ZodUnknown:return BJ(W);case C.ZodDefault:return r9(f,W);case C.ZodBranded:return UQ(f,W);case C.ZodReadonly:return qJ(f,W);case C.ZodCatch:return u9(f,W);case C.ZodPipeline:return JJ(f,W);case C.ZodFunction:case C.ZodVoid:case C.ZodSymbol:return;default:return((J)=>{return})(v)}};function o(f,v,W=!1){let J=v.seen.get(f);if(v.override){let w=v.override?.(f,v,J,W);if(w!==l9)return w}if(J&&!W){let w=v7(J,v);if(w!==void 0)return w}let Q={def:f,path:v.currentPath,jsonSchema:void 0};v.seen.set(f,Q);let X=PJ(f,f.typeName,v),Y=typeof X==="function"?o(X(),v):X;if(Y)f7(f,v,Y);if(v.postProcess){let w=v.postProcess(Y,f,v);return Q.jsonSchema=Y,w}return Q.jsonSchema=Y,Y}var v7=(f,v)=>{switch(v.$refStrategy){case"root":return{$ref:f.path.join("/")};case"relative":return{$ref:OQ(v.currentPath,f.path)};case"none":case"seen":{if(f.path.length<v.currentPath.length&&f.path.every((W,J)=>v.currentPath[J]===W))return console.warn(`Recursive reference detected at ${v.currentPath.join("/")}! Defaulting to any`),Mv(v);return v.$refStrategy==="seen"?Mv(v):void 0}}},f7=(f,v,W)=>{if(f.description){if(W.description=f.description,v.markdownDescription)W.markdownDescription=f.description}return W};var AQ=(f,v)=>{let W=Z9(v),J=typeof v==="object"&&v.definitions?Object.entries(v.definitions).reduce((B,[z,K])=>({...B,[z]:o(K._def,{...W,currentPath:[...W.basePath,W.definitionPath,z]},!0)??Mv(W)}),{}):void 0,Q=typeof v==="string"?v:v?.nameStrategy==="title"?void 0:v?.name,X=o(f._def,Q===void 0?W:{...W,currentPath:[...W.basePath,W.definitionPath,Q]},!1)??Mv(W),Y=typeof v==="object"&&v.name!==void 0&&v.nameStrategy==="title"?v.name:void 0;if(Y!==void 0)X.title=Y;if(W.flags.hasReferencedOpenAiAnyType){if(!J)J={};if(!J[W.openAiAnyTypeName])J[W.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:W.$refStrategy==="relative"?"1":[...W.basePath,W.definitionPath,W.openAiAnyTypeName].join("/")}}}let w=Q===void 0?J?{...X,[W.definitionPath]:J}:X:{$ref:[...W.$refStrategy==="relative"?[]:W.basePath,W.definitionPath,Q].join("/"),[W.definitionPath]:{...J,[Q]:X}};if(W.target==="jsonSchema7")w.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="jsonSchema2019-09"||W.target==="openAi")w.$schema="https://json-schema.org/draft/2019-09/schema#";if(W.target==="openAi"&&(("anyOf"in w)||("oneOf"in w)||("allOf"in w)||("type"in w)&&Array.isArray(w.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return w};var b0;(function(f){f.Completable="McpCompletable"})(b0||(b0={}));class S1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;return this._def.type._parse({data:W,path:v.path,parent:v})}unwrap(){return this._def.type}}S1.create=(f,v)=>{return new S1({type:f,typeName:b0.Completable,complete:v.complete,...Q7(v)})};function Q7(f){if(!f)return{};let{errorMap:v,invalid_type_error:W,required_error:J,description:Q}=f;if(v&&(W||J))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(v)return{errorMap:v,description:Q};return{errorMap:(Y,w)=>{var B,z;let{message:K}=f;if(Y.code==="invalid_enum_value")return{message:K!==null&&K!==void 0?K:w.defaultError};if(typeof w.data==="undefined")return{message:(B=K!==null&&K!==void 0?K:J)!==null&&B!==void 0?B:w.defaultError};if(Y.code!=="invalid_type")return{message:w.defaultError};return{message:(z=K!==null&&K!==void 0?K:W)!==null&&z!==void 0?z:w.defaultError}},description:Q}}class R0{constructor(f,v){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new F0(f,v)}async connect(f){return await this.server.connect(f)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(fQ.shape.method.value),this.server.assertCanSetRequestHandler(QQ.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(fQ,()=>({tools:Object.entries(this._registeredTools).filter(([,f])=>f.enabled).map(([f,v])=>{let W={name:f,title:v.title,description:v.description,inputSchema:v.inputSchema?AQ(v.inputSchema,{strictUnions:!0}):W7,annotations:v.annotations,_meta:v._meta};if(v.outputSchema)W.outputSchema=AQ(v.outputSchema,{strictUnions:!0});return W})})),this.server.setRequestHandler(QQ,async(f,v)=>{let W=this._registeredTools[f.params.name];if(!W)throw new zv(Kv.InvalidParams,`Tool ${f.params.name} not found`);if(!W.enabled)throw new zv(Kv.InvalidParams,`Tool ${f.params.name} disabled`);let J;if(W.inputSchema){let Q=await W.inputSchema.safeParseAsync(f.params.arguments);if(!Q.success)throw new zv(Kv.InvalidParams,`Invalid arguments for tool ${f.params.name}: ${Q.error.message}`);let X=Q.data,Y=W.callback;try{J=await Promise.resolve(Y(X,v))}catch(w){J={content:[{type:"text",text:w instanceof Error?w.message:String(w)}],isError:!0}}}else{let Q=W.callback;try{J=await Promise.resolve(Q(v))}catch(X){J={content:[{type:"text",text:X instanceof Error?X.message:String(X)}],isError:!0}}}if(W.outputSchema&&!J.isError){if(!J.structuredContent)throw new zv(Kv.InvalidParams,`Tool ${f.params.name} has an output schema but no structured content was provided`);let Q=await W.outputSchema.safeParseAsync(J.structuredContent);if(!Q.success)throw new zv(Kv.InvalidParams,`Invalid structured content for tool ${f.params.name}: ${Q.error.message}`)}return J}),this._toolHandlersInitialized=!0}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(WQ.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(WQ,async(f)=>{switch(f.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(f,f.params.ref);case"ref/resource":return this.handleResourceCompletion(f,f.params.ref);default:throw new zv(Kv.InvalidParams,`Invalid completion reference: ${f.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(f,v){let W=this._registeredPrompts[v.name];if(!W)throw new zv(Kv.InvalidParams,`Prompt ${v.name} not found`);if(!W.enabled)throw new zv(Kv.InvalidParams,`Prompt ${v.name} disabled`);if(!W.argsSchema)return gQ;let J=W.argsSchema.shape[f.params.argument.name];if(!(J instanceof S1))return gQ;let X=await J._def.complete(f.params.argument.value,f.params.context);return zJ(X)}async handleResourceCompletion(f,v){let W=Object.values(this._registeredResourceTemplates).find((X)=>X.resourceTemplate.uriTemplate.toString()===v.uri);if(!W){if(this._registeredResources[v.uri])return gQ;throw new zv(Kv.InvalidParams,`Resource template ${f.params.ref.uri} not found`)}let J=W.resourceTemplate.completeCallback(f.params.argument.name);if(!J)return gQ;let Q=await J(f.params.argument.value,f.params.context);return zJ(Q)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(o1.shape.method.value),this.server.assertCanSetRequestHandler(s1.shape.method.value),this.server.assertCanSetRequestHandler(t1.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(o1,async(f,v)=>{let W=Object.entries(this._registeredResources).filter(([Q,X])=>X.enabled).map(([Q,X])=>({uri:Q,name:X.name,...X.metadata})),J=[];for(let Q of Object.values(this._registeredResourceTemplates)){if(!Q.resourceTemplate.listCallback)continue;let X=await Q.resourceTemplate.listCallback(v);for(let Y of X.resources)J.push({...Q.metadata,...Y})}return{resources:[...W,...J]}}),this.server.setRequestHandler(s1,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([v,W])=>({name:v,uriTemplate:W.resourceTemplate.uriTemplate.toString(),...W.metadata}))}}),this.server.setRequestHandler(t1,async(f,v)=>{let W=new URL(f.params.uri),J=this._registeredResources[W.toString()];if(J){if(!J.enabled)throw new zv(Kv.InvalidParams,`Resource ${W} disabled`);return J.readCallback(W,v)}for(let Q of Object.values(this._registeredResourceTemplates)){let X=Q.resourceTemplate.uriTemplate.match(W.toString());if(X)return Q.readCallback(W,X,v)}throw new zv(Kv.InvalidParams,`Resource ${W} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(e1.shape.method.value),this.server.assertCanSetRequestHandler(vQ.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(e1,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,f])=>f.enabled).map(([f,v])=>{return{name:f,title:v.title,description:v.description,arguments:v.argsSchema?X7(v.argsSchema):void 0}})})),this.server.setRequestHandler(vQ,async(f,v)=>{let W=this._registeredPrompts[f.params.name];if(!W)throw new zv(Kv.InvalidParams,`Prompt ${f.params.name} not found`);if(!W.enabled)throw new zv(Kv.InvalidParams,`Prompt ${f.params.name} disabled`);if(W.argsSchema){let J=await W.argsSchema.safeParseAsync(f.params.arguments);if(!J.success)throw new zv(Kv.InvalidParams,`Invalid arguments for prompt ${f.params.name}: ${J.error.message}`);let Q=J.data,X=W.callback;return await Promise.resolve(X(Q,v))}else{let J=W.callback;return await Promise.resolve(J(v))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0}resource(f,v,...W){let J;if(typeof W[0]==="object")J=W.shift();let Q=W[0];if(typeof v==="string"){if(this._registeredResources[v])throw new Error(`Resource ${v} is already registered`);let X=this._createRegisteredResource(f,void 0,v,J,Q);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),X}else{if(this._registeredResourceTemplates[f])throw new Error(`Resource template ${f} is already registered`);let X=this._createRegisteredResourceTemplate(f,void 0,v,J,Q);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),X}}registerResource(f,v,W,J){if(typeof v==="string"){if(this._registeredResources[v])throw new Error(`Resource ${v} is already registered`);let Q=this._createRegisteredResource(f,W.title,v,W,J);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),Q}else{if(this._registeredResourceTemplates[f])throw new Error(`Resource template ${f} is already registered`);let Q=this._createRegisteredResourceTemplate(f,W.title,v,W,J);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),Q}}_createRegisteredResource(f,v,W,J,Q){let X={name:f,title:v,metadata:J,readCallback:Q,enabled:!0,disable:()=>X.update({enabled:!1}),enable:()=>X.update({enabled:!0}),remove:()=>X.update({uri:null}),update:(Y)=>{if(typeof Y.uri!=="undefined"&&Y.uri!==W){if(delete this._registeredResources[W],Y.uri)this._registeredResources[Y.uri]=X}if(typeof Y.name!=="undefined")X.name=Y.name;if(typeof Y.title!=="undefined")X.title=Y.title;if(typeof Y.metadata!=="undefined")X.metadata=Y.metadata;if(typeof Y.callback!=="undefined")X.readCallback=Y.callback;if(typeof Y.enabled!=="undefined")X.enabled=Y.enabled;this.sendResourceListChanged()}};return this._registeredResources[W]=X,X}_createRegisteredResourceTemplate(f,v,W,J,Q){let X={resourceTemplate:W,title:v,metadata:J,readCallback:Q,enabled:!0,disable:()=>X.update({enabled:!1}),enable:()=>X.update({enabled:!0}),remove:()=>X.update({name:null}),update:(Y)=>{if(typeof Y.name!=="undefined"&&Y.name!==f){if(delete this._registeredResourceTemplates[f],Y.name)this._registeredResourceTemplates[Y.name]=X}if(typeof Y.title!=="undefined")X.title=Y.title;if(typeof Y.template!=="undefined")X.resourceTemplate=Y.template;if(typeof Y.metadata!=="undefined")X.metadata=Y.metadata;if(typeof Y.callback!=="undefined")X.readCallback=Y.callback;if(typeof Y.enabled!=="undefined")X.enabled=Y.enabled;this.sendResourceListChanged()}};return this._registeredResourceTemplates[f]=X,X}_createRegisteredPrompt(f,v,W,J,Q){let X={title:v,description:W,argsSchema:J===void 0?void 0:G.object(J),callback:Q,enabled:!0,disable:()=>X.update({enabled:!1}),enable:()=>X.update({enabled:!0}),remove:()=>X.update({name:null}),update:(Y)=>{if(typeof Y.name!=="undefined"&&Y.name!==f){if(delete this._registeredPrompts[f],Y.name)this._registeredPrompts[Y.name]=X}if(typeof Y.title!=="undefined")X.title=Y.title;if(typeof Y.description!=="undefined")X.description=Y.description;if(typeof Y.argsSchema!=="undefined")X.argsSchema=G.object(Y.argsSchema);if(typeof Y.callback!=="undefined")X.callback=Y.callback;if(typeof Y.enabled!=="undefined")X.enabled=Y.enabled;this.sendPromptListChanged()}};return this._registeredPrompts[f]=X,X}_createRegisteredTool(f,v,W,J,Q,X,Y,w){let B={title:v,description:W,inputSchema:J===void 0?void 0:G.object(J),outputSchema:Q===void 0?void 0:G.object(Q),annotations:X,_meta:Y,callback:w,enabled:!0,disable:()=>B.update({enabled:!1}),enable:()=>B.update({enabled:!0}),remove:()=>B.update({name:null}),update:(z)=>{if(typeof z.name!=="undefined"&&z.name!==f){if(delete this._registeredTools[f],z.name)this._registeredTools[z.name]=B}if(typeof z.title!=="undefined")B.title=z.title;if(typeof z.description!=="undefined")B.description=z.description;if(typeof z.paramsSchema!=="undefined")B.inputSchema=G.object(z.paramsSchema);if(typeof z.callback!=="undefined")B.callback=z.callback;if(typeof z.annotations!=="undefined")B.annotations=z.annotations;if(typeof z._meta!=="undefined")B._meta=z._meta;if(typeof z.enabled!=="undefined")B.enabled=z.enabled;this.sendToolListChanged()}};return this._registeredTools[f]=B,this.setToolRequestHandlers(),this.sendToolListChanged(),B}tool(f,...v){if(this._registeredTools[f])throw new Error(`Tool ${f} is already registered`);let W,J,Q,X;if(typeof v[0]==="string")W=v.shift();if(v.length>1){let w=v[0];if(KJ(w)){if(J=v.shift(),v.length>1&&typeof v[0]==="object"&&v[0]!==null&&!KJ(v[0]))X=v.shift()}else if(typeof w==="object"&&w!==null)X=v.shift()}let Y=v[0];return this._createRegisteredTool(f,void 0,W,J,Q,X,void 0,Y)}registerTool(f,v,W){if(this._registeredTools[f])throw new Error(`Tool ${f} is already registered`);let{title:J,description:Q,inputSchema:X,outputSchema:Y,annotations:w,_meta:B}=v;return this._createRegisteredTool(f,J,Q,X,Y,w,B,W)}prompt(f,...v){if(this._registeredPrompts[f])throw new Error(`Prompt ${f} is already registered`);let W;if(typeof v[0]==="string")W=v.shift();let J;if(v.length>1)J=v.shift();let Q=v[0],X=this._createRegisteredPrompt(f,void 0,W,J,Q);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),X}registerPrompt(f,v,W){if(this._registeredPrompts[f])throw new Error(`Prompt ${f} is already registered`);let{title:J,description:Q,argsSchema:X}=v,Y=this._createRegisteredPrompt(f,J,Q,X,W);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),Y}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(f,v){return this.server.sendLoggingMessage(f,v)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var W7={type:"object",properties:{}};function KJ(f){if(typeof f!=="object"||f===null)return!1;return Object.keys(f).length===0||Object.values(f).some(J7)}function J7(f){return f!==null&&typeof f==="object"&&"parse"in f&&typeof f.parse==="function"&&"safeParse"in f&&typeof f.safeParse==="function"}function X7(f){return Object.entries(f.shape).map(([v,W])=>({name:v,description:W.description,required:!W.isOptional()}))}function zJ(f){return{completion:{values:f.slice(0,100),total:f.length,hasMore:f.length>100}}}var gQ={completion:{values:[],hasMore:!1}};import LJ from"process";class k0{append(f){this._buffer=this._buffer?Buffer.concat([this._buffer,f]):f}readMessage(){if(!this._buffer)return null;let f=this._buffer.indexOf(`
13
- `);if(f===-1)return null;let v=this._buffer.toString("utf8",0,f).replace(/\r$/,"");return this._buffer=this._buffer.subarray(f+1),Y7(v)}clear(){this._buffer=void 0}}function Y7(f){return U8.parse(JSON.parse(f))}function $J(f){return JSON.stringify(f)+`
14
- `}class S0{constructor(f=LJ.stdin,v=LJ.stdout){this._stdin=f,this._stdout=v,this._readBuffer=new k0,this._started=!1,this._ondata=(W)=>{this._readBuffer.append(W),this.processReadBuffer()},this._onerror=(W)=>{var J;(J=this.onerror)===null||J===void 0||J.call(this,W)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){var f,v;while(!0)try{let W=this._readBuffer.readMessage();if(W===null)break;(f=this.onmessage)===null||f===void 0||f.call(this,W)}catch(W){(v=this.onerror)===null||v===void 0||v.call(this,W)}}async close(){var f;if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),(f=this.onclose)===null||f===void 0||f.call(this)}send(f){return new Promise((v)=>{let W=$J(f);if(this._stdout.write(W))v();else this._stdout.once("drain",v)})}}var y0={name:"@kelceyp/swic",version:"0.1.0",description:"Story Workflow Integration Controller - MCP server for managing stories, subtasks, and pipelines",type:"module",main:"dist/server/Server.js",bin:{"swic-mcp":"./dist/server/Server.js",swic:"./dist/cli/cli.js"},files:["dist/","README.md","LICENSE"],scripts:{"build-server":"bun run scripts/server/build-dist.ts","build-cli":"bun run scripts/cli/build-dist.ts",build:"bun run scripts/build-all.ts",prepublishOnly:"bun run build","test:e2e":"bash tests/e2e/run-e2e-tests.sh","test:e2e:local":"bash tests/e2e/test-projects/run-e2e-tests.sh",lint:"eslint src scripts archive --ext .ts","lint:fix":"eslint src scripts archive --ext .ts --fix"},dependencies:{"@kelceyp/clibuilder":"^0.1.9","@modelcontextprotocol/sdk":"^1.0.0",debug:"^4.4.3"},devDependencies:{"@types/bun":"latest","@types/debug":"^4.1.12","@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^8.46.2","@typescript-eslint/parser":"^8.46.2",eslint:"8",typescript:"^5.0.0"},engines:{bun:">=1.0.0"},repository:{type:"git",url:"https://github.com/kelceyp/swic.git"},author:"Paul Kelcey",license:"MIT",keywords:["mcp","model-context-protocol","workflow","story-management","pipeline-orchestration","development-workflow","sdlc"]};var G7=(f)=>{let v={name:"doc_create",description:"Create a new doc with content. Returns the created doc ID.",inputSchema:{scope:G.enum(["project","shared"]).describe("Scope for the doc (project or shared)"),path:G.string().describe('Path for the doc (e.g., "auth/jwt-setup" or "auth/jwt-setup.md")'),content:G.string().describe("Content of the doc")}};return Object.freeze({definition:v,handler:async(J)=>{let{scope:Q,path:X,content:Y}=J,w=await f.DocService.create({address:{kind:"path",scope:Q,path:X},content:Y});return{content:[{type:"text",text:`Created doc: ${w.id} at ${w.path}`}]}}})},B7=Object.freeze({create:G7}),MJ=B7;var _Q=(f)=>{let v;if(typeof f==="string")v=[f];else if(Array.isArray(f)){if(f.length===0)throw new Error("identifier array cannot be empty");v=f}else throw new Error("identifier must be a string or array of strings");for(let Q of v)if(typeof Q!=="string"||Q.trim().length===0)throw new Error("All identifiers must be non-empty strings");let W=v.map((Q)=>Q.trim()),J=[...new Set(W)];if(J.length===0)throw new Error("No valid identifiers provided");return J};K1();var L7=(f)=>{let v={name:"doc_delete",description:"Delete one or more docs using optimistic locking. Idempotent - does not error if doc already deleted. Supports bulk operations by passing an array of identifiers.",inputSchema:{identifier:G.union([G.string().describe('Single doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),G.array(G.string()).describe("Array of doc IDs or paths for bulk delete")]).describe("doc identifier(s) - ID or path, single or array"),scope:G.enum(["project","shared"]).optional().describe("Optional scope. Auto-resolves if omitted (checks project first, then shared, or infers from ID prefix)"),expectedHash:G.string().optional().describe("Optional. Expected hash for optimistic locking. If omitted, automatically fetches current hash for each doc.")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,expectedHash:Y}=J,w=_Q(Q),B=await Promise.all(w.map(async(q)=>{let N=Qf.isdocId(q)?{kind:"id",scope:X,id:q}:{kind:"path",scope:X,path:q},$=await f.DocService.read(N);return{identifier:q,address:N,doc:$}})),z=[];for(let q of B){let M=Y||q.doc.hash,N=await f.DocService.deleteLatest(q.address,M);z.push({id:q.doc.id,deleted:N.deleted})}let K=z.filter((q)=>q.deleted),L=z.length-K.length,D={deleted:K.map((q)=>q.id),alreadyDeleted:z.filter((q)=>!q.deleted).map((q)=>q.id),message:`Deleted ${K.length} doc${K.length!==1?"s":""}`+(L>0?`, ${L} ${L!==1?"were":"was"} already deleted`:"")};return{content:[{type:"text",text:JSON.stringify(D,null,2)}]}}})},M7=Object.freeze({create:L7}),VJ=M7;K1();var N7=(f)=>{let v={name:"doc_edit",description:"Edit doc content using text replacement operations. Uses optimistic locking to prevent concurrent modifications.",inputSchema:{identifier:G.string().describe('doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),scope:G.enum(["project","shared"]).optional().describe("Optional scope. Auto-resolves if omitted (checks project first, then shared, or infers from ID prefix)"),operation:G.discriminatedUnion("type",[G.object({type:G.literal("replaceOnce"),oldText:G.string(),newText:G.string()}),G.object({type:G.literal("replaceAll"),oldText:G.string(),newText:G.string()}),G.object({type:G.literal("replaceRegex"),pattern:G.string(),flags:G.string().optional(),replacement:G.string()}),G.object({type:G.literal("replaceAllContent"),content:G.string()})]).describe("Edit operation to perform"),baseHash:G.string().optional().describe("Optional. Expected hash for optimistic locking. If omitted, automatically fetches current hash.")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,operation:Y,baseHash:w}=J,B;switch(Y.type){case"replaceOnce":B={op:"replaceOnce",oldText:Y.oldText,newText:Y.newText};break;case"replaceAll":B={op:"replaceAll",oldText:Y.oldText,newText:Y.newText};break;case"replaceRegex":B={op:"replaceRegex",pattern:Y.pattern,flags:Y.flags||"",replacement:Y.replacement};break;case"replaceAllContent":B={op:"replaceAllContent",content:Y.content};break}let K=Qf.isdocId(Q)?{kind:"id",scope:X,id:Q}:{kind:"path",scope:X,path:Q},L=w;if(!L)L=(await f.DocService.read(K)).hash;else validateString(L,"baseHash");let D=await f.DocService.editLatest(K,L,[B]);return{content:[{type:"text",text:`Edited doc: ${D.id}
15
- Applied: ${D.appliedEdits} edit operation(s)
16
- New hash: ${D.newHash}`}]}}})},D7=Object.freeze({create:N7}),jJ=D7;var V7=(f)=>{let v={name:"doc_list",description:"List docs with optional filtering. Returns structured JSON with doc metadata. When no scope specified, lists from both scopes with override detection.",inputSchema:{scope:G.enum(["project","shared"]).optional().describe("Optional scope filter. If omitted, lists from both scopes and detects overrides (project docs that shadow shared ones)"),pathPrefix:G.string().optional().describe('Optional path prefix filter (e.g., "auth/" to list only docs in auth namespace)'),includeContent:G.boolean().optional().default(!1).describe("Include synopsis from front matter in results")}};return Object.freeze({definition:v,handler:async(J)=>{let{scope:Q,pathPrefix:X,includeContent:Y}=J,w=await f.DocService.list({scope:Q,pathPrefix:X,includeContent:Y===!0}),B;if(!Q){let K=w.filter((M)=>M.id.startsWith("doc")),L=w.filter((M)=>M.id.startsWith("sdoc")),D=new Set(K.map((M)=>M.path)),q=new Set(L.map((M)=>M.path));B=w.map((M)=>{let N=M.id.startsWith("doc"),$;if(N&&q.has(M.path))$="overrides";else if(!N&&D.has(M.path))$="overridden";return{id:M.id,path:M.path,scope:N?"project":"shared",override:$,synopsis:M.synopsis,modifiedAt:M.modifiedAt}})}else B=w.map((K)=>({id:K.id,path:K.path,scope:K.id.startsWith("doc")?"project":"shared",synopsis:K.synopsis,modifiedAt:K.modifiedAt}));B.sort((K,L)=>K.path.localeCompare(L.path));let z={docs:B,count:B.length};return{content:[{type:"text",text:JSON.stringify(z,null,2)}]}}})},j7=Object.freeze({create:V7}),EJ=j7;K1();var E7=(f)=>{let v={name:"doc_move",description:"Move or rename a doc to a new path. Generates a new ID. Supports cross-scope moves.",inputSchema:{source:G.string().describe('Source doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),destination:G.string().describe("Destination path (not ID) for the doc"),sourceScope:G.enum(["project","shared"]).optional().describe("Optional. Source scope. Auto-resolves if omitted."),destinationScope:G.enum(["project","shared"]).optional().describe("Optional. Destination scope. Defaults to source scope if omitted.")}};return Object.freeze({definition:v,handler:async(J)=>{let{source:Q,destination:X,sourceScope:Y,destinationScope:w}=J,z=Qf.isdocId(Q)?{kind:"id",scope:Y,id:Q}:{kind:"path",scope:Y,path:Q},K=await f.DocService.read(z),L=K.id.startsWith("sdoc")?"shared":"project",D=w||L,q=L!==D;if(K.path===X&&L===D)throw new Error("Source and destination are identical");try{throw await f.DocService.read({kind:"path",scope:D,path:X}),new Error(`Destination already exists: ${D} ${X}`)}catch($){if(!($.message.includes("No doc")||$.message.includes("not found")||$.message.includes("File or directory")))throw $}let M=await f.DocService.create({address:{kind:"path",path:X,scope:D},content:K.content});await f.DocService.deleteLatest(z,K.hash);let N={oldId:K.id,newId:M.id,oldPath:K.path,newPath:X,oldScope:L,newScope:D,message:q?`Moved doc across scopes from ${L} ${K.path} (${K.id}) to ${D} ${X} (new ID: ${M.id})`:`Moved doc from ${K.path} (${K.id}) to ${X} (new ID: ${M.id})`};return{content:[{type:"text",text:JSON.stringify(N,null,2)}]}}})},O7=Object.freeze({create:E7}),OJ=O7;K1();var U7=(f)=>{let v={name:"doc_read",description:"Read one or more docs by ID or path. Returns content with optional metadata. Supports bulk operations by passing an array of identifiers.",inputSchema:{identifier:G.union([G.string().describe('Single doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),G.array(G.string()).describe("Array of doc IDs or paths for bulk read")]).describe("doc identifier(s) - ID or path, single or array"),scope:G.enum(["project","shared"]).optional().describe("Optional scope. If omitted, auto-resolves (checks project first, then shared, or infers from ID prefix)"),includeMetadata:G.boolean().optional().default(!1).describe("Include ID, path, and hash metadata header for each doc")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,includeMetadata:Y}=J,w=_Q(Q),B=await Promise.all(w.map(async(L)=>{let D=Qf.isdocId(L);return await f.DocService.read(D?{kind:"id",scope:X,id:L}:{kind:"path",scope:X,path:L})})),z=[];for(let L=0;L<B.length;L++){let D=B[L];if(Y)z.push(`ID: ${D.id}`),z.push(`Path: ${D.path}`),z.push(`Hash: ${D.hash}`),z.push("---");let q=D.content;if(!q.endsWith(`
12
+ ]`;continue}if(Q+=J[B],J[B]==="\\")X=!0;else if(Y&&J[B]==="]")Y=!1;else if(!Y&&J[B]==="[")Y=!0}try{new RegExp(Q)}catch{return console.warn(`Could not convert regex pattern at ${v.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),f.source}return Q}function FQ(f,v){if(v.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(v.target==="openApi3"&&f.keyType?._def.typeName===C.ZodEnum)return{type:"object",required:f.keyType._def.values,properties:f.keyType._def.values.reduce((J,Q)=>({...J,[Q]:o(f.valueType._def,{...v,currentPath:[...v.currentPath,"properties",Q]})??Mv(v)}),{}),additionalProperties:v.rejectedAdditionalProperties};let W={type:"object",additionalProperties:o(f.valueType._def,{...v,currentPath:[...v.currentPath,"additionalProperties"]})??v.allowedAdditionalProperties};if(v.target==="openApi3")return W;if(f.keyType?._def.typeName===C.ZodString&&f.keyType._def.checks?.length){let{type:J,...Q}=HQ(f.keyType._def,v);return{...W,propertyNames:Q}}else if(f.keyType?._def.typeName===C.ZodEnum)return{...W,propertyNames:{enum:f.keyType._def.values}};else if(f.keyType?._def.typeName===C.ZodBranded&&f.keyType._def.type._def.typeName===C.ZodString&&f.keyType._def.type._def.checks?.length){let{type:J,...Q}=UQ(f.keyType._def,v);return{...W,propertyNames:Q}}return W}function p9(f,v){if(v.mapStrategy==="record")return FQ(f,v);let W=o(f.keyType._def,{...v,currentPath:[...v.currentPath,"items","items","0"]})||Mv(v),J=o(f.valueType._def,{...v,currentPath:[...v.currentPath,"items","items","1"]})||Mv(v);return{type:"array",maxItems:125,items:{type:"array",items:[W,J],minItems:2,maxItems:2}}}function i9(f){let v=f.values,J=Object.keys(f.values).filter((X)=>{return typeof v[v[X]]!=="number"}).map((X)=>v[X]),Q=Array.from(new Set(J.map((X)=>typeof X)));return{type:Q.length===1?Q[0]==="string"?"string":"number":["string","number"],enum:J}}function d9(f){return f.target==="openAi"?void 0:{not:Mv({...f,currentPath:[...f.currentPath,"not"]})}}function o9(f){return f.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var k1={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function t9(f,v){if(v.target==="openApi3")return s9(f,v);let W=f.options instanceof Map?Array.from(f.options.values()):f.options;if(W.every((J)=>(J._def.typeName in k1)&&(!J._def.checks||!J._def.checks.length))){let J=W.reduce((Q,X)=>{let Y=k1[X._def.typeName];return Y&&!Q.includes(Y)?[...Q,Y]:Q},[]);return{type:J.length>1?J:J[0]}}else if(W.every((J)=>J._def.typeName==="ZodLiteral"&&!J.description)){let J=W.reduce((Q,X)=>{let Y=typeof X._def.value;switch(Y){case"string":case"number":case"boolean":return[...Q,Y];case"bigint":return[...Q,"integer"];case"object":if(X._def.value===null)return[...Q,"null"];case"symbol":case"undefined":case"function":default:return Q}},[]);if(J.length===W.length){let Q=J.filter((X,Y,w)=>w.indexOf(X)===Y);return{type:Q.length>1?Q:Q[0],enum:W.reduce((X,Y)=>{return X.includes(Y._def.value)?X:[...X,Y._def.value]},[])}}}else if(W.every((J)=>J._def.typeName==="ZodEnum"))return{type:"string",enum:W.reduce((J,Q)=>[...J,...Q._def.values.filter((X)=>!J.includes(X))],[])};return s9(f,v)}var s9=(f,v)=>{let W=(f.options instanceof Map?Array.from(f.options.values()):f.options).map((J,Q)=>o(J._def,{...v,currentPath:[...v.currentPath,"anyOf",`${Q}`]})).filter((J)=>!!J&&(!v.strictUnions||typeof J==="object"&&Object.keys(J).length>0));return W.length?{anyOf:W}:void 0};function e9(f,v){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(f.innerType._def.typeName)&&(!f.innerType._def.checks||!f.innerType._def.checks.length)){if(v.target==="openApi3")return{type:k1[f.innerType._def.typeName],nullable:!0};return{type:[k1[f.innerType._def.typeName],"null"]}}if(v.target==="openApi3"){let J=o(f.innerType._def,{...v,currentPath:[...v.currentPath]});if(J&&"$ref"in J)return{allOf:[J],nullable:!0};return J&&{...J,nullable:!0}}let W=o(f.innerType._def,{...v,currentPath:[...v.currentPath,"anyOf","0"]});return W&&{anyOf:[W,{type:"null"}]}}function vJ(f,v){let W={type:"number"};if(!f.checks)return W;for(let J of f.checks)switch(J.kind){case"int":W.type="integer",F0(W,"type",J.message,v);break;case"min":if(v.target==="jsonSchema7")if(J.inclusive)Wv(W,"minimum",J.value,J.message,v);else Wv(W,"exclusiveMinimum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMinimum=!0;Wv(W,"minimum",J.value,J.message,v)}break;case"max":if(v.target==="jsonSchema7")if(J.inclusive)Wv(W,"maximum",J.value,J.message,v);else Wv(W,"exclusiveMaximum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMaximum=!0;Wv(W,"maximum",J.value,J.message,v)}break;case"multipleOf":Wv(W,"multipleOf",J.value,J.message,v);break}return W}function fJ(f,v){let W=v.target==="openAi",J={type:"object",properties:{}},Q=[],X=f.shape();for(let w in X){let B=X[w];if(B===void 0||B._def===void 0)continue;let z=eY(B);if(z&&W){if(B._def.typeName==="ZodOptional")B=B._def.innerType;if(!B.isNullable())B=B.nullable();z=!1}let K=o(B._def,{...v,currentPath:[...v.currentPath,"properties",w],propertyPath:[...v.currentPath,"properties",w]});if(K===void 0)continue;if(J.properties[w]=K,!z)Q.push(w)}if(Q.length)J.required=Q;let Y=tY(f,v);if(Y!==void 0)J.additionalProperties=Y;return J}function tY(f,v){if(f.catchall._def.typeName!=="ZodNever")return o(f.catchall._def,{...v,currentPath:[...v.currentPath,"additionalProperties"]});switch(f.unknownKeys){case"passthrough":return v.allowedAdditionalProperties;case"strict":return v.rejectedAdditionalProperties;case"strip":return v.removeAdditionalStrategy==="strict"?v.allowedAdditionalProperties:v.rejectedAdditionalProperties}}function eY(f){try{return f.isOptional()}catch{return!0}}var QJ=(f,v)=>{if(v.currentPath.toString()===v.propertyPath?.toString())return o(f.innerType._def,v);let W=o(f.innerType._def,{...v,currentPath:[...v.currentPath,"anyOf","1"]});return W?{anyOf:[{not:Mv(v)},W]}:Mv(v)};var WJ=(f,v)=>{if(v.pipeStrategy==="input")return o(f.in._def,v);else if(v.pipeStrategy==="output")return o(f.out._def,v);let W=o(f.in._def,{...v,currentPath:[...v.currentPath,"allOf","0"]}),J=o(f.out._def,{...v,currentPath:[...v.currentPath,"allOf",W?"1":"0"]});return{allOf:[W,J].filter((Q)=>Q!==void 0)}};function JJ(f,v){return o(f.type._def,v)}function XJ(f,v){let J={type:"array",uniqueItems:!0,items:o(f.valueType._def,{...v,currentPath:[...v.currentPath,"items"]})};if(f.minSize)Wv(J,"minItems",f.minSize.value,f.minSize.message,v);if(f.maxSize)Wv(J,"maxItems",f.maxSize.value,f.maxSize.message,v);return J}function YJ(f,v){if(f.rest)return{type:"array",minItems:f.items.length,items:f.items.map((W,J)=>o(W._def,{...v,currentPath:[...v.currentPath,"items",`${J}`]})).reduce((W,J)=>J===void 0?W:[...W,J],[]),additionalItems:o(f.rest._def,{...v,currentPath:[...v.currentPath,"additionalItems"]})};else return{type:"array",minItems:f.items.length,maxItems:f.items.length,items:f.items.map((W,J)=>o(W._def,{...v,currentPath:[...v.currentPath,"items",`${J}`]})).reduce((W,J)=>J===void 0?W:[...W,J],[])}}function wJ(f){return{not:Mv(f)}}function GJ(f){return Mv(f)}var BJ=(f,v)=>{return o(f.innerType._def,v)};var qJ=(f,v,W)=>{switch(v){case C.ZodString:return HQ(f,W);case C.ZodNumber:return vJ(f,W);case C.ZodObject:return fJ(f,W);case C.ZodBigInt:return C9(f,W);case C.ZodBoolean:return T9();case C.ZodDate:return A0(f,W);case C.ZodUndefined:return wJ(W);case C.ZodNull:return o9(W);case C.ZodArray:return Z9(f,W);case C.ZodUnion:case C.ZodDiscriminatedUnion:return t9(f,W);case C.ZodIntersection:return a9(f,W);case C.ZodTuple:return YJ(f,W);case C.ZodRecord:return FQ(f,W);case C.ZodLiteral:return c9(f,W);case C.ZodEnum:return r9(f);case C.ZodNativeEnum:return i9(f);case C.ZodNullable:return e9(f,W);case C.ZodOptional:return QJ(f,W);case C.ZodMap:return p9(f,W);case C.ZodSet:return XJ(f,W);case C.ZodLazy:return()=>f.getter()._def;case C.ZodPromise:return JJ(f,W);case C.ZodNaN:case C.ZodNever:return d9(W);case C.ZodEffects:return m9(f,W);case C.ZodAny:return Mv(W);case C.ZodUnknown:return GJ(W);case C.ZodDefault:return u9(f,W);case C.ZodBranded:return UQ(f,W);case C.ZodReadonly:return BJ(f,W);case C.ZodCatch:return x9(f,W);case C.ZodPipeline:return WJ(f,W);case C.ZodFunction:case C.ZodVoid:case C.ZodSymbol:return;default:return((J)=>{return})(v)}};function o(f,v,W=!1){let J=v.seen.get(f);if(v.override){let w=v.override?.(f,v,J,W);if(w!==y9)return w}if(J&&!W){let w=v7(J,v);if(w!==void 0)return w}let Q={def:f,path:v.currentPath,jsonSchema:void 0};v.seen.set(f,Q);let X=qJ(f,f.typeName,v),Y=typeof X==="function"?o(X(),v):X;if(Y)f7(f,v,Y);if(v.postProcess){let w=v.postProcess(Y,f,v);return Q.jsonSchema=Y,w}return Q.jsonSchema=Y,Y}var v7=(f,v)=>{switch(v.$refStrategy){case"root":return{$ref:f.path.join("/")};case"relative":return{$ref:OQ(v.currentPath,f.path)};case"none":case"seen":{if(f.path.length<v.currentPath.length&&f.path.every((W,J)=>v.currentPath[J]===W))return console.warn(`Recursive reference detected at ${v.currentPath.join("/")}! Defaulting to any`),Mv(v);return v.$refStrategy==="seen"?Mv(v):void 0}}},f7=(f,v,W)=>{if(f.description){if(W.description=f.description,v.markdownDescription)W.markdownDescription=f.description}return W};var AQ=(f,v)=>{let W=I9(v),J=typeof v==="object"&&v.definitions?Object.entries(v.definitions).reduce((B,[z,K])=>({...B,[z]:o(K._def,{...W,currentPath:[...W.basePath,W.definitionPath,z]},!0)??Mv(W)}),{}):void 0,Q=typeof v==="string"?v:v?.nameStrategy==="title"?void 0:v?.name,X=o(f._def,Q===void 0?W:{...W,currentPath:[...W.basePath,W.definitionPath,Q]},!1)??Mv(W),Y=typeof v==="object"&&v.name!==void 0&&v.nameStrategy==="title"?v.name:void 0;if(Y!==void 0)X.title=Y;if(W.flags.hasReferencedOpenAiAnyType){if(!J)J={};if(!J[W.openAiAnyTypeName])J[W.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:W.$refStrategy==="relative"?"1":[...W.basePath,W.definitionPath,W.openAiAnyTypeName].join("/")}}}let w=Q===void 0?J?{...X,[W.definitionPath]:J}:X:{$ref:[...W.$refStrategy==="relative"?[]:W.basePath,W.definitionPath,Q].join("/"),[W.definitionPath]:{...J,[Q]:X}};if(W.target==="jsonSchema7")w.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="jsonSchema2019-09"||W.target==="openAi")w.$schema="https://json-schema.org/draft/2019-09/schema#";if(W.target==="openAi"&&(("anyOf"in w)||("oneOf"in w)||("allOf"in w)||("type"in w)&&Array.isArray(w.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return w};var h0;(function(f){f.Completable="McpCompletable"})(h0||(h0={}));class S1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;return this._def.type._parse({data:W,path:v.path,parent:v})}unwrap(){return this._def.type}}S1.create=(f,v)=>{return new S1({type:f,typeName:h0.Completable,complete:v.complete,...Q7(v)})};function Q7(f){if(!f)return{};let{errorMap:v,invalid_type_error:W,required_error:J,description:Q}=f;if(v&&(W||J))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(v)return{errorMap:v,description:Q};return{errorMap:(Y,w)=>{var B,z;let{message:K}=f;if(Y.code==="invalid_enum_value")return{message:K!==null&&K!==void 0?K:w.defaultError};if(typeof w.data==="undefined")return{message:(B=K!==null&&K!==void 0?K:J)!==null&&B!==void 0?B:w.defaultError};if(Y.code!=="invalid_type")return{message:w.defaultError};return{message:(z=K!==null&&K!==void 0?K:W)!==null&&z!==void 0?z:w.defaultError}},description:Q}}class b0{constructor(f,v){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new H0(f,v)}async connect(f){return await this.server.connect(f)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(fQ.shape.method.value),this.server.assertCanSetRequestHandler(QQ.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(fQ,()=>({tools:Object.entries(this._registeredTools).filter(([,f])=>f.enabled).map(([f,v])=>{let W={name:f,title:v.title,description:v.description,inputSchema:v.inputSchema?AQ(v.inputSchema,{strictUnions:!0}):W7,annotations:v.annotations,_meta:v._meta};if(v.outputSchema)W.outputSchema=AQ(v.outputSchema,{strictUnions:!0});return W})})),this.server.setRequestHandler(QQ,async(f,v)=>{let W=this._registeredTools[f.params.name];if(!W)throw new zv(Kv.InvalidParams,`Tool ${f.params.name} not found`);if(!W.enabled)throw new zv(Kv.InvalidParams,`Tool ${f.params.name} disabled`);let J;if(W.inputSchema){let Q=await W.inputSchema.safeParseAsync(f.params.arguments);if(!Q.success)throw new zv(Kv.InvalidParams,`Invalid arguments for tool ${f.params.name}: ${Q.error.message}`);let X=Q.data,Y=W.callback;try{J=await Promise.resolve(Y(X,v))}catch(w){J={content:[{type:"text",text:w instanceof Error?w.message:String(w)}],isError:!0}}}else{let Q=W.callback;try{J=await Promise.resolve(Q(v))}catch(X){J={content:[{type:"text",text:X instanceof Error?X.message:String(X)}],isError:!0}}}if(W.outputSchema&&!J.isError){if(!J.structuredContent)throw new zv(Kv.InvalidParams,`Tool ${f.params.name} has an output schema but no structured content was provided`);let Q=await W.outputSchema.safeParseAsync(J.structuredContent);if(!Q.success)throw new zv(Kv.InvalidParams,`Invalid structured content for tool ${f.params.name}: ${Q.error.message}`)}return J}),this._toolHandlersInitialized=!0}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(WQ.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(WQ,async(f)=>{switch(f.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(f,f.params.ref);case"ref/resource":return this.handleResourceCompletion(f,f.params.ref);default:throw new zv(Kv.InvalidParams,`Invalid completion reference: ${f.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(f,v){let W=this._registeredPrompts[v.name];if(!W)throw new zv(Kv.InvalidParams,`Prompt ${v.name} not found`);if(!W.enabled)throw new zv(Kv.InvalidParams,`Prompt ${v.name} disabled`);if(!W.argsSchema)return gQ;let J=W.argsSchema.shape[f.params.argument.name];if(!(J instanceof S1))return gQ;let X=await J._def.complete(f.params.argument.value,f.params.context);return KJ(X)}async handleResourceCompletion(f,v){let W=Object.values(this._registeredResourceTemplates).find((X)=>X.resourceTemplate.uriTemplate.toString()===v.uri);if(!W){if(this._registeredResources[v.uri])return gQ;throw new zv(Kv.InvalidParams,`Resource template ${f.params.ref.uri} not found`)}let J=W.resourceTemplate.completeCallback(f.params.argument.name);if(!J)return gQ;let Q=await J(f.params.argument.value,f.params.context);return KJ(Q)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(o1.shape.method.value),this.server.assertCanSetRequestHandler(s1.shape.method.value),this.server.assertCanSetRequestHandler(t1.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(o1,async(f,v)=>{let W=Object.entries(this._registeredResources).filter(([Q,X])=>X.enabled).map(([Q,X])=>({uri:Q,name:X.name,...X.metadata})),J=[];for(let Q of Object.values(this._registeredResourceTemplates)){if(!Q.resourceTemplate.listCallback)continue;let X=await Q.resourceTemplate.listCallback(v);for(let Y of X.resources)J.push({...Q.metadata,...Y})}return{resources:[...W,...J]}}),this.server.setRequestHandler(s1,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([v,W])=>({name:v,uriTemplate:W.resourceTemplate.uriTemplate.toString(),...W.metadata}))}}),this.server.setRequestHandler(t1,async(f,v)=>{let W=new URL(f.params.uri),J=this._registeredResources[W.toString()];if(J){if(!J.enabled)throw new zv(Kv.InvalidParams,`Resource ${W} disabled`);return J.readCallback(W,v)}for(let Q of Object.values(this._registeredResourceTemplates)){let X=Q.resourceTemplate.uriTemplate.match(W.toString());if(X)return Q.readCallback(W,X,v)}throw new zv(Kv.InvalidParams,`Resource ${W} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(e1.shape.method.value),this.server.assertCanSetRequestHandler(vQ.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(e1,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,f])=>f.enabled).map(([f,v])=>{return{name:f,title:v.title,description:v.description,arguments:v.argsSchema?X7(v.argsSchema):void 0}})})),this.server.setRequestHandler(vQ,async(f,v)=>{let W=this._registeredPrompts[f.params.name];if(!W)throw new zv(Kv.InvalidParams,`Prompt ${f.params.name} not found`);if(!W.enabled)throw new zv(Kv.InvalidParams,`Prompt ${f.params.name} disabled`);if(W.argsSchema){let J=await W.argsSchema.safeParseAsync(f.params.arguments);if(!J.success)throw new zv(Kv.InvalidParams,`Invalid arguments for prompt ${f.params.name}: ${J.error.message}`);let Q=J.data,X=W.callback;return await Promise.resolve(X(Q,v))}else{let J=W.callback;return await Promise.resolve(J(v))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0}resource(f,v,...W){let J;if(typeof W[0]==="object")J=W.shift();let Q=W[0];if(typeof v==="string"){if(this._registeredResources[v])throw new Error(`Resource ${v} is already registered`);let X=this._createRegisteredResource(f,void 0,v,J,Q);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),X}else{if(this._registeredResourceTemplates[f])throw new Error(`Resource template ${f} is already registered`);let X=this._createRegisteredResourceTemplate(f,void 0,v,J,Q);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),X}}registerResource(f,v,W,J){if(typeof v==="string"){if(this._registeredResources[v])throw new Error(`Resource ${v} is already registered`);let Q=this._createRegisteredResource(f,W.title,v,W,J);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),Q}else{if(this._registeredResourceTemplates[f])throw new Error(`Resource template ${f} is already registered`);let Q=this._createRegisteredResourceTemplate(f,W.title,v,W,J);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),Q}}_createRegisteredResource(f,v,W,J,Q){let X={name:f,title:v,metadata:J,readCallback:Q,enabled:!0,disable:()=>X.update({enabled:!1}),enable:()=>X.update({enabled:!0}),remove:()=>X.update({uri:null}),update:(Y)=>{if(typeof Y.uri!=="undefined"&&Y.uri!==W){if(delete this._registeredResources[W],Y.uri)this._registeredResources[Y.uri]=X}if(typeof Y.name!=="undefined")X.name=Y.name;if(typeof Y.title!=="undefined")X.title=Y.title;if(typeof Y.metadata!=="undefined")X.metadata=Y.metadata;if(typeof Y.callback!=="undefined")X.readCallback=Y.callback;if(typeof Y.enabled!=="undefined")X.enabled=Y.enabled;this.sendResourceListChanged()}};return this._registeredResources[W]=X,X}_createRegisteredResourceTemplate(f,v,W,J,Q){let X={resourceTemplate:W,title:v,metadata:J,readCallback:Q,enabled:!0,disable:()=>X.update({enabled:!1}),enable:()=>X.update({enabled:!0}),remove:()=>X.update({name:null}),update:(Y)=>{if(typeof Y.name!=="undefined"&&Y.name!==f){if(delete this._registeredResourceTemplates[f],Y.name)this._registeredResourceTemplates[Y.name]=X}if(typeof Y.title!=="undefined")X.title=Y.title;if(typeof Y.template!=="undefined")X.resourceTemplate=Y.template;if(typeof Y.metadata!=="undefined")X.metadata=Y.metadata;if(typeof Y.callback!=="undefined")X.readCallback=Y.callback;if(typeof Y.enabled!=="undefined")X.enabled=Y.enabled;this.sendResourceListChanged()}};return this._registeredResourceTemplates[f]=X,X}_createRegisteredPrompt(f,v,W,J,Q){let X={title:v,description:W,argsSchema:J===void 0?void 0:G.object(J),callback:Q,enabled:!0,disable:()=>X.update({enabled:!1}),enable:()=>X.update({enabled:!0}),remove:()=>X.update({name:null}),update:(Y)=>{if(typeof Y.name!=="undefined"&&Y.name!==f){if(delete this._registeredPrompts[f],Y.name)this._registeredPrompts[Y.name]=X}if(typeof Y.title!=="undefined")X.title=Y.title;if(typeof Y.description!=="undefined")X.description=Y.description;if(typeof Y.argsSchema!=="undefined")X.argsSchema=G.object(Y.argsSchema);if(typeof Y.callback!=="undefined")X.callback=Y.callback;if(typeof Y.enabled!=="undefined")X.enabled=Y.enabled;this.sendPromptListChanged()}};return this._registeredPrompts[f]=X,X}_createRegisteredTool(f,v,W,J,Q,X,Y,w){let B={title:v,description:W,inputSchema:J===void 0?void 0:G.object(J),outputSchema:Q===void 0?void 0:G.object(Q),annotations:X,_meta:Y,callback:w,enabled:!0,disable:()=>B.update({enabled:!1}),enable:()=>B.update({enabled:!0}),remove:()=>B.update({name:null}),update:(z)=>{if(typeof z.name!=="undefined"&&z.name!==f){if(delete this._registeredTools[f],z.name)this._registeredTools[z.name]=B}if(typeof z.title!=="undefined")B.title=z.title;if(typeof z.description!=="undefined")B.description=z.description;if(typeof z.paramsSchema!=="undefined")B.inputSchema=G.object(z.paramsSchema);if(typeof z.callback!=="undefined")B.callback=z.callback;if(typeof z.annotations!=="undefined")B.annotations=z.annotations;if(typeof z._meta!=="undefined")B._meta=z._meta;if(typeof z.enabled!=="undefined")B.enabled=z.enabled;this.sendToolListChanged()}};return this._registeredTools[f]=B,this.setToolRequestHandlers(),this.sendToolListChanged(),B}tool(f,...v){if(this._registeredTools[f])throw new Error(`Tool ${f} is already registered`);let W,J,Q,X;if(typeof v[0]==="string")W=v.shift();if(v.length>1){let w=v[0];if(PJ(w)){if(J=v.shift(),v.length>1&&typeof v[0]==="object"&&v[0]!==null&&!PJ(v[0]))X=v.shift()}else if(typeof w==="object"&&w!==null)X=v.shift()}let Y=v[0];return this._createRegisteredTool(f,void 0,W,J,Q,X,void 0,Y)}registerTool(f,v,W){if(this._registeredTools[f])throw new Error(`Tool ${f} is already registered`);let{title:J,description:Q,inputSchema:X,outputSchema:Y,annotations:w,_meta:B}=v;return this._createRegisteredTool(f,J,Q,X,Y,w,B,W)}prompt(f,...v){if(this._registeredPrompts[f])throw new Error(`Prompt ${f} is already registered`);let W;if(typeof v[0]==="string")W=v.shift();let J;if(v.length>1)J=v.shift();let Q=v[0],X=this._createRegisteredPrompt(f,void 0,W,J,Q);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),X}registerPrompt(f,v,W){if(this._registeredPrompts[f])throw new Error(`Prompt ${f} is already registered`);let{title:J,description:Q,argsSchema:X}=v,Y=this._createRegisteredPrompt(f,J,Q,X,W);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),Y}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(f,v){return this.server.sendLoggingMessage(f,v)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var W7={type:"object",properties:{}};function PJ(f){if(typeof f!=="object"||f===null)return!1;return Object.keys(f).length===0||Object.values(f).some(J7)}function J7(f){return f!==null&&typeof f==="object"&&"parse"in f&&typeof f.parse==="function"&&"safeParse"in f&&typeof f.safeParse==="function"}function X7(f){return Object.entries(f.shape).map(([v,W])=>({name:v,description:W.description,required:!W.isOptional()}))}function KJ(f){return{completion:{values:f.slice(0,100),total:f.length,hasMore:f.length>100}}}var gQ={completion:{values:[],hasMore:!1}};import $J from"process";class R0{append(f){this._buffer=this._buffer?Buffer.concat([this._buffer,f]):f}readMessage(){if(!this._buffer)return null;let f=this._buffer.indexOf(`
13
+ `);if(f===-1)return null;let v=this._buffer.toString("utf8",0,f).replace(/\r$/,"");return this._buffer=this._buffer.subarray(f+1),Y7(v)}clear(){this._buffer=void 0}}function Y7(f){return O8.parse(JSON.parse(f))}function zJ(f){return JSON.stringify(f)+`
14
+ `}class k0{constructor(f=$J.stdin,v=$J.stdout){this._stdin=f,this._stdout=v,this._readBuffer=new R0,this._started=!1,this._ondata=(W)=>{this._readBuffer.append(W),this.processReadBuffer()},this._onerror=(W)=>{var J;(J=this.onerror)===null||J===void 0||J.call(this,W)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){var f,v;while(!0)try{let W=this._readBuffer.readMessage();if(W===null)break;(f=this.onmessage)===null||f===void 0||f.call(this,W)}catch(W){(v=this.onerror)===null||v===void 0||v.call(this,W)}}async close(){var f;if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),(f=this.onclose)===null||f===void 0||f.call(this)}send(f){return new Promise((v)=>{let W=zJ(f);if(this._stdout.write(W))v();else this._stdout.once("drain",v)})}}var S0={name:"@kelceyp/swic",version:"0.1.2",description:"Story Workflow Integration Controller - MCP server for managing stories, subtasks, and pipelines",type:"module",main:"dist/server/Server.js",bin:{"swic-mcp":"./dist/server/Server.js",swic:"./dist/cli/cli.js"},files:["dist/","README.md","LICENSE"],scripts:{"build-server":"bun run scripts/server/build-dist.ts","build-cli":"bun run scripts/cli/build-dist.ts",build:"bun run scripts/build-all.ts",prepublishOnly:"bun run build","test:e2e":"bash tests/e2e/run-e2e-tests.sh","test:e2e:local":"bash tests/e2e/test-projects/run-e2e-tests.sh",lint:"eslint src scripts archive --ext .ts","lint:fix":"eslint src scripts archive --ext .ts --fix"},dependencies:{"@kelceyp/clibuilder":"^0.1.9","@modelcontextprotocol/sdk":"^1.0.0",debug:"^4.4.3"},devDependencies:{"@types/bun":"latest","@types/debug":"^4.1.12","@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^8.46.2","@typescript-eslint/parser":"^8.46.2",eslint:"8",typescript:"^5.0.0"},engines:{bun:">=1.0.0"},repository:{type:"git",url:"https://github.com/kelceyp/swic.git"},author:"Paul Kelcey",license:"MIT",keywords:["mcp","model-context-protocol","workflow","story-management","pipeline-orchestration","development-workflow","sdlc"]};var G7=(f)=>{let v={name:"doc_create",description:"Create a new doc with content. Returns the created doc ID.",inputSchema:{scope:G.enum(["project","shared"]).describe("Scope for the doc (project or shared)"),path:G.string().describe('Path for the doc (e.g., "auth/jwt-setup" or "auth/jwt-setup.md")'),content:G.string().describe("Content of the doc")}};return Object.freeze({definition:v,handler:async(J)=>{let{scope:Q,path:X,content:Y}=J,w=await f.DocService.create({address:{kind:"path",scope:Q,path:X},content:Y});return{content:[{type:"text",text:`Created doc: ${w.id} at ${w.path}`}]}}})},B7=Object.freeze({create:G7}),LJ=B7;var _Q=(f)=>{let v;if(typeof f==="string")v=[f];else if(Array.isArray(f)){if(f.length===0)throw new Error("identifier array cannot be empty");v=f}else throw new Error("identifier must be a string or array of strings");for(let Q of v)if(typeof Q!=="string"||Q.trim().length===0)throw new Error("All identifiers must be non-empty strings");let W=v.map((Q)=>Q.trim()),J=[...new Set(W)];if(J.length===0)throw new Error("No valid identifiers provided");return J};K1();var L7=(f)=>{let v={name:"doc_delete",description:"Delete one or more docs using optimistic locking. Idempotent - does not error if doc already deleted. Supports bulk operations by passing an array of identifiers.",inputSchema:{identifier:G.union([G.string().describe('Single doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),G.array(G.string()).describe("Array of doc IDs or paths for bulk delete")]).describe("doc identifier(s) - ID or path, single or array"),scope:G.enum(["project","shared"]).optional().describe("Optional scope. Auto-resolves if omitted (checks project first, then shared, or infers from ID prefix)"),expectedHash:G.string().optional().describe("Optional. Expected hash for optimistic locking. If omitted, automatically fetches current hash for each doc.")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,expectedHash:Y}=J,w=_Q(Q),B=await Promise.all(w.map(async(q)=>{let N=Qf.isdocId(q)?{kind:"id",scope:X,id:q}:{kind:"path",scope:X,path:q},$=await f.DocService.read(N);return{identifier:q,address:N,doc:$}})),z=[];for(let q of B){let M=Y||q.doc.hash,N=await f.DocService.deleteLatest(q.address,M);z.push({id:q.doc.id,deleted:N.deleted})}let K=z.filter((q)=>q.deleted),L=z.length-K.length,V={deleted:K.map((q)=>q.id),alreadyDeleted:z.filter((q)=>!q.deleted).map((q)=>q.id),message:`Deleted ${K.length} doc${K.length!==1?"s":""}`+(L>0?`, ${L} ${L!==1?"were":"was"} already deleted`:"")};return{content:[{type:"text",text:JSON.stringify(V,null,2)}]}}})},M7=Object.freeze({create:L7}),VJ=M7;K1();var N7=(f)=>{let v={name:"doc_edit",description:"Edit doc content using text replacement operations. Uses optimistic locking to prevent concurrent modifications.",inputSchema:{identifier:G.string().describe('doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),scope:G.enum(["project","shared"]).optional().describe("Optional scope. Auto-resolves if omitted (checks project first, then shared, or infers from ID prefix)"),operation:G.discriminatedUnion("type",[G.object({type:G.literal("replaceOnce"),oldText:G.string(),newText:G.string()}),G.object({type:G.literal("replaceAll"),oldText:G.string(),newText:G.string()}),G.object({type:G.literal("replaceRegex"),pattern:G.string(),flags:G.string().optional(),replacement:G.string()}),G.object({type:G.literal("replaceAllContent"),content:G.string()})]).describe("Edit operation to perform"),baseHash:G.string().optional().describe("Optional. Expected hash for optimistic locking. If omitted, automatically fetches current hash.")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,operation:Y,baseHash:w}=J,B;switch(Y.type){case"replaceOnce":B={op:"replaceOnce",oldText:Y.oldText,newText:Y.newText};break;case"replaceAll":B={op:"replaceAll",oldText:Y.oldText,newText:Y.newText};break;case"replaceRegex":B={op:"replaceRegex",pattern:Y.pattern,flags:Y.flags||"",replacement:Y.replacement};break;case"replaceAllContent":B={op:"replaceAllContent",content:Y.content};break}let K=Qf.isdocId(Q)?{kind:"id",scope:X,id:Q}:{kind:"path",scope:X,path:Q},L=w;if(!L)L=(await f.DocService.read(K)).hash;else validateString(L,"baseHash");let V=await f.DocService.editLatest(K,L,[B]);return{content:[{type:"text",text:`Edited doc: ${V.id}
15
+ Applied: ${V.appliedEdits} edit operation(s)
16
+ New hash: ${V.newHash}`}]}}})},V7=Object.freeze({create:N7}),DJ=V7;var D7=(f)=>{let v={name:"doc_list",description:"List docs with optional filtering. Returns structured JSON with doc metadata. When no scope specified, lists from both scopes with override detection.",inputSchema:{scope:G.enum(["project","shared"]).optional().describe("Optional scope filter. If omitted, lists from both scopes and detects overrides (project docs that shadow shared ones)"),pathPrefix:G.string().optional().describe('Optional path prefix filter (e.g., "auth/" to list only docs in auth namespace)'),includeContent:G.boolean().optional().default(!1).describe("Include synopsis from front matter in results")}};return Object.freeze({definition:v,handler:async(J)=>{let{scope:Q,pathPrefix:X,includeContent:Y}=J,w=await f.DocService.list({scope:Q,pathPrefix:X,includeContent:Y===!0}),B;if(!Q){let K=w.filter((M)=>M.id.startsWith("doc")),L=w.filter((M)=>M.id.startsWith("sdoc")),V=new Set(K.map((M)=>M.path)),q=new Set(L.map((M)=>M.path));B=w.map((M)=>{let N=M.id.startsWith("doc"),$;if(N&&q.has(M.path))$="overrides";else if(!N&&V.has(M.path))$="overridden";return{id:M.id,path:M.path,scope:N?"project":"shared",override:$,synopsis:M.synopsis,modifiedAt:M.modifiedAt}})}else B=w.map((K)=>({id:K.id,path:K.path,scope:K.id.startsWith("doc")?"project":"shared",synopsis:K.synopsis,modifiedAt:K.modifiedAt}));B.sort((K,L)=>K.path.localeCompare(L.path));let z={docs:B,count:B.length};return{content:[{type:"text",text:JSON.stringify(z,null,2)}]}}})},j7=Object.freeze({create:D7}),jJ=j7;K1();var E7=(f)=>{let v={name:"doc_move",description:"Move or rename a doc to a new path. Generates a new ID. Supports cross-scope moves.",inputSchema:{source:G.string().describe('Source doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),destination:G.string().describe("Destination path (not ID) for the doc"),sourceScope:G.enum(["project","shared"]).optional().describe("Optional. Source scope. Auto-resolves if omitted."),destinationScope:G.enum(["project","shared"]).optional().describe("Optional. Destination scope. Defaults to source scope if omitted.")}};return Object.freeze({definition:v,handler:async(J)=>{let{source:Q,destination:X,sourceScope:Y,destinationScope:w}=J,z=Qf.isdocId(Q)?{kind:"id",scope:Y,id:Q}:{kind:"path",scope:Y,path:Q},K=await f.DocService.read(z),L=K.id.startsWith("sdoc")?"shared":"project",V=w||L,q=L!==V;if(K.path===X&&L===V)throw new Error("Source and destination are identical");try{throw await f.DocService.read({kind:"path",scope:V,path:X}),new Error(`Destination already exists: ${V} ${X}`)}catch($){if(!($.message.includes("No doc")||$.message.includes("not found")||$.message.includes("File or directory")))throw $}let M=await f.DocService.create({address:{kind:"path",path:X,scope:V},content:K.content});await f.DocService.deleteLatest(z,K.hash);let N={oldId:K.id,newId:M.id,oldPath:K.path,newPath:X,oldScope:L,newScope:V,message:q?`Moved doc across scopes from ${L} ${K.path} (${K.id}) to ${V} ${X} (new ID: ${M.id})`:`Moved doc from ${K.path} (${K.id}) to ${X} (new ID: ${M.id})`};return{content:[{type:"text",text:JSON.stringify(N,null,2)}]}}})},O7=Object.freeze({create:E7}),EJ=O7;K1();var U7=(f)=>{let v={name:"doc_read",description:"Read one or more docs by ID or path. Returns content with optional metadata. Supports bulk operations by passing an array of identifiers.",inputSchema:{identifier:G.union([G.string().describe('Single doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),G.array(G.string()).describe("Array of doc IDs or paths for bulk read")]).describe("doc identifier(s) - ID or path, single or array"),scope:G.enum(["project","shared"]).optional().describe("Optional scope. If omitted, auto-resolves (checks project first, then shared, or infers from ID prefix)"),includeMetadata:G.boolean().optional().default(!1).describe("Include ID, path, and hash metadata header for each doc")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,includeMetadata:Y}=J,w=_Q(Q),B=await Promise.all(w.map(async(L)=>{let V=Qf.isdocId(L);return await f.DocService.read(V?{kind:"id",scope:X,id:L}:{kind:"path",scope:X,path:L})})),z=[];for(let L=0;L<B.length;L++){let V=B[L];if(Y)z.push(`ID: ${V.id}`),z.push(`Path: ${V.path}`),z.push(`Hash: ${V.hash}`),z.push("---");let q=V.content;if(!q.endsWith(`
17
17
  `))q+=`
18
18
  `;if(z.push(q),L<B.length-1)z.push("")}return{content:[{type:"text",text:z.join(`
19
- `)}]}}})},H7=Object.freeze({create:U7}),UJ=H7;var HJ=[MJ.create,VJ.create,jJ.create,EJ.create,OJ.create,UJ.create];var nJ=(f)=>{let{services:v}=f,W=y0.name,J=y0.version,Q=new R0({name:W,version:J});return Object.freeze({start:async()=>{for(let w of HJ){let B=w(v);Q.registerTool(B.definition.name,{description:B.definition.description,inputSchema:B.definition.inputSchema},async(z)=>B.handler(z,v))}let Y=new S0;await Q.connect(Y),console.error(`${W} v${J} running on stdio`)}})},Y2=async()=>{let{default:f}=await Promise.resolve().then(() => (mJ(),rJ)),{default:v}=await Promise.resolve().then(() => (cJ(),aJ)),{resolve:W}=await import("path"),{homedir:J}=await import("os"),Q=v.findProjectRoot(),X=W(J(),".swic"),Y=f.createServices({projectBoundaryDir:Q,sharedBoundaryDir:X});await nJ({services:Y}).start()},w2=Object.freeze({create:nJ});if(import.meta.main)Y2().catch(console.error);var Xq=w2;export{Xq as default};
19
+ `)}]}}})},H7=Object.freeze({create:U7}),OJ=H7;var UJ=[LJ.create,VJ.create,DJ.create,jJ.create,EJ.create,OJ.create];var cJ=(f)=>{let{services:v}=f,W=S0.name,J=S0.version,Q=new b0({name:W,version:J});return Object.freeze({start:async()=>{for(let w of UJ){let B=w(v);Q.registerTool(B.definition.name,{description:B.definition.description,inputSchema:B.definition.inputSchema},async(z)=>B.handler(z,v))}let Y=new k0;await Q.connect(Y),console.error(`${W} v${J} running on stdio`)}})},w2=async()=>{let{default:f}=await Promise.resolve().then(() => (aJ(),rJ)),{projectDataDir:v,sharedDataDir:W}=f.lazilyGetDataDirs(),J=f.createServices({projectBoundaryDir:v,sharedBoundaryDir:W});await cJ({services:J}).start()},G2=Object.freeze({create:cJ});if(import.meta.main)w2().catch(console.error);var qq=G2;export{qq as default};