@intelliweave/embedded 1.8.61 → 1.8.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component/component.d.ts +10 -0
- package/dist/component/component.js +21 -21
- package/dist/intelliweave-wordpress.zip +0 -0
- package/dist/node/node.d.ts +10 -0
- package/dist/node/node.js +14 -14
- package/dist/react/react.d.ts +6 -0
- package/dist/react/react.js +21 -21
- package/dist/script-tag/script-tag.js +35 -35
- package/dist/webpack/index.d.ts +163 -1
- package/dist/webpack/index.js +22 -22
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{b as te,c as Ss,d as Es,e as Pe}from"./chunk-AIYMQX7V.js";var Pd=te((Fi,Rd)=>{"use strict";(function(r,e){typeof Fi=="object"&&typeof Rd<"u"?e(Fi):typeof define=="function"&&define.amd?define(["exports"],e):e(r.URI=r.URI||{})})(Fi,function(r){"use strict";function e(){for(var w=arguments.length,b=Array(w),k=0;k<w;k++)b[k]=arguments[k];if(b.length>1){b[0]=b[0].slice(0,-1);for(var P=b.length-1,N=1;N<P;++N)b[N]=b[N].slice(1,-1);return b[P]=b[P].slice(1),b.join("")}else return b[0]}function t(w){return"(?:"+w+")"}function a(w){return w===void 0?"undefined":w===null?"null":Object.prototype.toString.call(w).split(" ").pop().split("]").shift().toLowerCase()}function n(w){return w.toUpperCase()}function i(w){return w!=null?w instanceof Array?w:typeof w.length!="number"||w.split||w.setInterval||w.call?[w]:Array.prototype.slice.call(w):[]}function o(w,b){var k=w;if(b)for(var P in b)k[P]=b[P];return k}function s(w){var b="[A-Za-z]",k="[\\x0D]",P="[0-9]",N="[\\x22]",q=e(P,"[A-Fa-f]"),ce="[\\x0A]",ve="[\\x20]",we=t(t("%[EFef]"+q+"%"+q+q+"%"+q+q)+"|"+t("%[89A-Fa-f]"+q+"%"+q+q)+"|"+t("%"+q+q)),Ke="[\\:\\/\\?\\#\\[\\]\\@]",ye="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Me=e(Ke,ye),$e=w?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Oe=w?"[\\uE000-\\uF8FF]":"[]",_e=e(b,P,"[\\-\\.\\_\\~]",$e),Fe=t(b+e(b,P,"[\\+\\-\\.]")+"*"),xe=t(t(we+"|"+e(_e,ye,"[\\:]"))+"*"),Vr=t(t("25[0-5]")+"|"+t("2[0-4]"+P)+"|"+t("1"+P+P)+"|"+t("[1-9]"+P)+"|"+P),wt=t(t("25[0-5]")+"|"+t("2[0-4]"+P)+"|"+t("1"+P+P)+"|"+t("0?[1-9]"+P)+"|0?0?"+P),Dt=t(wt+"\\."+wt+"\\."+wt+"\\."+wt),Ae=t(q+"{1,4}"),Ct=t(t(Ae+"\\:"+Ae)+"|"+Dt),Nt=t(t(Ae+"\\:")+"{6}"+Ct),Qt=t("\\:\\:"+t(Ae+"\\:")+"{5}"+Ct),Wr=t(t(Ae)+"?\\:\\:"+t(Ae+"\\:")+"{4}"+Ct),cr=t(t(t(Ae+"\\:")+"{0,1}"+Ae)+"?\\:\\:"+t(Ae+"\\:")+"{3}"+Ct),pa=t(t(t(Ae+"\\:")+"{0,2}"+Ae)+"?\\:\\:"+t(Ae+"\\:")+"{2}"+Ct),ai=t(t(t(Ae+"\\:")+"{0,3}"+Ae)+"?\\:\\:"+Ae+"\\:"+Ct),ii=t(t(t(Ae+"\\:")+"{0,4}"+Ae)+"?\\:\\:"+Ct),kn=t(t(t(Ae+"\\:")+"{0,5}"+Ae)+"?\\:\\:"+Ae),Tn=t(t(t(Ae+"\\:")+"{0,6}"+Ae)+"?\\:\\:"),ur=t([Nt,Qt,Wr,cr,pa,ai,ii,kn,Tn].join("|")),xn=t(t(_e+"|"+we)+"+"),vs=t(ur+"\\%25"+xn),jr=t(ur+t("\\%25|\\%(?!"+q+"{2})")+xn),Tf=t("[vV]"+q+"+\\."+e(_e,ye,"[\\:]")+"+"),xf=t("\\["+t(jr+"|"+ur+"|"+Tf)+"\\]"),iu=t(t(we+"|"+e(_e,ye))+"*"),ma=t(xf+"|"+Dt+"(?!"+iu+")|"+iu),ha=t(P+"*"),ou=t(t(xe+"@")+"?"+ma+t("\\:"+ha)+"?"),ga=t(we+"|"+e(_e,ye,"[\\:\\@]")),Af=t(ga+"*"),su=t(ga+"+"),If=t(t(we+"|"+e(_e,ye,"[\\@]"))+"+"),dr=t(t("\\/"+Af)+"*"),An=t("\\/"+t(su+dr)+"?"),_s=t(If+dr),oi=t(su+dr),In="(?!"+ga+")",Vk=t(dr+"|"+An+"|"+_s+"|"+oi+"|"+In),Rn=t(t(ga+"|"+e("[\\/\\?]",Oe))+"*"),fa=t(t(ga+"|[\\/\\?]")+"*"),lu=t(t("\\/\\/"+ou+dr)+"|"+An+"|"+oi+"|"+In),Rf=t(Fe+"\\:"+lu+t("\\?"+Rn)+"?"+t("\\#"+fa)+"?"),Pf=t(t("\\/\\/"+ou+dr)+"|"+An+"|"+_s+"|"+In),Df=t(Pf+t("\\?"+Rn)+"?"+t("\\#"+fa)+"?"),Wk=t(Rf+"|"+Df),jk=t(Fe+"\\:"+lu+t("\\?"+Rn)+"?"),qk="^("+Fe+")\\:"+t(t("\\/\\/("+t("("+xe+")@")+"?("+ma+")"+t("\\:("+ha+")")+"?)")+"?("+dr+"|"+An+"|"+oi+"|"+In+")")+t("\\?("+Rn+")")+"?"+t("\\#("+fa+")")+"?$",Kk="^(){0}"+t(t("\\/\\/("+t("("+xe+")@")+"?("+ma+")"+t("\\:("+ha+")")+"?)")+"?("+dr+"|"+An+"|"+_s+"|"+In+")")+t("\\?("+Rn+")")+"?"+t("\\#("+fa+")")+"?$",$k="^("+Fe+")\\:"+t(t("\\/\\/("+t("("+xe+")@")+"?("+ma+")"+t("\\:("+ha+")")+"?)")+"?("+dr+"|"+An+"|"+oi+"|"+In+")")+t("\\?("+Rn+")")+"?$",Xk="^"+t("\\#("+fa+")")+"?$",Yk="^"+t("("+xe+")@")+"?("+ma+")"+t("\\:("+ha+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",b,P,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",_e,ye),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",_e,ye),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",_e,ye),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",_e,ye),"g"),NOT_QUERY:new RegExp(e("[^\\%]",_e,ye,"[\\:\\@\\/\\?]",Oe),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",_e,ye,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",_e,ye),"g"),UNRESERVED:new RegExp(_e,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",_e,Me),"g"),PCT_ENCODED:new RegExp(we,"g"),IPV4ADDRESS:new RegExp("^("+Dt+")$"),IPV6ADDRESS:new RegExp("^\\[?("+ur+")"+t(t("\\%25|\\%(?!"+q+"{2})")+"("+xn+")")+"?\\]?$")}}var l=s(!1),c=s(!0),u=function(){function w(b,k){var P=[],N=!0,q=!1,ce=void 0;try{for(var ve=b[Symbol.iterator](),we;!(N=(we=ve.next()).done)&&(P.push(we.value),!(k&&P.length===k));N=!0);}catch(Ke){q=!0,ce=Ke}finally{try{!N&&ve.return&&ve.return()}finally{if(q)throw ce}}return P}return function(b,k){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return w(b,k);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(w){if(Array.isArray(w)){for(var b=0,k=Array(w.length);b<w.length;b++)k[b]=w[b];return k}else return Array.from(w)},m=2147483647,d=36,g=1,f=26,y=38,v=700,T=72,E=128,I="-",D=/^xn--/,C=/[^\0-\x7E]/,M=/[\x2E\u3002\uFF0E\uFF61]/g,F={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},R=d-g,G=Math.floor,z=String.fromCharCode;function O(w){throw new RangeError(F[w])}function x(w,b){for(var k=[],P=w.length;P--;)k[P]=b(w[P]);return k}function A(w,b){var k=w.split("@"),P="";k.length>1&&(P=k[0]+"@",w=k[1]),w=w.replace(M,".");var N=w.split("."),q=x(N,b).join(".");return P+q}function B(w){for(var b=[],k=0,P=w.length;k<P;){var N=w.charCodeAt(k++);if(N>=55296&&N<=56319&&k<P){var q=w.charCodeAt(k++);(q&64512)==56320?b.push(((N&1023)<<10)+(q&1023)+65536):(b.push(N),k--)}else b.push(N)}return b}var X=function(b){return String.fromCodePoint.apply(String,p(b))},K=function(b){return b-48<10?b-22:b-65<26?b-65:b-97<26?b-97:d},Q=function(b,k){return b+22+75*(b<26)-((k!=0)<<5)},Z=function(b,k,P){var N=0;for(b=P?G(b/v):b>>1,b+=G(b/k);b>R*f>>1;N+=d)b=G(b/R);return G(N+(R+1)*b/(b+y))},_=function(b){var k=[],P=b.length,N=0,q=E,ce=T,ve=b.lastIndexOf(I);ve<0&&(ve=0);for(var we=0;we<ve;++we)b.charCodeAt(we)>=128&&O("not-basic"),k.push(b.charCodeAt(we));for(var Ke=ve>0?ve+1:0;Ke<P;){for(var ye=N,Me=1,$e=d;;$e+=d){Ke>=P&&O("invalid-input");var Oe=K(b.charCodeAt(Ke++));(Oe>=d||Oe>G((m-N)/Me))&&O("overflow"),N+=Oe*Me;var _e=$e<=ce?g:$e>=ce+f?f:$e-ce;if(Oe<_e)break;var Fe=d-_e;Me>G(m/Fe)&&O("overflow"),Me*=Fe}var xe=k.length+1;ce=Z(N-ye,xe,ye==0),G(N/xe)>m-q&&O("overflow"),q+=G(N/xe),N%=xe,k.splice(N++,0,q)}return String.fromCodePoint.apply(String,k)},ge=function(b){var k=[];b=B(b);var P=b.length,N=E,q=0,ce=T,ve=!0,we=!1,Ke=void 0;try{for(var ye=b[Symbol.iterator](),Me;!(ve=(Me=ye.next()).done);ve=!0){var $e=Me.value;$e<128&&k.push(z($e))}}catch(jr){we=!0,Ke=jr}finally{try{!ve&&ye.return&&ye.return()}finally{if(we)throw Ke}}var Oe=k.length,_e=Oe;for(Oe&&k.push(I);_e<P;){var Fe=m,xe=!0,Vr=!1,wt=void 0;try{for(var Dt=b[Symbol.iterator](),Ae;!(xe=(Ae=Dt.next()).done);xe=!0){var Ct=Ae.value;Ct>=N&&Ct<Fe&&(Fe=Ct)}}catch(jr){Vr=!0,wt=jr}finally{try{!xe&&Dt.return&&Dt.return()}finally{if(Vr)throw wt}}var Nt=_e+1;Fe-N>G((m-q)/Nt)&&O("overflow"),q+=(Fe-N)*Nt,N=Fe;var Qt=!0,Wr=!1,cr=void 0;try{for(var pa=b[Symbol.iterator](),ai;!(Qt=(ai=pa.next()).done);Qt=!0){var ii=ai.value;if(ii<N&&++q>m&&O("overflow"),ii==N){for(var kn=q,Tn=d;;Tn+=d){var ur=Tn<=ce?g:Tn>=ce+f?f:Tn-ce;if(kn<ur)break;var xn=kn-ur,vs=d-ur;k.push(z(Q(ur+xn%vs,0))),kn=G(xn/vs)}k.push(z(Q(kn,0))),ce=Z(q,Nt,_e==Oe),q=0,++_e}}}catch(jr){Wr=!0,cr=jr}finally{try{!Qt&&pa.return&&pa.return()}finally{if(Wr)throw cr}}++q,++N}return k.join("")},Ie=function(b){return A(b,function(k){return D.test(k)?_(k.slice(4).toLowerCase()):k})},S=function(b){return A(b,function(k){return C.test(k)?"xn--"+ge(k):k})},ne={version:"2.1.0",ucs2:{decode:B,encode:X},decode:_,encode:ge,toASCII:S,toUnicode:Ie},Te={};function Be(w){var b=w.charCodeAt(0),k=void 0;return b<16?k="%0"+b.toString(16).toUpperCase():b<128?k="%"+b.toString(16).toUpperCase():b<2048?k="%"+(b>>6|192).toString(16).toUpperCase()+"%"+(b&63|128).toString(16).toUpperCase():k="%"+(b>>12|224).toString(16).toUpperCase()+"%"+(b>>6&63|128).toString(16).toUpperCase()+"%"+(b&63|128).toString(16).toUpperCase(),k}function We(w){for(var b="",k=0,P=w.length;k<P;){var N=parseInt(w.substr(k+1,2),16);if(N<128)b+=String.fromCharCode(N),k+=3;else if(N>=194&&N<224){if(P-k>=6){var q=parseInt(w.substr(k+4,2),16);b+=String.fromCharCode((N&31)<<6|q&63)}else b+=w.substr(k,6);k+=6}else if(N>=224){if(P-k>=9){var ce=parseInt(w.substr(k+4,2),16),ve=parseInt(w.substr(k+7,2),16);b+=String.fromCharCode((N&15)<<12|(ce&63)<<6|ve&63)}else b+=w.substr(k,9);k+=9}else b+=w.substr(k,3),k+=3}return b}function Re(w,b){function k(P){var N=We(P);return N.match(b.UNRESERVED)?N:P}return w.scheme&&(w.scheme=String(w.scheme).replace(b.PCT_ENCODED,k).toLowerCase().replace(b.NOT_SCHEME,"")),w.userinfo!==void 0&&(w.userinfo=String(w.userinfo).replace(b.PCT_ENCODED,k).replace(b.NOT_USERINFO,Be).replace(b.PCT_ENCODED,n)),w.host!==void 0&&(w.host=String(w.host).replace(b.PCT_ENCODED,k).toLowerCase().replace(b.NOT_HOST,Be).replace(b.PCT_ENCODED,n)),w.path!==void 0&&(w.path=String(w.path).replace(b.PCT_ENCODED,k).replace(w.scheme?b.NOT_PATH:b.NOT_PATH_NOSCHEME,Be).replace(b.PCT_ENCODED,n)),w.query!==void 0&&(w.query=String(w.query).replace(b.PCT_ENCODED,k).replace(b.NOT_QUERY,Be).replace(b.PCT_ENCODED,n)),w.fragment!==void 0&&(w.fragment=String(w.fragment).replace(b.PCT_ENCODED,k).replace(b.NOT_FRAGMENT,Be).replace(b.PCT_ENCODED,n)),w}function ut(w){return w.replace(/^0*(.*)/,"$1")||"0"}function Se(w,b){var k=w.match(b.IPV4ADDRESS)||[],P=u(k,2),N=P[1];return N?N.split(".").map(ut).join("."):w}function Ce(w,b){var k=w.match(b.IPV6ADDRESS)||[],P=u(k,3),N=P[1],q=P[2];if(N){for(var ce=N.toLowerCase().split("::").reverse(),ve=u(ce,2),we=ve[0],Ke=ve[1],ye=Ke?Ke.split(":").map(ut):[],Me=we.split(":").map(ut),$e=b.IPV4ADDRESS.test(Me[Me.length-1]),Oe=$e?7:8,_e=Me.length-Oe,Fe=Array(Oe),xe=0;xe<Oe;++xe)Fe[xe]=ye[xe]||Me[_e+xe]||"";$e&&(Fe[Oe-1]=Se(Fe[Oe-1],b));var Vr=Fe.reduce(function(Nt,Qt,Wr){if(!Qt||Qt==="0"){var cr=Nt[Nt.length-1];cr&&cr.index+cr.length===Wr?cr.length++:Nt.push({index:Wr,length:1})}return Nt},[]),wt=Vr.sort(function(Nt,Qt){return Qt.length-Nt.length})[0],Dt=void 0;if(wt&&wt.length>1){var Ae=Fe.slice(0,wt.index),Ct=Fe.slice(wt.index+wt.length);Dt=Ae.join(":")+"::"+Ct.join(":")}else Dt=Fe.join(":");return q&&(Dt+="%"+q),Dt}else return w}var ht=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,je="".match(/(){0}/)[1]===void 0;function fe(w){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},k={},P=b.iri!==!1?c:l;b.reference==="suffix"&&(w=(b.scheme?b.scheme+":":"")+"//"+w);var N=w.match(ht);if(N){je?(k.scheme=N[1],k.userinfo=N[3],k.host=N[4],k.port=parseInt(N[5],10),k.path=N[6]||"",k.query=N[7],k.fragment=N[8],isNaN(k.port)&&(k.port=N[5])):(k.scheme=N[1]||void 0,k.userinfo=w.indexOf("@")!==-1?N[3]:void 0,k.host=w.indexOf("//")!==-1?N[4]:void 0,k.port=parseInt(N[5],10),k.path=N[6]||"",k.query=w.indexOf("?")!==-1?N[7]:void 0,k.fragment=w.indexOf("#")!==-1?N[8]:void 0,isNaN(k.port)&&(k.port=w.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?N[4]:void 0)),k.host&&(k.host=Ce(Se(k.host,P),P)),k.scheme===void 0&&k.userinfo===void 0&&k.host===void 0&&k.port===void 0&&!k.path&&k.query===void 0?k.reference="same-document":k.scheme===void 0?k.reference="relative":k.fragment===void 0?k.reference="absolute":k.reference="uri",b.reference&&b.reference!=="suffix"&&b.reference!==k.reference&&(k.error=k.error||"URI is not a "+b.reference+" reference.");var q=Te[(b.scheme||k.scheme||"").toLowerCase()];if(!b.unicodeSupport&&(!q||!q.unicodeSupport)){if(k.host&&(b.domainHost||q&&q.domainHost))try{k.host=ne.toASCII(k.host.replace(P.PCT_ENCODED,We).toLowerCase())}catch(ce){k.error=k.error||"Host's domain name can not be converted to ASCII via punycode: "+ce}Re(k,l)}else Re(k,P);q&&q.parse&&q.parse(k,b)}else k.error=k.error||"URI can not be parsed.";return k}function Ht(w,b){var k=b.iri!==!1?c:l,P=[];return w.userinfo!==void 0&&(P.push(w.userinfo),P.push("@")),w.host!==void 0&&P.push(Ce(Se(String(w.host),k),k).replace(k.IPV6ADDRESS,function(N,q,ce){return"["+q+(ce?"%25"+ce:"")+"]"})),(typeof w.port=="number"||typeof w.port=="string")&&(P.push(":"),P.push(String(w.port))),P.length?P.join(""):void 0}var It=/^\.\.?\//,lr=/^\/\.(\/|$)/,Jt=/^\/\.\.(\/|$)/,qe=/^\/?(?:.|\n)*?(?=\/|$)/;function gt(w){for(var b=[];w.length;)if(w.match(It))w=w.replace(It,"");else if(w.match(lr))w=w.replace(lr,"/");else if(w.match(Jt))w=w.replace(Jt,"/"),b.pop();else if(w==="."||w==="..")w="";else{var k=w.match(qe);if(k){var P=k[0];w=w.slice(P.length),b.push(P)}else throw new Error("Unexpected dot segment condition")}return b.join("")}function at(w){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},k=b.iri?c:l,P=[],N=Te[(b.scheme||w.scheme||"").toLowerCase()];if(N&&N.serialize&&N.serialize(w,b),w.host&&!k.IPV6ADDRESS.test(w.host)){if(b.domainHost||N&&N.domainHost)try{w.host=b.iri?ne.toUnicode(w.host):ne.toASCII(w.host.replace(k.PCT_ENCODED,We).toLowerCase())}catch(ve){w.error=w.error||"Host's domain name can not be converted to "+(b.iri?"Unicode":"ASCII")+" via punycode: "+ve}}Re(w,k),b.reference!=="suffix"&&w.scheme&&(P.push(w.scheme),P.push(":"));var q=Ht(w,b);if(q!==void 0&&(b.reference!=="suffix"&&P.push("//"),P.push(q),w.path&&w.path.charAt(0)!=="/"&&P.push("/")),w.path!==void 0){var ce=w.path;!b.absolutePath&&(!N||!N.absolutePath)&&(ce=gt(ce)),q===void 0&&(ce=ce.replace(/^\/\//,"/%2F")),P.push(ce)}return w.query!==void 0&&(P.push("?"),P.push(w.query)),w.fragment!==void 0&&(P.push("#"),P.push(w.fragment)),P.join("")}function Qe(w,b){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},P=arguments[3],N={};return P||(w=fe(at(w,k),k),b=fe(at(b,k),k)),k=k||{},!k.tolerant&&b.scheme?(N.scheme=b.scheme,N.userinfo=b.userinfo,N.host=b.host,N.port=b.port,N.path=gt(b.path||""),N.query=b.query):(b.userinfo!==void 0||b.host!==void 0||b.port!==void 0?(N.userinfo=b.userinfo,N.host=b.host,N.port=b.port,N.path=gt(b.path||""),N.query=b.query):(b.path?(b.path.charAt(0)==="/"?N.path=gt(b.path):((w.userinfo!==void 0||w.host!==void 0||w.port!==void 0)&&!w.path?N.path="/"+b.path:w.path?N.path=w.path.slice(0,w.path.lastIndexOf("/")+1)+b.path:N.path=b.path,N.path=gt(N.path)),N.query=b.query):(N.path=w.path,b.query!==void 0?N.query=b.query:N.query=w.query),N.userinfo=w.userinfo,N.host=w.host,N.port=w.port),N.scheme=w.scheme),N.fragment=b.fragment,N}function Rt(w,b,k){var P=o({scheme:"null"},k);return at(Qe(fe(w,P),fe(b,P),P,!0),P)}function dt(w,b){return typeof w=="string"?w=at(fe(w,b),b):a(w)==="object"&&(w=fe(at(w,b),b)),w}function L(w,b,k){return typeof w=="string"?w=at(fe(w,k),k):a(w)==="object"&&(w=at(w,k)),typeof b=="string"?b=at(fe(b,k),k):a(b)==="object"&&(b=at(b,k)),w===b}function V(w,b){return w&&w.toString().replace(!b||!b.iri?l.ESCAPE:c.ESCAPE,Be)}function J(w,b){return w&&w.toString().replace(!b||!b.iri?l.PCT_ENCODED:c.PCT_ENCODED,We)}var le={scheme:"http",domainHost:!0,parse:function(b,k){return b.host||(b.error=b.error||"HTTP URIs must have a host."),b},serialize:function(b,k){var P=String(b.scheme).toLowerCase()==="https";return(b.port===(P?443:80)||b.port==="")&&(b.port=void 0),b.path||(b.path="/"),b}},Ee={scheme:"https",domainHost:le.domainHost,parse:le.parse,serialize:le.serialize};function ft(w){return typeof w.secure=="boolean"?w.secure:String(w.scheme).toLowerCase()==="wss"}var Et={scheme:"ws",domainHost:!0,parse:function(b,k){var P=b;return P.secure=ft(P),P.resourceName=(P.path||"/")+(P.query?"?"+P.query:""),P.path=void 0,P.query=void 0,P},serialize:function(b,k){if((b.port===(ft(b)?443:80)||b.port==="")&&(b.port=void 0),typeof b.secure=="boolean"&&(b.scheme=b.secure?"wss":"ws",b.secure=void 0),b.resourceName){var P=b.resourceName.split("?"),N=u(P,2),q=N[0],ce=N[1];b.path=q&&q!=="/"?q:void 0,b.query=ce,b.resourceName=void 0}return b.fragment=void 0,b}},Pt={scheme:"wss",domainHost:Et.domainHost,parse:Et.parse,serialize:Et.serialize},Ur={},Hr=!0,it="[A-Za-z0-9\\-\\.\\_\\~"+(Hr?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",et="[0-9A-Fa-f]",Vt=t(t("%[EFef]"+et+"%"+et+et+"%"+et+et)+"|"+t("%[89A-Fa-f]"+et+"%"+et+et)+"|"+t("%"+et+et)),yf="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",bf="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",vf=e(bf,'[\\"\\\\]'),_f="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Sf=new RegExp(it,"g"),Cn=new RegExp(Vt,"g"),Ef=new RegExp(e("[^]",yf,"[\\.]",'[\\"]',vf),"g"),tu=new RegExp(e("[^]",it,_f),"g"),wf=tu;function bs(w){var b=We(w);return b.match(Sf)?b:w}var ru={scheme:"mailto",parse:function(b,k){var P=b,N=P.to=P.path?P.path.split(","):[];if(P.path=void 0,P.query){for(var q=!1,ce={},ve=P.query.split("&"),we=0,Ke=ve.length;we<Ke;++we){var ye=ve[we].split("=");switch(ye[0]){case"to":for(var Me=ye[1].split(","),$e=0,Oe=Me.length;$e<Oe;++$e)N.push(Me[$e]);break;case"subject":P.subject=J(ye[1],k);break;case"body":P.body=J(ye[1],k);break;default:q=!0,ce[J(ye[0],k)]=J(ye[1],k);break}}q&&(P.headers=ce)}P.query=void 0;for(var _e=0,Fe=N.length;_e<Fe;++_e){var xe=N[_e].split("@");if(xe[0]=J(xe[0]),k.unicodeSupport)xe[1]=J(xe[1],k).toLowerCase();else try{xe[1]=ne.toASCII(J(xe[1],k).toLowerCase())}catch(Vr){P.error=P.error||"Email address's domain name can not be converted to ASCII via punycode: "+Vr}N[_e]=xe.join("@")}return P},serialize:function(b,k){var P=b,N=i(b.to);if(N){for(var q=0,ce=N.length;q<ce;++q){var ve=String(N[q]),we=ve.lastIndexOf("@"),Ke=ve.slice(0,we).replace(Cn,bs).replace(Cn,n).replace(Ef,Be),ye=ve.slice(we+1);try{ye=k.iri?ne.toUnicode(ye):ne.toASCII(J(ye,k).toLowerCase())}catch(_e){P.error=P.error||"Email address's domain name can not be converted to "+(k.iri?"Unicode":"ASCII")+" via punycode: "+_e}N[q]=Ke+"@"+ye}P.path=N.join(",")}var Me=b.headers=b.headers||{};b.subject&&(Me.subject=b.subject),b.body&&(Me.body=b.body);var $e=[];for(var Oe in Me)Me[Oe]!==Ur[Oe]&&$e.push(Oe.replace(Cn,bs).replace(Cn,n).replace(tu,Be)+"="+Me[Oe].replace(Cn,bs).replace(Cn,n).replace(wf,Be));return $e.length&&(P.query=$e.join("&")),P}},Cf=/^([^\:]+)\:(.*)/,nu={scheme:"urn",parse:function(b,k){var P=b.path&&b.path.match(Cf),N=b;if(P){var q=k.scheme||N.scheme||"urn",ce=P[1].toLowerCase(),ve=P[2],we=q+":"+(k.nid||ce),Ke=Te[we];N.nid=ce,N.nss=ve,N.path=void 0,Ke&&(N=Ke.parse(N,k))}else N.error=N.error||"URN can not be parsed.";return N},serialize:function(b,k){var P=k.scheme||b.scheme||"urn",N=b.nid,q=P+":"+(k.nid||N),ce=Te[q];ce&&(b=ce.serialize(b,k));var ve=b,we=b.nss;return ve.path=(N||k.nid)+":"+we,ve}},kf=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,au={scheme:"urn:uuid",parse:function(b,k){var P=b;return P.uuid=P.nss,P.nss=void 0,!k.tolerant&&(!P.uuid||!P.uuid.match(kf))&&(P.error=P.error||"UUID is not valid."),P},serialize:function(b,k){var P=b;return P.nss=(b.uuid||"").toLowerCase(),P}};Te[le.scheme]=le,Te[Ee.scheme]=Ee,Te[Et.scheme]=Et,Te[Pt.scheme]=Pt,Te[ru.scheme]=ru,Te[nu.scheme]=nu,Te[au.scheme]=au,r.SCHEMES=Te,r.pctEncChar=Be,r.pctDecChars=We,r.parse=fe,r.removeDotSegments=gt,r.serialize=at,r.resolveComponents=Qe,r.resolve=Rt,r.normalize=dt,r.equal=L,r.escapeComponent=V,r.unescapeComponent=J,Object.defineProperty(r,"__esModule",{value:!0})})});var Bi=te((wA,Dd)=>{"use strict";Dd.exports=function r(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var a,n,i;if(Array.isArray(e)){if(a=e.length,a!=t.length)return!1;for(n=a;n--!==0;)if(!r(e[n],t[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(i=Object.keys(e),a=i.length,a!==Object.keys(t).length)return!1;for(n=a;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[n]))return!1;for(n=a;n--!==0;){var o=i[n];if(!r(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}});var Od=te((CA,Nd)=>{"use strict";Nd.exports=function(e){for(var t=0,a=e.length,n=0,i;n<a;)t++,i=e.charCodeAt(n++),i>=55296&&i<=56319&&n<a&&(i=e.charCodeAt(n),(i&64512)==56320&&n++);return t}});var un=te((kA,Fd)=>{"use strict";Fd.exports={copy:r_,checkDataType:al,checkDataTypes:n_,coerceToTypes:a_,toHash:ol,getProperty:sl,escapeQuotes:ll,equal:Bi(),ucs2length:Od(),varOccurences:s_,varReplace:l_,schemaHasRules:c_,schemaHasRulesExcept:u_,schemaUnknownRules:d_,toQuotedString:il,getPathExpr:p_,getPath:m_,getData:f_,unescapeFragment:y_,unescapeJsonPointer:ul,escapeFragment:b_,escapeJsonPointer:cl};function r_(r,e){e=e||{};for(var t in r)e[t]=r[t];return e}function al(r,e,t,a){var n=a?" !== ":" === ",i=a?" || ":" && ",o=a?"!":"",s=a?"":"!";switch(r){case"null":return e+n+"null";case"array":return o+"Array.isArray("+e+")";case"object":return"("+o+e+i+"typeof "+e+n+'"object"'+i+s+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+n+'"number"'+i+s+"("+e+" % 1)"+i+e+n+e+(t?i+o+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+n+'"'+r+'"'+(t?i+o+"isFinite("+e+")":"")+")";default:return"typeof "+e+n+'"'+r+'"'}}function n_(r,e,t){switch(r.length){case 1:return al(r[0],e,t,!0);default:var a="",n=ol(r);n.array&&n.object&&(a=n.null?"(":"(!"+e+" || ",a+="typeof "+e+' !== "object")',delete n.null,delete n.array,delete n.object),n.number&&delete n.integer;for(var i in n)a+=(a?" && ":"")+al(i,e,t,!0);return a}}var Ld=ol(["string","number","integer","boolean","null"]);function a_(r,e){if(Array.isArray(e)){for(var t=[],a=0;a<e.length;a++){var n=e[a];(Ld[n]||r==="array"&&n==="array")&&(t[t.length]=n)}if(t.length)return t}else{if(Ld[e])return[e];if(r==="array"&&e==="array")return["array"]}}function ol(r){for(var e={},t=0;t<r.length;t++)e[r[t]]=!0;return e}var i_=/^[a-z$_][a-z$_0-9]*$/i,o_=/'|\\/g;function sl(r){return typeof r=="number"?"["+r+"]":i_.test(r)?"."+r:"['"+ll(r)+"']"}function ll(r){return r.replace(o_,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function s_(r,e){e+="[^0-9]";var t=r.match(new RegExp(e,"g"));return t?t.length:0}function l_(r,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),r.replace(new RegExp(e,"g"),t+"$1")}function c_(r,e){if(typeof r=="boolean")return!r;for(var t in r)if(e[t])return!0}function u_(r,e,t){if(typeof r=="boolean")return!r&&t!="not";for(var a in r)if(a!=t&&e[a])return!0}function d_(r,e){if(typeof r!="boolean"){for(var t in r)if(!e[t])return t}}function il(r){return"'"+ll(r)+"'"}function p_(r,e,t,a){var n=t?"'/' + "+e+(a?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):a?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Md(r,n)}function m_(r,e,t){var a=il(t?"/"+cl(e):sl(e));return Md(r,a)}var h_=/^\/(?:[^~]|~0|~1)*$/,g_=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function f_(r,e,t){var a,n,i,o;if(r==="")return"rootData";if(r[0]=="/"){if(!h_.test(r))throw new Error("Invalid JSON-pointer: "+r);n=r,i="rootData"}else{if(o=r.match(g_),!o)throw new Error("Invalid JSON-pointer: "+r);if(a=+o[1],n=o[2],n=="#"){if(a>=e)throw new Error("Cannot access property/index "+a+" levels up, current level is "+e);return t[e-a]}if(a>e)throw new Error("Cannot access data "+a+" levels up, current level is "+e);if(i="data"+(e-a||""),!n)return i}for(var s=i,l=n.split("/"),c=0;c<l.length;c++){var u=l[c];u&&(i+=sl(ul(u)),s+=" && "+i)}return s}function Md(r,e){return r=='""'?e:(r+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function y_(r){return ul(decodeURIComponent(r))}function b_(r){return encodeURIComponent(cl(r))}function cl(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}function ul(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")}});var dl=te((TA,Bd)=>{"use strict";var v_=un();Bd.exports=__;function __(r){v_.copy(r,this)}});var zd=te((xA,Gd)=>{"use strict";var Pr=Gd.exports=function(r,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var a=typeof t=="function"?t:t.pre||function(){},n=t.post||function(){};Gi(e,a,n,r,"",r)};Pr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Pr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Pr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Pr.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 Gi(r,e,t,a,n,i,o,s,l,c){if(a&&typeof a=="object"&&!Array.isArray(a)){e(a,n,i,o,s,l,c);for(var u in a){var p=a[u];if(Array.isArray(p)){if(u in Pr.arrayKeywords)for(var m=0;m<p.length;m++)Gi(r,e,t,p[m],n+"/"+u+"/"+m,i,n,u,a,m)}else if(u in Pr.propsKeywords){if(p&&typeof p=="object")for(var d in p)Gi(r,e,t,p[d],n+"/"+u+"/"+S_(d),i,n,u,a,d)}else(u in Pr.keywords||r.allKeys&&!(u in Pr.skipKeywords))&&Gi(r,e,t,p,n+"/"+u,i,n,u,a)}t(a,n,i,o,s,l,c)}}function S_(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}});var ji=te((AA,Wd)=>{"use strict";var Ca=Pd(),Ud=Bi(),Vi=un(),zi=dl(),E_=zd();Wd.exports=Nr;Nr.normalizeId=Dr;Nr.fullPath=Ui;Nr.url=Hi;Nr.ids=x_;Nr.inlineRef=pl;Nr.schema=Wi;function Nr(r,e,t){var a=this._refs[t];if(typeof a=="string")if(this._refs[a])a=this._refs[a];else return Nr.call(this,r,e,a);if(a=a||this._schemas[t],a instanceof zi)return pl(a.schema,this._opts.inlineRefs)?a.schema:a.validate||this._compile(a);var n=Wi.call(this,e,t),i,o,s;return n&&(i=n.schema,e=n.root,s=n.baseId),i instanceof zi?o=i.validate||r.call(this,i.schema,e,void 0,s):i!==void 0&&(o=pl(i,this._opts.inlineRefs)?i:r.call(this,i,e,void 0,s)),o}function Wi(r,e){var t=Ca.parse(e),a=Vd(t),n=Ui(this._getId(r.schema));if(Object.keys(r.schema).length===0||a!==n){var i=Dr(a),o=this._refs[i];if(typeof o=="string")return w_.call(this,r,o,t);if(o instanceof zi)o.validate||this._compile(o),r=o;else if(o=this._schemas[i],o instanceof zi){if(o.validate||this._compile(o),i==Dr(e))return{schema:o,root:r,baseId:n};r=o}else return;if(!r.schema)return;n=Ui(this._getId(r.schema))}return Hd.call(this,t,n,r.schema,r)}function w_(r,e,t){var a=Wi.call(this,r,e);if(a){var n=a.schema,i=a.baseId;r=a.root;var o=this._getId(n);return o&&(i=Hi(i,o)),Hd.call(this,t,i,n,r)}}var C_=Vi.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Hd(r,e,t,a){if(r.fragment=r.fragment||"",r.fragment.slice(0,1)=="/"){for(var n=r.fragment.split("/"),i=1;i<n.length;i++){var o=n[i];if(o){if(o=Vi.unescapeFragment(o),t=t[o],t===void 0)break;var s;if(!C_[o]&&(s=this._getId(t),s&&(e=Hi(e,s)),t.$ref)){var l=Hi(e,t.$ref),c=Wi.call(this,a,l);c&&(t=c.schema,a=c.root,e=c.baseId)}}}if(t!==void 0&&t!==a.schema)return{schema:t,root:a,baseId:e}}}var k_=Vi.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function pl(r,e){if(e===!1)return!1;if(e===void 0||e===!0)return ml(r);if(e)return hl(r)<=e}function ml(r){var e;if(Array.isArray(r)){for(var t=0;t<r.length;t++)if(e=r[t],typeof e=="object"&&!ml(e))return!1}else for(var a in r)if(a=="$ref"||(e=r[a],typeof e=="object"&&!ml(e)))return!1;return!0}function hl(r){var e=0,t;if(Array.isArray(r)){for(var a=0;a<r.length;a++)if(t=r[a],typeof t=="object"&&(e+=hl(t)),e==1/0)return 1/0}else for(var n in r){if(n=="$ref")return 1/0;if(k_[n])e++;else if(t=r[n],typeof t=="object"&&(e+=hl(t)+1),e==1/0)return 1/0}return e}function Ui(r,e){e!==!1&&(r=Dr(r));var t=Ca.parse(r);return Vd(t)}function Vd(r){return Ca.serialize(r).split("#")[0]+"#"}var T_=/#\/?$/;function Dr(r){return r?r.replace(T_,""):""}function Hi(r,e){return e=Dr(e),Ca.resolve(r,e)}function x_(r){var e=Dr(this._getId(r)),t={"":e},a={"":Ui(e,!1)},n={},i=this;return E_(r,{allKeys:!0},function(o,s,l,c,u,p,m){if(s!==""){var d=i._getId(o),g=t[c],f=a[c]+"/"+u;if(m!==void 0&&(f+="/"+(typeof m=="number"?m:Vi.escapeFragment(m))),typeof d=="string"){d=g=Dr(g?Ca.resolve(g,d):d);var y=i._refs[d];if(typeof y=="string"&&(y=i._refs[y]),y&&y.schema){if(!Ud(o,y.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=Dr(f))if(d[0]=="#"){if(n[d]&&!Ud(o,n[d]))throw new Error('id "'+d+'" resolves to more than one schema');n[d]=o}else i._refs[d]=f}t[s]=g,a[s]=f}}),n}});var qi=te((IA,qd)=>{"use strict";var gl=ji();qd.exports={Validation:jd(A_),MissingRef:jd(fl)};function A_(r){this.message="validation failed",this.errors=r,this.ajv=this.validation=!0}fl.message=function(r,e){return"can't resolve reference "+e+" from id "+r};function fl(r,e,t){this.message=t||fl.message(r,e),this.missingRef=gl.url(r,e),this.missingSchema=gl.normalizeId(gl.fullPath(this.missingRef))}function jd(r){return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}});var yl=te((RA,Kd)=>{"use strict";Kd.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,a=e.cmp&&function(i){return function(o){return function(s,l){var c={key:s,value:o[s]},u={key:l,value:o[l]};return i(c,u)}}}(e.cmp),n=[];return function i(o){if(o&&o.toJSON&&typeof o.toJSON=="function"&&(o=o.toJSON()),o!==void 0){if(typeof o=="number")return isFinite(o)?""+o:"null";if(typeof o!="object")return JSON.stringify(o);var s,l;if(Array.isArray(o)){for(l="[",s=0;s<o.length;s++)s&&(l+=","),l+=i(o[s])||"null";return l+"]"}if(o===null)return"null";if(n.indexOf(o)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var c=n.push(o)-1,u=Object.keys(o).sort(a&&a(o));for(l="",s=0;s<u.length;s++){var p=u[s],m=i(o[p]);m&&(l&&(l+=","),l+=JSON.stringify(p)+":"+m)}return n.splice(c,1),"{"+l+"}"}}(r)}});var bl=te((PA,$d)=>{"use strict";$d.exports=function(e,t,a){var n="",i=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),s=e.self._getId(e.schema);if(e.opts.strictKeywords){var l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var c="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(n+=" var validate = ",i&&(e.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",s&&(e.opts.sourceCode||e.opts.processCode)&&(n+=" "+("/*# sourceURL="+s+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var t="false schema",u=e.level,p=e.dataLevel,m=e.schema[t],d=e.schemaPath+e.util.getProperty(t),g=e.errSchemaPath+"/"+t,D=!e.opts.allErrors,F,f="data"+(p||""),I="valid"+u;if(e.schema===!1){e.isTop?D=!0:n+=" var "+I+" = false; ";var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(F||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'boolean schema is false' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var v=n;n=y.pop(),!e.compositeRule&&D?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?i?n+=" return data; ":n+=" validate.errors = null; return true; ":n+=" var "+I+" = true; ";return e.isTop&&(n+=" }; return validate; "),n}if(e.isTop){var T=e.isTop,u=e.level=0,p=e.dataLevel=0,f="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var E="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}n+=" var vErrors = null; ",n+=" var errors = 0; ",n+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,p=e.dataLevel,f="data"+(p||"");if(s&&(e.baseId=e.resolve.url(e.baseId,s)),i&&!e.async)throw new Error("async schema in sync schema");n+=" var errs_"+u+" = errors;"}var I="valid"+u,D=!e.opts.allErrors,C="",M="",F,R=e.schema.type,G=Array.isArray(R);if(R&&e.opts.nullable&&e.schema.nullable===!0&&(G?R.indexOf("null")==-1&&(R=R.concat("null")):R!="null"&&(R=[R,"null"],G=!0)),G&&R.length==1&&(R=R[0],G=!1),e.schema.$ref&&o){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(o=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(n+=" "+e.RULES.all.$comment.code(e,"$comment")),R){if(e.opts.coerceTypes)var z=e.util.coerceToTypes(e.opts.coerceTypes,R);var O=e.RULES.types[R];if(z||G||O===!0||O&&!qe(O)){var d=e.schemaPath+".type",g=e.errSchemaPath+"/type",d=e.schemaPath+".type",g=e.errSchemaPath+"/type",x=G?"checkDataTypes":"checkDataType";if(n+=" if ("+e.util[x](R,f,e.opts.strictNumbers,!0)+") { ",z){var A="dataType"+u,B="coerced"+u;n+=" var "+A+" = typeof "+f+"; var "+B+" = undefined; ",e.opts.coerceTypes=="array"&&(n+=" if ("+A+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+A+" = typeof "+f+"; if ("+e.util.checkDataType(e.schema.type,f,e.opts.strictNumbers)+") "+B+" = "+f+"; } "),n+=" if ("+B+" !== undefined) ; ";var X=z;if(X)for(var K,Q=-1,Z=X.length-1;Q<Z;)K=X[Q+=1],K=="string"?n+=" else if ("+A+" == 'number' || "+A+" == 'boolean') "+B+" = '' + "+f+"; else if ("+f+" === null) "+B+" = ''; ":K=="number"||K=="integer"?(n+=" else if ("+A+" == 'boolean' || "+f+" === null || ("+A+" == 'string' && "+f+" && "+f+" == +"+f+" ",K=="integer"&&(n+=" && !("+f+" % 1)"),n+=")) "+B+" = +"+f+"; "):K=="boolean"?n+=" else if ("+f+" === 'false' || "+f+" === 0 || "+f+" === null) "+B+" = false; else if ("+f+" === 'true' || "+f+" === 1) "+B+" = true; ":K=="null"?n+=" else if ("+f+" === '' || "+f+" === 0 || "+f+" === false) "+B+" = null; ":e.opts.coerceTypes=="array"&&K=="array"&&(n+=" else if ("+A+" == 'string' || "+A+" == 'number' || "+A+" == 'boolean' || "+f+" == null) "+B+" = ["+f+"]; ");n+=" else { ";var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(F||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",G?n+=""+R.join(","):n+=""+R,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",G?n+=""+R.join(","):n+=""+R,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var v=n;n=y.pop(),!e.compositeRule&&D?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } if ("+B+" !== undefined) { ";var _=p?"data"+(p-1||""):"parentData",ge=p?e.dataPathArr[p]:"parentDataProperty";n+=" "+f+" = "+B+"; ",p||(n+="if ("+_+" !== undefined)"),n+=" "+_+"["+ge+"] = "+B+"; } "}else{var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(F||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",G?n+=""+R.join(","):n+=""+R,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",G?n+=""+R.join(","):n+=""+R,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var v=n;n=y.pop(),!e.compositeRule&&D?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}n+=" } "}}if(e.schema.$ref&&!o)n+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",D&&(n+=" } if (errors === ",T?n+="0":n+="errs_"+u,n+=") { ",M+="}");else{var Ie=e.RULES;if(Ie){for(var O,S=-1,ne=Ie.length-1;S<ne;)if(O=Ie[S+=1],qe(O)){if(O.type&&(n+=" if ("+e.util.checkDataType(O.type,f,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(O.type=="object"&&e.schema.properties){var m=e.schema.properties,Te=Object.keys(m),Be=Te;if(Be)for(var We,Re=-1,ut=Be.length-1;Re<ut;){We=Be[Re+=1];var Se=m[We];if(Se.default!==void 0){var Ce=f+e.util.getProperty(We);if(e.compositeRule){if(e.opts.strictDefaults){var E="default is ignored for: "+Ce;if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}}else n+=" if ("+Ce+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+Ce+" === null || "+Ce+" === '' "),n+=" ) "+Ce+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(Se.default)+" ":n+=" "+JSON.stringify(Se.default)+" ",n+="; "}}}else if(O.type=="array"&&Array.isArray(e.schema.items)){var ht=e.schema.items;if(ht){for(var Se,Q=-1,je=ht.length-1;Q<je;)if(Se=ht[Q+=1],Se.default!==void 0){var Ce=f+"["+Q+"]";if(e.compositeRule){if(e.opts.strictDefaults){var E="default is ignored for: "+Ce;if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}}else n+=" if ("+Ce+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+Ce+" === null || "+Ce+" === '' "),n+=" ) "+Ce+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(Se.default)+" ":n+=" "+JSON.stringify(Se.default)+" ",n+="; "}}}}var fe=O.rules;if(fe){for(var Ht,It=-1,lr=fe.length-1;It<lr;)if(Ht=fe[It+=1],gt(Ht)){var Jt=Ht.code(e,Ht.keyword,O.type);Jt&&(n+=" "+Jt+" ",D&&(C+="}"))}}if(D&&(n+=" "+C+" ",C=""),O.type&&(n+=" } ",R&&R===O.type&&!z)){n+=" else { ";var d=e.schemaPath+".type",g=e.errSchemaPath+"/type",y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(F||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",G?n+=""+R.join(","):n+=""+R,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",G?n+=""+R.join(","):n+=""+R,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var v=n;n=y.pop(),!e.compositeRule&&D?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } "}D&&(n+=" if (errors === ",T?n+="0":n+="errs_"+u,n+=") { ",M+="}")}}}D&&(n+=" "+M+" "),T?(i?(n+=" if (errors === 0) return data; ",n+=" else throw new ValidationError(vErrors); "):(n+=" validate.errors = vErrors; ",n+=" return errors === 0; "),n+=" }; return validate;"):n+=" var "+I+" = errors === errs_"+u+";";function qe(Qe){for(var Rt=Qe.rules,dt=0;dt<Rt.length;dt++)if(gt(Rt[dt]))return!0}function gt(Qe){return e.schema[Qe.keyword]!==void 0||Qe.implements&&at(Qe)}function at(Qe){for(var Rt=Qe.implements,dt=0;dt<Rt.length;dt++)if(e.schema[Rt[dt]]!==void 0)return!0}return n}});var Qd=te((DA,Jd)=>{"use strict";var Ki=ji(),Xi=un(),Yd=qi(),I_=yl(),Xd=bl(),R_=Xi.ucs2length,P_=Bi(),D_=Yd.Validation;Jd.exports=vl;function vl(r,e,t,a){var n=this,i=this._opts,o=[void 0],s={},l=[],c={},u=[],p={},m=[];e=e||{schema:r,refVal:o,refs:s};var d=N_.call(this,r,e,a),g=this._compilations[d.index];if(d.compiling)return g.callValidate=E;var f=this._formats,y=this.RULES;try{var v=I(r,e,t,a);g.validate=v;var T=g.callValidate;return T&&(T.schema=v.schema,T.errors=null,T.refs=v.refs,T.refVal=v.refVal,T.root=v.root,T.$async=v.$async,i.sourceCode&&(T.source=v.source)),v}finally{O_.call(this,r,e,a)}function E(){var x=g.validate,A=x.apply(this,arguments);return E.errors=x.errors,A}function I(x,A,B,X){var K=!A||A&&A.schema==x;if(A.schema!=e.schema)return vl.call(n,x,A,B,X);var Q=x.$async===!0,Z=Xd({isTop:!0,schema:x,isRoot:K,baseId:X,root:A,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Yd.MissingRef,RULES:y,validate:Xd,util:Xi,resolve:Ki,resolveRef:D,usePattern:G,useDefault:z,useCustomRule:O,opts:i,formats:f,logger:n.logger,self:n});Z=$i(o,F_)+$i(l,L_)+$i(u,M_)+$i(m,B_)+Z,i.processCode&&(Z=i.processCode(Z,x));var _;try{var ge=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Z);_=ge(n,y,f,e,o,u,m,P_,R_,D_),o[0]=_}catch(Ie){throw n.logger.error("Error compiling schema, function code:",Z),Ie}return _.schema=x,_.errors=null,_.refs=s,_.refVal=o,_.root=K?_:A,Q&&(_.$async=!0),i.sourceCode===!0&&(_.source={code:Z,patterns:l,defaults:u}),_}function D(x,A,B){A=Ki.url(x,A);var X=s[A],K,Q;if(X!==void 0)return K=o[X],Q="refVal["+X+"]",R(K,Q);if(!B&&e.refs){var Z=e.refs[A];if(Z!==void 0)return K=e.refVal[Z],Q=C(A,K),R(K,Q)}Q=C(A);var _=Ki.call(n,I,e,A);if(_===void 0){var ge=t&&t[A];ge&&(_=Ki.inlineRef(ge,i.inlineRefs)?ge:vl.call(n,ge,e,t,x))}if(_===void 0)M(A);else return F(A,_),R(_,Q)}function C(x,A){var B=o.length;return o[B]=A,s[x]=B,"refVal"+B}function M(x){delete s[x]}function F(x,A){var B=s[x];o[B]=A}function R(x,A){return typeof x=="object"||typeof x=="boolean"?{code:A,schema:x,inline:!0}:{code:A,$async:x&&!!x.$async}}function G(x){var A=c[x];return A===void 0&&(A=c[x]=l.length,l[A]=x),"pattern"+A}function z(x){switch(typeof x){case"boolean":case"number":return""+x;case"string":return Xi.toQuotedString(x);case"object":if(x===null)return"null";var A=I_(x),B=p[A];return B===void 0&&(B=p[A]=u.length,u[B]=x),"default"+B}}function O(x,A,B,X){if(n._opts.validateSchema!==!1){var K=x.definition.dependencies;if(K&&!K.every(function(Be){return Object.prototype.hasOwnProperty.call(B,Be)}))throw new Error("parent schema must have all required keywords: "+K.join(","));var Q=x.definition.validateSchema;if(Q){var Z=Q(A);if(!Z){var _="keyword schema is invalid: "+n.errorsText(Q.errors);if(n._opts.validateSchema=="log")n.logger.error(_);else throw new Error(_)}}}var ge=x.definition.compile,Ie=x.definition.inline,S=x.definition.macro,ne;if(ge)ne=ge.call(n,A,B,X);else if(S)ne=S.call(n,A,B,X),i.validateSchema!==!1&&n.validateSchema(ne,!0);else if(Ie)ne=Ie.call(n,X,x.keyword,A,B);else if(ne=x.definition.validate,!ne)return;if(ne===void 0)throw new Error('custom keyword "'+x.keyword+'"failed to compile');var Te=m.length;return m[Te]=ne,{code:"customRule"+Te,validate:ne}}}function N_(r,e,t){var a=Zd.call(this,r,e,t);return a>=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:r,root:e,baseId:t},{index:a,compiling:!1})}function O_(r,e,t){var a=Zd.call(this,r,e,t);a>=0&&this._compilations.splice(a,1)}function Zd(r,e,t){for(var a=0;a<this._compilations.length;a++){var n=this._compilations[a];if(n.schema==r&&n.root==e&&n.baseId==t)return a}return-1}function L_(r,e){return"var pattern"+r+" = new RegExp("+Xi.toQuotedString(e[r])+");"}function M_(r){return"var default"+r+" = defaults["+r+"];"}function F_(r,e){return e[r]===void 0?"":"var refVal"+r+" = refVal["+r+"];"}function B_(r){return"var customRule"+r+" = customRules["+r+"];"}function $i(r,e){if(!r.length)return"";for(var t="",a=0;a<r.length;a++)t+=e(a,r);return t}});var tp=te((NA,ep)=>{"use strict";var Yi=ep.exports=function(){this._cache={}};Yi.prototype.put=function(e,t){this._cache[e]=t};Yi.prototype.get=function(e){return this._cache[e]};Yi.prototype.del=function(e){delete this._cache[e]};Yi.prototype.clear=function(){this._cache={}}});var mp=te((OA,pp)=>{"use strict";var G_=un(),z_=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,U_=[0,31,28,31,30,31,30,31,31,30,31,30,31],H_=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,rp=/^(?=.{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,V_=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,W_=/^(?:[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,np=/^(?:(?:[^\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,ap=/^(?:(?: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,ip=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,op=/^(?:\/(?:[^~/]|~0|~1)*)*$/,sp=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,lp=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;pp.exports=Zi;function Zi(r){return r=r=="full"?"full":"fast",G_.copy(Zi[r])}Zi.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":np,url:ap,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:rp,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:dp,uuid:ip,"json-pointer":op,"json-pointer-uri-fragment":sp,"relative-json-pointer":lp};Zi.full={date:cp,time:up,"date-time":K_,uri:X_,"uri-reference":W_,"uri-template":np,url:ap,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:rp,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:dp,uuid:ip,"json-pointer":op,"json-pointer-uri-fragment":sp,"relative-json-pointer":lp};function j_(r){return r%4===0&&(r%100!==0||r%400===0)}function cp(r){var e=r.match(z_);if(!e)return!1;var t=+e[1],a=+e[2],n=+e[3];return a>=1&&a<=12&&n>=1&&n<=(a==2&&j_(t)?29:U_[a])}function up(r,e){var t=r.match(H_);if(!t)return!1;var a=t[1],n=t[2],i=t[3],o=t[5];return(a<=23&&n<=59&&i<=59||a==23&&n==59&&i==60)&&(!e||o)}var q_=/t|\s/i;function K_(r){var e=r.split(q_);return e.length==2&&cp(e[0])&&up(e[1],!0)}var $_=/\/|:/;function X_(r){return $_.test(r)&&V_.test(r)}var Y_=/[^\\]\\Z/;function dp(r){if(Y_.test(r))return!1;try{return new RegExp(r),!0}catch{return!1}}});var gp=te((LA,hp)=>{"use strict";hp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(o||""),p="valid"+i,m,d;if(s=="#"||s=="#/")e.isRoot?(m=e.async,d="validate"):(m=e.root.schema.$async===!0,d="root.refVal[0]");else{var g=e.resolveRef(e.baseId,s,e.isRoot);if(g===void 0){var f=e.MissingRefError.message(e.baseId,s);if(e.opts.missingRefs=="fail"){e.logger.error(f);var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(s)+"' } ",e.opts.messages!==!1&&(n+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(s)+"' "),e.opts.verbose&&(n+=" , schema: "+e.util.toQuotedString(s)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),n+=" } "):n+=" {} ";var v=n;n=y.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(n+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(f),c&&(n+=" if (true) { ");else throw new e.MissingRefError(e.baseId,s,f)}else if(g.inline){var T=e.util.copy(e);T.level++;var E="valid"+T.level;T.schema=g.schema,T.schemaPath="",T.errSchemaPath=s;var I=e.validate(T).replace(/validate\.schema/g,g.code);n+=" "+I+" ",c&&(n+=" if ("+E+") { ")}else m=g.$async===!0||e.async&&g.$async!==!1,d=g.code}if(d){var y=y||[];y.push(n),n="",e.opts.passContext?n+=" "+d+".call(this, ":n+=" "+d+"( ",n+=" "+u+", (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var D=o?"data"+(o-1||""):"parentData",C=o?e.dataPathArr[o]:"parentDataProperty";n+=" , "+D+" , "+C+", rootData) ";var M=n;if(n=y.pop(),m){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(n+=" var "+p+"; "),n+=" try { await "+M+"; ",c&&(n+=" "+p+" = true; "),n+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(n+=" "+p+" = false; "),n+=" } ",c&&(n+=" if ("+p+") { ")}else n+=" if (!"+M+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",c&&(n+=" else { ")}return n}});var yp=te((MA,fp)=>{"use strict";fp.exports=function(e,t,a){var n=" ",i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),s=e.errSchemaPath+"/"+t,l=!e.opts.allErrors,c=e.util.copy(e),u="";c.level++;var p="valid"+c.level,m=c.baseId,d=!0,g=i;if(g)for(var f,y=-1,v=g.length-1;y<v;)f=g[y+=1],(e.opts.strictKeywords?typeof f=="object"&&Object.keys(f).length>0||f===!1:e.util.schemaHasRules(f,e.RULES.all))&&(d=!1,c.schema=f,c.schemaPath=o+"["+y+"]",c.errSchemaPath=s+"/"+y,n+=" "+e.validate(c)+" ",c.baseId=m,l&&(n+=" if ("+p+") { ",u+="}"));return l&&(d?n+=" if (true) { ":n+=" "+u.slice(0,-1)+" "),n}});var vp=te((FA,bp)=>{"use strict";bp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,v=s.every(function(F){return e.opts.strictKeywords?typeof F=="object"&&Object.keys(F).length>0||F===!1:e.util.schemaHasRules(F,e.RULES.all)});if(v){var T=g.baseId;n+=" var "+d+" = errors; var "+m+" = false; ";var E=e.compositeRule;e.compositeRule=g.compositeRule=!0;var I=s;if(I)for(var D,C=-1,M=I.length-1;C<M;)D=I[C+=1],g.schema=D,g.schemaPath=l+"["+C+"]",g.errSchemaPath=c+"/"+C,n+=" "+e.validate(g)+" ",g.baseId=T,n+=" "+m+" = "+m+" || "+y+"; if (!"+m+") { ",f+="}";e.compositeRule=g.compositeRule=E,n+=" "+f+" if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else u&&(n+=" if (true) { ");return n}});var Sp=te((BA,_p)=>{"use strict";_p.exports=function(e,t,a){var n=" ",i=e.schema[t],o=e.errSchemaPath+"/"+t,s=!e.opts.allErrors,l=e.util.toQuotedString(i);return e.opts.$comment===!0?n+=" console.log("+l+");":typeof e.opts.$comment=="function"&&(n+=" self._opts.$comment("+l+", "+e.util.toQuotedString(o)+", validate.root.schema);"),n}});var wp=te((GA,Ep)=>{"use strict";Ep.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d=e.opts.$data&&s&&s.$data,g;d?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",g="schema"+i):g=s,d||(n+=" var schema"+i+" = validate.schema"+l+";"),n+="var "+m+" = equal("+p+", schema"+i+"); if (!"+m+") { ";var f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be equal to constant' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;return n=f.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",u&&(n+=" else { "),n}});var kp=te((zA,Cp)=>{"use strict";Cp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,v="i"+i,T=g.dataLevel=e.dataLevel+1,E="data"+T,I=e.baseId,D=e.opts.strictKeywords?typeof s=="object"&&Object.keys(s).length>0||s===!1:e.util.schemaHasRules(s,e.RULES.all);if(n+="var "+d+" = errors;var "+m+";",D){var C=e.compositeRule;e.compositeRule=g.compositeRule=!0,g.schema=s,g.schemaPath=l,g.errSchemaPath=c,n+=" var "+y+" = false; for (var "+v+" = 0; "+v+" < "+p+".length; "+v+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var M=p+"["+v+"]";g.dataPathArr[T]=v;var F=e.validate(g);g.baseId=I,e.util.varOccurences(F,E)<2?n+=" "+e.util.varReplace(F,E,M)+" ":n+=" var "+E+" = "+M+"; "+F+" ",n+=" if ("+y+") break; } ",e.compositeRule=g.compositeRule=C,n+=" "+f+" if (!"+y+") {"}else n+=" if ("+p+".length == 0) {";var R=R||[];R.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should contain a valid item' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var G=n;return n=R.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+G+"]); ":n+=" validate.errors = ["+G+"]; return false; ":n+=" var err = "+G+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { ",D&&(n+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(n+=" } "),n}});var xp=te((UA,Tp)=>{"use strict";Tp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="errs__"+i,d=e.util.copy(e),g="";d.level++;var f="valid"+d.level,y={},v={},T=e.opts.ownProperties;for(C in s)if(C!="__proto__"){var E=s[C],I=Array.isArray(E)?v:y;I[C]=E}n+="var "+m+" = errors;";var D=e.errorPath;n+="var missing"+i+";";for(var C in v)if(I=v[C],I.length){if(n+=" if ( "+p+e.util.getProperty(C)+" !== undefined ",T&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(C)+"') "),u){n+=" && ( ";var M=I;if(M)for(var F,R=-1,G=M.length-1;R<G;){F=M[R+=1],R&&(n+=" || ");var z=e.util.getProperty(F),O=p+z;n+=" ( ( "+O+" === undefined ",T&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(F)+"') "),n+=") && (missing"+i+" = "+e.util.toQuotedString(e.opts.jsonPointers?F:z)+") ) "}n+=")) { ";var x="missing"+i,A="' + "+x+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(D,x,!0):D+" + "+x);var B=B||[];B.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(C)+"', missingProperty: '"+A+"', depsCount: "+I.length+", deps: '"+e.util.escapeQuotes(I.length==1?I[0]:I.join(", "))+"' } ",e.opts.messages!==!1&&(n+=" , message: 'should have ",I.length==1?n+="property "+e.util.escapeQuotes(I[0]):n+="properties "+e.util.escapeQuotes(I.join(", ")),n+=" when property "+e.util.escapeQuotes(C)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var X=n;n=B.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+X+"]); ":n+=" validate.errors = ["+X+"]; return false; ":n+=" var err = "+X+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{n+=" ) { ";var K=I;if(K)for(var F,Q=-1,Z=K.length-1;Q<Z;){F=K[Q+=1];var z=e.util.getProperty(F),A=e.util.escapeQuotes(F),O=p+z;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(D,F,e.opts.jsonPointers)),n+=" if ( "+O+" === undefined ",T&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(F)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(C)+"', missingProperty: '"+A+"', depsCount: "+I.length+", deps: '"+e.util.escapeQuotes(I.length==1?I[0]:I.join(", "))+"' } ",e.opts.messages!==!1&&(n+=" , message: 'should have ",I.length==1?n+="property "+e.util.escapeQuotes(I[0]):n+="properties "+e.util.escapeQuotes(I.join(", ")),n+=" when property "+e.util.escapeQuotes(C)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}n+=" } ",u&&(g+="}",n+=" else { ")}e.errorPath=D;var _=d.baseId;for(var C in y){var E=y[C];(e.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===!1:e.util.schemaHasRules(E,e.RULES.all))&&(n+=" "+f+" = true; if ( "+p+e.util.getProperty(C)+" !== undefined ",T&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(C)+"') "),n+=") { ",d.schema=E,d.schemaPath=l+e.util.getProperty(C),d.errSchemaPath=c+"/"+e.util.escapeFragment(C),n+=" "+e.validate(d)+" ",d.baseId=_,n+=" } ",u&&(n+=" if ("+f+") { ",g+="}"))}return u&&(n+=" "+g+" if ("+m+" == errors) {"),n}});var Ip=te((HA,Ap)=>{"use strict";Ap.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d=e.opts.$data&&s&&s.$data,g;d?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",g="schema"+i):g=s;var f="i"+i,y="schema"+i;d||(n+=" var "+y+" = validate.schema"+l+";"),n+="var "+m+";",d&&(n+=" if (schema"+i+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+i+")) "+m+" = false; else {"),n+=""+m+" = false;for (var "+f+"=0; "+f+"<"+y+".length; "+f+"++) if (equal("+p+", "+y+"["+f+"])) { "+m+" = true; break; }",d&&(n+=" } "),n+=" if (!"+m+") { ";var v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var T=n;return n=v.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+T+"]); ":n+=" validate.errors = ["+T+"]; return false; ":n+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",u&&(n+=" else { "),n}});var Pp=te((VA,Rp)=>{"use strict";Rp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||"");if(e.opts.format===!1)return u&&(n+=" if (true) { "),n;var m=e.opts.$data&&s&&s.$data,d;m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s;var g=e.opts.unknownFormats,f=Array.isArray(g);if(m){var y="format"+i,v="isObject"+i,T="formatType"+i;n+=" var "+y+" = formats["+d+"]; var "+v+" = typeof "+y+" == 'object' && !("+y+" instanceof RegExp) && "+y+".validate; var "+T+" = "+v+" && "+y+".type || 'string'; if ("+v+") { ",e.async&&(n+=" var async"+i+" = "+y+".async; "),n+=" "+y+" = "+y+".validate; } if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),n+=" (",g!="ignore"&&(n+=" ("+d+" && !"+y+" ",f&&(n+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),n+=") || "),n+=" ("+y+" && "+T+" == '"+a+"' && !(typeof "+y+" == 'function' ? ",e.async?n+=" (async"+i+" ? await "+y+"("+p+") : "+y+"("+p+")) ":n+=" "+y+"("+p+") ",n+=" : "+y+".test("+p+"))))) {"}else{var y=e.formats[s];if(!y){if(g=="ignore")return e.logger.warn('unknown format "'+s+'" ignored in schema at path "'+e.errSchemaPath+'"'),u&&(n+=" if (true) { "),n;if(f&&g.indexOf(s)>=0)return u&&(n+=" if (true) { "),n;throw new Error('unknown format "'+s+'" is used in schema at path "'+e.errSchemaPath+'"')}var v=typeof y=="object"&&!(y instanceof RegExp)&&y.validate,T=v&&y.type||"string";if(v){var E=y.async===!0;y=y.validate}if(T!=a)return u&&(n+=" if (true) { "),n;if(E){if(!e.async)throw new Error("async format in sync schema");var I="formats"+e.util.getProperty(s)+".validate";n+=" if (!(await "+I+"("+p+"))) { "}else{n+=" if (! ";var I="formats"+e.util.getProperty(s);v&&(I+=".validate"),typeof y=="function"?n+=" "+I+"("+p+") ":n+=" "+I+".test("+p+") ",n+=") { "}}var D=D||[];D.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",m?n+=""+d:n+=""+e.util.toQuotedString(s),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match format "`,m?n+="' + "+d+" + '":n+=""+e.util.escapeQuotes(s),n+=`"' `),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+e.util.toQuotedString(s),n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var C=n;return n=D.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+C+"]); ":n+=" validate.errors = ["+C+"]; return false; ":n+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u&&(n+=" else { "),n}});var Np=te((WA,Dp)=>{"use strict";Dp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e);g.level++;var f="valid"+g.level,y=e.schema.then,v=e.schema.else,T=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),E=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),I=g.baseId;if(T||E){var D;g.createErrors=!1,g.schema=s,g.schemaPath=l,g.errSchemaPath=c,n+=" var "+d+" = errors; var "+m+" = true; ";var C=e.compositeRule;e.compositeRule=g.compositeRule=!0,n+=" "+e.validate(g)+" ",g.baseId=I,g.createErrors=!0,n+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=g.compositeRule=C,T?(n+=" if ("+f+") { ",g.schema=e.schema.then,g.schemaPath=e.schemaPath+".then",g.errSchemaPath=e.errSchemaPath+"/then",n+=" "+e.validate(g)+" ",g.baseId=I,n+=" "+m+" = "+f+"; ",T&&E?(D="ifClause"+i,n+=" var "+D+" = 'then'; "):D="'then'",n+=" } ",E&&(n+=" else { ")):n+=" if (!"+f+") { ",E&&(g.schema=e.schema.else,g.schemaPath=e.schemaPath+".else",g.errSchemaPath=e.errSchemaPath+"/else",n+=" "+e.validate(g)+" ",g.baseId=I,n+=" "+m+" = "+f+"; ",T&&E?(D="ifClause"+i,n+=" var "+D+" = 'else'; "):D="'else'",n+=" } "),n+=" if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+D+" } ",e.opts.messages!==!1&&(n+=` , message: 'should match "' + `+D+` + '" schema' `),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } ",u&&(n+=" else { ")}else u&&(n+=" if (true) { ");return n}});var Lp=te((jA,Op)=>{"use strict";Op.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,v="i"+i,T=g.dataLevel=e.dataLevel+1,E="data"+T,I=e.baseId;if(n+="var "+d+" = errors;var "+m+";",Array.isArray(s)){var D=e.schema.additionalItems;if(D===!1){n+=" "+m+" = "+p+".length <= "+s.length+"; ";var C=c;c=e.errSchemaPath+"/additionalItems",n+=" if (!"+m+") { ";var M=M||[];M.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+s.length+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have more than "+s.length+" items' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var F=n;n=M.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+F+"]); ":n+=" validate.errors = ["+F+"]; return false; ":n+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",c=C,u&&(f+="}",n+=" else { ")}var R=s;if(R){for(var G,z=-1,O=R.length-1;z<O;)if(G=R[z+=1],e.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:e.util.schemaHasRules(G,e.RULES.all)){n+=" "+y+" = true; if ("+p+".length > "+z+") { ";var x=p+"["+z+"]";g.schema=G,g.schemaPath=l+"["+z+"]",g.errSchemaPath=c+"/"+z,g.errorPath=e.util.getPathExpr(e.errorPath,z,e.opts.jsonPointers,!0),g.dataPathArr[T]=z;var A=e.validate(g);g.baseId=I,e.util.varOccurences(A,E)<2?n+=" "+e.util.varReplace(A,E,x)+" ":n+=" var "+E+" = "+x+"; "+A+" ",n+=" } ",u&&(n+=" if ("+y+") { ",f+="}")}}if(typeof D=="object"&&(e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all))){g.schema=D,g.schemaPath=e.schemaPath+".additionalItems",g.errSchemaPath=e.errSchemaPath+"/additionalItems",n+=" "+y+" = true; if ("+p+".length > "+s.length+") { for (var "+v+" = "+s.length+"; "+v+" < "+p+".length; "+v+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var x=p+"["+v+"]";g.dataPathArr[T]=v;var A=e.validate(g);g.baseId=I,e.util.varOccurences(A,E)<2?n+=" "+e.util.varReplace(A,E,x)+" ":n+=" var "+E+" = "+x+"; "+A+" ",u&&(n+=" if (!"+y+") break; "),n+=" } } ",u&&(n+=" if ("+y+") { ",f+="}")}}else if(e.opts.strictKeywords?typeof s=="object"&&Object.keys(s).length>0||s===!1:e.util.schemaHasRules(s,e.RULES.all)){g.schema=s,g.schemaPath=l,g.errSchemaPath=c,n+=" for (var "+v+" = 0; "+v+" < "+p+".length; "+v+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var x=p+"["+v+"]";g.dataPathArr[T]=v;var A=e.validate(g);g.baseId=I,e.util.varOccurences(A,E)<2?n+=" "+e.util.varReplace(A,E,x)+" ":n+=" var "+E+" = "+x+"; "+A+" ",u&&(n+=" if (!"+y+") break; "),n+=" }"}return u&&(n+=" "+f+" if ("+d+" == errors) {"),n}});var _l=te((qA,Mp)=>{"use strict";Mp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,I,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s;var g=t=="maximum",f=g?"exclusiveMaximum":"exclusiveMinimum",y=e.schema[f],v=e.opts.$data&&y&&y.$data,T=g?"<":">",E=g?">":"<",I=void 0;if(!(m||typeof s=="number"||s===void 0))throw new Error(t+" must be number");if(!(v||y===void 0||typeof y=="number"||typeof y=="boolean"))throw new Error(f+" must be number or boolean");if(v){var D=e.util.getData(y.$data,o,e.dataPathArr),C="exclusive"+i,M="exclType"+i,F="exclIsNumber"+i,R="op"+i,G="' + "+R+" + '";n+=" var schemaExcl"+i+" = "+D+"; ",D="schemaExcl"+i,n+=" var "+C+"; var "+M+" = typeof "+D+"; if ("+M+" != 'boolean' && "+M+" != 'undefined' && "+M+" != 'number') { ";var I=f,z=z||[];z.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(I||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: '"+f+" should be boolean' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var O=n;n=z.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+O+"]); ":n+=" validate.errors = ["+O+"]; return false; ":n+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" "+M+" == 'number' ? ( ("+C+" = "+d+" === undefined || "+D+" "+T+"= "+d+") ? "+p+" "+E+"= "+D+" : "+p+" "+E+" "+d+" ) : ( ("+C+" = "+D+" === true) ? "+p+" "+E+"= "+d+" : "+p+" "+E+" "+d+" ) || "+p+" !== "+p+") { var op"+i+" = "+C+" ? '"+T+"' : '"+T+"='; ",s===void 0&&(I=f,c=e.errSchemaPath+"/"+f,d=D,m=v)}else{var F=typeof y=="number",G=T;if(F&&m){var R="'"+G+"'";n+=" if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" ( "+d+" === undefined || "+y+" "+T+"= "+d+" ? "+p+" "+E+"= "+y+" : "+p+" "+E+" "+d+" ) || "+p+" !== "+p+") { "}else{F&&s===void 0?(C=!0,I=f,c=e.errSchemaPath+"/"+f,d=y,E+="="):(F&&(d=Math[g?"min":"max"](y,s)),y===(F?d:!0)?(C=!0,I=f,c=e.errSchemaPath+"/"+f,E+="="):(C=!1,G+="="));var R="'"+G+"'";n+=" if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" "+p+" "+E+" "+d+" || "+p+" !== "+p+") { "}}I=I||t;var z=z||[];z.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(I||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+R+", limit: "+d+", exclusive: "+C+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be "+G+" ",m?n+="' + "+d:n+=""+d+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var O=n;return n=z.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+O+"]); ":n+=" validate.errors = ["+O+"]; return false; ":n+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u&&(n+=" else { "),n}});var Sl=te((KA,Fp)=>{"use strict";Fp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s,!(m||typeof s=="number"))throw new Error(t+" must be number");var g=t=="maxItems"?">":"<";n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" "+p+".length "+g+" "+d+") { ";var f=t,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",t=="maxItems"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+d+" + '":n+=""+s,n+=" items' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var v=n;return n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var El=te(($A,Bp)=>{"use strict";Bp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s,!(m||typeof s=="number"))throw new Error(t+" must be number");var g=t=="maxLength"?">":"<";n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?n+=" "+p+".length ":n+=" ucs2length("+p+") ",n+=" "+g+" "+d+") { ";var f=t,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be ",t=="maxLength"?n+="longer":n+="shorter",n+=" than ",m?n+="' + "+d+" + '":n+=""+s,n+=" characters' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var v=n;return n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var wl=te((XA,Gp)=>{"use strict";Gp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s,!(m||typeof s=="number"))throw new Error(t+" must be number");var g=t=="maxProperties"?">":"<";n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" Object.keys("+p+").length "+g+" "+d+") { ";var f=t,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",t=="maxProperties"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+d+" + '":n+=""+s,n+=" properties' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var v=n;return n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Up=te((YA,zp)=>{"use strict";zp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s,!(m||typeof s=="number"))throw new Error(t+" must be number");n+="var division"+i+";if (",m&&(n+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),n+=" (division"+i+" = "+p+" / "+d+", ",e.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+i+") - division"+i+") > 1e-"+e.opts.multipleOfPrecision+" ":n+=" division"+i+" !== parseInt(division"+i+") ",n+=" ) ",m&&(n+=" ) "),n+=" ) { ";var g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",m?n+="' + "+d:n+=""+d+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var f=n;return n=g.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+f+"]); ":n+=" validate.errors = ["+f+"]; return false; ":n+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Vp=te((ZA,Hp)=>{"use strict";Hp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="errs__"+i,d=e.util.copy(e);d.level++;var g="valid"+d.level;if(e.opts.strictKeywords?typeof s=="object"&&Object.keys(s).length>0||s===!1:e.util.schemaHasRules(s,e.RULES.all)){d.schema=s,d.schemaPath=l,d.errSchemaPath=c,n+=" var "+m+" = errors; ";var f=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var y;d.opts.allErrors&&(y=d.opts.allErrors,d.opts.allErrors=!1),n+=" "+e.validate(d)+" ",d.createErrors=!0,y&&(d.opts.allErrors=y),e.compositeRule=d.compositeRule=f,n+=" if ("+g+") { ";var v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var T=n;n=v.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+T+"]); ":n+=" validate.errors = ["+T+"]; return false; ":n+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(n+=" if (false) { ");return n}});var jp=te((JA,Wp)=>{"use strict";Wp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,v=g.baseId,T="prevValid"+i,E="passingSchemas"+i;n+="var "+d+" = errors , "+T+" = false , "+m+" = false , "+E+" = null; ";var I=e.compositeRule;e.compositeRule=g.compositeRule=!0;var D=s;if(D)for(var C,M=-1,F=D.length-1;M<F;)C=D[M+=1],(e.opts.strictKeywords?typeof C=="object"&&Object.keys(C).length>0||C===!1:e.util.schemaHasRules(C,e.RULES.all))?(g.schema=C,g.schemaPath=l+"["+M+"]",g.errSchemaPath=c+"/"+M,n+=" "+e.validate(g)+" ",g.baseId=v):n+=" var "+y+" = true; ",M&&(n+=" if ("+y+" && "+T+") { "+m+" = false; "+E+" = ["+E+", "+M+"]; } else { ",f+="}"),n+=" if ("+y+") { "+m+" = "+T+" = true; "+E+" = "+M+"; }";return e.compositeRule=g.compositeRule=I,n+=""+f+"if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+E+" } ",e.opts.messages!==!1&&(n+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(n+=" } "),n}});var Kp=te((QA,qp)=>{"use strict";qp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s;var g=m?"(new RegExp("+d+"))":e.usePattern(s);n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),n+=" !"+g+".test("+p+") ) { ";var f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",m?n+=""+d:n+=""+e.util.toQuotedString(s),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,m?n+="' + "+d+" + '":n+=""+e.util.escapeQuotes(s),n+=`"' `),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+e.util.toQuotedString(s),n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;return n=f.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Xp=te((eI,$p)=>{"use strict";$p.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="errs__"+i,d=e.util.copy(e),g="";d.level++;var f="valid"+d.level,y="key"+i,v="idx"+i,T=d.dataLevel=e.dataLevel+1,E="data"+T,I="dataProperties"+i,D=Object.keys(s||{}).filter(Q),C=e.schema.patternProperties||{},M=Object.keys(C).filter(Q),F=e.schema.additionalProperties,R=D.length||M.length,G=F===!1,z=typeof F=="object"&&Object.keys(F).length,O=e.opts.removeAdditional,x=G||z||O,A=e.opts.ownProperties,B=e.baseId,X=e.schema.required;if(X&&!(e.opts.$data&&X.$data)&&X.length<e.opts.loopRequired)var K=e.util.toHash(X);function Q(J){return J!=="__proto__"}if(n+="var "+m+" = errors;var "+f+" = true;",A&&(n+=" var "+I+" = undefined;"),x){if(A?n+=" "+I+" = "+I+" || Object.keys("+p+"); for (var "+v+"=0; "+v+"<"+I+".length; "+v+"++) { var "+y+" = "+I+"["+v+"]; ":n+=" for (var "+y+" in "+p+") { ",R){if(n+=" var isAdditional"+i+" = !(false ",D.length)if(D.length>8)n+=" || validate.schema"+l+".hasOwnProperty("+y+") ";else{var Z=D;if(Z)for(var _,ge=-1,Ie=Z.length-1;ge<Ie;)_=Z[ge+=1],n+=" || "+y+" == "+e.util.toQuotedString(_)+" "}if(M.length){var S=M;if(S)for(var ne,Te=-1,Be=S.length-1;Te<Be;)ne=S[Te+=1],n+=" || "+e.usePattern(ne)+".test("+y+") "}n+=" ); if (isAdditional"+i+") { "}if(O=="all")n+=" delete "+p+"["+y+"]; ";else{var We=e.errorPath,Re="' + "+y+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers)),G)if(O)n+=" delete "+p+"["+y+"]; ";else{n+=" "+f+" = false; ";var ut=c;c=e.errSchemaPath+"/additionalProperties";var Se=Se||[];Se.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { additionalProperty: '"+Re+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is an invalid additional property":n+="should NOT have additional properties",n+="' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var Ce=n;n=Se.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+Ce+"]); ":n+=" validate.errors = ["+Ce+"]; return false; ":n+=" var err = "+Ce+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=ut,u&&(n+=" break; ")}else if(z)if(O=="failing"){n+=" var "+m+" = errors; ";var ht=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=F,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var je=p+"["+y+"]";d.dataPathArr[T]=y;var fe=e.validate(d);d.baseId=B,e.util.varOccurences(fe,E)<2?n+=" "+e.util.varReplace(fe,E,je)+" ":n+=" var "+E+" = "+je+"; "+fe+" ",n+=" if (!"+f+") { errors = "+m+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+p+"["+y+"]; } ",e.compositeRule=d.compositeRule=ht}else{d.schema=F,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var je=p+"["+y+"]";d.dataPathArr[T]=y;var fe=e.validate(d);d.baseId=B,e.util.varOccurences(fe,E)<2?n+=" "+e.util.varReplace(fe,E,je)+" ":n+=" var "+E+" = "+je+"; "+fe+" ",u&&(n+=" if (!"+f+") break; ")}e.errorPath=We}R&&(n+=" } "),n+=" } ",u&&(n+=" if ("+f+") { ",g+="}")}var Ht=e.opts.useDefaults&&!e.compositeRule;if(D.length){var It=D;if(It)for(var _,lr=-1,Jt=It.length-1;lr<Jt;){_=It[lr+=1];var qe=s[_];if(e.opts.strictKeywords?typeof qe=="object"&&Object.keys(qe).length>0||qe===!1:e.util.schemaHasRules(qe,e.RULES.all)){var gt=e.util.getProperty(_),je=p+gt,at=Ht&&qe.default!==void 0;d.schema=qe,d.schemaPath=l+gt,d.errSchemaPath=c+"/"+e.util.escapeFragment(_),d.errorPath=e.util.getPath(e.errorPath,_,e.opts.jsonPointers),d.dataPathArr[T]=e.util.toQuotedString(_);var fe=e.validate(d);if(d.baseId=B,e.util.varOccurences(fe,E)<2){fe=e.util.varReplace(fe,E,je);var Qe=je}else{var Qe=E;n+=" var "+E+" = "+je+"; "}if(at)n+=" "+fe+" ";else{if(K&&K[_]){n+=" if ( "+Qe+" === undefined ",A&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(_)+"') "),n+=") { "+f+" = false; ";var We=e.errorPath,ut=c,Rt=e.util.escapeQuotes(_);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(We,_,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var Se=Se||[];Se.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+Rt+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+Rt+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var Ce=n;n=Se.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+Ce+"]); ":n+=" validate.errors = ["+Ce+"]; return false; ":n+=" var err = "+Ce+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=ut,e.errorPath=We,n+=" } else { "}else u?(n+=" if ( "+Qe+" === undefined ",A&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(_)+"') "),n+=") { "+f+" = true; } else { "):(n+=" if ("+Qe+" !== undefined ",A&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(_)+"') "),n+=" ) { ");n+=" "+fe+" } "}}u&&(n+=" if ("+f+") { ",g+="}")}}if(M.length){var dt=M;if(dt)for(var ne,L=-1,V=dt.length-1;L<V;){ne=dt[L+=1];var qe=C[ne];if(e.opts.strictKeywords?typeof qe=="object"&&Object.keys(qe).length>0||qe===!1:e.util.schemaHasRules(qe,e.RULES.all)){d.schema=qe,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(ne),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(ne),A?n+=" "+I+" = "+I+" || Object.keys("+p+"); for (var "+v+"=0; "+v+"<"+I+".length; "+v+"++) { var "+y+" = "+I+"["+v+"]; ":n+=" for (var "+y+" in "+p+") { ",n+=" if ("+e.usePattern(ne)+".test("+y+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var je=p+"["+y+"]";d.dataPathArr[T]=y;var fe=e.validate(d);d.baseId=B,e.util.varOccurences(fe,E)<2?n+=" "+e.util.varReplace(fe,E,je)+" ":n+=" var "+E+" = "+je+"; "+fe+" ",u&&(n+=" if (!"+f+") break; "),n+=" } ",u&&(n+=" else "+f+" = true; "),n+=" } ",u&&(n+=" if ("+f+") { ",g+="}")}}}return u&&(n+=" "+g+" if ("+m+" == errors) {"),n}});var Zp=te((tI,Yp)=>{"use strict";Yp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="errs__"+i,d=e.util.copy(e),g="";d.level++;var f="valid"+d.level;if(n+="var "+m+" = errors;",e.opts.strictKeywords?typeof s=="object"&&Object.keys(s).length>0||s===!1:e.util.schemaHasRules(s,e.RULES.all)){d.schema=s,d.schemaPath=l,d.errSchemaPath=c;var y="key"+i,v="idx"+i,T="i"+i,E="' + "+y+" + '",I=d.dataLevel=e.dataLevel+1,D="data"+I,C="dataProperties"+i,M=e.opts.ownProperties,F=e.baseId;M&&(n+=" var "+C+" = undefined; "),M?n+=" "+C+" = "+C+" || Object.keys("+p+"); for (var "+v+"=0; "+v+"<"+C+".length; "+v+"++) { var "+y+" = "+C+"["+v+"]; ":n+=" for (var "+y+" in "+p+") { ",n+=" var startErrs"+i+" = errors; ";var R=y,G=e.compositeRule;e.compositeRule=d.compositeRule=!0;var z=e.validate(d);d.baseId=F,e.util.varOccurences(z,D)<2?n+=" "+e.util.varReplace(z,D,R)+" ":n+=" var "+D+" = "+R+"; "+z+" ",e.compositeRule=d.compositeRule=G,n+=" if (!"+f+") { for (var "+T+"=startErrs"+i+"; "+T+"<errors; "+T+"++) { vErrors["+T+"].propertyName = "+y+"; } var err = ",e.createErrors!==!1?(n+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+E+"' } ",e.opts.messages!==!1&&(n+=" , message: 'property name \\'"+E+"\\' is invalid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),u&&(n+=" break; "),n+=" } }"}return u&&(n+=" "+g+" if ("+m+" == errors) {"),n}});var Qp=te((rI,Jp)=>{"use strict";Jp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d=e.opts.$data&&s&&s.$data,g;d?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",g="schema"+i):g=s;var f="schema"+i;if(!d)if(s.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var y=[],v=s;if(v)for(var T,E=-1,I=v.length-1;E<I;){T=v[E+=1];var D=e.schema.properties[T];D&&(e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all))||(y[y.length]=T)}}else var y=s;if(d||y.length){var C=e.errorPath,M=d||y.length>=e.opts.loopRequired,F=e.opts.ownProperties;if(u)if(n+=" var missing"+i+"; ",M){d||(n+=" var "+f+" = validate.schema"+l+"; ");var R="i"+i,G="schema"+i+"["+R+"]",z="' + "+G+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(C,G,e.opts.jsonPointers)),n+=" var "+m+" = true; ",d&&(n+=" if (schema"+i+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+i+")) "+m+" = false; else {"),n+=" for (var "+R+" = 0; "+R+" < "+f+".length; "+R+"++) { "+m+" = "+p+"["+f+"["+R+"]] !== undefined ",F&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", "+f+"["+R+"]) "),n+="; if (!"+m+") break; } ",d&&(n+=" } "),n+=" if (!"+m+") { ";var O=O||[];O.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+z+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+z+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var x=n;n=O.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+x+"]); ":n+=" validate.errors = ["+x+"]; return false; ":n+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var A=y;if(A)for(var B,R=-1,X=A.length-1;R<X;){B=A[R+=1],R&&(n+=" || ");var K=e.util.getProperty(B),Q=p+K;n+=" ( ( "+Q+" === undefined ",F&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(B)+"') "),n+=") && (missing"+i+" = "+e.util.toQuotedString(e.opts.jsonPointers?B:K)+") ) "}n+=") { ";var G="missing"+i,z="' + "+G+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(C,G,!0):C+" + "+G);var O=O||[];O.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+z+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+z+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var x=n;n=O.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+x+"]); ":n+=" validate.errors = ["+x+"]; return false; ":n+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else if(M){d||(n+=" var "+f+" = validate.schema"+l+"; ");var R="i"+i,G="schema"+i+"["+R+"]",z="' + "+G+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(C,G,e.opts.jsonPointers)),d&&(n+=" if ("+f+" && !Array.isArray("+f+")) { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+z+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+z+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+f+" !== undefined) { "),n+=" for (var "+R+" = 0; "+R+" < "+f+".length; "+R+"++) { if ("+p+"["+f+"["+R+"]] === undefined ",F&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", "+f+"["+R+"]) "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+z+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+z+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(n+=" } ")}else{var Z=y;if(Z)for(var B,_=-1,ge=Z.length-1;_<ge;){B=Z[_+=1];var K=e.util.getProperty(B),z=e.util.escapeQuotes(B),Q=p+K;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(C,B,e.opts.jsonPointers)),n+=" if ( "+Q+" === undefined ",F&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(B)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+z+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+z+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=C}else u&&(n+=" if (true) {");return n}});var tm=te((nI,em)=>{"use strict";em.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d=e.opts.$data&&s&&s.$data,g;if(d?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",g="schema"+i):g=s,(s||d)&&e.opts.uniqueItems!==!1){d&&(n+=" var "+m+"; if ("+g+" === false || "+g+" === undefined) "+m+" = true; else if (typeof "+g+" != 'boolean') "+m+" = false; else { "),n+=" var i = "+p+".length , "+m+" = true , j; if (i > 1) { ";var f=e.schema.items&&e.schema.items.type,y=Array.isArray(f);if(!f||f=="object"||f=="array"||y&&(f.indexOf("object")>=0||f.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+m+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ";var v="checkDataType"+(y?"s":"");n+=" if ("+e.util[v](f,"item",e.opts.strictNumbers,!0)+") continue; ",y&&(n+=` if (typeof item == 'string') item = '"' + item; `),n+=" if (typeof itemIndices[item] == 'number') { "+m+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",d&&(n+=" } "),n+=" if (!"+m+") { ";var T=T||[];T.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(n+=" , schema: ",d?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var E=n;n=T.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+E+"]); ":n+=" validate.errors = ["+E+"]; return false; ":n+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u&&(n+=" else { ")}else u&&(n+=" if (true) { ");return n}});var nm=te((aI,rm)=>{"use strict";rm.exports={$ref:gp(),allOf:yp(),anyOf:vp(),$comment:Sp(),const:wp(),contains:kp(),dependencies:xp(),enum:Ip(),format:Pp(),if:Np(),items:Lp(),maximum:_l(),minimum:_l(),maxItems:Sl(),minItems:Sl(),maxLength:El(),minLength:El(),maxProperties:wl(),minProperties:wl(),multipleOf:Up(),not:Vp(),oneOf:jp(),pattern:Kp(),properties:Xp(),propertyNames:Zp(),required:Qp(),uniqueItems:tm(),validate:bl()}});var om=te((iI,im)=>{"use strict";var am=nm(),Cl=un().toHash;im.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],a=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],n=["number","integer","string","array","object","boolean","null"];return e.all=Cl(t),e.types=Cl(n),e.forEach(function(i){i.rules=i.rules.map(function(o){var s;if(typeof o=="object"){var l=Object.keys(o)[0];s=o[l],o=l,s.forEach(function(u){t.push(u),e.all[u]=!0})}t.push(o);var c=e.all[o]={keyword:o,code:am[o],implements:s};return c}),e.all.$comment={keyword:"$comment",code:am.$comment},i.type&&(e.types[i.type]=i)}),e.keywords=Cl(t.concat(a)),e.custom={},e}});var cm=te((oI,lm)=>{"use strict";var sm=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];lm.exports=function(r,e){for(var t=0;t<e.length;t++){r=JSON.parse(JSON.stringify(r));var a=e[t].split("/"),n=r,i;for(i=1;i<a.length;i++)n=n[a[i]];for(i=0;i<sm.length;i++){var o=sm[i],s=n[o];s&&(n[o]={anyOf:[s,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return r}});var pm=te((sI,dm)=>{"use strict";var Z_=qi().MissingRef;dm.exports=um;function um(r,e,t){var a=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(t=e,e=void 0);var n=i(r).then(function(){var s=a._addSchema(r,void 0,e);return s.validate||o(s)});return t&&n.then(function(s){t(null,s)},t),n;function i(s){var l=s.$schema;return l&&!a.getSchema(l)?um.call(a,{$ref:l},!0):Promise.resolve()}function o(s){try{return a._compile(s)}catch(c){if(c instanceof Z_)return l(c);throw c}function l(c){var u=c.missingSchema;if(d(u))throw new Error("Schema "+u+" is loaded but "+c.missingRef+" cannot be resolved");var p=a._loadingSchemas[u];return p||(p=a._loadingSchemas[u]=a._opts.loadSchema(u),p.then(m,m)),p.then(function(g){if(!d(u))return i(g).then(function(){d(u)||a.addSchema(g,u,void 0,e)})}).then(function(){return o(s)});function m(){delete a._loadingSchemas[u]}function d(g){return a._refs[g]||a._schemas[g]}}}}});var hm=te((lI,mm)=>{"use strict";mm.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p,m="data"+(o||""),d="valid"+i,g="errs__"+i,f=e.opts.$data&&s&&s.$data,y;f?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",y="schema"+i):y=s;var v=this,T="definition"+i,E=v.definition,I="",D,C,M,F,R;if(f&&E.$data){R="keywordValidate"+i;var G=E.validateSchema;n+=" var "+T+" = RULES.custom['"+t+"'].definition; var "+R+" = "+T+".validate;"}else{if(F=e.useCustomRule(v,s,e.schema,e),!F)return;y="validate.schema"+l,R=F.code,D=E.compile,C=E.inline,M=E.macro}var z=R+".errors",O="i"+i,x="ruleErr"+i,A=E.async;if(A&&!e.async)throw new Error("async keyword in sync schema");if(C||M||(n+=""+z+" = null;"),n+="var "+g+" = errors;var "+d+";",f&&E.$data&&(I+="}",n+=" if ("+y+" === undefined) { "+d+" = true; } else { ",G&&(I+="}",n+=" "+d+" = "+T+".validateSchema("+y+"); if ("+d+") { ")),C)E.statements?n+=" "+F.validate+" ":n+=" "+d+" = "+F.validate+"; ";else if(M){var B=e.util.copy(e),I="";B.level++;var X="valid"+B.level;B.schema=F.validate,B.schemaPath="";var K=e.compositeRule;e.compositeRule=B.compositeRule=!0;var Q=e.validate(B).replace(/validate\.schema/g,R);e.compositeRule=B.compositeRule=K,n+=" "+Q}else{var Z=Z||[];Z.push(n),n="",n+=" "+R+".call( ",e.opts.passContext?n+="this":n+="self",D||E.schema===!1?n+=" , "+m+" ":n+=" , "+y+" , "+m+" , validate.schema"+e.schemaPath+" ",n+=" , (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var _=o?"data"+(o-1||""):"parentData",ge=o?e.dataPathArr[o]:"parentDataProperty";n+=" , "+_+" , "+ge+" , rootData ) ";var Ie=n;n=Z.pop(),E.errors===!1?(n+=" "+d+" = ",A&&(n+="await "),n+=""+Ie+"; "):A?(z="customErrors"+i,n+=" var "+z+" = null; try { "+d+" = await "+Ie+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+z+" = e.errors; else throw e; } "):n+=" "+z+" = null; "+d+" = "+Ie+"; "}if(E.modifying&&(n+=" if ("+_+") "+m+" = "+_+"["+ge+"];"),n+=""+I,E.valid)u&&(n+=" if (true) { ");else{n+=" if ( ",E.valid===void 0?(n+=" !",M?n+=""+X:n+=""+d):n+=" "+!E.valid+" ",n+=") { ",p=v.keyword;var Z=Z||[];Z.push(n),n="";var Z=Z||[];Z.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(n+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var S=n;n=Z.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+S+"]); ":n+=" validate.errors = ["+S+"]; return false; ":n+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var ne=n;n=Z.pop(),C?E.errors?E.errors!="full"&&(n+=" for (var "+O+"="+g+"; "+O+"<errors; "+O+"++) { var "+x+" = vErrors["+O+"]; if ("+x+".dataPath === undefined) "+x+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+x+".schemaPath === undefined) { "+x+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(n+=" "+x+".schema = "+y+"; "+x+".data = "+m+"; "),n+=" } "):E.errors===!1?n+=" "+ne+" ":(n+=" if ("+g+" == errors) { "+ne+" } else { for (var "+O+"="+g+"; "+O+"<errors; "+O+"++) { var "+x+" = vErrors["+O+"]; if ("+x+".dataPath === undefined) "+x+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+x+".schemaPath === undefined) { "+x+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(n+=" "+x+".schema = "+y+"; "+x+".data = "+m+"; "),n+=" } } "):M?(n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(n+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; ")):E.errors===!1?n+=" "+ne+" ":(n+=" if (Array.isArray("+z+")) { if (vErrors === null) vErrors = "+z+"; else vErrors = vErrors.concat("+z+"); errors = vErrors.length; for (var "+O+"="+g+"; "+O+"<errors; "+O+"++) { var "+x+" = vErrors["+O+"]; if ("+x+".dataPath === undefined) "+x+".dataPath = (dataPath || '') + "+e.errorPath+"; "+x+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(n+=" "+x+".schema = "+y+"; "+x+".data = "+m+"; "),n+=" } } else { "+ne+" } "),n+=" } ",u&&(n+=" else { ")}return n}});var kl=te((cI,J_)=>{J_.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 ym=te((uI,fm)=>{"use strict";var gm=kl();fm.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:gm.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:gm.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 vm=te((dI,bm)=>{"use strict";var Q_=/^[a-z_$][a-z0-9_$-]*$/i,eS=hm(),tS=ym();bm.exports={add:rS,get:nS,remove:aS,validate:Tl};function rS(r,e){var t=this.RULES;if(t.keywords[r])throw new Error("Keyword "+r+" is already defined");if(!Q_.test(r))throw new Error("Keyword "+r+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var a=e.type;if(Array.isArray(a))for(var n=0;n<a.length;n++)o(r,a[n],e);else o(r,a,e);var i=e.metaSchema;i&&(e.$data&&this._opts.$data&&(i={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(i,!0))}t.keywords[r]=t.all[r]=!0;function o(s,l,c){for(var u,p=0;p<t.length;p++){var m=t[p];if(m.type==l){u=m;break}}u||(u={type:l,rules:[]},t.push(u));var d={keyword:s,definition:c,custom:!0,code:eS,implements:c.implements};u.rules.push(d),t.custom[s]=d}return this}function nS(r){var e=this.RULES.custom[r];return e?e.definition:this.RULES.keywords[r]||!1}function aS(r){var e=this.RULES;delete e.keywords[r],delete e.all[r],delete e.custom[r];for(var t=0;t<e.length;t++)for(var a=e[t].rules,n=0;n<a.length;n++)if(a[n].keyword==r){a.splice(n,1);break}return this}function Tl(r,e){Tl.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(tS,!0);if(t(r))return!0;if(Tl.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var _m=te((pI,iS)=>{iS.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 Rm=te((mI,Im)=>{"use strict";var Em=Qd(),dn=ji(),oS=tp(),wm=dl(),sS=yl(),lS=mp(),cS=om(),Cm=cm(),km=un();Im.exports=Ge;Ge.prototype.validate=dS;Ge.prototype.compile=pS;Ge.prototype.addSchema=mS;Ge.prototype.addMetaSchema=hS;Ge.prototype.validateSchema=gS;Ge.prototype.getSchema=yS;Ge.prototype.removeSchema=vS;Ge.prototype.addFormat=xS;Ge.prototype.errorsText=TS;Ge.prototype._addSchema=_S;Ge.prototype._compile=SS;Ge.prototype.compileAsync=pm();var eo=vm();Ge.prototype.addKeyword=eo.add;Ge.prototype.getKeyword=eo.get;Ge.prototype.removeKeyword=eo.remove;Ge.prototype.validateKeyword=eo.validate;var Tm=qi();Ge.ValidationError=Tm.Validation;Ge.MissingRefError=Tm.MissingRef;Ge.$dataMetaSchema=Cm;var Qi="http://json-schema.org/draft-07/schema",Sm=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],uS=["/properties"];function Ge(r){if(!(this instanceof Ge))return new Ge(r);r=this._opts=km.copy(r)||{},NS(this),this._schemas={},this._refs={},this._fragments={},this._formats=lS(r.format),this._cache=r.cache||new oS,this._loadingSchemas={},this._compilations=[],this.RULES=cS(),this._getId=ES(r),r.loopRequired=r.loopRequired||1/0,r.errorDataPath=="property"&&(r._errorDataPathProperty=!0),r.serialize===void 0&&(r.serialize=sS),this._metaOpts=DS(this),r.formats&&RS(this),r.keywords&&PS(this),AS(this),typeof r.meta=="object"&&this.addMetaSchema(r.meta),r.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),IS(this)}function dS(r,e){var t;if(typeof r=="string"){if(t=this.getSchema(r),!t)throw new Error('no schema with key or ref "'+r+'"')}else{var a=this._addSchema(r);t=a.validate||this._compile(a)}var n=t(e);return t.$async!==!0&&(this.errors=t.errors),n}function pS(r,e){var t=this._addSchema(r,void 0,e);return t.validate||this._compile(t)}function mS(r,e,t,a){if(Array.isArray(r)){for(var n=0;n<r.length;n++)this.addSchema(r[n],void 0,t,a);return this}var i=this._getId(r);if(i!==void 0&&typeof i!="string")throw new Error("schema id must be string");return e=dn.normalizeId(e||i),Am(this,e),this._schemas[e]=this._addSchema(r,t,a,!0),this}function hS(r,e,t){return this.addSchema(r,e,t,!0),this}function gS(r,e){var t=r.$schema;if(t!==void 0&&typeof t!="string")throw new Error("$schema must be a string");if(t=t||this._opts.defaultMeta||fS(this),!t)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var a=this.validate(t,r);if(!a&&e){var n="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(n);else throw new Error(n)}return a}function fS(r){var e=r._opts.meta;return r._opts.defaultMeta=typeof e=="object"?r._getId(e)||e:r.getSchema(Qi)?Qi:void 0,r._opts.defaultMeta}function yS(r){var e=xm(this,r);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return bS(this,r)}}function bS(r,e){var t=dn.schema.call(r,{schema:{}},e);if(t){var a=t.schema,n=t.root,i=t.baseId,o=Em.call(r,a,n,void 0,i);return r._fragments[e]=new wm({ref:e,fragment:!0,schema:a,root:n,baseId:i,validate:o}),o}}function xm(r,e){return e=dn.normalizeId(e),r._schemas[e]||r._refs[e]||r._fragments[e]}function vS(r){if(r instanceof RegExp)return Ji(this,this._schemas,r),Ji(this,this._refs,r),this;switch(typeof r){case"undefined":return Ji(this,this._schemas),Ji(this,this._refs),this._cache.clear(),this;case"string":var e=xm(this,r);return e&&this._cache.del(e.cacheKey),delete this._schemas[r],delete this._refs[r],this;case"object":var t=this._opts.serialize,a=t?t(r):r;this._cache.del(a);var n=this._getId(r);n&&(n=dn.normalizeId(n),delete this._schemas[n],delete this._refs[n])}return this}function Ji(r,e,t){for(var a in e){var n=e[a];!n.meta&&(!t||t.test(a))&&(r._cache.del(n.cacheKey),delete e[a])}}function _S(r,e,t,a){if(typeof r!="object"&&typeof r!="boolean")throw new Error("schema should be object or boolean");var n=this._opts.serialize,i=n?n(r):r,o=this._cache.get(i);if(o)return o;a=a||this._opts.addUsedSchema!==!1;var s=dn.normalizeId(this._getId(r));s&&a&&Am(this,s);var l=this._opts.validateSchema!==!1&&!e,c;l&&!(c=s&&s==dn.normalizeId(r.$schema))&&this.validateSchema(r,!0);var u=dn.ids.call(this,r),p=new wm({id:s,schema:r,localRefs:u,cacheKey:i,meta:t});return s[0]!="#"&&a&&(this._refs[s]=p),this._cache.put(i,p),l&&c&&this.validateSchema(r,!0),p}function SS(r,e){if(r.compiling)return r.validate=n,n.schema=r.schema,n.errors=null,n.root=e||n,r.schema.$async===!0&&(n.$async=!0),n;r.compiling=!0;var t;r.meta&&(t=this._opts,this._opts=this._metaOpts);var a;try{a=Em.call(this,r.schema,e,r.localRefs)}catch(i){throw delete r.validate,i}finally{r.compiling=!1,r.meta&&(this._opts=t)}return r.validate=a,r.refs=a.refs,r.refVal=a.refVal,r.root=a.root,a;function n(){var i=r.validate,o=i.apply(this,arguments);return n.errors=i.errors,o}}function ES(r){switch(r.schemaId){case"auto":return kS;case"id":return wS;default:return CS}}function wS(r){return r.$id&&this.logger.warn("schema $id ignored",r.$id),r.id}function CS(r){return r.id&&this.logger.warn("schema id ignored",r.id),r.$id}function kS(r){if(r.$id&&r.id&&r.$id!=r.id)throw new Error("schema $id is different from id");return r.$id||r.id}function TS(r,e){if(r=r||this.errors,!r)return"No errors";e=e||{};for(var t=e.separator===void 0?", ":e.separator,a=e.dataVar===void 0?"data":e.dataVar,n="",i=0;i<r.length;i++){var o=r[i];o&&(n+=a+o.dataPath+" "+o.message+t)}return n.slice(0,-t.length)}function xS(r,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[r]=e,this}function AS(r){var e;if(r._opts.$data&&(e=_m(),r.addMetaSchema(e,e.$id,!0)),r._opts.meta!==!1){var t=kl();r._opts.$data&&(t=Cm(t,uS)),r.addMetaSchema(t,Qi,!0),r._refs["http://json-schema.org/schema"]=Qi}}function IS(r){var e=r._opts.schemas;if(e)if(Array.isArray(e))r.addSchema(e);else for(var t in e)r.addSchema(e[t],t)}function RS(r){for(var e in r._opts.formats){var t=r._opts.formats[e];r.addFormat(e,t)}}function PS(r){for(var e in r._opts.keywords){var t=r._opts.keywords[e];r.addKeyword(e,t)}}function Am(r,e){if(r._schemas[e]||r._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function DS(r){for(var e=km.copy(r._opts),t=0;t<Sm.length;t++)delete e[Sm[t]];return e}function NS(r){var e=r._opts.logger;if(e===!1)r.logger={log:xl,warn:xl,error:xl};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");r.logger=e}}function xl(){}});var Wg=te(($M,Vg)=>{"use strict";var Qo=Object.prototype.hasOwnProperty,Hg=Object.prototype.toString,Mg=Object.defineProperty,Fg=Object.getOwnPropertyDescriptor,Bg=function(e){return typeof Array.isArray=="function"?Array.isArray(e):Hg.call(e)==="[object Array]"},Gg=function(e){if(!e||Hg.call(e)!=="[object Object]")return!1;var t=Qo.call(e,"constructor"),a=e.constructor&&e.constructor.prototype&&Qo.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!t&&!a)return!1;var n;for(n in e);return typeof n>"u"||Qo.call(e,n)},zg=function(e,t){Mg&&t.name==="__proto__"?Mg(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},Ug=function(e,t){if(t==="__proto__")if(Qo.call(e,t)){if(Fg)return Fg(e,t).value}else return;return e[t]};Vg.exports=function r(){var e,t,a,n,i,o,s=arguments[0],l=1,c=arguments.length,u=!1;for(typeof s=="boolean"&&(u=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l<c;++l)if(e=arguments[l],e!=null)for(t in e)a=Ug(s,t),n=Ug(e,t),s!==n&&(u&&n&&(Gg(n)||(i=Bg(n)))?(i?(i=!1,o=a&&Bg(a)?a:[]):o=a&&Gg(a)?a:{},zg(s,{name:t,newValue:r(u,o,n)})):typeof n<"u"&&zg(s,{name:t,newValue:n}));return s}});var hf=te(he=>{"use strict";var ri=Symbol.for("react.element"),Ak=Symbol.for("react.portal"),Ik=Symbol.for("react.fragment"),Rk=Symbol.for("react.strict_mode"),Pk=Symbol.for("react.profiler"),Dk=Symbol.for("react.provider"),Nk=Symbol.for("react.context"),Ok=Symbol.for("react.forward_ref"),Lk=Symbol.for("react.suspense"),Mk=Symbol.for("react.memo"),Fk=Symbol.for("react.lazy"),rf=Symbol.iterator;function Bk(r){return r===null||typeof r!="object"?null:(r=rf&&r[rf]||r["@@iterator"],typeof r=="function"?r:null)}var of={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},sf=Object.assign,lf={};function da(r,e,t){this.props=r,this.context=e,this.refs=lf,this.updater=t||of}da.prototype.isReactComponent={};da.prototype.setState=function(r,e){if(typeof r!="object"&&typeof r!="function"&&r!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,r,e,"setState")};da.prototype.forceUpdate=function(r){this.updater.enqueueForceUpdate(this,r,"forceUpdate")};function cf(){}cf.prototype=da.prototype;function Zc(r,e,t){this.props=r,this.context=e,this.refs=lf,this.updater=t||of}var Jc=Zc.prototype=new cf;Jc.constructor=Zc;sf(Jc,da.prototype);Jc.isPureReactComponent=!0;var nf=Array.isArray,uf=Object.prototype.hasOwnProperty,Qc={current:null},df={key:!0,ref:!0,__self:!0,__source:!0};function pf(r,e,t){var a,n={},i=null,o=null;if(e!=null)for(a in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)uf.call(e,a)&&!df.hasOwnProperty(a)&&(n[a]=e[a]);var s=arguments.length-2;if(s===1)n.children=t;else if(1<s){for(var l=Array(s),c=0;c<s;c++)l[c]=arguments[c+2];n.children=l}if(r&&r.defaultProps)for(a in s=r.defaultProps,s)n[a]===void 0&&(n[a]=s[a]);return{$$typeof:ri,type:r,key:i,ref:o,props:n,_owner:Qc.current}}function Gk(r,e){return{$$typeof:ri,type:r.type,key:e,ref:r.ref,props:r.props,_owner:r._owner}}function eu(r){return typeof r=="object"&&r!==null&&r.$$typeof===ri}function zk(r){var e={"=":"=0",":":"=2"};return"$"+r.replace(/[=:]/g,function(t){return e[t]})}var af=/\/+/g;function Yc(r,e){return typeof r=="object"&&r!==null&&r.key!=null?zk(""+r.key):e.toString(36)}function fs(r,e,t,a,n){var i=typeof r;(i==="undefined"||i==="boolean")&&(r=null);var o=!1;if(r===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(r.$$typeof){case ri:case Ak:o=!0}}if(o)return o=r,n=n(o),r=a===""?"."+Yc(o,0):a,nf(n)?(t="",r!=null&&(t=r.replace(af,"$&/")+"/"),fs(n,e,t,"",function(c){return c})):n!=null&&(eu(n)&&(n=Gk(n,t+(!n.key||o&&o.key===n.key?"":(""+n.key).replace(af,"$&/")+"/")+r)),e.push(n)),1;if(o=0,a=a===""?".":a+":",nf(r))for(var s=0;s<r.length;s++){i=r[s];var l=a+Yc(i,s);o+=fs(i,e,t,l,n)}else if(l=Bk(r),typeof l=="function")for(r=l.call(r),s=0;!(i=r.next()).done;)i=i.value,l=a+Yc(i,s++),o+=fs(i,e,t,l,n);else if(i==="object")throw e=String(r),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function gs(r,e,t){if(r==null)return r;var a=[],n=0;return fs(r,a,"","",function(i){return e.call(t,i,n++)}),a}function Uk(r){if(r._status===-1){var e=r._result;e=e(),e.then(function(t){(r._status===0||r._status===-1)&&(r._status=1,r._result=t)},function(t){(r._status===0||r._status===-1)&&(r._status=2,r._result=t)}),r._status===-1&&(r._status=0,r._result=e)}if(r._status===1)return r._result.default;throw r._result}var mt={current:null},ys={transition:null},Hk={ReactCurrentDispatcher:mt,ReactCurrentBatchConfig:ys,ReactCurrentOwner:Qc};function mf(){throw Error("act(...) is not supported in production builds of React.")}he.Children={map:gs,forEach:function(r,e,t){gs(r,function(){e.apply(this,arguments)},t)},count:function(r){var e=0;return gs(r,function(){e++}),e},toArray:function(r){return gs(r,function(e){return e})||[]},only:function(r){if(!eu(r))throw Error("React.Children.only expected to receive a single React element child.");return r}};he.Component=da;he.Fragment=Ik;he.Profiler=Pk;he.PureComponent=Zc;he.StrictMode=Rk;he.Suspense=Lk;he.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Hk;he.act=mf;he.cloneElement=function(r,e,t){if(r==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+r+".");var a=sf({},r.props),n=r.key,i=r.ref,o=r._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=Qc.current),e.key!==void 0&&(n=""+e.key),r.type&&r.type.defaultProps)var s=r.type.defaultProps;for(l in e)uf.call(e,l)&&!df.hasOwnProperty(l)&&(a[l]=e[l]===void 0&&s!==void 0?s[l]:e[l])}var l=arguments.length-2;if(l===1)a.children=t;else if(1<l){s=Array(l);for(var c=0;c<l;c++)s[c]=arguments[c+2];a.children=s}return{$$typeof:ri,type:r.type,key:n,ref:i,props:a,_owner:o}};he.createContext=function(r){return r={$$typeof:Nk,_currentValue:r,_currentValue2:r,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},r.Provider={$$typeof:Dk,_context:r},r.Consumer=r};he.createElement=pf;he.createFactory=function(r){var e=pf.bind(null,r);return e.type=r,e};he.createRef=function(){return{current:null}};he.forwardRef=function(r){return{$$typeof:Ok,render:r}};he.isValidElement=eu;he.lazy=function(r){return{$$typeof:Fk,_payload:{_status:-1,_result:r},_init:Uk}};he.memo=function(r,e){return{$$typeof:Mk,type:r,compare:e===void 0?null:e}};he.startTransition=function(r){var e=ys.transition;ys.transition={};try{r()}finally{ys.transition=e}};he.unstable_act=mf;he.useCallback=function(r,e){return mt.current.useCallback(r,e)};he.useContext=function(r){return mt.current.useContext(r)};he.useDebugValue=function(){};he.useDeferredValue=function(r){return mt.current.useDeferredValue(r)};he.useEffect=function(r,e){return mt.current.useEffect(r,e)};he.useId=function(){return mt.current.useId()};he.useImperativeHandle=function(r,e,t){return mt.current.useImperativeHandle(r,e,t)};he.useInsertionEffect=function(r,e){return mt.current.useInsertionEffect(r,e)};he.useLayoutEffect=function(r,e){return mt.current.useLayoutEffect(r,e)};he.useMemo=function(r,e){return mt.current.useMemo(r,e)};he.useReducer=function(r,e,t){return mt.current.useReducer(r,e,t)};he.useRef=function(r){return mt.current.useRef(r)};he.useState=function(r){return mt.current.useState(r)};he.useSyncExternalStore=function(r,e,t){return mt.current.useSyncExternalStore(r,e,t)};he.useTransition=function(){return mt.current.useTransition()};he.version="18.3.1"});var ff=te((wF,gf)=>{"use strict";gf.exports=hf()});var tt=[];for(si=0;si<256;++si)tt.push((si+256).toString(16).slice(1));var si;function cu(r,e=0){return(tt[r[e+0]]+tt[r[e+1]]+tt[r[e+2]]+tt[r[e+3]]+"-"+tt[r[e+4]]+tt[r[e+5]]+"-"+tt[r[e+6]]+tt[r[e+7]]+"-"+tt[r[e+8]]+tt[r[e+9]]+"-"+tt[r[e+10]]+tt[r[e+11]]+tt[r[e+12]]+tt[r[e+13]]+tt[r[e+14]]+tt[r[e+15]]).toLowerCase()}var li,Nf=new Uint8Array(16);function ws(){if(!li&&(li=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!li))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return li(Nf)}var Of=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Cs={randomUUID:Of};function Lf(r,e,t){if(Cs.randomUUID&&!e&&!r)return Cs.randomUUID();r=r||{};var a=r.random||(r.rng||ws)();if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,e){t=t||0;for(var n=0;n<16;++n)e[t+n]=a[n];return e}return cu(a)}var Wt=Lf;function ks(r){let e=(r||"").split(`
|
|
1
|
+
import{b as te,c as ws,d as Cs,e as Pe}from"./chunk-AIYMQX7V.js";var Nd=te((Gi,Dd)=>{"use strict";(function(r,e){typeof Gi=="object"&&typeof Dd<"u"?e(Gi):typeof define=="function"&&define.amd?define(["exports"],e):e(r.URI=r.URI||{})})(Gi,function(r){"use strict";function e(){for(var w=arguments.length,b=Array(w),k=0;k<w;k++)b[k]=arguments[k];if(b.length>1){b[0]=b[0].slice(0,-1);for(var P=b.length-1,N=1;N<P;++N)b[N]=b[N].slice(1,-1);return b[P]=b[P].slice(1),b.join("")}else return b[0]}function t(w){return"(?:"+w+")"}function a(w){return w===void 0?"undefined":w===null?"null":Object.prototype.toString.call(w).split(" ").pop().split("]").shift().toLowerCase()}function n(w){return w.toUpperCase()}function i(w){return w!=null?w instanceof Array?w:typeof w.length!="number"||w.split||w.setInterval||w.call?[w]:Array.prototype.slice.call(w):[]}function o(w,b){var k=w;if(b)for(var P in b)k[P]=b[P];return k}function s(w){var b="[A-Za-z]",k="[\\x0D]",P="[0-9]",N="[\\x22]",q=e(P,"[A-Fa-f]"),ce="[\\x0A]",ve="[\\x20]",we=t(t("%[EFef]"+q+"%"+q+q+"%"+q+q)+"|"+t("%[89A-Fa-f]"+q+"%"+q+q)+"|"+t("%"+q+q)),Ke="[\\:\\/\\?\\#\\[\\]\\@]",be="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Me=e(Ke,be),$e=w?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Oe=w?"[\\uE000-\\uF8FF]":"[]",_e=e(b,P,"[\\-\\.\\_\\~]",$e),Fe=t(b+e(b,P,"[\\+\\-\\.]")+"*"),xe=t(t(we+"|"+e(_e,be,"[\\:]"))+"*"),jr=t(t("25[0-5]")+"|"+t("2[0-4]"+P)+"|"+t("1"+P+P)+"|"+t("[1-9]"+P)+"|"+P),Ct=t(t("25[0-5]")+"|"+t("2[0-4]"+P)+"|"+t("1"+P+P)+"|"+t("0?[1-9]"+P)+"|0?0?"+P),Ot=t(Ct+"\\."+Ct+"\\."+Ct+"\\."+Ct),Ae=t(q+"{1,4}"),kt=t(t(Ae+"\\:"+Ae)+"|"+Ot),Lt=t(t(Ae+"\\:")+"{6}"+kt),er=t("\\:\\:"+t(Ae+"\\:")+"{5}"+kt),qr=t(t(Ae)+"?\\:\\:"+t(Ae+"\\:")+"{4}"+kt),ur=t(t(t(Ae+"\\:")+"{0,1}"+Ae)+"?\\:\\:"+t(Ae+"\\:")+"{3}"+kt),ha=t(t(t(Ae+"\\:")+"{0,2}"+Ae)+"?\\:\\:"+t(Ae+"\\:")+"{2}"+kt),oi=t(t(t(Ae+"\\:")+"{0,3}"+Ae)+"?\\:\\:"+Ae+"\\:"+kt),si=t(t(t(Ae+"\\:")+"{0,4}"+Ae)+"?\\:\\:"+kt),xn=t(t(t(Ae+"\\:")+"{0,5}"+Ae)+"?\\:\\:"+Ae),An=t(t(t(Ae+"\\:")+"{0,6}"+Ae)+"?\\:\\:"),dr=t([Lt,er,qr,ur,ha,oi,si,xn,An].join("|")),In=t(t(_e+"|"+we)+"+"),Ss=t(dr+"\\%25"+In),Kr=t(dr+t("\\%25|\\%(?!"+q+"{2})")+In),If=t("[vV]"+q+"+\\."+e(_e,be,"[\\:]")+"+"),Rf=t("\\["+t(Kr+"|"+dr+"|"+If)+"\\]"),su=t(t(we+"|"+e(_e,be))+"*"),ga=t(Rf+"|"+Ot+"(?!"+su+")|"+su),fa=t(P+"*"),lu=t(t(xe+"@")+"?"+ga+t("\\:"+fa)+"?"),ya=t(we+"|"+e(_e,be,"[\\:\\@]")),Pf=t(ya+"*"),cu=t(ya+"+"),Df=t(t(we+"|"+e(_e,be,"[\\@]"))+"+"),pr=t(t("\\/"+Pf)+"*"),Rn=t("\\/"+t(cu+pr)+"?"),Es=t(Df+pr),li=t(cu+pr),Pn="(?!"+ya+")",Kk=t(pr+"|"+Rn+"|"+Es+"|"+li+"|"+Pn),Dn=t(t(ya+"|"+e("[\\/\\?]",Oe))+"*"),ba=t(t(ya+"|[\\/\\?]")+"*"),uu=t(t("\\/\\/"+lu+pr)+"|"+Rn+"|"+li+"|"+Pn),Nf=t(Fe+"\\:"+uu+t("\\?"+Dn)+"?"+t("\\#"+ba)+"?"),Of=t(t("\\/\\/"+lu+pr)+"|"+Rn+"|"+Es+"|"+Pn),Lf=t(Of+t("\\?"+Dn)+"?"+t("\\#"+ba)+"?"),$k=t(Nf+"|"+Lf),Xk=t(Fe+"\\:"+uu+t("\\?"+Dn)+"?"),Yk="^("+Fe+")\\:"+t(t("\\/\\/("+t("("+xe+")@")+"?("+ga+")"+t("\\:("+fa+")")+"?)")+"?("+pr+"|"+Rn+"|"+li+"|"+Pn+")")+t("\\?("+Dn+")")+"?"+t("\\#("+ba+")")+"?$",Zk="^(){0}"+t(t("\\/\\/("+t("("+xe+")@")+"?("+ga+")"+t("\\:("+fa+")")+"?)")+"?("+pr+"|"+Rn+"|"+Es+"|"+Pn+")")+t("\\?("+Dn+")")+"?"+t("\\#("+ba+")")+"?$",Jk="^("+Fe+")\\:"+t(t("\\/\\/("+t("("+xe+")@")+"?("+ga+")"+t("\\:("+fa+")")+"?)")+"?("+pr+"|"+Rn+"|"+li+"|"+Pn+")")+t("\\?("+Dn+")")+"?$",Qk="^"+t("\\#("+ba+")")+"?$",eT="^"+t("("+xe+")@")+"?("+ga+")"+t("\\:("+fa+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",b,P,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",_e,be),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",_e,be),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",_e,be),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",_e,be),"g"),NOT_QUERY:new RegExp(e("[^\\%]",_e,be,"[\\:\\@\\/\\?]",Oe),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",_e,be,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",_e,be),"g"),UNRESERVED:new RegExp(_e,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",_e,Me),"g"),PCT_ENCODED:new RegExp(we,"g"),IPV4ADDRESS:new RegExp("^("+Ot+")$"),IPV6ADDRESS:new RegExp("^\\[?("+dr+")"+t(t("\\%25|\\%(?!"+q+"{2})")+"("+In+")")+"?\\]?$")}}var l=s(!1),c=s(!0),u=function(){function w(b,k){var P=[],N=!0,q=!1,ce=void 0;try{for(var ve=b[Symbol.iterator](),we;!(N=(we=ve.next()).done)&&(P.push(we.value),!(k&&P.length===k));N=!0);}catch(Ke){q=!0,ce=Ke}finally{try{!N&&ve.return&&ve.return()}finally{if(q)throw ce}}return P}return function(b,k){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return w(b,k);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(w){if(Array.isArray(w)){for(var b=0,k=Array(w.length);b<w.length;b++)k[b]=w[b];return k}else return Array.from(w)},m=2147483647,d=36,g=1,f=26,y=38,v=700,T=72,E=128,I="-",D=/^xn--/,C=/[^\0-\x7E]/,M=/[\x2E\u3002\uFF0E\uFF61]/g,F={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},R=d-g,G=Math.floor,z=String.fromCharCode;function O(w){throw new RangeError(F[w])}function x(w,b){for(var k=[],P=w.length;P--;)k[P]=b(w[P]);return k}function A(w,b){var k=w.split("@"),P="";k.length>1&&(P=k[0]+"@",w=k[1]),w=w.replace(M,".");var N=w.split("."),q=x(N,b).join(".");return P+q}function B(w){for(var b=[],k=0,P=w.length;k<P;){var N=w.charCodeAt(k++);if(N>=55296&&N<=56319&&k<P){var q=w.charCodeAt(k++);(q&64512)==56320?b.push(((N&1023)<<10)+(q&1023)+65536):(b.push(N),k--)}else b.push(N)}return b}var X=function(b){return String.fromCodePoint.apply(String,p(b))},K=function(b){return b-48<10?b-22:b-65<26?b-65:b-97<26?b-97:d},Q=function(b,k){return b+22+75*(b<26)-((k!=0)<<5)},Z=function(b,k,P){var N=0;for(b=P?G(b/v):b>>1,b+=G(b/k);b>R*f>>1;N+=d)b=G(b/R);return G(N+(R+1)*b/(b+y))},_=function(b){var k=[],P=b.length,N=0,q=E,ce=T,ve=b.lastIndexOf(I);ve<0&&(ve=0);for(var we=0;we<ve;++we)b.charCodeAt(we)>=128&&O("not-basic"),k.push(b.charCodeAt(we));for(var Ke=ve>0?ve+1:0;Ke<P;){for(var be=N,Me=1,$e=d;;$e+=d){Ke>=P&&O("invalid-input");var Oe=K(b.charCodeAt(Ke++));(Oe>=d||Oe>G((m-N)/Me))&&O("overflow"),N+=Oe*Me;var _e=$e<=ce?g:$e>=ce+f?f:$e-ce;if(Oe<_e)break;var Fe=d-_e;Me>G(m/Fe)&&O("overflow"),Me*=Fe}var xe=k.length+1;ce=Z(N-be,xe,be==0),G(N/xe)>m-q&&O("overflow"),q+=G(N/xe),N%=xe,k.splice(N++,0,q)}return String.fromCodePoint.apply(String,k)},fe=function(b){var k=[];b=B(b);var P=b.length,N=E,q=0,ce=T,ve=!0,we=!1,Ke=void 0;try{for(var be=b[Symbol.iterator](),Me;!(ve=(Me=be.next()).done);ve=!0){var $e=Me.value;$e<128&&k.push(z($e))}}catch(Kr){we=!0,Ke=Kr}finally{try{!ve&&be.return&&be.return()}finally{if(we)throw Ke}}var Oe=k.length,_e=Oe;for(Oe&&k.push(I);_e<P;){var Fe=m,xe=!0,jr=!1,Ct=void 0;try{for(var Ot=b[Symbol.iterator](),Ae;!(xe=(Ae=Ot.next()).done);xe=!0){var kt=Ae.value;kt>=N&&kt<Fe&&(Fe=kt)}}catch(Kr){jr=!0,Ct=Kr}finally{try{!xe&&Ot.return&&Ot.return()}finally{if(jr)throw Ct}}var Lt=_e+1;Fe-N>G((m-q)/Lt)&&O("overflow"),q+=(Fe-N)*Lt,N=Fe;var er=!0,qr=!1,ur=void 0;try{for(var ha=b[Symbol.iterator](),oi;!(er=(oi=ha.next()).done);er=!0){var si=oi.value;if(si<N&&++q>m&&O("overflow"),si==N){for(var xn=q,An=d;;An+=d){var dr=An<=ce?g:An>=ce+f?f:An-ce;if(xn<dr)break;var In=xn-dr,Ss=d-dr;k.push(z(Q(dr+In%Ss,0))),xn=G(In/Ss)}k.push(z(Q(xn,0))),ce=Z(q,Lt,_e==Oe),q=0,++_e}}}catch(Kr){qr=!0,ur=Kr}finally{try{!er&&ha.return&&ha.return()}finally{if(qr)throw ur}}++q,++N}return k.join("")},Ie=function(b){return A(b,function(k){return D.test(k)?_(k.slice(4).toLowerCase()):k})},S=function(b){return A(b,function(k){return C.test(k)?"xn--"+fe(k):k})},ne={version:"2.1.0",ucs2:{decode:B,encode:X},decode:_,encode:fe,toASCII:S,toUnicode:Ie},Te={};function Be(w){var b=w.charCodeAt(0),k=void 0;return b<16?k="%0"+b.toString(16).toUpperCase():b<128?k="%"+b.toString(16).toUpperCase():b<2048?k="%"+(b>>6|192).toString(16).toUpperCase()+"%"+(b&63|128).toString(16).toUpperCase():k="%"+(b>>12|224).toString(16).toUpperCase()+"%"+(b>>6&63|128).toString(16).toUpperCase()+"%"+(b&63|128).toString(16).toUpperCase(),k}function We(w){for(var b="",k=0,P=w.length;k<P;){var N=parseInt(w.substr(k+1,2),16);if(N<128)b+=String.fromCharCode(N),k+=3;else if(N>=194&&N<224){if(P-k>=6){var q=parseInt(w.substr(k+4,2),16);b+=String.fromCharCode((N&31)<<6|q&63)}else b+=w.substr(k,6);k+=6}else if(N>=224){if(P-k>=9){var ce=parseInt(w.substr(k+4,2),16),ve=parseInt(w.substr(k+7,2),16);b+=String.fromCharCode((N&15)<<12|(ce&63)<<6|ve&63)}else b+=w.substr(k,9);k+=9}else b+=w.substr(k,3),k+=3}return b}function Re(w,b){function k(P){var N=We(P);return N.match(b.UNRESERVED)?N:P}return w.scheme&&(w.scheme=String(w.scheme).replace(b.PCT_ENCODED,k).toLowerCase().replace(b.NOT_SCHEME,"")),w.userinfo!==void 0&&(w.userinfo=String(w.userinfo).replace(b.PCT_ENCODED,k).replace(b.NOT_USERINFO,Be).replace(b.PCT_ENCODED,n)),w.host!==void 0&&(w.host=String(w.host).replace(b.PCT_ENCODED,k).toLowerCase().replace(b.NOT_HOST,Be).replace(b.PCT_ENCODED,n)),w.path!==void 0&&(w.path=String(w.path).replace(b.PCT_ENCODED,k).replace(w.scheme?b.NOT_PATH:b.NOT_PATH_NOSCHEME,Be).replace(b.PCT_ENCODED,n)),w.query!==void 0&&(w.query=String(w.query).replace(b.PCT_ENCODED,k).replace(b.NOT_QUERY,Be).replace(b.PCT_ENCODED,n)),w.fragment!==void 0&&(w.fragment=String(w.fragment).replace(b.PCT_ENCODED,k).replace(b.NOT_FRAGMENT,Be).replace(b.PCT_ENCODED,n)),w}function ut(w){return w.replace(/^0*(.*)/,"$1")||"0"}function Se(w,b){var k=w.match(b.IPV4ADDRESS)||[],P=u(k,2),N=P[1];return N?N.split(".").map(ut).join("."):w}function Ce(w,b){var k=w.match(b.IPV6ADDRESS)||[],P=u(k,3),N=P[1],q=P[2];if(N){for(var ce=N.toLowerCase().split("::").reverse(),ve=u(ce,2),we=ve[0],Ke=ve[1],be=Ke?Ke.split(":").map(ut):[],Me=we.split(":").map(ut),$e=b.IPV4ADDRESS.test(Me[Me.length-1]),Oe=$e?7:8,_e=Me.length-Oe,Fe=Array(Oe),xe=0;xe<Oe;++xe)Fe[xe]=be[xe]||Me[_e+xe]||"";$e&&(Fe[Oe-1]=Se(Fe[Oe-1],b));var jr=Fe.reduce(function(Lt,er,qr){if(!er||er==="0"){var ur=Lt[Lt.length-1];ur&&ur.index+ur.length===qr?ur.length++:Lt.push({index:qr,length:1})}return Lt},[]),Ct=jr.sort(function(Lt,er){return er.length-Lt.length})[0],Ot=void 0;if(Ct&&Ct.length>1){var Ae=Fe.slice(0,Ct.index),kt=Fe.slice(Ct.index+Ct.length);Ot=Ae.join(":")+"::"+kt.join(":")}else Ot=Fe.join(":");return q&&(Ot+="%"+q),Ot}else return w}var gt=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,je="".match(/(){0}/)[1]===void 0;function ye(w){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},k={},P=b.iri!==!1?c:l;b.reference==="suffix"&&(w=(b.scheme?b.scheme+":":"")+"//"+w);var N=w.match(gt);if(N){je?(k.scheme=N[1],k.userinfo=N[3],k.host=N[4],k.port=parseInt(N[5],10),k.path=N[6]||"",k.query=N[7],k.fragment=N[8],isNaN(k.port)&&(k.port=N[5])):(k.scheme=N[1]||void 0,k.userinfo=w.indexOf("@")!==-1?N[3]:void 0,k.host=w.indexOf("//")!==-1?N[4]:void 0,k.port=parseInt(N[5],10),k.path=N[6]||"",k.query=w.indexOf("?")!==-1?N[7]:void 0,k.fragment=w.indexOf("#")!==-1?N[8]:void 0,isNaN(k.port)&&(k.port=w.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?N[4]:void 0)),k.host&&(k.host=Ce(Se(k.host,P),P)),k.scheme===void 0&&k.userinfo===void 0&&k.host===void 0&&k.port===void 0&&!k.path&&k.query===void 0?k.reference="same-document":k.scheme===void 0?k.reference="relative":k.fragment===void 0?k.reference="absolute":k.reference="uri",b.reference&&b.reference!=="suffix"&&b.reference!==k.reference&&(k.error=k.error||"URI is not a "+b.reference+" reference.");var q=Te[(b.scheme||k.scheme||"").toLowerCase()];if(!b.unicodeSupport&&(!q||!q.unicodeSupport)){if(k.host&&(b.domainHost||q&&q.domainHost))try{k.host=ne.toASCII(k.host.replace(P.PCT_ENCODED,We).toLowerCase())}catch(ce){k.error=k.error||"Host's domain name can not be converted to ASCII via punycode: "+ce}Re(k,l)}else Re(k,P);q&&q.parse&&q.parse(k,b)}else k.error=k.error||"URI can not be parsed.";return k}function Wt(w,b){var k=b.iri!==!1?c:l,P=[];return w.userinfo!==void 0&&(P.push(w.userinfo),P.push("@")),w.host!==void 0&&P.push(Ce(Se(String(w.host),k),k).replace(k.IPV6ADDRESS,function(N,q,ce){return"["+q+(ce?"%25"+ce:"")+"]"})),(typeof w.port=="number"||typeof w.port=="string")&&(P.push(":"),P.push(String(w.port))),P.length?P.join(""):void 0}var Pt=/^\.\.?\//,cr=/^\/\.(\/|$)/,Qt=/^\/\.\.(\/|$)/,qe=/^\/?(?:.|\n)*?(?=\/|$)/;function ft(w){for(var b=[];w.length;)if(w.match(Pt))w=w.replace(Pt,"");else if(w.match(cr))w=w.replace(cr,"/");else if(w.match(Qt))w=w.replace(Qt,"/"),b.pop();else if(w==="."||w==="..")w="";else{var k=w.match(qe);if(k){var P=k[0];w=w.slice(P.length),b.push(P)}else throw new Error("Unexpected dot segment condition")}return b.join("")}function at(w){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},k=b.iri?c:l,P=[],N=Te[(b.scheme||w.scheme||"").toLowerCase()];if(N&&N.serialize&&N.serialize(w,b),w.host&&!k.IPV6ADDRESS.test(w.host)){if(b.domainHost||N&&N.domainHost)try{w.host=b.iri?ne.toUnicode(w.host):ne.toASCII(w.host.replace(k.PCT_ENCODED,We).toLowerCase())}catch(ve){w.error=w.error||"Host's domain name can not be converted to "+(b.iri?"Unicode":"ASCII")+" via punycode: "+ve}}Re(w,k),b.reference!=="suffix"&&w.scheme&&(P.push(w.scheme),P.push(":"));var q=Wt(w,b);if(q!==void 0&&(b.reference!=="suffix"&&P.push("//"),P.push(q),w.path&&w.path.charAt(0)!=="/"&&P.push("/")),w.path!==void 0){var ce=w.path;!b.absolutePath&&(!N||!N.absolutePath)&&(ce=ft(ce)),q===void 0&&(ce=ce.replace(/^\/\//,"/%2F")),P.push(ce)}return w.query!==void 0&&(P.push("?"),P.push(w.query)),w.fragment!==void 0&&(P.push("#"),P.push(w.fragment)),P.join("")}function Qe(w,b){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},P=arguments[3],N={};return P||(w=ye(at(w,k),k),b=ye(at(b,k),k)),k=k||{},!k.tolerant&&b.scheme?(N.scheme=b.scheme,N.userinfo=b.userinfo,N.host=b.host,N.port=b.port,N.path=ft(b.path||""),N.query=b.query):(b.userinfo!==void 0||b.host!==void 0||b.port!==void 0?(N.userinfo=b.userinfo,N.host=b.host,N.port=b.port,N.path=ft(b.path||""),N.query=b.query):(b.path?(b.path.charAt(0)==="/"?N.path=ft(b.path):((w.userinfo!==void 0||w.host!==void 0||w.port!==void 0)&&!w.path?N.path="/"+b.path:w.path?N.path=w.path.slice(0,w.path.lastIndexOf("/")+1)+b.path:N.path=b.path,N.path=ft(N.path)),N.query=b.query):(N.path=w.path,b.query!==void 0?N.query=b.query:N.query=w.query),N.userinfo=w.userinfo,N.host=w.host,N.port=w.port),N.scheme=w.scheme),N.fragment=b.fragment,N}function Dt(w,b,k){var P=o({scheme:"null"},k);return at(Qe(ye(w,P),ye(b,P),P,!0),P)}function dt(w,b){return typeof w=="string"?w=at(ye(w,b),b):a(w)==="object"&&(w=ye(at(w,b),b)),w}function L(w,b,k){return typeof w=="string"?w=at(ye(w,k),k):a(w)==="object"&&(w=at(w,k)),typeof b=="string"?b=at(ye(b,k),k):a(b)==="object"&&(b=at(b,k)),w===b}function V(w,b){return w&&w.toString().replace(!b||!b.iri?l.ESCAPE:c.ESCAPE,Be)}function J(w,b){return w&&w.toString().replace(!b||!b.iri?l.PCT_ENCODED:c.PCT_ENCODED,We)}var le={scheme:"http",domainHost:!0,parse:function(b,k){return b.host||(b.error=b.error||"HTTP URIs must have a host."),b},serialize:function(b,k){var P=String(b.scheme).toLowerCase()==="https";return(b.port===(P?443:80)||b.port==="")&&(b.port=void 0),b.path||(b.path="/"),b}},Ee={scheme:"https",domainHost:le.domainHost,parse:le.parse,serialize:le.serialize};function yt(w){return typeof w.secure=="boolean"?w.secure:String(w.scheme).toLowerCase()==="wss"}var wt={scheme:"ws",domainHost:!0,parse:function(b,k){var P=b;return P.secure=yt(P),P.resourceName=(P.path||"/")+(P.query?"?"+P.query:""),P.path=void 0,P.query=void 0,P},serialize:function(b,k){if((b.port===(yt(b)?443:80)||b.port==="")&&(b.port=void 0),typeof b.secure=="boolean"&&(b.scheme=b.secure?"wss":"ws",b.secure=void 0),b.resourceName){var P=b.resourceName.split("?"),N=u(P,2),q=N[0],ce=N[1];b.path=q&&q!=="/"?q:void 0,b.query=ce,b.resourceName=void 0}return b.fragment=void 0,b}},Nt={scheme:"wss",domainHost:wt.domainHost,parse:wt.parse,serialize:wt.serialize},Vr={},Wr=!0,it="[A-Za-z0-9\\-\\.\\_\\~"+(Wr?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",et="[0-9A-Fa-f]",jt=t(t("%[EFef]"+et+"%"+et+et+"%"+et+et)+"|"+t("%[89A-Fa-f]"+et+"%"+et+et)+"|"+t("%"+et+et)),_f="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Sf="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Ef=e(Sf,'[\\"\\\\]'),wf="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Cf=new RegExp(it,"g"),Tn=new RegExp(jt,"g"),kf=new RegExp(e("[^]",_f,"[\\.]",'[\\"]',Ef),"g"),nu=new RegExp(e("[^]",it,wf),"g"),Tf=nu;function _s(w){var b=We(w);return b.match(Cf)?b:w}var au={scheme:"mailto",parse:function(b,k){var P=b,N=P.to=P.path?P.path.split(","):[];if(P.path=void 0,P.query){for(var q=!1,ce={},ve=P.query.split("&"),we=0,Ke=ve.length;we<Ke;++we){var be=ve[we].split("=");switch(be[0]){case"to":for(var Me=be[1].split(","),$e=0,Oe=Me.length;$e<Oe;++$e)N.push(Me[$e]);break;case"subject":P.subject=J(be[1],k);break;case"body":P.body=J(be[1],k);break;default:q=!0,ce[J(be[0],k)]=J(be[1],k);break}}q&&(P.headers=ce)}P.query=void 0;for(var _e=0,Fe=N.length;_e<Fe;++_e){var xe=N[_e].split("@");if(xe[0]=J(xe[0]),k.unicodeSupport)xe[1]=J(xe[1],k).toLowerCase();else try{xe[1]=ne.toASCII(J(xe[1],k).toLowerCase())}catch(jr){P.error=P.error||"Email address's domain name can not be converted to ASCII via punycode: "+jr}N[_e]=xe.join("@")}return P},serialize:function(b,k){var P=b,N=i(b.to);if(N){for(var q=0,ce=N.length;q<ce;++q){var ve=String(N[q]),we=ve.lastIndexOf("@"),Ke=ve.slice(0,we).replace(Tn,_s).replace(Tn,n).replace(kf,Be),be=ve.slice(we+1);try{be=k.iri?ne.toUnicode(be):ne.toASCII(J(be,k).toLowerCase())}catch(_e){P.error=P.error||"Email address's domain name can not be converted to "+(k.iri?"Unicode":"ASCII")+" via punycode: "+_e}N[q]=Ke+"@"+be}P.path=N.join(",")}var Me=b.headers=b.headers||{};b.subject&&(Me.subject=b.subject),b.body&&(Me.body=b.body);var $e=[];for(var Oe in Me)Me[Oe]!==Vr[Oe]&&$e.push(Oe.replace(Tn,_s).replace(Tn,n).replace(nu,Be)+"="+Me[Oe].replace(Tn,_s).replace(Tn,n).replace(Tf,Be));return $e.length&&(P.query=$e.join("&")),P}},xf=/^([^\:]+)\:(.*)/,iu={scheme:"urn",parse:function(b,k){var P=b.path&&b.path.match(xf),N=b;if(P){var q=k.scheme||N.scheme||"urn",ce=P[1].toLowerCase(),ve=P[2],we=q+":"+(k.nid||ce),Ke=Te[we];N.nid=ce,N.nss=ve,N.path=void 0,Ke&&(N=Ke.parse(N,k))}else N.error=N.error||"URN can not be parsed.";return N},serialize:function(b,k){var P=k.scheme||b.scheme||"urn",N=b.nid,q=P+":"+(k.nid||N),ce=Te[q];ce&&(b=ce.serialize(b,k));var ve=b,we=b.nss;return ve.path=(N||k.nid)+":"+we,ve}},Af=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,ou={scheme:"urn:uuid",parse:function(b,k){var P=b;return P.uuid=P.nss,P.nss=void 0,!k.tolerant&&(!P.uuid||!P.uuid.match(Af))&&(P.error=P.error||"UUID is not valid."),P},serialize:function(b,k){var P=b;return P.nss=(b.uuid||"").toLowerCase(),P}};Te[le.scheme]=le,Te[Ee.scheme]=Ee,Te[wt.scheme]=wt,Te[Nt.scheme]=Nt,Te[au.scheme]=au,Te[iu.scheme]=iu,Te[ou.scheme]=ou,r.SCHEMES=Te,r.pctEncChar=Be,r.pctDecChars=We,r.parse=ye,r.removeDotSegments=ft,r.serialize=at,r.resolveComponents=Qe,r.resolve=Dt,r.normalize=dt,r.equal=L,r.escapeComponent=V,r.unescapeComponent=J,Object.defineProperty(r,"__esModule",{value:!0})})});var zi=te((AA,Od)=>{"use strict";Od.exports=function r(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var a,n,i;if(Array.isArray(e)){if(a=e.length,a!=t.length)return!1;for(n=a;n--!==0;)if(!r(e[n],t[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(i=Object.keys(e),a=i.length,a!==Object.keys(t).length)return!1;for(n=a;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[n]))return!1;for(n=a;n--!==0;){var o=i[n];if(!r(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}});var Md=te((IA,Ld)=>{"use strict";Ld.exports=function(e){for(var t=0,a=e.length,n=0,i;n<a;)t++,i=e.charCodeAt(n++),i>=55296&&i<=56319&&n<a&&(i=e.charCodeAt(n),(i&64512)==56320&&n++);return t}});var mn=te((RA,Gd)=>{"use strict";Gd.exports={copy:i_,checkDataType:ol,checkDataTypes:o_,coerceToTypes:s_,toHash:ll,getProperty:cl,escapeQuotes:ul,equal:zi(),ucs2length:Md(),varOccurences:u_,varReplace:d_,schemaHasRules:p_,schemaHasRulesExcept:m_,schemaUnknownRules:h_,toQuotedString:sl,getPathExpr:g_,getPath:f_,getData:v_,unescapeFragment:__,unescapeJsonPointer:pl,escapeFragment:S_,escapeJsonPointer:dl};function i_(r,e){e=e||{};for(var t in r)e[t]=r[t];return e}function ol(r,e,t,a){var n=a?" !== ":" === ",i=a?" || ":" && ",o=a?"!":"",s=a?"":"!";switch(r){case"null":return e+n+"null";case"array":return o+"Array.isArray("+e+")";case"object":return"("+o+e+i+"typeof "+e+n+'"object"'+i+s+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+n+'"number"'+i+s+"("+e+" % 1)"+i+e+n+e+(t?i+o+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+n+'"'+r+'"'+(t?i+o+"isFinite("+e+")":"")+")";default:return"typeof "+e+n+'"'+r+'"'}}function o_(r,e,t){switch(r.length){case 1:return ol(r[0],e,t,!0);default:var a="",n=ll(r);n.array&&n.object&&(a=n.null?"(":"(!"+e+" || ",a+="typeof "+e+' !== "object")',delete n.null,delete n.array,delete n.object),n.number&&delete n.integer;for(var i in n)a+=(a?" && ":"")+ol(i,e,t,!0);return a}}var Fd=ll(["string","number","integer","boolean","null"]);function s_(r,e){if(Array.isArray(e)){for(var t=[],a=0;a<e.length;a++){var n=e[a];(Fd[n]||r==="array"&&n==="array")&&(t[t.length]=n)}if(t.length)return t}else{if(Fd[e])return[e];if(r==="array"&&e==="array")return["array"]}}function ll(r){for(var e={},t=0;t<r.length;t++)e[r[t]]=!0;return e}var l_=/^[a-z$_][a-z$_0-9]*$/i,c_=/'|\\/g;function cl(r){return typeof r=="number"?"["+r+"]":l_.test(r)?"."+r:"['"+ul(r)+"']"}function ul(r){return r.replace(c_,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function u_(r,e){e+="[^0-9]";var t=r.match(new RegExp(e,"g"));return t?t.length:0}function d_(r,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),r.replace(new RegExp(e,"g"),t+"$1")}function p_(r,e){if(typeof r=="boolean")return!r;for(var t in r)if(e[t])return!0}function m_(r,e,t){if(typeof r=="boolean")return!r&&t!="not";for(var a in r)if(a!=t&&e[a])return!0}function h_(r,e){if(typeof r!="boolean"){for(var t in r)if(!e[t])return t}}function sl(r){return"'"+ul(r)+"'"}function g_(r,e,t,a){var n=t?"'/' + "+e+(a?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):a?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Bd(r,n)}function f_(r,e,t){var a=sl(t?"/"+dl(e):cl(e));return Bd(r,a)}var y_=/^\/(?:[^~]|~0|~1)*$/,b_=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function v_(r,e,t){var a,n,i,o;if(r==="")return"rootData";if(r[0]=="/"){if(!y_.test(r))throw new Error("Invalid JSON-pointer: "+r);n=r,i="rootData"}else{if(o=r.match(b_),!o)throw new Error("Invalid JSON-pointer: "+r);if(a=+o[1],n=o[2],n=="#"){if(a>=e)throw new Error("Cannot access property/index "+a+" levels up, current level is "+e);return t[e-a]}if(a>e)throw new Error("Cannot access data "+a+" levels up, current level is "+e);if(i="data"+(e-a||""),!n)return i}for(var s=i,l=n.split("/"),c=0;c<l.length;c++){var u=l[c];u&&(i+=cl(pl(u)),s+=" && "+i)}return s}function Bd(r,e){return r=='""'?e:(r+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function __(r){return pl(decodeURIComponent(r))}function S_(r){return encodeURIComponent(dl(r))}function dl(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}function pl(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")}});var ml=te((PA,zd)=>{"use strict";var E_=mn();zd.exports=w_;function w_(r){E_.copy(r,this)}});var Hd=te((DA,Ud)=>{"use strict";var Nr=Ud.exports=function(r,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var a=typeof t=="function"?t:t.pre||function(){},n=t.post||function(){};Ui(e,a,n,r,"",r)};Nr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Nr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Nr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Nr.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 Ui(r,e,t,a,n,i,o,s,l,c){if(a&&typeof a=="object"&&!Array.isArray(a)){e(a,n,i,o,s,l,c);for(var u in a){var p=a[u];if(Array.isArray(p)){if(u in Nr.arrayKeywords)for(var m=0;m<p.length;m++)Ui(r,e,t,p[m],n+"/"+u+"/"+m,i,n,u,a,m)}else if(u in Nr.propsKeywords){if(p&&typeof p=="object")for(var d in p)Ui(r,e,t,p[d],n+"/"+u+"/"+C_(d),i,n,u,a,d)}else(u in Nr.keywords||r.allKeys&&!(u in Nr.skipKeywords))&&Ui(r,e,t,p,n+"/"+u,i,n,u,a)}t(a,n,i,o,s,l,c)}}function C_(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ki=te((NA,qd)=>{"use strict";var ka=Nd(),Vd=zi(),ji=mn(),Hi=ml(),k_=Hd();qd.exports=Lr;Lr.normalizeId=Or;Lr.fullPath=Vi;Lr.url=Wi;Lr.ids=R_;Lr.inlineRef=hl;Lr.schema=qi;function Lr(r,e,t){var a=this._refs[t];if(typeof a=="string")if(this._refs[a])a=this._refs[a];else return Lr.call(this,r,e,a);if(a=a||this._schemas[t],a instanceof Hi)return hl(a.schema,this._opts.inlineRefs)?a.schema:a.validate||this._compile(a);var n=qi.call(this,e,t),i,o,s;return n&&(i=n.schema,e=n.root,s=n.baseId),i instanceof Hi?o=i.validate||r.call(this,i.schema,e,void 0,s):i!==void 0&&(o=hl(i,this._opts.inlineRefs)?i:r.call(this,i,e,void 0,s)),o}function qi(r,e){var t=ka.parse(e),a=jd(t),n=Vi(this._getId(r.schema));if(Object.keys(r.schema).length===0||a!==n){var i=Or(a),o=this._refs[i];if(typeof o=="string")return T_.call(this,r,o,t);if(o instanceof Hi)o.validate||this._compile(o),r=o;else if(o=this._schemas[i],o instanceof Hi){if(o.validate||this._compile(o),i==Or(e))return{schema:o,root:r,baseId:n};r=o}else return;if(!r.schema)return;n=Vi(this._getId(r.schema))}return Wd.call(this,t,n,r.schema,r)}function T_(r,e,t){var a=qi.call(this,r,e);if(a){var n=a.schema,i=a.baseId;r=a.root;var o=this._getId(n);return o&&(i=Wi(i,o)),Wd.call(this,t,i,n,r)}}var x_=ji.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Wd(r,e,t,a){if(r.fragment=r.fragment||"",r.fragment.slice(0,1)=="/"){for(var n=r.fragment.split("/"),i=1;i<n.length;i++){var o=n[i];if(o){if(o=ji.unescapeFragment(o),t=t[o],t===void 0)break;var s;if(!x_[o]&&(s=this._getId(t),s&&(e=Wi(e,s)),t.$ref)){var l=Wi(e,t.$ref),c=qi.call(this,a,l);c&&(t=c.schema,a=c.root,e=c.baseId)}}}if(t!==void 0&&t!==a.schema)return{schema:t,root:a,baseId:e}}}var A_=ji.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function hl(r,e){if(e===!1)return!1;if(e===void 0||e===!0)return gl(r);if(e)return fl(r)<=e}function gl(r){var e;if(Array.isArray(r)){for(var t=0;t<r.length;t++)if(e=r[t],typeof e=="object"&&!gl(e))return!1}else for(var a in r)if(a=="$ref"||(e=r[a],typeof e=="object"&&!gl(e)))return!1;return!0}function fl(r){var e=0,t;if(Array.isArray(r)){for(var a=0;a<r.length;a++)if(t=r[a],typeof t=="object"&&(e+=fl(t)),e==1/0)return 1/0}else for(var n in r){if(n=="$ref")return 1/0;if(A_[n])e++;else if(t=r[n],typeof t=="object"&&(e+=fl(t)+1),e==1/0)return 1/0}return e}function Vi(r,e){e!==!1&&(r=Or(r));var t=ka.parse(r);return jd(t)}function jd(r){return ka.serialize(r).split("#")[0]+"#"}var I_=/#\/?$/;function Or(r){return r?r.replace(I_,""):""}function Wi(r,e){return e=Or(e),ka.resolve(r,e)}function R_(r){var e=Or(this._getId(r)),t={"":e},a={"":Vi(e,!1)},n={},i=this;return k_(r,{allKeys:!0},function(o,s,l,c,u,p,m){if(s!==""){var d=i._getId(o),g=t[c],f=a[c]+"/"+u;if(m!==void 0&&(f+="/"+(typeof m=="number"?m:ji.escapeFragment(m))),typeof d=="string"){d=g=Or(g?ka.resolve(g,d):d);var y=i._refs[d];if(typeof y=="string"&&(y=i._refs[y]),y&&y.schema){if(!Vd(o,y.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=Or(f))if(d[0]=="#"){if(n[d]&&!Vd(o,n[d]))throw new Error('id "'+d+'" resolves to more than one schema');n[d]=o}else i._refs[d]=f}t[s]=g,a[s]=f}}),n}});var $i=te((OA,$d)=>{"use strict";var yl=Ki();$d.exports={Validation:Kd(P_),MissingRef:Kd(bl)};function P_(r){this.message="validation failed",this.errors=r,this.ajv=this.validation=!0}bl.message=function(r,e){return"can't resolve reference "+e+" from id "+r};function bl(r,e,t){this.message=t||bl.message(r,e),this.missingRef=yl.url(r,e),this.missingSchema=yl.normalizeId(yl.fullPath(this.missingRef))}function Kd(r){return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}});var vl=te((LA,Xd)=>{"use strict";Xd.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,a=e.cmp&&function(i){return function(o){return function(s,l){var c={key:s,value:o[s]},u={key:l,value:o[l]};return i(c,u)}}}(e.cmp),n=[];return function i(o){if(o&&o.toJSON&&typeof o.toJSON=="function"&&(o=o.toJSON()),o!==void 0){if(typeof o=="number")return isFinite(o)?""+o:"null";if(typeof o!="object")return JSON.stringify(o);var s,l;if(Array.isArray(o)){for(l="[",s=0;s<o.length;s++)s&&(l+=","),l+=i(o[s])||"null";return l+"]"}if(o===null)return"null";if(n.indexOf(o)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var c=n.push(o)-1,u=Object.keys(o).sort(a&&a(o));for(l="",s=0;s<u.length;s++){var p=u[s],m=i(o[p]);m&&(l&&(l+=","),l+=JSON.stringify(p)+":"+m)}return n.splice(c,1),"{"+l+"}"}}(r)}});var _l=te((MA,Yd)=>{"use strict";Yd.exports=function(e,t,a){var n="",i=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),s=e.self._getId(e.schema);if(e.opts.strictKeywords){var l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var c="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(n+=" var validate = ",i&&(e.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",s&&(e.opts.sourceCode||e.opts.processCode)&&(n+=" "+("/*# sourceURL="+s+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var t="false schema",u=e.level,p=e.dataLevel,m=e.schema[t],d=e.schemaPath+e.util.getProperty(t),g=e.errSchemaPath+"/"+t,D=!e.opts.allErrors,F,f="data"+(p||""),I="valid"+u;if(e.schema===!1){e.isTop?D=!0:n+=" var "+I+" = false; ";var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(F||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'boolean schema is false' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var v=n;n=y.pop(),!e.compositeRule&&D?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?i?n+=" return data; ":n+=" validate.errors = null; return true; ":n+=" var "+I+" = true; ";return e.isTop&&(n+=" }; return validate; "),n}if(e.isTop){var T=e.isTop,u=e.level=0,p=e.dataLevel=0,f="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var E="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}n+=" var vErrors = null; ",n+=" var errors = 0; ",n+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,p=e.dataLevel,f="data"+(p||"");if(s&&(e.baseId=e.resolve.url(e.baseId,s)),i&&!e.async)throw new Error("async schema in sync schema");n+=" var errs_"+u+" = errors;"}var I="valid"+u,D=!e.opts.allErrors,C="",M="",F,R=e.schema.type,G=Array.isArray(R);if(R&&e.opts.nullable&&e.schema.nullable===!0&&(G?R.indexOf("null")==-1&&(R=R.concat("null")):R!="null"&&(R=[R,"null"],G=!0)),G&&R.length==1&&(R=R[0],G=!1),e.schema.$ref&&o){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(o=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(n+=" "+e.RULES.all.$comment.code(e,"$comment")),R){if(e.opts.coerceTypes)var z=e.util.coerceToTypes(e.opts.coerceTypes,R);var O=e.RULES.types[R];if(z||G||O===!0||O&&!qe(O)){var d=e.schemaPath+".type",g=e.errSchemaPath+"/type",d=e.schemaPath+".type",g=e.errSchemaPath+"/type",x=G?"checkDataTypes":"checkDataType";if(n+=" if ("+e.util[x](R,f,e.opts.strictNumbers,!0)+") { ",z){var A="dataType"+u,B="coerced"+u;n+=" var "+A+" = typeof "+f+"; var "+B+" = undefined; ",e.opts.coerceTypes=="array"&&(n+=" if ("+A+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+A+" = typeof "+f+"; if ("+e.util.checkDataType(e.schema.type,f,e.opts.strictNumbers)+") "+B+" = "+f+"; } "),n+=" if ("+B+" !== undefined) ; ";var X=z;if(X)for(var K,Q=-1,Z=X.length-1;Q<Z;)K=X[Q+=1],K=="string"?n+=" else if ("+A+" == 'number' || "+A+" == 'boolean') "+B+" = '' + "+f+"; else if ("+f+" === null) "+B+" = ''; ":K=="number"||K=="integer"?(n+=" else if ("+A+" == 'boolean' || "+f+" === null || ("+A+" == 'string' && "+f+" && "+f+" == +"+f+" ",K=="integer"&&(n+=" && !("+f+" % 1)"),n+=")) "+B+" = +"+f+"; "):K=="boolean"?n+=" else if ("+f+" === 'false' || "+f+" === 0 || "+f+" === null) "+B+" = false; else if ("+f+" === 'true' || "+f+" === 1) "+B+" = true; ":K=="null"?n+=" else if ("+f+" === '' || "+f+" === 0 || "+f+" === false) "+B+" = null; ":e.opts.coerceTypes=="array"&&K=="array"&&(n+=" else if ("+A+" == 'string' || "+A+" == 'number' || "+A+" == 'boolean' || "+f+" == null) "+B+" = ["+f+"]; ");n+=" else { ";var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(F||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",G?n+=""+R.join(","):n+=""+R,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",G?n+=""+R.join(","):n+=""+R,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var v=n;n=y.pop(),!e.compositeRule&&D?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } if ("+B+" !== undefined) { ";var _=p?"data"+(p-1||""):"parentData",fe=p?e.dataPathArr[p]:"parentDataProperty";n+=" "+f+" = "+B+"; ",p||(n+="if ("+_+" !== undefined)"),n+=" "+_+"["+fe+"] = "+B+"; } "}else{var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(F||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",G?n+=""+R.join(","):n+=""+R,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",G?n+=""+R.join(","):n+=""+R,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var v=n;n=y.pop(),!e.compositeRule&&D?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}n+=" } "}}if(e.schema.$ref&&!o)n+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",D&&(n+=" } if (errors === ",T?n+="0":n+="errs_"+u,n+=") { ",M+="}");else{var Ie=e.RULES;if(Ie){for(var O,S=-1,ne=Ie.length-1;S<ne;)if(O=Ie[S+=1],qe(O)){if(O.type&&(n+=" if ("+e.util.checkDataType(O.type,f,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(O.type=="object"&&e.schema.properties){var m=e.schema.properties,Te=Object.keys(m),Be=Te;if(Be)for(var We,Re=-1,ut=Be.length-1;Re<ut;){We=Be[Re+=1];var Se=m[We];if(Se.default!==void 0){var Ce=f+e.util.getProperty(We);if(e.compositeRule){if(e.opts.strictDefaults){var E="default is ignored for: "+Ce;if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}}else n+=" if ("+Ce+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+Ce+" === null || "+Ce+" === '' "),n+=" ) "+Ce+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(Se.default)+" ":n+=" "+JSON.stringify(Se.default)+" ",n+="; "}}}else if(O.type=="array"&&Array.isArray(e.schema.items)){var gt=e.schema.items;if(gt){for(var Se,Q=-1,je=gt.length-1;Q<je;)if(Se=gt[Q+=1],Se.default!==void 0){var Ce=f+"["+Q+"]";if(e.compositeRule){if(e.opts.strictDefaults){var E="default is ignored for: "+Ce;if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}}else n+=" if ("+Ce+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+Ce+" === null || "+Ce+" === '' "),n+=" ) "+Ce+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(Se.default)+" ":n+=" "+JSON.stringify(Se.default)+" ",n+="; "}}}}var ye=O.rules;if(ye){for(var Wt,Pt=-1,cr=ye.length-1;Pt<cr;)if(Wt=ye[Pt+=1],ft(Wt)){var Qt=Wt.code(e,Wt.keyword,O.type);Qt&&(n+=" "+Qt+" ",D&&(C+="}"))}}if(D&&(n+=" "+C+" ",C=""),O.type&&(n+=" } ",R&&R===O.type&&!z)){n+=" else { ";var d=e.schemaPath+".type",g=e.errSchemaPath+"/type",y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(F||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",G?n+=""+R.join(","):n+=""+R,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",G?n+=""+R.join(","):n+=""+R,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var v=n;n=y.pop(),!e.compositeRule&&D?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } "}D&&(n+=" if (errors === ",T?n+="0":n+="errs_"+u,n+=") { ",M+="}")}}}D&&(n+=" "+M+" "),T?(i?(n+=" if (errors === 0) return data; ",n+=" else throw new ValidationError(vErrors); "):(n+=" validate.errors = vErrors; ",n+=" return errors === 0; "),n+=" }; return validate;"):n+=" var "+I+" = errors === errs_"+u+";";function qe(Qe){for(var Dt=Qe.rules,dt=0;dt<Dt.length;dt++)if(ft(Dt[dt]))return!0}function ft(Qe){return e.schema[Qe.keyword]!==void 0||Qe.implements&&at(Qe)}function at(Qe){for(var Dt=Qe.implements,dt=0;dt<Dt.length;dt++)if(e.schema[Dt[dt]]!==void 0)return!0}return n}});var tp=te((FA,ep)=>{"use strict";var Xi=Ki(),Zi=mn(),Jd=$i(),D_=vl(),Zd=_l(),N_=Zi.ucs2length,O_=zi(),L_=Jd.Validation;ep.exports=Sl;function Sl(r,e,t,a){var n=this,i=this._opts,o=[void 0],s={},l=[],c={},u=[],p={},m=[];e=e||{schema:r,refVal:o,refs:s};var d=M_.call(this,r,e,a),g=this._compilations[d.index];if(d.compiling)return g.callValidate=E;var f=this._formats,y=this.RULES;try{var v=I(r,e,t,a);g.validate=v;var T=g.callValidate;return T&&(T.schema=v.schema,T.errors=null,T.refs=v.refs,T.refVal=v.refVal,T.root=v.root,T.$async=v.$async,i.sourceCode&&(T.source=v.source)),v}finally{F_.call(this,r,e,a)}function E(){var x=g.validate,A=x.apply(this,arguments);return E.errors=x.errors,A}function I(x,A,B,X){var K=!A||A&&A.schema==x;if(A.schema!=e.schema)return Sl.call(n,x,A,B,X);var Q=x.$async===!0,Z=Zd({isTop:!0,schema:x,isRoot:K,baseId:X,root:A,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Jd.MissingRef,RULES:y,validate:Zd,util:Zi,resolve:Xi,resolveRef:D,usePattern:G,useDefault:z,useCustomRule:O,opts:i,formats:f,logger:n.logger,self:n});Z=Yi(o,z_)+Yi(l,B_)+Yi(u,G_)+Yi(m,U_)+Z,i.processCode&&(Z=i.processCode(Z,x));var _;try{var fe=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Z);_=fe(n,y,f,e,o,u,m,O_,N_,L_),o[0]=_}catch(Ie){throw n.logger.error("Error compiling schema, function code:",Z),Ie}return _.schema=x,_.errors=null,_.refs=s,_.refVal=o,_.root=K?_:A,Q&&(_.$async=!0),i.sourceCode===!0&&(_.source={code:Z,patterns:l,defaults:u}),_}function D(x,A,B){A=Xi.url(x,A);var X=s[A],K,Q;if(X!==void 0)return K=o[X],Q="refVal["+X+"]",R(K,Q);if(!B&&e.refs){var Z=e.refs[A];if(Z!==void 0)return K=e.refVal[Z],Q=C(A,K),R(K,Q)}Q=C(A);var _=Xi.call(n,I,e,A);if(_===void 0){var fe=t&&t[A];fe&&(_=Xi.inlineRef(fe,i.inlineRefs)?fe:Sl.call(n,fe,e,t,x))}if(_===void 0)M(A);else return F(A,_),R(_,Q)}function C(x,A){var B=o.length;return o[B]=A,s[x]=B,"refVal"+B}function M(x){delete s[x]}function F(x,A){var B=s[x];o[B]=A}function R(x,A){return typeof x=="object"||typeof x=="boolean"?{code:A,schema:x,inline:!0}:{code:A,$async:x&&!!x.$async}}function G(x){var A=c[x];return A===void 0&&(A=c[x]=l.length,l[A]=x),"pattern"+A}function z(x){switch(typeof x){case"boolean":case"number":return""+x;case"string":return Zi.toQuotedString(x);case"object":if(x===null)return"null";var A=D_(x),B=p[A];return B===void 0&&(B=p[A]=u.length,u[B]=x),"default"+B}}function O(x,A,B,X){if(n._opts.validateSchema!==!1){var K=x.definition.dependencies;if(K&&!K.every(function(Be){return Object.prototype.hasOwnProperty.call(B,Be)}))throw new Error("parent schema must have all required keywords: "+K.join(","));var Q=x.definition.validateSchema;if(Q){var Z=Q(A);if(!Z){var _="keyword schema is invalid: "+n.errorsText(Q.errors);if(n._opts.validateSchema=="log")n.logger.error(_);else throw new Error(_)}}}var fe=x.definition.compile,Ie=x.definition.inline,S=x.definition.macro,ne;if(fe)ne=fe.call(n,A,B,X);else if(S)ne=S.call(n,A,B,X),i.validateSchema!==!1&&n.validateSchema(ne,!0);else if(Ie)ne=Ie.call(n,X,x.keyword,A,B);else if(ne=x.definition.validate,!ne)return;if(ne===void 0)throw new Error('custom keyword "'+x.keyword+'"failed to compile');var Te=m.length;return m[Te]=ne,{code:"customRule"+Te,validate:ne}}}function M_(r,e,t){var a=Qd.call(this,r,e,t);return a>=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:r,root:e,baseId:t},{index:a,compiling:!1})}function F_(r,e,t){var a=Qd.call(this,r,e,t);a>=0&&this._compilations.splice(a,1)}function Qd(r,e,t){for(var a=0;a<this._compilations.length;a++){var n=this._compilations[a];if(n.schema==r&&n.root==e&&n.baseId==t)return a}return-1}function B_(r,e){return"var pattern"+r+" = new RegExp("+Zi.toQuotedString(e[r])+");"}function G_(r){return"var default"+r+" = defaults["+r+"];"}function z_(r,e){return e[r]===void 0?"":"var refVal"+r+" = refVal["+r+"];"}function U_(r){return"var customRule"+r+" = customRules["+r+"];"}function Yi(r,e){if(!r.length)return"";for(var t="",a=0;a<r.length;a++)t+=e(a,r);return t}});var np=te((BA,rp)=>{"use strict";var Ji=rp.exports=function(){this._cache={}};Ji.prototype.put=function(e,t){this._cache[e]=t};Ji.prototype.get=function(e){return this._cache[e]};Ji.prototype.del=function(e){delete this._cache[e]};Ji.prototype.clear=function(){this._cache={}}});var gp=te((GA,hp)=>{"use strict";var H_=mn(),V_=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,W_=[0,31,28,31,30,31,30,31,31,30,31,30,31],j_=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,ap=/^(?=.{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,q_=/^(?:[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,K_=/^(?:[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,ip=/^(?:(?:[^\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,op=/^(?:(?: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,sp=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,lp=/^(?:\/(?:[^~/]|~0|~1)*)*$/,cp=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,up=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;hp.exports=Qi;function Qi(r){return r=r=="full"?"full":"fast",H_.copy(Qi[r])}Qi.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":ip,url:op,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:ap,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:mp,uuid:sp,"json-pointer":lp,"json-pointer-uri-fragment":cp,"relative-json-pointer":up};Qi.full={date:dp,time:pp,"date-time":Y_,uri:J_,"uri-reference":K_,"uri-template":ip,url:op,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:ap,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:mp,uuid:sp,"json-pointer":lp,"json-pointer-uri-fragment":cp,"relative-json-pointer":up};function $_(r){return r%4===0&&(r%100!==0||r%400===0)}function dp(r){var e=r.match(V_);if(!e)return!1;var t=+e[1],a=+e[2],n=+e[3];return a>=1&&a<=12&&n>=1&&n<=(a==2&&$_(t)?29:W_[a])}function pp(r,e){var t=r.match(j_);if(!t)return!1;var a=t[1],n=t[2],i=t[3],o=t[5];return(a<=23&&n<=59&&i<=59||a==23&&n==59&&i==60)&&(!e||o)}var X_=/t|\s/i;function Y_(r){var e=r.split(X_);return e.length==2&&dp(e[0])&&pp(e[1],!0)}var Z_=/\/|:/;function J_(r){return Z_.test(r)&&q_.test(r)}var Q_=/[^\\]\\Z/;function mp(r){if(Q_.test(r))return!1;try{return new RegExp(r),!0}catch{return!1}}});var yp=te((zA,fp)=>{"use strict";fp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(o||""),p="valid"+i,m,d;if(s=="#"||s=="#/")e.isRoot?(m=e.async,d="validate"):(m=e.root.schema.$async===!0,d="root.refVal[0]");else{var g=e.resolveRef(e.baseId,s,e.isRoot);if(g===void 0){var f=e.MissingRefError.message(e.baseId,s);if(e.opts.missingRefs=="fail"){e.logger.error(f);var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(s)+"' } ",e.opts.messages!==!1&&(n+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(s)+"' "),e.opts.verbose&&(n+=" , schema: "+e.util.toQuotedString(s)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),n+=" } "):n+=" {} ";var v=n;n=y.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(n+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(f),c&&(n+=" if (true) { ");else throw new e.MissingRefError(e.baseId,s,f)}else if(g.inline){var T=e.util.copy(e);T.level++;var E="valid"+T.level;T.schema=g.schema,T.schemaPath="",T.errSchemaPath=s;var I=e.validate(T).replace(/validate\.schema/g,g.code);n+=" "+I+" ",c&&(n+=" if ("+E+") { ")}else m=g.$async===!0||e.async&&g.$async!==!1,d=g.code}if(d){var y=y||[];y.push(n),n="",e.opts.passContext?n+=" "+d+".call(this, ":n+=" "+d+"( ",n+=" "+u+", (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var D=o?"data"+(o-1||""):"parentData",C=o?e.dataPathArr[o]:"parentDataProperty";n+=" , "+D+" , "+C+", rootData) ";var M=n;if(n=y.pop(),m){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(n+=" var "+p+"; "),n+=" try { await "+M+"; ",c&&(n+=" "+p+" = true; "),n+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(n+=" "+p+" = false; "),n+=" } ",c&&(n+=" if ("+p+") { ")}else n+=" if (!"+M+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",c&&(n+=" else { ")}return n}});var vp=te((UA,bp)=>{"use strict";bp.exports=function(e,t,a){var n=" ",i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),s=e.errSchemaPath+"/"+t,l=!e.opts.allErrors,c=e.util.copy(e),u="";c.level++;var p="valid"+c.level,m=c.baseId,d=!0,g=i;if(g)for(var f,y=-1,v=g.length-1;y<v;)f=g[y+=1],(e.opts.strictKeywords?typeof f=="object"&&Object.keys(f).length>0||f===!1:e.util.schemaHasRules(f,e.RULES.all))&&(d=!1,c.schema=f,c.schemaPath=o+"["+y+"]",c.errSchemaPath=s+"/"+y,n+=" "+e.validate(c)+" ",c.baseId=m,l&&(n+=" if ("+p+") { ",u+="}"));return l&&(d?n+=" if (true) { ":n+=" "+u.slice(0,-1)+" "),n}});var Sp=te((HA,_p)=>{"use strict";_p.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,v=s.every(function(F){return e.opts.strictKeywords?typeof F=="object"&&Object.keys(F).length>0||F===!1:e.util.schemaHasRules(F,e.RULES.all)});if(v){var T=g.baseId;n+=" var "+d+" = errors; var "+m+" = false; ";var E=e.compositeRule;e.compositeRule=g.compositeRule=!0;var I=s;if(I)for(var D,C=-1,M=I.length-1;C<M;)D=I[C+=1],g.schema=D,g.schemaPath=l+"["+C+"]",g.errSchemaPath=c+"/"+C,n+=" "+e.validate(g)+" ",g.baseId=T,n+=" "+m+" = "+m+" || "+y+"; if (!"+m+") { ",f+="}";e.compositeRule=g.compositeRule=E,n+=" "+f+" if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else u&&(n+=" if (true) { ");return n}});var wp=te((VA,Ep)=>{"use strict";Ep.exports=function(e,t,a){var n=" ",i=e.schema[t],o=e.errSchemaPath+"/"+t,s=!e.opts.allErrors,l=e.util.toQuotedString(i);return e.opts.$comment===!0?n+=" console.log("+l+");":typeof e.opts.$comment=="function"&&(n+=" self._opts.$comment("+l+", "+e.util.toQuotedString(o)+", validate.root.schema);"),n}});var kp=te((WA,Cp)=>{"use strict";Cp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d=e.opts.$data&&s&&s.$data,g;d?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",g="schema"+i):g=s,d||(n+=" var schema"+i+" = validate.schema"+l+";"),n+="var "+m+" = equal("+p+", schema"+i+"); if (!"+m+") { ";var f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be equal to constant' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;return n=f.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",u&&(n+=" else { "),n}});var xp=te((jA,Tp)=>{"use strict";Tp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,v="i"+i,T=g.dataLevel=e.dataLevel+1,E="data"+T,I=e.baseId,D=e.opts.strictKeywords?typeof s=="object"&&Object.keys(s).length>0||s===!1:e.util.schemaHasRules(s,e.RULES.all);if(n+="var "+d+" = errors;var "+m+";",D){var C=e.compositeRule;e.compositeRule=g.compositeRule=!0,g.schema=s,g.schemaPath=l,g.errSchemaPath=c,n+=" var "+y+" = false; for (var "+v+" = 0; "+v+" < "+p+".length; "+v+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var M=p+"["+v+"]";g.dataPathArr[T]=v;var F=e.validate(g);g.baseId=I,e.util.varOccurences(F,E)<2?n+=" "+e.util.varReplace(F,E,M)+" ":n+=" var "+E+" = "+M+"; "+F+" ",n+=" if ("+y+") break; } ",e.compositeRule=g.compositeRule=C,n+=" "+f+" if (!"+y+") {"}else n+=" if ("+p+".length == 0) {";var R=R||[];R.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should contain a valid item' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var G=n;return n=R.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+G+"]); ":n+=" validate.errors = ["+G+"]; return false; ":n+=" var err = "+G+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { ",D&&(n+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(n+=" } "),n}});var Ip=te((qA,Ap)=>{"use strict";Ap.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="errs__"+i,d=e.util.copy(e),g="";d.level++;var f="valid"+d.level,y={},v={},T=e.opts.ownProperties;for(C in s)if(C!="__proto__"){var E=s[C],I=Array.isArray(E)?v:y;I[C]=E}n+="var "+m+" = errors;";var D=e.errorPath;n+="var missing"+i+";";for(var C in v)if(I=v[C],I.length){if(n+=" if ( "+p+e.util.getProperty(C)+" !== undefined ",T&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(C)+"') "),u){n+=" && ( ";var M=I;if(M)for(var F,R=-1,G=M.length-1;R<G;){F=M[R+=1],R&&(n+=" || ");var z=e.util.getProperty(F),O=p+z;n+=" ( ( "+O+" === undefined ",T&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(F)+"') "),n+=") && (missing"+i+" = "+e.util.toQuotedString(e.opts.jsonPointers?F:z)+") ) "}n+=")) { ";var x="missing"+i,A="' + "+x+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(D,x,!0):D+" + "+x);var B=B||[];B.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(C)+"', missingProperty: '"+A+"', depsCount: "+I.length+", deps: '"+e.util.escapeQuotes(I.length==1?I[0]:I.join(", "))+"' } ",e.opts.messages!==!1&&(n+=" , message: 'should have ",I.length==1?n+="property "+e.util.escapeQuotes(I[0]):n+="properties "+e.util.escapeQuotes(I.join(", ")),n+=" when property "+e.util.escapeQuotes(C)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var X=n;n=B.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+X+"]); ":n+=" validate.errors = ["+X+"]; return false; ":n+=" var err = "+X+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{n+=" ) { ";var K=I;if(K)for(var F,Q=-1,Z=K.length-1;Q<Z;){F=K[Q+=1];var z=e.util.getProperty(F),A=e.util.escapeQuotes(F),O=p+z;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(D,F,e.opts.jsonPointers)),n+=" if ( "+O+" === undefined ",T&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(F)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(C)+"', missingProperty: '"+A+"', depsCount: "+I.length+", deps: '"+e.util.escapeQuotes(I.length==1?I[0]:I.join(", "))+"' } ",e.opts.messages!==!1&&(n+=" , message: 'should have ",I.length==1?n+="property "+e.util.escapeQuotes(I[0]):n+="properties "+e.util.escapeQuotes(I.join(", ")),n+=" when property "+e.util.escapeQuotes(C)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}n+=" } ",u&&(g+="}",n+=" else { ")}e.errorPath=D;var _=d.baseId;for(var C in y){var E=y[C];(e.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===!1:e.util.schemaHasRules(E,e.RULES.all))&&(n+=" "+f+" = true; if ( "+p+e.util.getProperty(C)+" !== undefined ",T&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(C)+"') "),n+=") { ",d.schema=E,d.schemaPath=l+e.util.getProperty(C),d.errSchemaPath=c+"/"+e.util.escapeFragment(C),n+=" "+e.validate(d)+" ",d.baseId=_,n+=" } ",u&&(n+=" if ("+f+") { ",g+="}"))}return u&&(n+=" "+g+" if ("+m+" == errors) {"),n}});var Pp=te((KA,Rp)=>{"use strict";Rp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d=e.opts.$data&&s&&s.$data,g;d?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",g="schema"+i):g=s;var f="i"+i,y="schema"+i;d||(n+=" var "+y+" = validate.schema"+l+";"),n+="var "+m+";",d&&(n+=" if (schema"+i+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+i+")) "+m+" = false; else {"),n+=""+m+" = false;for (var "+f+"=0; "+f+"<"+y+".length; "+f+"++) if (equal("+p+", "+y+"["+f+"])) { "+m+" = true; break; }",d&&(n+=" } "),n+=" if (!"+m+") { ";var v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var T=n;return n=v.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+T+"]); ":n+=" validate.errors = ["+T+"]; return false; ":n+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",u&&(n+=" else { "),n}});var Np=te(($A,Dp)=>{"use strict";Dp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||"");if(e.opts.format===!1)return u&&(n+=" if (true) { "),n;var m=e.opts.$data&&s&&s.$data,d;m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s;var g=e.opts.unknownFormats,f=Array.isArray(g);if(m){var y="format"+i,v="isObject"+i,T="formatType"+i;n+=" var "+y+" = formats["+d+"]; var "+v+" = typeof "+y+" == 'object' && !("+y+" instanceof RegExp) && "+y+".validate; var "+T+" = "+v+" && "+y+".type || 'string'; if ("+v+") { ",e.async&&(n+=" var async"+i+" = "+y+".async; "),n+=" "+y+" = "+y+".validate; } if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),n+=" (",g!="ignore"&&(n+=" ("+d+" && !"+y+" ",f&&(n+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),n+=") || "),n+=" ("+y+" && "+T+" == '"+a+"' && !(typeof "+y+" == 'function' ? ",e.async?n+=" (async"+i+" ? await "+y+"("+p+") : "+y+"("+p+")) ":n+=" "+y+"("+p+") ",n+=" : "+y+".test("+p+"))))) {"}else{var y=e.formats[s];if(!y){if(g=="ignore")return e.logger.warn('unknown format "'+s+'" ignored in schema at path "'+e.errSchemaPath+'"'),u&&(n+=" if (true) { "),n;if(f&&g.indexOf(s)>=0)return u&&(n+=" if (true) { "),n;throw new Error('unknown format "'+s+'" is used in schema at path "'+e.errSchemaPath+'"')}var v=typeof y=="object"&&!(y instanceof RegExp)&&y.validate,T=v&&y.type||"string";if(v){var E=y.async===!0;y=y.validate}if(T!=a)return u&&(n+=" if (true) { "),n;if(E){if(!e.async)throw new Error("async format in sync schema");var I="formats"+e.util.getProperty(s)+".validate";n+=" if (!(await "+I+"("+p+"))) { "}else{n+=" if (! ";var I="formats"+e.util.getProperty(s);v&&(I+=".validate"),typeof y=="function"?n+=" "+I+"("+p+") ":n+=" "+I+".test("+p+") ",n+=") { "}}var D=D||[];D.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",m?n+=""+d:n+=""+e.util.toQuotedString(s),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match format "`,m?n+="' + "+d+" + '":n+=""+e.util.escapeQuotes(s),n+=`"' `),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+e.util.toQuotedString(s),n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var C=n;return n=D.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+C+"]); ":n+=" validate.errors = ["+C+"]; return false; ":n+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u&&(n+=" else { "),n}});var Lp=te((XA,Op)=>{"use strict";Op.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e);g.level++;var f="valid"+g.level,y=e.schema.then,v=e.schema.else,T=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),E=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),I=g.baseId;if(T||E){var D;g.createErrors=!1,g.schema=s,g.schemaPath=l,g.errSchemaPath=c,n+=" var "+d+" = errors; var "+m+" = true; ";var C=e.compositeRule;e.compositeRule=g.compositeRule=!0,n+=" "+e.validate(g)+" ",g.baseId=I,g.createErrors=!0,n+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=g.compositeRule=C,T?(n+=" if ("+f+") { ",g.schema=e.schema.then,g.schemaPath=e.schemaPath+".then",g.errSchemaPath=e.errSchemaPath+"/then",n+=" "+e.validate(g)+" ",g.baseId=I,n+=" "+m+" = "+f+"; ",T&&E?(D="ifClause"+i,n+=" var "+D+" = 'then'; "):D="'then'",n+=" } ",E&&(n+=" else { ")):n+=" if (!"+f+") { ",E&&(g.schema=e.schema.else,g.schemaPath=e.schemaPath+".else",g.errSchemaPath=e.errSchemaPath+"/else",n+=" "+e.validate(g)+" ",g.baseId=I,n+=" "+m+" = "+f+"; ",T&&E?(D="ifClause"+i,n+=" var "+D+" = 'else'; "):D="'else'",n+=" } "),n+=" if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+D+" } ",e.opts.messages!==!1&&(n+=` , message: 'should match "' + `+D+` + '" schema' `),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } ",u&&(n+=" else { ")}else u&&(n+=" if (true) { ");return n}});var Fp=te((YA,Mp)=>{"use strict";Mp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,v="i"+i,T=g.dataLevel=e.dataLevel+1,E="data"+T,I=e.baseId;if(n+="var "+d+" = errors;var "+m+";",Array.isArray(s)){var D=e.schema.additionalItems;if(D===!1){n+=" "+m+" = "+p+".length <= "+s.length+"; ";var C=c;c=e.errSchemaPath+"/additionalItems",n+=" if (!"+m+") { ";var M=M||[];M.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+s.length+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have more than "+s.length+" items' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var F=n;n=M.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+F+"]); ":n+=" validate.errors = ["+F+"]; return false; ":n+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",c=C,u&&(f+="}",n+=" else { ")}var R=s;if(R){for(var G,z=-1,O=R.length-1;z<O;)if(G=R[z+=1],e.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:e.util.schemaHasRules(G,e.RULES.all)){n+=" "+y+" = true; if ("+p+".length > "+z+") { ";var x=p+"["+z+"]";g.schema=G,g.schemaPath=l+"["+z+"]",g.errSchemaPath=c+"/"+z,g.errorPath=e.util.getPathExpr(e.errorPath,z,e.opts.jsonPointers,!0),g.dataPathArr[T]=z;var A=e.validate(g);g.baseId=I,e.util.varOccurences(A,E)<2?n+=" "+e.util.varReplace(A,E,x)+" ":n+=" var "+E+" = "+x+"; "+A+" ",n+=" } ",u&&(n+=" if ("+y+") { ",f+="}")}}if(typeof D=="object"&&(e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all))){g.schema=D,g.schemaPath=e.schemaPath+".additionalItems",g.errSchemaPath=e.errSchemaPath+"/additionalItems",n+=" "+y+" = true; if ("+p+".length > "+s.length+") { for (var "+v+" = "+s.length+"; "+v+" < "+p+".length; "+v+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var x=p+"["+v+"]";g.dataPathArr[T]=v;var A=e.validate(g);g.baseId=I,e.util.varOccurences(A,E)<2?n+=" "+e.util.varReplace(A,E,x)+" ":n+=" var "+E+" = "+x+"; "+A+" ",u&&(n+=" if (!"+y+") break; "),n+=" } } ",u&&(n+=" if ("+y+") { ",f+="}")}}else if(e.opts.strictKeywords?typeof s=="object"&&Object.keys(s).length>0||s===!1:e.util.schemaHasRules(s,e.RULES.all)){g.schema=s,g.schemaPath=l,g.errSchemaPath=c,n+=" for (var "+v+" = 0; "+v+" < "+p+".length; "+v+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var x=p+"["+v+"]";g.dataPathArr[T]=v;var A=e.validate(g);g.baseId=I,e.util.varOccurences(A,E)<2?n+=" "+e.util.varReplace(A,E,x)+" ":n+=" var "+E+" = "+x+"; "+A+" ",u&&(n+=" if (!"+y+") break; "),n+=" }"}return u&&(n+=" "+f+" if ("+d+" == errors) {"),n}});var El=te((ZA,Bp)=>{"use strict";Bp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,I,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s;var g=t=="maximum",f=g?"exclusiveMaximum":"exclusiveMinimum",y=e.schema[f],v=e.opts.$data&&y&&y.$data,T=g?"<":">",E=g?">":"<",I=void 0;if(!(m||typeof s=="number"||s===void 0))throw new Error(t+" must be number");if(!(v||y===void 0||typeof y=="number"||typeof y=="boolean"))throw new Error(f+" must be number or boolean");if(v){var D=e.util.getData(y.$data,o,e.dataPathArr),C="exclusive"+i,M="exclType"+i,F="exclIsNumber"+i,R="op"+i,G="' + "+R+" + '";n+=" var schemaExcl"+i+" = "+D+"; ",D="schemaExcl"+i,n+=" var "+C+"; var "+M+" = typeof "+D+"; if ("+M+" != 'boolean' && "+M+" != 'undefined' && "+M+" != 'number') { ";var I=f,z=z||[];z.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(I||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: '"+f+" should be boolean' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var O=n;n=z.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+O+"]); ":n+=" validate.errors = ["+O+"]; return false; ":n+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" "+M+" == 'number' ? ( ("+C+" = "+d+" === undefined || "+D+" "+T+"= "+d+") ? "+p+" "+E+"= "+D+" : "+p+" "+E+" "+d+" ) : ( ("+C+" = "+D+" === true) ? "+p+" "+E+"= "+d+" : "+p+" "+E+" "+d+" ) || "+p+" !== "+p+") { var op"+i+" = "+C+" ? '"+T+"' : '"+T+"='; ",s===void 0&&(I=f,c=e.errSchemaPath+"/"+f,d=D,m=v)}else{var F=typeof y=="number",G=T;if(F&&m){var R="'"+G+"'";n+=" if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" ( "+d+" === undefined || "+y+" "+T+"= "+d+" ? "+p+" "+E+"= "+y+" : "+p+" "+E+" "+d+" ) || "+p+" !== "+p+") { "}else{F&&s===void 0?(C=!0,I=f,c=e.errSchemaPath+"/"+f,d=y,E+="="):(F&&(d=Math[g?"min":"max"](y,s)),y===(F?d:!0)?(C=!0,I=f,c=e.errSchemaPath+"/"+f,E+="="):(C=!1,G+="="));var R="'"+G+"'";n+=" if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" "+p+" "+E+" "+d+" || "+p+" !== "+p+") { "}}I=I||t;var z=z||[];z.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(I||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+R+", limit: "+d+", exclusive: "+C+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be "+G+" ",m?n+="' + "+d:n+=""+d+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var O=n;return n=z.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+O+"]); ":n+=" validate.errors = ["+O+"]; return false; ":n+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u&&(n+=" else { "),n}});var wl=te((JA,Gp)=>{"use strict";Gp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s,!(m||typeof s=="number"))throw new Error(t+" must be number");var g=t=="maxItems"?">":"<";n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" "+p+".length "+g+" "+d+") { ";var f=t,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",t=="maxItems"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+d+" + '":n+=""+s,n+=" items' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var v=n;return n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Cl=te((QA,zp)=>{"use strict";zp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s,!(m||typeof s=="number"))throw new Error(t+" must be number");var g=t=="maxLength"?">":"<";n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?n+=" "+p+".length ":n+=" ucs2length("+p+") ",n+=" "+g+" "+d+") { ";var f=t,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be ",t=="maxLength"?n+="longer":n+="shorter",n+=" than ",m?n+="' + "+d+" + '":n+=""+s,n+=" characters' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var v=n;return n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var kl=te((eI,Up)=>{"use strict";Up.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s,!(m||typeof s=="number"))throw new Error(t+" must be number");var g=t=="maxProperties"?">":"<";n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" Object.keys("+p+").length "+g+" "+d+") { ";var f=t,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",t=="maxProperties"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+d+" + '":n+=""+s,n+=" properties' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var v=n;return n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Vp=te((tI,Hp)=>{"use strict";Hp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s,!(m||typeof s=="number"))throw new Error(t+" must be number");n+="var division"+i+";if (",m&&(n+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),n+=" (division"+i+" = "+p+" / "+d+", ",e.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+i+") - division"+i+") > 1e-"+e.opts.multipleOfPrecision+" ":n+=" division"+i+" !== parseInt(division"+i+") ",n+=" ) ",m&&(n+=" ) "),n+=" ) { ";var g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",m?n+="' + "+d:n+=""+d+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var f=n;return n=g.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+f+"]); ":n+=" validate.errors = ["+f+"]; return false; ":n+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var jp=te((rI,Wp)=>{"use strict";Wp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="errs__"+i,d=e.util.copy(e);d.level++;var g="valid"+d.level;if(e.opts.strictKeywords?typeof s=="object"&&Object.keys(s).length>0||s===!1:e.util.schemaHasRules(s,e.RULES.all)){d.schema=s,d.schemaPath=l,d.errSchemaPath=c,n+=" var "+m+" = errors; ";var f=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var y;d.opts.allErrors&&(y=d.opts.allErrors,d.opts.allErrors=!1),n+=" "+e.validate(d)+" ",d.createErrors=!0,y&&(d.opts.allErrors=y),e.compositeRule=d.compositeRule=f,n+=" if ("+g+") { ";var v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var T=n;n=v.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+T+"]); ":n+=" validate.errors = ["+T+"]; return false; ":n+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(n+=" if (false) { ");return n}});var Kp=te((nI,qp)=>{"use strict";qp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,v=g.baseId,T="prevValid"+i,E="passingSchemas"+i;n+="var "+d+" = errors , "+T+" = false , "+m+" = false , "+E+" = null; ";var I=e.compositeRule;e.compositeRule=g.compositeRule=!0;var D=s;if(D)for(var C,M=-1,F=D.length-1;M<F;)C=D[M+=1],(e.opts.strictKeywords?typeof C=="object"&&Object.keys(C).length>0||C===!1:e.util.schemaHasRules(C,e.RULES.all))?(g.schema=C,g.schemaPath=l+"["+M+"]",g.errSchemaPath=c+"/"+M,n+=" "+e.validate(g)+" ",g.baseId=v):n+=" var "+y+" = true; ",M&&(n+=" if ("+y+" && "+T+") { "+m+" = false; "+E+" = ["+E+", "+M+"]; } else { ",f+="}"),n+=" if ("+y+") { "+m+" = "+T+" = true; "+E+" = "+M+"; }";return e.compositeRule=g.compositeRule=I,n+=""+f+"if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+E+" } ",e.opts.messages!==!1&&(n+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(n+=" } "),n}});var Xp=te((aI,$p)=>{"use strict";$p.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s;var g=m?"(new RegExp("+d+"))":e.usePattern(s);n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),n+=" !"+g+".test("+p+") ) { ";var f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",m?n+=""+d:n+=""+e.util.toQuotedString(s),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,m?n+="' + "+d+" + '":n+=""+e.util.escapeQuotes(s),n+=`"' `),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+e.util.toQuotedString(s),n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;return n=f.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Zp=te((iI,Yp)=>{"use strict";Yp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="errs__"+i,d=e.util.copy(e),g="";d.level++;var f="valid"+d.level,y="key"+i,v="idx"+i,T=d.dataLevel=e.dataLevel+1,E="data"+T,I="dataProperties"+i,D=Object.keys(s||{}).filter(Q),C=e.schema.patternProperties||{},M=Object.keys(C).filter(Q),F=e.schema.additionalProperties,R=D.length||M.length,G=F===!1,z=typeof F=="object"&&Object.keys(F).length,O=e.opts.removeAdditional,x=G||z||O,A=e.opts.ownProperties,B=e.baseId,X=e.schema.required;if(X&&!(e.opts.$data&&X.$data)&&X.length<e.opts.loopRequired)var K=e.util.toHash(X);function Q(J){return J!=="__proto__"}if(n+="var "+m+" = errors;var "+f+" = true;",A&&(n+=" var "+I+" = undefined;"),x){if(A?n+=" "+I+" = "+I+" || Object.keys("+p+"); for (var "+v+"=0; "+v+"<"+I+".length; "+v+"++) { var "+y+" = "+I+"["+v+"]; ":n+=" for (var "+y+" in "+p+") { ",R){if(n+=" var isAdditional"+i+" = !(false ",D.length)if(D.length>8)n+=" || validate.schema"+l+".hasOwnProperty("+y+") ";else{var Z=D;if(Z)for(var _,fe=-1,Ie=Z.length-1;fe<Ie;)_=Z[fe+=1],n+=" || "+y+" == "+e.util.toQuotedString(_)+" "}if(M.length){var S=M;if(S)for(var ne,Te=-1,Be=S.length-1;Te<Be;)ne=S[Te+=1],n+=" || "+e.usePattern(ne)+".test("+y+") "}n+=" ); if (isAdditional"+i+") { "}if(O=="all")n+=" delete "+p+"["+y+"]; ";else{var We=e.errorPath,Re="' + "+y+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers)),G)if(O)n+=" delete "+p+"["+y+"]; ";else{n+=" "+f+" = false; ";var ut=c;c=e.errSchemaPath+"/additionalProperties";var Se=Se||[];Se.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { additionalProperty: '"+Re+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is an invalid additional property":n+="should NOT have additional properties",n+="' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var Ce=n;n=Se.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+Ce+"]); ":n+=" validate.errors = ["+Ce+"]; return false; ":n+=" var err = "+Ce+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=ut,u&&(n+=" break; ")}else if(z)if(O=="failing"){n+=" var "+m+" = errors; ";var gt=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=F,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var je=p+"["+y+"]";d.dataPathArr[T]=y;var ye=e.validate(d);d.baseId=B,e.util.varOccurences(ye,E)<2?n+=" "+e.util.varReplace(ye,E,je)+" ":n+=" var "+E+" = "+je+"; "+ye+" ",n+=" if (!"+f+") { errors = "+m+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+p+"["+y+"]; } ",e.compositeRule=d.compositeRule=gt}else{d.schema=F,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var je=p+"["+y+"]";d.dataPathArr[T]=y;var ye=e.validate(d);d.baseId=B,e.util.varOccurences(ye,E)<2?n+=" "+e.util.varReplace(ye,E,je)+" ":n+=" var "+E+" = "+je+"; "+ye+" ",u&&(n+=" if (!"+f+") break; ")}e.errorPath=We}R&&(n+=" } "),n+=" } ",u&&(n+=" if ("+f+") { ",g+="}")}var Wt=e.opts.useDefaults&&!e.compositeRule;if(D.length){var Pt=D;if(Pt)for(var _,cr=-1,Qt=Pt.length-1;cr<Qt;){_=Pt[cr+=1];var qe=s[_];if(e.opts.strictKeywords?typeof qe=="object"&&Object.keys(qe).length>0||qe===!1:e.util.schemaHasRules(qe,e.RULES.all)){var ft=e.util.getProperty(_),je=p+ft,at=Wt&&qe.default!==void 0;d.schema=qe,d.schemaPath=l+ft,d.errSchemaPath=c+"/"+e.util.escapeFragment(_),d.errorPath=e.util.getPath(e.errorPath,_,e.opts.jsonPointers),d.dataPathArr[T]=e.util.toQuotedString(_);var ye=e.validate(d);if(d.baseId=B,e.util.varOccurences(ye,E)<2){ye=e.util.varReplace(ye,E,je);var Qe=je}else{var Qe=E;n+=" var "+E+" = "+je+"; "}if(at)n+=" "+ye+" ";else{if(K&&K[_]){n+=" if ( "+Qe+" === undefined ",A&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(_)+"') "),n+=") { "+f+" = false; ";var We=e.errorPath,ut=c,Dt=e.util.escapeQuotes(_);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(We,_,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var Se=Se||[];Se.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+Dt+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+Dt+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var Ce=n;n=Se.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+Ce+"]); ":n+=" validate.errors = ["+Ce+"]; return false; ":n+=" var err = "+Ce+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=ut,e.errorPath=We,n+=" } else { "}else u?(n+=" if ( "+Qe+" === undefined ",A&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(_)+"') "),n+=") { "+f+" = true; } else { "):(n+=" if ("+Qe+" !== undefined ",A&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(_)+"') "),n+=" ) { ");n+=" "+ye+" } "}}u&&(n+=" if ("+f+") { ",g+="}")}}if(M.length){var dt=M;if(dt)for(var ne,L=-1,V=dt.length-1;L<V;){ne=dt[L+=1];var qe=C[ne];if(e.opts.strictKeywords?typeof qe=="object"&&Object.keys(qe).length>0||qe===!1:e.util.schemaHasRules(qe,e.RULES.all)){d.schema=qe,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(ne),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(ne),A?n+=" "+I+" = "+I+" || Object.keys("+p+"); for (var "+v+"=0; "+v+"<"+I+".length; "+v+"++) { var "+y+" = "+I+"["+v+"]; ":n+=" for (var "+y+" in "+p+") { ",n+=" if ("+e.usePattern(ne)+".test("+y+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var je=p+"["+y+"]";d.dataPathArr[T]=y;var ye=e.validate(d);d.baseId=B,e.util.varOccurences(ye,E)<2?n+=" "+e.util.varReplace(ye,E,je)+" ":n+=" var "+E+" = "+je+"; "+ye+" ",u&&(n+=" if (!"+f+") break; "),n+=" } ",u&&(n+=" else "+f+" = true; "),n+=" } ",u&&(n+=" if ("+f+") { ",g+="}")}}}return u&&(n+=" "+g+" if ("+m+" == errors) {"),n}});var Qp=te((oI,Jp)=>{"use strict";Jp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="errs__"+i,d=e.util.copy(e),g="";d.level++;var f="valid"+d.level;if(n+="var "+m+" = errors;",e.opts.strictKeywords?typeof s=="object"&&Object.keys(s).length>0||s===!1:e.util.schemaHasRules(s,e.RULES.all)){d.schema=s,d.schemaPath=l,d.errSchemaPath=c;var y="key"+i,v="idx"+i,T="i"+i,E="' + "+y+" + '",I=d.dataLevel=e.dataLevel+1,D="data"+I,C="dataProperties"+i,M=e.opts.ownProperties,F=e.baseId;M&&(n+=" var "+C+" = undefined; "),M?n+=" "+C+" = "+C+" || Object.keys("+p+"); for (var "+v+"=0; "+v+"<"+C+".length; "+v+"++) { var "+y+" = "+C+"["+v+"]; ":n+=" for (var "+y+" in "+p+") { ",n+=" var startErrs"+i+" = errors; ";var R=y,G=e.compositeRule;e.compositeRule=d.compositeRule=!0;var z=e.validate(d);d.baseId=F,e.util.varOccurences(z,D)<2?n+=" "+e.util.varReplace(z,D,R)+" ":n+=" var "+D+" = "+R+"; "+z+" ",e.compositeRule=d.compositeRule=G,n+=" if (!"+f+") { for (var "+T+"=startErrs"+i+"; "+T+"<errors; "+T+"++) { vErrors["+T+"].propertyName = "+y+"; } var err = ",e.createErrors!==!1?(n+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+E+"' } ",e.opts.messages!==!1&&(n+=" , message: 'property name \\'"+E+"\\' is invalid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),u&&(n+=" break; "),n+=" } }"}return u&&(n+=" "+g+" if ("+m+" == errors) {"),n}});var tm=te((sI,em)=>{"use strict";em.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d=e.opts.$data&&s&&s.$data,g;d?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",g="schema"+i):g=s;var f="schema"+i;if(!d)if(s.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var y=[],v=s;if(v)for(var T,E=-1,I=v.length-1;E<I;){T=v[E+=1];var D=e.schema.properties[T];D&&(e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all))||(y[y.length]=T)}}else var y=s;if(d||y.length){var C=e.errorPath,M=d||y.length>=e.opts.loopRequired,F=e.opts.ownProperties;if(u)if(n+=" var missing"+i+"; ",M){d||(n+=" var "+f+" = validate.schema"+l+"; ");var R="i"+i,G="schema"+i+"["+R+"]",z="' + "+G+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(C,G,e.opts.jsonPointers)),n+=" var "+m+" = true; ",d&&(n+=" if (schema"+i+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+i+")) "+m+" = false; else {"),n+=" for (var "+R+" = 0; "+R+" < "+f+".length; "+R+"++) { "+m+" = "+p+"["+f+"["+R+"]] !== undefined ",F&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", "+f+"["+R+"]) "),n+="; if (!"+m+") break; } ",d&&(n+=" } "),n+=" if (!"+m+") { ";var O=O||[];O.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+z+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+z+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var x=n;n=O.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+x+"]); ":n+=" validate.errors = ["+x+"]; return false; ":n+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var A=y;if(A)for(var B,R=-1,X=A.length-1;R<X;){B=A[R+=1],R&&(n+=" || ");var K=e.util.getProperty(B),Q=p+K;n+=" ( ( "+Q+" === undefined ",F&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(B)+"') "),n+=") && (missing"+i+" = "+e.util.toQuotedString(e.opts.jsonPointers?B:K)+") ) "}n+=") { ";var G="missing"+i,z="' + "+G+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(C,G,!0):C+" + "+G);var O=O||[];O.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+z+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+z+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var x=n;n=O.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+x+"]); ":n+=" validate.errors = ["+x+"]; return false; ":n+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else if(M){d||(n+=" var "+f+" = validate.schema"+l+"; ");var R="i"+i,G="schema"+i+"["+R+"]",z="' + "+G+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(C,G,e.opts.jsonPointers)),d&&(n+=" if ("+f+" && !Array.isArray("+f+")) { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+z+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+z+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+f+" !== undefined) { "),n+=" for (var "+R+" = 0; "+R+" < "+f+".length; "+R+"++) { if ("+p+"["+f+"["+R+"]] === undefined ",F&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", "+f+"["+R+"]) "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+z+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+z+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(n+=" } ")}else{var Z=y;if(Z)for(var B,_=-1,fe=Z.length-1;_<fe;){B=Z[_+=1];var K=e.util.getProperty(B),z=e.util.escapeQuotes(B),Q=p+K;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(C,B,e.opts.jsonPointers)),n+=" if ( "+Q+" === undefined ",F&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(B)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+z+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+z+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=C}else u&&(n+=" if (true) {");return n}});var nm=te((lI,rm)=>{"use strict";rm.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d=e.opts.$data&&s&&s.$data,g;if(d?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",g="schema"+i):g=s,(s||d)&&e.opts.uniqueItems!==!1){d&&(n+=" var "+m+"; if ("+g+" === false || "+g+" === undefined) "+m+" = true; else if (typeof "+g+" != 'boolean') "+m+" = false; else { "),n+=" var i = "+p+".length , "+m+" = true , j; if (i > 1) { ";var f=e.schema.items&&e.schema.items.type,y=Array.isArray(f);if(!f||f=="object"||f=="array"||y&&(f.indexOf("object")>=0||f.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+m+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ";var v="checkDataType"+(y?"s":"");n+=" if ("+e.util[v](f,"item",e.opts.strictNumbers,!0)+") continue; ",y&&(n+=` if (typeof item == 'string') item = '"' + item; `),n+=" if (typeof itemIndices[item] == 'number') { "+m+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",d&&(n+=" } "),n+=" if (!"+m+") { ";var T=T||[];T.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(n+=" , schema: ",d?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var E=n;n=T.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+E+"]); ":n+=" validate.errors = ["+E+"]; return false; ":n+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u&&(n+=" else { ")}else u&&(n+=" if (true) { ");return n}});var im=te((cI,am)=>{"use strict";am.exports={$ref:yp(),allOf:vp(),anyOf:Sp(),$comment:wp(),const:kp(),contains:xp(),dependencies:Ip(),enum:Pp(),format:Np(),if:Lp(),items:Fp(),maximum:El(),minimum:El(),maxItems:wl(),minItems:wl(),maxLength:Cl(),minLength:Cl(),maxProperties:kl(),minProperties:kl(),multipleOf:Vp(),not:jp(),oneOf:Kp(),pattern:Xp(),properties:Zp(),propertyNames:Qp(),required:tm(),uniqueItems:nm(),validate:_l()}});var lm=te((uI,sm)=>{"use strict";var om=im(),Tl=mn().toHash;sm.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],a=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],n=["number","integer","string","array","object","boolean","null"];return e.all=Tl(t),e.types=Tl(n),e.forEach(function(i){i.rules=i.rules.map(function(o){var s;if(typeof o=="object"){var l=Object.keys(o)[0];s=o[l],o=l,s.forEach(function(u){t.push(u),e.all[u]=!0})}t.push(o);var c=e.all[o]={keyword:o,code:om[o],implements:s};return c}),e.all.$comment={keyword:"$comment",code:om.$comment},i.type&&(e.types[i.type]=i)}),e.keywords=Tl(t.concat(a)),e.custom={},e}});var dm=te((dI,um)=>{"use strict";var cm=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];um.exports=function(r,e){for(var t=0;t<e.length;t++){r=JSON.parse(JSON.stringify(r));var a=e[t].split("/"),n=r,i;for(i=1;i<a.length;i++)n=n[a[i]];for(i=0;i<cm.length;i++){var o=cm[i],s=n[o];s&&(n[o]={anyOf:[s,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return r}});var hm=te((pI,mm)=>{"use strict";var eS=$i().MissingRef;mm.exports=pm;function pm(r,e,t){var a=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(t=e,e=void 0);var n=i(r).then(function(){var s=a._addSchema(r,void 0,e);return s.validate||o(s)});return t&&n.then(function(s){t(null,s)},t),n;function i(s){var l=s.$schema;return l&&!a.getSchema(l)?pm.call(a,{$ref:l},!0):Promise.resolve()}function o(s){try{return a._compile(s)}catch(c){if(c instanceof eS)return l(c);throw c}function l(c){var u=c.missingSchema;if(d(u))throw new Error("Schema "+u+" is loaded but "+c.missingRef+" cannot be resolved");var p=a._loadingSchemas[u];return p||(p=a._loadingSchemas[u]=a._opts.loadSchema(u),p.then(m,m)),p.then(function(g){if(!d(u))return i(g).then(function(){d(u)||a.addSchema(g,u,void 0,e)})}).then(function(){return o(s)});function m(){delete a._loadingSchemas[u]}function d(g){return a._refs[g]||a._schemas[g]}}}}});var fm=te((mI,gm)=>{"use strict";gm.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p,m="data"+(o||""),d="valid"+i,g="errs__"+i,f=e.opts.$data&&s&&s.$data,y;f?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",y="schema"+i):y=s;var v=this,T="definition"+i,E=v.definition,I="",D,C,M,F,R;if(f&&E.$data){R="keywordValidate"+i;var G=E.validateSchema;n+=" var "+T+" = RULES.custom['"+t+"'].definition; var "+R+" = "+T+".validate;"}else{if(F=e.useCustomRule(v,s,e.schema,e),!F)return;y="validate.schema"+l,R=F.code,D=E.compile,C=E.inline,M=E.macro}var z=R+".errors",O="i"+i,x="ruleErr"+i,A=E.async;if(A&&!e.async)throw new Error("async keyword in sync schema");if(C||M||(n+=""+z+" = null;"),n+="var "+g+" = errors;var "+d+";",f&&E.$data&&(I+="}",n+=" if ("+y+" === undefined) { "+d+" = true; } else { ",G&&(I+="}",n+=" "+d+" = "+T+".validateSchema("+y+"); if ("+d+") { ")),C)E.statements?n+=" "+F.validate+" ":n+=" "+d+" = "+F.validate+"; ";else if(M){var B=e.util.copy(e),I="";B.level++;var X="valid"+B.level;B.schema=F.validate,B.schemaPath="";var K=e.compositeRule;e.compositeRule=B.compositeRule=!0;var Q=e.validate(B).replace(/validate\.schema/g,R);e.compositeRule=B.compositeRule=K,n+=" "+Q}else{var Z=Z||[];Z.push(n),n="",n+=" "+R+".call( ",e.opts.passContext?n+="this":n+="self",D||E.schema===!1?n+=" , "+m+" ":n+=" , "+y+" , "+m+" , validate.schema"+e.schemaPath+" ",n+=" , (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var _=o?"data"+(o-1||""):"parentData",fe=o?e.dataPathArr[o]:"parentDataProperty";n+=" , "+_+" , "+fe+" , rootData ) ";var Ie=n;n=Z.pop(),E.errors===!1?(n+=" "+d+" = ",A&&(n+="await "),n+=""+Ie+"; "):A?(z="customErrors"+i,n+=" var "+z+" = null; try { "+d+" = await "+Ie+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+z+" = e.errors; else throw e; } "):n+=" "+z+" = null; "+d+" = "+Ie+"; "}if(E.modifying&&(n+=" if ("+_+") "+m+" = "+_+"["+fe+"];"),n+=""+I,E.valid)u&&(n+=" if (true) { ");else{n+=" if ( ",E.valid===void 0?(n+=" !",M?n+=""+X:n+=""+d):n+=" "+!E.valid+" ",n+=") { ",p=v.keyword;var Z=Z||[];Z.push(n),n="";var Z=Z||[];Z.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(n+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var S=n;n=Z.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+S+"]); ":n+=" validate.errors = ["+S+"]; return false; ":n+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var ne=n;n=Z.pop(),C?E.errors?E.errors!="full"&&(n+=" for (var "+O+"="+g+"; "+O+"<errors; "+O+"++) { var "+x+" = vErrors["+O+"]; if ("+x+".dataPath === undefined) "+x+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+x+".schemaPath === undefined) { "+x+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(n+=" "+x+".schema = "+y+"; "+x+".data = "+m+"; "),n+=" } "):E.errors===!1?n+=" "+ne+" ":(n+=" if ("+g+" == errors) { "+ne+" } else { for (var "+O+"="+g+"; "+O+"<errors; "+O+"++) { var "+x+" = vErrors["+O+"]; if ("+x+".dataPath === undefined) "+x+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+x+".schemaPath === undefined) { "+x+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(n+=" "+x+".schema = "+y+"; "+x+".data = "+m+"; "),n+=" } } "):M?(n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(n+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; ")):E.errors===!1?n+=" "+ne+" ":(n+=" if (Array.isArray("+z+")) { if (vErrors === null) vErrors = "+z+"; else vErrors = vErrors.concat("+z+"); errors = vErrors.length; for (var "+O+"="+g+"; "+O+"<errors; "+O+"++) { var "+x+" = vErrors["+O+"]; if ("+x+".dataPath === undefined) "+x+".dataPath = (dataPath || '') + "+e.errorPath+"; "+x+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(n+=" "+x+".schema = "+y+"; "+x+".data = "+m+"; "),n+=" } } else { "+ne+" } "),n+=" } ",u&&(n+=" else { ")}return n}});var xl=te((hI,tS)=>{tS.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 vm=te((gI,bm)=>{"use strict";var ym=xl();bm.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:ym.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:ym.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 Sm=te((fI,_m)=>{"use strict";var rS=/^[a-z_$][a-z0-9_$-]*$/i,nS=fm(),aS=vm();_m.exports={add:iS,get:oS,remove:sS,validate:Al};function iS(r,e){var t=this.RULES;if(t.keywords[r])throw new Error("Keyword "+r+" is already defined");if(!rS.test(r))throw new Error("Keyword "+r+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var a=e.type;if(Array.isArray(a))for(var n=0;n<a.length;n++)o(r,a[n],e);else o(r,a,e);var i=e.metaSchema;i&&(e.$data&&this._opts.$data&&(i={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(i,!0))}t.keywords[r]=t.all[r]=!0;function o(s,l,c){for(var u,p=0;p<t.length;p++){var m=t[p];if(m.type==l){u=m;break}}u||(u={type:l,rules:[]},t.push(u));var d={keyword:s,definition:c,custom:!0,code:nS,implements:c.implements};u.rules.push(d),t.custom[s]=d}return this}function oS(r){var e=this.RULES.custom[r];return e?e.definition:this.RULES.keywords[r]||!1}function sS(r){var e=this.RULES;delete e.keywords[r],delete e.all[r],delete e.custom[r];for(var t=0;t<e.length;t++)for(var a=e[t].rules,n=0;n<a.length;n++)if(a[n].keyword==r){a.splice(n,1);break}return this}function Al(r,e){Al.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(aS,!0);if(t(r))return!0;if(Al.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var Em=te((yI,lS)=>{lS.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 Dm=te((bI,Pm)=>{"use strict";var Cm=tp(),hn=Ki(),cS=np(),km=ml(),uS=vl(),dS=gp(),pS=lm(),Tm=dm(),xm=mn();Pm.exports=Ge;Ge.prototype.validate=hS;Ge.prototype.compile=gS;Ge.prototype.addSchema=fS;Ge.prototype.addMetaSchema=yS;Ge.prototype.validateSchema=bS;Ge.prototype.getSchema=_S;Ge.prototype.removeSchema=ES;Ge.prototype.addFormat=RS;Ge.prototype.errorsText=IS;Ge.prototype._addSchema=wS;Ge.prototype._compile=CS;Ge.prototype.compileAsync=hm();var ro=Sm();Ge.prototype.addKeyword=ro.add;Ge.prototype.getKeyword=ro.get;Ge.prototype.removeKeyword=ro.remove;Ge.prototype.validateKeyword=ro.validate;var Am=$i();Ge.ValidationError=Am.Validation;Ge.MissingRefError=Am.MissingRef;Ge.$dataMetaSchema=Tm;var to="http://json-schema.org/draft-07/schema",wm=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],mS=["/properties"];function Ge(r){if(!(this instanceof Ge))return new Ge(r);r=this._opts=xm.copy(r)||{},MS(this),this._schemas={},this._refs={},this._fragments={},this._formats=dS(r.format),this._cache=r.cache||new cS,this._loadingSchemas={},this._compilations=[],this.RULES=pS(),this._getId=kS(r),r.loopRequired=r.loopRequired||1/0,r.errorDataPath=="property"&&(r._errorDataPathProperty=!0),r.serialize===void 0&&(r.serialize=uS),this._metaOpts=LS(this),r.formats&&NS(this),r.keywords&&OS(this),PS(this),typeof r.meta=="object"&&this.addMetaSchema(r.meta),r.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),DS(this)}function hS(r,e){var t;if(typeof r=="string"){if(t=this.getSchema(r),!t)throw new Error('no schema with key or ref "'+r+'"')}else{var a=this._addSchema(r);t=a.validate||this._compile(a)}var n=t(e);return t.$async!==!0&&(this.errors=t.errors),n}function gS(r,e){var t=this._addSchema(r,void 0,e);return t.validate||this._compile(t)}function fS(r,e,t,a){if(Array.isArray(r)){for(var n=0;n<r.length;n++)this.addSchema(r[n],void 0,t,a);return this}var i=this._getId(r);if(i!==void 0&&typeof i!="string")throw new Error("schema id must be string");return e=hn.normalizeId(e||i),Rm(this,e),this._schemas[e]=this._addSchema(r,t,a,!0),this}function yS(r,e,t){return this.addSchema(r,e,t,!0),this}function bS(r,e){var t=r.$schema;if(t!==void 0&&typeof t!="string")throw new Error("$schema must be a string");if(t=t||this._opts.defaultMeta||vS(this),!t)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var a=this.validate(t,r);if(!a&&e){var n="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(n);else throw new Error(n)}return a}function vS(r){var e=r._opts.meta;return r._opts.defaultMeta=typeof e=="object"?r._getId(e)||e:r.getSchema(to)?to:void 0,r._opts.defaultMeta}function _S(r){var e=Im(this,r);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return SS(this,r)}}function SS(r,e){var t=hn.schema.call(r,{schema:{}},e);if(t){var a=t.schema,n=t.root,i=t.baseId,o=Cm.call(r,a,n,void 0,i);return r._fragments[e]=new km({ref:e,fragment:!0,schema:a,root:n,baseId:i,validate:o}),o}}function Im(r,e){return e=hn.normalizeId(e),r._schemas[e]||r._refs[e]||r._fragments[e]}function ES(r){if(r instanceof RegExp)return eo(this,this._schemas,r),eo(this,this._refs,r),this;switch(typeof r){case"undefined":return eo(this,this._schemas),eo(this,this._refs),this._cache.clear(),this;case"string":var e=Im(this,r);return e&&this._cache.del(e.cacheKey),delete this._schemas[r],delete this._refs[r],this;case"object":var t=this._opts.serialize,a=t?t(r):r;this._cache.del(a);var n=this._getId(r);n&&(n=hn.normalizeId(n),delete this._schemas[n],delete this._refs[n])}return this}function eo(r,e,t){for(var a in e){var n=e[a];!n.meta&&(!t||t.test(a))&&(r._cache.del(n.cacheKey),delete e[a])}}function wS(r,e,t,a){if(typeof r!="object"&&typeof r!="boolean")throw new Error("schema should be object or boolean");var n=this._opts.serialize,i=n?n(r):r,o=this._cache.get(i);if(o)return o;a=a||this._opts.addUsedSchema!==!1;var s=hn.normalizeId(this._getId(r));s&&a&&Rm(this,s);var l=this._opts.validateSchema!==!1&&!e,c;l&&!(c=s&&s==hn.normalizeId(r.$schema))&&this.validateSchema(r,!0);var u=hn.ids.call(this,r),p=new km({id:s,schema:r,localRefs:u,cacheKey:i,meta:t});return s[0]!="#"&&a&&(this._refs[s]=p),this._cache.put(i,p),l&&c&&this.validateSchema(r,!0),p}function CS(r,e){if(r.compiling)return r.validate=n,n.schema=r.schema,n.errors=null,n.root=e||n,r.schema.$async===!0&&(n.$async=!0),n;r.compiling=!0;var t;r.meta&&(t=this._opts,this._opts=this._metaOpts);var a;try{a=Cm.call(this,r.schema,e,r.localRefs)}catch(i){throw delete r.validate,i}finally{r.compiling=!1,r.meta&&(this._opts=t)}return r.validate=a,r.refs=a.refs,r.refVal=a.refVal,r.root=a.root,a;function n(){var i=r.validate,o=i.apply(this,arguments);return n.errors=i.errors,o}}function kS(r){switch(r.schemaId){case"auto":return AS;case"id":return TS;default:return xS}}function TS(r){return r.$id&&this.logger.warn("schema $id ignored",r.$id),r.id}function xS(r){return r.id&&this.logger.warn("schema id ignored",r.id),r.$id}function AS(r){if(r.$id&&r.id&&r.$id!=r.id)throw new Error("schema $id is different from id");return r.$id||r.id}function IS(r,e){if(r=r||this.errors,!r)return"No errors";e=e||{};for(var t=e.separator===void 0?", ":e.separator,a=e.dataVar===void 0?"data":e.dataVar,n="",i=0;i<r.length;i++){var o=r[i];o&&(n+=a+o.dataPath+" "+o.message+t)}return n.slice(0,-t.length)}function RS(r,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[r]=e,this}function PS(r){var e;if(r._opts.$data&&(e=Em(),r.addMetaSchema(e,e.$id,!0)),r._opts.meta!==!1){var t=xl();r._opts.$data&&(t=Tm(t,mS)),r.addMetaSchema(t,to,!0),r._refs["http://json-schema.org/schema"]=to}}function DS(r){var e=r._opts.schemas;if(e)if(Array.isArray(e))r.addSchema(e);else for(var t in e)r.addSchema(e[t],t)}function NS(r){for(var e in r._opts.formats){var t=r._opts.formats[e];r.addFormat(e,t)}}function OS(r){for(var e in r._opts.keywords){var t=r._opts.keywords[e];r.addKeyword(e,t)}}function Rm(r,e){if(r._schemas[e]||r._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function LS(r){for(var e=xm.copy(r._opts),t=0;t<wm.length;t++)delete e[wm[t]];return e}function MS(r){var e=r._opts.logger;if(e===!1)r.logger={log:Il,warn:Il,error:Il};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");r.logger=e}}function Il(){}});var Kg=te((i2,qg)=>{"use strict";var ts=Object.prototype.hasOwnProperty,jg=Object.prototype.toString,Gg=Object.defineProperty,zg=Object.getOwnPropertyDescriptor,Ug=function(e){return typeof Array.isArray=="function"?Array.isArray(e):jg.call(e)==="[object Array]"},Hg=function(e){if(!e||jg.call(e)!=="[object Object]")return!1;var t=ts.call(e,"constructor"),a=e.constructor&&e.constructor.prototype&&ts.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!t&&!a)return!1;var n;for(n in e);return typeof n>"u"||ts.call(e,n)},Vg=function(e,t){Gg&&t.name==="__proto__"?Gg(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},Wg=function(e,t){if(t==="__proto__")if(ts.call(e,t)){if(zg)return zg(e,t).value}else return;return e[t]};qg.exports=function r(){var e,t,a,n,i,o,s=arguments[0],l=1,c=arguments.length,u=!1;for(typeof s=="boolean"&&(u=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l<c;++l)if(e=arguments[l],e!=null)for(t in e)a=Wg(s,t),n=Wg(e,t),s!==n&&(u&&n&&(Hg(n)||(i=Ug(n)))?(i?(i=!1,o=a&&Ug(a)?a:[]):o=a&&Hg(a)?a:{},Vg(s,{name:t,newValue:r(u,o,n)})):typeof n<"u"&&Vg(s,{name:t,newValue:n}));return s}});var yf=te(he=>{"use strict";var ai=Symbol.for("react.element"),Dk=Symbol.for("react.portal"),Nk=Symbol.for("react.fragment"),Ok=Symbol.for("react.strict_mode"),Lk=Symbol.for("react.profiler"),Mk=Symbol.for("react.provider"),Fk=Symbol.for("react.context"),Bk=Symbol.for("react.forward_ref"),Gk=Symbol.for("react.suspense"),zk=Symbol.for("react.memo"),Uk=Symbol.for("react.lazy"),of=Symbol.iterator;function Hk(r){return r===null||typeof r!="object"?null:(r=of&&r[of]||r["@@iterator"],typeof r=="function"?r:null)}var cf={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},uf=Object.assign,df={};function ma(r,e,t){this.props=r,this.context=e,this.refs=df,this.updater=t||cf}ma.prototype.isReactComponent={};ma.prototype.setState=function(r,e){if(typeof r!="object"&&typeof r!="function"&&r!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,r,e,"setState")};ma.prototype.forceUpdate=function(r){this.updater.enqueueForceUpdate(this,r,"forceUpdate")};function pf(){}pf.prototype=ma.prototype;function Qc(r,e,t){this.props=r,this.context=e,this.refs=df,this.updater=t||cf}var eu=Qc.prototype=new pf;eu.constructor=Qc;uf(eu,ma.prototype);eu.isPureReactComponent=!0;var sf=Array.isArray,mf=Object.prototype.hasOwnProperty,tu={current:null},hf={key:!0,ref:!0,__self:!0,__source:!0};function gf(r,e,t){var a,n={},i=null,o=null;if(e!=null)for(a in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)mf.call(e,a)&&!hf.hasOwnProperty(a)&&(n[a]=e[a]);var s=arguments.length-2;if(s===1)n.children=t;else if(1<s){for(var l=Array(s),c=0;c<s;c++)l[c]=arguments[c+2];n.children=l}if(r&&r.defaultProps)for(a in s=r.defaultProps,s)n[a]===void 0&&(n[a]=s[a]);return{$$typeof:ai,type:r,key:i,ref:o,props:n,_owner:tu.current}}function Vk(r,e){return{$$typeof:ai,type:r.type,key:e,ref:r.ref,props:r.props,_owner:r._owner}}function ru(r){return typeof r=="object"&&r!==null&&r.$$typeof===ai}function Wk(r){var e={"=":"=0",":":"=2"};return"$"+r.replace(/[=:]/g,function(t){return e[t]})}var lf=/\/+/g;function Jc(r,e){return typeof r=="object"&&r!==null&&r.key!=null?Wk(""+r.key):e.toString(36)}function bs(r,e,t,a,n){var i=typeof r;(i==="undefined"||i==="boolean")&&(r=null);var o=!1;if(r===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(r.$$typeof){case ai:case Dk:o=!0}}if(o)return o=r,n=n(o),r=a===""?"."+Jc(o,0):a,sf(n)?(t="",r!=null&&(t=r.replace(lf,"$&/")+"/"),bs(n,e,t,"",function(c){return c})):n!=null&&(ru(n)&&(n=Vk(n,t+(!n.key||o&&o.key===n.key?"":(""+n.key).replace(lf,"$&/")+"/")+r)),e.push(n)),1;if(o=0,a=a===""?".":a+":",sf(r))for(var s=0;s<r.length;s++){i=r[s];var l=a+Jc(i,s);o+=bs(i,e,t,l,n)}else if(l=Hk(r),typeof l=="function")for(r=l.call(r),s=0;!(i=r.next()).done;)i=i.value,l=a+Jc(i,s++),o+=bs(i,e,t,l,n);else if(i==="object")throw e=String(r),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function ys(r,e,t){if(r==null)return r;var a=[],n=0;return bs(r,a,"","",function(i){return e.call(t,i,n++)}),a}function jk(r){if(r._status===-1){var e=r._result;e=e(),e.then(function(t){(r._status===0||r._status===-1)&&(r._status=1,r._result=t)},function(t){(r._status===0||r._status===-1)&&(r._status=2,r._result=t)}),r._status===-1&&(r._status=0,r._result=e)}if(r._status===1)return r._result.default;throw r._result}var ht={current:null},vs={transition:null},qk={ReactCurrentDispatcher:ht,ReactCurrentBatchConfig:vs,ReactCurrentOwner:tu};function ff(){throw Error("act(...) is not supported in production builds of React.")}he.Children={map:ys,forEach:function(r,e,t){ys(r,function(){e.apply(this,arguments)},t)},count:function(r){var e=0;return ys(r,function(){e++}),e},toArray:function(r){return ys(r,function(e){return e})||[]},only:function(r){if(!ru(r))throw Error("React.Children.only expected to receive a single React element child.");return r}};he.Component=ma;he.Fragment=Nk;he.Profiler=Lk;he.PureComponent=Qc;he.StrictMode=Ok;he.Suspense=Gk;he.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qk;he.act=ff;he.cloneElement=function(r,e,t){if(r==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+r+".");var a=uf({},r.props),n=r.key,i=r.ref,o=r._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=tu.current),e.key!==void 0&&(n=""+e.key),r.type&&r.type.defaultProps)var s=r.type.defaultProps;for(l in e)mf.call(e,l)&&!hf.hasOwnProperty(l)&&(a[l]=e[l]===void 0&&s!==void 0?s[l]:e[l])}var l=arguments.length-2;if(l===1)a.children=t;else if(1<l){s=Array(l);for(var c=0;c<l;c++)s[c]=arguments[c+2];a.children=s}return{$$typeof:ai,type:r.type,key:n,ref:i,props:a,_owner:o}};he.createContext=function(r){return r={$$typeof:Fk,_currentValue:r,_currentValue2:r,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},r.Provider={$$typeof:Mk,_context:r},r.Consumer=r};he.createElement=gf;he.createFactory=function(r){var e=gf.bind(null,r);return e.type=r,e};he.createRef=function(){return{current:null}};he.forwardRef=function(r){return{$$typeof:Bk,render:r}};he.isValidElement=ru;he.lazy=function(r){return{$$typeof:Uk,_payload:{_status:-1,_result:r},_init:jk}};he.memo=function(r,e){return{$$typeof:zk,type:r,compare:e===void 0?null:e}};he.startTransition=function(r){var e=vs.transition;vs.transition={};try{r()}finally{vs.transition=e}};he.unstable_act=ff;he.useCallback=function(r,e){return ht.current.useCallback(r,e)};he.useContext=function(r){return ht.current.useContext(r)};he.useDebugValue=function(){};he.useDeferredValue=function(r){return ht.current.useDeferredValue(r)};he.useEffect=function(r,e){return ht.current.useEffect(r,e)};he.useId=function(){return ht.current.useId()};he.useImperativeHandle=function(r,e,t){return ht.current.useImperativeHandle(r,e,t)};he.useInsertionEffect=function(r,e){return ht.current.useInsertionEffect(r,e)};he.useLayoutEffect=function(r,e){return ht.current.useLayoutEffect(r,e)};he.useMemo=function(r,e){return ht.current.useMemo(r,e)};he.useReducer=function(r,e,t){return ht.current.useReducer(r,e,t)};he.useRef=function(r){return ht.current.useRef(r)};he.useState=function(r){return ht.current.useState(r)};he.useSyncExternalStore=function(r,e,t){return ht.current.useSyncExternalStore(r,e,t)};he.useTransition=function(){return ht.current.useTransition()};he.version="18.3.1"});var vf=te((LF,bf)=>{"use strict";bf.exports=yf()});var tt=[];for(ci=0;ci<256;++ci)tt.push((ci+256).toString(16).slice(1));var ci;function du(r,e=0){return(tt[r[e+0]]+tt[r[e+1]]+tt[r[e+2]]+tt[r[e+3]]+"-"+tt[r[e+4]]+tt[r[e+5]]+"-"+tt[r[e+6]]+tt[r[e+7]]+"-"+tt[r[e+8]]+tt[r[e+9]]+"-"+tt[r[e+10]]+tt[r[e+11]]+tt[r[e+12]]+tt[r[e+13]]+tt[r[e+14]]+tt[r[e+15]]).toLowerCase()}var ui,Mf=new Uint8Array(16);function ks(){if(!ui&&(ui=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ui))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ui(Mf)}var Ff=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ts={randomUUID:Ff};function Bf(r,e,t){if(Ts.randomUUID&&!e&&!r)return Ts.randomUUID();r=r||{};var a=r.random||(r.rng||ks)();if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,e){t=t||0;for(var n=0;n<16;++n)e[t+n]=a[n];return e}return du(a)}var Tt=Bf;function xs(r){let e=(r||"").split(`
|
|
2
2
|
`);for(;e.length>0&&e[0].trim()=="";)e.shift();for(;e.length>0&&e[e.length-1].trim()=="";)e.pop();let t=1/0;for(let a of e){let n=a.match(/^\s*/)?.[0].length||0;t=Math.min(t,n)}return t>0&&t<1/0&&(e=e.map(a=>a.substring(t))),e.join(`
|
|
3
|
-
`)}var
|
|
3
|
+
`)}var Gf={};function Cr(){return typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:Gf}function Ne(){return Cr().intelliweave=Cr().intelliweave||Cr().webWeaver||{},Cr().intelliweave}async function*pu(r){let e="",t=function*(){for(;;){let i=e.indexOf(`
|
|
4
4
|
|
|
5
5
|
`);if(i==-1)break;let o=e.slice(0,i);e=e.slice(i+2);let s={},l=o.split(`
|
|
6
6
|
`);for(let c of l){i=c.indexOf(": ");let u=c.slice(0,i),p=c.slice(i+2);i==-1&&(u=c,p=""),u&&(s[u]!==void 0?s[u]+=`
|
|
7
7
|
`+p:s[u]=p)}yield s}},a=new TextDecoder,n=r.getReader();for(;;){let{done:i,value:o}=await n.read();if(i)break;e+=a.decode(o,{stream:!0}),yield*t()}e+=a.decode()+`
|
|
8
8
|
|
|
9
|
-
`,yield*t()}function
|
|
9
|
+
`,yield*t()}function mu(){if(Ne().userID)return Ne().userID||"";if(typeof localStorage<"u"){let r=localStorage.getItem("intelliweave.uid")||"";return r||(r=Tt(),localStorage.setItem("intelliweave.uid",r),r)}else return Tt()}function hu(r){let e=r;if(e?.type=="object"&&e.properties)return r;let t={type:"object",properties:{},required:[]};if(r&&Array.isArray(r)){let a=r;for(let n of a)t.properties[n.name]={type:n.type||"string",description:n.description||""}}return t}var di=class di{constructor(e){this.module="IntelliWeave";this.module=e}get debugEnabled(){return di.debug?!0:typeof window<"u"&&Ne().debug}log(...e){this.debugEnabled&&console.log(`[IntelliWeave > ${this.module}]`,...e)}debug(...e){this.debugEnabled&&console.debug(`[IntelliWeave > ${this.module}]`,...e)}info(...e){this.debugEnabled&&console.info(`[IntelliWeave > ${this.module}]`,...e)}warn(...e){console.warn(`[IntelliWeave > ${this.module}]`,...e)}error(...e){console.error(`[IntelliWeave > ${this.module}]`,...e)}timer(e,...t){let a=Date.now();return this.debug(`[${e} 0ms] Started`,...t),(...n)=>this.debug(`[${e} ${Math.floor(Date.now()-a)}ms]`,...n)}};di.debug=!1;var ge=di;var gu=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~",[161],[162],[163],[164],[165],[166],[167],[168],[169],[170],[171],[172],[174],[175],[176],[177],[178],[179],[180],[181],[182],[183],[184],[185],[186],[187],[188],[189],[190],[191],[192],[193],[194],[195],[196],[197],[198],[199],[200],[201],[202],[203],[204],[205],[206],[207],[208],[209],[210],[211],[212],[213],[214],[215],[216],[217],[218],[219],[220],[221],[222],[223],[224],[225],[226],[227],[228],[229],[230],[231],[232],[233],[234],[235],[236],[237],[238],[239],[240],[241],[242],[243],[244],[245],[246],[247],[248],[249],[250],[251],[252],[253],[254],[255],"\0","","","","","","","\x07","\b"," ",`
|
|
10
10
|
`,"\v","\f","\r","","","","","","","","","","","","","","\x1B","","","",""," ","\x7F",[128],[129],[130],[131],[132],[133],[134],[135],[136],[137],[138],[139],[140],[141],[142],[143],[144],[145],[146],[147],[148],[149],[150],[151],[152],[153],[154],[155],[156],[157],[158],[159],[160],[173]," "," ","in"," t"," ","er"," ","on"," a","re","at","st","en","or"," th",`
|
|
11
11
|
|
|
12
12
|
`," c","le"," s","it","an","ar","al"," the",`;
|
|
@@ -3236,7 +3236,7 @@ import{b as te,c as Ss,d as Es,e as Pe}from"./chunk-AIYMQX7V.js";var Pd=te((Fi,R
|
|
|
3236
3236
|
|
|
3237
3237
|
|
|
3238
3238
|
|
|
3239
|
-
`," lup","_Reference"," BATCH"," intertwined","<Cell"," Cabr","nation"," isConnected",".removeListener"," cong","_ti"," Silicone"," \uACB0\uACFC"," WAN"," Gibraltar","/response"," person","chants","VIP","emergency","PixelFormat","-Am"," southwestern","_pll","ifers","_ONCE"," Fayette",".ncbi","_Panel",".Qual"," polys"," createStackNavigator","\uFFFDt"," layoffs"," Blanco","Feat"," Vimeo","_chi","_lifetime","POINTS",",private"," unbearable","printing"," cgi",".BACK"," interns"," Newly","infeld","(IB"," Kata"," Defendants","Thr","\u9884","_VF","FFFFFFFF"," davidjl"," bitterly","Suggestions",".setCancelable","FINAL","asons","_rwlock","_WRAPPER"," happiest","(rowIndex","\xF3sito","TOTYPE","Automation","LogFile"," consolation","\u30C0"," t\xEAm"," prer","rgyz"," Geg"," dto",".defaultValue"," Kami"," ASE","optimized"," \uD3EC"," originates","errMsg"," espa\xE7o","(SYS"," McB","dance","_detected"," fr\xFC"," ","<Date","(comb"," Decide","\\Field"," Proposed","Rib"," dislikes"," Wien"," Document"," traf"," storia"," Tells","')==","Cri","(VALUE"," Burnett",",void"," danh"," ccp","Blockchain",':"-"`\n'],
|
|
3239
|
+
`," lup","_Reference"," BATCH"," intertwined","<Cell"," Cabr","nation"," isConnected",".removeListener"," cong","_ti"," Silicone"," \uACB0\uACFC"," WAN"," Gibraltar","/response"," person","chants","VIP","emergency","PixelFormat","-Am"," southwestern","_pll","ifers","_ONCE"," Fayette",".ncbi","_Panel",".Qual"," polys"," createStackNavigator","\uFFFDt"," layoffs"," Blanco","Feat"," Vimeo","_chi","_lifetime","POINTS",",private"," unbearable","printing"," cgi",".BACK"," interns"," Newly","infeld","(IB"," Kata"," Defendants","Thr","\u9884","_VF","FFFFFFFF"," davidjl"," bitterly","Suggestions",".setCancelable","FINAL","asons","_rwlock","_WRAPPER"," happiest","(rowIndex","\xF3sito","TOTYPE","Automation","LogFile"," consolation","\u30C0"," t\xEAm"," prer","rgyz"," Geg"," dto",".defaultValue"," Kami"," ASE","optimized"," \uD3EC"," originates","errMsg"," espa\xE7o","(SYS"," McB","dance","_detected"," fr\xFC"," ","<Date","(comb"," Decide","\\Field"," Proposed","Rib"," dislikes"," Wien"," Document"," traf"," storia"," Tells","')==","Cri","(VALUE"," Burnett",",void"," danh"," ccp","Blockchain",':"-"`\n'],fu=["IClient","ISODE","Issuer",`)}\r
|
|
3240
3240
|
`,",but"," Uph","(Sub"," t\xE9l\xE9phone"," onDataChange"," marshaller","-analytics",",content"," debacle","_ValueChanged"," fauna"," #=>"," foyer","'utilisation"," M\xFCller"," Fetish"," defaultManager"," backtrack","Bah","Explicit","_ASCII"," mActivity","(Msg"," \uAC8C"," TERMS"," Angie","HSV"," Mosque",".Names","\uD2BC","reste","_parms"," gaping"," cropping","DataFrame"," responsiveness","_undo","_tran",".terminate"," italiane"," walkthrough"," attractiveness","\u0434\u0435","_STS","_learn"," chocolates","ierarchical","-thinking"," )))","ishments",".Logf"," TMZ"," Canary","foil"," Vaccine",".vx"," Surround","Intermediate"," iov","vais",`';";
|
|
3241
3241
|
`,`\uFF5E
|
|
3242
3242
|
|
|
@@ -3246,16 +3246,16 @@ import{b as te,c as Ss,d as Es,e as Pe}from"./chunk-AIYMQX7V.js";var Pd=te((Fi,R
|
|
|
3246
3246
|
`," spac"," rookies","(describing","ngen",[224,174,191,224,174],".rdf",".Mutex"," kneeling"," QE","setMax","ReadStream"," ventas","sut","cmpeq",".WriteAllText"," Experienced","$__"," kaum"," LIS"," documentos","_HEALTH","icontains"," artisans","OWNER"," blinked","getDisplay"," toen"," rowNum"," avril"," invis"," Kear","toBeInTheDocument","apur"," racked"," McMaster","_ATTRIB","Haz"," factura","/ts"," \u0440\u0430\u0437\u043C\u0435\u0440"," zf"," shortfall",".fasta"," CONSTANT",".managed","gems","SharedPointer"," blurry","brightness","(components",` ..."
|
|
3247
3247
|
|
|
3248
3248
|
`,"SELL"," Illustrator",".getChannel"," trouv\xE9","ysters"," vois"," Linden"," emojis"," brawl"," MSR"," Elo"," Croatian","PopupMenu","Lewis",".JWT"," astonished","Bush","(itemId"," detachment"," Encore","\u5C14"," rekl"," cram",")$/",".getHost","_recommend","-HT","_calibration","Authenticate",".firebaseapp","UNIX"," Camera"," HEAP","Ideal",".office"," goofy","(Symbol"," jouer","_partitions"," rapidement"," GNUNET","idUser"," supervise","(Contact","AWN","\u3058"," naam"," aust","\u5728\u7EBF","_softmax","AllowAnonymous","ammable","ROUTE","*D"," aden"," Cristina"," Cristiano"," bloodstream","subclass","_persona","CHILD","-know"," navigationOptions"," Zukunft"," Pixar","Tyler"," underworld"," sincerity"," dispenser"," kter","idders",".addNode","-checked"," keyst"," WTO",".signals"," adventurer"," Pang","\\R","=pos"," dispensaries"," Closet",'("{\\"',"ideon"," n\xE9cessaire",`()"
|
|
3249
|
-
`,"_RECEIVED"," r\xE9sultats"," moden"," Icelandic",";d",".allowed","(newUser"," merciless",".WaitFor"," daycare"," Conveyor"],Ff=mu.concat(hu);mu.length=0;hu.length=0;var gu=Ff;var Pn="all";var fu=r=>r<=127;function Ts(r){if(r.length===0)return!1;let e=r.charCodeAt(r.length-1);return e>=55296&&e<=56319}function Bf(r){let e=0;for(;e<r.length;){let t=r[e],a=0,n=0;if(t<=127)a=1,n=t;else if((t&224)===192){if(a=2,n=t&31,t<=193)return!1}else if((t&240)===224)a=3,n=t&15;else if((t&248)===240){if(a=4,n=t&7,t>244)return!1}else return!1;if(e+a>r.length)return!1;for(let i=1;i<a;i++){let o=r[e+i];if(o===void 0||(o&192)!==128)return!1;n=n<<6|o&63}if(a===2&&n<128||a===3&&n<2048||a===4&&n<65536||n>=55296&&n<=57343||n>1114111)return!1;e+=a}return!0}var Gf=new TextDecoder("utf8",{fatal:!1});function yu(r){if(Bf(r))return Gf.decode(r)}function bu(r,e){let t=Math.min(r.length,e.length);for(let a=0;a<t;a++)if(r[a]!==e[a])return r[a]-e[a];return r.length-e.length}function vu(r){let e=0;return r.forEach(t=>{e=Math.max(e,t)}),e}function xs(r){return r.replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")}function As(r){let t=[...r].map(xs).join("|");return new RegExp(`(${t})`)}var ui=new Uint8Array(0),Dn=new TextDecoder("utf8"),di=class{constructor({bytePairRankDecoder:e,specialTokensEncoder:t,tokenSplitRegex:a,mergeCacheSize:n=1e5}){Pe(this,"mergeableBytePairRankCount");Pe(this,"bytePairRankDecoder");Pe(this,"bytePairNonUtfRankDecoder",new Map);Pe(this,"bytePairNonUtfSortedEncoder");Pe(this,"bytePairStringRankEncoder");Pe(this,"tokenSplitRegex");Pe(this,"specialTokensEncoder");Pe(this,"specialTokensDecoder");Pe(this,"specialTokenPatternRegex");Pe(this,"textEncoder",new TextEncoder);Pe(this,"mergeCache");Pe(this,"mergeCacheSize");this.bytePairRankDecoder=e,this.bytePairStringRankEncoder=new Map,this.mergeCacheSize=n,n>0&&(this.mergeCache=new Map),this.mergeableBytePairRankCount=Object.keys(e).length;let i=[];e.forEach((l,c)=>{if(typeof l=="string"){this.bytePairStringRankEncoder.set(l,c);return}let u=new Uint8Array(l);i.push([u,c]),this.bytePairNonUtfRankDecoder.set(c,u)}),this.bytePairNonUtfSortedEncoder=i.sort((l,c)=>bu(l[0],c[0])),this.specialTokensEncoder=t??new Map,this.specialTokensDecoder=t?new Map([...t].map(([l,c])=>[c,l])):new Map,this.tokenSplitRegex=a;let s=[...this.specialTokensEncoder.keys()].map(xs).join("|");try{this.specialTokenPatternRegex=new RegExp(s,"y")}catch{throw new Error("Invalid regular expression pattern.")}}setMergeCacheSize(e){this.mergeCacheSize===0&&e>0&&(this.mergeCache=new Map),this.mergeCacheSize=e,e===0&&(this.mergeCache=void 0)}clearMergeCache(){this.mergeCache?.clear()}*encodeNativeGenerator(e,t){let a=0,n=0;for(;;){let i=this.findNextSpecialToken(e,t,a),o=i?.[0],s=o??e.length,l=a===0&&s===e.length?e:e.slice(a,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){n=1,yield[u];continue}let p=this.bytePairEncode(c);n=p.length,yield p}if(o!==void 0){let c=i[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);yield[u],a=o+c.length,n=1}else break}return n}encodeNative(e,t){let a=0,n=[];for(;;){let i=this.findNextSpecialToken(e,t,a),o=i?.[0],s=o??e.length,l=a===0&&s===e.length?e:e.slice(a,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){n.push(u);continue}let p=this.bytePairEncode(c);n.push(...p)}if(o!==void 0){let c=i[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);n.push(u),a=o+c.length}else break}return n}countNative(e,t){let a=0,n=0;for(;;){let i=this.findNextSpecialToken(e,t,a),o=i?.[0],s=o??e.length,l=a===0&&s===e.length?e:e.slice(a,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){if(this.getBpeRankFromString(c)!==void 0){n++;continue}let p=this.bytePairEncode(c);n+=p.length}if(o!==void 0){let c=i[1];if(this.specialTokensEncoder.get(c)===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);n++,a=o+c.length}else break}return n}*decodeNativeGenerator(e){for(let t of e){let a=this.tryDecodeToken(t);a&&(yield a)}}decodeNative(e){let t="",a=ui;for(let n of e){let i=this.tryDecodeToken(n);if(i===void 0)throw new Error(`Token ${n} is not in the byte pair encoder.`);if(typeof i=="string")a!==ui&&(t+=Dn.decode(a,{stream:!0}),a=ui),t+=i;else{let o=new Uint8Array(a.length+i.length);o.set(a),o.set(i,a.length),a=o}}return a!==ui&&(t+=Dn.decode(a,{stream:!0})),t}async*decodeNativeAsyncIterable(e){for await(let t of e){let a=this.tryDecodeToken(t);a&&(yield a)}}getBpeRankFromString(e){return this.bytePairStringRankEncoder.get(e)}getBpeRankFromStringOrThrow(e){let t=this.getBpeRankFromString(e);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e}`);return t}getBpeRankFromBytes(e){let t=yu(e);if(t!==void 0)return this.getBpeRankFromString(t);let a=this.binarySearch(e);if(a!==-1)return this.bytePairNonUtfSortedEncoder[a][1]}getBpeRankFromBytesOrThrow(e){let t=this.getBpeRankFromBytes(e);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e.toString()}`);return t}binarySearch(e){let t=0,a=this.bytePairNonUtfSortedEncoder.length-1;for(;t<=a;){let n=t+a>>>1,i=this.bytePairNonUtfSortedEncoder[n][0],o=0,s=Math.min(i.length,e.length);for(let l=0;l<s&&(o=i[l]-e[l],o===0);l++);if(o===0&&(o=i.length-e.length),o===0)return n;o<0?t=n+1:a=n-1}return-1}findNextSpecialToken(e,t,a){let n=a;for(;;){this.specialTokenPatternRegex.lastIndex=n;let i=this.specialTokenPatternRegex.exec(e);if(!i)return;let o=i[0];if(t?.has(o))return[i.index+n,o];n=i.index+n+1}}tryDecodeToken(e){let t=this.bytePairRankDecoder[e];if(typeof t=="string")return t;if(typeof t=="object"){let a=this.bytePairNonUtfRankDecoder.get(e);if(a)return a}return this.specialTokensDecoder.get(e)}addToMergeCache(e,t){if(this.mergeCache){if(this.mergeCache.size>=this.mergeCacheSize){let a=this.mergeCache.keys().next().value;this.mergeCache.delete(a)}this.mergeCache.set(e,t)}}bytePairEncode(e){if(e.length===1&&fu(e.codePointAt(0)))return[this.getBpeRankFromStringOrThrow(e)];if(this.mergeCache?.has(e)){let n=this.mergeCache.get(e);return this.mergeCache.delete(e),this.mergeCache.set(e,n),n}let t=this.textEncoder.encode(e),a=this.bytePairMerge(t);return this.addToMergeCache(e,a),a}bytePairMerge(e){let t=[],a=[],n=(o,s=t[o],l=t[o+2])=>{if(l===void 0)return Number.POSITIVE_INFINITY;let c=e.subarray(s,l);return this.getBpeRankFromBytes(c)??Number.POSITIVE_INFINITY};for(let o=0;o<=e.length;o++)t.push(o),o<e.length-1?a.push(n(o,o,o+2)):a.push(Number.POSITIVE_INFINITY);for(;t.length>1;){let o=Number.POSITIVE_INFINITY,s=-1;for(let l=0;l<a.length-1;l++){let c=a[l];c<o&&(o=c,s=l)}if(o===Number.POSITIVE_INFINITY||s===-1)break;t.splice(s+1,1),a.splice(s,1),a[s]=n(s),s>0&&(a[s-1]=n(s-1))}let i=[];for(let o=0;o<t.length-1;o++){let s=t[o],l=t[o+1],c=this.getBpeRankFromBytesOrThrow(e.subarray(s,l));i.push(c)}return i}};var _u={humanName:"GPT-4o (Aug 2024)",description:"Our high-intelligence flagship model for complex, multi-step tasks. GPT-4o is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-08-06.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},Uf={humanName:"GPT-4o (Nov 2024)",description:"November 2024 snapshot of the GPT-4o model with enhanced capabilities.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},Hf={humanName:"GPT-4o",description:"Original gpt-4o snapshot from May 13, 2024, offering advanced multimodal capabilities.",encoding:"o200k_base",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:15,batchInput:2.5,batchOutput:7.5}},Su={humanName:"GPT-4o Mini",description:"Our affordable and intelligent small model for fast, lightweight tasks. GPT-4o mini is cheaper and more capable than GPT-3.5 Turbo. Currently points to gpt-4o-mini-2024-07-18.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6,batchInput:.075,batchOutput:.3,cachedInput:.075}},Eu={humanName:"OpenAI o1",description:"Our most intelligent model, optimal for complex tasks requiring deep understanding and expertise. Currently points to o1-2024-12-17.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},wu={humanName:"OpenAI o1-preview",description:"Preview version of the o1 model: o1-preview-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},Cu={humanName:"OpenAI o1-mini",description:"Points to the most recent o1-mini snapshot: o1-mini-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},Vf={humanName:"OpenAI o3-mini",description:"Small cost-efficient reasoning model that's optimized for coding, math, and science, and supports tools and Structured Outputs.",encoding:"o200k_base",context:2e5,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},Wf={humanName:"Text Embedding 3 Small",description:"Embedding model for small-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.02,batchInput:.01}},jf={humanName:"Text Embedding 3 Large",description:"Embedding model for large-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.13,batchInput:.065}},qf={humanName:"Ada v2",description:"A versatile model suitable for text embeddings and lightweight NLP tasks.",encoding:"cl100k_base",maxInput:8191,cost:{input:.1,output:0,batchInput:.05,batchOutput:0}},Kf={humanName:"GPT-4o Realtime Preview",encoding:"o200k_base",description:"Preview release for the Realtime API.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},$f={humanName:"GPT-4o Realtime Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},Xf={humanName:"GPT-4o Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},ku={humanName:"GPT-4o Mini Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Realtime API with December 2024 snapshot.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:.6,output:2.4,cachedInput:.3}},Yf={humanName:"GPT-4o Audio Preview",encoding:"o200k_base",description:"Preview release for audio inputs in chat completions.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},Zf={humanName:"GPT-4o Audio Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},Jf={humanName:"GPT-4o Audio Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},Tu={humanName:"GPT-4o Mini Audio Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Audio API with December 2024 snapshot.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6}},Qf={humanName:"GPT-4o 2024-08-06 Finetuning",description:"GPT-4o finetuned for custom tasks.",encoding:"o200k_base",cost:{input:3.75,output:15,batchInput:1.875,batchOutput:7.5,cachedInput:1.875,training:25}},ey={humanName:"GPT-4o Mini 2024-07-18 Finetuning",description:"GPT-4o mini finetuned for custom tasks.",encoding:"o200k_base",cost:{input:.3,output:1.2,batchInput:.15,batchOutput:.6,cachedInput:.15,training:3}},ty={humanName:"GPT-3.5 Turbo Finetuning",description:"Finetuning GPT-3.5 Turbo with custom data.",encoding:"cl100k_base",cost:{input:3,output:6,batchInput:1.5,batchOutput:3,training:8}},xu={humanName:"GPT-4o Mini Training",description:"Training GPT-4o Mini with custom datasets.",encoding:"o200k_base",cost:{input:3,output:0,batchInput:1.5,batchOutput:0}},ry={humanName:"GPT-3.5 Turbo 16k",description:"GPT-3.5 model with 16k token context.",encoding:"cl100k_base",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},Au={humanName:"GPT-4 Turbo 2024-04-09",description:"The latest GPT-4 Turbo model with vision capabilities. Vision requests can now use JSON mode and function calling. Currently points to gpt-4-turbo-2024-04-09.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},ny={humanName:"ChatGPT 4o Latest",description:"The chatgpt-4o-latest model version continuously points to the version of GPT-4o used in ChatGPT, and is updated frequently when there are significant changes.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:5,output:15}},Iu={humanName:"GPT-4",description:"Currently points to gpt-4-0613. See continuous model upgrades.",encoding:"cl100k_base",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60,batchInput:15,batchOutput:30}},Is={humanName:"GPT-4 0125 Preview",description:"GPT-4 Turbo preview model intended to reduce cases of \u201Claziness\u201D where the model doesn\u2019t complete a task.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},ay={...Is,humanName:"GPT-4 1106 Preview"},Ru={humanName:"GPT-3.5 Turbo 0125",description:"The latest GPT-3.5 Turbo model with higher accuracy at responding in requested formats and a fix for a bug which caused a text encoding issue for non-English language function calls.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:.5,output:1.5,batchInput:.25,batchOutput:.75}},Pu={humanName:"GPT-3.5 Turbo Instruct",description:"Similar capabilities as GPT-3 era models. Compatible with legacy Completions endpoint and not Chat Completions.",encoding:"cl100k_base",context:4096,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2}},iy={humanName:"GPT-3.5 Turbo 1106",description:"GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1,output:2,batchInput:.5,batchOutput:1}},oy={humanName:"Davinci 002",description:"Replacement for the GPT-3 curie and davinci base models.",encoding:"p50k_base",context:16384,maxOutput:16384,trainingData:"2021-09",cost:{input:2,output:2,batchInput:1,batchOutput:1}},sy={humanName:"Davinci-002 Finetuning",description:"Davinci-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:12,output:12,batchInput:6,batchOutput:6,training:6}},ly={humanName:"Babbage 002",description:"Replacement for the GPT-3 ada and babbage base models.",encoding:"p50k_base",context:16384,trainingData:"2021-09",cost:{input:.4,output:.4,batchInput:.2,batchOutput:.2}},cy={humanName:"Babbage-002 Finetuning",description:"Babbage-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:1.6,output:1.6,batchInput:.8,batchOutput:.8,training:.4}},Rs={humanName:"GPT-4 32k",encoding:"cl100k_base",description:"Snapshot of gpt-4 from June 13th 2023 with improved function calling support.",shutdownDate:"2025-06-06",recommendedReplacement:"gpt-4o",context:32768,maxOutput:16384,trainingData:"2021-09",cost:{input:60,output:120,batchInput:30,batchOutput:60}},Ou={humanName:"GPT-4 Vision Preview",encoding:"cl100k_base",description:"Vision capabilities preview of GPT-4.",shutdownDate:"2024-12-06",recommendedReplacement:"gpt-4o",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},uy=Ou,dy={humanName:"GPT-3.5 Turbo 0613",encoding:"cl100k_base",description:"Version of GPT-3.5 Turbo from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},py={humanName:"GPT-3.5 Turbo 16k 0613",encoding:"cl100k_base",description:"16k context version from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},my={humanName:"Text Ada 001",encoding:"r50k_base",description:"Model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.4}},hy={humanName:"Text Babbage 001",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.5}},gy={humanName:"Text Curie 001",encoding:"r50k_base",description:"Mid-range model for various tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:2}},fy={humanName:"Text Davinci 001",encoding:"r50k_base",description:"High-performance model for complex tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},yy={humanName:"Text Davinci 002",encoding:"p50k_base",description:"Legacy high-performance model.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},by={humanName:"Text Davinci 003",encoding:"p50k_base",description:"Latest of the Davinci series.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},vy={humanName:"Ada",encoding:"r50k_base",description:"Base model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.4}},_y={humanName:"Babbage",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.5}},Sy={humanName:"Curie",encoding:"r50k_base",description:"Mid-range model for a variety of applications.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:2}},Ey={humanName:"Davinci",encoding:"p50k_base",description:"High-performance legacy model.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:20}},wy={humanName:"Code Davinci 002",encoding:"p50k_base",description:"Legacy coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Du={humanName:"Code Davinci 001",encoding:"p50k_base",description:"Older coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Cy={humanName:"Code Davinci 001",encoding:"p50k_edit",description:"Older coding model.",shutdownDate:"2023-03-23"},ky={humanName:"Code Cushman 002",encoding:"p50k_base",description:"Legacy model for coding.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Nu={humanName:"Code Cushman 001",encoding:"p50k_base",description:"Older model for coding tasks.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Ty={humanName:"GPT-4 0314",encoding:"cl100k_base",description:"Variant of GPT-4 model.",shutdownDate:"2024-06-13",recommendedReplacement:"gpt-4o",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60}},xy={humanName:"GPT-3.5 Turbo 0301",encoding:"cl100k_base",description:"Earlier version of GPT-3.5 Turbo.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},Ay={...Rs,humanName:"GPT-4 32k 0314"},Iy={humanName:"Text Similarity Ada 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Ry={humanName:"Text Search Ada Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Py={humanName:"Text Search Ada Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Dy={humanName:"Code Search Ada Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Ny={humanName:"Code Search Ada Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Oy={humanName:"Text Davinci 001",encoding:"p50k_edit",description:"Older text model.",shutdownDate:"2023-03-23"},Ly={humanName:"Text Similarity Babbage 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},My={humanName:"Text Search Babbage Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},Fy={humanName:"Text Search Babbage Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},By={humanName:"Code Search Babbage Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},Gy={humanName:"Code Search Babbage Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},zy={humanName:"Text Similarity Curie 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},Uy={humanName:"Text Search Curie Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},Hy={humanName:"Text Search Curie Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},Vy={humanName:"Text Similarity Davinci 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},Wy={humanName:"Text Search Davinci Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},jy={humanName:"Text Search Davinci Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},Ps={o1:Eu,"o1-2024-12-17":Eu,"o1-preview":wu,"o1-preview-2024-09-12":wu,"o1-mini":Cu,"o1-mini-2024-09-12":Cu,"o3-mini":Vf,"chatgpt-4o-latest":ny,"gpt-4o":_u,"gpt-4o-2024-11-20":Uf,"gpt-4o-2024-08-06":_u,"gpt-4o-2024-05-13":Hf,"gpt-4o-mini":Su,"gpt-4o-mini-2024-07-18":Su,"gpt-4o-realtime-preview":Kf,"gpt-4o-realtime-preview-2024-10-01":$f,"gpt-4o-realtime-preview-2024-12-17":Xf,"gpt-4o-mini-realtime-preview":ku,"gpt-4o-mini-realtime-preview-2024-12-17":ku,"gpt-4o-audio-preview":Yf,"gpt-4o-audio-preview-2024-10-01":Zf,"gpt-4o-audio-preview-2024-12-17":Jf,"gpt-4o-mini-audio-preview":Tu,"gpt-4o-mini-audio-preview-2024-12-17":Tu,"gpt-4o-2024-08-06-finetune":Qf,"gpt-4o-mini-2024-07-18-finetune":ey,"gpt-4o-mini-training":xu,"gpt-4o-mini-training-2024-07-18":xu,"davinci-002-finetune":sy,"babbage-002-finetune":cy,"gpt-4-turbo":Au,"gpt-4-turbo-2024-04-09":Au,"gpt-4-turbo-preview":Is,"gpt-4-0125-preview":Is,"gpt-4-1106-preview":ay,"gpt-4":Iu,"gpt-4-0613":Iu,"gpt-3.5-turbo":Ru,"gpt-3.5-turbo-0125":Ru,"gpt-3.5-turbo-1106":iy,"gpt-3.5-turbo-finetune":ty,"gpt-3.5-turbo-16k":ry,"gpt-4-32k":Rs,"gpt-4-32k-0613":Rs,"gpt-4-vision-preview":Ou,"gpt-4-1106-vision-preview":uy,"gpt-4-0314":Ty,"gpt-4-32k-0314":Ay,"gpt-3.5-turbo-0613":dy,"gpt-3.5-turbo-16k-0613":py,"gpt-3.5-turbo-0301":xy},pi={...Ps,"text-embedding-3-small":Wf,"text-embedding-3-large":jf,"text-embedding-ada-002":qf,"gpt-3.5-turbo-instruct":Pu,"gpt-3.5-turbo-instruct-0914":Pu,"davinci-002":oy,"babbage-002":ly,"text-ada-001":my,"text-babbage-001":hy,"text-curie-001":gy,"text-davinci-001":fy,"text-davinci-002":yy,"text-davinci-003":by,ada:vy,babbage:_y,curie:Sy,davinci:Ey,"code-davinci-002":wy,"code-davinci-001":Du,"davinci-codex":Du,"code-davinci-edit-001":Cy,"code-cushman-002":ky,"code-cushman-001":Nu,"cushman-codex":Nu,"code-search-ada-code-001":Dy,"code-search-ada-text-001":Ny,"text-davinci-edit-001":Oy,"text-similarity-ada-001":Iy,"text-search-ada-doc-001":Ry,"text-search-ada-query-001":Py,"text-similarity-babbage-001":Ly,"text-search-babbage-doc-001":My,"text-search-babbage-query-001":Fy,"code-search-babbage-code-001":By,"code-search-babbage-text-001":Gy,"text-similarity-curie-001":zy,"text-search-curie-doc-001":Uy,"text-search-curie-query-001":Hy,"text-similarity-davinci-001":Vy,"text-search-davinci-doc-001":Wy,"text-search-davinci-query-001":jy};var Ot="<|endoftext|>",Er="<|fim_prefix|>",wr="<|fim_middle|>",Cr="<|fim_suffix|>",Nn="<|im_start|>",On="<|im_end|>",kr="<|im_sep|>",Ln="<|endofprompt|>";var Lu=Object.fromEntries(Object.entries(Ps).map(([r,e])=>[r,e.encoding])),Mu=Object.fromEntries(Object.entries(pi).map(([r,e])=>[r,e.encoding])),qy={messageSeparator:`
|
|
3249
|
+
`,"_RECEIVED"," r\xE9sultats"," moden"," Icelandic",";d",".allowed","(newUser"," merciless",".WaitFor"," daycare"," Conveyor"],zf=gu.concat(fu);gu.length=0;fu.length=0;var yu=zf;var Nn="all";var bu=r=>r<=127;function As(r){if(r.length===0)return!1;let e=r.charCodeAt(r.length-1);return e>=55296&&e<=56319}function Uf(r){let e=0;for(;e<r.length;){let t=r[e],a=0,n=0;if(t<=127)a=1,n=t;else if((t&224)===192){if(a=2,n=t&31,t<=193)return!1}else if((t&240)===224)a=3,n=t&15;else if((t&248)===240){if(a=4,n=t&7,t>244)return!1}else return!1;if(e+a>r.length)return!1;for(let i=1;i<a;i++){let o=r[e+i];if(o===void 0||(o&192)!==128)return!1;n=n<<6|o&63}if(a===2&&n<128||a===3&&n<2048||a===4&&n<65536||n>=55296&&n<=57343||n>1114111)return!1;e+=a}return!0}var Hf=new TextDecoder("utf8",{fatal:!1});function vu(r){if(Uf(r))return Hf.decode(r)}function _u(r,e){let t=Math.min(r.length,e.length);for(let a=0;a<t;a++)if(r[a]!==e[a])return r[a]-e[a];return r.length-e.length}function Su(r){let e=0;return r.forEach(t=>{e=Math.max(e,t)}),e}function Is(r){return r.replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")}function Rs(r){let t=[...r].map(Is).join("|");return new RegExp(`(${t})`)}var pi=new Uint8Array(0),On=new TextDecoder("utf8"),mi=class{constructor({bytePairRankDecoder:e,specialTokensEncoder:t,tokenSplitRegex:a,mergeCacheSize:n=1e5}){Pe(this,"mergeableBytePairRankCount");Pe(this,"bytePairRankDecoder");Pe(this,"bytePairNonUtfRankDecoder",new Map);Pe(this,"bytePairNonUtfSortedEncoder");Pe(this,"bytePairStringRankEncoder");Pe(this,"tokenSplitRegex");Pe(this,"specialTokensEncoder");Pe(this,"specialTokensDecoder");Pe(this,"specialTokenPatternRegex");Pe(this,"textEncoder",new TextEncoder);Pe(this,"mergeCache");Pe(this,"mergeCacheSize");this.bytePairRankDecoder=e,this.bytePairStringRankEncoder=new Map,this.mergeCacheSize=n,n>0&&(this.mergeCache=new Map),this.mergeableBytePairRankCount=Object.keys(e).length;let i=[];e.forEach((l,c)=>{if(typeof l=="string"){this.bytePairStringRankEncoder.set(l,c);return}let u=new Uint8Array(l);i.push([u,c]),this.bytePairNonUtfRankDecoder.set(c,u)}),this.bytePairNonUtfSortedEncoder=i.sort((l,c)=>_u(l[0],c[0])),this.specialTokensEncoder=t??new Map,this.specialTokensDecoder=t?new Map([...t].map(([l,c])=>[c,l])):new Map,this.tokenSplitRegex=a;let s=[...this.specialTokensEncoder.keys()].map(Is).join("|");try{this.specialTokenPatternRegex=new RegExp(s,"y")}catch{throw new Error("Invalid regular expression pattern.")}}setMergeCacheSize(e){this.mergeCacheSize===0&&e>0&&(this.mergeCache=new Map),this.mergeCacheSize=e,e===0&&(this.mergeCache=void 0)}clearMergeCache(){this.mergeCache?.clear()}*encodeNativeGenerator(e,t){let a=0,n=0;for(;;){let i=this.findNextSpecialToken(e,t,a),o=i?.[0],s=o??e.length,l=a===0&&s===e.length?e:e.slice(a,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){n=1,yield[u];continue}let p=this.bytePairEncode(c);n=p.length,yield p}if(o!==void 0){let c=i[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);yield[u],a=o+c.length,n=1}else break}return n}encodeNative(e,t){let a=0,n=[];for(;;){let i=this.findNextSpecialToken(e,t,a),o=i?.[0],s=o??e.length,l=a===0&&s===e.length?e:e.slice(a,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){n.push(u);continue}let p=this.bytePairEncode(c);n.push(...p)}if(o!==void 0){let c=i[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);n.push(u),a=o+c.length}else break}return n}countNative(e,t){let a=0,n=0;for(;;){let i=this.findNextSpecialToken(e,t,a),o=i?.[0],s=o??e.length,l=a===0&&s===e.length?e:e.slice(a,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){if(this.getBpeRankFromString(c)!==void 0){n++;continue}let p=this.bytePairEncode(c);n+=p.length}if(o!==void 0){let c=i[1];if(this.specialTokensEncoder.get(c)===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);n++,a=o+c.length}else break}return n}*decodeNativeGenerator(e){for(let t of e){let a=this.tryDecodeToken(t);a&&(yield a)}}decodeNative(e){let t="",a=pi;for(let n of e){let i=this.tryDecodeToken(n);if(i===void 0)throw new Error(`Token ${n} is not in the byte pair encoder.`);if(typeof i=="string")a!==pi&&(t+=On.decode(a,{stream:!0}),a=pi),t+=i;else{let o=new Uint8Array(a.length+i.length);o.set(a),o.set(i,a.length),a=o}}return a!==pi&&(t+=On.decode(a,{stream:!0})),t}async*decodeNativeAsyncIterable(e){for await(let t of e){let a=this.tryDecodeToken(t);a&&(yield a)}}getBpeRankFromString(e){return this.bytePairStringRankEncoder.get(e)}getBpeRankFromStringOrThrow(e){let t=this.getBpeRankFromString(e);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e}`);return t}getBpeRankFromBytes(e){let t=vu(e);if(t!==void 0)return this.getBpeRankFromString(t);let a=this.binarySearch(e);if(a!==-1)return this.bytePairNonUtfSortedEncoder[a][1]}getBpeRankFromBytesOrThrow(e){let t=this.getBpeRankFromBytes(e);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e.toString()}`);return t}binarySearch(e){let t=0,a=this.bytePairNonUtfSortedEncoder.length-1;for(;t<=a;){let n=t+a>>>1,i=this.bytePairNonUtfSortedEncoder[n][0],o=0,s=Math.min(i.length,e.length);for(let l=0;l<s&&(o=i[l]-e[l],o===0);l++);if(o===0&&(o=i.length-e.length),o===0)return n;o<0?t=n+1:a=n-1}return-1}findNextSpecialToken(e,t,a){let n=a;for(;;){this.specialTokenPatternRegex.lastIndex=n;let i=this.specialTokenPatternRegex.exec(e);if(!i)return;let o=i[0];if(t?.has(o))return[i.index+n,o];n=i.index+n+1}}tryDecodeToken(e){let t=this.bytePairRankDecoder[e];if(typeof t=="string")return t;if(typeof t=="object"){let a=this.bytePairNonUtfRankDecoder.get(e);if(a)return a}return this.specialTokensDecoder.get(e)}addToMergeCache(e,t){if(this.mergeCache){if(this.mergeCache.size>=this.mergeCacheSize){let a=this.mergeCache.keys().next().value;this.mergeCache.delete(a)}this.mergeCache.set(e,t)}}bytePairEncode(e){if(e.length===1&&bu(e.codePointAt(0)))return[this.getBpeRankFromStringOrThrow(e)];if(this.mergeCache?.has(e)){let n=this.mergeCache.get(e);return this.mergeCache.delete(e),this.mergeCache.set(e,n),n}let t=this.textEncoder.encode(e),a=this.bytePairMerge(t);return this.addToMergeCache(e,a),a}bytePairMerge(e){let t=[],a=[],n=(o,s=t[o],l=t[o+2])=>{if(l===void 0)return Number.POSITIVE_INFINITY;let c=e.subarray(s,l);return this.getBpeRankFromBytes(c)??Number.POSITIVE_INFINITY};for(let o=0;o<=e.length;o++)t.push(o),o<e.length-1?a.push(n(o,o,o+2)):a.push(Number.POSITIVE_INFINITY);for(;t.length>1;){let o=Number.POSITIVE_INFINITY,s=-1;for(let l=0;l<a.length-1;l++){let c=a[l];c<o&&(o=c,s=l)}if(o===Number.POSITIVE_INFINITY||s===-1)break;t.splice(s+1,1),a.splice(s,1),a[s]=n(s),s>0&&(a[s-1]=n(s-1))}let i=[];for(let o=0;o<t.length-1;o++){let s=t[o],l=t[o+1],c=this.getBpeRankFromBytesOrThrow(e.subarray(s,l));i.push(c)}return i}};var Eu={humanName:"GPT-4o (Aug 2024)",description:"Our high-intelligence flagship model for complex, multi-step tasks. GPT-4o is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-08-06.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},Wf={humanName:"GPT-4o (Nov 2024)",description:"November 2024 snapshot of the GPT-4o model with enhanced capabilities.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},jf={humanName:"GPT-4o",description:"Original gpt-4o snapshot from May 13, 2024, offering advanced multimodal capabilities.",encoding:"o200k_base",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:15,batchInput:2.5,batchOutput:7.5}},wu={humanName:"GPT-4o Mini",description:"Our affordable and intelligent small model for fast, lightweight tasks. GPT-4o mini is cheaper and more capable than GPT-3.5 Turbo. Currently points to gpt-4o-mini-2024-07-18.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6,batchInput:.075,batchOutput:.3,cachedInput:.075}},Cu={humanName:"OpenAI o1",description:"Our most intelligent model, optimal for complex tasks requiring deep understanding and expertise. Currently points to o1-2024-12-17.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},ku={humanName:"OpenAI o1-preview",description:"Preview version of the o1 model: o1-preview-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},Tu={humanName:"OpenAI o1-mini",description:"Points to the most recent o1-mini snapshot: o1-mini-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},qf={humanName:"OpenAI o3-mini",description:"Small cost-efficient reasoning model that's optimized for coding, math, and science, and supports tools and Structured Outputs.",encoding:"o200k_base",context:2e5,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},Kf={humanName:"Text Embedding 3 Small",description:"Embedding model for small-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.02,batchInput:.01}},$f={humanName:"Text Embedding 3 Large",description:"Embedding model for large-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.13,batchInput:.065}},Xf={humanName:"Ada v2",description:"A versatile model suitable for text embeddings and lightweight NLP tasks.",encoding:"cl100k_base",maxInput:8191,cost:{input:.1,output:0,batchInput:.05,batchOutput:0}},Yf={humanName:"GPT-4o Realtime Preview",encoding:"o200k_base",description:"Preview release for the Realtime API.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},Zf={humanName:"GPT-4o Realtime Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},Jf={humanName:"GPT-4o Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},xu={humanName:"GPT-4o Mini Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Realtime API with December 2024 snapshot.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:.6,output:2.4,cachedInput:.3}},Qf={humanName:"GPT-4o Audio Preview",encoding:"o200k_base",description:"Preview release for audio inputs in chat completions.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},ey={humanName:"GPT-4o Audio Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},ty={humanName:"GPT-4o Audio Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},Au={humanName:"GPT-4o Mini Audio Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Audio API with December 2024 snapshot.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6}},ry={humanName:"GPT-4o 2024-08-06 Finetuning",description:"GPT-4o finetuned for custom tasks.",encoding:"o200k_base",cost:{input:3.75,output:15,batchInput:1.875,batchOutput:7.5,cachedInput:1.875,training:25}},ny={humanName:"GPT-4o Mini 2024-07-18 Finetuning",description:"GPT-4o mini finetuned for custom tasks.",encoding:"o200k_base",cost:{input:.3,output:1.2,batchInput:.15,batchOutput:.6,cachedInput:.15,training:3}},ay={humanName:"GPT-3.5 Turbo Finetuning",description:"Finetuning GPT-3.5 Turbo with custom data.",encoding:"cl100k_base",cost:{input:3,output:6,batchInput:1.5,batchOutput:3,training:8}},Iu={humanName:"GPT-4o Mini Training",description:"Training GPT-4o Mini with custom datasets.",encoding:"o200k_base",cost:{input:3,output:0,batchInput:1.5,batchOutput:0}},iy={humanName:"GPT-3.5 Turbo 16k",description:"GPT-3.5 model with 16k token context.",encoding:"cl100k_base",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},Ru={humanName:"GPT-4 Turbo 2024-04-09",description:"The latest GPT-4 Turbo model with vision capabilities. Vision requests can now use JSON mode and function calling. Currently points to gpt-4-turbo-2024-04-09.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},oy={humanName:"ChatGPT 4o Latest",description:"The chatgpt-4o-latest model version continuously points to the version of GPT-4o used in ChatGPT, and is updated frequently when there are significant changes.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:5,output:15}},Pu={humanName:"GPT-4",description:"Currently points to gpt-4-0613. See continuous model upgrades.",encoding:"cl100k_base",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60,batchInput:15,batchOutput:30}},Ps={humanName:"GPT-4 0125 Preview",description:"GPT-4 Turbo preview model intended to reduce cases of \u201Claziness\u201D where the model doesn\u2019t complete a task.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},sy={...Ps,humanName:"GPT-4 1106 Preview"},Du={humanName:"GPT-3.5 Turbo 0125",description:"The latest GPT-3.5 Turbo model with higher accuracy at responding in requested formats and a fix for a bug which caused a text encoding issue for non-English language function calls.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:.5,output:1.5,batchInput:.25,batchOutput:.75}},Nu={humanName:"GPT-3.5 Turbo Instruct",description:"Similar capabilities as GPT-3 era models. Compatible with legacy Completions endpoint and not Chat Completions.",encoding:"cl100k_base",context:4096,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2}},ly={humanName:"GPT-3.5 Turbo 1106",description:"GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1,output:2,batchInput:.5,batchOutput:1}},cy={humanName:"Davinci 002",description:"Replacement for the GPT-3 curie and davinci base models.",encoding:"p50k_base",context:16384,maxOutput:16384,trainingData:"2021-09",cost:{input:2,output:2,batchInput:1,batchOutput:1}},uy={humanName:"Davinci-002 Finetuning",description:"Davinci-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:12,output:12,batchInput:6,batchOutput:6,training:6}},dy={humanName:"Babbage 002",description:"Replacement for the GPT-3 ada and babbage base models.",encoding:"p50k_base",context:16384,trainingData:"2021-09",cost:{input:.4,output:.4,batchInput:.2,batchOutput:.2}},py={humanName:"Babbage-002 Finetuning",description:"Babbage-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:1.6,output:1.6,batchInput:.8,batchOutput:.8,training:.4}},Ds={humanName:"GPT-4 32k",encoding:"cl100k_base",description:"Snapshot of gpt-4 from June 13th 2023 with improved function calling support.",shutdownDate:"2025-06-06",recommendedReplacement:"gpt-4o",context:32768,maxOutput:16384,trainingData:"2021-09",cost:{input:60,output:120,batchInput:30,batchOutput:60}},Mu={humanName:"GPT-4 Vision Preview",encoding:"cl100k_base",description:"Vision capabilities preview of GPT-4.",shutdownDate:"2024-12-06",recommendedReplacement:"gpt-4o",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},my=Mu,hy={humanName:"GPT-3.5 Turbo 0613",encoding:"cl100k_base",description:"Version of GPT-3.5 Turbo from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},gy={humanName:"GPT-3.5 Turbo 16k 0613",encoding:"cl100k_base",description:"16k context version from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},fy={humanName:"Text Ada 001",encoding:"r50k_base",description:"Model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.4}},yy={humanName:"Text Babbage 001",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.5}},by={humanName:"Text Curie 001",encoding:"r50k_base",description:"Mid-range model for various tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:2}},vy={humanName:"Text Davinci 001",encoding:"r50k_base",description:"High-performance model for complex tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},_y={humanName:"Text Davinci 002",encoding:"p50k_base",description:"Legacy high-performance model.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},Sy={humanName:"Text Davinci 003",encoding:"p50k_base",description:"Latest of the Davinci series.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},Ey={humanName:"Ada",encoding:"r50k_base",description:"Base model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.4}},wy={humanName:"Babbage",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.5}},Cy={humanName:"Curie",encoding:"r50k_base",description:"Mid-range model for a variety of applications.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:2}},ky={humanName:"Davinci",encoding:"p50k_base",description:"High-performance legacy model.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:20}},Ty={humanName:"Code Davinci 002",encoding:"p50k_base",description:"Legacy coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Ou={humanName:"Code Davinci 001",encoding:"p50k_base",description:"Older coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},xy={humanName:"Code Davinci 001",encoding:"p50k_edit",description:"Older coding model.",shutdownDate:"2023-03-23"},Ay={humanName:"Code Cushman 002",encoding:"p50k_base",description:"Legacy model for coding.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Lu={humanName:"Code Cushman 001",encoding:"p50k_base",description:"Older model for coding tasks.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Iy={humanName:"GPT-4 0314",encoding:"cl100k_base",description:"Variant of GPT-4 model.",shutdownDate:"2024-06-13",recommendedReplacement:"gpt-4o",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60}},Ry={humanName:"GPT-3.5 Turbo 0301",encoding:"cl100k_base",description:"Earlier version of GPT-3.5 Turbo.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},Py={...Ds,humanName:"GPT-4 32k 0314"},Dy={humanName:"Text Similarity Ada 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Ny={humanName:"Text Search Ada Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Oy={humanName:"Text Search Ada Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Ly={humanName:"Code Search Ada Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},My={humanName:"Code Search Ada Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Fy={humanName:"Text Davinci 001",encoding:"p50k_edit",description:"Older text model.",shutdownDate:"2023-03-23"},By={humanName:"Text Similarity Babbage 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},Gy={humanName:"Text Search Babbage Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},zy={humanName:"Text Search Babbage Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},Uy={humanName:"Code Search Babbage Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},Hy={humanName:"Code Search Babbage Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},Vy={humanName:"Text Similarity Curie 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},Wy={humanName:"Text Search Curie Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},jy={humanName:"Text Search Curie Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},qy={humanName:"Text Similarity Davinci 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},Ky={humanName:"Text Search Davinci Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},$y={humanName:"Text Search Davinci Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},Ns={o1:Cu,"o1-2024-12-17":Cu,"o1-preview":ku,"o1-preview-2024-09-12":ku,"o1-mini":Tu,"o1-mini-2024-09-12":Tu,"o3-mini":qf,"chatgpt-4o-latest":oy,"gpt-4o":Eu,"gpt-4o-2024-11-20":Wf,"gpt-4o-2024-08-06":Eu,"gpt-4o-2024-05-13":jf,"gpt-4o-mini":wu,"gpt-4o-mini-2024-07-18":wu,"gpt-4o-realtime-preview":Yf,"gpt-4o-realtime-preview-2024-10-01":Zf,"gpt-4o-realtime-preview-2024-12-17":Jf,"gpt-4o-mini-realtime-preview":xu,"gpt-4o-mini-realtime-preview-2024-12-17":xu,"gpt-4o-audio-preview":Qf,"gpt-4o-audio-preview-2024-10-01":ey,"gpt-4o-audio-preview-2024-12-17":ty,"gpt-4o-mini-audio-preview":Au,"gpt-4o-mini-audio-preview-2024-12-17":Au,"gpt-4o-2024-08-06-finetune":ry,"gpt-4o-mini-2024-07-18-finetune":ny,"gpt-4o-mini-training":Iu,"gpt-4o-mini-training-2024-07-18":Iu,"davinci-002-finetune":uy,"babbage-002-finetune":py,"gpt-4-turbo":Ru,"gpt-4-turbo-2024-04-09":Ru,"gpt-4-turbo-preview":Ps,"gpt-4-0125-preview":Ps,"gpt-4-1106-preview":sy,"gpt-4":Pu,"gpt-4-0613":Pu,"gpt-3.5-turbo":Du,"gpt-3.5-turbo-0125":Du,"gpt-3.5-turbo-1106":ly,"gpt-3.5-turbo-finetune":ay,"gpt-3.5-turbo-16k":iy,"gpt-4-32k":Ds,"gpt-4-32k-0613":Ds,"gpt-4-vision-preview":Mu,"gpt-4-1106-vision-preview":my,"gpt-4-0314":Iy,"gpt-4-32k-0314":Py,"gpt-3.5-turbo-0613":hy,"gpt-3.5-turbo-16k-0613":gy,"gpt-3.5-turbo-0301":Ry},hi={...Ns,"text-embedding-3-small":Kf,"text-embedding-3-large":$f,"text-embedding-ada-002":Xf,"gpt-3.5-turbo-instruct":Nu,"gpt-3.5-turbo-instruct-0914":Nu,"davinci-002":cy,"babbage-002":dy,"text-ada-001":fy,"text-babbage-001":yy,"text-curie-001":by,"text-davinci-001":vy,"text-davinci-002":_y,"text-davinci-003":Sy,ada:Ey,babbage:wy,curie:Cy,davinci:ky,"code-davinci-002":Ty,"code-davinci-001":Ou,"davinci-codex":Ou,"code-davinci-edit-001":xy,"code-cushman-002":Ay,"code-cushman-001":Lu,"cushman-codex":Lu,"code-search-ada-code-001":Ly,"code-search-ada-text-001":My,"text-davinci-edit-001":Fy,"text-similarity-ada-001":Dy,"text-search-ada-doc-001":Ny,"text-search-ada-query-001":Oy,"text-similarity-babbage-001":By,"text-search-babbage-doc-001":Gy,"text-search-babbage-query-001":zy,"code-search-babbage-code-001":Uy,"code-search-babbage-text-001":Hy,"text-similarity-curie-001":Vy,"text-search-curie-doc-001":Wy,"text-search-curie-query-001":jy,"text-similarity-davinci-001":qy,"text-search-davinci-doc-001":Ky,"text-search-davinci-query-001":$y};var Mt="<|endoftext|>",kr="<|fim_prefix|>",Tr="<|fim_middle|>",xr="<|fim_suffix|>",Ln="<|im_start|>",Mn="<|im_end|>",Ar="<|im_sep|>",Fn="<|endofprompt|>";var Fu=Object.fromEntries(Object.entries(Ns).map(([r,e])=>[r,e.encoding])),Bu=Object.fromEntries(Object.entries(hi).map(([r,e])=>[r,e.encoding])),Xy={messageSeparator:`
|
|
3250
3250
|
`,roleSeparator:`
|
|
3251
|
-
`},
|
|
3252
|
-
`;this.itemPadding=0;this.sortFunction=(e,t)=>e.sortOrder!==t.sortOrder?e.sortOrder-t.sortOrder:e.dateAdded!==t.dateAdded?e.dateAdded-t.dateAdded:e.content.localeCompare(t.content)}setItemPadding(e){return this.itemPadding=e,this.recalculateTokens(),this}sortBy(e){return this.sortFunction=e,this.items.sort(this.sortFunction),this}setSeparator(e){return this.separator==e?this:(this.separator=e,this.recalculateTokens(),this)}setWeight(e){return this.weight=e,this}recalculateTokens(){this.tokenCount=this.items.reduce((e,t)=>(t.tokenCount
|
|
3251
|
+
`},Yy={messageSeparator:"",roleSeparator:Ar},Gu=Object.fromEntries(Object.keys(Fu).flatMap(r=>r.startsWith("gpt-4")?[[r,Yy]]:r.startsWith("gpt-3.5-turbo")?[[r,Xy]]:[])),xT=Object.keys(Fu);var Bn=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,gi=/(?:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+/giu;function zu(r){return{tokenSplitRegex:gi,bytePairRankDecoder:r,specialTokensEncoder:new Map([[Mt,100257],[kr,100258],[Tr,100259],[xr,100260],[Ln,100264],[Mn,100265],[Ar,100266],[Fn,100276]])}}function Uu(r){return{tokenSplitRegex:gi,bytePairRankDecoder:r,specialTokensEncoder:new Map([[Mt,199999],[kr,2e5],[Tr,200001],[xr,200002],[Ln,200003],[Mn,200004],[Ar,200005],[Fn,200006]])}}function Hu(r){return{expectedVocabularySize:50281,tokenSplitRegex:Bn,bytePairRankDecoder:r,specialTokensEncoder:new Map([[Mt,50256]])}}function Vu(r){return{tokenSplitRegex:Bn,bytePairRankDecoder:r,specialTokensEncoder:new Map([[Mt,50256],[kr,50281],[Tr,50282],[xr,50283]])}}function Wu(r){return{expectedVocabularySize:50257,tokenSplitRegex:Bn,bytePairRankDecoder:r,specialTokensEncoder:new Map([[Mt,50256]])}}function Os(r,e){let t=e(r);switch(r.toLowerCase()){case"r50k_base":return Wu(t);case"p50k_base":return Hu(t);case"p50k_edit":return Vu(t);case"cl100k_base":return zu(t);case"o200k_base":return Uu(t);default:throw new Error(`Unknown encoding name: ${r}`)}}var mr=class mr{constructor({bytePairRankDecoder:e,specialTokensEncoder:t,expectedVocabularySize:a,modelName:n,...i}){Pe(this,"modelName");Pe(this,"bytePairEncodingCoreProcessor");Pe(this,"specialTokensEncoder");Pe(this,"specialTokensSet");Pe(this,"allSpecialTokenRegex");Pe(this,"defaultSpecialTokenConfig");Pe(this,"vocabularySize");this.specialTokensEncoder=t,this.specialTokensSet=new Set(this.specialTokensEncoder.keys()),this.allSpecialTokenRegex=Rs(this.specialTokensSet),this.bytePairEncodingCoreProcessor=new mi({bytePairRankDecoder:e,specialTokensEncoder:t,...i}),this.defaultSpecialTokenConfig=this.processSpecialTokens();let o=Math.max(e.length-1,Su(t));if(this.vocabularySize=this.bytePairEncodingCoreProcessor.mergeableBytePairRankCount+t.size,a!==void 0){if(this.vocabularySize!==a)throw new Error("The number of mergeable tokens and special tokens must be equal to expectedVocabularySize.");if(o!==a-1)throw new Error(`The model encodings are invalid. The maximum token value must be equal to expectedVocabularySize - 1. Currently ${o}, expected ${a-1}`)}this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),this.encodeGenerator=this.encodeGenerator.bind(this),this.decodeGenerator=this.decodeGenerator.bind(this),this.decodeAsyncGenerator=this.decodeAsyncGenerator.bind(this),this.decodeAsync=this.decodeAsync.bind(this),this.isWithinTokenLimit=this.isWithinTokenLimit.bind(this),this.encodeChat=this.encodeChat.bind(this),this.encodeChatGenerator=this.encodeChatGenerator.bind(this),this.countTokens=this.countTokens.bind(this),this.setMergeCacheSize=this.setMergeCacheSize.bind(this),this.clearMergeCache=this.clearMergeCache.bind(this),this.estimateCost=this.estimateCost.bind(this),this.modelName=n}static getEncodingApi(e,t){let a=Os(e,t);return new mr(a)}static getEncodingApiForModel(e,t){let a=Bu[e],n=Os(a,t);return new mr({...n,modelName:e})}processSpecialTokens({allowedSpecial:e,disallowedSpecial:t}={}){let a;if(e===Nn||e?.has(Nn)){e=new Set(this.specialTokensSet);let n=e;if(t===Nn)throw new Error('allowedSpecial and disallowedSpecial cannot both be set to "all".');typeof t=="object"?t.forEach(i=>n.delete(i)):t=new Set}if(!t||t===Nn||t.has(Nn)){t=new Set(this.specialTokensSet);let n=t;e?.size?(e.forEach(i=>n.delete(i)),t.forEach(i=>e.delete(i)),t.size>0&&(a=Rs(t))):a=this.allSpecialTokenRegex}return{allowedSpecial:e,regexPattern:a}}encodeGenerator(e,t){let a=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(a.regexPattern){let n=e.match(a.regexPattern);if(n!==null)throw new Error(`Disallowed special token found: ${n[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNativeGenerator(e,a.allowedSpecial)}encode(e,t){let a=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(a.regexPattern){let n=e.match(a.regexPattern);if(n!==null)throw new Error(`Disallowed special token found: ${n[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNative(e,a.allowedSpecial)}*encodeChatGenerator(e,t=this.modelName){if(!t)throw new Error("Model name must be provided either during initialization or passed in to the method.");let a=Gu[t],n=this.specialTokensEncoder.get(Ln),i=this.specialTokensEncoder.get(Mn);if(!a||n===void 0||i===void 0)throw new Error(`Model '${t}' does not support chat.`);let o=new Set([Ar]),{messageSeparator:s,roleSeparator:l}=a,c=s.length>0?this.encode(s):[],u=l.length>0?this.encode(l,{allowedSpecial:o}):[],p=new Map;for(let{role:m="system",name:d=m,content:g}of e){if(g===void 0)throw new Error("Content must be defined for all messages.");yield[n];let f=p.get(d)??this.encode(d);p.set(d,f),yield f,u.length>0&&(yield u),yield*this.encodeGenerator(g),yield[i],yield c}yield[n],yield*this.encodeGenerator("assistant"),u.length>0&&(yield u)}encodeChat(e,t=this.modelName){return[...this.encodeChatGenerator(e,t)].flat()}isWithinTokenLimit(e,t){let a=typeof e=="string"?this.encodeGenerator(e):this.encodeChatGenerator(e),n=0;for(let i of a)if(n+=i.length,n>t)return!1;return n}countTokens(e,t){if(typeof e=="string"){let i=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(i.regexPattern){let o=e.match(i.regexPattern);if(o!==null)throw new Error(`Disallowed special token found: ${o[0]}`)}return this.bytePairEncodingCoreProcessor.countNative(e,i.allowedSpecial)}let a=this.encodeChatGenerator(e),n=0;for(let i of a)n+=i.length;return n}setMergeCacheSize(e){this.bytePairEncodingCoreProcessor.setMergeCacheSize(e)}clearMergeCache(){this.bytePairEncodingCoreProcessor.clearMergeCache()}decode(e){return this.bytePairEncodingCoreProcessor.decodeNative(e)}*decodeGenerator(e){let t=this.bytePairEncodingCoreProcessor.decodeNativeGenerator(e),a="";for(let n of t)a+=typeof n=="string"?n:On.decode(n,{stream:!0}),!(a.length===0||As(a))&&(yield a,a="");a.length>0&&(yield a)}async*decodeAsyncGenerator(e){let t=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(e),a="";for await(let n of t)a+=typeof n=="string"?n:On.decode(n,{stream:!0}),!(a.length===0||As(a))&&(yield a,a="");a.length>0&&(yield a)}async decodeAsync(e){let t=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(e),a="";for await(let n of t)a+=typeof n=="string"?n:On.decode(n,{stream:!0});return a}estimateCost(e,t=this.modelName){if(!t)throw new Error("Model name must be provided either during initialization or passed in to the method.");let a=hi[t];if(!a)throw new Error(`Unknown model: ${t}`);if(!a.cost)throw new Error(`No cost information available for model: ${t}`);let n=a.cost,i={},o=e/1e6;return n.input!==void 0&&(i.input=n.input*o),n.output!==void 0&&(i.output=n.output*o),n.batchInput!==void 0&&(i.batchInput=n.batchInput*o),n.batchOutput!==void 0&&(i.batchOutput=n.batchOutput*o),i}};Pe(mr,"EndOfPrompt",Fn),Pe(mr,"EndOfText",Mt),Pe(mr,"FimMiddle",Tr),Pe(mr,"FimPrefix",kr),Pe(mr,"FimSuffix",xr);var fi=mr;var Zy=fi.getEncodingApi("cl100k_base",()=>yu),{decode:px,decodeAsyncGenerator:mx,decodeGenerator:hx,encode:gx,encodeGenerator:fx,isWithinTokenLimit:yx,countTokens:$r,encodeChat:bx,encodeChatGenerator:vx,vocabularySize:_x,setMergeCacheSize:Sx,clearMergeCache:Ex,estimateCost:wx}=Zy;var yi=class{constructor(){this.size=4096;this.groups=[]}createGroup(e){let t=new Ls;return t.id=e,this.groups.push(t),t}group(e){return this.groups.find(t=>t.id===e)}countTokens(){return this.groups.reduce((e,t)=>e+t.tokenCount,0)}removeOverflow(){let e=this.countTokens(),t=this.groups.reduce((a,n)=>a+n.weight,0);for(;e>this.size;){let a=this.groups.slice().sort((i,o)=>{let s=Math.floor(i.weight/t*this.size),l=Math.floor(o.weight/t*this.size),c=i.tokenCount-s;return o.tokenCount-l-c}),n=this.removeOneItem(a);if(!n)throw new Error("Too many items in the token window that cannot be removed.");e-=n.tokenCount}}removeOneItem(e){for(let t of e){let a=t.items.findIndex(i=>!i.cannotRemove);if(a===-1)continue;let n=t.items[a];return t.items.splice(a,1),t.tokenCount-=n.tokenCount,n}return null}},Ls=class{constructor(){this.id="";this.items=[];this.weight=1;this.tokenCount=0;this.separator=`
|
|
3252
|
+
`;this.itemPadding=0;this.sortFunction=(e,t)=>e.sortOrder!==t.sortOrder?e.sortOrder-t.sortOrder:e.dateAdded!==t.dateAdded?e.dateAdded-t.dateAdded:e.content.localeCompare(t.content)}setItemPadding(e){return this.itemPadding=e,this.recalculateTokens(),this}sortBy(e){return this.sortFunction=e,this.items.sort(this.sortFunction),this}setSeparator(e){return this.separator==e?this:(this.separator=e,this.recalculateTokens(),this)}setWeight(e){return this.weight=e,this}recalculateTokens(){this.tokenCount=this.items.reduce((e,t)=>(t.tokenCount=$r(t.content)+$r(this.separator)+this.itemPadding,e+t.tokenCount),0)}add(e){typeof e=="string"&&(e={content:e});let t=e;t.id===void 0&&(t.id=Tt());let a=this.items.find(n=>n.id===t.id);return a?(this.tokenCount-=a.tokenCount,Object.assign(a,t),t=a):this.items.push(t),t.dateAdded===void 0&&(t.dateAdded=Date.now()),t.sortOrder===void 0&&(t.sortOrder=0),t.disabled===void 0&&(t.disabled=!1),t.tokenCount=t.disabled?0:$r(e.content)+$r(this.separator)+this.itemPadding,this.tokenCount+=t.tokenCount,this.items.sort(this.sortFunction),t}getAllAsString(){return this.getAll().map(e=>e.content).join(this.separator)}getAll(){return this.items.filter(e=>!e.disabled)}empty(){this.items=[],this.tokenCount=0}};var Gn=1,hr=new ge("ChatGPT"),bi=class{constructor(e){this.id="";this.metadata={};this.config={apiKey:"",endpoint:"",model:"gpt-4-turbo",systemMessage:"",userID:"",stream:!0,maxTokens:4096};this.maxToolCallsPerMessage=10;this.stats={tokensUsed:0};this.tokenWindow=(()=>{let e=new yi;return e.createGroup("context").setSeparator(`
|
|
3253
3253
|
|
|
3254
|
-
`),e.createGroup("actions").setItemPadding(25),e.createGroup("messages").setItemPadding(10),e})();this.config={...this.config,...e},this.tokenWindow.size=this.config.maxTokens||4096}get contextGroup(){return this.tokenWindow.group("context")}get toolGroup(){return this.tokenWindow.group("actions")}get messageGroup(){return this.tokenWindow.group("messages")}async sendMessage(e){let t={role:"user",content:e};this.messageGroup.add({id:"msg-"+Fn++,content:JSON.stringify(t),customData:t}),await this.processMessages();let n=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;return n?.role=="assistant"&&n.content||""}addAssistantMessage(e){let t={role:"assistant",content:e};this.messageGroup.add({id:"msg-"+Fn++,content:JSON.stringify(t),customData:t})}addUserMessage(e){let t={role:"user",content:e};this.messageGroup.add({id:"msg-"+Fn++,content:JSON.stringify(t),customData:t})}getMessages(){return this.messageGroup.items.map(e=>e.customData)}getLatestMessage(){return this.messageGroup.items.length?this.messageGroup.items[this.messageGroup.items.length-1]?.customData:void 0}async processMessages(){await this.config.onBeforeMessageProcessing?.(),Tr.debugEnabled&&Tr.debug("Process message state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(a=>a.customData),messages:this.messageGroup.items.map(a=>a.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let t=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;if(t?.role=="user"||t?.role=="tool")await this.sendToAPI(),await this.processMessages();else if(t?.role=="assistant"&&t?.tool_calls?.length){for(let a of t.tool_calls)await this.processToolCall(a);await this.processMessages()}}async trimMessages(){for(this.tokenWindow.removeOverflow();this.messageGroup.items.length&&this.messageGroup.items[0].customData?.role=="tool";)this.messageGroup.items.shift()}async sendToAPI(e){this.config.systemMessage&&this.contextGroup.add({id:"_gpt_context",cannotRemove:!0,sortOrder:0,content:this.config.systemMessage}),await this.trimMessages();let t=0;for(let l=this.messageGroup.items.length-1;l>=0;l--){let c=this.messageGroup.items[l].customData;if(c.role=="assistant"&&c.tool_calls){if(t+=1,t>=this.maxToolCallsPerMessage)throw new Error(`Exceeded the maximum tool calls per message limit of ${this.maxToolCallsPerMessage}.`)}else if(c.role=="user")break}Tr.debugEnabled&&Tr.debug("Before LLM state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(l=>l.customData),messages:this.messageGroup.items.map(l=>l.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let a={model:this.config.model,temperature:.2,user:this.config.userID,tools:[],stream:!!this.config.stream,max_tokens:1024,messages:[{role:"system",content:this.contextGroup.getAllAsString()},...this.messageGroup.getAll().map(l=>l.customData)]};for(let l of this.toolGroup.getAll()){let c=l.customData;c.description&&c.description.length>1024&&Tr.warn(`Tool description for "${c.name}" is too long, it will be truncated.`);let u={type:"function",function:{name:c.name,description:(c.description||"").substring(0,1024),parameters:c.params}};a.tools.push(u)}a.user||delete a.user,a.tools.length||delete a.tools;let n={};if(n["Content-Type"]="application/json",this.config.apiKey&&(n.Authorization=`Bearer ${this.config.apiKey}`),e)return a;let i=await fetch(this.config.endpoint||"https://api.openai.com/v1/chat/completions",{method:"POST",headers:n,body:JSON.stringify(a)});if(!i.ok){let l=`${i.status} ${i.statusText}`;try{let u=await i.json();l=u.errorText||u.error?.message||u.error||l}catch{}let c=new Error(l);throw c.code=i.status,c}let o=null,s=null;if(this.config.stream)for await(let l of uu(i.body)){if(l.data=="[DONE]")break;if(!l.data)continue;let c=JSON.parse(l.data);if(s){for(let u in c.choices[0].delta)if(typeof c.choices[0].delta[u]=="string"){if(u=="role"&&s[u]==c.choices[0].delta[u])continue;s[u]=(s[u]||"")+c.choices[0].delta[u]}for(let u of c.choices[0].delta.tool_calls||[]){if(s.tool_calls||(s.tool_calls=[]),!s.tool_calls[u.index]){s.tool_calls[u.index]=u;continue}let p=s.tool_calls[u.index];p.function=p.function||{},p.function.name=(p.function.name||"")+(u.function?.name||""),p.function.arguments=(p.function.arguments||"")+(u.function?.arguments||"")}}else s={chunkID:c.id,...c.choices[0].delta};s?.content&&!s.content.startsWith("{")&&this.config.onAIMessage?.(s.content,!0)}else o=await i.json(),this.stats.tokensUsed+=o.usage?.total_tokens||0,Tr.debug(`Used ${o.usage?.total_tokens||0} tokens, total used: ${this.stats.tokensUsed}`),s=o.choices?.[0]?.message;if(s||(Tr.warn("No response block in API response."),s={role:"assistant",content:""}),s.role=="user")throw new Error("API returned a user message, which is not allowed.");this.processIncomingMessage(s),this.messageGroup.add({id:"msg-"+Fn++,content:JSON.stringify(s),customData:s}),s.content&&this.config.onAIMessage?.(s.content,!1)}processIncomingMessage(e){}registerTool(e){this.toolGroup.add({id:e.name,cannotRemove:!e.canRemove,content:JSON.stringify(e),customData:e})}async processToolCall(e){try{let a=this.toolGroup.items.find(s=>s.id==e.function.name)?.customData;if(!a)throw new Error(`Tool "${e.function.name}" not found.`);let n=JSON.parse(e.function.arguments);this.config.onAIToolStart?.(e.function.name,n);let i=await a.callback(n);typeof i!="string"&&(i=JSON.stringify(i)||""),(i===""||i==="undefined")&&(i="success");let o={role:"tool",content:i,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+Fn++,content:JSON.stringify(o),customData:o})}catch(t){Tr.warn(`Unable to process tool call for "${e?.function?.name}"`,t);let a={role:"tool",content:`Error: ${t.message}`,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+Fn++,content:JSON.stringify(a),customData:a})}}resetConversation(){this.messageGroup.empty(),this.toolGroup.empty(),this.contextGroup.empty()}};var De=function(){return De=Object.assign||function(e){for(var t,a=1,n=arguments.length;a<n;a++){t=arguments[a];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},De.apply(this,arguments)};function Xy(r,e,t,a){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function s(u){try{c(a.next(u))}catch(p){o(p)}}function l(u){try{c(a.throw(u))}catch(p){o(p)}}function c(u){u.done?i(u.value):n(u.value).then(s,l)}c((a=a.apply(r,e||[])).next())})}function Yy(r,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,n,i,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(c){return function(u){return l([c,u])}}function l(c){if(a)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(t=0)),t;)try{if(a=1,n&&(i=c[0]&2?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,n=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1],i=c;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(c);break}i[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(r,t)}catch(u){c=[6,u],n=0}finally{a=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function de(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],a=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ue(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var a=t.call(r),n,i=[],o;try{for(;(e===void 0||e-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(s){o={error:s}}finally{try{n&&!n.done&&(t=a.return)&&t.call(a)}finally{if(o)throw o.error}}return i}var Zy="ENTRIES",Ku="KEYS",$u="VALUES",rt="",Os=function(){function r(e,t){var a=e._tree,n=Array.from(a.keys());this.set=e,this._type=t,this._path=n.length>0?[{node:a,keys:n}]:[]}return r.prototype.next=function(){var e=this.dive();return this.backtrack(),e},r.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var e=Bn(this._path),t=e.node,a=e.keys;if(Bn(a)===rt)return{done:!1,value:this.result()};var n=t.get(Bn(a));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()},r.prototype.backtrack=function(){if(this._path.length!==0){var e=Bn(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}},r.prototype.key=function(){return this.set._prefix+this._path.map(function(e){var t=e.keys;return Bn(t)}).filter(function(e){return e!==rt}).join("")},r.prototype.value=function(){return Bn(this._path).node.get(rt)},r.prototype.result=function(){switch(this._type){case $u:return this.value();case Ku:return this.key();default:return[this.key(),this.value()]}},r.prototype[Symbol.iterator]=function(){return this},r}(),Bn=function(r){return r[r.length-1]},Jy=function(r,e,t){var a=new Map;if(e===void 0)return a;for(var n=e.length+1,i=n+t,o=new Uint8Array(i*n).fill(t+1),s=0;s<n;++s)o[s]=s;for(var l=1;l<i;++l)o[l*n]=l;return Xu(r,e,t,a,o,1,n,""),a},Xu=function(r,e,t,a,n,i,o,s){var l,c,u=i*o;try{e:for(var p=de(r.keys()),m=p.next();!m.done;m=p.next()){var d=m.value;if(d===rt){var g=n[u-1];g<=t&&a.set(s,[r.get(d),g])}else{for(var f=i,y=0;y<d.length;++y,++f){for(var v=d[y],T=o*f,E=T-o,I=n[T],D=Math.max(0,f-t-1),C=Math.min(o-1,f+t),M=D;M<C;++M){var F=v!==e[M],R=n[E+M]+ +F,G=n[E+M+1]+1,z=n[T+M]+1,O=n[T+M+1]=Math.min(R,G,z);O<I&&(I=O)}if(I>t)continue e}Xu(r.get(d),e,t,a,n,f,o,s+d)}}}catch(x){l={error:x}}finally{try{m&&!m.done&&(c=p.return)&&c.call(p)}finally{if(l)throw l.error}}},Ls=function(){function r(e,t){e===void 0&&(e=new Map),t===void 0&&(t=""),this._size=void 0,this._tree=e,this._prefix=t}return r.prototype.atPrefix=function(e){var t,a;if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");var n=Ue(bi(this._tree,e.slice(this._prefix.length)),2),i=n[0],o=n[1];if(i===void 0){var s=Ue(Vs(o),2),l=s[0],c=s[1];try{for(var u=de(l.keys()),p=u.next();!p.done;p=u.next()){var m=p.value;if(m!==rt&&m.startsWith(c)){var d=new Map;return d.set(m.slice(c.length),l.get(m)),new r(d,e)}}}catch(g){t={error:g}}finally{try{p&&!p.done&&(a=u.return)&&a.call(u)}finally{if(t)throw t.error}}}return new r(i,e)},r.prototype.clear=function(){this._size=void 0,this._tree.clear()},r.prototype.delete=function(e){return this._size=void 0,Qy(this._tree,e)},r.prototype.entries=function(){return new Os(this,Zy)},r.prototype.forEach=function(e){var t,a;try{for(var n=de(this),i=n.next();!i.done;i=n.next()){var o=Ue(i.value,2),s=o[0],l=o[1];e(s,l,this)}}catch(c){t={error:c}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},r.prototype.fuzzyGet=function(e,t){return Jy(this._tree,e,t)},r.prototype.get=function(e){var t=zs(this._tree,e);return t!==void 0?t.get(rt):void 0},r.prototype.has=function(e){var t=zs(this._tree,e);return t!==void 0&&t.has(rt)},r.prototype.keys=function(){return new Os(this,Ku)},r.prototype.set=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var a=Ms(this._tree,e);return a.set(rt,t),this},Object.defineProperty(r.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var e=this.entries();!e.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),r.prototype.update=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var a=Ms(this._tree,e);return a.set(rt,t(a.get(rt))),this},r.prototype.fetch=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var a=Ms(this._tree,e),n=a.get(rt);return n===void 0&&a.set(rt,n=t()),n},r.prototype.values=function(){return new Os(this,$u)},r.prototype[Symbol.iterator]=function(){return this.entries()},r.from=function(e){var t,a,n=new r;try{for(var i=de(e),o=i.next();!o.done;o=i.next()){var s=Ue(o.value,2),l=s[0],c=s[1];n.set(l,c)}}catch(u){t={error:u}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(t)throw t.error}}return n},r.fromObject=function(e){return r.from(Object.entries(e))},r}(),bi=function(r,e,t){var a,n;if(t===void 0&&(t=[]),e.length===0||r==null)return[r,t];try{for(var i=de(r.keys()),o=i.next();!o.done;o=i.next()){var s=o.value;if(s!==rt&&e.startsWith(s))return t.push([r,s]),bi(r.get(s),e.slice(s.length),t)}}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return t.push([r,e]),bi(void 0,"",t)},zs=function(r,e){var t,a;if(e.length===0||r==null)return r;try{for(var n=de(r.keys()),i=n.next();!i.done;i=n.next()){var o=i.value;if(o!==rt&&e.startsWith(o))return zs(r.get(o),e.slice(o.length))}}catch(s){t={error:s}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},Ms=function(r,e){var t,a,n=e.length;e:for(var i=0;r&&i<n;){try{for(var o=(t=void 0,de(r.keys())),s=o.next();!s.done;s=o.next()){var l=s.value;if(l!==rt&&e[i]===l[0]){for(var c=Math.min(n-i,l.length),u=1;u<c&&e[i+u]===l[u];)++u;var p=r.get(l);if(u===l.length)r=p;else{var m=new Map;m.set(l.slice(u),p),r.set(e.slice(i,i+u),m),r.delete(l),r=m}i+=u;continue e}}}catch(g){t={error:g}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(t)throw t.error}}var d=new Map;return r.set(e.slice(i),d),d}return r},Qy=function(r,e){var t=Ue(bi(r,e),2),a=t[0],n=t[1];if(a!==void 0){if(a.delete(rt),a.size===0)Yu(n);else if(a.size===1){var i=Ue(a.entries().next().value,2),o=i[0],s=i[1];Zu(n,o,s)}}},Yu=function(r){if(r.length!==0){var e=Ue(Vs(r),2),t=e[0],a=e[1];if(t.delete(a),t.size===0)Yu(r.slice(0,-1));else if(t.size===1){var n=Ue(t.entries().next().value,2),i=n[0],o=n[1];i!==rt&&Zu(r.slice(0,-1),i,o)}}},Zu=function(r,e,t){if(r.length!==0){var a=Ue(Vs(r),2),n=a[0],i=a[1];n.set(i+e,t),n.delete(i)}},Vs=function(r){return r[r.length-1]},ba,Ws="or",Ju="and",eb="and_not",Qu=function(){function r(e){if(e?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');var t=e.autoVacuum==null||e.autoVacuum===!0?Gs:e.autoVacuum;this._options=De(De(De({},Bs),e),{autoVacuum:t,searchOptions:De(De({},Vu),e.searchOptions||{}),autoSuggestOptions:De(De({},ib),e.autoSuggestOptions||{})}),this._index=new Ls,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=Hs,this.addFields(this._options.fields)}return r.prototype.add=function(e){var t,a,n,i,o,s,l=this._options,c=l.extractField,u=l.tokenize,p=l.processTerm,m=l.fields,d=l.idField,g=c(e,d);if(g==null)throw new Error('MiniSearch: document does not have ID field "'.concat(d,'"'));if(this._idToShortId.has(g))throw new Error("MiniSearch: duplicate ID ".concat(g));var f=this.addDocumentId(g);this.saveStoredFields(f,e);try{for(var y=de(m),v=y.next();!v.done;v=y.next()){var T=v.value,E=c(e,T);if(E!=null){var I=u(E.toString(),T),D=this._fieldIds[T],C=new Set(I).size;this.addFieldLength(f,D,this._documentCount-1,C);try{for(var M=(n=void 0,de(I)),F=M.next();!F.done;F=M.next()){var R=F.value,G=p(R,T);if(Array.isArray(G))try{for(var z=(o=void 0,de(G)),O=z.next();!O.done;O=z.next()){var x=O.value;this.addTerm(D,f,x)}}catch(A){o={error:A}}finally{try{O&&!O.done&&(s=z.return)&&s.call(z)}finally{if(o)throw o.error}}else G&&this.addTerm(D,f,G)}}catch(A){n={error:A}}finally{try{F&&!F.done&&(i=M.return)&&i.call(M)}finally{if(n)throw n.error}}}}}catch(A){t={error:A}}finally{try{v&&!v.done&&(a=y.return)&&a.call(y)}finally{if(t)throw t.error}}},r.prototype.addAll=function(e){var t,a;try{for(var n=de(e),i=n.next();!i.done;i=n.next()){var o=i.value;this.add(o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},r.prototype.addAllAsync=function(e,t){var a=this;t===void 0&&(t={});var n=t.chunkSize,i=n===void 0?10:n,o={chunk:[],promise:Promise.resolve()},s=e.reduce(function(u,p,m){var d=u.chunk,g=u.promise;return d.push(p),(m+1)%i===0?{chunk:[],promise:g.then(function(){return new Promise(function(f){return setTimeout(f,0)})}).then(function(){return a.addAll(d)})}:{chunk:d,promise:g}},o),l=s.chunk,c=s.promise;return c.then(function(){return a.addAll(l)})},r.prototype.remove=function(e){var t,a,n,i,o,s,l=this._options,c=l.tokenize,u=l.processTerm,p=l.extractField,m=l.fields,d=l.idField,g=p(e,d);if(g==null)throw new Error('MiniSearch: document does not have ID field "'.concat(d,'"'));var f=this._idToShortId.get(g);if(f==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(g,": it is not in the index"));try{for(var y=de(m),v=y.next();!v.done;v=y.next()){var T=v.value,E=p(e,T);if(E!=null){var I=c(E.toString(),T),D=this._fieldIds[T],C=new Set(I).size;this.removeFieldLength(f,D,this._documentCount,C);try{for(var M=(n=void 0,de(I)),F=M.next();!F.done;F=M.next()){var R=F.value,G=u(R,T);if(Array.isArray(G))try{for(var z=(o=void 0,de(G)),O=z.next();!O.done;O=z.next()){var x=O.value;this.removeTerm(D,f,x)}}catch(A){o={error:A}}finally{try{O&&!O.done&&(s=z.return)&&s.call(z)}finally{if(o)throw o.error}}else G&&this.removeTerm(D,f,G)}}catch(A){n={error:A}}finally{try{F&&!F.done&&(i=M.return)&&i.call(M)}finally{if(n)throw n.error}}}}}catch(A){t={error:A}}finally{try{v&&!v.done&&(a=y.return)&&a.call(y)}finally{if(t)throw t.error}}this._storedFields.delete(f),this._documentIds.delete(f),this._idToShortId.delete(g),this._fieldLength.delete(f),this._documentCount-=1},r.prototype.removeAll=function(e){var t,a;if(e)try{for(var n=de(e),i=n.next();!i.done;i=n.next()){var o=i.value;this.remove(o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Ls,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},r.prototype.discard=function(e){var t=this,a=this._idToShortId.get(e);if(a==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(e,": it is not in the index"));this._idToShortId.delete(e),this._documentIds.delete(a),this._storedFields.delete(a),(this._fieldLength.get(a)||[]).forEach(function(n,i){t.removeFieldLength(a,i,t._documentCount,n)}),this._fieldLength.delete(a),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},r.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var e=this._options.autoVacuum,t=e.minDirtFactor,a=e.minDirtCount,n=e.batchSize,i=e.batchWait;this.conditionalVacuum({batchSize:n,batchWait:i},{minDirtCount:a,minDirtFactor:t})}},r.prototype.discardAll=function(e){var t,a,n=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var i=de(e),o=i.next();!o.done;o=i.next()){var s=o.value;this.discard(s)}}catch(l){t={error:l}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(t)throw t.error}}}finally{this._options.autoVacuum=n}this.maybeAutoVacuum()},r.prototype.replace=function(e){var t=this._options,a=t.idField,n=t.extractField,i=n(e,a);this.discard(i),this.add(e)},r.prototype.vacuum=function(e){return e===void 0&&(e={}),this.conditionalVacuum(e)},r.prototype.conditionalVacuum=function(e,t){var a=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var n=a._enqueuedVacuumConditions;return a._enqueuedVacuumConditions=Hs,a.performVacuuming(e,n)}),this._enqueuedVacuum)):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)},r.prototype.performVacuuming=function(e,t){return Xy(this,void 0,void 0,function(){var a,n,i,o,s,l,c,u,p,m,d,g,f,y,v,T,E,I,D,C,M,F,R,G,z;return Yy(this,function(O){switch(O.label){case 0:if(a=this._dirtCount,!this.vacuumConditionsMet(t))return[3,10];n=e.batchSize||Us.batchSize,i=e.batchWait||Us.batchWait,o=1,O.label=1;case 1:O.trys.push([1,7,8,9]),s=de(this._index),l=s.next(),O.label=2;case 2:if(l.done)return[3,6];c=Ue(l.value,2),u=c[0],p=c[1];try{for(m=(F=void 0,de(p)),d=m.next();!d.done;d=m.next()){g=Ue(d.value,2),f=g[0],y=g[1];try{for(v=(G=void 0,de(y)),T=v.next();!T.done;T=v.next())E=Ue(T.value,1),I=E[0],!this._documentIds.has(I)&&(y.size<=1?p.delete(f):y.delete(I))}catch(x){G={error:x}}finally{try{T&&!T.done&&(z=v.return)&&z.call(v)}finally{if(G)throw G.error}}}}catch(x){F={error:x}}finally{try{d&&!d.done&&(R=m.return)&&R.call(m)}finally{if(F)throw F.error}}return this._index.get(u).size===0&&this._index.delete(u),o%n!==0?[3,4]:[4,new Promise(function(x){return setTimeout(x,i)})];case 3:O.sent(),O.label=4;case 4:o+=1,O.label=5;case 5:return l=s.next(),[3,2];case 6:return[3,9];case 7:return D=O.sent(),C={error:D},[3,9];case 8:try{l&&!l.done&&(M=s.return)&&M.call(s)}finally{if(C)throw C.error}return[7];case 9:this._dirtCount-=a,O.label=10;case 10:return[4,null];case 11:return O.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},r.prototype.vacuumConditionsMet=function(e){if(e==null)return!0;var t=e.minDirtCount,a=e.minDirtFactor;return t=t||Gs.minDirtCount,a=a||Gs.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=a},Object.defineProperty(r.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),r.prototype.has=function(e){return this._idToShortId.has(e)},r.prototype.getStoredFields=function(e){var t=this._idToShortId.get(e);if(t!=null)return this._storedFields.get(t)},r.prototype.search=function(e,t){var a,n;t===void 0&&(t={});var i=this.executeQuery(e,t),o=[];try{for(var s=de(i),l=s.next();!l.done;l=s.next()){var c=Ue(l.value,2),u=c[0],p=c[1],m=p.score,d=p.terms,g=p.match,f=d.length||1,y={id:this._documentIds.get(u),score:m*f,terms:Object.keys(g),queryTerms:d,match:g};Object.assign(y,this._storedFields.get(u)),(t.filter==null||t.filter(y))&&o.push(y)}}catch(v){a={error:v}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return e===r.wildcard&&t.boostDocument==null&&this._options.searchOptions.boostDocument==null||o.sort(ju),o},r.prototype.autoSuggest=function(e,t){var a,n,i,o;t===void 0&&(t={}),t=De(De({},this._options.autoSuggestOptions),t);var s=new Map;try{for(var l=de(this.search(e,t)),c=l.next();!c.done;c=l.next()){var u=c.value,p=u.score,m=u.terms,d=m.join(" "),g=s.get(d);g!=null?(g.score+=p,g.count+=1):s.set(d,{score:p,terms:m,count:1})}}catch(D){a={error:D}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(a)throw a.error}}var f=[];try{for(var y=de(s),v=y.next();!v.done;v=y.next()){var T=Ue(v.value,2),g=T[0],E=T[1],p=E.score,m=E.terms,I=E.count;f.push({suggestion:g,terms:m,score:p/I})}}catch(D){i={error:D}}finally{try{v&&!v.done&&(o=y.return)&&o.call(y)}finally{if(i)throw i.error}}return f.sort(ju),f},Object.defineProperty(r.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),r.loadJSON=function(e,t){if(t==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),t)},r.getDefault=function(e){if(Bs.hasOwnProperty(e))return Fs(Bs,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},r.loadJS=function(e,t){var a,n,i,o,s,l,c=e.index,u=e.documentCount,p=e.nextId,m=e.documentIds,d=e.fieldIds,g=e.fieldLength,f=e.averageFieldLength,y=e.storedFields,v=e.dirtCount,T=e.serializationVersion;if(T!==1&&T!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var E=new r(t);E._documentCount=u,E._nextId=p,E._documentIds=yi(m),E._idToShortId=new Map,E._fieldIds=d,E._fieldLength=yi(g),E._avgFieldLength=f,E._storedFields=yi(y),E._dirtCount=v||0,E._index=new Ls;try{for(var I=de(E._documentIds),D=I.next();!D.done;D=I.next()){var C=Ue(D.value,2),M=C[0],F=C[1];E._idToShortId.set(F,M)}}catch(Z){a={error:Z}}finally{try{D&&!D.done&&(n=I.return)&&n.call(I)}finally{if(a)throw a.error}}try{for(var R=de(c),G=R.next();!G.done;G=R.next()){var z=Ue(G.value,2),O=z[0],x=z[1],A=new Map;try{for(var B=(s=void 0,de(Object.keys(x))),X=B.next();!X.done;X=B.next()){var K=X.value,Q=x[K];T===1&&(Q=Q.ds),A.set(parseInt(K,10),yi(Q))}}catch(Z){s={error:Z}}finally{try{X&&!X.done&&(l=B.return)&&l.call(B)}finally{if(s)throw s.error}}E._index.set(O,A)}}catch(Z){i={error:Z}}finally{try{G&&!G.done&&(o=R.return)&&o.call(R)}finally{if(i)throw i.error}}return E},r.prototype.executeQuery=function(e,t){var a=this;if(t===void 0&&(t={}),e===r.wildcard)return this.executeWildcardQuery(t);if(typeof e!="string"){var n=De(De(De({},t),e),{queries:void 0}),i=e.queries.map(function(y){return a.executeQuery(y,n)});return this.combineResults(i,n.combineWith)}var o=this._options,s=o.tokenize,l=o.processTerm,c=o.searchOptions,u=De(De({tokenize:s,processTerm:l},c),t),p=u.tokenize,m=u.processTerm,d=p(e).flatMap(function(y){return m(y)}).filter(function(y){return!!y}),g=d.map(ab(u)),f=g.map(function(y){return a.executeQuerySpec(y,u)});return this.combineResults(f,u.combineWith)},r.prototype.executeQuerySpec=function(e,t){var a,n,i,o,s=De(De({},this._options.searchOptions),t),l=(s.fields||this._options.fields).reduce(function(K,Q){var Z;return De(De({},K),(Z={},Z[Q]=Fs(s.boost,Q)||1,Z))},{}),c=s.boostDocument,u=s.weights,p=s.maxFuzzy,m=s.bm25,d=De(De({},Vu.weights),u),g=d.fuzzy,f=d.prefix,y=this._index.get(e.term),v=this.termResults(e.term,e.term,1,y,l,c,m),T,E;if(e.prefix&&(T=this._index.atPrefix(e.term)),e.fuzzy){var I=e.fuzzy===!0?.2:e.fuzzy,D=I<1?Math.min(p,Math.round(e.term.length*I)):I;D&&(E=this._index.fuzzyGet(e.term,D))}if(T)try{for(var C=de(T),M=C.next();!M.done;M=C.next()){var F=Ue(M.value,2),R=F[0],G=F[1],z=R.length-e.term.length;if(z){E?.delete(R);var O=f*R.length/(R.length+.3*z);this.termResults(e.term,R,O,G,l,c,m,v)}}}catch(K){a={error:K}}finally{try{M&&!M.done&&(n=C.return)&&n.call(C)}finally{if(a)throw a.error}}if(E)try{for(var x=de(E.keys()),A=x.next();!A.done;A=x.next()){var R=A.value,B=Ue(E.get(R),2),X=B[0],z=B[1];if(z){var O=g*R.length/(R.length+z);this.termResults(e.term,R,O,X,l,c,m,v)}}}catch(K){i={error:K}}finally{try{A&&!A.done&&(o=x.return)&&o.call(x)}finally{if(i)throw i.error}}return v},r.prototype.executeWildcardQuery=function(e){var t,a,n=new Map,i=De(De({},this._options.searchOptions),e);try{for(var o=de(this._documentIds),s=o.next();!s.done;s=o.next()){var l=Ue(s.value,2),c=l[0],u=l[1],p=i.boostDocument?i.boostDocument(u,"",this._storedFields.get(c)):1;n.set(c,{score:p,terms:[],match:{}})}}catch(m){t={error:m}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(t)throw t.error}}return n},r.prototype.combineResults=function(e,t){if(t===void 0&&(t=Ws),e.length===0)return new Map;var a=t.toLowerCase();return e.reduce(tb[a])||new Map},r.prototype.toJSON=function(){var e,t,a,n,i=[];try{for(var o=de(this._index),s=o.next();!s.done;s=o.next()){var l=Ue(s.value,2),c=l[0],u=l[1],p={};try{for(var m=(a=void 0,de(u)),d=m.next();!d.done;d=m.next()){var g=Ue(d.value,2),f=g[0],y=g[1];p[f]=Object.fromEntries(y)}}catch(v){a={error:v}}finally{try{d&&!d.done&&(n=m.return)&&n.call(m)}finally{if(a)throw a.error}}i.push([c,p])}}catch(v){e={error:v}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:i,serializationVersion:2}},r.prototype.termResults=function(e,t,a,n,i,o,s,l){var c,u,p,m,d;if(l===void 0&&(l=new Map),n==null)return l;try{for(var g=de(Object.keys(i)),f=g.next();!f.done;f=g.next()){var y=f.value,v=i[y],T=this._fieldIds[y],E=n.get(T);if(E!=null){var I=E.size,D=this._avgFieldLength[T];try{for(var C=(p=void 0,de(E.keys())),M=C.next();!M.done;M=C.next()){var F=M.value;if(!this._documentIds.has(F)){this.removeTerm(T,F,t),I-=1;continue}var R=o?o(this._documentIds.get(F),t,this._storedFields.get(F)):1;if(R){var G=E.get(F),z=this._fieldLength.get(F)[T],O=nb(G,I,this._documentCount,z,D,s),x=a*v*R*O,A=l.get(F);if(A){A.score+=x,ob(A.terms,e);var B=Fs(A.match,t);B?B.push(y):A.match[t]=[y]}else l.set(F,{score:x,terms:[e],match:(d={},d[t]=[y],d)})}}}catch(X){p={error:X}}finally{try{M&&!M.done&&(m=C.return)&&m.call(C)}finally{if(p)throw p.error}}}}}catch(X){c={error:X}}finally{try{f&&!f.done&&(u=g.return)&&u.call(g)}finally{if(c)throw c.error}}return l},r.prototype.addTerm=function(e,t,a){var n=this._index.fetch(a,qu),i=n.get(e);if(i==null)i=new Map,i.set(t,1),n.set(e,i);else{var o=i.get(t);i.set(t,(o||0)+1)}},r.prototype.removeTerm=function(e,t,a){if(!this._index.has(a)){this.warnDocumentChanged(t,e,a);return}var n=this._index.fetch(a,qu),i=n.get(e);i==null||i.get(t)==null?this.warnDocumentChanged(t,e,a):i.get(t)<=1?i.size<=1?n.delete(e):i.delete(t):i.set(t,i.get(t)-1),this._index.get(a).size===0&&this._index.delete(a)},r.prototype.warnDocumentChanged=function(e,t,a){var n,i;try{for(var o=de(Object.keys(this._fieldIds)),s=o.next();!s.done;s=o.next()){var l=s.value;if(this._fieldIds[l]===t){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(a,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(c){n={error:c}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}},r.prototype.addDocumentId=function(e){var t=this._nextId;return this._idToShortId.set(e,t),this._documentIds.set(t,e),this._documentCount+=1,this._nextId+=1,t},r.prototype.addFields=function(e){for(var t=0;t<e.length;t++)this._fieldIds[e[t]]=t},r.prototype.addFieldLength=function(e,t,a,n){var i=this._fieldLength.get(e);i==null&&this._fieldLength.set(e,i=[]),i[t]=n;var o=this._avgFieldLength[t]||0,s=o*a+n;this._avgFieldLength[t]=s/(a+1)},r.prototype.removeFieldLength=function(e,t,a,n){if(a===1){this._avgFieldLength[t]=0;return}var i=this._avgFieldLength[t]*a-n;this._avgFieldLength[t]=i/(a-1)},r.prototype.saveStoredFields=function(e,t){var a,n,i=this._options,o=i.storeFields,s=i.extractField;if(!(o==null||o.length===0)){var l=this._storedFields.get(e);l==null&&this._storedFields.set(e,l={});try{for(var c=de(o),u=c.next();!u.done;u=c.next()){var p=u.value,m=s(t,p);m!==void 0&&(l[p]=m)}}catch(d){a={error:d}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(a)throw a.error}}}},r.wildcard=Symbol("*"),r}(),Fs=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0},tb=(ba={},ba[Ws]=function(r,e){var t,a;try{for(var n=de(e.keys()),i=n.next();!i.done;i=n.next()){var o=i.value,s=r.get(o);if(s==null)r.set(o,e.get(o));else{var l=e.get(o),c=l.score,u=l.terms,p=l.match;s.score=s.score+c,s.match=Object.assign(s.match,p),Wu(s.terms,u)}}}catch(m){t={error:m}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}return r},ba[Ju]=function(r,e){var t,a,n=new Map;try{for(var i=de(e.keys()),o=i.next();!o.done;o=i.next()){var s=o.value,l=r.get(s);if(l!=null){var c=e.get(s),u=c.score,p=c.terms,m=c.match;Wu(l.terms,p),n.set(s,{score:l.score+u,terms:l.terms,match:Object.assign(l.match,m)})}}}catch(d){t={error:d}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(t)throw t.error}}return n},ba[eb]=function(r,e){var t,a;try{for(var n=de(e.keys()),i=n.next();!i.done;i=n.next()){var o=i.value;r.delete(o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}return r},ba),rb={k:1.2,b:.7,d:.5},nb=function(r,e,t,a,n,i){var o=i.k,s=i.b,l=i.d,c=Math.log(1+(t-e+.5)/(e+.5));return c*(l+r*(o+1)/(r+o*(1-s+s*a/n)))},ab=function(r){return function(e,t,a){var n=typeof r.fuzzy=="function"?r.fuzzy(e,t,a):r.fuzzy||!1,i=typeof r.prefix=="function"?r.prefix(e,t,a):r.prefix===!0;return{term:e,fuzzy:n,prefix:i}}},Bs={idField:"id",extractField:function(r,e){return r[e]},tokenize:function(r){return r.split(sb)},processTerm:function(r){return r.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(r,e){typeof console?.[r]=="function"&&console[r](e)},autoVacuum:!0},Vu={combineWith:Ws,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:rb},ib={combineWith:Ju,prefix:function(r,e,t){return e===t.length-1}},Us={batchSize:1e3,batchWait:10},Hs={minDirtFactor:.1,minDirtCount:20},Gs=De(De({},Us),Hs),ob=function(r,e){r.includes(e)||r.push(e)},Wu=function(r,e){var t,a;try{for(var n=de(e),i=n.next();!i.done;i=n.next()){var o=i.value;r.includes(o)||r.push(o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},ju=function(r,e){var t=r.score,a=e.score;return a-t},qu=function(){return new Map},yi=function(r){var e,t,a=new Map;try{for(var n=de(Object.keys(r)),i=n.next();!i.done;i=n.next()){var o=i.value;a.set(parseInt(o,10),r[o])}}catch(s){e={error:s}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return a},sb=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;var ed=[{id:"search",type:"action",name:"Search the knowledge base.",content:"Search the knowledge base for information, actions, tools, tours, UI elements, etc. Use this on EVERY request if you don't have information. If the user asks for personal information, use this. If the user asks you to do something, use this to find the tool you need.",isContext:!0,removeFromMessageHistory:!0,parameters:[{name:"query",type:"string",description:"The search query"}],action:async(r,e)=>{let t=await e.knowledgeBase.search(r.query),a=e;a._lastKBsearch=r.query,a._nextRequestUseKBitems=t,e.submitAnalyticsEvent({type:"kb-search",query:r.query,results:t});let n=t.filter(o=>o.type!="action").map(o=>"id="+o.id).join(", ")||"(none)",i=t.filter(o=>o.type=="action").map(o=>"name="+o._functionID).join(", ")||"(none)";return`Search complete, context has been updated. New info entries found: ${n}. New tools available: ${i}.`}}];var h={};Ss(h,{BRAND:()=>Nb,DIRTY:()=>qr,EMPTY_PATH:()=>db,INVALID:()=>ee,NEVER:()=>yv,OK:()=>ot,ParseStatus:()=>nt,Schema:()=>ue,ZodAny:()=>Ir,ZodArray:()=>fr,ZodBigInt:()=>$r,ZodBoolean:()=>Xr,ZodBranded:()=>_a,ZodCatch:()=>sn,ZodDate:()=>Yr,ZodDefault:()=>on,ZodDiscriminatedUnion:()=>Si,ZodEffects:()=>Ft,ZodEnum:()=>nn,ZodError:()=>yt,ZodFirstPartyTypeKind:()=>re,ZodFunction:()=>wi,ZodIntersection:()=>en,ZodIssueCode:()=>U,ZodLazy:()=>tn,ZodLiteral:()=>rn,ZodMap:()=>Wn,ZodNaN:()=>qn,ZodNativeEnum:()=>an,ZodNever:()=>jt,ZodNull:()=>Jr,ZodNullable:()=>rr,ZodNumber:()=>Kr,ZodObject:()=>bt,ZodOptional:()=>Lt,ZodParsedType:()=>j,ZodPipeline:()=>Sa,ZodPromise:()=>Rr,ZodReadonly:()=>ln,ZodRecord:()=>Ei,ZodSchema:()=>ue,ZodSet:()=>jn,ZodString:()=>Ar,ZodSymbol:()=>Hn,ZodTransformer:()=>Ft,ZodTuple:()=>tr,ZodType:()=>ue,ZodUndefined:()=>Zr,ZodUnion:()=>Qr,ZodUnknown:()=>gr,ZodVoid:()=>Vn,addIssueToContext:()=>W,any:()=>Hb,array:()=>qb,bigint:()=>Fb,boolean:()=>dd,coerce:()=>fv,custom:()=>ld,date:()=>Bb,datetimeRegex:()=>od,defaultErrorMap:()=>mr,discriminatedUnion:()=>Yb,effect:()=>lv,enum:()=>iv,function:()=>rv,getErrorMap:()=>Gn,getParsedType:()=>er,instanceof:()=>Lb,intersection:()=>Zb,isAborted:()=>vi,isAsync:()=>zn,isDirty:()=>_i,isValid:()=>xr,late:()=>Ob,lazy:()=>nv,literal:()=>av,makeIssue:()=>va,map:()=>ev,nan:()=>Mb,nativeEnum:()=>ov,never:()=>Wb,null:()=>Ub,nullable:()=>uv,number:()=>ud,object:()=>Kb,objectUtil:()=>js,oboolean:()=>gv,onumber:()=>hv,optional:()=>cv,ostring:()=>mv,pipeline:()=>pv,preprocess:()=>dv,promise:()=>sv,quotelessJson:()=>lb,record:()=>Qb,set:()=>tv,setErrorMap:()=>ub,strictObject:()=>$b,string:()=>cd,symbol:()=>Gb,transformer:()=>lv,tuple:()=>Jb,undefined:()=>zb,union:()=>Xb,unknown:()=>Vb,util:()=>pe,void:()=>jb});var pe;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let i={};for(let o of n)i[o]=o;return i},r.getValidEnumValues=n=>{let i=r.objectKeys(n).filter(s=>typeof n[n[s]]!="number"),o={};for(let s of i)o[s]=n[s];return r.objectValues(o)},r.objectValues=n=>r.objectKeys(n).map(function(i){return n[i]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.push(o);return i},r.find=(n,i)=>{for(let o of n)if(i(o))return o},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function a(n,i=" | "){return n.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}r.joinValues=a,r.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(pe||(pe={}));var js;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(js||(js={}));var j=pe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),er=r=>{switch(typeof r){case"undefined":return j.undefined;case"string":return j.string;case"number":return Number.isNaN(r)?j.nan:j.number;case"boolean":return j.boolean;case"function":return j.function;case"bigint":return j.bigint;case"symbol":return j.symbol;case"object":return Array.isArray(r)?j.array:r===null?j.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?j.promise:typeof Map<"u"&&r instanceof Map?j.map:typeof Set<"u"&&r instanceof Set?j.set:typeof Date<"u"&&r instanceof Date?j.date:j.object;default:return j.unknown}};var U=pe.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"]),lb=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),yt=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},a={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)a._errors.push(t(o));else{let s=a,l=0;for(;l<o.path.length;){let c=o.path[l];l===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return n(this),a}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,pe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},a=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):a.push(e(n));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}};yt.create=r=>new yt(r);var cb=(r,e)=>{let t;switch(r.code){case U.invalid_type:r.received===j.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case U.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,pe.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:t=`Unrecognized key(s) in object: ${pe.joinValues(r.keys,", ")}`;break;case U.invalid_union:t="Invalid input";break;case U.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${pe.joinValues(r.options)}`;break;case U.invalid_enum_value:t=`Invalid enum value. Expected ${pe.joinValues(r.options)}, received '${r.received}'`;break;case U.invalid_arguments:t="Invalid function arguments";break;case U.invalid_return_type:t="Invalid function return type";break;case U.invalid_date:t="Invalid date";break;case U.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:pe.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case U.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case U.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case U.custom:t="Invalid input";break;case U.invalid_intersection_types:t="Intersection results could not be merged";break;case U.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case U.not_finite:t="Number must be finite";break;default:t=e.defaultError,pe.assertNever(r)}return{message:t}},mr=cb;var td=mr;function ub(r){td=r}function Gn(){return td}var va=r=>{let{data:e,path:t,errorMaps:a,issueData:n}=r,i=[...t,...n.path||[]],o={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let s="",l=a.filter(c=>!!c).slice().reverse();for(let c of l)s=c(o,{data:e,defaultError:s}).message;return{...n,path:i,message:s}},db=[];function W(r,e){let t=Gn(),a=va({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===mr?void 0:mr].filter(n=>!!n)});r.common.issues.push(a)}var nt=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let a=[];for(let n of t){if(n.status==="aborted")return ee;n.status==="dirty"&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){let a=[];for(let n of t){let i=await n.key,o=await n.value;a.push({key:i,value:o})}return r.mergeObjectSync(e,a)}static mergeObjectSync(e,t){let a={};for(let n of t){let{key:i,value:o}=n;if(i.status==="aborted"||o.status==="aborted")return ee;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(a[i.value]=o.value)}return{status:e.value,value:a}}},ee=Object.freeze({status:"aborted"}),qr=r=>({status:"dirty",value:r}),ot=r=>({status:"valid",value:r}),vi=r=>r.status==="aborted",_i=r=>r.status==="dirty",xr=r=>r.status==="valid",zn=r=>typeof Promise<"u"&&r instanceof Promise;var Y;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(Y||(Y={}));var Mt=class{constructor(e,t,a,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},rd=(r,e)=>{if(xr(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new yt(r.common.issues);return this._error=t,this._error}}};function se(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:a,description:n}=r;if(e&&(t||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,s)=>{let{message:l}=r;return o.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??a??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:l??t??s.defaultError}},description:n}}var ue=class{get description(){return this._def.description}_getType(e){return er(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:er(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new nt,ctx:{common:e.parent.common,data:e.data,parsedType:er(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(zn(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){let a={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:er(e)},n=this._parseSync({data:e,path:a.path,parent:a});return rd(a,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:er(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:t});return xr(a)?{value:a.value}:{issues:t.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>xr(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){let a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){let a={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:er(e)},n=this._parse({data:e,path:a.path,parent:a}),i=await(zn(n)?n:Promise.resolve(n));return rd(a,i)}refine(e,t){let a=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,i)=>{let o=e(n),s=()=>i.addIssue({code:U.custom,...a(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,t){return this._refinement((a,n)=>e(a)?!0:(n.addIssue(typeof t=="function"?t(a,n):t),!1))}_refinement(e){return new Ft({schema:this,typeName:re.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Lt.create(this,this._def)}nullable(){return rr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fr.create(this)}promise(){return Rr.create(this,this._def)}or(e){return Qr.create([this,e],this._def)}and(e){return en.create(this,e,this._def)}transform(e){return new Ft({...se(this._def),schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new on({...se(this._def),innerType:this,defaultValue:t,typeName:re.ZodDefault})}brand(){return new _a({typeName:re.ZodBranded,type:this,...se(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new sn({...se(this._def),innerType:this,catchValue:t,typeName:re.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Sa.create(this,e)}readonly(){return ln.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},pb=/^c[^\s-]{8,}$/i,mb=/^[0-9a-z]+$/,hb=/^[0-9A-HJKMNP-TV-Z]{26}$/i,gb=/^[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,fb=/^[a-z0-9_-]{21}$/i,yb=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,bb=/^[-+]?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)?)??$/,vb=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_b="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",qs,Sb=/^(?:(?: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])$/,Eb=/^(?:(?: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])$/,wb=/^(([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]))$/,Cb=/^(([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])$/,kb=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Tb=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ad="((\\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])))",xb=new RegExp(`^${ad}$`);function id(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Ab(r){return new RegExp(`^${id(r)}$`)}function od(r){let e=`${ad}T${id(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ib(r,e){return!!((e==="v4"||!e)&&Sb.test(r)||(e==="v6"||!e)&&wb.test(r))}function Rb(r,e){if(!yb.test(r))return!1;try{let[t]=r.split("."),a=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(a));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Pb(r,e){return!!((e==="v4"||!e)&&Eb.test(r)||(e==="v6"||!e)&&Cb.test(r))}var Ar=class r extends ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==j.string){let i=this._getOrReturnCtx(e);return W(i,{code:U.invalid_type,expected:j.string,received:i.parsedType}),ee}let a=new nt,n;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,s=e.data.length<i.value;(o||s)&&(n=this._getOrReturnCtx(e,n),o?W(n,{code:U.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&W(n,{code:U.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),a.dirty())}else if(i.kind==="email")vb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"email",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="emoji")qs||(qs=new RegExp(_b,"u")),qs.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"emoji",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="uuid")gb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"uuid",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="nanoid")fb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"nanoid",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid")pb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"cuid",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid2")mb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"cuid2",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="ulid")hb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"ulid",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),W(n,{validation:"url",code:U.invalid_string,message:i.message}),a.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"regex",code:U.invalid_string,message:i.message}),a.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),a.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{startsWith:i.value},message:i.message}),a.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{endsWith:i.value},message:i.message}),a.dirty()):i.kind==="datetime"?od(i).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:"datetime",message:i.message}),a.dirty()):i.kind==="date"?xb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:"date",message:i.message}),a.dirty()):i.kind==="time"?Ab(i).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:"time",message:i.message}),a.dirty()):i.kind==="duration"?bb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"duration",code:U.invalid_string,message:i.message}),a.dirty()):i.kind==="ip"?Ib(e.data,i.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"ip",code:U.invalid_string,message:i.message}),a.dirty()):i.kind==="jwt"?Rb(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"jwt",code:U.invalid_string,message:i.message}),a.dirty()):i.kind==="cidr"?Pb(e.data,i.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"cidr",code:U.invalid_string,message:i.message}),a.dirty()):i.kind==="base64"?kb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"base64",code:U.invalid_string,message:i.message}),a.dirty()):i.kind==="base64url"?Tb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"base64url",code:U.invalid_string,message:i.message}),a.dirty()):pe.assertNever(i);return{status:a.value,value:e.data}}_regex(e,t,a){return this.refinement(n=>e.test(n),{validation:t,code:U.invalid_string,...Y.errToObj(a)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Y.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Y.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Y.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Y.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Y.errToObj(t)})}nonempty(e){return this.min(1,Y.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Ar.create=r=>new Ar({checks:[],typeName:re.ZodString,coerce:r?.coerce??!1,...se(r)});function Db(r,e){let t=(r.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,n=t>a?t:a,i=Number.parseInt(r.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return i%o/10**n}var Kr=class r extends ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==j.number){let i=this._getOrReturnCtx(e);return W(i,{code:U.invalid_type,expected:j.number,received:i.parsedType}),ee}let a,n=new nt;for(let i of this._def.checks)i.kind==="int"?pe.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),W(a,{code:U.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?Db(e.data,i.value)!==0&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),W(a,{code:U.not_finite,message:i.message}),n.dirty()):pe.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,a,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:Y.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&pe.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(t===null||a.value>t)&&(t=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Kr.create=r=>new Kr({checks:[],typeName:re.ZodNumber,coerce:r?.coerce||!1,...se(r)});var $r=class r extends ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==j.bigint)return this._getInvalidInput(e);let a,n=new nt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):pe.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:j.bigint,received:t.parsedType}),ee}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,a,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:Y.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};$r.create=r=>new $r({checks:[],typeName:re.ZodBigInt,coerce:r?.coerce??!1,...se(r)});var Xr=class extends ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==j.boolean){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.boolean,received:a.parsedType}),ee}return ot(e.data)}};Xr.create=r=>new Xr({typeName:re.ZodBoolean,coerce:r?.coerce||!1,...se(r)});var Yr=class r extends ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==j.date){let i=this._getOrReturnCtx(e);return W(i,{code:U.invalid_type,expected:j.date,received:i.parsedType}),ee}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return W(i,{code:U.invalid_date}),ee}let a=new nt,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),a.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),a.dirty()):pe.assertNever(i);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Y.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Yr.create=r=>new Yr({checks:[],coerce:r?.coerce||!1,typeName:re.ZodDate,...se(r)});var Hn=class extends ue{_parse(e){if(this._getType(e)!==j.symbol){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.symbol,received:a.parsedType}),ee}return ot(e.data)}};Hn.create=r=>new Hn({typeName:re.ZodSymbol,...se(r)});var Zr=class extends ue{_parse(e){if(this._getType(e)!==j.undefined){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.undefined,received:a.parsedType}),ee}return ot(e.data)}};Zr.create=r=>new Zr({typeName:re.ZodUndefined,...se(r)});var Jr=class extends ue{_parse(e){if(this._getType(e)!==j.null){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.null,received:a.parsedType}),ee}return ot(e.data)}};Jr.create=r=>new Jr({typeName:re.ZodNull,...se(r)});var Ir=class extends ue{constructor(){super(...arguments),this._any=!0}_parse(e){return ot(e.data)}};Ir.create=r=>new Ir({typeName:re.ZodAny,...se(r)});var gr=class extends ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ot(e.data)}};gr.create=r=>new gr({typeName:re.ZodUnknown,...se(r)});var jt=class extends ue{_parse(e){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:j.never,received:t.parsedType}),ee}};jt.create=r=>new jt({typeName:re.ZodNever,...se(r)});var Vn=class extends ue{_parse(e){if(this._getType(e)!==j.undefined){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.void,received:a.parsedType}),ee}return ot(e.data)}};Vn.create=r=>new Vn({typeName:re.ZodVoid,...se(r)});var fr=class r extends ue{_parse(e){let{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==j.array)return W(t,{code:U.invalid_type,expected:j.array,received:t.parsedType}),ee;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;(o||s)&&(W(t,{code:o?U.too_big:U.too_small,minimum:s?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(W(t,{code:U.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(W(t,{code:U.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((o,s)=>n.type._parseAsync(new Mt(t,o,t.path,s)))).then(o=>nt.mergeArray(a,o));let i=[...t.data].map((o,s)=>n.type._parseSync(new Mt(t,o,t.path,s)));return nt.mergeArray(a,i)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:Y.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:Y.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:Y.toString(t)}})}nonempty(e){return this.min(1,e)}};fr.create=(r,e)=>new fr({type:r,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray,...se(e)});function Un(r){if(r instanceof bt){let e={};for(let t in r.shape){let a=r.shape[t];e[t]=Lt.create(Un(a))}return new bt({...r._def,shape:()=>e})}else return r instanceof fr?new fr({...r._def,type:Un(r.element)}):r instanceof Lt?Lt.create(Un(r.unwrap())):r instanceof rr?rr.create(Un(r.unwrap())):r instanceof tr?tr.create(r.items.map(e=>Un(e))):r}var bt=class r extends ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=pe.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==j.object){let c=this._getOrReturnCtx(e);return W(c,{code:U.invalid_type,expected:j.object,received:c.parsedType}),ee}let{status:a,ctx:n}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof jt&&this._def.unknownKeys==="strip"))for(let c in n.data)o.includes(c)||s.push(c);let l=[];for(let c of o){let u=i[c],p=n.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Mt(n,p,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof jt){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict")s.length>0&&(W(n,{code:U.unrecognized_keys,keys:s}),a.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of s){let p=n.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Mt(n,p,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,m=await u.value;c.push({key:p,value:m,alwaysSet:u.alwaysSet})}return c}).then(c=>nt.mergeObjectSync(a,c)):nt.mergeObjectSync(a,l)}get shape(){return this._def.shape()}strict(e){return Y.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,a)=>{let n=this._def.errorMap?.(t,a).message??a.defaultError;return t.code==="unrecognized_keys"?{message:Y.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:re.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let a of pe.objectKeys(e))e[a]&&this.shape[a]&&(t[a]=this.shape[a]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let a of pe.objectKeys(this.shape))e[a]||(t[a]=this.shape[a]);return new r({...this._def,shape:()=>t})}deepPartial(){return Un(this)}partial(e){let t={};for(let a of pe.objectKeys(this.shape)){let n=this.shape[a];e&&!e[a]?t[a]=n:t[a]=n.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let a of pe.objectKeys(this.shape))if(e&&!e[a])t[a]=this.shape[a];else{let i=this.shape[a];for(;i instanceof Lt;)i=i._def.innerType;t[a]=i}return new r({...this._def,shape:()=>t})}keyof(){return sd(pe.objectKeys(this.shape))}};bt.create=(r,e)=>new bt({shape:()=>r,unknownKeys:"strip",catchall:jt.create(),typeName:re.ZodObject,...se(e)});bt.strictCreate=(r,e)=>new bt({shape:()=>r,unknownKeys:"strict",catchall:jt.create(),typeName:re.ZodObject,...se(e)});bt.lazycreate=(r,e)=>new bt({shape:r,unknownKeys:"strip",catchall:jt.create(),typeName:re.ZodObject,...se(e)});var Qr=class extends ue{_parse(e){let{ctx:t}=this._processInputParams(e),a=this._def.options;function n(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map(s=>new yt(s.ctx.common.issues));return W(t,{code:U.invalid_union,unionErrors:o}),ee}if(t.common.async)return Promise.all(a.map(async i=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);{let i,o=[];for(let l of a){let c={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map(l=>new yt(l));return W(t,{code:U.invalid_union,unionErrors:s}),ee}}get options(){return this._def.options}};Qr.create=(r,e)=>new Qr({options:r,typeName:re.ZodUnion,...se(e)});var hr=r=>r instanceof tn?hr(r.schema):r instanceof Ft?hr(r.innerType()):r instanceof rn?[r.value]:r instanceof nn?r.options:r instanceof an?pe.objectValues(r.enum):r instanceof on?hr(r._def.innerType):r instanceof Zr?[void 0]:r instanceof Jr?[null]:r instanceof Lt?[void 0,...hr(r.unwrap())]:r instanceof rr?[null,...hr(r.unwrap())]:r instanceof _a||r instanceof ln?hr(r.unwrap()):r instanceof sn?hr(r._def.innerType):[],Si=class r extends ue{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.object)return W(t,{code:U.invalid_type,expected:j.object,received:t.parsedType}),ee;let a=this.discriminator,n=t.data[a],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(W(t,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){let n=new Map;for(let i of t){let o=hr(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(n.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);n.set(s,i)}}return new r({typeName:re.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...se(a)})}};function Ks(r,e){let t=er(r),a=er(e);if(r===e)return{valid:!0,data:r};if(t===j.object&&a===j.object){let n=pe.objectKeys(e),i=pe.objectKeys(r).filter(s=>n.indexOf(s)!==-1),o={...r,...e};for(let s of i){let l=Ks(r[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(t===j.array&&a===j.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let i=0;i<r.length;i++){let o=r[i],s=e[i],l=Ks(o,s);if(!l.valid)return{valid:!1};n.push(l.data)}return{valid:!0,data:n}}else return t===j.date&&a===j.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var en=class extends ue{_parse(e){let{status:t,ctx:a}=this._processInputParams(e),n=(i,o)=>{if(vi(i)||vi(o))return ee;let s=Ks(i.value,o.value);return s.valid?((_i(i)||_i(o))&&t.dirty(),{status:t.value,value:s.data}):(W(a,{code:U.invalid_intersection_types}),ee)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([i,o])=>n(i,o)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};en.create=(r,e,t)=>new en({left:r,right:e,typeName:re.ZodIntersection,...se(t)});var tr=class r extends ue{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==j.array)return W(a,{code:U.invalid_type,expected:j.array,received:a.parsedType}),ee;if(a.data.length<this._def.items.length)return W(a,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ee;!this._def.rest&&a.data.length>this._def.items.length&&(W(a,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...a.data].map((o,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new Mt(a,o,a.path,s)):null}).filter(o=>!!o);return a.common.async?Promise.all(i).then(o=>nt.mergeArray(t,o)):nt.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};tr.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new tr({items:r,typeName:re.ZodTuple,rest:null,...se(e)})};var Ei=class r extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==j.object)return W(a,{code:U.invalid_type,expected:j.object,received:a.parsedType}),ee;let n=[],i=this._def.keyType,o=this._def.valueType;for(let s in a.data)n.push({key:i._parse(new Mt(a,s,a.path,s)),value:o._parse(new Mt(a,a.data[s],a.path,s)),alwaysSet:s in a.data});return a.common.async?nt.mergeObjectAsync(t,n):nt.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,a){return t instanceof ue?new r({keyType:e,valueType:t,typeName:re.ZodRecord,...se(a)}):new r({keyType:Ar.create(),valueType:e,typeName:re.ZodRecord,...se(t)})}},Wn=class extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==j.map)return W(a,{code:U.invalid_type,expected:j.map,received:a.parsedType}),ee;let n=this._def.keyType,i=this._def.valueType,o=[...a.data.entries()].map(([s,l],c)=>({key:n._parse(new Mt(a,s,a.path,[c,"key"])),value:i._parse(new Mt(a,l,a.path,[c,"value"]))}));if(a.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ee;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),s.set(c.value,u.value)}return{status:t.value,value:s}})}else{let s=new Map;for(let l of o){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ee;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),s.set(c.value,u.value)}return{status:t.value,value:s}}}};Wn.create=(r,e,t)=>new Wn({valueType:e,keyType:r,typeName:re.ZodMap,...se(t)});var jn=class r extends ue{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==j.set)return W(a,{code:U.invalid_type,expected:j.set,received:a.parsedType}),ee;let n=this._def;n.minSize!==null&&a.data.size<n.minSize.value&&(W(a,{code:U.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&a.data.size>n.maxSize.value&&(W(a,{code:U.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function o(l){let c=new Set;for(let u of l){if(u.status==="aborted")return ee;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}let s=[...a.data.values()].map((l,c)=>i._parse(new Mt(a,l,a.path,c)));return a.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,t){return new r({...this._def,minSize:{value:e,message:Y.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:Y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};jn.create=(r,e)=>new jn({valueType:r,minSize:null,maxSize:null,typeName:re.ZodSet,...se(e)});var wi=class r extends ue{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.function)return W(t,{code:U.invalid_type,expected:j.function,received:t.parsedType}),ee;function a(s,l){return va({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Gn(),mr].filter(c=>!!c),issueData:{code:U.invalid_arguments,argumentsError:l}})}function n(s,l){return va({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Gn(),mr].filter(c=>!!c),issueData:{code:U.invalid_return_type,returnTypeError:l}})}let i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Rr){let s=this;return ot(async function(...l){let c=new yt([]),u=await s._def.args.parseAsync(l,i).catch(d=>{throw c.addIssue(a(l,d)),c}),p=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(p,i).catch(d=>{throw c.addIssue(n(p,d)),c})})}else{let s=this;return ot(function(...l){let c=s._def.args.safeParse(l,i);if(!c.success)throw new yt([a(l,c.error)]);let u=Reflect.apply(o,this,c.data),p=s._def.returns.safeParse(u,i);if(!p.success)throw new yt([n(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:tr.create(e).rest(gr.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new r({args:e||tr.create([]).rest(gr.create()),returns:t||gr.create(),typeName:re.ZodFunction,...se(a)})}},tn=class extends ue{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};tn.create=(r,e)=>new tn({getter:r,typeName:re.ZodLazy,...se(e)});var rn=class extends ue{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return W(t,{received:t.data,code:U.invalid_literal,expected:this._def.value}),ee}return{status:"valid",value:e.data}}get value(){return this._def.value}};rn.create=(r,e)=>new rn({value:r,typeName:re.ZodLiteral,...se(e)});function sd(r,e){return new nn({values:r,typeName:re.ZodEnum,...se(e)})}var nn=class r extends ue{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),a=this._def.values;return W(t,{expected:pe.joinValues(a),received:t.parsedType,code:U.invalid_type}),ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),a=this._def.values;return W(t,{received:t.data,code:U.invalid_enum_value,options:a}),ee}return ot(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(a=>!e.includes(a)),{...this._def,...t})}};nn.create=sd;var an=class extends ue{_parse(e){let t=pe.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==j.string&&a.parsedType!==j.number){let n=pe.objectValues(t);return W(a,{expected:pe.joinValues(n),received:a.parsedType,code:U.invalid_type}),ee}if(this._cache||(this._cache=new Set(pe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=pe.objectValues(t);return W(a,{received:a.data,code:U.invalid_enum_value,options:n}),ee}return ot(e.data)}get enum(){return this._def.values}};an.create=(r,e)=>new an({values:r,typeName:re.ZodNativeEnum,...se(e)});var Rr=class extends ue{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.promise&&t.common.async===!1)return W(t,{code:U.invalid_type,expected:j.promise,received:t.parsedType}),ee;let a=t.parsedType===j.promise?t.data:Promise.resolve(t.data);return ot(a.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Rr.create=(r,e)=>new Rr({type:r,typeName:re.ZodPromise,...se(e)});var Ft=class extends ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:a}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:o=>{W(a,o),o.fatal?t.abort():t.dirty()},get path(){return a.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let o=n.transform(a.data,i);if(a.common.async)return Promise.resolve(o).then(async s=>{if(t.value==="aborted")return ee;let l=await this._def.schema._parseAsync({data:s,path:a.path,parent:a});return l.status==="aborted"?ee:l.status==="dirty"?qr(l.value):t.value==="dirty"?qr(l.value):l});{if(t.value==="aborted")return ee;let s=this._def.schema._parseSync({data:o,path:a.path,parent:a});return s.status==="aborted"?ee:s.status==="dirty"?qr(s.value):t.value==="dirty"?qr(s.value):s}}if(n.type==="refinement"){let o=s=>{let l=n.refinement(s,i);if(a.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(a.common.async===!1){let s=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return s.status==="aborted"?ee:(s.status==="dirty"&&t.dirty(),o(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(s=>s.status==="aborted"?ee:(s.status==="dirty"&&t.dirty(),o(s.value).then(()=>({status:t.value,value:s.value}))))}if(n.type==="transform")if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!xr(o))return ee;let s=n.transform(o.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>xr(o)?Promise.resolve(n.transform(o.value,i)).then(s=>({status:t.value,value:s})):ee);pe.assertNever(n)}};Ft.create=(r,e,t)=>new Ft({schema:r,typeName:re.ZodEffects,effect:e,...se(t)});Ft.createWithPreprocess=(r,e,t)=>new Ft({schema:e,effect:{type:"preprocess",transform:r},typeName:re.ZodEffects,...se(t)});var Lt=class extends ue{_parse(e){return this._getType(e)===j.undefined?ot(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Lt.create=(r,e)=>new Lt({innerType:r,typeName:re.ZodOptional,...se(e)});var rr=class extends ue{_parse(e){return this._getType(e)===j.null?ot(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};rr.create=(r,e)=>new rr({innerType:r,typeName:re.ZodNullable,...se(e)});var on=class extends ue{_parse(e){let{ctx:t}=this._processInputParams(e),a=t.data;return t.parsedType===j.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};on.create=(r,e)=>new on({innerType:r,typeName:re.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...se(e)});var sn=class extends ue{_parse(e){let{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return zn(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new yt(a.common.issues)},input:a.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new yt(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};sn.create=(r,e)=>new sn({innerType:r,typeName:re.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...se(e)});var qn=class extends ue{_parse(e){if(this._getType(e)!==j.nan){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.nan,received:a.parsedType}),ee}return{status:"valid",value:e.data}}};qn.create=r=>new qn({typeName:re.ZodNaN,...se(r)});var Nb=Symbol("zod_brand"),_a=class extends ue{_parse(e){let{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}},Sa=class r extends ue{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?ee:i.status==="dirty"?(t.dirty(),qr(i.value)):this._def.out._parseAsync({data:i.value,path:a.path,parent:a})})();{let n=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?ee:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:a.path,parent:a})}}static create(e,t){return new r({in:e,out:t,typeName:re.ZodPipeline})}},ln=class extends ue{_parse(e){let t=this._def.innerType._parse(e),a=n=>(xr(n)&&(n.value=Object.freeze(n.value)),n);return zn(t)?t.then(n=>a(n)):a(t)}unwrap(){return this._def.innerType}};ln.create=(r,e)=>new ln({innerType:r,typeName:re.ZodReadonly,...se(e)});function nd(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function ld(r,e={},t){return r?Ir.create().superRefine((a,n)=>{let i=r(a);if(i instanceof Promise)return i.then(o=>{if(!o){let s=nd(e,a),l=s.fatal??t??!0;n.addIssue({code:"custom",...s,fatal:l})}});if(!i){let o=nd(e,a),s=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:s})}}):Ir.create()}var Ob={object:bt.lazycreate},re;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(re||(re={}));var Lb=(r,e={message:`Input not instance of ${r.name}`})=>ld(t=>t instanceof r,e),cd=Ar.create,ud=Kr.create,Mb=qn.create,Fb=$r.create,dd=Xr.create,Bb=Yr.create,Gb=Hn.create,zb=Zr.create,Ub=Jr.create,Hb=Ir.create,Vb=gr.create,Wb=jt.create,jb=Vn.create,qb=fr.create,Kb=bt.create,$b=bt.strictCreate,Xb=Qr.create,Yb=Si.create,Zb=en.create,Jb=tr.create,Qb=Ei.create,ev=Wn.create,tv=jn.create,rv=wi.create,nv=tn.create,av=rn.create,iv=nn.create,ov=an.create,sv=Rr.create,lv=Ft.create,cv=Lt.create,uv=rr.create,dv=Ft.createWithPreprocess,pv=Sa.create,mv=()=>cd().optional(),hv=()=>ud().optional(),gv=()=>dd().optional(),fv={string:r=>Ar.create({...r,coerce:!0}),number:r=>Kr.create({...r,coerce:!0}),boolean:r=>Xr.create({...r,coerce:!0}),bigint:r=>$r.create({...r,coerce:!0}),date:r=>Yr.create({...r,coerce:!0})};var yv=ee;var Kn="2025-03-26",pd=[Kn,"2024-11-05","2024-10-07"],Ci="2.0",md=h.union([h.string(),h.number().int()]),hd=h.string(),bv=h.object({progressToken:h.optional(md)}).passthrough(),qt=h.object({_meta:h.optional(bv)}).passthrough(),kt=h.object({method:h.string(),params:h.optional(qt)}),Ea=h.object({_meta:h.optional(h.object({}).passthrough())}).passthrough(),nr=h.object({method:h.string(),params:h.optional(Ea)}),Kt=h.object({_meta:h.optional(h.object({}).passthrough())}).passthrough(),ki=h.union([h.string(),h.number().int()]),gd=h.object({jsonrpc:h.literal(Ci),id:ki}).merge(kt).strict(),Ti=r=>gd.safeParse(r).success,fd=h.object({jsonrpc:h.literal(Ci)}).merge(nr).strict(),yd=r=>fd.safeParse(r).success,bd=h.object({jsonrpc:h.literal(Ci),id:ki,result:Kt}).strict(),wa=r=>bd.safeParse(r).success,Bt;(function(r){r[r.ConnectionClosed=-32e3]="ConnectionClosed",r[r.RequestTimeout=-32001]="RequestTimeout",r[r.ParseError=-32700]="ParseError",r[r.InvalidRequest=-32600]="InvalidRequest",r[r.MethodNotFound=-32601]="MethodNotFound",r[r.InvalidParams=-32602]="InvalidParams",r[r.InternalError=-32603]="InternalError"})(Bt||(Bt={}));var vd=h.object({jsonrpc:h.literal(Ci),id:ki,error:h.object({code:h.number().int(),message:h.string(),data:h.optional(h.unknown())})}).strict(),_d=r=>vd.safeParse(r).success,$n=h.union([gd,fd,bd,vd]),cn=Kt.strict(),xi=nr.extend({method:h.literal("notifications/cancelled"),params:Ea.extend({requestId:ki,reason:h.string().optional()})}),Sd=h.object({name:h.string(),version:h.string()}).passthrough(),vv=h.object({experimental:h.optional(h.object({}).passthrough()),sampling:h.optional(h.object({}).passthrough()),roots:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough())}).passthrough(),_v=kt.extend({method:h.literal("initialize"),params:qt.extend({protocolVersion:h.string(),capabilities:vv,clientInfo:Sd})});var Sv=h.object({experimental:h.optional(h.object({}).passthrough()),logging:h.optional(h.object({}).passthrough()),completions:h.optional(h.object({}).passthrough()),prompts:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough()),resources:h.optional(h.object({subscribe:h.optional(h.boolean()),listChanged:h.optional(h.boolean())}).passthrough()),tools:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough())}).passthrough(),$s=Kt.extend({protocolVersion:h.string(),capabilities:Sv,serverInfo:Sd,instructions:h.optional(h.string())}),Ed=nr.extend({method:h.literal("notifications/initialized")}),wd=r=>Ed.safeParse(r).success,Ai=kt.extend({method:h.literal("ping")}),Ev=h.object({progress:h.number(),total:h.optional(h.number()),message:h.optional(h.string())}).passthrough(),Ii=nr.extend({method:h.literal("notifications/progress"),params:Ea.merge(Ev).extend({progressToken:md})}),Ri=kt.extend({params:qt.extend({cursor:h.optional(hd)}).optional()}),Pi=Kt.extend({nextCursor:h.optional(hd)}),Cd=h.object({uri:h.string(),mimeType:h.optional(h.string())}).passthrough(),kd=Cd.extend({text:h.string()}),Td=Cd.extend({blob:h.string().base64()}),wv=h.object({uri:h.string(),name:h.string(),description:h.optional(h.string()),mimeType:h.optional(h.string())}).passthrough(),Cv=h.object({uriTemplate:h.string(),name:h.string(),description:h.optional(h.string()),mimeType:h.optional(h.string())}).passthrough(),kv=Ri.extend({method:h.literal("resources/list")}),Xs=Pi.extend({resources:h.array(wv)}),Tv=Ri.extend({method:h.literal("resources/templates/list")}),Ys=Pi.extend({resourceTemplates:h.array(Cv)}),xv=kt.extend({method:h.literal("resources/read"),params:qt.extend({uri:h.string()})}),Zs=Kt.extend({contents:h.array(h.union([kd,Td]))}),Av=nr.extend({method:h.literal("notifications/resources/list_changed")}),Iv=kt.extend({method:h.literal("resources/subscribe"),params:qt.extend({uri:h.string()})}),Rv=kt.extend({method:h.literal("resources/unsubscribe"),params:qt.extend({uri:h.string()})}),Pv=nr.extend({method:h.literal("notifications/resources/updated"),params:Ea.extend({uri:h.string()})}),Dv=h.object({name:h.string(),description:h.optional(h.string()),required:h.optional(h.boolean())}).passthrough(),Nv=h.object({name:h.string(),description:h.optional(h.string()),arguments:h.optional(h.array(Dv))}).passthrough(),Ov=Ri.extend({method:h.literal("prompts/list")}),Js=Pi.extend({prompts:h.array(Nv)}),Lv=kt.extend({method:h.literal("prompts/get"),params:qt.extend({name:h.string(),arguments:h.optional(h.record(h.string()))})}),Di=h.object({type:h.literal("text"),text:h.string()}).passthrough(),Ni=h.object({type:h.literal("image"),data:h.string().base64(),mimeType:h.string()}).passthrough(),Oi=h.object({type:h.literal("audio"),data:h.string().base64(),mimeType:h.string()}).passthrough(),xd=h.object({type:h.literal("resource"),resource:h.union([kd,Td])}).passthrough(),Mv=h.object({role:h.enum(["user","assistant"]),content:h.union([Di,Ni,Oi,xd])}).passthrough(),Qs=Kt.extend({description:h.optional(h.string()),messages:h.array(Mv)}),Fv=nr.extend({method:h.literal("notifications/prompts/list_changed")}),Bv=h.object({title:h.optional(h.string()),readOnlyHint:h.optional(h.boolean()),destructiveHint:h.optional(h.boolean()),idempotentHint:h.optional(h.boolean()),openWorldHint:h.optional(h.boolean())}).passthrough(),Gv=h.object({name:h.string(),description:h.optional(h.string()),inputSchema:h.object({type:h.literal("object"),properties:h.optional(h.object({}).passthrough()),required:h.optional(h.array(h.string()))}).passthrough(),outputSchema:h.optional(h.object({type:h.literal("object"),properties:h.optional(h.object({}).passthrough()),required:h.optional(h.array(h.string()))}).passthrough()),annotations:h.optional(Bv)}).passthrough(),zv=Ri.extend({method:h.literal("tools/list")}),el=Pi.extend({tools:h.array(Gv)}),Li=Kt.extend({content:h.array(h.union([Di,Ni,Oi,xd])).default([]),structuredContent:h.object({}).passthrough().optional(),isError:h.optional(h.boolean())}),mA=Li.or(Kt.extend({toolResult:h.unknown()})),Uv=kt.extend({method:h.literal("tools/call"),params:qt.extend({name:h.string(),arguments:h.optional(h.record(h.unknown()))})}),tl=nr.extend({method:h.literal("notifications/tools/list_changed")}),Ad=h.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Hv=kt.extend({method:h.literal("logging/setLevel"),params:qt.extend({level:Ad})}),rl=nr.extend({method:h.literal("notifications/message"),params:Ea.extend({level:Ad,logger:h.optional(h.string()),data:h.unknown()})}),Vv=h.object({name:h.string().optional()}).passthrough(),Wv=h.object({hints:h.optional(h.array(Vv)),costPriority:h.optional(h.number().min(0).max(1)),speedPriority:h.optional(h.number().min(0).max(1)),intelligencePriority:h.optional(h.number().min(0).max(1))}).passthrough(),jv=h.object({role:h.enum(["user","assistant"]),content:h.union([Di,Ni,Oi])}).passthrough(),qv=kt.extend({method:h.literal("sampling/createMessage"),params:qt.extend({messages:h.array(jv),systemPrompt:h.optional(h.string()),includeContext:h.optional(h.enum(["none","thisServer","allServers"])),temperature:h.optional(h.number()),maxTokens:h.number().int(),stopSequences:h.optional(h.array(h.string())),metadata:h.optional(h.object({}).passthrough()),modelPreferences:h.optional(Wv)})}),Kv=Kt.extend({model:h.string(),stopReason:h.optional(h.enum(["endTurn","stopSequence","maxTokens"]).or(h.string())),role:h.enum(["user","assistant"]),content:h.discriminatedUnion("type",[Di,Ni,Oi])}),$v=h.object({type:h.literal("ref/resource"),uri:h.string()}).passthrough(),Xv=h.object({type:h.literal("ref/prompt"),name:h.string()}).passthrough(),Yv=kt.extend({method:h.literal("completion/complete"),params:qt.extend({ref:h.union([Xv,$v]),argument:h.object({name:h.string(),value:h.string()}).passthrough()})}),nl=Kt.extend({completion:h.object({values:h.array(h.string()).max(100),total:h.optional(h.number().int()),hasMore:h.optional(h.boolean())}).passthrough()}),Zv=h.object({uri:h.string().startsWith("file://"),name:h.optional(h.string())}).passthrough(),Jv=kt.extend({method:h.literal("roots/list")}),Qv=Kt.extend({roots:h.array(Zv)}),e_=nr.extend({method:h.literal("notifications/roots/list_changed")}),hA=h.union([Ai,_v,Yv,Hv,Lv,Ov,kv,Tv,xv,Iv,Rv,Uv,zv]),gA=h.union([xi,Ii,Ed,e_]),fA=h.union([cn,Kv,Qv]),yA=h.union([Ai,qv,Jv]),bA=h.union([xi,Ii,rl,Pv,Av,tl,Fv]),vA=h.union([cn,$s,nl,Qs,Js,Xs,Ys,Zs,Li,el]),Gt=class extends Error{constructor(e,t,a){super(`MCP error ${e}: ${t}`),this.code=e,this.data=a,this.name="McpError"}};var t_=6e4,Mi=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(xi,t=>{let a=this._requestHandlerAbortControllers.get(t.params.requestId);a?.abort(t.params.reason)}),this.setNotificationHandler(Ii,t=>{this._onprogress(t)}),this.setRequestHandler(Ai,t=>({}))}_setupTimeout(e,t,a,n,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:a,resetTimeoutOnProgress:i,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let a=Date.now()-t.startTime;if(t.maxTotalTimeout&&a>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Gt(Bt.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:a});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=t=>{this._onerror(t)},this._transport.onmessage=(t,a)=>{wa(t)||_d(t)?this._onresponse(t):Ti(t)?this._onrequest(t,a):yd(t)?this._onnotification(t):this._onerror(new Error(`Unknown message type: ${JSON.stringify(t)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let a=new Gt(Bt.ConnectionClosed,"Connection closed");for(let n of t.values())n(a)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let a=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;a!==void 0&&Promise.resolve().then(()=>a(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,t){var a,n,i,o;let s=(a=this._requestHandlers.get(e.method))!==null&&a!==void 0?a:this.fallbackRequestHandler;if(s===void 0){(n=this._transport)===null||n===void 0||n.send({jsonrpc:"2.0",id:e.id,error:{code:Bt.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);let c={signal:l.signal,sessionId:(i=this._transport)===null||i===void 0?void 0:i.sessionId,_meta:(o=e.params)===null||o===void 0?void 0:o._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,p,m)=>this.request(u,p,{...m,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id};Promise.resolve().then(()=>s(e,c)).then(u=>{var p;if(!l.signal.aborted)return(p=this._transport)===null||p===void 0?void 0:p.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var p,m;if(!l.signal.aborted)return(p=this._transport)===null||p===void 0?void 0:p.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:Bt.InternalError,message:(m=u.message)!==null&&m!==void 0?m:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...a}=e.params,n=Number(t),i=this._progressHandlers.get(n);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(n),s=this._timeoutInfo.get(n);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(l){o(l);return}i(a)}_onresponse(e){let t=Number(e.id),a=this._responseHandlers.get(t);if(a===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),wa(e))a(e);else{let n=new Gt(e.error.code,e.error.message,e.error.data);a(n)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,a){let{relatedRequestId:n,resumptionToken:i,onresumptiontoken:o}=a??{};return new Promise((s,l)=>{var c,u,p,m,d,g;if(!this._transport){l(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=a?.signal)===null||u===void 0||u.throwIfAborted();let f=this._requestMessageId++,y={...e,jsonrpc:"2.0",id:f};a?.onprogress&&(this._progressHandlers.set(f,a.onprogress),y.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:f}});let v=I=>{var D;this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),(D=this._transport)===null||D===void 0||D.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(I)}},{relatedRequestId:n,resumptionToken:i,onresumptiontoken:o}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`))),l(I)};this._responseHandlers.set(f,I=>{var D;if(!(!((D=a?.signal)===null||D===void 0)&&D.aborted)){if(I instanceof Error)return l(I);try{let C=t.parse(I.result);s(C)}catch(C){l(C)}}}),(m=a?.signal)===null||m===void 0||m.addEventListener("abort",()=>{var I;v((I=a?.signal)===null||I===void 0?void 0:I.reason)});let T=(d=a?.timeout)!==null&&d!==void 0?d:t_,E=()=>v(new Gt(Bt.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(f,T,a?.maxTotalTimeout,E,(g=a?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(y,{relatedRequestId:n,resumptionToken:i,onresumptiontoken:o}).catch(I=>{this._cleanupTimeout(f),l(I)})})}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let a={...e,jsonrpc:"2.0"};await this._transport.send(a,t)}setRequestHandler(e,t){let a=e.shape.method.value;this.assertRequestHandlerCapability(a),this._requestHandlers.set(a,(n,i)=>Promise.resolve(t(e.parse(n),i)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,a=>Promise.resolve(t(e.parse(a))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Id(r,e){return Object.entries(e).reduce((t,[a,n])=>(n&&typeof n=="object"?t[a]=t[a]?{...t[a],...n}:n:t[a]=n,t),{...r})}var Pm=Es(Rm(),1),ka=class extends Mi{constructor(e,t){var a;super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(a=t?.capabilities)!==null&&a!==void 0?a:{},this._ajv=new Pm.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Id(this._capabilities,e)}assertCapability(e,t){var a;if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a[e]))throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{let a=await this.request({method:"initialize",params:{protocolVersion:Kn,capabilities:this._capabilities,clientInfo:this._clientInfo}},$s,t);if(a===void 0)throw new Error(`Server sent invalid initialize result: ${a}`);if(!pd.includes(a.protocolVersion))throw new Error(`Server's protocol version is not supported: ${a.protocolVersion}`);this._serverCapabilities=a.capabilities,this._serverVersion=a.serverInfo,this._instructions=a.instructions,await this.notification({method:"notifications/initialized"})}catch(a){throw this.close(),a}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var t,a,n,i,o;switch(e){case"logging/setLevel":if(!(!((t=this._serverCapabilities)===null||t===void 0)&&t.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var t;switch(e){case"notifications/roots/list_changed":if(!(!((t=this._capabilities.roots)===null||t===void 0)&&t.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},cn,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},nl,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},cn,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},Qs,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},Js,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},Xs,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},Ys,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Zs,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},cn,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},cn,t)}async callTool(e,t=Li,a){let n=await this.request({method:"tools/call",params:e},t,a),i=this.getToolOutputValidator(e.name);if(i){if(!n.structuredContent&&!n.isError)throw new Gt(Bt.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(n.structuredContent)try{if(!i(n.structuredContent))throw new Gt(Bt.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(i.errors)}`)}catch(o){throw o instanceof Gt?o:new Gt(Bt.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return n}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let t of e)if(t.outputSchema)try{let a=this._ajv.compile(t.outputSchema);this._cachedToolOutputValidators.set(t.name,a)}catch(a){console.warn(`Failed to compile output schema for tool ${t.name}: ${a}`)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let a=await this.request({method:"tools/list",params:e},el,t);return this.cacheToolOutputSchemas(a.tools),a}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Al;Al=globalThis.crypto;async function OS(r){return(await Al).getRandomValues(new Uint8Array(r))}async function LS(r){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",t="",a=await OS(r);for(let n=0;n<r;n++){let i=a[n]%e.length;t+=e[i]}return t}async function MS(r){return await LS(r)}async function FS(r){let e=await(await Al).subtle.digest("SHA-256",new TextEncoder().encode(r));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Il(r){if(r||(r=43),r<43||r>128)throw`Expected a length between 43 and 128. Received ${r}.`;let e=await MS(r),t=await FS(e);return{code_verifier:e,code_challenge:t}}var Dm=h.object({resource:h.string().url(),authorization_servers:h.array(h.string().url()).optional(),jwks_uri:h.string().url().optional(),scopes_supported:h.array(h.string()).optional(),bearer_methods_supported:h.array(h.string()).optional(),resource_signing_alg_values_supported:h.array(h.string()).optional(),resource_name:h.string().optional(),resource_documentation:h.string().optional(),resource_policy_uri:h.string().url().optional(),resource_tos_uri:h.string().url().optional(),tls_client_certificate_bound_access_tokens:h.boolean().optional(),authorization_details_types_supported:h.array(h.string()).optional(),dpop_signing_alg_values_supported:h.array(h.string()).optional(),dpop_bound_access_tokens_required:h.boolean().optional()}).passthrough(),Nm=h.object({issuer:h.string(),authorization_endpoint:h.string(),token_endpoint:h.string(),registration_endpoint:h.string().optional(),scopes_supported:h.array(h.string()).optional(),response_types_supported:h.array(h.string()),response_modes_supported:h.array(h.string()).optional(),grant_types_supported:h.array(h.string()).optional(),token_endpoint_auth_methods_supported:h.array(h.string()).optional(),token_endpoint_auth_signing_alg_values_supported:h.array(h.string()).optional(),service_documentation:h.string().optional(),revocation_endpoint:h.string().optional(),revocation_endpoint_auth_methods_supported:h.array(h.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:h.array(h.string()).optional(),introspection_endpoint:h.string().optional(),introspection_endpoint_auth_methods_supported:h.array(h.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:h.array(h.string()).optional(),code_challenge_methods_supported:h.array(h.string()).optional()}).passthrough(),Rl=h.object({access_token:h.string(),token_type:h.string(),expires_in:h.number().optional(),scope:h.string().optional(),refresh_token:h.string().optional()}).strip(),vI=h.object({error:h.string(),error_description:h.string().optional(),error_uri:h.string().optional()}),BS=h.object({redirect_uris:h.array(h.string()).refine(r=>r.every(e=>URL.canParse(e)),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:h.string().optional(),grant_types:h.array(h.string()).optional(),response_types:h.array(h.string()).optional(),client_name:h.string().optional(),client_uri:h.string().optional(),logo_uri:h.string().optional(),scope:h.string().optional(),contacts:h.array(h.string()).optional(),tos_uri:h.string().optional(),policy_uri:h.string().optional(),jwks_uri:h.string().optional(),jwks:h.any().optional(),software_id:h.string().optional(),software_version:h.string().optional()}).strip(),GS=h.object({client_id:h.string(),client_secret:h.string().optional(),client_id_issued_at:h.number().optional(),client_secret_expires_at:h.number().optional()}).strip(),Om=BS.merge(GS),_I=h.object({error:h.string(),error_description:h.string().optional()}).strip(),SI=h.object({token:h.string(),token_type_hint:h.string().optional()}).strip();var vt=class extends Error{constructor(e){super(e??"Unauthorized")}};async function Or(r,{serverUrl:e,authorizationCode:t,scope:a,resourceMetadataUrl:n}){let i=e;try{let m=await zS(n||e);m.authorization_servers&&m.authorization_servers.length>0&&(i=m.authorization_servers[0])}catch(m){console.warn("Could not load OAuth Protected Resource metadata, falling back to /.well-known/oauth-authorization-server",m)}let o=await US(i),s=await Promise.resolve(r.clientInformation());if(!s){if(t!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!r.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let m=await jS(i,{metadata:o,clientMetadata:r.clientMetadata});await r.saveClientInformation(m),s=m}if(t!==void 0){let m=await r.codeVerifier(),d=await VS(i,{metadata:o,clientInformation:s,authorizationCode:t,codeVerifier:m,redirectUri:r.redirectUrl});return await r.saveTokens(d),"AUTHORIZED"}let l=await r.tokens();if(l?.refresh_token)try{let m=await WS(i,{metadata:o,clientInformation:s,refreshToken:l.refresh_token});return await r.saveTokens(m),"AUTHORIZED"}catch(m){console.error("Could not refresh OAuth tokens:",m)}let c=r.state?await r.state():void 0,{authorizationUrl:u,codeVerifier:p}=await HS(i,{metadata:o,clientInformation:s,state:c,redirectUrl:r.redirectUrl,scope:a||r.clientMetadata.scope});return await r.saveCodeVerifier(p),await r.redirectToAuthorization(u),"REDIRECT"}function to(r){let e=r.headers.get("WWW-Authenticate");if(!e)return;let[t,a]=e.split(" ");if(t.toLowerCase()!=="bearer"||!a){console.log("Invalid WWW-Authenticate header format, expected 'Bearer'");return}let i=/resource_metadata="([^"]*)"/.exec(e);if(i)try{return new URL(i[1])}catch{console.log("Invalid resource metadata url: ",i[1]);return}}async function zS(r,e){var t;let a;e?.resourceMetadataUrl?a=new URL(e?.resourceMetadataUrl):a=new URL("/.well-known/oauth-protected-resource",r);let n;try{n=await fetch(a,{headers:{"MCP-Protocol-Version":(t=e?.protocolVersion)!==null&&t!==void 0?t:Kn}})}catch(i){if(i instanceof TypeError)n=await fetch(a);else throw i}if(n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return Dm.parse(await n.json())}async function US(r,e){var t;let a=new URL("/.well-known/oauth-authorization-server",r),n;try{n=await fetch(a,{headers:{"MCP-Protocol-Version":(t=e?.protocolVersion)!==null&&t!==void 0?t:Kn}})}catch(i){if(i instanceof TypeError)n=await fetch(a);else throw i}if(n.status!==404){if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth metadata`);return Nm.parse(await n.json())}}async function HS(r,{metadata:e,clientInformation:t,redirectUrl:a,scope:n,state:i}){let o="code",s="S256",l;if(e){if(l=new URL(e.authorization_endpoint),!e.response_types_supported.includes(o))throw new Error(`Incompatible auth server: does not support response type ${o}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(s))throw new Error(`Incompatible auth server: does not support code challenge method ${s}`)}else l=new URL("/authorize",r);let c=await Il(),u=c.code_verifier,p=c.code_challenge;return l.searchParams.set("response_type",o),l.searchParams.set("client_id",t.client_id),l.searchParams.set("code_challenge",p),l.searchParams.set("code_challenge_method",s),l.searchParams.set("redirect_uri",String(a)),i&&l.searchParams.set("state",i),n&&l.searchParams.set("scope",n),{authorizationUrl:l,codeVerifier:u}}async function VS(r,{metadata:e,clientInformation:t,authorizationCode:a,codeVerifier:n,redirectUri:i}){let o="authorization_code",s;if(e){if(s=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(o))throw new Error(`Incompatible auth server: does not support grant type ${o}`)}else s=new URL("/token",r);let l=new URLSearchParams({grant_type:o,client_id:t.client_id,code:a,code_verifier:n,redirect_uri:String(i)});t.client_secret&&l.set("client_secret",t.client_secret);let c=await fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:l});if(!c.ok)throw new Error(`Token exchange failed: HTTP ${c.status}`);return Rl.parse(await c.json())}async function WS(r,{metadata:e,clientInformation:t,refreshToken:a}){let n="refresh_token",i;if(e){if(i=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(n))throw new Error(`Incompatible auth server: does not support grant type ${n}`)}else i=new URL("/token",r);let o=new URLSearchParams({grant_type:n,client_id:t.client_id,refresh_token:a});t.client_secret&&o.set("client_secret",t.client_secret);let s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o});if(!s.ok)throw new Error(`Token refresh failed: HTTP ${s.status}`);return Rl.parse({refresh_token:a,...await s.json()})}async function jS(r,{metadata:e,clientMetadata:t}){let a;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");a=new URL(e.registration_endpoint)}else a=new URL("/register",r);let n=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`Dynamic client registration failed: HTTP ${n.status}`);return Om.parse(await n.json())}var ro=class extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function Pl(r){}function no(r){if(typeof r=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Pl,onError:t=Pl,onRetry:a=Pl,onComment:n}=r,i="",o=!0,s,l="",c="";function u(f){let y=o?f.replace(/^\xEF\xBB\xBF/,""):f,[v,T]=qS(`${i}${y}`);for(let E of v)p(E);i=T,o=!1}function p(f){if(f===""){d();return}if(f.startsWith(":")){n&&n(f.slice(f.startsWith(": ")?2:1));return}let y=f.indexOf(":");if(y!==-1){let v=f.slice(0,y),T=f[y+1]===" "?2:1,E=f.slice(y+T);m(v,E,f);return}m(f,"",f)}function m(f,y,v){switch(f){case"event":c=y;break;case"data":l=`${l}${y}
|
|
3255
|
-
`;break;case"id":s=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?a(parseInt(y,10)):t(new
|
|
3256
|
-
`)?l.slice(0,-1):l}),s=void 0,l="",c=""}function g(f={}){i&&f.consume&&p(i),o=!0,s=void 0,l="",c="",i=""}return{feed:u,reset:g}}function
|
|
3254
|
+
`),e.createGroup("actions").setItemPadding(25),e.createGroup("messages").setItemPadding(10),e})();this.config={...this.config,...e},this.tokenWindow.size=this.config.maxTokens||4096}get contextGroup(){return this.tokenWindow.group("context")}get toolGroup(){return this.tokenWindow.group("actions")}get messageGroup(){return this.tokenWindow.group("messages")}async sendMessage(e){let t={role:"user",content:e};this.messageGroup.add({id:"msg-"+Gn++,content:JSON.stringify(t),customData:t}),await this.processMessages();let n=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;return n?.role=="assistant"&&n.content||""}addAssistantMessage(e){let t={role:"assistant",content:e};this.messageGroup.add({id:"msg-"+Gn++,content:JSON.stringify(t),customData:t})}addUserMessage(e){let t={role:"user",content:e};this.messageGroup.add({id:"msg-"+Gn++,content:JSON.stringify(t),customData:t})}getMessages(){return this.messageGroup.items.map(e=>e.customData)}getLatestMessage(){return this.messageGroup.items.length?this.messageGroup.items[this.messageGroup.items.length-1]?.customData:void 0}async processMessages(){await this.config.onBeforeMessageProcessing?.(),hr.debugEnabled&&hr.debug("Process message state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(a=>a.customData),messages:this.messageGroup.items.map(a=>a.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let t=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;if(t?.role=="user"||t?.role=="tool")await this.sendToAPI(),await this.processMessages();else if(t?.role=="assistant"&&t?.tool_calls?.length){for(let a of t.tool_calls)await this.processToolCall(a);await this.processMessages()}}async trimMessages(){for(this.tokenWindow.removeOverflow();this.messageGroup.items.length&&this.messageGroup.items[0].customData?.role=="tool";)this.messageGroup.items.shift()}async sendToAPI(e){this.config.systemMessage&&this.contextGroup.add({id:"_gpt_context",cannotRemove:!0,sortOrder:0,content:this.config.systemMessage}),await this.trimMessages();let t=0;for(let l=this.messageGroup.items.length-1;l>=0;l--){let c=this.messageGroup.items[l].customData;if(c.role=="assistant"&&c.tool_calls){if(t+=1,t>=this.maxToolCallsPerMessage)throw new Error(`Exceeded the maximum tool calls per message limit of ${this.maxToolCallsPerMessage}.`)}else if(c.role=="user")break}hr.debugEnabled&&hr.debug("Before LLM state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(l=>l.customData),messages:this.messageGroup.items.map(l=>l.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let a={model:this.config.model,temperature:.2,user:this.config.userID,tools:[],stream:!!this.config.stream,messages:[{role:"system",content:this.contextGroup.getAllAsString()},...this.messageGroup.getAll().map(l=>l.customData)]};for(let l of this.toolGroup.getAll()){let c=l.customData;c.description&&c.description.length>1024&&hr.warn(`Tool description for "${c.name}" is too long, it will be truncated.`);let u={type:"function",function:{name:c.name,description:(c.description||"").substring(0,1024),parameters:c.params}};a.tools.push(u)}a.user||delete a.user,a.tools.length||delete a.tools;let n={};if(n["Content-Type"]="application/json",this.config.apiKey&&(n.Authorization=`Bearer ${this.config.apiKey}`),e)return a;let i=await fetch(this.config.endpoint||"https://api.openai.com/v1/chat/completions",{method:"POST",headers:n,body:JSON.stringify(a)});if(!i.ok){let l=`${i.status} ${i.statusText}`;try{let u=await i.json();l=u.errorText||u.error?.message||u.error||l}catch{}let c=new Error(l);throw c.code=i.status,c}let o=null,s=null;if(this.config.stream){for await(let c of pu(i.body)){if(c.data=="[DONE]")break;if(!c.data)continue;let u=JSON.parse(c.data);if(s){for(let p in u.choices[0].delta)if(typeof u.choices[0].delta[p]=="string"){if(p=="role"&&s[p]==u.choices[0].delta[p])continue;s[p]=(s[p]||"")+u.choices[0].delta[p]}for(let p of u.choices[0].delta.tool_calls||[]){if(s.tool_calls||(s.tool_calls=[]),!s.tool_calls[p.index]){s.tool_calls[p.index]=p;continue}let m=s.tool_calls[p.index];m.function=m.function||{},m.function.name=(m.function.name||"")+(p.function?.name||""),m.function.arguments=(m.function.arguments||"")+(p.function?.arguments||"")}}else s={chunkID:u.id,...u.choices[0].delta};s?.content&&!s.content.startsWith("{")&&this.config.onAIMessage?.(s.content,!0)}let l=$r(JSON.stringify(a)+JSON.stringify(s)||"");this.stats.tokensUsed+=l,hr.debug(`Estimated ${l} tokens for streaming response, total used: ${this.stats.tokensUsed}`)}else o=await i.json(),this.stats.tokensUsed+=o.usage?.total_tokens||0,hr.debug(`Used ${o.usage?.total_tokens||0} tokens, total used: ${this.stats.tokensUsed}`),s=o.choices?.[0]?.message;if(s||(hr.warn("No response block in API response."),s={role:"assistant",content:""}),s.role=="user")throw new Error("API returned a user message, which is not allowed.");this.processIncomingMessage(s),this.messageGroup.add({id:"msg-"+Gn++,content:JSON.stringify(s),customData:s}),s.content&&this.config.onAIMessage?.(s.content,!1)}processIncomingMessage(e){}registerTool(e){this.toolGroup.add({id:e.name,cannotRemove:!e.canRemove,content:JSON.stringify(e),customData:e})}async processToolCall(e){try{let a=this.toolGroup.items.find(s=>s.id==e.function.name)?.customData;if(!a)throw new Error(`Tool "${e.function.name}" not found.`);let n=JSON.parse(e.function.arguments);this.config.onAIToolStart?.(e.function.name,n);let i=await a.callback(n);typeof i!="string"&&(i=JSON.stringify(i)||""),(i===""||i==="undefined")&&(i="success");let o={role:"tool",content:i,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+Gn++,content:JSON.stringify(o),customData:o})}catch(t){hr.warn(`Unable to process tool call for "${e?.function?.name}"`,t);let a={role:"tool",content:`Error: ${t.message}`,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+Gn++,content:JSON.stringify(a),customData:a})}}resetConversation(){this.messageGroup.empty(),this.toolGroup.empty(),this.contextGroup.empty()}};var De=function(){return De=Object.assign||function(e){for(var t,a=1,n=arguments.length;a<n;a++){t=arguments[a];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},De.apply(this,arguments)};function Jy(r,e,t,a){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function s(u){try{c(a.next(u))}catch(p){o(p)}}function l(u){try{c(a.throw(u))}catch(p){o(p)}}function c(u){u.done?i(u.value):n(u.value).then(s,l)}c((a=a.apply(r,e||[])).next())})}function Qy(r,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,n,i,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(c){return function(u){return l([c,u])}}function l(c){if(a)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(t=0)),t;)try{if(a=1,n&&(i=c[0]&2?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,n=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1],i=c;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(c);break}i[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(r,t)}catch(u){c=[6,u],n=0}finally{a=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function de(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],a=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ue(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var a=t.call(r),n,i=[],o;try{for(;(e===void 0||e-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(s){o={error:s}}finally{try{n&&!n.done&&(t=a.return)&&t.call(a)}finally{if(o)throw o.error}}return i}var eb="ENTRIES",Xu="KEYS",Yu="VALUES",rt="",Ms=function(){function r(e,t){var a=e._tree,n=Array.from(a.keys());this.set=e,this._type=t,this._path=n.length>0?[{node:a,keys:n}]:[]}return r.prototype.next=function(){var e=this.dive();return this.backtrack(),e},r.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var e=zn(this._path),t=e.node,a=e.keys;if(zn(a)===rt)return{done:!1,value:this.result()};var n=t.get(zn(a));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()},r.prototype.backtrack=function(){if(this._path.length!==0){var e=zn(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}},r.prototype.key=function(){return this.set._prefix+this._path.map(function(e){var t=e.keys;return zn(t)}).filter(function(e){return e!==rt}).join("")},r.prototype.value=function(){return zn(this._path).node.get(rt)},r.prototype.result=function(){switch(this._type){case Yu:return this.value();case Xu:return this.key();default:return[this.key(),this.value()]}},r.prototype[Symbol.iterator]=function(){return this},r}(),zn=function(r){return r[r.length-1]},tb=function(r,e,t){var a=new Map;if(e===void 0)return a;for(var n=e.length+1,i=n+t,o=new Uint8Array(i*n).fill(t+1),s=0;s<n;++s)o[s]=s;for(var l=1;l<i;++l)o[l*n]=l;return Zu(r,e,t,a,o,1,n,""),a},Zu=function(r,e,t,a,n,i,o,s){var l,c,u=i*o;try{e:for(var p=de(r.keys()),m=p.next();!m.done;m=p.next()){var d=m.value;if(d===rt){var g=n[u-1];g<=t&&a.set(s,[r.get(d),g])}else{for(var f=i,y=0;y<d.length;++y,++f){for(var v=d[y],T=o*f,E=T-o,I=n[T],D=Math.max(0,f-t-1),C=Math.min(o-1,f+t),M=D;M<C;++M){var F=v!==e[M],R=n[E+M]+ +F,G=n[E+M+1]+1,z=n[T+M]+1,O=n[T+M+1]=Math.min(R,G,z);O<I&&(I=O)}if(I>t)continue e}Zu(r.get(d),e,t,a,n,f,o,s+d)}}}catch(x){l={error:x}}finally{try{m&&!m.done&&(c=p.return)&&c.call(p)}finally{if(l)throw l.error}}},Fs=function(){function r(e,t){e===void 0&&(e=new Map),t===void 0&&(t=""),this._size=void 0,this._tree=e,this._prefix=t}return r.prototype.atPrefix=function(e){var t,a;if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");var n=Ue(_i(this._tree,e.slice(this._prefix.length)),2),i=n[0],o=n[1];if(i===void 0){var s=Ue(js(o),2),l=s[0],c=s[1];try{for(var u=de(l.keys()),p=u.next();!p.done;p=u.next()){var m=p.value;if(m!==rt&&m.startsWith(c)){var d=new Map;return d.set(m.slice(c.length),l.get(m)),new r(d,e)}}}catch(g){t={error:g}}finally{try{p&&!p.done&&(a=u.return)&&a.call(u)}finally{if(t)throw t.error}}}return new r(i,e)},r.prototype.clear=function(){this._size=void 0,this._tree.clear()},r.prototype.delete=function(e){return this._size=void 0,rb(this._tree,e)},r.prototype.entries=function(){return new Ms(this,eb)},r.prototype.forEach=function(e){var t,a;try{for(var n=de(this),i=n.next();!i.done;i=n.next()){var o=Ue(i.value,2),s=o[0],l=o[1];e(s,l,this)}}catch(c){t={error:c}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},r.prototype.fuzzyGet=function(e,t){return tb(this._tree,e,t)},r.prototype.get=function(e){var t=Hs(this._tree,e);return t!==void 0?t.get(rt):void 0},r.prototype.has=function(e){var t=Hs(this._tree,e);return t!==void 0&&t.has(rt)},r.prototype.keys=function(){return new Ms(this,Xu)},r.prototype.set=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var a=Bs(this._tree,e);return a.set(rt,t),this},Object.defineProperty(r.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var e=this.entries();!e.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),r.prototype.update=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var a=Bs(this._tree,e);return a.set(rt,t(a.get(rt))),this},r.prototype.fetch=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var a=Bs(this._tree,e),n=a.get(rt);return n===void 0&&a.set(rt,n=t()),n},r.prototype.values=function(){return new Ms(this,Yu)},r.prototype[Symbol.iterator]=function(){return this.entries()},r.from=function(e){var t,a,n=new r;try{for(var i=de(e),o=i.next();!o.done;o=i.next()){var s=Ue(o.value,2),l=s[0],c=s[1];n.set(l,c)}}catch(u){t={error:u}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(t)throw t.error}}return n},r.fromObject=function(e){return r.from(Object.entries(e))},r}(),_i=function(r,e,t){var a,n;if(t===void 0&&(t=[]),e.length===0||r==null)return[r,t];try{for(var i=de(r.keys()),o=i.next();!o.done;o=i.next()){var s=o.value;if(s!==rt&&e.startsWith(s))return t.push([r,s]),_i(r.get(s),e.slice(s.length),t)}}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return t.push([r,e]),_i(void 0,"",t)},Hs=function(r,e){var t,a;if(e.length===0||r==null)return r;try{for(var n=de(r.keys()),i=n.next();!i.done;i=n.next()){var o=i.value;if(o!==rt&&e.startsWith(o))return Hs(r.get(o),e.slice(o.length))}}catch(s){t={error:s}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},Bs=function(r,e){var t,a,n=e.length;e:for(var i=0;r&&i<n;){try{for(var o=(t=void 0,de(r.keys())),s=o.next();!s.done;s=o.next()){var l=s.value;if(l!==rt&&e[i]===l[0]){for(var c=Math.min(n-i,l.length),u=1;u<c&&e[i+u]===l[u];)++u;var p=r.get(l);if(u===l.length)r=p;else{var m=new Map;m.set(l.slice(u),p),r.set(e.slice(i,i+u),m),r.delete(l),r=m}i+=u;continue e}}}catch(g){t={error:g}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(t)throw t.error}}var d=new Map;return r.set(e.slice(i),d),d}return r},rb=function(r,e){var t=Ue(_i(r,e),2),a=t[0],n=t[1];if(a!==void 0){if(a.delete(rt),a.size===0)Ju(n);else if(a.size===1){var i=Ue(a.entries().next().value,2),o=i[0],s=i[1];Qu(n,o,s)}}},Ju=function(r){if(r.length!==0){var e=Ue(js(r),2),t=e[0],a=e[1];if(t.delete(a),t.size===0)Ju(r.slice(0,-1));else if(t.size===1){var n=Ue(t.entries().next().value,2),i=n[0],o=n[1];i!==rt&&Qu(r.slice(0,-1),i,o)}}},Qu=function(r,e,t){if(r.length!==0){var a=Ue(js(r),2),n=a[0],i=a[1];n.set(i+e,t),n.delete(i)}},js=function(r){return r[r.length-1]},va,qs="or",ed="and",nb="and_not",td=function(){function r(e){if(e?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');var t=e.autoVacuum==null||e.autoVacuum===!0?Us:e.autoVacuum;this._options=De(De(De({},zs),e),{autoVacuum:t,searchOptions:De(De({},ju),e.searchOptions||{}),autoSuggestOptions:De(De({},lb),e.autoSuggestOptions||{})}),this._index=new Fs,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=Ws,this.addFields(this._options.fields)}return r.prototype.add=function(e){var t,a,n,i,o,s,l=this._options,c=l.extractField,u=l.tokenize,p=l.processTerm,m=l.fields,d=l.idField,g=c(e,d);if(g==null)throw new Error('MiniSearch: document does not have ID field "'.concat(d,'"'));if(this._idToShortId.has(g))throw new Error("MiniSearch: duplicate ID ".concat(g));var f=this.addDocumentId(g);this.saveStoredFields(f,e);try{for(var y=de(m),v=y.next();!v.done;v=y.next()){var T=v.value,E=c(e,T);if(E!=null){var I=u(E.toString(),T),D=this._fieldIds[T],C=new Set(I).size;this.addFieldLength(f,D,this._documentCount-1,C);try{for(var M=(n=void 0,de(I)),F=M.next();!F.done;F=M.next()){var R=F.value,G=p(R,T);if(Array.isArray(G))try{for(var z=(o=void 0,de(G)),O=z.next();!O.done;O=z.next()){var x=O.value;this.addTerm(D,f,x)}}catch(A){o={error:A}}finally{try{O&&!O.done&&(s=z.return)&&s.call(z)}finally{if(o)throw o.error}}else G&&this.addTerm(D,f,G)}}catch(A){n={error:A}}finally{try{F&&!F.done&&(i=M.return)&&i.call(M)}finally{if(n)throw n.error}}}}}catch(A){t={error:A}}finally{try{v&&!v.done&&(a=y.return)&&a.call(y)}finally{if(t)throw t.error}}},r.prototype.addAll=function(e){var t,a;try{for(var n=de(e),i=n.next();!i.done;i=n.next()){var o=i.value;this.add(o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},r.prototype.addAllAsync=function(e,t){var a=this;t===void 0&&(t={});var n=t.chunkSize,i=n===void 0?10:n,o={chunk:[],promise:Promise.resolve()},s=e.reduce(function(u,p,m){var d=u.chunk,g=u.promise;return d.push(p),(m+1)%i===0?{chunk:[],promise:g.then(function(){return new Promise(function(f){return setTimeout(f,0)})}).then(function(){return a.addAll(d)})}:{chunk:d,promise:g}},o),l=s.chunk,c=s.promise;return c.then(function(){return a.addAll(l)})},r.prototype.remove=function(e){var t,a,n,i,o,s,l=this._options,c=l.tokenize,u=l.processTerm,p=l.extractField,m=l.fields,d=l.idField,g=p(e,d);if(g==null)throw new Error('MiniSearch: document does not have ID field "'.concat(d,'"'));var f=this._idToShortId.get(g);if(f==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(g,": it is not in the index"));try{for(var y=de(m),v=y.next();!v.done;v=y.next()){var T=v.value,E=p(e,T);if(E!=null){var I=c(E.toString(),T),D=this._fieldIds[T],C=new Set(I).size;this.removeFieldLength(f,D,this._documentCount,C);try{for(var M=(n=void 0,de(I)),F=M.next();!F.done;F=M.next()){var R=F.value,G=u(R,T);if(Array.isArray(G))try{for(var z=(o=void 0,de(G)),O=z.next();!O.done;O=z.next()){var x=O.value;this.removeTerm(D,f,x)}}catch(A){o={error:A}}finally{try{O&&!O.done&&(s=z.return)&&s.call(z)}finally{if(o)throw o.error}}else G&&this.removeTerm(D,f,G)}}catch(A){n={error:A}}finally{try{F&&!F.done&&(i=M.return)&&i.call(M)}finally{if(n)throw n.error}}}}}catch(A){t={error:A}}finally{try{v&&!v.done&&(a=y.return)&&a.call(y)}finally{if(t)throw t.error}}this._storedFields.delete(f),this._documentIds.delete(f),this._idToShortId.delete(g),this._fieldLength.delete(f),this._documentCount-=1},r.prototype.removeAll=function(e){var t,a;if(e)try{for(var n=de(e),i=n.next();!i.done;i=n.next()){var o=i.value;this.remove(o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Fs,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},r.prototype.discard=function(e){var t=this,a=this._idToShortId.get(e);if(a==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(e,": it is not in the index"));this._idToShortId.delete(e),this._documentIds.delete(a),this._storedFields.delete(a),(this._fieldLength.get(a)||[]).forEach(function(n,i){t.removeFieldLength(a,i,t._documentCount,n)}),this._fieldLength.delete(a),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},r.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var e=this._options.autoVacuum,t=e.minDirtFactor,a=e.minDirtCount,n=e.batchSize,i=e.batchWait;this.conditionalVacuum({batchSize:n,batchWait:i},{minDirtCount:a,minDirtFactor:t})}},r.prototype.discardAll=function(e){var t,a,n=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var i=de(e),o=i.next();!o.done;o=i.next()){var s=o.value;this.discard(s)}}catch(l){t={error:l}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(t)throw t.error}}}finally{this._options.autoVacuum=n}this.maybeAutoVacuum()},r.prototype.replace=function(e){var t=this._options,a=t.idField,n=t.extractField,i=n(e,a);this.discard(i),this.add(e)},r.prototype.vacuum=function(e){return e===void 0&&(e={}),this.conditionalVacuum(e)},r.prototype.conditionalVacuum=function(e,t){var a=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var n=a._enqueuedVacuumConditions;return a._enqueuedVacuumConditions=Ws,a.performVacuuming(e,n)}),this._enqueuedVacuum)):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)},r.prototype.performVacuuming=function(e,t){return Jy(this,void 0,void 0,function(){var a,n,i,o,s,l,c,u,p,m,d,g,f,y,v,T,E,I,D,C,M,F,R,G,z;return Qy(this,function(O){switch(O.label){case 0:if(a=this._dirtCount,!this.vacuumConditionsMet(t))return[3,10];n=e.batchSize||Vs.batchSize,i=e.batchWait||Vs.batchWait,o=1,O.label=1;case 1:O.trys.push([1,7,8,9]),s=de(this._index),l=s.next(),O.label=2;case 2:if(l.done)return[3,6];c=Ue(l.value,2),u=c[0],p=c[1];try{for(m=(F=void 0,de(p)),d=m.next();!d.done;d=m.next()){g=Ue(d.value,2),f=g[0],y=g[1];try{for(v=(G=void 0,de(y)),T=v.next();!T.done;T=v.next())E=Ue(T.value,1),I=E[0],!this._documentIds.has(I)&&(y.size<=1?p.delete(f):y.delete(I))}catch(x){G={error:x}}finally{try{T&&!T.done&&(z=v.return)&&z.call(v)}finally{if(G)throw G.error}}}}catch(x){F={error:x}}finally{try{d&&!d.done&&(R=m.return)&&R.call(m)}finally{if(F)throw F.error}}return this._index.get(u).size===0&&this._index.delete(u),o%n!==0?[3,4]:[4,new Promise(function(x){return setTimeout(x,i)})];case 3:O.sent(),O.label=4;case 4:o+=1,O.label=5;case 5:return l=s.next(),[3,2];case 6:return[3,9];case 7:return D=O.sent(),C={error:D},[3,9];case 8:try{l&&!l.done&&(M=s.return)&&M.call(s)}finally{if(C)throw C.error}return[7];case 9:this._dirtCount-=a,O.label=10;case 10:return[4,null];case 11:return O.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},r.prototype.vacuumConditionsMet=function(e){if(e==null)return!0;var t=e.minDirtCount,a=e.minDirtFactor;return t=t||Us.minDirtCount,a=a||Us.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=a},Object.defineProperty(r.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),r.prototype.has=function(e){return this._idToShortId.has(e)},r.prototype.getStoredFields=function(e){var t=this._idToShortId.get(e);if(t!=null)return this._storedFields.get(t)},r.prototype.search=function(e,t){var a,n;t===void 0&&(t={});var i=this.executeQuery(e,t),o=[];try{for(var s=de(i),l=s.next();!l.done;l=s.next()){var c=Ue(l.value,2),u=c[0],p=c[1],m=p.score,d=p.terms,g=p.match,f=d.length||1,y={id:this._documentIds.get(u),score:m*f,terms:Object.keys(g),queryTerms:d,match:g};Object.assign(y,this._storedFields.get(u)),(t.filter==null||t.filter(y))&&o.push(y)}}catch(v){a={error:v}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return e===r.wildcard&&t.boostDocument==null&&this._options.searchOptions.boostDocument==null||o.sort(Ku),o},r.prototype.autoSuggest=function(e,t){var a,n,i,o;t===void 0&&(t={}),t=De(De({},this._options.autoSuggestOptions),t);var s=new Map;try{for(var l=de(this.search(e,t)),c=l.next();!c.done;c=l.next()){var u=c.value,p=u.score,m=u.terms,d=m.join(" "),g=s.get(d);g!=null?(g.score+=p,g.count+=1):s.set(d,{score:p,terms:m,count:1})}}catch(D){a={error:D}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(a)throw a.error}}var f=[];try{for(var y=de(s),v=y.next();!v.done;v=y.next()){var T=Ue(v.value,2),g=T[0],E=T[1],p=E.score,m=E.terms,I=E.count;f.push({suggestion:g,terms:m,score:p/I})}}catch(D){i={error:D}}finally{try{v&&!v.done&&(o=y.return)&&o.call(y)}finally{if(i)throw i.error}}return f.sort(Ku),f},Object.defineProperty(r.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),r.loadJSON=function(e,t){if(t==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),t)},r.getDefault=function(e){if(zs.hasOwnProperty(e))return Gs(zs,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},r.loadJS=function(e,t){var a,n,i,o,s,l,c=e.index,u=e.documentCount,p=e.nextId,m=e.documentIds,d=e.fieldIds,g=e.fieldLength,f=e.averageFieldLength,y=e.storedFields,v=e.dirtCount,T=e.serializationVersion;if(T!==1&&T!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var E=new r(t);E._documentCount=u,E._nextId=p,E._documentIds=vi(m),E._idToShortId=new Map,E._fieldIds=d,E._fieldLength=vi(g),E._avgFieldLength=f,E._storedFields=vi(y),E._dirtCount=v||0,E._index=new Fs;try{for(var I=de(E._documentIds),D=I.next();!D.done;D=I.next()){var C=Ue(D.value,2),M=C[0],F=C[1];E._idToShortId.set(F,M)}}catch(Z){a={error:Z}}finally{try{D&&!D.done&&(n=I.return)&&n.call(I)}finally{if(a)throw a.error}}try{for(var R=de(c),G=R.next();!G.done;G=R.next()){var z=Ue(G.value,2),O=z[0],x=z[1],A=new Map;try{for(var B=(s=void 0,de(Object.keys(x))),X=B.next();!X.done;X=B.next()){var K=X.value,Q=x[K];T===1&&(Q=Q.ds),A.set(parseInt(K,10),vi(Q))}}catch(Z){s={error:Z}}finally{try{X&&!X.done&&(l=B.return)&&l.call(B)}finally{if(s)throw s.error}}E._index.set(O,A)}}catch(Z){i={error:Z}}finally{try{G&&!G.done&&(o=R.return)&&o.call(R)}finally{if(i)throw i.error}}return E},r.prototype.executeQuery=function(e,t){var a=this;if(t===void 0&&(t={}),e===r.wildcard)return this.executeWildcardQuery(t);if(typeof e!="string"){var n=De(De(De({},t),e),{queries:void 0}),i=e.queries.map(function(y){return a.executeQuery(y,n)});return this.combineResults(i,n.combineWith)}var o=this._options,s=o.tokenize,l=o.processTerm,c=o.searchOptions,u=De(De({tokenize:s,processTerm:l},c),t),p=u.tokenize,m=u.processTerm,d=p(e).flatMap(function(y){return m(y)}).filter(function(y){return!!y}),g=d.map(sb(u)),f=g.map(function(y){return a.executeQuerySpec(y,u)});return this.combineResults(f,u.combineWith)},r.prototype.executeQuerySpec=function(e,t){var a,n,i,o,s=De(De({},this._options.searchOptions),t),l=(s.fields||this._options.fields).reduce(function(K,Q){var Z;return De(De({},K),(Z={},Z[Q]=Gs(s.boost,Q)||1,Z))},{}),c=s.boostDocument,u=s.weights,p=s.maxFuzzy,m=s.bm25,d=De(De({},ju.weights),u),g=d.fuzzy,f=d.prefix,y=this._index.get(e.term),v=this.termResults(e.term,e.term,1,y,l,c,m),T,E;if(e.prefix&&(T=this._index.atPrefix(e.term)),e.fuzzy){var I=e.fuzzy===!0?.2:e.fuzzy,D=I<1?Math.min(p,Math.round(e.term.length*I)):I;D&&(E=this._index.fuzzyGet(e.term,D))}if(T)try{for(var C=de(T),M=C.next();!M.done;M=C.next()){var F=Ue(M.value,2),R=F[0],G=F[1],z=R.length-e.term.length;if(z){E?.delete(R);var O=f*R.length/(R.length+.3*z);this.termResults(e.term,R,O,G,l,c,m,v)}}}catch(K){a={error:K}}finally{try{M&&!M.done&&(n=C.return)&&n.call(C)}finally{if(a)throw a.error}}if(E)try{for(var x=de(E.keys()),A=x.next();!A.done;A=x.next()){var R=A.value,B=Ue(E.get(R),2),X=B[0],z=B[1];if(z){var O=g*R.length/(R.length+z);this.termResults(e.term,R,O,X,l,c,m,v)}}}catch(K){i={error:K}}finally{try{A&&!A.done&&(o=x.return)&&o.call(x)}finally{if(i)throw i.error}}return v},r.prototype.executeWildcardQuery=function(e){var t,a,n=new Map,i=De(De({},this._options.searchOptions),e);try{for(var o=de(this._documentIds),s=o.next();!s.done;s=o.next()){var l=Ue(s.value,2),c=l[0],u=l[1],p=i.boostDocument?i.boostDocument(u,"",this._storedFields.get(c)):1;n.set(c,{score:p,terms:[],match:{}})}}catch(m){t={error:m}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(t)throw t.error}}return n},r.prototype.combineResults=function(e,t){if(t===void 0&&(t=qs),e.length===0)return new Map;var a=t.toLowerCase();return e.reduce(ab[a])||new Map},r.prototype.toJSON=function(){var e,t,a,n,i=[];try{for(var o=de(this._index),s=o.next();!s.done;s=o.next()){var l=Ue(s.value,2),c=l[0],u=l[1],p={};try{for(var m=(a=void 0,de(u)),d=m.next();!d.done;d=m.next()){var g=Ue(d.value,2),f=g[0],y=g[1];p[f]=Object.fromEntries(y)}}catch(v){a={error:v}}finally{try{d&&!d.done&&(n=m.return)&&n.call(m)}finally{if(a)throw a.error}}i.push([c,p])}}catch(v){e={error:v}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:i,serializationVersion:2}},r.prototype.termResults=function(e,t,a,n,i,o,s,l){var c,u,p,m,d;if(l===void 0&&(l=new Map),n==null)return l;try{for(var g=de(Object.keys(i)),f=g.next();!f.done;f=g.next()){var y=f.value,v=i[y],T=this._fieldIds[y],E=n.get(T);if(E!=null){var I=E.size,D=this._avgFieldLength[T];try{for(var C=(p=void 0,de(E.keys())),M=C.next();!M.done;M=C.next()){var F=M.value;if(!this._documentIds.has(F)){this.removeTerm(T,F,t),I-=1;continue}var R=o?o(this._documentIds.get(F),t,this._storedFields.get(F)):1;if(R){var G=E.get(F),z=this._fieldLength.get(F)[T],O=ob(G,I,this._documentCount,z,D,s),x=a*v*R*O,A=l.get(F);if(A){A.score+=x,cb(A.terms,e);var B=Gs(A.match,t);B?B.push(y):A.match[t]=[y]}else l.set(F,{score:x,terms:[e],match:(d={},d[t]=[y],d)})}}}catch(X){p={error:X}}finally{try{M&&!M.done&&(m=C.return)&&m.call(C)}finally{if(p)throw p.error}}}}}catch(X){c={error:X}}finally{try{f&&!f.done&&(u=g.return)&&u.call(g)}finally{if(c)throw c.error}}return l},r.prototype.addTerm=function(e,t,a){var n=this._index.fetch(a,$u),i=n.get(e);if(i==null)i=new Map,i.set(t,1),n.set(e,i);else{var o=i.get(t);i.set(t,(o||0)+1)}},r.prototype.removeTerm=function(e,t,a){if(!this._index.has(a)){this.warnDocumentChanged(t,e,a);return}var n=this._index.fetch(a,$u),i=n.get(e);i==null||i.get(t)==null?this.warnDocumentChanged(t,e,a):i.get(t)<=1?i.size<=1?n.delete(e):i.delete(t):i.set(t,i.get(t)-1),this._index.get(a).size===0&&this._index.delete(a)},r.prototype.warnDocumentChanged=function(e,t,a){var n,i;try{for(var o=de(Object.keys(this._fieldIds)),s=o.next();!s.done;s=o.next()){var l=s.value;if(this._fieldIds[l]===t){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(a,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(c){n={error:c}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}},r.prototype.addDocumentId=function(e){var t=this._nextId;return this._idToShortId.set(e,t),this._documentIds.set(t,e),this._documentCount+=1,this._nextId+=1,t},r.prototype.addFields=function(e){for(var t=0;t<e.length;t++)this._fieldIds[e[t]]=t},r.prototype.addFieldLength=function(e,t,a,n){var i=this._fieldLength.get(e);i==null&&this._fieldLength.set(e,i=[]),i[t]=n;var o=this._avgFieldLength[t]||0,s=o*a+n;this._avgFieldLength[t]=s/(a+1)},r.prototype.removeFieldLength=function(e,t,a,n){if(a===1){this._avgFieldLength[t]=0;return}var i=this._avgFieldLength[t]*a-n;this._avgFieldLength[t]=i/(a-1)},r.prototype.saveStoredFields=function(e,t){var a,n,i=this._options,o=i.storeFields,s=i.extractField;if(!(o==null||o.length===0)){var l=this._storedFields.get(e);l==null&&this._storedFields.set(e,l={});try{for(var c=de(o),u=c.next();!u.done;u=c.next()){var p=u.value,m=s(t,p);m!==void 0&&(l[p]=m)}}catch(d){a={error:d}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(a)throw a.error}}}},r.wildcard=Symbol("*"),r}(),Gs=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0},ab=(va={},va[qs]=function(r,e){var t,a;try{for(var n=de(e.keys()),i=n.next();!i.done;i=n.next()){var o=i.value,s=r.get(o);if(s==null)r.set(o,e.get(o));else{var l=e.get(o),c=l.score,u=l.terms,p=l.match;s.score=s.score+c,s.match=Object.assign(s.match,p),qu(s.terms,u)}}}catch(m){t={error:m}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}return r},va[ed]=function(r,e){var t,a,n=new Map;try{for(var i=de(e.keys()),o=i.next();!o.done;o=i.next()){var s=o.value,l=r.get(s);if(l!=null){var c=e.get(s),u=c.score,p=c.terms,m=c.match;qu(l.terms,p),n.set(s,{score:l.score+u,terms:l.terms,match:Object.assign(l.match,m)})}}}catch(d){t={error:d}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(t)throw t.error}}return n},va[nb]=function(r,e){var t,a;try{for(var n=de(e.keys()),i=n.next();!i.done;i=n.next()){var o=i.value;r.delete(o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}return r},va),ib={k:1.2,b:.7,d:.5},ob=function(r,e,t,a,n,i){var o=i.k,s=i.b,l=i.d,c=Math.log(1+(t-e+.5)/(e+.5));return c*(l+r*(o+1)/(r+o*(1-s+s*a/n)))},sb=function(r){return function(e,t,a){var n=typeof r.fuzzy=="function"?r.fuzzy(e,t,a):r.fuzzy||!1,i=typeof r.prefix=="function"?r.prefix(e,t,a):r.prefix===!0;return{term:e,fuzzy:n,prefix:i}}},zs={idField:"id",extractField:function(r,e){return r[e]},tokenize:function(r){return r.split(ub)},processTerm:function(r){return r.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(r,e){typeof console?.[r]=="function"&&console[r](e)},autoVacuum:!0},ju={combineWith:qs,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:ib},lb={combineWith:ed,prefix:function(r,e,t){return e===t.length-1}},Vs={batchSize:1e3,batchWait:10},Ws={minDirtFactor:.1,minDirtCount:20},Us=De(De({},Vs),Ws),cb=function(r,e){r.includes(e)||r.push(e)},qu=function(r,e){var t,a;try{for(var n=de(e),i=n.next();!i.done;i=n.next()){var o=i.value;r.includes(o)||r.push(o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},Ku=function(r,e){var t=r.score,a=e.score;return a-t},$u=function(){return new Map},vi=function(r){var e,t,a=new Map;try{for(var n=de(Object.keys(r)),i=n.next();!i.done;i=n.next()){var o=i.value;a.set(parseInt(o,10),r[o])}}catch(s){e={error:s}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return a},ub=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;var rd=[{id:"search",type:"action",name:"Search the knowledge base.",content:"Search the knowledge base for information, actions, tools, tours, UI elements, etc. Use this on EVERY request if you don't have information. If the user asks for personal information, use this. If the user asks you to do something, use this to find the tool you need.",isContext:!0,removeFromMessageHistory:!0,parameters:[{name:"query",type:"string",description:"The search query"}],action:async(r,e)=>{let t=await e.knowledgeBase.search(r.query),a=e;a._lastKBsearch=r.query,a._nextRequestUseKBitems=t,e.submitAnalyticsEvent({type:"kb-search",query:r.query,results:t});let n=t.filter(o=>o.type!="action").map(o=>"id="+o.id).join(", ")||"(none)",i=t.filter(o=>o.type=="action").map(o=>"name="+o._functionID).join(", ")||"(none)";return`Search complete, context has been updated. New info entries found: ${n}. New tools available: ${i}.`}}];var h={};ws(h,{BRAND:()=>Mb,DIRTY:()=>Xr,EMPTY_PATH:()=>hb,INVALID:()=>ee,NEVER:()=>_v,OK:()=>ot,ParseStatus:()=>nt,Schema:()=>ue,ZodAny:()=>Pr,ZodArray:()=>br,ZodBigInt:()=>Zr,ZodBoolean:()=>Jr,ZodBranded:()=>Sa,ZodCatch:()=>un,ZodDate:()=>Qr,ZodDefault:()=>cn,ZodDiscriminatedUnion:()=>wi,ZodEffects:()=>Gt,ZodEnum:()=>sn,ZodError:()=>bt,ZodFirstPartyTypeKind:()=>re,ZodFunction:()=>ki,ZodIntersection:()=>nn,ZodIssueCode:()=>U,ZodLazy:()=>an,ZodLiteral:()=>on,ZodMap:()=>qn,ZodNaN:()=>$n,ZodNativeEnum:()=>ln,ZodNever:()=>qt,ZodNull:()=>tn,ZodNullable:()=>nr,ZodNumber:()=>Yr,ZodObject:()=>vt,ZodOptional:()=>Ft,ZodParsedType:()=>j,ZodPipeline:()=>Ea,ZodPromise:()=>Dr,ZodReadonly:()=>dn,ZodRecord:()=>Ci,ZodSchema:()=>ue,ZodSet:()=>Kn,ZodString:()=>Rr,ZodSymbol:()=>Wn,ZodTransformer:()=>Gt,ZodTuple:()=>rr,ZodType:()=>ue,ZodUndefined:()=>en,ZodUnion:()=>rn,ZodUnknown:()=>yr,ZodVoid:()=>jn,addIssueToContext:()=>W,any:()=>jb,array:()=>Xb,bigint:()=>zb,boolean:()=>md,coerce:()=>vv,custom:()=>ud,date:()=>Ub,datetimeRegex:()=>ld,defaultErrorMap:()=>gr,discriminatedUnion:()=>Qb,effect:()=>dv,enum:()=>lv,function:()=>iv,getErrorMap:()=>Un,getParsedType:()=>tr,instanceof:()=>Bb,intersection:()=>ev,isAborted:()=>Si,isAsync:()=>Hn,isDirty:()=>Ei,isValid:()=>Ir,late:()=>Fb,lazy:()=>ov,literal:()=>sv,makeIssue:()=>_a,map:()=>nv,nan:()=>Gb,nativeEnum:()=>cv,never:()=>Kb,null:()=>Wb,nullable:()=>mv,number:()=>pd,object:()=>Yb,objectUtil:()=>Ks,oboolean:()=>bv,onumber:()=>yv,optional:()=>pv,ostring:()=>fv,pipeline:()=>gv,preprocess:()=>hv,promise:()=>uv,quotelessJson:()=>db,record:()=>rv,set:()=>av,setErrorMap:()=>mb,strictObject:()=>Zb,string:()=>dd,symbol:()=>Hb,transformer:()=>dv,tuple:()=>tv,undefined:()=>Vb,union:()=>Jb,unknown:()=>qb,util:()=>pe,void:()=>$b});var pe;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let i={};for(let o of n)i[o]=o;return i},r.getValidEnumValues=n=>{let i=r.objectKeys(n).filter(s=>typeof n[n[s]]!="number"),o={};for(let s of i)o[s]=n[s];return r.objectValues(o)},r.objectValues=n=>r.objectKeys(n).map(function(i){return n[i]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.push(o);return i},r.find=(n,i)=>{for(let o of n)if(i(o))return o},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function a(n,i=" | "){return n.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}r.joinValues=a,r.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(pe||(pe={}));var Ks;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ks||(Ks={}));var j=pe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),tr=r=>{switch(typeof r){case"undefined":return j.undefined;case"string":return j.string;case"number":return Number.isNaN(r)?j.nan:j.number;case"boolean":return j.boolean;case"function":return j.function;case"bigint":return j.bigint;case"symbol":return j.symbol;case"object":return Array.isArray(r)?j.array:r===null?j.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?j.promise:typeof Map<"u"&&r instanceof Map?j.map:typeof Set<"u"&&r instanceof Set?j.set:typeof Date<"u"&&r instanceof Date?j.date:j.object;default:return j.unknown}};var U=pe.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"]),db=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),bt=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},a={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)a._errors.push(t(o));else{let s=a,l=0;for(;l<o.path.length;){let c=o.path[l];l===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return n(this),a}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,pe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},a=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):a.push(e(n));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}};bt.create=r=>new bt(r);var pb=(r,e)=>{let t;switch(r.code){case U.invalid_type:r.received===j.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case U.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,pe.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:t=`Unrecognized key(s) in object: ${pe.joinValues(r.keys,", ")}`;break;case U.invalid_union:t="Invalid input";break;case U.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${pe.joinValues(r.options)}`;break;case U.invalid_enum_value:t=`Invalid enum value. Expected ${pe.joinValues(r.options)}, received '${r.received}'`;break;case U.invalid_arguments:t="Invalid function arguments";break;case U.invalid_return_type:t="Invalid function return type";break;case U.invalid_date:t="Invalid date";break;case U.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:pe.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case U.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case U.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case U.custom:t="Invalid input";break;case U.invalid_intersection_types:t="Intersection results could not be merged";break;case U.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case U.not_finite:t="Number must be finite";break;default:t=e.defaultError,pe.assertNever(r)}return{message:t}},gr=pb;var nd=gr;function mb(r){nd=r}function Un(){return nd}var _a=r=>{let{data:e,path:t,errorMaps:a,issueData:n}=r,i=[...t,...n.path||[]],o={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let s="",l=a.filter(c=>!!c).slice().reverse();for(let c of l)s=c(o,{data:e,defaultError:s}).message;return{...n,path:i,message:s}},hb=[];function W(r,e){let t=Un(),a=_a({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===gr?void 0:gr].filter(n=>!!n)});r.common.issues.push(a)}var nt=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let a=[];for(let n of t){if(n.status==="aborted")return ee;n.status==="dirty"&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){let a=[];for(let n of t){let i=await n.key,o=await n.value;a.push({key:i,value:o})}return r.mergeObjectSync(e,a)}static mergeObjectSync(e,t){let a={};for(let n of t){let{key:i,value:o}=n;if(i.status==="aborted"||o.status==="aborted")return ee;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(a[i.value]=o.value)}return{status:e.value,value:a}}},ee=Object.freeze({status:"aborted"}),Xr=r=>({status:"dirty",value:r}),ot=r=>({status:"valid",value:r}),Si=r=>r.status==="aborted",Ei=r=>r.status==="dirty",Ir=r=>r.status==="valid",Hn=r=>typeof Promise<"u"&&r instanceof Promise;var Y;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(Y||(Y={}));var Bt=class{constructor(e,t,a,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ad=(r,e)=>{if(Ir(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new bt(r.common.issues);return this._error=t,this._error}}};function se(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:a,description:n}=r;if(e&&(t||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,s)=>{let{message:l}=r;return o.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??a??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:l??t??s.defaultError}},description:n}}var ue=class{get description(){return this._def.description}_getType(e){return tr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:tr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new nt,ctx:{common:e.parent.common,data:e.data,parsedType:tr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Hn(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){let a={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:tr(e)},n=this._parseSync({data:e,path:a.path,parent:a});return ad(a,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:tr(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:t});return Ir(a)?{value:a.value}:{issues:t.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>Ir(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){let a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){let a={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:tr(e)},n=this._parse({data:e,path:a.path,parent:a}),i=await(Hn(n)?n:Promise.resolve(n));return ad(a,i)}refine(e,t){let a=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,i)=>{let o=e(n),s=()=>i.addIssue({code:U.custom,...a(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,t){return this._refinement((a,n)=>e(a)?!0:(n.addIssue(typeof t=="function"?t(a,n):t),!1))}_refinement(e){return new Gt({schema:this,typeName:re.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Ft.create(this,this._def)}nullable(){return nr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return br.create(this)}promise(){return Dr.create(this,this._def)}or(e){return rn.create([this,e],this._def)}and(e){return nn.create(this,e,this._def)}transform(e){return new Gt({...se(this._def),schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new cn({...se(this._def),innerType:this,defaultValue:t,typeName:re.ZodDefault})}brand(){return new Sa({typeName:re.ZodBranded,type:this,...se(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new un({...se(this._def),innerType:this,catchValue:t,typeName:re.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ea.create(this,e)}readonly(){return dn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},gb=/^c[^\s-]{8,}$/i,fb=/^[0-9a-z]+$/,yb=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bb=/^[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,vb=/^[a-z0-9_-]{21}$/i,_b=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Sb=/^[-+]?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)?)??$/,Eb=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",$s,Cb=/^(?:(?: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])$/,kb=/^(?:(?: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])$/,Tb=/^(([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]))$/,xb=/^(([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])$/,Ab=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ib=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,od="((\\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])))",Rb=new RegExp(`^${od}$`);function sd(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Pb(r){return new RegExp(`^${sd(r)}$`)}function ld(r){let e=`${od}T${sd(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Db(r,e){return!!((e==="v4"||!e)&&Cb.test(r)||(e==="v6"||!e)&&Tb.test(r))}function Nb(r,e){if(!_b.test(r))return!1;try{let[t]=r.split("."),a=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(a));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Ob(r,e){return!!((e==="v4"||!e)&&kb.test(r)||(e==="v6"||!e)&&xb.test(r))}var Rr=class r extends ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==j.string){let i=this._getOrReturnCtx(e);return W(i,{code:U.invalid_type,expected:j.string,received:i.parsedType}),ee}let a=new nt,n;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,s=e.data.length<i.value;(o||s)&&(n=this._getOrReturnCtx(e,n),o?W(n,{code:U.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&W(n,{code:U.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),a.dirty())}else if(i.kind==="email")Eb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"email",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="emoji")$s||($s=new RegExp(wb,"u")),$s.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"emoji",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="uuid")bb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"uuid",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="nanoid")vb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"nanoid",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid")gb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"cuid",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid2")fb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"cuid2",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="ulid")yb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"ulid",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),W(n,{validation:"url",code:U.invalid_string,message:i.message}),a.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"regex",code:U.invalid_string,message:i.message}),a.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),a.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{startsWith:i.value},message:i.message}),a.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{endsWith:i.value},message:i.message}),a.dirty()):i.kind==="datetime"?ld(i).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:"datetime",message:i.message}),a.dirty()):i.kind==="date"?Rb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:"date",message:i.message}),a.dirty()):i.kind==="time"?Pb(i).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:"time",message:i.message}),a.dirty()):i.kind==="duration"?Sb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"duration",code:U.invalid_string,message:i.message}),a.dirty()):i.kind==="ip"?Db(e.data,i.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"ip",code:U.invalid_string,message:i.message}),a.dirty()):i.kind==="jwt"?Nb(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"jwt",code:U.invalid_string,message:i.message}),a.dirty()):i.kind==="cidr"?Ob(e.data,i.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"cidr",code:U.invalid_string,message:i.message}),a.dirty()):i.kind==="base64"?Ab.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"base64",code:U.invalid_string,message:i.message}),a.dirty()):i.kind==="base64url"?Ib.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"base64url",code:U.invalid_string,message:i.message}),a.dirty()):pe.assertNever(i);return{status:a.value,value:e.data}}_regex(e,t,a){return this.refinement(n=>e.test(n),{validation:t,code:U.invalid_string,...Y.errToObj(a)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Y.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Y.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Y.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Y.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Y.errToObj(t)})}nonempty(e){return this.min(1,Y.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Rr.create=r=>new Rr({checks:[],typeName:re.ZodString,coerce:r?.coerce??!1,...se(r)});function Lb(r,e){let t=(r.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,n=t>a?t:a,i=Number.parseInt(r.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return i%o/10**n}var Yr=class r extends ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==j.number){let i=this._getOrReturnCtx(e);return W(i,{code:U.invalid_type,expected:j.number,received:i.parsedType}),ee}let a,n=new nt;for(let i of this._def.checks)i.kind==="int"?pe.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),W(a,{code:U.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?Lb(e.data,i.value)!==0&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),W(a,{code:U.not_finite,message:i.message}),n.dirty()):pe.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,a,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:Y.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&pe.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(t===null||a.value>t)&&(t=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Yr.create=r=>new Yr({checks:[],typeName:re.ZodNumber,coerce:r?.coerce||!1,...se(r)});var Zr=class r extends ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==j.bigint)return this._getInvalidInput(e);let a,n=new nt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):pe.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:j.bigint,received:t.parsedType}),ee}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,a,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:Y.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Zr.create=r=>new Zr({checks:[],typeName:re.ZodBigInt,coerce:r?.coerce??!1,...se(r)});var Jr=class extends ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==j.boolean){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.boolean,received:a.parsedType}),ee}return ot(e.data)}};Jr.create=r=>new Jr({typeName:re.ZodBoolean,coerce:r?.coerce||!1,...se(r)});var Qr=class r extends ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==j.date){let i=this._getOrReturnCtx(e);return W(i,{code:U.invalid_type,expected:j.date,received:i.parsedType}),ee}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return W(i,{code:U.invalid_date}),ee}let a=new nt,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),a.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),a.dirty()):pe.assertNever(i);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Y.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Qr.create=r=>new Qr({checks:[],coerce:r?.coerce||!1,typeName:re.ZodDate,...se(r)});var Wn=class extends ue{_parse(e){if(this._getType(e)!==j.symbol){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.symbol,received:a.parsedType}),ee}return ot(e.data)}};Wn.create=r=>new Wn({typeName:re.ZodSymbol,...se(r)});var en=class extends ue{_parse(e){if(this._getType(e)!==j.undefined){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.undefined,received:a.parsedType}),ee}return ot(e.data)}};en.create=r=>new en({typeName:re.ZodUndefined,...se(r)});var tn=class extends ue{_parse(e){if(this._getType(e)!==j.null){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.null,received:a.parsedType}),ee}return ot(e.data)}};tn.create=r=>new tn({typeName:re.ZodNull,...se(r)});var Pr=class extends ue{constructor(){super(...arguments),this._any=!0}_parse(e){return ot(e.data)}};Pr.create=r=>new Pr({typeName:re.ZodAny,...se(r)});var yr=class extends ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ot(e.data)}};yr.create=r=>new yr({typeName:re.ZodUnknown,...se(r)});var qt=class extends ue{_parse(e){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:j.never,received:t.parsedType}),ee}};qt.create=r=>new qt({typeName:re.ZodNever,...se(r)});var jn=class extends ue{_parse(e){if(this._getType(e)!==j.undefined){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.void,received:a.parsedType}),ee}return ot(e.data)}};jn.create=r=>new jn({typeName:re.ZodVoid,...se(r)});var br=class r extends ue{_parse(e){let{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==j.array)return W(t,{code:U.invalid_type,expected:j.array,received:t.parsedType}),ee;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;(o||s)&&(W(t,{code:o?U.too_big:U.too_small,minimum:s?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(W(t,{code:U.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(W(t,{code:U.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((o,s)=>n.type._parseAsync(new Bt(t,o,t.path,s)))).then(o=>nt.mergeArray(a,o));let i=[...t.data].map((o,s)=>n.type._parseSync(new Bt(t,o,t.path,s)));return nt.mergeArray(a,i)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:Y.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:Y.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:Y.toString(t)}})}nonempty(e){return this.min(1,e)}};br.create=(r,e)=>new br({type:r,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray,...se(e)});function Vn(r){if(r instanceof vt){let e={};for(let t in r.shape){let a=r.shape[t];e[t]=Ft.create(Vn(a))}return new vt({...r._def,shape:()=>e})}else return r instanceof br?new br({...r._def,type:Vn(r.element)}):r instanceof Ft?Ft.create(Vn(r.unwrap())):r instanceof nr?nr.create(Vn(r.unwrap())):r instanceof rr?rr.create(r.items.map(e=>Vn(e))):r}var vt=class r extends ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=pe.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==j.object){let c=this._getOrReturnCtx(e);return W(c,{code:U.invalid_type,expected:j.object,received:c.parsedType}),ee}let{status:a,ctx:n}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof qt&&this._def.unknownKeys==="strip"))for(let c in n.data)o.includes(c)||s.push(c);let l=[];for(let c of o){let u=i[c],p=n.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Bt(n,p,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof qt){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict")s.length>0&&(W(n,{code:U.unrecognized_keys,keys:s}),a.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of s){let p=n.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Bt(n,p,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,m=await u.value;c.push({key:p,value:m,alwaysSet:u.alwaysSet})}return c}).then(c=>nt.mergeObjectSync(a,c)):nt.mergeObjectSync(a,l)}get shape(){return this._def.shape()}strict(e){return Y.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,a)=>{let n=this._def.errorMap?.(t,a).message??a.defaultError;return t.code==="unrecognized_keys"?{message:Y.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:re.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let a of pe.objectKeys(e))e[a]&&this.shape[a]&&(t[a]=this.shape[a]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let a of pe.objectKeys(this.shape))e[a]||(t[a]=this.shape[a]);return new r({...this._def,shape:()=>t})}deepPartial(){return Vn(this)}partial(e){let t={};for(let a of pe.objectKeys(this.shape)){let n=this.shape[a];e&&!e[a]?t[a]=n:t[a]=n.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let a of pe.objectKeys(this.shape))if(e&&!e[a])t[a]=this.shape[a];else{let i=this.shape[a];for(;i instanceof Ft;)i=i._def.innerType;t[a]=i}return new r({...this._def,shape:()=>t})}keyof(){return cd(pe.objectKeys(this.shape))}};vt.create=(r,e)=>new vt({shape:()=>r,unknownKeys:"strip",catchall:qt.create(),typeName:re.ZodObject,...se(e)});vt.strictCreate=(r,e)=>new vt({shape:()=>r,unknownKeys:"strict",catchall:qt.create(),typeName:re.ZodObject,...se(e)});vt.lazycreate=(r,e)=>new vt({shape:r,unknownKeys:"strip",catchall:qt.create(),typeName:re.ZodObject,...se(e)});var rn=class extends ue{_parse(e){let{ctx:t}=this._processInputParams(e),a=this._def.options;function n(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map(s=>new bt(s.ctx.common.issues));return W(t,{code:U.invalid_union,unionErrors:o}),ee}if(t.common.async)return Promise.all(a.map(async i=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);{let i,o=[];for(let l of a){let c={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map(l=>new bt(l));return W(t,{code:U.invalid_union,unionErrors:s}),ee}}get options(){return this._def.options}};rn.create=(r,e)=>new rn({options:r,typeName:re.ZodUnion,...se(e)});var fr=r=>r instanceof an?fr(r.schema):r instanceof Gt?fr(r.innerType()):r instanceof on?[r.value]:r instanceof sn?r.options:r instanceof ln?pe.objectValues(r.enum):r instanceof cn?fr(r._def.innerType):r instanceof en?[void 0]:r instanceof tn?[null]:r instanceof Ft?[void 0,...fr(r.unwrap())]:r instanceof nr?[null,...fr(r.unwrap())]:r instanceof Sa||r instanceof dn?fr(r.unwrap()):r instanceof un?fr(r._def.innerType):[],wi=class r extends ue{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.object)return W(t,{code:U.invalid_type,expected:j.object,received:t.parsedType}),ee;let a=this.discriminator,n=t.data[a],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(W(t,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){let n=new Map;for(let i of t){let o=fr(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(n.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);n.set(s,i)}}return new r({typeName:re.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...se(a)})}};function Xs(r,e){let t=tr(r),a=tr(e);if(r===e)return{valid:!0,data:r};if(t===j.object&&a===j.object){let n=pe.objectKeys(e),i=pe.objectKeys(r).filter(s=>n.indexOf(s)!==-1),o={...r,...e};for(let s of i){let l=Xs(r[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(t===j.array&&a===j.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let i=0;i<r.length;i++){let o=r[i],s=e[i],l=Xs(o,s);if(!l.valid)return{valid:!1};n.push(l.data)}return{valid:!0,data:n}}else return t===j.date&&a===j.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var nn=class extends ue{_parse(e){let{status:t,ctx:a}=this._processInputParams(e),n=(i,o)=>{if(Si(i)||Si(o))return ee;let s=Xs(i.value,o.value);return s.valid?((Ei(i)||Ei(o))&&t.dirty(),{status:t.value,value:s.data}):(W(a,{code:U.invalid_intersection_types}),ee)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([i,o])=>n(i,o)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};nn.create=(r,e,t)=>new nn({left:r,right:e,typeName:re.ZodIntersection,...se(t)});var rr=class r extends ue{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==j.array)return W(a,{code:U.invalid_type,expected:j.array,received:a.parsedType}),ee;if(a.data.length<this._def.items.length)return W(a,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ee;!this._def.rest&&a.data.length>this._def.items.length&&(W(a,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...a.data].map((o,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new Bt(a,o,a.path,s)):null}).filter(o=>!!o);return a.common.async?Promise.all(i).then(o=>nt.mergeArray(t,o)):nt.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};rr.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new rr({items:r,typeName:re.ZodTuple,rest:null,...se(e)})};var Ci=class r extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==j.object)return W(a,{code:U.invalid_type,expected:j.object,received:a.parsedType}),ee;let n=[],i=this._def.keyType,o=this._def.valueType;for(let s in a.data)n.push({key:i._parse(new Bt(a,s,a.path,s)),value:o._parse(new Bt(a,a.data[s],a.path,s)),alwaysSet:s in a.data});return a.common.async?nt.mergeObjectAsync(t,n):nt.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,a){return t instanceof ue?new r({keyType:e,valueType:t,typeName:re.ZodRecord,...se(a)}):new r({keyType:Rr.create(),valueType:e,typeName:re.ZodRecord,...se(t)})}},qn=class extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==j.map)return W(a,{code:U.invalid_type,expected:j.map,received:a.parsedType}),ee;let n=this._def.keyType,i=this._def.valueType,o=[...a.data.entries()].map(([s,l],c)=>({key:n._parse(new Bt(a,s,a.path,[c,"key"])),value:i._parse(new Bt(a,l,a.path,[c,"value"]))}));if(a.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ee;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),s.set(c.value,u.value)}return{status:t.value,value:s}})}else{let s=new Map;for(let l of o){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ee;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),s.set(c.value,u.value)}return{status:t.value,value:s}}}};qn.create=(r,e,t)=>new qn({valueType:e,keyType:r,typeName:re.ZodMap,...se(t)});var Kn=class r extends ue{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==j.set)return W(a,{code:U.invalid_type,expected:j.set,received:a.parsedType}),ee;let n=this._def;n.minSize!==null&&a.data.size<n.minSize.value&&(W(a,{code:U.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&a.data.size>n.maxSize.value&&(W(a,{code:U.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function o(l){let c=new Set;for(let u of l){if(u.status==="aborted")return ee;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}let s=[...a.data.values()].map((l,c)=>i._parse(new Bt(a,l,a.path,c)));return a.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,t){return new r({...this._def,minSize:{value:e,message:Y.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:Y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Kn.create=(r,e)=>new Kn({valueType:r,minSize:null,maxSize:null,typeName:re.ZodSet,...se(e)});var ki=class r extends ue{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.function)return W(t,{code:U.invalid_type,expected:j.function,received:t.parsedType}),ee;function a(s,l){return _a({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Un(),gr].filter(c=>!!c),issueData:{code:U.invalid_arguments,argumentsError:l}})}function n(s,l){return _a({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Un(),gr].filter(c=>!!c),issueData:{code:U.invalid_return_type,returnTypeError:l}})}let i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Dr){let s=this;return ot(async function(...l){let c=new bt([]),u=await s._def.args.parseAsync(l,i).catch(d=>{throw c.addIssue(a(l,d)),c}),p=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(p,i).catch(d=>{throw c.addIssue(n(p,d)),c})})}else{let s=this;return ot(function(...l){let c=s._def.args.safeParse(l,i);if(!c.success)throw new bt([a(l,c.error)]);let u=Reflect.apply(o,this,c.data),p=s._def.returns.safeParse(u,i);if(!p.success)throw new bt([n(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:rr.create(e).rest(yr.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new r({args:e||rr.create([]).rest(yr.create()),returns:t||yr.create(),typeName:re.ZodFunction,...se(a)})}},an=class extends ue{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};an.create=(r,e)=>new an({getter:r,typeName:re.ZodLazy,...se(e)});var on=class extends ue{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return W(t,{received:t.data,code:U.invalid_literal,expected:this._def.value}),ee}return{status:"valid",value:e.data}}get value(){return this._def.value}};on.create=(r,e)=>new on({value:r,typeName:re.ZodLiteral,...se(e)});function cd(r,e){return new sn({values:r,typeName:re.ZodEnum,...se(e)})}var sn=class r extends ue{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),a=this._def.values;return W(t,{expected:pe.joinValues(a),received:t.parsedType,code:U.invalid_type}),ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),a=this._def.values;return W(t,{received:t.data,code:U.invalid_enum_value,options:a}),ee}return ot(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(a=>!e.includes(a)),{...this._def,...t})}};sn.create=cd;var ln=class extends ue{_parse(e){let t=pe.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==j.string&&a.parsedType!==j.number){let n=pe.objectValues(t);return W(a,{expected:pe.joinValues(n),received:a.parsedType,code:U.invalid_type}),ee}if(this._cache||(this._cache=new Set(pe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=pe.objectValues(t);return W(a,{received:a.data,code:U.invalid_enum_value,options:n}),ee}return ot(e.data)}get enum(){return this._def.values}};ln.create=(r,e)=>new ln({values:r,typeName:re.ZodNativeEnum,...se(e)});var Dr=class extends ue{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.promise&&t.common.async===!1)return W(t,{code:U.invalid_type,expected:j.promise,received:t.parsedType}),ee;let a=t.parsedType===j.promise?t.data:Promise.resolve(t.data);return ot(a.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Dr.create=(r,e)=>new Dr({type:r,typeName:re.ZodPromise,...se(e)});var Gt=class extends ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:a}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:o=>{W(a,o),o.fatal?t.abort():t.dirty()},get path(){return a.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let o=n.transform(a.data,i);if(a.common.async)return Promise.resolve(o).then(async s=>{if(t.value==="aborted")return ee;let l=await this._def.schema._parseAsync({data:s,path:a.path,parent:a});return l.status==="aborted"?ee:l.status==="dirty"?Xr(l.value):t.value==="dirty"?Xr(l.value):l});{if(t.value==="aborted")return ee;let s=this._def.schema._parseSync({data:o,path:a.path,parent:a});return s.status==="aborted"?ee:s.status==="dirty"?Xr(s.value):t.value==="dirty"?Xr(s.value):s}}if(n.type==="refinement"){let o=s=>{let l=n.refinement(s,i);if(a.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(a.common.async===!1){let s=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return s.status==="aborted"?ee:(s.status==="dirty"&&t.dirty(),o(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(s=>s.status==="aborted"?ee:(s.status==="dirty"&&t.dirty(),o(s.value).then(()=>({status:t.value,value:s.value}))))}if(n.type==="transform")if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Ir(o))return ee;let s=n.transform(o.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>Ir(o)?Promise.resolve(n.transform(o.value,i)).then(s=>({status:t.value,value:s})):ee);pe.assertNever(n)}};Gt.create=(r,e,t)=>new Gt({schema:r,typeName:re.ZodEffects,effect:e,...se(t)});Gt.createWithPreprocess=(r,e,t)=>new Gt({schema:e,effect:{type:"preprocess",transform:r},typeName:re.ZodEffects,...se(t)});var Ft=class extends ue{_parse(e){return this._getType(e)===j.undefined?ot(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ft.create=(r,e)=>new Ft({innerType:r,typeName:re.ZodOptional,...se(e)});var nr=class extends ue{_parse(e){return this._getType(e)===j.null?ot(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};nr.create=(r,e)=>new nr({innerType:r,typeName:re.ZodNullable,...se(e)});var cn=class extends ue{_parse(e){let{ctx:t}=this._processInputParams(e),a=t.data;return t.parsedType===j.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};cn.create=(r,e)=>new cn({innerType:r,typeName:re.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...se(e)});var un=class extends ue{_parse(e){let{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Hn(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bt(a.common.issues)},input:a.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new bt(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};un.create=(r,e)=>new un({innerType:r,typeName:re.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...se(e)});var $n=class extends ue{_parse(e){if(this._getType(e)!==j.nan){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.nan,received:a.parsedType}),ee}return{status:"valid",value:e.data}}};$n.create=r=>new $n({typeName:re.ZodNaN,...se(r)});var Mb=Symbol("zod_brand"),Sa=class extends ue{_parse(e){let{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}},Ea=class r extends ue{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?ee:i.status==="dirty"?(t.dirty(),Xr(i.value)):this._def.out._parseAsync({data:i.value,path:a.path,parent:a})})();{let n=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?ee:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:a.path,parent:a})}}static create(e,t){return new r({in:e,out:t,typeName:re.ZodPipeline})}},dn=class extends ue{_parse(e){let t=this._def.innerType._parse(e),a=n=>(Ir(n)&&(n.value=Object.freeze(n.value)),n);return Hn(t)?t.then(n=>a(n)):a(t)}unwrap(){return this._def.innerType}};dn.create=(r,e)=>new dn({innerType:r,typeName:re.ZodReadonly,...se(e)});function id(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function ud(r,e={},t){return r?Pr.create().superRefine((a,n)=>{let i=r(a);if(i instanceof Promise)return i.then(o=>{if(!o){let s=id(e,a),l=s.fatal??t??!0;n.addIssue({code:"custom",...s,fatal:l})}});if(!i){let o=id(e,a),s=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:s})}}):Pr.create()}var Fb={object:vt.lazycreate},re;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(re||(re={}));var Bb=(r,e={message:`Input not instance of ${r.name}`})=>ud(t=>t instanceof r,e),dd=Rr.create,pd=Yr.create,Gb=$n.create,zb=Zr.create,md=Jr.create,Ub=Qr.create,Hb=Wn.create,Vb=en.create,Wb=tn.create,jb=Pr.create,qb=yr.create,Kb=qt.create,$b=jn.create,Xb=br.create,Yb=vt.create,Zb=vt.strictCreate,Jb=rn.create,Qb=wi.create,ev=nn.create,tv=rr.create,rv=Ci.create,nv=qn.create,av=Kn.create,iv=ki.create,ov=an.create,sv=on.create,lv=sn.create,cv=ln.create,uv=Dr.create,dv=Gt.create,pv=Ft.create,mv=nr.create,hv=Gt.createWithPreprocess,gv=Ea.create,fv=()=>dd().optional(),yv=()=>pd().optional(),bv=()=>md().optional(),vv={string:r=>Rr.create({...r,coerce:!0}),number:r=>Yr.create({...r,coerce:!0}),boolean:r=>Jr.create({...r,coerce:!0}),bigint:r=>Zr.create({...r,coerce:!0}),date:r=>Qr.create({...r,coerce:!0})};var _v=ee;var Xn="2025-03-26",hd=[Xn,"2024-11-05","2024-10-07"],Ti="2.0",gd=h.union([h.string(),h.number().int()]),fd=h.string(),Sv=h.object({progressToken:h.optional(gd)}).passthrough(),Kt=h.object({_meta:h.optional(Sv)}).passthrough(),xt=h.object({method:h.string(),params:h.optional(Kt)}),wa=h.object({_meta:h.optional(h.object({}).passthrough())}).passthrough(),ar=h.object({method:h.string(),params:h.optional(wa)}),$t=h.object({_meta:h.optional(h.object({}).passthrough())}).passthrough(),xi=h.union([h.string(),h.number().int()]),yd=h.object({jsonrpc:h.literal(Ti),id:xi}).merge(xt).strict(),Ai=r=>yd.safeParse(r).success,bd=h.object({jsonrpc:h.literal(Ti)}).merge(ar).strict(),vd=r=>bd.safeParse(r).success,_d=h.object({jsonrpc:h.literal(Ti),id:xi,result:$t}).strict(),Ca=r=>_d.safeParse(r).success,zt;(function(r){r[r.ConnectionClosed=-32e3]="ConnectionClosed",r[r.RequestTimeout=-32001]="RequestTimeout",r[r.ParseError=-32700]="ParseError",r[r.InvalidRequest=-32600]="InvalidRequest",r[r.MethodNotFound=-32601]="MethodNotFound",r[r.InvalidParams=-32602]="InvalidParams",r[r.InternalError=-32603]="InternalError"})(zt||(zt={}));var Sd=h.object({jsonrpc:h.literal(Ti),id:xi,error:h.object({code:h.number().int(),message:h.string(),data:h.optional(h.unknown())})}).strict(),Ed=r=>Sd.safeParse(r).success,Yn=h.union([yd,bd,_d,Sd]),pn=$t.strict(),Ii=ar.extend({method:h.literal("notifications/cancelled"),params:wa.extend({requestId:xi,reason:h.string().optional()})}),wd=h.object({name:h.string(),version:h.string()}).passthrough(),Ev=h.object({experimental:h.optional(h.object({}).passthrough()),sampling:h.optional(h.object({}).passthrough()),roots:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough())}).passthrough(),wv=xt.extend({method:h.literal("initialize"),params:Kt.extend({protocolVersion:h.string(),capabilities:Ev,clientInfo:wd})});var Cv=h.object({experimental:h.optional(h.object({}).passthrough()),logging:h.optional(h.object({}).passthrough()),completions:h.optional(h.object({}).passthrough()),prompts:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough()),resources:h.optional(h.object({subscribe:h.optional(h.boolean()),listChanged:h.optional(h.boolean())}).passthrough()),tools:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough())}).passthrough(),Ys=$t.extend({protocolVersion:h.string(),capabilities:Cv,serverInfo:wd,instructions:h.optional(h.string())}),Cd=ar.extend({method:h.literal("notifications/initialized")}),kd=r=>Cd.safeParse(r).success,Ri=xt.extend({method:h.literal("ping")}),kv=h.object({progress:h.number(),total:h.optional(h.number()),message:h.optional(h.string())}).passthrough(),Pi=ar.extend({method:h.literal("notifications/progress"),params:wa.merge(kv).extend({progressToken:gd})}),Di=xt.extend({params:Kt.extend({cursor:h.optional(fd)}).optional()}),Ni=$t.extend({nextCursor:h.optional(fd)}),Td=h.object({uri:h.string(),mimeType:h.optional(h.string())}).passthrough(),xd=Td.extend({text:h.string()}),Ad=Td.extend({blob:h.string().base64()}),Tv=h.object({uri:h.string(),name:h.string(),description:h.optional(h.string()),mimeType:h.optional(h.string())}).passthrough(),xv=h.object({uriTemplate:h.string(),name:h.string(),description:h.optional(h.string()),mimeType:h.optional(h.string())}).passthrough(),Av=Di.extend({method:h.literal("resources/list")}),Zs=Ni.extend({resources:h.array(Tv)}),Iv=Di.extend({method:h.literal("resources/templates/list")}),Js=Ni.extend({resourceTemplates:h.array(xv)}),Rv=xt.extend({method:h.literal("resources/read"),params:Kt.extend({uri:h.string()})}),Qs=$t.extend({contents:h.array(h.union([xd,Ad]))}),Pv=ar.extend({method:h.literal("notifications/resources/list_changed")}),Dv=xt.extend({method:h.literal("resources/subscribe"),params:Kt.extend({uri:h.string()})}),Nv=xt.extend({method:h.literal("resources/unsubscribe"),params:Kt.extend({uri:h.string()})}),Ov=ar.extend({method:h.literal("notifications/resources/updated"),params:wa.extend({uri:h.string()})}),Lv=h.object({name:h.string(),description:h.optional(h.string()),required:h.optional(h.boolean())}).passthrough(),Mv=h.object({name:h.string(),description:h.optional(h.string()),arguments:h.optional(h.array(Lv))}).passthrough(),Fv=Di.extend({method:h.literal("prompts/list")}),el=Ni.extend({prompts:h.array(Mv)}),Bv=xt.extend({method:h.literal("prompts/get"),params:Kt.extend({name:h.string(),arguments:h.optional(h.record(h.string()))})}),Oi=h.object({type:h.literal("text"),text:h.string()}).passthrough(),Li=h.object({type:h.literal("image"),data:h.string().base64(),mimeType:h.string()}).passthrough(),Mi=h.object({type:h.literal("audio"),data:h.string().base64(),mimeType:h.string()}).passthrough(),Id=h.object({type:h.literal("resource"),resource:h.union([xd,Ad])}).passthrough(),Gv=h.object({role:h.enum(["user","assistant"]),content:h.union([Oi,Li,Mi,Id])}).passthrough(),tl=$t.extend({description:h.optional(h.string()),messages:h.array(Gv)}),zv=ar.extend({method:h.literal("notifications/prompts/list_changed")}),Uv=h.object({title:h.optional(h.string()),readOnlyHint:h.optional(h.boolean()),destructiveHint:h.optional(h.boolean()),idempotentHint:h.optional(h.boolean()),openWorldHint:h.optional(h.boolean())}).passthrough(),Hv=h.object({name:h.string(),description:h.optional(h.string()),inputSchema:h.object({type:h.literal("object"),properties:h.optional(h.object({}).passthrough()),required:h.optional(h.array(h.string()))}).passthrough(),outputSchema:h.optional(h.object({type:h.literal("object"),properties:h.optional(h.object({}).passthrough()),required:h.optional(h.array(h.string()))}).passthrough()),annotations:h.optional(Uv)}).passthrough(),Vv=Di.extend({method:h.literal("tools/list")}),rl=Ni.extend({tools:h.array(Hv)}),Fi=$t.extend({content:h.array(h.union([Oi,Li,Mi,Id])).default([]),structuredContent:h.object({}).passthrough().optional(),isError:h.optional(h.boolean())}),bA=Fi.or($t.extend({toolResult:h.unknown()})),Wv=xt.extend({method:h.literal("tools/call"),params:Kt.extend({name:h.string(),arguments:h.optional(h.record(h.unknown()))})}),nl=ar.extend({method:h.literal("notifications/tools/list_changed")}),Rd=h.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),jv=xt.extend({method:h.literal("logging/setLevel"),params:Kt.extend({level:Rd})}),al=ar.extend({method:h.literal("notifications/message"),params:wa.extend({level:Rd,logger:h.optional(h.string()),data:h.unknown()})}),qv=h.object({name:h.string().optional()}).passthrough(),Kv=h.object({hints:h.optional(h.array(qv)),costPriority:h.optional(h.number().min(0).max(1)),speedPriority:h.optional(h.number().min(0).max(1)),intelligencePriority:h.optional(h.number().min(0).max(1))}).passthrough(),$v=h.object({role:h.enum(["user","assistant"]),content:h.union([Oi,Li,Mi])}).passthrough(),Xv=xt.extend({method:h.literal("sampling/createMessage"),params:Kt.extend({messages:h.array($v),systemPrompt:h.optional(h.string()),includeContext:h.optional(h.enum(["none","thisServer","allServers"])),temperature:h.optional(h.number()),maxTokens:h.number().int(),stopSequences:h.optional(h.array(h.string())),metadata:h.optional(h.object({}).passthrough()),modelPreferences:h.optional(Kv)})}),Yv=$t.extend({model:h.string(),stopReason:h.optional(h.enum(["endTurn","stopSequence","maxTokens"]).or(h.string())),role:h.enum(["user","assistant"]),content:h.discriminatedUnion("type",[Oi,Li,Mi])}),Zv=h.object({type:h.literal("ref/resource"),uri:h.string()}).passthrough(),Jv=h.object({type:h.literal("ref/prompt"),name:h.string()}).passthrough(),Qv=xt.extend({method:h.literal("completion/complete"),params:Kt.extend({ref:h.union([Jv,Zv]),argument:h.object({name:h.string(),value:h.string()}).passthrough()})}),il=$t.extend({completion:h.object({values:h.array(h.string()).max(100),total:h.optional(h.number().int()),hasMore:h.optional(h.boolean())}).passthrough()}),e_=h.object({uri:h.string().startsWith("file://"),name:h.optional(h.string())}).passthrough(),t_=xt.extend({method:h.literal("roots/list")}),r_=$t.extend({roots:h.array(e_)}),n_=ar.extend({method:h.literal("notifications/roots/list_changed")}),vA=h.union([Ri,wv,Qv,jv,Bv,Fv,Av,Iv,Rv,Dv,Nv,Wv,Vv]),_A=h.union([Ii,Pi,Cd,n_]),SA=h.union([pn,Yv,r_]),EA=h.union([Ri,Xv,t_]),wA=h.union([Ii,Pi,al,Ov,Pv,nl,zv]),CA=h.union([pn,Ys,il,tl,el,Zs,Js,Qs,Fi,rl]),Ut=class extends Error{constructor(e,t,a){super(`MCP error ${e}: ${t}`),this.code=e,this.data=a,this.name="McpError"}};var a_=6e4,Bi=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(Ii,t=>{let a=this._requestHandlerAbortControllers.get(t.params.requestId);a?.abort(t.params.reason)}),this.setNotificationHandler(Pi,t=>{this._onprogress(t)}),this.setRequestHandler(Ri,t=>({}))}_setupTimeout(e,t,a,n,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:a,resetTimeoutOnProgress:i,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let a=Date.now()-t.startTime;if(t.maxTotalTimeout&&a>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Ut(zt.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:a});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=t=>{this._onerror(t)},this._transport.onmessage=(t,a)=>{Ca(t)||Ed(t)?this._onresponse(t):Ai(t)?this._onrequest(t,a):vd(t)?this._onnotification(t):this._onerror(new Error(`Unknown message type: ${JSON.stringify(t)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let a=new Ut(zt.ConnectionClosed,"Connection closed");for(let n of t.values())n(a)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let a=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;a!==void 0&&Promise.resolve().then(()=>a(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,t){var a,n,i,o;let s=(a=this._requestHandlers.get(e.method))!==null&&a!==void 0?a:this.fallbackRequestHandler;if(s===void 0){(n=this._transport)===null||n===void 0||n.send({jsonrpc:"2.0",id:e.id,error:{code:zt.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);let c={signal:l.signal,sessionId:(i=this._transport)===null||i===void 0?void 0:i.sessionId,_meta:(o=e.params)===null||o===void 0?void 0:o._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,p,m)=>this.request(u,p,{...m,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id};Promise.resolve().then(()=>s(e,c)).then(u=>{var p;if(!l.signal.aborted)return(p=this._transport)===null||p===void 0?void 0:p.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var p,m;if(!l.signal.aborted)return(p=this._transport)===null||p===void 0?void 0:p.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:zt.InternalError,message:(m=u.message)!==null&&m!==void 0?m:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...a}=e.params,n=Number(t),i=this._progressHandlers.get(n);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(n),s=this._timeoutInfo.get(n);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(l){o(l);return}i(a)}_onresponse(e){let t=Number(e.id),a=this._responseHandlers.get(t);if(a===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),Ca(e))a(e);else{let n=new Ut(e.error.code,e.error.message,e.error.data);a(n)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,a){let{relatedRequestId:n,resumptionToken:i,onresumptiontoken:o}=a??{};return new Promise((s,l)=>{var c,u,p,m,d,g;if(!this._transport){l(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=a?.signal)===null||u===void 0||u.throwIfAborted();let f=this._requestMessageId++,y={...e,jsonrpc:"2.0",id:f};a?.onprogress&&(this._progressHandlers.set(f,a.onprogress),y.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:f}});let v=I=>{var D;this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),(D=this._transport)===null||D===void 0||D.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(I)}},{relatedRequestId:n,resumptionToken:i,onresumptiontoken:o}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`))),l(I)};this._responseHandlers.set(f,I=>{var D;if(!(!((D=a?.signal)===null||D===void 0)&&D.aborted)){if(I instanceof Error)return l(I);try{let C=t.parse(I.result);s(C)}catch(C){l(C)}}}),(m=a?.signal)===null||m===void 0||m.addEventListener("abort",()=>{var I;v((I=a?.signal)===null||I===void 0?void 0:I.reason)});let T=(d=a?.timeout)!==null&&d!==void 0?d:a_,E=()=>v(new Ut(zt.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(f,T,a?.maxTotalTimeout,E,(g=a?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(y,{relatedRequestId:n,resumptionToken:i,onresumptiontoken:o}).catch(I=>{this._cleanupTimeout(f),l(I)})})}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let a={...e,jsonrpc:"2.0"};await this._transport.send(a,t)}setRequestHandler(e,t){let a=e.shape.method.value;this.assertRequestHandlerCapability(a),this._requestHandlers.set(a,(n,i)=>Promise.resolve(t(e.parse(n),i)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,a=>Promise.resolve(t(e.parse(a))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Pd(r,e){return Object.entries(e).reduce((t,[a,n])=>(n&&typeof n=="object"?t[a]=t[a]?{...t[a],...n}:n:t[a]=n,t),{...r})}var Nm=Cs(Dm(),1),Ta=class extends Bi{constructor(e,t){var a;super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(a=t?.capabilities)!==null&&a!==void 0?a:{},this._ajv=new Nm.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Pd(this._capabilities,e)}assertCapability(e,t){var a;if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a[e]))throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{let a=await this.request({method:"initialize",params:{protocolVersion:Xn,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ys,t);if(a===void 0)throw new Error(`Server sent invalid initialize result: ${a}`);if(!hd.includes(a.protocolVersion))throw new Error(`Server's protocol version is not supported: ${a.protocolVersion}`);this._serverCapabilities=a.capabilities,this._serverVersion=a.serverInfo,this._instructions=a.instructions,await this.notification({method:"notifications/initialized"})}catch(a){throw this.close(),a}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var t,a,n,i,o;switch(e){case"logging/setLevel":if(!(!((t=this._serverCapabilities)===null||t===void 0)&&t.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var t;switch(e){case"notifications/roots/list_changed":if(!(!((t=this._capabilities.roots)===null||t===void 0)&&t.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},pn,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},il,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},pn,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},tl,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},el,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},Zs,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},Js,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Qs,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},pn,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},pn,t)}async callTool(e,t=Fi,a){let n=await this.request({method:"tools/call",params:e},t,a),i=this.getToolOutputValidator(e.name);if(i){if(!n.structuredContent&&!n.isError)throw new Ut(zt.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(n.structuredContent)try{if(!i(n.structuredContent))throw new Ut(zt.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(i.errors)}`)}catch(o){throw o instanceof Ut?o:new Ut(zt.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return n}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let t of e)if(t.outputSchema)try{let a=this._ajv.compile(t.outputSchema);this._cachedToolOutputValidators.set(t.name,a)}catch(a){console.warn(`Failed to compile output schema for tool ${t.name}: ${a}`)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let a=await this.request({method:"tools/list",params:e},rl,t);return this.cacheToolOutputSchemas(a.tools),a}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Rl;Rl=globalThis.crypto;async function FS(r){return(await Rl).getRandomValues(new Uint8Array(r))}async function BS(r){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",t="",a=await FS(r);for(let n=0;n<r;n++){let i=a[n]%e.length;t+=e[i]}return t}async function GS(r){return await BS(r)}async function zS(r){let e=await(await Rl).subtle.digest("SHA-256",new TextEncoder().encode(r));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Pl(r){if(r||(r=43),r<43||r>128)throw`Expected a length between 43 and 128. Received ${r}.`;let e=await GS(r),t=await zS(e);return{code_verifier:e,code_challenge:t}}var Om=h.object({resource:h.string().url(),authorization_servers:h.array(h.string().url()).optional(),jwks_uri:h.string().url().optional(),scopes_supported:h.array(h.string()).optional(),bearer_methods_supported:h.array(h.string()).optional(),resource_signing_alg_values_supported:h.array(h.string()).optional(),resource_name:h.string().optional(),resource_documentation:h.string().optional(),resource_policy_uri:h.string().url().optional(),resource_tos_uri:h.string().url().optional(),tls_client_certificate_bound_access_tokens:h.boolean().optional(),authorization_details_types_supported:h.array(h.string()).optional(),dpop_signing_alg_values_supported:h.array(h.string()).optional(),dpop_bound_access_tokens_required:h.boolean().optional()}).passthrough(),Lm=h.object({issuer:h.string(),authorization_endpoint:h.string(),token_endpoint:h.string(),registration_endpoint:h.string().optional(),scopes_supported:h.array(h.string()).optional(),response_types_supported:h.array(h.string()),response_modes_supported:h.array(h.string()).optional(),grant_types_supported:h.array(h.string()).optional(),token_endpoint_auth_methods_supported:h.array(h.string()).optional(),token_endpoint_auth_signing_alg_values_supported:h.array(h.string()).optional(),service_documentation:h.string().optional(),revocation_endpoint:h.string().optional(),revocation_endpoint_auth_methods_supported:h.array(h.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:h.array(h.string()).optional(),introspection_endpoint:h.string().optional(),introspection_endpoint_auth_methods_supported:h.array(h.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:h.array(h.string()).optional(),code_challenge_methods_supported:h.array(h.string()).optional()}).passthrough(),Dl=h.object({access_token:h.string(),token_type:h.string(),expires_in:h.number().optional(),scope:h.string().optional(),refresh_token:h.string().optional()}).strip(),CI=h.object({error:h.string(),error_description:h.string().optional(),error_uri:h.string().optional()}),US=h.object({redirect_uris:h.array(h.string()).refine(r=>r.every(e=>URL.canParse(e)),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:h.string().optional(),grant_types:h.array(h.string()).optional(),response_types:h.array(h.string()).optional(),client_name:h.string().optional(),client_uri:h.string().optional(),logo_uri:h.string().optional(),scope:h.string().optional(),contacts:h.array(h.string()).optional(),tos_uri:h.string().optional(),policy_uri:h.string().optional(),jwks_uri:h.string().optional(),jwks:h.any().optional(),software_id:h.string().optional(),software_version:h.string().optional()}).strip(),HS=h.object({client_id:h.string(),client_secret:h.string().optional(),client_id_issued_at:h.number().optional(),client_secret_expires_at:h.number().optional()}).strip(),Mm=US.merge(HS),kI=h.object({error:h.string(),error_description:h.string().optional()}).strip(),TI=h.object({token:h.string(),token_type_hint:h.string().optional()}).strip();var _t=class extends Error{constructor(e){super(e??"Unauthorized")}};async function Mr(r,{serverUrl:e,authorizationCode:t,scope:a,resourceMetadataUrl:n}){let i=e;try{let m=await VS(n||e);m.authorization_servers&&m.authorization_servers.length>0&&(i=m.authorization_servers[0])}catch(m){console.warn("Could not load OAuth Protected Resource metadata, falling back to /.well-known/oauth-authorization-server",m)}let o=await WS(i),s=await Promise.resolve(r.clientInformation());if(!s){if(t!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!r.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let m=await $S(i,{metadata:o,clientMetadata:r.clientMetadata});await r.saveClientInformation(m),s=m}if(t!==void 0){let m=await r.codeVerifier(),d=await qS(i,{metadata:o,clientInformation:s,authorizationCode:t,codeVerifier:m,redirectUri:r.redirectUrl});return await r.saveTokens(d),"AUTHORIZED"}let l=await r.tokens();if(l?.refresh_token)try{let m=await KS(i,{metadata:o,clientInformation:s,refreshToken:l.refresh_token});return await r.saveTokens(m),"AUTHORIZED"}catch(m){console.error("Could not refresh OAuth tokens:",m)}let c=r.state?await r.state():void 0,{authorizationUrl:u,codeVerifier:p}=await jS(i,{metadata:o,clientInformation:s,state:c,redirectUrl:r.redirectUrl,scope:a||r.clientMetadata.scope});return await r.saveCodeVerifier(p),await r.redirectToAuthorization(u),"REDIRECT"}function no(r){let e=r.headers.get("WWW-Authenticate");if(!e)return;let[t,a]=e.split(" ");if(t.toLowerCase()!=="bearer"||!a){console.log("Invalid WWW-Authenticate header format, expected 'Bearer'");return}let i=/resource_metadata="([^"]*)"/.exec(e);if(i)try{return new URL(i[1])}catch{console.log("Invalid resource metadata url: ",i[1]);return}}async function VS(r,e){var t;let a;e?.resourceMetadataUrl?a=new URL(e?.resourceMetadataUrl):a=new URL("/.well-known/oauth-protected-resource",r);let n;try{n=await fetch(a,{headers:{"MCP-Protocol-Version":(t=e?.protocolVersion)!==null&&t!==void 0?t:Xn}})}catch(i){if(i instanceof TypeError)n=await fetch(a);else throw i}if(n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return Om.parse(await n.json())}async function WS(r,e){var t;let a=new URL("/.well-known/oauth-authorization-server",r),n;try{n=await fetch(a,{headers:{"MCP-Protocol-Version":(t=e?.protocolVersion)!==null&&t!==void 0?t:Xn}})}catch(i){if(i instanceof TypeError)n=await fetch(a);else throw i}if(n.status!==404){if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth metadata`);return Lm.parse(await n.json())}}async function jS(r,{metadata:e,clientInformation:t,redirectUrl:a,scope:n,state:i}){let o="code",s="S256",l;if(e){if(l=new URL(e.authorization_endpoint),!e.response_types_supported.includes(o))throw new Error(`Incompatible auth server: does not support response type ${o}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(s))throw new Error(`Incompatible auth server: does not support code challenge method ${s}`)}else l=new URL("/authorize",r);let c=await Pl(),u=c.code_verifier,p=c.code_challenge;return l.searchParams.set("response_type",o),l.searchParams.set("client_id",t.client_id),l.searchParams.set("code_challenge",p),l.searchParams.set("code_challenge_method",s),l.searchParams.set("redirect_uri",String(a)),i&&l.searchParams.set("state",i),n&&l.searchParams.set("scope",n),{authorizationUrl:l,codeVerifier:u}}async function qS(r,{metadata:e,clientInformation:t,authorizationCode:a,codeVerifier:n,redirectUri:i}){let o="authorization_code",s;if(e){if(s=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(o))throw new Error(`Incompatible auth server: does not support grant type ${o}`)}else s=new URL("/token",r);let l=new URLSearchParams({grant_type:o,client_id:t.client_id,code:a,code_verifier:n,redirect_uri:String(i)});t.client_secret&&l.set("client_secret",t.client_secret);let c=await fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:l});if(!c.ok)throw new Error(`Token exchange failed: HTTP ${c.status}`);return Dl.parse(await c.json())}async function KS(r,{metadata:e,clientInformation:t,refreshToken:a}){let n="refresh_token",i;if(e){if(i=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(n))throw new Error(`Incompatible auth server: does not support grant type ${n}`)}else i=new URL("/token",r);let o=new URLSearchParams({grant_type:n,client_id:t.client_id,refresh_token:a});t.client_secret&&o.set("client_secret",t.client_secret);let s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o});if(!s.ok)throw new Error(`Token refresh failed: HTTP ${s.status}`);return Dl.parse({refresh_token:a,...await s.json()})}async function $S(r,{metadata:e,clientMetadata:t}){let a;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");a=new URL(e.registration_endpoint)}else a=new URL("/register",r);let n=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`Dynamic client registration failed: HTTP ${n.status}`);return Mm.parse(await n.json())}var ao=class extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function Nl(r){}function io(r){if(typeof r=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Nl,onError:t=Nl,onRetry:a=Nl,onComment:n}=r,i="",o=!0,s,l="",c="";function u(f){let y=o?f.replace(/^\xEF\xBB\xBF/,""):f,[v,T]=XS(`${i}${y}`);for(let E of v)p(E);i=T,o=!1}function p(f){if(f===""){d();return}if(f.startsWith(":")){n&&n(f.slice(f.startsWith(": ")?2:1));return}let y=f.indexOf(":");if(y!==-1){let v=f.slice(0,y),T=f[y+1]===" "?2:1,E=f.slice(y+T);m(v,E,f);return}m(f,"",f)}function m(f,y,v){switch(f){case"event":c=y;break;case"data":l=`${l}${y}
|
|
3255
|
+
`;break;case"id":s=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?a(parseInt(y,10)):t(new ao(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:v}));break;default:t(new ao(`Unknown field "${f.length>20?`${f.slice(0,20)}\u2026`:f}"`,{type:"unknown-field",field:f,value:y,line:v}));break}}function d(){l.length>0&&e({id:s,event:c||void 0,data:l.endsWith(`
|
|
3256
|
+
`)?l.slice(0,-1):l}),s=void 0,l="",c=""}function g(f={}){i&&f.consume&&p(i),o=!0,s=void 0,l="",c="",i=""}return{feed:u,reset:g}}function XS(r){let e=[],t="",a=0;for(;a<r.length;){let n=r.indexOf("\r",a),i=r.indexOf(`
|
|
3257
3257
|
`,a),o=-1;if(n!==-1&&i!==-1?o=Math.min(n,i):n!==-1?o=n:i!==-1&&(o=i),o===-1){t=r.slice(a);break}else{let s=r.slice(a,o);e.push(s),a=o+1,r[a-1]==="\r"&&r[a]===`
|
|
3258
|
-
`&&a++}}return[e,t]}var ao=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:a}={}){let n;super({start(i){n=no({onEvent:o=>{i.enqueue(o)},onError(o){e==="terminate"?i.error(o):typeof e=="function"&&e(o)},onRetry:t,onComment:a})},transform(i){n.feed(i)}})}};var KS={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Ta=class extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}},io=class{constructor(e,t){var a;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._sessionId=t?.sessionId,this._reconnectionOptions=(a=t?.reconnectionOptions)!==null&&a!==void 0?a:KS}async _authThenStart(){var e;if(!this._authProvider)throw new vt("No auth provider");let t;try{t=await Or(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})}catch(a){throw(e=this.onerror)===null||e===void 0||e.call(this,a),a}if(t!=="AUTHORIZED")throw new vt;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let t={};if(this._authProvider){let a=await this._authProvider.tokens();a&&(t.Authorization=`Bearer ${a.access_token}`)}return this._sessionId&&(t["mcp-session-id"]=this._sessionId),new Headers({...t,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}async _startOrAuthSse(e){var t,a;let{resumptionToken:n}=e;try{let i=await this._commonHeaders();i.set("Accept","text/event-stream"),n&&i.set("last-event-id",n);let o=await fetch(this._url,{method:"GET",headers:i,signal:(t=this._abortController)===null||t===void 0?void 0:t.signal});if(!o.ok){if(o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new Ta(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e)}catch(i){throw(a=this.onerror)===null||a===void 0||a.call(this,i),i}}_getNextReconnectionDelay(e){let t=this._reconnectionOptions.initialReconnectionDelay,a=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(a,e),n)}_scheduleReconnection(e,t=0){var a;let n=this._reconnectionOptions.maxRetries;if(n>0&&t>=n){(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let i=this._getNextReconnectionDelay(t);setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var s;(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,t+1)})},i)}_handleSseStream(e,t){if(!e)return;let{onresumptiontoken:a,replayMessageId:n}=t,i;(async()=>{var s,l,c,u;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new ao).getReader();for(;;){let{value:m,done:d}=await p.read();if(d)break;if(m.id&&(i=m.id,a?.(m.id)),!m.event||m.event==="message")try{let g=$n.parse(JSON.parse(m.data));n!==void 0&&wa(g)&&(g.id=n),(s=this.onmessage)===null||s===void 0||s.call(this,g)}catch(g){(l=this.onerror)===null||l===void 0||l.call(this,g)}}}catch(p){if((c=this.onerror)===null||c===void 0||c.call(this,new Error(`SSE stream disconnected: ${p}`)),this._abortController&&!this._abortController.signal.aborted&&i!==void 0)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:n},0)}catch(m){(u=this.onerror)===null||u===void 0||u.call(this,new Error(`Failed to reconnect: ${m instanceof Error?m.message:String(m)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new vt("No auth provider");if(await Or(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new vt("Failed to authorize")}async close(){var e,t;(e=this._abortController)===null||e===void 0||e.abort(),(t=this.onclose)===null||t===void 0||t.call(this)}async send(e,t){var a,n,i;try{let{resumptionToken:o,onresumptiontoken:s}=t||{};if(o){this._startOrAuthSse({resumptionToken:o,replayMessageId:Ti(e)?e.id:void 0}).catch(f=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,f)});return}let l=await this._commonHeaders();l.set("content-type","application/json"),l.set("accept","application/json, text/event-stream");let c={...this._requestInit,method:"POST",headers:l,body:JSON.stringify(e),signal:(a=this._abortController)===null||a===void 0?void 0:a.signal},u=await fetch(this._url,c),p=u.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!u.ok){if(u.status===401&&this._authProvider){if(this._resourceMetadataUrl=to(u),await Or(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new vt;return this.send(e)}let f=await u.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${u.status}): ${f}`)}if(u.status===202){wd(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,f)});return}let d=(Array.isArray(e)?e:[e]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,g=u.headers.get("content-type");if(d)if(g?.includes("text/event-stream"))this._handleSseStream(u.body,{onresumptiontoken:s});else if(g?.includes("application/json")){let f=await u.json(),y=Array.isArray(f)?f.map(v=>$n.parse(v)):[$n.parse(f)];for(let v of y)(n=this.onmessage)===null||n===void 0||n.call(this,v)}else throw new Ta(-1,`Unexpected content type: ${g}`)}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}get sessionId(){return this._sessionId}async terminateSession(){var e,t;if(this._sessionId)try{let a=await this._commonHeaders(),n={...this._requestInit,method:"DELETE",headers:a,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},i=await fetch(this._url,n);if(!i.ok&&i.status!==405)throw new Ta(i.status,`Failed to terminate session: ${i.statusText}`);this._sessionId=void 0}catch(a){throw(t=this.onerror)===null||t===void 0||t.call(this,a),a}}};var so=class extends Event{constructor(e,t){var a,n;super(e),this.code=(a=t?.code)!=null?a:void 0,this.message=(n=t?.message)!=null?n:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,a){return a(Lm(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(Lm(this),t)}};function $S(r){let e=globalThis.DOMException;return typeof e=="function"?new e(r,"SyntaxError"):new SyntaxError(r)}function Dl(r){return r instanceof Error?"errors"in r&&Array.isArray(r.errors)?r.errors.map(Dl).join(", "):"cause"in r&&r.cause instanceof Error?`${r}: ${Dl(r.cause)}`:r.message:`${r}`}function Lm(r){return{type:r.type,message:r.message,code:r.code,defaultPrevented:r.defaultPrevented,cancelable:r.cancelable,timeStamp:r.timeStamp}}var Fm=r=>{throw TypeError(r)},zl=(r,e,t)=>e.has(r)||Fm("Cannot "+t),me=(r,e,t)=>(zl(r,e,"read from private field"),t?t.call(r):e.get(r)),Xe=(r,e,t)=>e.has(r)?Fm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Le=(r,e,t,a)=>(zl(r,e,"write to private field"),e.set(r,t),t),yr=(r,e,t)=>(zl(r,e,"access private method"),t),_t,pn,Xn,oo,lo,Ia,Jn,Ra,Lr,Yn,Qn,Zn,xa,$t,Nl,Ol,Ll,Mm,Ml,Fl,Aa,Bl,Gl,mn=class extends EventTarget{constructor(e,t){var a,n;super(),Xe(this,$t),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Xe(this,_t),Xe(this,pn),Xe(this,Xn),Xe(this,oo),Xe(this,lo),Xe(this,Ia),Xe(this,Jn),Xe(this,Ra,null),Xe(this,Lr),Xe(this,Yn),Xe(this,Qn,null),Xe(this,Zn,null),Xe(this,xa,null),Xe(this,Ol,async i=>{var o;me(this,Yn).reset();let{body:s,redirected:l,status:c,headers:u}=i;if(c===204){yr(this,$t,Aa).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?Le(this,Xn,new URL(i.url)):Le(this,Xn,void 0),c!==200){yr(this,$t,Aa).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){yr(this,$t,Aa).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(me(this,_t)===this.CLOSED)return;Le(this,_t,this.OPEN);let p=new Event("open");if((o=me(this,xa))==null||o.call(this,p),this.dispatchEvent(p),typeof s!="object"||!s||!("getReader"in s)){yr(this,$t,Aa).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}let m=new TextDecoder,d=s.getReader(),g=!0;do{let{done:f,value:y}=await d.read();y&&me(this,Yn).feed(m.decode(y,{stream:!f})),f&&(g=!1,me(this,Yn).reset(),yr(this,$t,Bl).call(this))}while(g)}),Xe(this,Ll,i=>{Le(this,Lr,void 0),!(i.name==="AbortError"||i.type==="aborted")&&yr(this,$t,Bl).call(this,Dl(i))}),Xe(this,Ml,i=>{typeof i.id=="string"&&Le(this,Ra,i.id);let o=new MessageEvent(i.event||"message",{data:i.data,origin:me(this,Xn)?me(this,Xn).origin:me(this,pn).origin,lastEventId:i.id||""});me(this,Zn)&&(!i.event||i.event==="message")&&me(this,Zn).call(this,o),this.dispatchEvent(o)}),Xe(this,Fl,i=>{Le(this,Ia,i)}),Xe(this,Gl,()=>{Le(this,Jn,void 0),me(this,_t)===this.CONNECTING&&yr(this,$t,Nl).call(this)});try{if(e instanceof URL)Le(this,pn,e);else if(typeof e=="string")Le(this,pn,new URL(e,XS()));else throw new Error("Invalid URL")}catch{throw $S("An invalid or illegal string was specified")}Le(this,Yn,no({onEvent:me(this,Ml),onRetry:me(this,Fl)})),Le(this,_t,this.CONNECTING),Le(this,Ia,3e3),Le(this,lo,(a=t?.fetch)!=null?a:globalThis.fetch),Le(this,oo,(n=t?.withCredentials)!=null?n:!1),yr(this,$t,Nl).call(this)}get readyState(){return me(this,_t)}get url(){return me(this,pn).href}get withCredentials(){return me(this,oo)}get onerror(){return me(this,Qn)}set onerror(e){Le(this,Qn,e)}get onmessage(){return me(this,Zn)}set onmessage(e){Le(this,Zn,e)}get onopen(){return me(this,xa)}set onopen(e){Le(this,xa,e)}addEventListener(e,t,a){let n=t;super.addEventListener(e,n,a)}removeEventListener(e,t,a){let n=t;super.removeEventListener(e,n,a)}close(){me(this,Jn)&&clearTimeout(me(this,Jn)),me(this,_t)!==this.CLOSED&&(me(this,Lr)&&me(this,Lr).abort(),Le(this,_t,this.CLOSED),Le(this,Lr,void 0))}};_t=new WeakMap,pn=new WeakMap,Xn=new WeakMap,oo=new WeakMap,lo=new WeakMap,Ia=new WeakMap,Jn=new WeakMap,Ra=new WeakMap,Lr=new WeakMap,Yn=new WeakMap,Qn=new WeakMap,Zn=new WeakMap,xa=new WeakMap,$t=new WeakSet,Nl=function(){Le(this,_t,this.CONNECTING),Le(this,Lr,new AbortController),me(this,lo)(me(this,pn),yr(this,$t,Mm).call(this)).then(me(this,Ol)).catch(me(this,Ll))},Ol=new WeakMap,Ll=new WeakMap,Mm=function(){var r;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...me(this,Ra)?{"Last-Event-ID":me(this,Ra)}:void 0},cache:"no-store",signal:(r=me(this,Lr))==null?void 0:r.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Ml=new WeakMap,Fl=new WeakMap,Aa=function(r,e){var t;me(this,_t)!==this.CLOSED&&Le(this,_t,this.CLOSED);let a=new so("error",{code:e,message:r});(t=me(this,Qn))==null||t.call(this,a),this.dispatchEvent(a)},Bl=function(r,e){var t;if(me(this,_t)===this.CLOSED)return;Le(this,_t,this.CONNECTING);let a=new so("error",{code:e,message:r});(t=me(this,Qn))==null||t.call(this,a),this.dispatchEvent(a),Le(this,Jn,setTimeout(me(this,Gl),me(this,Ia)))},Gl=new WeakMap,mn.CONNECTING=0,mn.OPEN=1,mn.CLOSED=2;function XS(){let r="document"in globalThis?globalThis.document:void 0;return r&&typeof r=="object"&&"baseURI"in r&&typeof r.baseURI=="string"?r.baseURI:void 0}var Ul=class extends Error{constructor(e,t,a){super(`SSE error: ${t}`),this.code=e,this.event=a}},co=class{constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=t?.eventSourceInit,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider}async _authThenStart(){var e;if(!this._authProvider)throw new vt("No auth provider");let t;try{t=await Or(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})}catch(a){throw(e=this.onerror)===null||e===void 0||e.call(this,a),a}if(t!=="AUTHORIZED")throw new vt;return await this._startOrAuth()}async _commonHeaders(){var e;let t={...(e=this._requestInit)===null||e===void 0?void 0:e.headers};if(this._authProvider){let a=await this._authProvider.tokens();a&&(t.Authorization=`Bearer ${a.access_token}`)}return t}_startOrAuth(){return new Promise((e,t)=>{var a;this._eventSource=new mn(this._url.href,(a=this._eventSourceInit)!==null&&a!==void 0?a:{fetch:(n,i)=>this._commonHeaders().then(o=>fetch(n,{...i,headers:{...o,Accept:"text/event-stream"}}))}),this._abortController=new AbortController,this._eventSource.onerror=n=>{var i;if(n.code===401&&this._authProvider){this._authThenStart().then(e,t);return}let o=new Ul(n.code,n.message,n);t(o),(i=this.onerror)===null||i===void 0||i.call(this,o)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",n=>{var i;let o=n;try{if(this._endpoint=new URL(o.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(s){t(s),(i=this.onerror)===null||i===void 0||i.call(this,s),this.close();return}e()}),this._eventSource.onmessage=n=>{var i,o;let s=n,l;try{l=$n.parse(JSON.parse(s.data))}catch(c){(i=this.onerror)===null||i===void 0||i.call(this,c);return}(o=this.onmessage)===null||o===void 0||o.call(this,l)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new vt("No auth provider");if(await Or(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new vt("Failed to authorize")}async close(){var e,t,a;(e=this._abortController)===null||e===void 0||e.abort(),(t=this._eventSource)===null||t===void 0||t.close(),(a=this.onclose)===null||a===void 0||a.call(this)}async send(e){var t,a,n;if(!this._endpoint)throw new Error("Not connected");try{let i=await this._commonHeaders(),o=new Headers({...i,...(t=this._requestInit)===null||t===void 0?void 0:t.headers});o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(a=this._abortController)===null||a===void 0?void 0:a.signal},l=await fetch(this._endpoint,s);if(!l.ok){if(l.status===401&&this._authProvider){if(this._resourceMetadataUrl=to(l),await Or(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new vt;return this.send(e)}let c=await l.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${l.status}): ${c}`)}}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}};var hn={name:"@intelliweave/embedded",version:"1.8.61",description:"Integrate IntelliWeave into your app or website.",main:"./dist/webpack/index.js",types:"./dist/webpack/index.d.ts",type:"module",exports:{".":"./dist/webpack/index.js","./component":"./dist/component/component.js","./node":"./dist/node/node.js","./react":"./dist/react/react.js","./webpack":"./dist/webpack/index.js"},scripts:{build:"npm run build:lib && npm run build:docs","build:lib":"tsx build.ts","build:dev":"cross-env DEVELOPMENT=1 npm run build","build:docs":"typedoc src/index.mts --out dist/docs/",deploy:'npm run build && gsutil cp ./dist/web-weaver.min.js gs://metapress-cdn/web-weaver.min.js && gcloud compute url-maps invalidate-cdn-cache mp-cdn-loadbalancer --project="mp-backend-api" --path "/web-weaver.min.js" --async',"start:server":"cd server && npm run start","deploy:server":"cd server && npm run deploy","llm:build":"cd llm-server && docker build -t web-weaver-llm .","llm:start":"npm run llm:build && docker run -it --rm -p 8000:80 --gpus=all web-weaver-llm","llm:deploy.docker":"npm run llm:build && gcloud auth configure-docker us-central1-docker.pkg.dev && docker tag web-weaver-llm us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm && docker push us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm","llm:deploy":'npm run llm:deploy.docker && gcloud run deploy web-weaver-llm --project=ydangle-web-companion --image=us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm --allow-unauthenticated --region=us-central1 --description="Web Weaver LLM" --concurrency=2 --min-instances=0 --timeout=5m --memory=16Gi --cpu=8',prepack:"npm run build",test:"npm run build && IW_TESTER_API_KEY=97150cfc-5b97-413e-8da3-e86d01f70057 tsx --test"},keywords:["web","weaver","ai","assistant","chat"],author:"jjv360",license:"UNLICENSED",devDependencies:{"@types/audioworklet":"^0.0.64","@types/lodash":"^4.17.13","@types/react":"^18.3.12","@types/uuid":"^10.0.0",bestzip:"^2.2.1","cross-env":"^7.0.3","find-cache-dir":"^5.0.0",lodash:"^4.17.21","onnxruntime-web":"^1.20.0",react:"^18.3.1","replace-in-file":"^8.2.0",tsup:"^8.3.5",tsx:"^4.19.2",typedoc:"^0.27.6"},peerDependencies:{"onnxruntime-web":"^1.20.0",react:"^18 || ^19"},dependencies:{"@modelcontextprotocol/sdk":"^1.12.1","@types/json-schema":"^7.0.15","gpt-tokenizer":"^2.9.0",minisearch:"^6.3.0","rehype-document":"^7.0.3","rehype-external-links":"^3.0.0","rehype-format":"^5.0.0","rehype-stringify":"^10.0.0","remark-parse":"^11.0.0","remark-rehype":"^11.1.0",unified:"^11.0.4","utility-types":"^3.11.0",uuid:"^10.0.0"}};var Ye=new be("MCPKnowledgeClient"),uo=class{constructor(e){this.tools=[];this.iwActions=[];this.stats={toolsCalled:0};this.lastSearchQuery="";this.lastSearchResults=[];this.config=e}async connect(){return this.client?this.client:this.connectionPromise?await this.connectionPromise:(this.connectionPromise=this.connectInternal(),this.connectionPromise.finally(()=>{this.connectionPromise=void 0}),await this.connectionPromise)}async connectInternal(){Ye.debug("Connecting to MCP client");let e=this.config.connect?await this.config.connect():await Promise.resolve().then(async()=>{let t=new ka({name:hn.name,version:hn.version}),a=new io(new URL(this.config.baseURL));return await t.connect(a),Ye.debug("Connected with HTTP streaming mode"),t}).catch(async t=>{let a=new ka({name:hn.name,version:hn.version}),n=new co(new URL(this.config.baseURL));return await a.connect(n),Ye.debug("Connected with SSE mode"),a});return await this.disconnect(),this.client=e,e.onerror=t=>{Ye.error(`MCP client error: ${t.message}`)},e.onclose=()=>{Ye.debug("MCP client connection closed"),this.client=void 0},e.setNotificationHandler(rl,t=>{t.params.level=="critical"?Ye.error(`[Server] ${t.params.data}`):t.params.level=="emergency"?Ye.error(`[Server] ${t.params.data}`):t.params.level=="error"?Ye.error(`[Server] ${t.params.data}`):t.params.level=="warning"?Ye.warn(`[Server] ${t.params.data}`):t.params.level=="info"?Ye.info(`[Server] ${t.params.data}`):t.params.level=="debug"?Ye.debug(`[Server] ${t.params.data}`):Ye.log(`[Server] ${t.params.data}`)}),e.setNotificationHandler(tl,t=>{Ye.debug("Tool list changed",t),this.fetchTools()}),Ye.debug("Fetching tools from MCP server..."),await this.fetchTools(),e}async disconnect(){await this.client?.close(),this.client=void 0,this.tools=[],this.iwActions=[]}async fetchTools(){let e=[],t;for(;;){let n=await this.client.listTools({cursor:t});t=n.nextCursor;for(let i of n.tools||[])e.push(i);if(!n?.tools?.length||!t)break}let a=[];for(let n of e){let i=!!(this.config.searchToolName&&n.name==this.config.searchToolName&&!this.config.searchToolVisible);a.push({id:n.name,name:n.name,content:n.description||"",type:"action",isContext:!0,parameters:n.inputSchema,action:o=>this.performToolCall(n.name,o),disabled:i})}Ye.debug(`Fetched ${e.length} tools from MCP server.`),this.tools=e,this.iwActions=a}async search(e){if(e==this.lastSearchQuery)return this.lastSearchResults;await this.connect();let t=this.iwActions.slice(),a=await this.performSearchCall(e);return t=t.concat(a),this.lastSearchQuery=e,this.lastSearchResults=t,Ye.debug(`Search completed, found ${t.length} items.`),t}async performSearchCall(e){let t=[];if(!this.config.searchToolName)return t;let a=this.tools.find(i=>i.name==this.config.searchToolName);if(!a)return Ye.warn(`Search function ${this.config.searchToolName} not found on the MCP server.`),t;let n;if(a.inputSchema.required?.length==1){let i=a.inputSchema.required[0];n=await this.performToolCall(this.config.searchToolName,{[i]:e})}else if(a.inputSchema.properties&&Object.keys(a.inputSchema.properties).length==1){let i=Object.keys(a.inputSchema.properties)[0];n=await this.performToolCall(this.config.searchToolName,{[i]:e})}else n=await this.performToolCall(this.config.searchToolName,{});if(Array.isArray(n))for(let i=0;i<n.length;i++){let o=n[i];t.push({id:this.config.id+":"+this.config.searchToolName+":"+i,name:`Search result ${i+1} in ${this.config.searchToolName}`,type:"info",content:typeof o=="string"?o:JSON.stringify(o)})}else t.push({id:this.config.id+":"+this.config.searchToolName+":result",name:`Search result in ${this.config.searchToolName}`,type:"info",content:typeof n=="string"?n:JSON.stringify(n)});return t}async performToolCall(e,t){await this.connect(),Ye.debug(`Performing tool call for ${e} with params:`,t),this.stats.toolsCalled+=1;let a=await this.client.callTool({name:e,arguments:t});if(a.isError){let n=a.content?.[0]?.text||"Unknown error";throw Ye.error(`Error calling tool ${e}: ${n}`),new Error(`Error calling tool ${e}: ${n}`)}if(Array.isArray(a.content)&&a.content.length==1&&a.content[0].type=="text")try{return JSON.parse(a.content[0].text)}catch{}return a.content||[]}};var gn=new be("KnowledgeBase"),Hl=1,po=class r{constructor(e){this._sources=[{id:"core.internal",query:async()=>ed}];this._windowSources=[];this.lastResults=[];this.manualEntries=[];this.ai=e}registerSource(e,t){let a=e;return typeof e=="function"&&(t=e,a=`source.${Hl++}`),this._sources.push({id:a,query:t}),a}removeSource(e){this._sources=this.sources.filter(t=>t.id!==e&&t.query!==e)}addEntry(e){this.manualEntries.push(e)}removeEntry(e){this.manualEntries=this.manualEntries.filter(t=>t.id!==e)}get sources(){let e=this._sources;return Ne().knowledgeBaseSources&&(e=e.concat(Ne().knowledgeBaseSources)),e=e.concat(this._windowSources),e=e.filter(t=>!t.disabled),e}async search(e){gn.debug(`Searching knowledge base for: ${e}`);let t=new Event("webweaver_kb_search",{bubbles:!0,cancelable:!0});t.query=e,t.entries=[],t.sources=[],typeof document<"u"&&document.dispatchEvent(t),this._windowSources=t.sources;let n=(await Promise.all(this.sources.map(async l=>{try{let c=Date.now(),u=await l.query(e);return gn.debug(`Source '${l.id}' took ${Date.now()-c}ms`),u||[]}catch(c){return gn.warn(`Knowledge source '${l.id}' failed:`,c),[]}}))).flat();n=n.concat(t.entries),n=n.concat(this.manualEntries),Ne().knowledgeBase&&(n=n.concat(Ne().knowledgeBase)),n=n.filter(l=>l&&!l.disabled);for(let l=0;l<n.length;l++){let c=n[l];c.id=c.id||`temp.${l}`,c._functionID=c.id.replaceAll(/[^a-zA-Z0-9_]/g,"_"),!c.action&&c.type=="tour"&&(c.action=u=>{throw new Error("This tour does not have an action. You must perform the tour content manually.")}),!c.action&&c.type=="info"&&(c.action=u=>{throw new Error("This item does not have an action. Use the content to provide information to the user instead.")})}let i=new Qu({fields:["id","type","name","content","tags"],storeFields:[],searchOptions:{boost:{name:3,tags:2},fuzzy:.2}});i.addAll(n);let s=i.search(e).map(l=>n.find(c=>c.id==l.id));for(let l of n)l.isContext&&(s.find(c=>c.id===l.id)||s.push(l));return this.lastResults=s,gn.debug("Found results:",s),s}getCachedEntry(e){return this.lastResults.find(t=>t.id==e||t._functionID==e)}registerSourceFromURL(e,t){t||(t=`external.${Hl++}`),gn.debug(`Registering remote knowledge base source: ${e}`);let a=[],n=[],i=!0,o=async(l,c)=>{gn.debug(`Calling remote knowledge base action: ${l.id}`);let u={type:"action",userID:this.ai.userID,extra:this.ai.extra,actionID:l.id,parameters:c},p=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!p.ok)throw new Error(`HTTP Error ${p.status} ${p.statusText}`);let m=await p.json();return s(m.updateItems||[]),m.response},s=l=>{for(let c of l){if(!c.id){gn.warn("KB item skipped since it has no ID.",c);continue}let u=a.find(p=>p.id==c.id);if(u){u.name=c.name||u.name||"",u.content=c.content||u.content||"",u.disabled=c.disabled??u.disabled,u.isContext=c.isContext??u.isContext,u.parameters=c.parameters||u.parameters||[],u.tags=c.tags||u.tags,u.type=c.type||u.type;continue}a.push({...c,action:p=>o(c,p)})}};this.registerSource(t,async l=>{if(i&&n.includes(l))return a;let c={type:"search",userID:this.ai?.userID||"",extra:this.ai?.extra||{},query:l},u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error(`HTTP Error ${u.status} ${u.statusText}`);let p=await u.json();return i=!p.noCache,n.includes(l)||n.push(l),s(p.items),a})}clone(){let e=new r(this.ai);return e._sources=this._sources,e._windowSources=this._windowSources,e.manualEntries=this.manualEntries,e}registerMCPSource(e){e.id||(e.id=`external.${Hl++}`);let t=new uo(e);return this.registerSource(e.id,a=>t.search(a)),t}};var mo=class{constructor(e){this.ai=e}async boolean(e){let t=await this.instruct({...e,instruction:`${e.instruction}
|
|
3258
|
+
`&&a++}}return[e,t]}var oo=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:a}={}){let n;super({start(i){n=io({onEvent:o=>{i.enqueue(o)},onError(o){e==="terminate"?i.error(o):typeof e=="function"&&e(o)},onRetry:t,onComment:a})},transform(i){n.feed(i)}})}};var YS={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},xa=class extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}},so=class{constructor(e,t){var a;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._sessionId=t?.sessionId,this._reconnectionOptions=(a=t?.reconnectionOptions)!==null&&a!==void 0?a:YS}async _authThenStart(){var e;if(!this._authProvider)throw new _t("No auth provider");let t;try{t=await Mr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})}catch(a){throw(e=this.onerror)===null||e===void 0||e.call(this,a),a}if(t!=="AUTHORIZED")throw new _t;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let t={};if(this._authProvider){let a=await this._authProvider.tokens();a&&(t.Authorization=`Bearer ${a.access_token}`)}return this._sessionId&&(t["mcp-session-id"]=this._sessionId),new Headers({...t,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}async _startOrAuthSse(e){var t,a;let{resumptionToken:n}=e;try{let i=await this._commonHeaders();i.set("Accept","text/event-stream"),n&&i.set("last-event-id",n);let o=await fetch(this._url,{method:"GET",headers:i,signal:(t=this._abortController)===null||t===void 0?void 0:t.signal});if(!o.ok){if(o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new xa(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e)}catch(i){throw(a=this.onerror)===null||a===void 0||a.call(this,i),i}}_getNextReconnectionDelay(e){let t=this._reconnectionOptions.initialReconnectionDelay,a=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(a,e),n)}_scheduleReconnection(e,t=0){var a;let n=this._reconnectionOptions.maxRetries;if(n>0&&t>=n){(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let i=this._getNextReconnectionDelay(t);setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var s;(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,t+1)})},i)}_handleSseStream(e,t){if(!e)return;let{onresumptiontoken:a,replayMessageId:n}=t,i;(async()=>{var s,l,c,u;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new oo).getReader();for(;;){let{value:m,done:d}=await p.read();if(d)break;if(m.id&&(i=m.id,a?.(m.id)),!m.event||m.event==="message")try{let g=Yn.parse(JSON.parse(m.data));n!==void 0&&Ca(g)&&(g.id=n),(s=this.onmessage)===null||s===void 0||s.call(this,g)}catch(g){(l=this.onerror)===null||l===void 0||l.call(this,g)}}}catch(p){if((c=this.onerror)===null||c===void 0||c.call(this,new Error(`SSE stream disconnected: ${p}`)),this._abortController&&!this._abortController.signal.aborted&&i!==void 0)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:n},0)}catch(m){(u=this.onerror)===null||u===void 0||u.call(this,new Error(`Failed to reconnect: ${m instanceof Error?m.message:String(m)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new _t("No auth provider");if(await Mr(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new _t("Failed to authorize")}async close(){var e,t;(e=this._abortController)===null||e===void 0||e.abort(),(t=this.onclose)===null||t===void 0||t.call(this)}async send(e,t){var a,n,i;try{let{resumptionToken:o,onresumptiontoken:s}=t||{};if(o){this._startOrAuthSse({resumptionToken:o,replayMessageId:Ai(e)?e.id:void 0}).catch(f=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,f)});return}let l=await this._commonHeaders();l.set("content-type","application/json"),l.set("accept","application/json, text/event-stream");let c={...this._requestInit,method:"POST",headers:l,body:JSON.stringify(e),signal:(a=this._abortController)===null||a===void 0?void 0:a.signal},u=await fetch(this._url,c),p=u.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!u.ok){if(u.status===401&&this._authProvider){if(this._resourceMetadataUrl=no(u),await Mr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new _t;return this.send(e)}let f=await u.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${u.status}): ${f}`)}if(u.status===202){kd(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,f)});return}let d=(Array.isArray(e)?e:[e]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,g=u.headers.get("content-type");if(d)if(g?.includes("text/event-stream"))this._handleSseStream(u.body,{onresumptiontoken:s});else if(g?.includes("application/json")){let f=await u.json(),y=Array.isArray(f)?f.map(v=>Yn.parse(v)):[Yn.parse(f)];for(let v of y)(n=this.onmessage)===null||n===void 0||n.call(this,v)}else throw new xa(-1,`Unexpected content type: ${g}`)}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}get sessionId(){return this._sessionId}async terminateSession(){var e,t;if(this._sessionId)try{let a=await this._commonHeaders(),n={...this._requestInit,method:"DELETE",headers:a,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},i=await fetch(this._url,n);if(!i.ok&&i.status!==405)throw new xa(i.status,`Failed to terminate session: ${i.statusText}`);this._sessionId=void 0}catch(a){throw(t=this.onerror)===null||t===void 0||t.call(this,a),a}}};var co=class extends Event{constructor(e,t){var a,n;super(e),this.code=(a=t?.code)!=null?a:void 0,this.message=(n=t?.message)!=null?n:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,a){return a(Fm(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(Fm(this),t)}};function ZS(r){let e=globalThis.DOMException;return typeof e=="function"?new e(r,"SyntaxError"):new SyntaxError(r)}function Ol(r){return r instanceof Error?"errors"in r&&Array.isArray(r.errors)?r.errors.map(Ol).join(", "):"cause"in r&&r.cause instanceof Error?`${r}: ${Ol(r.cause)}`:r.message:`${r}`}function Fm(r){return{type:r.type,message:r.message,code:r.code,defaultPrevented:r.defaultPrevented,cancelable:r.cancelable,timeStamp:r.timeStamp}}var Gm=r=>{throw TypeError(r)},Hl=(r,e,t)=>e.has(r)||Gm("Cannot "+t),me=(r,e,t)=>(Hl(r,e,"read from private field"),t?t.call(r):e.get(r)),Xe=(r,e,t)=>e.has(r)?Gm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Le=(r,e,t,a)=>(Hl(r,e,"write to private field"),e.set(r,t),t),vr=(r,e,t)=>(Hl(r,e,"access private method"),t),St,gn,Zn,lo,uo,Ra,ea,Pa,Fr,Jn,ta,Qn,Aa,Xt,Ll,Ml,Fl,Bm,Bl,Gl,Ia,zl,Ul,fn=class extends EventTarget{constructor(e,t){var a,n;super(),Xe(this,Xt),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Xe(this,St),Xe(this,gn),Xe(this,Zn),Xe(this,lo),Xe(this,uo),Xe(this,Ra),Xe(this,ea),Xe(this,Pa,null),Xe(this,Fr),Xe(this,Jn),Xe(this,ta,null),Xe(this,Qn,null),Xe(this,Aa,null),Xe(this,Ml,async i=>{var o;me(this,Jn).reset();let{body:s,redirected:l,status:c,headers:u}=i;if(c===204){vr(this,Xt,Ia).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?Le(this,Zn,new URL(i.url)):Le(this,Zn,void 0),c!==200){vr(this,Xt,Ia).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){vr(this,Xt,Ia).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(me(this,St)===this.CLOSED)return;Le(this,St,this.OPEN);let p=new Event("open");if((o=me(this,Aa))==null||o.call(this,p),this.dispatchEvent(p),typeof s!="object"||!s||!("getReader"in s)){vr(this,Xt,Ia).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}let m=new TextDecoder,d=s.getReader(),g=!0;do{let{done:f,value:y}=await d.read();y&&me(this,Jn).feed(m.decode(y,{stream:!f})),f&&(g=!1,me(this,Jn).reset(),vr(this,Xt,zl).call(this))}while(g)}),Xe(this,Fl,i=>{Le(this,Fr,void 0),!(i.name==="AbortError"||i.type==="aborted")&&vr(this,Xt,zl).call(this,Ol(i))}),Xe(this,Bl,i=>{typeof i.id=="string"&&Le(this,Pa,i.id);let o=new MessageEvent(i.event||"message",{data:i.data,origin:me(this,Zn)?me(this,Zn).origin:me(this,gn).origin,lastEventId:i.id||""});me(this,Qn)&&(!i.event||i.event==="message")&&me(this,Qn).call(this,o),this.dispatchEvent(o)}),Xe(this,Gl,i=>{Le(this,Ra,i)}),Xe(this,Ul,()=>{Le(this,ea,void 0),me(this,St)===this.CONNECTING&&vr(this,Xt,Ll).call(this)});try{if(e instanceof URL)Le(this,gn,e);else if(typeof e=="string")Le(this,gn,new URL(e,JS()));else throw new Error("Invalid URL")}catch{throw ZS("An invalid or illegal string was specified")}Le(this,Jn,io({onEvent:me(this,Bl),onRetry:me(this,Gl)})),Le(this,St,this.CONNECTING),Le(this,Ra,3e3),Le(this,uo,(a=t?.fetch)!=null?a:globalThis.fetch),Le(this,lo,(n=t?.withCredentials)!=null?n:!1),vr(this,Xt,Ll).call(this)}get readyState(){return me(this,St)}get url(){return me(this,gn).href}get withCredentials(){return me(this,lo)}get onerror(){return me(this,ta)}set onerror(e){Le(this,ta,e)}get onmessage(){return me(this,Qn)}set onmessage(e){Le(this,Qn,e)}get onopen(){return me(this,Aa)}set onopen(e){Le(this,Aa,e)}addEventListener(e,t,a){let n=t;super.addEventListener(e,n,a)}removeEventListener(e,t,a){let n=t;super.removeEventListener(e,n,a)}close(){me(this,ea)&&clearTimeout(me(this,ea)),me(this,St)!==this.CLOSED&&(me(this,Fr)&&me(this,Fr).abort(),Le(this,St,this.CLOSED),Le(this,Fr,void 0))}};St=new WeakMap,gn=new WeakMap,Zn=new WeakMap,lo=new WeakMap,uo=new WeakMap,Ra=new WeakMap,ea=new WeakMap,Pa=new WeakMap,Fr=new WeakMap,Jn=new WeakMap,ta=new WeakMap,Qn=new WeakMap,Aa=new WeakMap,Xt=new WeakSet,Ll=function(){Le(this,St,this.CONNECTING),Le(this,Fr,new AbortController),me(this,uo)(me(this,gn),vr(this,Xt,Bm).call(this)).then(me(this,Ml)).catch(me(this,Fl))},Ml=new WeakMap,Fl=new WeakMap,Bm=function(){var r;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...me(this,Pa)?{"Last-Event-ID":me(this,Pa)}:void 0},cache:"no-store",signal:(r=me(this,Fr))==null?void 0:r.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Bl=new WeakMap,Gl=new WeakMap,Ia=function(r,e){var t;me(this,St)!==this.CLOSED&&Le(this,St,this.CLOSED);let a=new co("error",{code:e,message:r});(t=me(this,ta))==null||t.call(this,a),this.dispatchEvent(a)},zl=function(r,e){var t;if(me(this,St)===this.CLOSED)return;Le(this,St,this.CONNECTING);let a=new co("error",{code:e,message:r});(t=me(this,ta))==null||t.call(this,a),this.dispatchEvent(a),Le(this,ea,setTimeout(me(this,Ul),me(this,Ra)))},Ul=new WeakMap,fn.CONNECTING=0,fn.OPEN=1,fn.CLOSED=2;function JS(){let r="document"in globalThis?globalThis.document:void 0;return r&&typeof r=="object"&&"baseURI"in r&&typeof r.baseURI=="string"?r.baseURI:void 0}var Vl=class extends Error{constructor(e,t,a){super(`SSE error: ${t}`),this.code=e,this.event=a}},po=class{constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=t?.eventSourceInit,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider}async _authThenStart(){var e;if(!this._authProvider)throw new _t("No auth provider");let t;try{t=await Mr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})}catch(a){throw(e=this.onerror)===null||e===void 0||e.call(this,a),a}if(t!=="AUTHORIZED")throw new _t;return await this._startOrAuth()}async _commonHeaders(){var e;let t={...(e=this._requestInit)===null||e===void 0?void 0:e.headers};if(this._authProvider){let a=await this._authProvider.tokens();a&&(t.Authorization=`Bearer ${a.access_token}`)}return t}_startOrAuth(){return new Promise((e,t)=>{var a;this._eventSource=new fn(this._url.href,(a=this._eventSourceInit)!==null&&a!==void 0?a:{fetch:(n,i)=>this._commonHeaders().then(o=>fetch(n,{...i,headers:{...o,Accept:"text/event-stream"}}))}),this._abortController=new AbortController,this._eventSource.onerror=n=>{var i;if(n.code===401&&this._authProvider){this._authThenStart().then(e,t);return}let o=new Vl(n.code,n.message,n);t(o),(i=this.onerror)===null||i===void 0||i.call(this,o)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",n=>{var i;let o=n;try{if(this._endpoint=new URL(o.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(s){t(s),(i=this.onerror)===null||i===void 0||i.call(this,s),this.close();return}e()}),this._eventSource.onmessage=n=>{var i,o;let s=n,l;try{l=Yn.parse(JSON.parse(s.data))}catch(c){(i=this.onerror)===null||i===void 0||i.call(this,c);return}(o=this.onmessage)===null||o===void 0||o.call(this,l)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new _t("No auth provider");if(await Mr(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new _t("Failed to authorize")}async close(){var e,t,a;(e=this._abortController)===null||e===void 0||e.abort(),(t=this._eventSource)===null||t===void 0||t.close(),(a=this.onclose)===null||a===void 0||a.call(this)}async send(e){var t,a,n;if(!this._endpoint)throw new Error("Not connected");try{let i=await this._commonHeaders(),o=new Headers({...i,...(t=this._requestInit)===null||t===void 0?void 0:t.headers});o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(a=this._abortController)===null||a===void 0?void 0:a.signal},l=await fetch(this._endpoint,s);if(!l.ok){if(l.status===401&&this._authProvider){if(this._resourceMetadataUrl=no(l),await Mr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new _t;return this.send(e)}let c=await l.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${l.status}): ${c}`)}}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}};var _r={name:"@intelliweave/embedded",version:"1.8.63",description:"Integrate IntelliWeave into your app or website.",main:"./dist/webpack/index.js",types:"./dist/webpack/index.d.ts",type:"module",exports:{".":"./dist/webpack/index.js","./component":"./dist/component/component.js","./node":"./dist/node/node.js","./react":"./dist/react/react.js","./webpack":"./dist/webpack/index.js"},scripts:{build:"npm run build:lib && npm run build:docs","build:lib":"tsx build.ts","build:dev":"cross-env DEVELOPMENT=1 npm run build","build:docs":"typedoc src/index.mts --out dist/docs/",deploy:'npm run build && gsutil cp ./dist/web-weaver.min.js gs://metapress-cdn/web-weaver.min.js && gcloud compute url-maps invalidate-cdn-cache mp-cdn-loadbalancer --project="mp-backend-api" --path "/web-weaver.min.js" --async',"start:server":"cd server && npm run start","deploy:server":"cd server && npm run deploy","llm:build":"cd llm-server && docker build -t web-weaver-llm .","llm:start":"npm run llm:build && docker run -it --rm -p 8000:80 --gpus=all web-weaver-llm","llm:deploy.docker":"npm run llm:build && gcloud auth configure-docker us-central1-docker.pkg.dev && docker tag web-weaver-llm us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm && docker push us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm","llm:deploy":'npm run llm:deploy.docker && gcloud run deploy web-weaver-llm --project=ydangle-web-companion --image=us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm --allow-unauthenticated --region=us-central1 --description="Web Weaver LLM" --concurrency=2 --min-instances=0 --timeout=5m --memory=16Gi --cpu=8',prepack:"npm run build",test:"npm run build && IW_TESTER_API_KEY=97150cfc-5b97-413e-8da3-e86d01f70057 tsx --test"},keywords:["web","weaver","ai","assistant","chat"],author:"jjv360",license:"UNLICENSED",devDependencies:{"@types/audioworklet":"^0.0.64","@types/lodash":"^4.17.13","@types/react":"^18.3.12","@types/uuid":"^10.0.0",bestzip:"^2.2.1","cross-env":"^7.0.3","find-cache-dir":"^5.0.0",lodash:"^4.17.21","onnxruntime-web":"^1.20.0",react:"^18.3.1","replace-in-file":"^8.2.0",tsup:"^8.3.5",tsx:"^4.19.2",typedoc:"^0.27.6"},peerDependencies:{"onnxruntime-web":"^1.20.0",react:"^18 || ^19"},dependencies:{"@modelcontextprotocol/sdk":"^1.12.1","@types/json-schema":"^7.0.15","gpt-tokenizer":"^2.9.0",minisearch:"^6.3.0","rehype-document":"^7.0.3","rehype-external-links":"^3.0.0","rehype-format":"^5.0.0","rehype-stringify":"^10.0.0","remark-parse":"^11.0.0","remark-rehype":"^11.1.0",unified:"^11.0.4","utility-types":"^3.11.0",uuid:"^10.0.0"}};var Ye=new ge("MCPKnowledgeClient"),mo=class{constructor(e){this.tools=[];this.iwActions=[];this.stats={toolsCalled:0};this.lastSearchQuery="";this.lastSearchResults=[];this.config=e}async connect(){return this.client?this.client:this.connectionPromise?await this.connectionPromise:(this.connectionPromise=this.connectInternal(),this.connectionPromise.finally(()=>{this.connectionPromise=void 0}),await this.connectionPromise)}async connectInternal(){Ye.debug("Connecting to MCP client");let e=this.config.connect?await this.config.connect():await Promise.resolve().then(async()=>{let t=new Ta({name:_r.name,version:_r.version}),a=new so(new URL(this.config.baseURL));return await t.connect(a),Ye.debug("Connected with HTTP streaming mode"),t}).catch(async t=>{let a=new Ta({name:_r.name,version:_r.version}),n=new po(new URL(this.config.baseURL));return await a.connect(n),Ye.debug("Connected with SSE mode"),a});return await this.disconnect(),this.client=e,e.onerror=t=>{Ye.error(`MCP client error: ${t.message}`)},e.onclose=()=>{Ye.debug("MCP client connection closed"),this.client=void 0},e.setNotificationHandler(al,t=>{t.params.level=="critical"?Ye.error(`[Server] ${t.params.data}`):t.params.level=="emergency"?Ye.error(`[Server] ${t.params.data}`):t.params.level=="error"?Ye.error(`[Server] ${t.params.data}`):t.params.level=="warning"?Ye.warn(`[Server] ${t.params.data}`):t.params.level=="info"?Ye.info(`[Server] ${t.params.data}`):t.params.level=="debug"?Ye.debug(`[Server] ${t.params.data}`):Ye.log(`[Server] ${t.params.data}`)}),e.setNotificationHandler(nl,t=>{Ye.debug("Tool list changed",t),this.fetchTools()}),Ye.debug("Fetching tools from MCP server..."),await this.fetchTools(),e}async disconnect(){await this.client?.close(),this.client=void 0,this.tools=[],this.iwActions=[]}async fetchTools(){let e=[],t;for(;;){let n=await this.client.listTools({cursor:t});t=n.nextCursor;for(let i of n.tools||[])e.push(i);if(!n?.tools?.length||!t)break}let a=[];for(let n of e){let i=!!(this.config.searchToolName&&n.name==this.config.searchToolName&&!this.config.searchToolVisible);a.push({id:n.name,name:n.name,content:n.description||"",type:"action",isContext:!0,parameters:n.inputSchema,action:o=>this.performToolCall(n.name,o),disabled:i})}Ye.debug(`Fetched ${e.length} tools from MCP server.`),this.tools=e,this.iwActions=a}async search(e){if(e==this.lastSearchQuery)return this.lastSearchResults;await this.connect();let t=this.iwActions.slice(),a=await this.performSearchCall(e);return t=t.concat(a),this.lastSearchQuery=e,this.lastSearchResults=t,Ye.debug(`Search completed, found ${t.length} items.`),t}async performSearchCall(e){let t=[];if(!this.config.searchToolName)return t;let a=this.tools.find(i=>i.name==this.config.searchToolName);if(!a)return Ye.warn(`Search function ${this.config.searchToolName} not found on the MCP server.`),t;let n;if(a.inputSchema.required?.length==1){let i=a.inputSchema.required[0];n=await this.performToolCall(this.config.searchToolName,{[i]:e})}else if(a.inputSchema.properties&&Object.keys(a.inputSchema.properties).length==1){let i=Object.keys(a.inputSchema.properties)[0];n=await this.performToolCall(this.config.searchToolName,{[i]:e})}else n=await this.performToolCall(this.config.searchToolName,{});if(Array.isArray(n))for(let i=0;i<n.length;i++){let o=n[i];t.push({id:this.config.id+":"+this.config.searchToolName+":"+i,name:`Search result ${i+1} in ${this.config.searchToolName}`,type:"info",content:typeof o=="string"?o:JSON.stringify(o)})}else t.push({id:this.config.id+":"+this.config.searchToolName+":result",name:`Search result in ${this.config.searchToolName}`,type:"info",content:typeof n=="string"?n:JSON.stringify(n)});return t}async performToolCall(e,t){await this.connect(),Ye.debug(`Performing tool call for ${e} with params:`,t),this.stats.toolsCalled+=1;let a=await this.client.callTool({name:e,arguments:t});if(a.isError){let n=a.content?.[0]?.text||"Unknown error";throw Ye.error(`Error calling tool ${e}: ${n}`),new Error(`Error calling tool ${e}: ${n}`)}if(Array.isArray(a.content)&&a.content.length==1&&a.content[0].type=="text")try{return JSON.parse(a.content[0].text)}catch{}return a.content||[]}};var eE=new ge("Statistics"),Da=[];async function pt(r,e){let t={...e,event_id:Tt(),event_date:new Date().toISOString(),sdk_version:_r.version,conversation_id:r?.conversationID||"",api_key:r?.apiKey||"",user_id:r?.userID||""};if(Da.push(t),!r||(await new Promise(n=>setTimeout(n,5e3)),Da.length===0))return;let a=Da.slice();Da.length=0;try{let n=await fetch(r.hubAPI+"/analytics/stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:a})});if(!n.ok)throw new Error(`Analytics submission failed: ${n.status} ${n.statusText}`)}catch(n){eE.warn("Failed to submit analytics event:",n),Da.push(...a);return}}var yn=new ge("KnowledgeBase"),Wl=1,ho=class r{constructor(e){this._sources=[{id:"core.internal",query:async()=>rd}];this._windowSources=[];this.lastResults=[];this.manualEntries=[];this.ai=e}registerSource(e,t){let a=e;return typeof e=="function"&&(t=e,a=`source.${Wl++}`),this._sources.push({id:a,query:t}),a}removeSource(e){this._sources=this.sources.filter(t=>t.id!==e&&t.query!==e)}addEntry(e){this.manualEntries.push(e)}removeEntry(e){this.manualEntries=this.manualEntries.filter(t=>t.id!==e)}get sources(){let e=this._sources;return Ne().knowledgeBaseSources&&(e=e.concat(Ne().knowledgeBaseSources)),e=e.concat(this._windowSources),e=e.filter(t=>!t.disabled),e}async search(e){let t=Date.now();yn.debug(`Searching knowledge base for: ${e}`);let a=new Event("webweaver_kb_search",{bubbles:!0,cancelable:!0});a.query=e,a.entries=[],a.sources=[],typeof document<"u"&&document.dispatchEvent(a),this._windowSources=a.sources;let i=(await Promise.all(this.sources.map(async c=>{try{let u=Date.now(),p=await c.query(e);return yn.debug(`Source '${c.id}' took ${Date.now()-u}ms`),p||[]}catch(u){return yn.warn(`Knowledge source '${c.id}' failed:`,u),[]}}))).flat();i=i.concat(a.entries),i=i.concat(this.manualEntries),Ne().knowledgeBase&&(i=i.concat(Ne().knowledgeBase)),i=i.filter(c=>c&&!c.disabled);for(let c=0;c<i.length;c++){let u=i[c];u.id=u.id||`temp.${c}`,u._functionID=u.id.replaceAll(/[^a-zA-Z0-9_]/g,"_"),!u.action&&u.type=="tour"&&(u.action=p=>{throw new Error("This tour does not have an action. You must perform the tour content manually.")}),!u.action&&u.type=="info"&&(u.action=p=>{throw new Error("This item does not have an action. Use the content to provide information to the user instead.")})}let o=new td({fields:["id","type","name","content","tags"],storeFields:[],searchOptions:{boost:{name:3,tags:2},fuzzy:.2}});o.addAll(i);let l=o.search(e).map(c=>i.find(u=>u.id==c.id));for(let c of i)c.isContext&&(l.find(u=>u.id===c.id)||l.push(c));return this.lastResults=l,pt(this.ai,{event_type:"kb_search",value:l.length,value_str:"",event_properties:{search_time_ms:Date.now()-t,sources_searched:this.sources.length}}),yn.debug("Found results:",l),l}getCachedEntry(e){return this.lastResults.find(t=>t.id==e||t._functionID==e)}registerSourceFromURL(e,t){t||(t=`external.${Wl++}`),yn.debug(`Registering remote knowledge base source: ${e}`);let a=[],n=[],i=!0,o=async(l,c)=>{yn.debug(`Calling remote knowledge base action: ${l.id}`);let u={type:"action",userID:this.ai.userID,extra:this.ai.extra,actionID:l.id,parameters:c},p=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!p.ok)throw new Error(`HTTP Error ${p.status} ${p.statusText}`);let m=await p.json();return s(m.updateItems||[]),m.response},s=l=>{for(let c of l){if(!c.id){yn.warn("KB item skipped since it has no ID.",c);continue}let u=a.find(p=>p.id==c.id);if(u){u.name=c.name||u.name||"",u.content=c.content||u.content||"",u.disabled=c.disabled??u.disabled,u.isContext=c.isContext??u.isContext,u.parameters=c.parameters||u.parameters||[],u.tags=c.tags||u.tags,u.type=c.type||u.type;continue}a.push({...c,action:p=>o(c,p)})}};this.registerSource(t,async l=>{if(i&&n.includes(l))return a;let c={type:"search",userID:this.ai?.userID||"",extra:this.ai?.extra||{},query:l},u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error(`HTTP Error ${u.status} ${u.statusText}`);let p=await u.json();return i=!p.noCache,n.includes(l)||n.push(l),s(p.items),a})}clone(){let e=new r(this.ai);return e._sources=this._sources,e._windowSources=this._windowSources,e.manualEntries=this.manualEntries,e}registerMCPSource(e){e.id||(e.id=`external.${Wl++}`);let t=new mo(e);return this.registerSource(e.id,a=>t.search(a)),t}};var go=class{constructor(e){this.ai=e}async boolean(e){let t=await this.instruct({...e,instruction:`${e.instruction}
|
|
3259
3259
|
|
|
3260
3260
|
Return only the text "true" or "false" to indicate the answer to the question. Do not include any additional text or explanations.`});if(t.toLowerCase().includes("true"))return!0;if(t.toLowerCase().includes("false"))return!1;throw new Error("The AI did not give a boolean answer: "+t)}async choose(e){let t=await this.instruct({...e,instruction:`${e.instruction}
|
|
3261
3261
|
|
|
@@ -3272,8 +3272,8 @@ Objects should have the following keys:
|
|
|
3272
3272
|
${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No description provided."}`).join(`
|
|
3273
3273
|
`)}
|
|
3274
3274
|
`,a=await this.instruct({...e,instruction:t});if(a=a.replace(/```jsonl/g,"").replace(/```json/g,"").replace(/```/g,""),e.allowMultiple){let n=a.split(`
|
|
3275
|
-
`).map(o=>o.trim()).filter(o=>!!o.trim()),i=[];for(let o of n)try{i.push(JSON.parse(o))}catch(s){console.error("Failed to parse line as JSON:",o,s.message)}return i}else return[JSON.parse(a.trim())]}async generateMarkdown(e){return this.instruct({...e,instruction:"Generate a Markdown document based on the input text. Always include a header on every response. Give long detailed answers with many paragraphs, and explain concepts step by step."})}async instruct(e){let t=this.ai.clone();return t.resetConversation(),t.getContextPrefix=async()=>e.instruction,e.callback&&t.addEventListener("output",a=>{e.callback(a.detail.message)}),e.allowKB||(t.knowledgeBase._sources=[]),await t.sendMessage(typeof e.data=="string"?e.data:JSON.stringify(e.data))||""}};var
|
|
3276
|
-
`});else if(i.type=="action"){let o={name:i._functionID,description:ks(typeof i.content=="function"?i.content():i.content),params:pu(i.parameters||[{name:"value",type:"string",description:"Input"}]),removeFromMessageHistory:!!i.removeFromMessageHistory,callback:s=>this.toolRunKBAction(i,s),kb:i};this.currentModel.toolGroup.add({id:i._functionID,customData:o,cannotRemove:i.isContext,sortOrder:101,disabled:i.disabled,content:JSON.stringify(o)})}else continue;let n=this.currentModel.contextGroup.getAllAsString();this._lastSystemMsg!=n&&(this._lastSystemMsg=n,this.submitAnalyticsEvent({type:"system-msg",txt:n}))}processIncomingMessage(t,a){a||this.submitAnalyticsEvent({type:"message",role:"assistant",message:t});let n="";this._lastOutput===void 0?(n=t,this._lastOutput=t):t.startsWith(this._lastOutput)?(n=t.substring(this._lastOutput.length),this._lastOutput=t):(Xt.warn("Message was changed during chunking. This should not happen.",t,this._lastOutput),n=t,this._lastOutput=t),a||(this._lastOutput=void 0),this.dispatchEvent(new CustomEvent("output",{detail:{ai:this,isChunk:a,message:t,messageChunk:n}})),this.onAIMessage?.(t,!!a)}async sendMessage(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(this.isProcessing)return Xt.warn("Cannot send message while another message is being processed."),null;this.isProcessing=!0;try{return this.submitAnalyticsEvent({type:"message",role:"user",message:t}),this.dispatchEvent(new CustomEvent("input",{detail:{ai:this,message:t}})),await this.currentModel.sendMessage(t)}finally{this.isProcessing=!1}}async toolRunKBAction(t,a){try{this.dispatchEvent(new CustomEvent("toolstart",{detail:{knowledgeBaseEntry:t,input:a,ai:this}}));let n=await t.action(a,this);return this.submitAnalyticsEvent({type:"action",action:t.id,value:a,result:n}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:t,input:a,ai:this,result:n}})),n}catch(n){throw this.submitAnalyticsEvent({type:"action",action:t.id,value:a,error:n.message}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:t,input:a,ai:this,error:n}})),n}}submitAnalyticsEvent(t){Ne().analytics===!1||this.config?.analytics===!1||fetch(this.hubAPI+"/analytics/post",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,apiKey:this.apiKey,time:Date.now(),conversationID:this.conversationID,personaID:this.config?.id})}).catch(a=>{Xt.debug("Failed to submit analytics event:",a)})}resetConversation(){this.currentModel&&(this.currentModel.resetConversation(),this._lastKBsearch="",this._nextRequestUseKBitems=void 0,this.conversationID=Wt(),this._lastSystemMsg="")}insertAssistantMessage(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");let a={role:"assistant",content:t};this.currentModel.messageGroup.add({id:Wt(),content:JSON.stringify(a),customData:a})}exportState(){return{type:"intelliweave/state/v1",conversationID:this.conversationID,messages:this.currentModel?.messageGroup.getAll().map(t=>t.customData)}}importState(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(t?.type!="intelliweave/state/v1")throw new Error(`Invalid state type: ${t.type}`);this.conversationID=t.conversationID;for(let a of t.messages)this.currentModel.messageGroup.add({id:Wt(),content:JSON.stringify(a),customData:a})}clone(){let t=new ho;return t.apiKey=this.apiKey,t.config=this.config,t.models=this.models,this.config?.id&&t.setModel(this.config.id),t.audio=this.audio,t.vadModel=this.vadModel,t.userID=this.userID,t.extra=this.extra,t.knowledgeBase=this.knowledgeBase.clone(),t}};ho.version=hn.version;var ea=ho;var Tt=class extends HTMLElement{constructor(){super(...arguments);this._state={}}get root(){return this._shadow}static register(){this._isRegistered||(this._isRegistered=!0,this.tagName||(this.tagName="anonymous-component-"+this.name.toLowerCase().replace(/[^a-z0-9-]/g,"-")+"--"+Math.random().toString(36).substring(2)),window.customElements.define(this.tagName,this))}static create(t={},a=""){this.register();let n=document.createElement(this.tagName);for(let i in t)n.setAttribute(i,t[i]);return n.onBeforeCreate(),n.innerHTML=a,n}static add(t={},a=""){return this.register(),`<${this.tagName} ${Object.keys(t).map(n=>`${n}="${(t[n]+"").replaceAll('"',""")}"`).join(" ")}>${a}</${this.tagName}>`}static createElement(){return this.register(),document.createElement(this.tagName)}connectedCallback(){this._shadow||(this._shadow=this.attachShadow({mode:"closed"}),this._shadow.innerHTML=this.html(),this.onCreate()),this.onUpdate()}disconnectedCallback(){this._shadow=void 0,this.onDestroy()}html(){return""}onBeforeCreate(){}onCreate(){}onUpdate(){}onDestroy(){}attributeChangedCallback(t,a,n){this._shadow&&this.onUpdate()}get attr(){if(this._attrProxy)return this._attrProxy;let t=a=>(go=go||document.createElement("div"),go.innerText=a||"",go.innerHTML);return this._attrProxy=new Proxy({},{get:(a,n)=>t(this.getAttribute(n.toString())||""),set:(a,n,i)=>(this.getAttribute(n.toString())===i||(i?this.setAttribute(n.toString(),i):this.removeAttribute(n.toString()),this._shadow&&this.onUpdate()),!0)}),this._attrProxy}get state(){return this._stateProxy?this._stateProxy:(this._stateProxy=new Proxy({},{get:(t,a)=>this._state[a],set:(t,a,n)=>(this._state[a]=n,this._shadow&&this.onUpdate(),!0)}),this._stateProxy)}hasChild(t){return!!this.root?.getElementById(t)}child(t){let a=this.root?.getElementById(t);if(!a)throw new Error(`Child with ID ${t} not found`);return a}};Tt.observedAttributes=[],Tt.tagName="",Tt._isRegistered=!1;var go;var Bm='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" width="200" height="200" style="shape-rendering: auto; display: block; " xmlns:xlink="http://www.w3.org/1999/xlink"><g><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="0.5s" calcMode="spline" keyTimes="0;1" values="10;0" keySplines="0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="fill" repeatCount="indefinite" dur="2s" calcMode="discrete" keyTimes="0;0.25;0.5;0.75;1" values="%23797979;%23797979;%23797979;%23797979;%23797979" begin="0s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A</circle><circle cx="50" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A</circle><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A</circle><g></g></g><!-- [ldio] generated by https://loading.io --></svg>';var Gm='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 475.085 475.085" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M237.541 328.897c25.128 0 46.632-8.946 64.523-26.83 17.888-17.884 26.833-39.399 26.833-64.525V91.365c0-25.126-8.938-46.632-26.833-64.525C284.173 8.951 262.669 0 237.541 0c-25.125 0-46.632 8.951-64.524 26.84-17.893 17.89-26.838 39.399-26.838 64.525v146.177c0 25.125 8.949 46.641 26.838 64.525 17.889 17.884 39.399 26.83 64.524 26.83z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path><path d="M396.563 188.15c-3.606-3.617-7.898-5.426-12.847-5.426-4.944 0-9.226 1.809-12.847 5.426-3.613 3.616-5.421 7.898-5.421 12.845v36.547c0 35.214-12.518 65.333-37.548 90.362-25.022 25.03-55.145 37.545-90.36 37.545-35.214 0-65.334-12.515-90.365-37.545-25.028-25.022-37.541-55.147-37.541-90.362v-36.547c0-4.947-1.809-9.229-5.424-12.845-3.617-3.617-7.895-5.426-12.847-5.426s-9.235 1.809-12.85 5.426c-3.618 3.616-5.426 7.898-5.426 12.845v36.547c0 42.065 14.04 78.659 42.112 109.776 28.073 31.118 62.762 48.961 104.068 53.526v37.691h-73.089c-4.949 0-9.231 1.811-12.847 5.428-3.617 3.614-5.426 7.898-5.426 12.847 0 4.941 1.809 9.233 5.426 12.847 3.616 3.614 7.898 5.428 12.847 5.428h182.719c4.948 0 9.236-1.813 12.847-5.428 3.621-3.613 5.431-7.905 5.431-12.847 0-4.948-1.81-9.232-5.431-12.847-3.61-3.617-7.898-5.428-12.847-5.428h-73.08v-37.691c41.299-4.565 75.985-22.408 104.061-53.526 28.076-31.117 42.12-67.711 42.12-109.776v-36.547c0-4.946-1.813-9.225-5.435-12.845z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var zm='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 448.075 448.075" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M352.021 16.075c0-6.08-3.52-11.84-8.96-14.4-5.76-2.88-12.16-1.92-16.96 1.92l-141.76 112.96 167.68 167.68zM443.349 420.747l-416-416c-6.24-6.24-16.384-6.24-22.624 0s-6.24 16.384 0 22.624l100.672 100.704h-9.376c-9.92 0-18.56 4.48-24.32 11.52-4.8 5.44-7.68 12.8-7.68 20.48v128c0 17.6 14.4 32 32 32h74.24l155.84 124.48c2.88 2.24 6.4 3.52 9.92 3.52 2.24 0 4.8-.64 7.04-1.6 5.44-2.56 8.96-8.32 8.96-14.4v-57.376l68.672 68.672c3.136 3.136 7.232 4.704 11.328 4.704s8.192-1.568 11.328-4.672c6.24-6.272 6.24-16.384 0-22.656z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var Pa=class extends Tt{constructor(){super(...arguments);this.html=()=>`
|
|
3275
|
+
`).map(o=>o.trim()).filter(o=>!!o.trim()),i=[];for(let o of n)try{i.push(JSON.parse(o))}catch(s){console.error("Failed to parse line as JSON:",o,s.message)}return i}else return[JSON.parse(a.trim())]}async generateMarkdown(e){return this.instruct({...e,instruction:"Generate a Markdown document based on the input text. Always include a header on every response. Give long detailed answers with many paragraphs, and explain concepts step by step."})}async instruct(e){let t=this.ai.clone();return t.resetConversation(),t.getContextPrefix=async()=>e.instruction,e.callback&&t.addEventListener("output",a=>{e.callback(a.detail.message)}),e.allowKB||(t.knowledgeBase._sources=[]),await t.sendMessage(typeof e.data=="string"?e.data:JSON.stringify(e.data))||""}};var Yt=new ge("Main"),zm=new Set,fo=class fo extends EventTarget{constructor(){super(...arguments);this.conversationID=Tt();this.knowledgeBase=new ho(this);this._lastKBsearch="";this.models=[];this.audio=null;this.apiKey="";this.logic=new go(this);this.userID=mu();this.extra=Ne().extra||{};this.hubAPI="https://intelliweave.ai/api";this._lastSystemMsg="";this.isProcessing=!1;this._lastTrackedTokens=0}get loaded(){return!!(this.config&&this.currentModel)}async load(t){if(this.apiKey=t,!t)throw new Error("API key is required to load the AI.");try{await Promise.all([(async()=>{Yt.debug("Loading configuration...");let a=await fetch(this.hubAPI+"/config/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t})});if(!a.ok)throw new Error(`Failed to load configuration: ${a.status} ${a.statusText}`);try{this.config=await a.json(),Yt.debug("Config loaded successfully:",this.config),this.config&&Yt.debug("UI Properties - logo:",this.config.logo,"background:",this.config.background,"textColor:",this.config.textColor)}catch(n){Yt.error("Failed to parse JSON response:",n);try{let i=await a.clone().text();Yt.error("Raw response that failed parsing:",i)}catch{Yt.error("Could not get raw response text either")}throw new Error(`Failed to parse configuration: ${n}`)}})(),(async()=>{try{let a=await fetch("https://cdn.intelliweave.ai/models/silero_vad_3.onnx");if(!a.ok)throw new Error(`Failed to load VAD model: ${a.status} ${a.statusText}`);this.vadModel=await a.blob()}catch(a){Yt.warn(`Failed to load VAD model, some features will be unavailable. ${a.message}`)}})()]),this.models=[{id:this.config.id,config:this.config.model}],this.setModel(this.config.id);for(let a of this.config.knowledge||[])a.url&&a.backendType=="mcp"?this.knowledgeBase.registerMCPSource({id:a.id,searchToolName:a.mcpSearchToolName,baseURL:a.url}):a.url&&this.knowledgeBase.registerSourceFromURL(a.url);for(let a of this.config.knowledge||[])a.entries?.length&&this.knowledgeBase.registerSource(a.id,()=>a.entries||[]);if(this.config.mcpServers)for(let a of this.config.mcpServers)this.knowledgeBase.registerMCPSource(a);return this.resetConversation(),this.dispatchEvent(new CustomEvent("load",{detail:{ai:this}})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("webweaver_loaded",{detail:{ai:this}})),this.config}catch(a){throw Yt.warn("Failed to load:",a),this.error=a,this.dispatchEvent(new CustomEvent("error",{detail:{ai:this,error:a}})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("webweaver_error",{detail:{ai:this,error:a}})),a}}setModel(t){let a=this.models.find(n=>n.id==t);if(!a)throw new Error(`Model with ID "${t}" not found.`);this.currentModel=new bi({...a.config,systemMessage:"",onBeforeMessageProcessing:this.onBeforeMessageProcessing.bind(this),onAIMessage:this.processIncomingMessage.bind(this),onAIToolStart:(n,i)=>{let o=this.knowledgeBase.getCachedEntry(n);this.onAIToolStart?.(o?.id||n,i)}}),this.currentModel.id=a.id,this.currentModel.metadata=a}async getContextPrefix(){let t=Ne().pageSummary||`You are ${this.config?.name||"IntelliWeave"}. ${this.config?.instructions||"Speak in short sentences."}`;return typeof t=="function"&&(t=await t()),t}async onBeforeMessageProcessing(){this._lastKBsearch||(this._lastKBsearch="__intelliweaveblanksearchforcontextitems__");let t=await this.getContextPrefix();this.currentModel.contextGroup.add({id:"_iw_main",sortOrder:1,cannotRemove:!0,content:t}),this.currentModel.contextGroup.add({id:"_iw_kb_description",sortOrder:100,cannotRemove:!0,content:'You have access to a database of knowledge base items. These include "info" type items which provide information and "tour" type items which contain instructions you should follow (only do one item at a time). Current info and tour items:'});let a=this._nextRequestUseKBitems||await this.knowledgeBase.search(this._lastKBsearch);this._nextRequestUseKBitems=void 0;for(let i of a)if(i.type=="info"||i.type=="tour"||i.type=="input-event")this.currentModel.contextGroup.add({id:i.id,customData:i,cannotRemove:i.isContext,sortOrder:101,disabled:i.disabled,content:JSON.stringify({id:i.id,type:i.type,name:i.name,content:xs(typeof i.content=="function"?i.content():i.content)})+`
|
|
3276
|
+
`});else if(i.type=="action"){let o={name:i._functionID,description:xs(typeof i.content=="function"?i.content():i.content),params:hu(i.parameters||[{name:"value",type:"string",description:"Input"}]),removeFromMessageHistory:!!i.removeFromMessageHistory,callback:s=>this.toolRunKBAction(i,s),kb:i};this.currentModel.toolGroup.add({id:i._functionID,customData:o,cannotRemove:i.isContext,sortOrder:101,disabled:i.disabled,content:JSON.stringify(o)})}else continue;let n=this.currentModel.contextGroup.getAllAsString();this._lastSystemMsg!=n&&(this._lastSystemMsg=n,this.submitAnalyticsEvent({type:"system-msg",txt:n}))}processIncomingMessage(t,a){if(!a){let i=this.currentModel?.stats?.tokensUsed||0,o=i-(this._lastTrackedTokens||0);this._lastTrackedTokens=i,pt(this,{event_type:"message_receive",value:o,value_str:"",event_properties:{response_time_ms:Date.now()-(this._messageStartTime||Date.now()),is_streaming:!1,is_chunk:!1,total_tokens:i}})}let n="";this._lastOutput===void 0?(n=t,this._lastOutput=t):t.startsWith(this._lastOutput)?(n=t.substring(this._lastOutput.length),this._lastOutput=t):(Yt.warn("Message was changed during chunking. This should not happen.",t,this._lastOutput),n=t,this._lastOutput=t),a||(this._lastOutput=void 0),this.dispatchEvent(new CustomEvent("output",{detail:{ai:this,isChunk:a,message:t,messageChunk:n}})),this.onAIMessage?.(t,!!a)}async sendMessage(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(this.isProcessing)return Yt.warn("Cannot send message while another message is being processed."),null;this.isProcessing=!0;try{return this._messageStartTime=Date.now(),zm.has(this.conversationID)||(zm.add(this.conversationID),pt(this,{event_type:"session_start"})),this._lastTrackedTokens=this.currentModel?.stats?.tokensUsed||0,pt(this,{event_type:"message_send",value_str:"",event_properties:{message_length:t.length,is_voice_input:!!this.audio?.speechRecognition?.isRunning}}),this.dispatchEvent(new CustomEvent("input",{detail:{ai:this,message:t}})),await this.currentModel.sendMessage(t)}finally{this.isProcessing=!1}}async toolRunKBAction(t,a){let n=Date.now();try{this.dispatchEvent(new CustomEvent("toolstart",{detail:{knowledgeBaseEntry:t,input:a,ai:this}}));let i=await t.action(a,this),o=Date.now()-n;return pt(this,{event_type:"tool_call",value_str:t.id||"",event_properties:{tool_args:a,execution_time_ms:o,success:!0}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:t,input:a,ai:this,result:i}})),i}catch(i){let o=Date.now()-n;throw pt(this,{event_type:"tool_call",value_str:t.id||"",event_properties:{tool_args:a,execution_time_ms:o,success:!1,error_message:i.message}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:t,input:a,ai:this,error:i}})),i}}submitAnalyticsEvent(t){Ne().analytics===!1||this.config?.analytics===!1||fetch(this.hubAPI+"/analytics/post",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,apiKey:this.apiKey,time:Date.now(),conversationID:this.conversationID,personaID:this.config?.id})}).catch(a=>{Yt.debug("Failed to submit analytics event:",a)})}resetConversation(){this.currentModel&&(this.currentModel.resetConversation(),this._lastKBsearch="",this._nextRequestUseKBitems=void 0,this.conversationID=Tt(),this._lastSystemMsg="")}insertAssistantMessage(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");let a={role:"assistant",content:t};this.currentModel.messageGroup.add({id:Tt(),content:JSON.stringify(a),customData:a})}exportState(){return{type:"intelliweave/state/v1",conversationID:this.conversationID,messages:this.currentModel?.messageGroup.getAll().map(t=>t.customData)}}importState(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(t?.type!="intelliweave/state/v1")throw new Error(`Invalid state type: ${t.type}`);this.conversationID=t.conversationID;for(let a of t.messages)this.currentModel.messageGroup.add({id:Tt(),content:JSON.stringify(a),customData:a})}clone(){let t=new fo;return t.apiKey=this.apiKey,t.config=this.config,t.models=this.models,this.config?.id&&t.setModel(this.config.id),t.audio=this.audio,t.vadModel=this.vadModel,t.userID=this.userID,t.extra=this.extra,t.knowledgeBase=this.knowledgeBase.clone(),t}};fo.version=_r.version;var ra=fo;var At=class extends HTMLElement{constructor(){super(...arguments);this._state={}}get root(){return this._shadow}static register(){this._isRegistered||(this._isRegistered=!0,this.tagName||(this.tagName="anonymous-component-"+this.name.toLowerCase().replace(/[^a-z0-9-]/g,"-")+"--"+Math.random().toString(36).substring(2)),window.customElements.define(this.tagName,this))}static create(t={},a=""){this.register();let n=document.createElement(this.tagName);for(let i in t)n.setAttribute(i,t[i]);return n.onBeforeCreate(),n.innerHTML=a,n}static add(t={},a=""){return this.register(),`<${this.tagName} ${Object.keys(t).map(n=>`${n}="${(t[n]+"").replaceAll('"',""")}"`).join(" ")}>${a}</${this.tagName}>`}static createElement(){return this.register(),document.createElement(this.tagName)}connectedCallback(){this._shadow||(this._shadow=this.attachShadow({mode:"closed"}),this._shadow.innerHTML=this.html(),this.onCreate()),this.onUpdate()}disconnectedCallback(){this._shadow=void 0,this.onDestroy()}html(){return""}onBeforeCreate(){}onCreate(){}onUpdate(){}onDestroy(){}attributeChangedCallback(t,a,n){this._shadow&&this.onUpdate()}get attr(){if(this._attrProxy)return this._attrProxy;let t=a=>(yo=yo||document.createElement("div"),yo.innerText=a||"",yo.innerHTML);return this._attrProxy=new Proxy({},{get:(a,n)=>t(this.getAttribute(n.toString())||""),set:(a,n,i)=>(this.getAttribute(n.toString())===i||(i?this.setAttribute(n.toString(),i):this.removeAttribute(n.toString()),this._shadow&&this.onUpdate()),!0)}),this._attrProxy}get state(){return this._stateProxy?this._stateProxy:(this._stateProxy=new Proxy({},{get:(t,a)=>this._state[a],set:(t,a,n)=>(this._state[a]=n,this._shadow&&this.onUpdate(),!0)}),this._stateProxy)}hasChild(t){return!!this.root?.getElementById(t)}child(t){let a=this.root?.getElementById(t);if(!a)throw new Error(`Child with ID ${t} not found`);return a}};At.observedAttributes=[],At.tagName="",At._isRegistered=!1;var yo;var Um='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" width="200" height="200" style="shape-rendering: auto; display: block; " xmlns:xlink="http://www.w3.org/1999/xlink"><g><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="0.5s" calcMode="spline" keyTimes="0;1" values="10;0" keySplines="0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="fill" repeatCount="indefinite" dur="2s" calcMode="discrete" keyTimes="0;0.25;0.5;0.75;1" values="%23797979;%23797979;%23797979;%23797979;%23797979" begin="0s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A</circle><circle cx="50" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A</circle><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A</circle><g></g></g><!-- [ldio] generated by https://loading.io --></svg>';var Hm='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 475.085 475.085" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M237.541 328.897c25.128 0 46.632-8.946 64.523-26.83 17.888-17.884 26.833-39.399 26.833-64.525V91.365c0-25.126-8.938-46.632-26.833-64.525C284.173 8.951 262.669 0 237.541 0c-25.125 0-46.632 8.951-64.524 26.84-17.893 17.89-26.838 39.399-26.838 64.525v146.177c0 25.125 8.949 46.641 26.838 64.525 17.889 17.884 39.399 26.83 64.524 26.83z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path><path d="M396.563 188.15c-3.606-3.617-7.898-5.426-12.847-5.426-4.944 0-9.226 1.809-12.847 5.426-3.613 3.616-5.421 7.898-5.421 12.845v36.547c0 35.214-12.518 65.333-37.548 90.362-25.022 25.03-55.145 37.545-90.36 37.545-35.214 0-65.334-12.515-90.365-37.545-25.028-25.022-37.541-55.147-37.541-90.362v-36.547c0-4.947-1.809-9.229-5.424-12.845-3.617-3.617-7.895-5.426-12.847-5.426s-9.235 1.809-12.85 5.426c-3.618 3.616-5.426 7.898-5.426 12.845v36.547c0 42.065 14.04 78.659 42.112 109.776 28.073 31.118 62.762 48.961 104.068 53.526v37.691h-73.089c-4.949 0-9.231 1.811-12.847 5.428-3.617 3.614-5.426 7.898-5.426 12.847 0 4.941 1.809 9.233 5.426 12.847 3.616 3.614 7.898 5.428 12.847 5.428h182.719c4.948 0 9.236-1.813 12.847-5.428 3.621-3.613 5.431-7.905 5.431-12.847 0-4.948-1.81-9.232-5.431-12.847-3.61-3.617-7.898-5.428-12.847-5.428h-73.08v-37.691c41.299-4.565 75.985-22.408 104.061-53.526 28.076-31.117 42.12-67.711 42.12-109.776v-36.547c0-4.946-1.813-9.225-5.435-12.845z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var Vm='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 448.075 448.075" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M352.021 16.075c0-6.08-3.52-11.84-8.96-14.4-5.76-2.88-12.16-1.92-16.96 1.92l-141.76 112.96 167.68 167.68zM443.349 420.747l-416-416c-6.24-6.24-16.384-6.24-22.624 0s-6.24 16.384 0 22.624l100.672 100.704h-9.376c-9.92 0-18.56 4.48-24.32 11.52-4.8 5.44-7.68 12.8-7.68 20.48v128c0 17.6 14.4 32 32 32h74.24l155.84 124.48c2.88 2.24 6.4 3.52 9.92 3.52 2.24 0 4.8-.64 7.04-1.6 5.44-2.56 8.96-8.32 8.96-14.4v-57.376l68.672 68.672c3.136 3.136 7.232 4.704 11.328 4.704s8.192-1.568 11.328-4.672c6.24-6.272 6.24-16.384 0-22.656z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var Na=class extends At{constructor(){super(...arguments);this.html=()=>`
|
|
3277
3277
|
|
|
3278
3278
|
<!-- Styling -->
|
|
3279
3279
|
<style>
|
|
@@ -3313,7 +3313,7 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3313
3313
|
}
|
|
3314
3314
|
|
|
3315
3315
|
:host #loader {
|
|
3316
|
-
background-image: url('${
|
|
3316
|
+
background-image: url('${Um}');
|
|
3317
3317
|
background-size: 64px 64px;
|
|
3318
3318
|
background-position: center;
|
|
3319
3319
|
background-repeat: no-repeat;
|
|
@@ -3336,7 +3336,7 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3336
3336
|
}
|
|
3337
3337
|
|
|
3338
3338
|
:host #microphone-button {
|
|
3339
|
-
background-image: url('${
|
|
3339
|
+
background-image: url('${Hm}');
|
|
3340
3340
|
z-index: 2;
|
|
3341
3341
|
margin-right: -10px;
|
|
3342
3342
|
}
|
|
@@ -3360,7 +3360,7 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3360
3360
|
}
|
|
3361
3361
|
|
|
3362
3362
|
:host #cancel-speech-button {
|
|
3363
|
-
background-image: url('${
|
|
3363
|
+
background-image: url('${Vm}');
|
|
3364
3364
|
z-index: 2;
|
|
3365
3365
|
}
|
|
3366
3366
|
|
|
@@ -3384,7 +3384,7 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3384
3384
|
<!-- Loader bar -->
|
|
3385
3385
|
<div id='loader'></div>
|
|
3386
3386
|
|
|
3387
|
-
`;this._wasLoading=!1;this.voiceAnimationPieces=[];this._micAnimFrameCounter=0}onCreate(){this.child("input-field").addEventListener("keypress",t=>this.onInputKeyPress(t),{capture:!0}),this.child("input-field").addEventListener("keydown",t=>t.stopPropagation(),{capture:!0}),this.child("llm-button").addEventListener("click",t=>this.onLLMButtonClick(t)),this.child("microphone-button").addEventListener("click",t=>this.onMicButtonClick(t)),this.child("cancel-speech-button").addEventListener("click",t=>this.onCancelSpeechButtonClick(t))}connectAI(t){this.ai=t,this.ai.audio?.speechRecognition.addEventListener("speech",a=>this.onSpeechEvent(a)),this.ai.audio?.speechRecognition.addEventListener("start",a=>this.onUpdate()),this.ai.audio?.speechRecognition.addEventListener("end",a=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechstart",a=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechend",a=>this.onUpdate()),this.onUpdate()}onUpdate(){this.attr.textColor&&document.documentElement.style.setProperty("--intelliweave-text-color",this.attr.textColor),this.child("input-field").style.display=this.attr.loading||this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("llm-button").style.display=this.attr.loading||!this.attr.llmButtonVisible||this.state.micActiv?"none":"",this.child("llm-button").innerText=this.attr.llmName||"LLM",this.child("loader").style.display=this.attr.loading?"block":"",this.child("microphone-button").style.display=!this.ai?.audio?.speechRecognition?.isSupported||this.attr.loading&&!this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("cancel-speech-button").style.display="none",this.ai?.audio?.speechRecognition.isRunning&&this.ai?.audio?.speechOutput.isSpeaking&&(this.child("microphone-button").style.display="none",this.child("cancel-speech-button").style.display=""),!this.attr.loading&&this._wasLoading&&this.child("input-field").focus(),this._wasLoading=this.attr.loading,this.child("microphone-button-bg").classList.toggle("active",!!this.ai?.audio?.speechRecognition.isRunning);let t=this.ai?.audio?.speechRecognition.isRunning&&!this.attr.loading;t&&!this.micStateAnimationTimer?this.micStateAnimationTimer=setInterval(()=>this.onMicAnimation(),1e3/60):!t&&this.micStateAnimationTimer&&(this.voiceAnimationPieces.forEach(a=>a.remove()),this.voiceAnimationPieces=[],clearInterval(this.micStateAnimationTimer),this.micStateAnimationTimer=void 0)}onInputKeyPress(t){if(t.stopPropagation(),t.key!="Enter")return;let a=this.child("input-field"),n=a.value?.trim();a.value="",n&&this.dispatchEvent(new CustomEvent("input-message",{detail:n}))}onLLMButtonClick(t){t.preventDefault(),this.dispatchEvent(new CustomEvent("llm-button-click"))}onMicButtonClick(t){t.preventDefault(),this.ai.audio?.speechRecognition.isRunning?this.ai.audio?.speechRecognition.stop():this.ai.audio?.speechRecognition.start()}onMicAnimation(){if(!this.attr.loading){if(this._micAnimFrameCounter++,this._micAnimFrameCounter%5==0){let t="rgba(140, 170, 200, 0.5)";this.ai?.audio?.speechRecognition.voiceDetection?.isModelLoaded||(t="rgba(255, 0, 0, 0.5)"),this.ai?.audio?.speechRecognition.voiceDetection?.isTranscribing&&(t="rgba(96, 66, 245, 0.9)"),this.ai?.audio?.speechRecognition.wordsCurrentlyBeingSpoken&&(t="rgba(0, 128, 255, 0.9)"),this.ai?.audio?.speechRecognition.voiceDetection?.isVoicePossiblyEnding&&(t="rgba(0, 128, 255, 0.5)"),this.ai?.isProcessing&&(t="rgba(255, 255, 0, 0.5)"),this.ai?.audio?.speechOutput.isSpeaking&&(t="rgba(0, 255, 0, 0.5)");let a=this.ai?.audio?.speechRecognition.volumeLevel||0,n=30,i=6,o=Math.round(a*(n-i)+i),s=document.createElement("div");s.posX=50,s.style.cssText=`position: absolute; top: calc(50% - ${o}px/2); left: 0px; width: 6px; height: ${o}px; background-color: ${t}; border-radius: 3px; pointer-events: none; `,this.root?.appendChild(s),this.voiceAnimationPieces.push(s)}for(let t=0;t<this.voiceAnimationPieces.length;t++){let a=this.voiceAnimationPieces[t];a.posX+=2,a.style.transform=`translate(${a.posX}px, 0px)`,!(a.posX<400)&&(this.voiceAnimationPieces.splice(t--,1),a.remove())}}}onSpeechEvent(t){this.attr.loading||t.detail.isFinal&&this.dispatchEvent(new CustomEvent("input-message",{detail:t.detail.transcript}))}onCancelSpeechButtonClick(t){this.ai.audio?.speechOutput.interrupt(),this.onUpdate()}};
|
|
3387
|
+
`;this._wasLoading=!1;this.voiceAnimationPieces=[];this._micAnimFrameCounter=0}onCreate(){this.child("input-field").addEventListener("keypress",t=>this.onInputKeyPress(t),{capture:!0}),this.child("input-field").addEventListener("keydown",t=>t.stopPropagation(),{capture:!0}),this.child("llm-button").addEventListener("click",t=>this.onLLMButtonClick(t)),this.child("microphone-button").addEventListener("click",t=>this.onMicButtonClick(t)),this.child("cancel-speech-button").addEventListener("click",t=>this.onCancelSpeechButtonClick(t))}connectAI(t){this.ai=t,this.ai.audio?.speechRecognition.addEventListener("speech",a=>this.onSpeechEvent(a)),this.ai.audio?.speechRecognition.addEventListener("start",a=>this.onUpdate()),this.ai.audio?.speechRecognition.addEventListener("end",a=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechstart",a=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechend",a=>this.onUpdate()),this.onUpdate()}onUpdate(){this.attr.textColor&&document.documentElement.style.setProperty("--intelliweave-text-color",this.attr.textColor),this.child("input-field").style.display=this.attr.loading||this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("llm-button").style.display=this.attr.loading||!this.attr.llmButtonVisible||this.state.micActiv?"none":"",this.child("llm-button").innerText=this.attr.llmName||"LLM",this.child("loader").style.display=this.attr.loading?"block":"",this.child("microphone-button").style.display=!this.ai?.audio?.speechRecognition?.isSupported||this.attr.loading&&!this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("cancel-speech-button").style.display="none",this.ai?.audio?.speechRecognition.isRunning&&this.ai?.audio?.speechOutput.isSpeaking&&(this.child("microphone-button").style.display="none",this.child("cancel-speech-button").style.display=""),!this.attr.loading&&this._wasLoading&&this.child("input-field").focus(),this._wasLoading=this.attr.loading,this.child("microphone-button-bg").classList.toggle("active",!!this.ai?.audio?.speechRecognition.isRunning);let t=this.ai?.audio?.speechRecognition.isRunning&&!this.attr.loading;t&&!this.micStateAnimationTimer?this.micStateAnimationTimer=setInterval(()=>this.onMicAnimation(),1e3/60):!t&&this.micStateAnimationTimer&&(this.voiceAnimationPieces.forEach(a=>a.remove()),this.voiceAnimationPieces=[],clearInterval(this.micStateAnimationTimer),this.micStateAnimationTimer=void 0)}onInputKeyPress(t){if(t.stopPropagation(),t.key!="Enter")return;let a=this.child("input-field"),n=a.value?.trim();a.value="",n&&this.dispatchEvent(new CustomEvent("input-message",{detail:n}))}onLLMButtonClick(t){t.preventDefault(),this.dispatchEvent(new CustomEvent("llm-button-click"))}onMicButtonClick(t){t.preventDefault(),this.ai.audio?.speechRecognition.isRunning?this.ai.audio?.speechRecognition.stop():this.ai.audio?.speechRecognition.start()}onMicAnimation(){if(!this.attr.loading){if(this._micAnimFrameCounter++,this._micAnimFrameCounter%5==0){let t="rgba(140, 170, 200, 0.5)";this.ai?.audio?.speechRecognition.voiceDetection?.isModelLoaded||(t="rgba(255, 0, 0, 0.5)"),this.ai?.audio?.speechRecognition.voiceDetection?.isTranscribing&&(t="rgba(96, 66, 245, 0.9)"),this.ai?.audio?.speechRecognition.wordsCurrentlyBeingSpoken&&(t="rgba(0, 128, 255, 0.9)"),this.ai?.audio?.speechRecognition.voiceDetection?.isVoicePossiblyEnding&&(t="rgba(0, 128, 255, 0.5)"),this.ai?.isProcessing&&(t="rgba(255, 255, 0, 0.5)"),this.ai?.audio?.speechOutput.isSpeaking&&(t="rgba(0, 255, 0, 0.5)");let a=this.ai?.audio?.speechRecognition.volumeLevel||0,n=30,i=6,o=Math.round(a*(n-i)+i),s=document.createElement("div");s.posX=50,s.style.cssText=`position: absolute; top: calc(50% - ${o}px/2); left: 0px; width: 6px; height: ${o}px; background-color: ${t}; border-radius: 3px; pointer-events: none; `,this.root?.appendChild(s),this.voiceAnimationPieces.push(s)}for(let t=0;t<this.voiceAnimationPieces.length;t++){let a=this.voiceAnimationPieces[t];a.posX+=2,a.style.transform=`translate(${a.posX}px, 0px)`,!(a.posX<400)&&(this.voiceAnimationPieces.splice(t--,1),a.remove())}}}onSpeechEvent(t){this.attr.loading||t.detail.isFinal&&this.dispatchEvent(new CustomEvent("input-message",{detail:t.detail.transcript}))}onCancelSpeechButtonClick(t){this.ai.audio?.speechOutput.interrupt(),this.onUpdate()}};Na.observedAttributes=["loading","llmName","llmButtonVisible","textColor"];var jl='data:image/svg+xml,<svg id="eLjt8NmVnoY1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 300 300" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" project-id="defaf4a7213e40159eb368f9622a2af1" export-id="e0405e7e1d4a45c0a08fbbedb06a02a8" cached="false"><defs><radialGradient id="eLjt8NmVnoY6-fill" cx="0" cy="0" r="1" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-58.520001 292.985 -172.197 -34.394001 203.907 57.158)"><stop id="eLjt8NmVnoY6-fill-0" offset="0%" stop-color="%232b3d43"/><stop id="eLjt8NmVnoY6-fill-1" offset="33%" stop-color="%23328897"/><stop id="eLjt8NmVnoY6-fill-2" offset="58%" stop-color="%23328897"/><stop id="eLjt8NmVnoY6-fill-3" offset="100%" stop-color="%237ebf96"/></radialGradient><radialGradient id="eLjt8NmVnoY7-fill" cx="0" cy="0" r="1.112049" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(182.129 -94.016999 94.016999 182.129 43.4553 184.626)"><stop id="eLjt8NmVnoY7-fill-0" offset="0%" stop-color="%233f2d2d"/><stop id="eLjt8NmVnoY7-fill-1" offset="28%" stop-color="%23c83b35"/><stop id="eLjt8NmVnoY7-fill-2" offset="81%" stop-color="%23f69153"/><stop id="eLjt8NmVnoY7-fill-3" offset="100%" stop-color="%23ffe388"/></radialGradient><radialGradient id="eLjt8NmVnoY9-fill" cx="0" cy="0" r="593.59" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.196117 0.98058 -0.578542 -0.115709 406.499077 117.274778)"><stop id="eLjt8NmVnoY9-fill-0" offset="0%" stop-color="%23252d3a"/><stop id="eLjt8NmVnoY9-fill-1" offset="60%" stop-color="%23c50"/><stop id="eLjt8NmVnoY9-fill-2" offset="100%" stop-color="%23fddc85"/></radialGradient><radialGradient id="eLjt8NmVnoY10-fill" cx="0" cy="0" r="454.77" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="translate(87.33 340.7)"><stop id="eLjt8NmVnoY10-fill-0" offset="0%" stop-color="%23002936"/><stop id="eLjt8NmVnoY10-fill-1" offset="44%" stop-color="%23007aa1"/><stop id="eLjt8NmVnoY10-fill-2" offset="67%" stop-color="%2326ab7f"/><stop id="eLjt8NmVnoY10-fill-3" offset="100%" stop-color="%2395e0c8"/></radialGradient></defs><g transform="matrix(.339855 0 0 0.339855 65.056641 64.89012)"><path d="M337.93,111.85c17.31-4.12,30.6-2.15,38.55,5.96c12.9,13.16,10.13,41.58-7.64,77.95-34.66,70.98-116.01,153.37-181.35,183.6-4.15,1.92-8.16,3.6-12.02,5.03l.05.18C83.95,418.36,13.7,365.53,1.49,278.27C15.34,403.24,121.28,500.43,249.94,500.43c138.07,0,250-111.93,250-250c0-9.8-.58-19.46-1.68-28.96-12-82.27-75.81-133.5-160.33-109.62Z" fill="url(%23eLjt8NmVnoY9-fill)"/><path d="M249.94,0.43c-138.07,0-250,111.93-250,250c0,9.41.54,18.69,1.55,27.84C13.7,365.54,83.95,418.36,175.52,384.58l-.05-.18c-11.22,4.17-21.17,6.24-29.61,6.24-9.59,0-17.18-2.67-22.44-8.03-12.9-13.19-10.13-41.61,7.64-77.98c18.26-37.41,49.51-77.98,84.51-112.41c31.45-32.33,62.2-54.66,91.14-68.47.16-.08.34-.16.49-.23c1.74-.85,3.47-1.68,5.18-2.49c9.22-4.27,17.77-7.33,25.54-9.17c84.52-23.88,148.33,27.35,160.33,109.62C483.91,97.04,378.22,0.43,249.94,0.43Z" fill="url(%23eLjt8NmVnoY10-fill)"/><path d="M337.93,111.85c-7.77,1.84-16.32,4.9-25.54,9.17-1.71.8-3.45,1.63-5.18,2.49-.16.08-.34.16-.49.23-28.94,13.81-59.69,36.14-91.14,68.47-35,34.43-66.24,75-84.51,112.41-17.77,36.37-20.54,64.79-7.64,77.98c5.26,5.36,12.85,8.03,22.44,8.03c8.45,0,18.39-2.07,29.61-6.24c3.86-1.42,7.88-3.11,12.02-5.03c65.34-30.23,146.68-112.62,181.35-183.6c17.77-36.37,20.54-64.79,7.64-77.95-7.95-8.11-21.24-10.08-38.55-5.96h-.01Z" fill="%23252d3a"/></g></svg>%0D%0A';var Oa=class extends At{constructor(){super(...arguments);this.html=()=>`
|
|
3388
3388
|
|
|
3389
3389
|
<!-- Styling -->
|
|
3390
3390
|
<style>
|
|
@@ -3427,14 +3427,14 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3427
3427
|
</style>
|
|
3428
3428
|
|
|
3429
3429
|
<!-- Logo -->
|
|
3430
|
-
<img id='root' src='${this.attr.logo||
|
|
3430
|
+
<img id='root' src='${this.attr.logo||jl}' />
|
|
3431
3431
|
|
|
3432
|
-
`;this._lastLogoSrc=""}onCreate(){this.layoutUpdateTimer=setInterval(()=>this.onUpdate(),250)}onDestroy(){clearInterval(this.layoutUpdateTimer)}onUpdate(){let t=this.child("root");if(!t)return;let a=this.attr.logo||Vl;this._lastLogoSrc!=a&&(this._lastLogoSrc=a,t.src=a);let n=window.visualViewport?.offsetTop||0,i=window.visualViewport?.offsetLeft||0,o=this.attr.focusID?document.getElementById(this.attr.focusID):null;if(o){let s=o.getBoundingClientRect();if(!s)return;t.style.position="fixed",t.style.width="128px",t.style.height="128px",t.style.left=Math.round(s.x+s.width/2-128/2+i)+"px",t.style.top=Math.round(s.y+s.height/2-128/2+n)+"px"}else{let s=this.getBoundingClientRect();if(!s)return;t.style.width=s.width+"px",t.style.height=s.height+"px",t.style.left=Math.round(s.x+i)+"px",t.style.top=Math.round(s.y+n)+"px"}}refreshLayout(){setTimeout(()=>this.onUpdate(),100)}};Da.observedAttributes=["logo","focusID"];var Um=typeof self=="object"?self:globalThis,tE=(r,e)=>{let t=(n,i)=>(r.set(i,n),n),a=n=>{if(r.has(n))return r.get(n);let[i,o]=e[n];switch(i){case 0:case-1:return t(o,n);case 1:{let s=t([],n);for(let l of o)s.push(a(l));return s}case 2:{let s=t({},n);for(let[l,c]of o)s[a(l)]=a(c);return s}case 3:return t(new Date(o),n);case 4:{let{source:s,flags:l}=o;return t(new RegExp(s,l),n)}case 5:{let s=t(new Map,n);for(let[l,c]of o)s.set(a(l),a(c));return s}case 6:{let s=t(new Set,n);for(let l of o)s.add(a(l));return s}case 7:{let{name:s,message:l}=o;return t(new Um[s](l),n)}case 8:return t(BigInt(o),n);case"BigInt":return t(Object(BigInt(o)),n)}return t(new Um[i](o),n)};return a},Kl=r=>tE(new Map,r)(0);var ta="",{toString:rE}={},{keys:nE}=Object,Ma=r=>{let e=typeof r;if(e!=="object"||!r)return[0,e];let t=rE.call(r).slice(8,-1);switch(t){case"Array":return[1,ta];case"Object":return[2,ta];case"Date":return[3,ta];case"RegExp":return[4,ta];case"Map":return[5,ta];case"Set":return[6,ta]}return t.includes("Array")?[1,t]:t.includes("Error")?[7,t]:[2,t]},_o=([r,e])=>r===0&&(e==="function"||e==="symbol"),aE=(r,e,t,a)=>{let n=(o,s)=>{let l=a.push(o)-1;return t.set(s,l),l},i=o=>{if(t.has(o))return t.get(o);let[s,l]=Ma(o);switch(s){case 0:{let u=o;switch(l){case"bigint":s=8,u=o.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return n([-1],o)}return n([s,u],o)}case 1:{if(l)return n([l,[...o]],o);let u=[],p=n([s,u],o);for(let m of o)u.push(i(m));return p}case 2:{if(l)switch(l){case"BigInt":return n([l,o.toString()],o);case"Boolean":case"Number":case"String":return n([l,o.valueOf()],o)}if(e&&"toJSON"in o)return i(o.toJSON());let u=[],p=n([s,u],o);for(let m of nE(o))(r||!_o(Ma(o[m])))&&u.push([i(m),i(o[m])]);return p}case 3:return n([s,o.toISOString()],o);case 4:{let{source:u,flags:p}=o;return n([s,{source:u,flags:p}],o)}case 5:{let u=[],p=n([s,u],o);for(let[m,d]of o)(r||!(_o(Ma(m))||_o(Ma(d))))&&u.push([i(m),i(d)]);return p}case 6:{let u=[],p=n([s,u],o);for(let m of o)(r||!_o(Ma(m)))&&u.push(i(m));return p}}let{message:c}=o;return n([s,{name:l,message:c}],o)};return i},$l=(r,{json:e,lossy:t}={})=>{let a=[];return aE(!(e||t),!!e,new Map,a)(r),a};var ar=typeof structuredClone=="function"?(r,e)=>e&&("json"in e||"lossy"in e)?Kl($l(r,e)):structuredClone(r):(r,e)=>Kl($l(r,e));var ir=function(r,e,t,a,n){let i=or(e);if(t!=null&&(typeof t!="number"||t<0||t===Number.POSITIVE_INFINITY))throw new Error("Expected positive finite `index`");if(a!=null&&(!a.type||!a.children))throw new Error("Expected valid `parent`");if(t==null!=(a==null))throw new Error("Expected both `index` and `parent`");return Hm(r)?i.call(n,r,t,a):!1},or=function(r){if(r==null)return sE;if(typeof r=="string")return oE(r);if(typeof r=="object")return iE(r);if(typeof r=="function")return Xl(r);throw new Error("Expected function, string, or array as `test`")};function iE(r){let e=[],t=-1;for(;++t<r.length;)e[t]=or(r[t]);return Xl(a);function a(...n){let i=-1;for(;++i<e.length;)if(e[i].apply(this,n))return!0;return!1}}function oE(r){return Xl(e);function e(t){return t.tagName===r}}function Xl(r){return e;function e(t,a,n){return!!(Hm(t)&&r.call(this,t,typeof a=="number"?a:void 0,n||void 0))}}function sE(r){return!!(r&&typeof r=="object"&&"type"in r&&r.type==="element"&&"tagName"in r&&typeof r.tagName=="string")}function Hm(r){return r!==null&&typeof r=="object"&&"type"in r&&"tagName"in r}var lE=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,cE=/^[a-zA-Z]:\\/;function Yl(r){if(typeof r!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof r}\``);return cE.test(r)?!1:lE.test(r)}function Vm(r){let e=String(r||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function Wm(r){return r.join(" ").trim()}var ra=function(r){if(r==null)return mE;if(typeof r=="function")return So(r);if(typeof r=="object")return Array.isArray(r)?uE(r):dE(r);if(typeof r=="string")return pE(r);throw new Error("Expected function, string, or object as test")};function uE(r){let e=[],t=-1;for(;++t<r.length;)e[t]=ra(r[t]);return So(a);function a(...n){let i=-1;for(;++i<e.length;)if(e[i].apply(this,n))return!0;return!1}}function dE(r){let e=r;return So(t);function t(a){let n=a,i;for(i in r)if(n[i]!==e[i])return!1;return!0}}function pE(r){return So(e);function e(t){return t&&t.type===r}}function So(r){return e;function e(t,a,n){return!!(hE(t)&&r.call(this,t,typeof a=="number"?a:void 0,n||void 0))}}function mE(){return!0}function hE(r){return r!==null&&typeof r=="object"&&"type"in r}var jm=[],Zl=!0,Eo=!1,Fa="skip";function Ba(r,e,t,a){let n;typeof e=="function"&&typeof t!="function"?(a=t,t=e):n=e;let i=ra(n),o=a?-1:1;s(r,void 0,[])();function s(l,c,u){let p=l&&typeof l=="object"?l:{};if(typeof p.type=="string"){let d=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(d?"<"+d+">":""))+")"})}return m;function m(){let d=jm,g,f,y;if((!e||i(l,c,u[u.length-1]||void 0))&&(d=gE(t(l,u)),d[0]===Eo))return d;if("children"in l&&l.children){let v=l;if(v.children&&d[0]!==Fa)for(f=(a?v.children.length:-1)+o,y=u.concat(v);f>-1&&f<v.children.length;){let T=v.children[f];if(g=s(T,f,y)(),g[0]===Eo)return g;f=typeof g[1]=="number"?g[1]:f+o}}return d}}}function gE(r){return Array.isArray(r)?r:typeof r=="number"?[Zl,r]:r==null?jm:[r]}function Ga(r,e,t,a){let n,i,o;typeof e=="function"&&typeof t!="function"?(i=void 0,o=e,n=t):(i=e,o=t,n=a),Ba(r,i,s,n);function s(l,c){let u=c[c.length-1],p=u?u.children.indexOf(l):void 0;return o(l,p,u)}}var fE=["http","https"],yE=["nofollow"],bE={};function wo(r){let e=r||bE,t=e.protocols||fE,a=or(e.test);return function(n){Ga(n,"element",function(i,o,s){if(i.tagName==="a"&&typeof i.properties.href=="string"&&a(i,o,s)){let l=i.properties.href;if(Yl(l)?t.includes(l.slice(0,l.indexOf(":"))):l.startsWith("//")){let c=za(e.content,i),u=c&&!Array.isArray(c)?[c]:c,p=za(e.rel,i)||yE,m=typeof p=="string"?Vm(p):p,d=za(e.target,i),g=za(e.properties,i);if(g&&Object.assign(i.properties,ar(g)),m.length>0&&(i.properties.rel=[...m]),d&&(i.properties.target=d),u){let f=za(e.contentProperties,i)||{};i.children.push({type:"element",tagName:"span",properties:ar(f),children:ar(u)})}}}})}}function za(r,e){return typeof r=="function"?r(e):r}var fn=or(function(r){return r.tagName==="audio"||r.tagName==="canvas"||r.tagName==="embed"||r.tagName==="iframe"||r.tagName==="img"||r.tagName==="math"||r.tagName==="object"||r.tagName==="picture"||r.tagName==="svg"||r.tagName==="video"});var vE={}.hasOwnProperty;function Jl(r,e){let t=r.type==="element"&&vE.call(r.properties,e)&&r.properties[e];return t!=null&&t!==!1}var _E=new Set(["pingback","prefetch","stylesheet"]);function Ql(r){if(r.type!=="element"||r.tagName!=="link")return!1;if(r.properties.itemProp)return!0;let e=r.properties.rel,t=-1;if(!Array.isArray(e)||e.length===0)return!1;for(;++t<e.length;)if(!_E.has(String(e[t])))return!1;return!0}var SE=or(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),EE=or("meta");function ec(r){return!!(r.type==="text"||SE(r)||fn(r)||Ql(r)||EE(r)&&Jl(r,"itemProp"))}var wE=/[ \t\n\f\r]/g;function xt(r){return typeof r=="object"?r.type==="text"?qm(r.value):!1:qm(r)}function qm(r){return r.replace(wE,"")===""}var tc=["pre","script","style","textarea"];var Km=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"];var $m=["button","input","select","textarea"];var Xm=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"];var CE={},rc=ra(["doctype","comment"]);function Co(r){let t=PE((r||CE).newlines?IE:RE);return function(a){Zm(a,{collapse:t,whitespace:"normal"})}}function Zm(r,e){if("children"in r){let t={...e};return(r.type==="root"||eh(r))&&(t.before=!0,t.after=!0),t.whitespace=DE(r,e),TE(r,t)}if(r.type==="text"){if(e.whitespace==="normal")return kE(r,e);e.whitespace==="nowrap"&&(r.value=e.collapse(r.value))}return{ignore:rc(r),stripAtStart:!1,remove:!1}}function kE(r,e){let t=e.collapse(r.value),a={ignore:!1,stripAtStart:!1,remove:!1},n=0,i=t.length;return e.before&&Ym(t.charAt(0))&&n++,n!==i&&Ym(t.charAt(i-1))&&(e.after?i--:a.stripAtStart=!0),n===i?a.remove=!0:r.value=t.slice(n,i),a}function TE(r,e){let t=e.before,a=e.after,n=r.children,i=n.length,o=-1;for(;++o<i;){let s=Zm(n[o],{...e,after:Jm(n,o,a),before:t});s.remove?(n.splice(o,1),o--,i--):s.ignore||(t=s.stripAtStart),Qm(n[o])&&(t=!1)}return{ignore:!1,stripAtStart:!!(t||a),remove:!1}}function Jm(r,e,t){for(;++e<r.length;){let a=r[e],n=xE(a);if(n===void 0&&"children"in a&&!AE(a)&&(n=Jm(a.children,-1)),typeof n=="boolean")return n}return t}function xE(r){if(r.type==="element"){if(Qm(r))return!1;if(eh(r))return!0}else if(r.type==="text"){if(!xt(r))return!1}else if(!rc(r))return!1}function Qm(r){return fn(r)||ir(r,$m)}function eh(r){return ir(r,Km)}function AE(r){return!!(r.type==="element"&&r.properties.hidden)||rc(r)||ir(r,Xm)}function Ym(r){return r===" "||r===`
|
|
3433
|
-
`}function
|
|
3434
|
-
`)&&(d=!0),y.value=y.value.replace(/ *\n/g,"$&"+String(t).repeat(m)))}let g=[],f;for(u=-1;++u<p.length;){let y=p[u];(
|
|
3432
|
+
`;this._lastLogoSrc=""}onCreate(){this.layoutUpdateTimer=setInterval(()=>this.onUpdate(),250)}onDestroy(){clearInterval(this.layoutUpdateTimer)}onUpdate(){let t=this.child("root");if(!t)return;let a=this.attr.logo||jl;this._lastLogoSrc!=a&&(this._lastLogoSrc=a,t.src=a);let n=window.visualViewport?.offsetTop||0,i=window.visualViewport?.offsetLeft||0,o=this.attr.focusID?document.getElementById(this.attr.focusID):null;if(o){let s=o.getBoundingClientRect();if(!s)return;t.style.position="fixed",t.style.width="128px",t.style.height="128px",t.style.left=Math.round(s.x+s.width/2-128/2+i)+"px",t.style.top=Math.round(s.y+s.height/2-128/2+n)+"px"}else{let s=this.getBoundingClientRect();if(!s)return;t.style.width=s.width+"px",t.style.height=s.height+"px",t.style.left=Math.round(s.x+i)+"px",t.style.top=Math.round(s.y+n)+"px"}}refreshLayout(){setTimeout(()=>this.onUpdate(),100)}};Oa.observedAttributes=["logo","focusID"];var Wm=typeof self=="object"?self:globalThis,iE=(r,e)=>{let t=(n,i)=>(r.set(i,n),n),a=n=>{if(r.has(n))return r.get(n);let[i,o]=e[n];switch(i){case 0:case-1:return t(o,n);case 1:{let s=t([],n);for(let l of o)s.push(a(l));return s}case 2:{let s=t({},n);for(let[l,c]of o)s[a(l)]=a(c);return s}case 3:return t(new Date(o),n);case 4:{let{source:s,flags:l}=o;return t(new RegExp(s,l),n)}case 5:{let s=t(new Map,n);for(let[l,c]of o)s.set(a(l),a(c));return s}case 6:{let s=t(new Set,n);for(let l of o)s.add(a(l));return s}case 7:{let{name:s,message:l}=o;return t(new Wm[s](l),n)}case 8:return t(BigInt(o),n);case"BigInt":return t(Object(BigInt(o)),n)}return t(new Wm[i](o),n)};return a},Xl=r=>iE(new Map,r)(0);var na="",{toString:oE}={},{keys:sE}=Object,Ba=r=>{let e=typeof r;if(e!=="object"||!r)return[0,e];let t=oE.call(r).slice(8,-1);switch(t){case"Array":return[1,na];case"Object":return[2,na];case"Date":return[3,na];case"RegExp":return[4,na];case"Map":return[5,na];case"Set":return[6,na]}return t.includes("Array")?[1,t]:t.includes("Error")?[7,t]:[2,t]},Eo=([r,e])=>r===0&&(e==="function"||e==="symbol"),lE=(r,e,t,a)=>{let n=(o,s)=>{let l=a.push(o)-1;return t.set(s,l),l},i=o=>{if(t.has(o))return t.get(o);let[s,l]=Ba(o);switch(s){case 0:{let u=o;switch(l){case"bigint":s=8,u=o.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return n([-1],o)}return n([s,u],o)}case 1:{if(l)return n([l,[...o]],o);let u=[],p=n([s,u],o);for(let m of o)u.push(i(m));return p}case 2:{if(l)switch(l){case"BigInt":return n([l,o.toString()],o);case"Boolean":case"Number":case"String":return n([l,o.valueOf()],o)}if(e&&"toJSON"in o)return i(o.toJSON());let u=[],p=n([s,u],o);for(let m of sE(o))(r||!Eo(Ba(o[m])))&&u.push([i(m),i(o[m])]);return p}case 3:return n([s,o.toISOString()],o);case 4:{let{source:u,flags:p}=o;return n([s,{source:u,flags:p}],o)}case 5:{let u=[],p=n([s,u],o);for(let[m,d]of o)(r||!(Eo(Ba(m))||Eo(Ba(d))))&&u.push([i(m),i(d)]);return p}case 6:{let u=[],p=n([s,u],o);for(let m of o)(r||!Eo(Ba(m)))&&u.push(i(m));return p}}let{message:c}=o;return n([s,{name:l,message:c}],o)};return i},Yl=(r,{json:e,lossy:t}={})=>{let a=[];return lE(!(e||t),!!e,new Map,a)(r),a};var ir=typeof structuredClone=="function"?(r,e)=>e&&("json"in e||"lossy"in e)?Xl(Yl(r,e)):structuredClone(r):(r,e)=>Xl(Yl(r,e));var or=function(r,e,t,a,n){let i=sr(e);if(t!=null&&(typeof t!="number"||t<0||t===Number.POSITIVE_INFINITY))throw new Error("Expected positive finite `index`");if(a!=null&&(!a.type||!a.children))throw new Error("Expected valid `parent`");if(t==null!=(a==null))throw new Error("Expected both `index` and `parent`");return jm(r)?i.call(n,r,t,a):!1},sr=function(r){if(r==null)return dE;if(typeof r=="string")return uE(r);if(typeof r=="object")return cE(r);if(typeof r=="function")return Zl(r);throw new Error("Expected function, string, or array as `test`")};function cE(r){let e=[],t=-1;for(;++t<r.length;)e[t]=sr(r[t]);return Zl(a);function a(...n){let i=-1;for(;++i<e.length;)if(e[i].apply(this,n))return!0;return!1}}function uE(r){return Zl(e);function e(t){return t.tagName===r}}function Zl(r){return e;function e(t,a,n){return!!(jm(t)&&r.call(this,t,typeof a=="number"?a:void 0,n||void 0))}}function dE(r){return!!(r&&typeof r=="object"&&"type"in r&&r.type==="element"&&"tagName"in r&&typeof r.tagName=="string")}function jm(r){return r!==null&&typeof r=="object"&&"type"in r&&"tagName"in r}var pE=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,mE=/^[a-zA-Z]:\\/;function Jl(r){if(typeof r!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof r}\``);return mE.test(r)?!1:pE.test(r)}function qm(r){let e=String(r||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function Km(r){return r.join(" ").trim()}var aa=function(r){if(r==null)return yE;if(typeof r=="function")return wo(r);if(typeof r=="object")return Array.isArray(r)?hE(r):gE(r);if(typeof r=="string")return fE(r);throw new Error("Expected function, string, or object as test")};function hE(r){let e=[],t=-1;for(;++t<r.length;)e[t]=aa(r[t]);return wo(a);function a(...n){let i=-1;for(;++i<e.length;)if(e[i].apply(this,n))return!0;return!1}}function gE(r){let e=r;return wo(t);function t(a){let n=a,i;for(i in r)if(n[i]!==e[i])return!1;return!0}}function fE(r){return wo(e);function e(t){return t&&t.type===r}}function wo(r){return e;function e(t,a,n){return!!(bE(t)&&r.call(this,t,typeof a=="number"?a:void 0,n||void 0))}}function yE(){return!0}function bE(r){return r!==null&&typeof r=="object"&&"type"in r}var $m=[],Ql=!0,Co=!1,Ga="skip";function za(r,e,t,a){let n;typeof e=="function"&&typeof t!="function"?(a=t,t=e):n=e;let i=aa(n),o=a?-1:1;s(r,void 0,[])();function s(l,c,u){let p=l&&typeof l=="object"?l:{};if(typeof p.type=="string"){let d=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(d?"<"+d+">":""))+")"})}return m;function m(){let d=$m,g,f,y;if((!e||i(l,c,u[u.length-1]||void 0))&&(d=vE(t(l,u)),d[0]===Co))return d;if("children"in l&&l.children){let v=l;if(v.children&&d[0]!==Ga)for(f=(a?v.children.length:-1)+o,y=u.concat(v);f>-1&&f<v.children.length;){let T=v.children[f];if(g=s(T,f,y)(),g[0]===Co)return g;f=typeof g[1]=="number"?g[1]:f+o}}return d}}}function vE(r){return Array.isArray(r)?r:typeof r=="number"?[Ql,r]:r==null?$m:[r]}function Ua(r,e,t,a){let n,i,o;typeof e=="function"&&typeof t!="function"?(i=void 0,o=e,n=t):(i=e,o=t,n=a),za(r,i,s,n);function s(l,c){let u=c[c.length-1],p=u?u.children.indexOf(l):void 0;return o(l,p,u)}}var _E=["http","https"],SE=["nofollow"],EE={};function ko(r){let e=r||EE,t=e.protocols||_E,a=sr(e.test);return function(n){Ua(n,"element",function(i,o,s){if(i.tagName==="a"&&typeof i.properties.href=="string"&&a(i,o,s)){let l=i.properties.href;if(Jl(l)?t.includes(l.slice(0,l.indexOf(":"))):l.startsWith("//")){let c=Ha(e.content,i),u=c&&!Array.isArray(c)?[c]:c,p=Ha(e.rel,i)||SE,m=typeof p=="string"?qm(p):p,d=Ha(e.target,i),g=Ha(e.properties,i);if(g&&Object.assign(i.properties,ir(g)),m.length>0&&(i.properties.rel=[...m]),d&&(i.properties.target=d),u){let f=Ha(e.contentProperties,i)||{};i.children.push({type:"element",tagName:"span",properties:ir(f),children:ir(u)})}}}})}}function Ha(r,e){return typeof r=="function"?r(e):r}var bn=sr(function(r){return r.tagName==="audio"||r.tagName==="canvas"||r.tagName==="embed"||r.tagName==="iframe"||r.tagName==="img"||r.tagName==="math"||r.tagName==="object"||r.tagName==="picture"||r.tagName==="svg"||r.tagName==="video"});var wE={}.hasOwnProperty;function ec(r,e){let t=r.type==="element"&&wE.call(r.properties,e)&&r.properties[e];return t!=null&&t!==!1}var CE=new Set(["pingback","prefetch","stylesheet"]);function tc(r){if(r.type!=="element"||r.tagName!=="link")return!1;if(r.properties.itemProp)return!0;let e=r.properties.rel,t=-1;if(!Array.isArray(e)||e.length===0)return!1;for(;++t<e.length;)if(!CE.has(String(e[t])))return!1;return!0}var kE=sr(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),TE=sr("meta");function rc(r){return!!(r.type==="text"||kE(r)||bn(r)||tc(r)||TE(r)&&ec(r,"itemProp"))}var xE=/[ \t\n\f\r]/g;function It(r){return typeof r=="object"?r.type==="text"?Xm(r.value):!1:Xm(r)}function Xm(r){return r.replace(xE,"")===""}var nc=["pre","script","style","textarea"];var Ym=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"];var Zm=["button","input","select","textarea"];var Jm=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"];var AE={},ac=aa(["doctype","comment"]);function To(r){let t=LE((r||AE).newlines?NE:OE);return function(a){eh(a,{collapse:t,whitespace:"normal"})}}function eh(r,e){if("children"in r){let t={...e};return(r.type==="root"||nh(r))&&(t.before=!0,t.after=!0),t.whitespace=ME(r,e),RE(r,t)}if(r.type==="text"){if(e.whitespace==="normal")return IE(r,e);e.whitespace==="nowrap"&&(r.value=e.collapse(r.value))}return{ignore:ac(r),stripAtStart:!1,remove:!1}}function IE(r,e){let t=e.collapse(r.value),a={ignore:!1,stripAtStart:!1,remove:!1},n=0,i=t.length;return e.before&&Qm(t.charAt(0))&&n++,n!==i&&Qm(t.charAt(i-1))&&(e.after?i--:a.stripAtStart=!0),n===i?a.remove=!0:r.value=t.slice(n,i),a}function RE(r,e){let t=e.before,a=e.after,n=r.children,i=n.length,o=-1;for(;++o<i;){let s=eh(n[o],{...e,after:th(n,o,a),before:t});s.remove?(n.splice(o,1),o--,i--):s.ignore||(t=s.stripAtStart),rh(n[o])&&(t=!1)}return{ignore:!1,stripAtStart:!!(t||a),remove:!1}}function th(r,e,t){for(;++e<r.length;){let a=r[e],n=PE(a);if(n===void 0&&"children"in a&&!DE(a)&&(n=th(a.children,-1)),typeof n=="boolean")return n}return t}function PE(r){if(r.type==="element"){if(rh(r))return!1;if(nh(r))return!0}else if(r.type==="text"){if(!It(r))return!1}else if(!ac(r))return!1}function rh(r){return bn(r)||or(r,Zm)}function nh(r){return or(r,Ym)}function DE(r){return!!(r.type==="element"&&r.properties.hidden)||ac(r)||or(r,Jm)}function Qm(r){return r===" "||r===`
|
|
3433
|
+
`}function NE(r){let e=/\r?\n|\r/.exec(r);return e?e[0]:" "}function OE(){return" "}function LE(r){return e;function e(t){return String(t).replace(/[\t\n\v\f\r ]+/g,r)}}function ME(r,e){if("tagName"in r&&r.properties)switch(r.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return r.properties.wrap?"pre-wrap":"pre";case"td":case"th":return r.properties.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap";default:}return e.whitespace}var FE={},BE=To({newlines:!0});function xo(r){let e=r||FE,t=e.indent||2,a=e.indentInitial;return typeof t=="number"&&(t=" ".repeat(t)),a==null&&(a=!0),function(o){let s;BE(o),za(o,function(l,c){let u=-1;if(!("children"in l))return;if(or(l,"head")&&(s=!0),s&&or(l,"body")&&(s=void 0),or(l,nc))return Ga;let p=l.children,m=c.length;if(p.length===0||!ic(l,s))return;a||m--;let d;for(;++u<p.length;){let y=p[u];(y.type==="text"||y.type==="comment")&&(y.value.includes(`
|
|
3434
|
+
`)&&(d=!0),y.value=y.value.replace(/ *\n/g,"$&"+String(t).repeat(m)))}let g=[],f;for(u=-1;++u<p.length;){let y=p[u];(ic(y,s)||d&&!u)&&(n(g,m,y),d=!0),f=y,g.push(y)}f&&(d||ic(f,s))&&(It(f)&&(g.pop(),f=g[g.length-1]),n(g,m-1)),l.children=g})};function n(o,s,l){let c=o[o.length-1],u=c&&It(c)?o[o.length-2]:c,p=(i(u)&&i(l)?`
|
|
3435
3435
|
|
|
3436
3436
|
`:`
|
|
3437
|
-
`)+String(t).repeat(Math.max(s,0));c&&c.type==="text"?c.value=xt(c)?p:c.value+p:o.push({type:"text",value:p})}function i(o){return!!(o&&o.type==="element"&&e.blanks&&e.blanks.length>0&&e.blanks.includes(o.tagName))}}function nc(r,e){return r.type==="root"||(r.type==="element"?e||ir(r,"script")||fn(r)||!ec(r):!1)}var th=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var br=class{constructor(e,t,a){this.property=e,this.normal=t,a&&(this.space=a)}};br.prototype.property={};br.prototype.normal={};br.prototype.space=null;function ac(r,e){let t={},a={},n=-1;for(;++n<r.length;)Object.assign(t,r[n].property),Object.assign(a,r[n].normal);return new br(t,a,e)}function Ua(r){return r.toLowerCase()}var st=class{constructor(e,t){this.property=e,this.attribute=t}};st.prototype.space=null;st.prototype.boolean=!1;st.prototype.booleanish=!1;st.prototype.overloadedBoolean=!1;st.prototype.number=!1;st.prototype.commaSeparated=!1;st.prototype.spaceSeparated=!1;st.prototype.commaOrSpaceSeparated=!1;st.prototype.mustUseProperty=!1;st.prototype.defined=!1;var Ha={};Ss(Ha,{boolean:()=>ae,booleanish:()=>ze,commaOrSpaceSeparated:()=>St,commaSeparated:()=>Mr,number:()=>H,overloadedBoolean:()=>ic,spaceSeparated:()=>ke});var LE=0,ae=yn(),ze=yn(),ic=yn(),H=yn(),ke=yn(),Mr=yn(),St=yn();function yn(){return 2**++LE}var oc=Object.keys(Ha),bn=class extends st{constructor(e,t,a,n){let i=-1;if(super(e,t),rh(this,"space",n),typeof a=="number")for(;++i<oc.length;){let o=oc[i];rh(this,oc[i],(a&Ha[o])===Ha[o])}}};bn.prototype.defined=!0;function rh(r,e,t){t&&(r[e]=t)}var ME={}.hasOwnProperty;function zt(r){let e={},t={},a;for(a in r.properties)if(ME.call(r.properties,a)){let n=r.properties[a],i=new bn(a,r.transform(r.attributes||{},a),n,r.space);r.mustUseProperty&&r.mustUseProperty.includes(a)&&(i.mustUseProperty=!0),e[a]=i,t[Ua(a)]=a,t[Ua(i.attribute)]=a}return new br(e,t,r.space)}var sc=zt({space:"xlink",transform(r,e){return"xlink:"+e.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}});var lc=zt({space:"xml",transform(r,e){return"xml:"+e.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function To(r,e){return e in r?r[e]:e}function xo(r,e){return To(r,e.toLowerCase())}var cc=zt({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:xo,properties:{xmlns:null,xmlnsXLink:null}});var uc=zt({transform(r,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:ze,ariaAutoComplete:null,ariaBusy:ze,ariaChecked:ze,ariaColCount:H,ariaColIndex:H,ariaColSpan:H,ariaControls:ke,ariaCurrent:null,ariaDescribedBy:ke,ariaDetails:null,ariaDisabled:ze,ariaDropEffect:ke,ariaErrorMessage:null,ariaExpanded:ze,ariaFlowTo:ke,ariaGrabbed:ze,ariaHasPopup:null,ariaHidden:ze,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ke,ariaLevel:H,ariaLive:null,ariaModal:ze,ariaMultiLine:ze,ariaMultiSelectable:ze,ariaOrientation:null,ariaOwns:ke,ariaPlaceholder:null,ariaPosInSet:H,ariaPressed:ze,ariaReadOnly:ze,ariaRelevant:null,ariaRequired:ze,ariaRoleDescription:ke,ariaRowCount:H,ariaRowIndex:H,ariaRowSpan:H,ariaSelected:ze,ariaSetSize:H,ariaSort:null,ariaValueMax:H,ariaValueMin:H,ariaValueNow:H,ariaValueText:null,role:null}});var nh=zt({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:xo,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Mr,acceptCharset:ke,accessKey:ke,action:null,allow:null,allowFullScreen:ae,allowPaymentRequest:ae,allowUserMedia:ae,alt:null,as:null,async:ae,autoCapitalize:null,autoComplete:ke,autoFocus:ae,autoPlay:ae,blocking:ke,capture:null,charSet:null,checked:ae,cite:null,className:ke,cols:H,colSpan:null,content:null,contentEditable:ze,controls:ae,controlsList:ke,coords:H|Mr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ae,defer:ae,dir:null,dirName:null,disabled:ae,download:ic,draggable:ze,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ae,formTarget:null,headers:ke,height:H,hidden:ae,high:H,href:null,hrefLang:null,htmlFor:ke,httpEquiv:ke,id:null,imageSizes:null,imageSrcSet:null,inert:ae,inputMode:null,integrity:null,is:null,isMap:ae,itemId:null,itemProp:ke,itemRef:ke,itemScope:ae,itemType:ke,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ae,low:H,manifest:null,max:null,maxLength:H,media:null,method:null,min:null,minLength:H,multiple:ae,muted:ae,name:null,nonce:null,noModule:ae,noValidate:ae,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ae,optimum:H,pattern:null,ping:ke,placeholder:null,playsInline:ae,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ae,referrerPolicy:null,rel:ke,required:ae,reversed:ae,rows:H,rowSpan:H,sandbox:ke,scope:null,scoped:ae,seamless:ae,selected:ae,shadowRootClonable:ae,shadowRootDelegatesFocus:ae,shadowRootMode:null,shape:null,size:H,sizes:null,slot:null,span:H,spellCheck:ze,src:null,srcDoc:null,srcLang:null,srcSet:null,start:H,step:null,style:null,tabIndex:H,target:null,title:null,translate:null,type:null,typeMustMatch:ae,useMap:null,value:ze,width:H,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ke,axis:null,background:null,bgColor:null,border:H,borderColor:null,bottomMargin:H,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ae,declare:ae,event:null,face:null,frame:null,frameBorder:null,hSpace:H,leftMargin:H,link:null,longDesc:null,lowSrc:null,marginHeight:H,marginWidth:H,noResize:ae,noHref:ae,noShade:ae,noWrap:ae,object:null,profile:null,prompt:null,rev:null,rightMargin:H,rules:null,scheme:null,scrolling:ze,standby:null,summary:null,text:null,topMargin:H,valueType:null,version:null,vAlign:null,vLink:null,vSpace:H,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ae,disableRemotePlayback:ae,prefix:null,property:null,results:H,security:null,unselectable:null}});var ah=zt({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:To,properties:{about:St,accentHeight:H,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:H,amplitude:H,arabicForm:null,ascent:H,attributeName:null,attributeType:null,azimuth:H,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:H,by:null,calcMode:null,capHeight:H,className:ke,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:H,diffuseConstant:H,direction:null,display:null,dur:null,divisor:H,dominantBaseline:null,download:ae,dx:null,dy:null,edgeMode:null,editable:null,elevation:H,enableBackground:null,end:null,event:null,exponent:H,externalResourcesRequired:null,fill:null,fillOpacity:H,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Mr,g2:Mr,glyphName:Mr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:H,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:H,horizOriginX:H,horizOriginY:H,id:null,ideographic:H,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:H,k:H,k1:H,k2:H,k3:H,k4:H,kernelMatrix:St,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:H,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:H,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:H,overlineThickness:H,paintOrder:null,panose1:null,path:null,pathLength:H,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ke,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:H,pointsAtY:H,pointsAtZ:H,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:St,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:St,rev:St,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:St,requiredFeatures:St,requiredFonts:St,requiredFormats:St,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:H,specularExponent:H,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:H,strikethroughThickness:H,string:null,stroke:null,strokeDashArray:St,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:H,strokeOpacity:H,strokeWidth:null,style:null,surfaceScale:H,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:St,tabIndex:H,tableValues:null,target:null,targetX:H,targetY:H,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:St,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:H,underlineThickness:H,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:H,values:null,vAlphabetic:H,vMathematical:H,vectorEffect:null,vHanging:H,vIdeographic:H,version:null,vertAdvY:H,vertOriginX:H,vertOriginY:H,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:H,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}});var FE=/^data[-\w.:]+$/i,ih=/-[a-z]/g,BE=/[A-Z]/g;function dc(r,e){let t=Ua(e),a=e,n=st;if(t in r.normal)return r.property[r.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&FE.test(e)){if(e.charAt(4)==="-"){let i=e.slice(5).replace(ih,zE);a="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{let i=e.slice(4);if(!ih.test(i)){let o=i.replace(BE,GE);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}n=bn}return new n(a,e)}function GE(r){return"-"+r.toLowerCase()}function zE(r){return r.charAt(1).toUpperCase()}var oh=ac([lc,sc,cc,uc,nh],"html"),Ao=ac([lc,sc,cc,uc,ah],"svg");var sh={}.hasOwnProperty;function lh(r,e){let t=e||{};function a(n,...i){let o=a.invalid,s=a.handlers;if(n&&sh.call(n,r)){let l=String(n[r]);o=sh.call(s,l)?s[l]:a.unknown}if(o)return o.call(this,n,...i)}return a.handlers=t.handlers||{},a.invalid=t.invalid,a.unknown=t.unknown,a}var UE=/["&'<>`]/g,HE=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,VE=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,WE=/[|\\{}()[\]^$+*?.]/g,ch=new WeakMap;function uh(r,e){if(r=r.replace(e.subset?jE(e.subset):UE,a),e.subset||e.escapeOnly)return r;return r.replace(HE,t).replace(VE,a);function t(n,i,o){return e.format((n.charCodeAt(0)-55296)*1024+n.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),e)}function a(n,i,o){return e.format(n.charCodeAt(0),o.charCodeAt(i+1),e)}}function jE(r){let e=ch.get(r);return e||(e=qE(r),ch.set(r,e)),e}function qE(r){let e=[],t=-1;for(;++t<r.length;)e.push(r[t].replace(WE,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}var KE=/[\dA-Fa-f]/;function dh(r,e,t){let a="&#x"+r.toString(16).toUpperCase();return t&&e&&!KE.test(String.fromCharCode(e))?a:a+";"}var $E=/\d/;function ph(r,e,t){let a="&#"+String(r);return t&&e&&!$E.test(String.fromCharCode(e))?a:a+";"}var mh=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var Io={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var hh=["cent","copy","divide","gt","lt","not","para","times"];var gh={}.hasOwnProperty,pc={},Ro;for(Ro in Io)gh.call(Io,Ro)&&(pc[Io[Ro]]=Ro);var XE=/[^\dA-Za-z]/;function fh(r,e,t,a){let n=String.fromCharCode(r);if(gh.call(pc,n)){let i=pc[n],o="&"+i;return t&&mh.includes(i)&&!hh.includes(i)&&(!a||e&&e!==61&&XE.test(String.fromCharCode(e)))?o:o+";"}return""}function yh(r,e,t){let a=dh(r,e,t.omitOptionalSemicolons),n;if((t.useNamedReferences||t.useShortestReferences)&&(n=fh(r,e,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!n)&&t.useShortestReferences){let i=ph(r,e,t.omitOptionalSemicolons);i.length<a.length&&(a=i)}return n&&(!t.useShortestReferences||n.length<a.length)?n:a}function vr(r,e){return uh(r,Object.assign({format:yh},e))}var YE=/^>|^->|<!--|-->|--!>|<!-$/g,ZE=[">"],JE=["<",">"];function bh(r,e,t,a){return a.settings.bogusComments?"<?"+vr(r.value,Object.assign({},a.settings.characterReferences,{subset:ZE}))+">":"<!--"+r.value.replace(YE,n)+"-->";function n(i){return vr(i,Object.assign({},a.settings.characterReferences,{subset:JE}))}}function vh(r,e,t,a){return"<!"+(a.settings.upperDoctype?"DOCTYPE":"doctype")+(a.settings.tightDoctype?"":" ")+"html>"}function mc(r,e){let t=String(r);if(typeof e!="string")throw new TypeError("Expected character");let a=0,n=t.indexOf(e);for(;n!==-1;)a++,n=t.indexOf(e,n+e.length);return a}function _h(r,e){let t=e||{};return(r[r.length-1]===""?[...r,""]:r).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}var He=Sh(1),hc=Sh(-1),QE=[];function Sh(r){return e;function e(t,a,n){let i=t?t.children:QE,o=(a||0)+r,s=i[o];if(!n)for(;s&&xt(s);)o+=r,s=i[o];return s}}var ew={}.hasOwnProperty;function Po(r){return e;function e(t,a,n){return ew.call(r,t.tagName)&&r[t.tagName](t,a,n)}}var Va=Po({body:rw,caption:gc,colgroup:gc,dd:ow,dt:iw,head:gc,html:tw,li:aw,optgroup:sw,option:lw,p:nw,rp:Eh,rt:Eh,tbody:uw,td:wh,tfoot:dw,th:wh,thead:cw,tr:pw});function gc(r,e,t){let a=He(t,e,!0);return!a||a.type!=="comment"&&!(a.type==="text"&&xt(a.value.charAt(0)))}function tw(r,e,t){let a=He(t,e);return!a||a.type!=="comment"}function rw(r,e,t){let a=He(t,e);return!a||a.type!=="comment"}function nw(r,e,t){let a=He(t,e);return a?a.type==="element"&&(a.tagName==="address"||a.tagName==="article"||a.tagName==="aside"||a.tagName==="blockquote"||a.tagName==="details"||a.tagName==="div"||a.tagName==="dl"||a.tagName==="fieldset"||a.tagName==="figcaption"||a.tagName==="figure"||a.tagName==="footer"||a.tagName==="form"||a.tagName==="h1"||a.tagName==="h2"||a.tagName==="h3"||a.tagName==="h4"||a.tagName==="h5"||a.tagName==="h6"||a.tagName==="header"||a.tagName==="hgroup"||a.tagName==="hr"||a.tagName==="main"||a.tagName==="menu"||a.tagName==="nav"||a.tagName==="ol"||a.tagName==="p"||a.tagName==="pre"||a.tagName==="section"||a.tagName==="table"||a.tagName==="ul"):!t||!(t.type==="element"&&(t.tagName==="a"||t.tagName==="audio"||t.tagName==="del"||t.tagName==="ins"||t.tagName==="map"||t.tagName==="noscript"||t.tagName==="video"))}function aw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&a.tagName==="li"}function iw(r,e,t){let a=He(t,e);return!!(a&&a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd"))}function ow(r,e,t){let a=He(t,e);return!a||a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd")}function Eh(r,e,t){let a=He(t,e);return!a||a.type==="element"&&(a.tagName==="rp"||a.tagName==="rt")}function sw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&a.tagName==="optgroup"}function lw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&(a.tagName==="option"||a.tagName==="optgroup")}function cw(r,e,t){let a=He(t,e);return!!(a&&a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot"))}function uw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot")}function dw(r,e,t){return!He(t,e)}function pw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&a.tagName==="tr"}function wh(r,e,t){let a=He(t,e);return!a||a.type==="element"&&(a.tagName==="td"||a.tagName==="th")}var Ch=Po({body:gw,colgroup:fw,head:hw,html:mw,tbody:yw});function mw(r){let e=He(r,-1);return!e||e.type!=="comment"}function hw(r){let e=r.children,t=[],a=-1;for(;++a<e.length;){let n=e[a];if(n.type==="element"&&(n.tagName==="title"||n.tagName==="base")){if(t.includes(n.tagName))return!1;t.push(n.tagName)}}return e.length>0}function gw(r){let e=He(r,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&xt(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function fw(r,e,t){let a=hc(t,e),n=He(r,-1,!0);return t&&a&&a.type==="element"&&a.tagName==="colgroup"&&Va(a,t.children.indexOf(a),t)?!1:!!(n&&n.type==="element"&&n.tagName==="col")}function yw(r,e,t){let a=hc(t,e),n=He(r,-1);return t&&a&&a.type==="element"&&(a.tagName==="thead"||a.tagName==="tbody")&&Va(a,t.children.indexOf(a),t)?!1:!!(n&&n.type==="element"&&n.tagName==="tr")}var Do={name:[[`
|
|
3437
|
+
`)+String(t).repeat(Math.max(s,0));c&&c.type==="text"?c.value=It(c)?p:c.value+p:o.push({type:"text",value:p})}function i(o){return!!(o&&o.type==="element"&&e.blanks&&e.blanks.length>0&&e.blanks.includes(o.tagName))}}function ic(r,e){return r.type==="root"||(r.type==="element"?e||or(r,"script")||bn(r)||!rc(r):!1)}var ah=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var Sr=class{constructor(e,t,a){this.property=e,this.normal=t,a&&(this.space=a)}};Sr.prototype.property={};Sr.prototype.normal={};Sr.prototype.space=null;function oc(r,e){let t={},a={},n=-1;for(;++n<r.length;)Object.assign(t,r[n].property),Object.assign(a,r[n].normal);return new Sr(t,a,e)}function Va(r){return r.toLowerCase()}var st=class{constructor(e,t){this.property=e,this.attribute=t}};st.prototype.space=null;st.prototype.boolean=!1;st.prototype.booleanish=!1;st.prototype.overloadedBoolean=!1;st.prototype.number=!1;st.prototype.commaSeparated=!1;st.prototype.spaceSeparated=!1;st.prototype.commaOrSpaceSeparated=!1;st.prototype.mustUseProperty=!1;st.prototype.defined=!1;var Wa={};ws(Wa,{boolean:()=>ae,booleanish:()=>ze,commaOrSpaceSeparated:()=>Et,commaSeparated:()=>Br,number:()=>H,overloadedBoolean:()=>sc,spaceSeparated:()=>ke});var GE=0,ae=vn(),ze=vn(),sc=vn(),H=vn(),ke=vn(),Br=vn(),Et=vn();function vn(){return 2**++GE}var lc=Object.keys(Wa),_n=class extends st{constructor(e,t,a,n){let i=-1;if(super(e,t),ih(this,"space",n),typeof a=="number")for(;++i<lc.length;){let o=lc[i];ih(this,lc[i],(a&Wa[o])===Wa[o])}}};_n.prototype.defined=!0;function ih(r,e,t){t&&(r[e]=t)}var zE={}.hasOwnProperty;function Ht(r){let e={},t={},a;for(a in r.properties)if(zE.call(r.properties,a)){let n=r.properties[a],i=new _n(a,r.transform(r.attributes||{},a),n,r.space);r.mustUseProperty&&r.mustUseProperty.includes(a)&&(i.mustUseProperty=!0),e[a]=i,t[Va(a)]=a,t[Va(i.attribute)]=a}return new Sr(e,t,r.space)}var cc=Ht({space:"xlink",transform(r,e){return"xlink:"+e.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}});var uc=Ht({space:"xml",transform(r,e){return"xml:"+e.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function Ao(r,e){return e in r?r[e]:e}function Io(r,e){return Ao(r,e.toLowerCase())}var dc=Ht({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:Io,properties:{xmlns:null,xmlnsXLink:null}});var pc=Ht({transform(r,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:ze,ariaAutoComplete:null,ariaBusy:ze,ariaChecked:ze,ariaColCount:H,ariaColIndex:H,ariaColSpan:H,ariaControls:ke,ariaCurrent:null,ariaDescribedBy:ke,ariaDetails:null,ariaDisabled:ze,ariaDropEffect:ke,ariaErrorMessage:null,ariaExpanded:ze,ariaFlowTo:ke,ariaGrabbed:ze,ariaHasPopup:null,ariaHidden:ze,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ke,ariaLevel:H,ariaLive:null,ariaModal:ze,ariaMultiLine:ze,ariaMultiSelectable:ze,ariaOrientation:null,ariaOwns:ke,ariaPlaceholder:null,ariaPosInSet:H,ariaPressed:ze,ariaReadOnly:ze,ariaRelevant:null,ariaRequired:ze,ariaRoleDescription:ke,ariaRowCount:H,ariaRowIndex:H,ariaRowSpan:H,ariaSelected:ze,ariaSetSize:H,ariaSort:null,ariaValueMax:H,ariaValueMin:H,ariaValueNow:H,ariaValueText:null,role:null}});var oh=Ht({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:Io,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Br,acceptCharset:ke,accessKey:ke,action:null,allow:null,allowFullScreen:ae,allowPaymentRequest:ae,allowUserMedia:ae,alt:null,as:null,async:ae,autoCapitalize:null,autoComplete:ke,autoFocus:ae,autoPlay:ae,blocking:ke,capture:null,charSet:null,checked:ae,cite:null,className:ke,cols:H,colSpan:null,content:null,contentEditable:ze,controls:ae,controlsList:ke,coords:H|Br,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ae,defer:ae,dir:null,dirName:null,disabled:ae,download:sc,draggable:ze,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ae,formTarget:null,headers:ke,height:H,hidden:ae,high:H,href:null,hrefLang:null,htmlFor:ke,httpEquiv:ke,id:null,imageSizes:null,imageSrcSet:null,inert:ae,inputMode:null,integrity:null,is:null,isMap:ae,itemId:null,itemProp:ke,itemRef:ke,itemScope:ae,itemType:ke,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ae,low:H,manifest:null,max:null,maxLength:H,media:null,method:null,min:null,minLength:H,multiple:ae,muted:ae,name:null,nonce:null,noModule:ae,noValidate:ae,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ae,optimum:H,pattern:null,ping:ke,placeholder:null,playsInline:ae,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ae,referrerPolicy:null,rel:ke,required:ae,reversed:ae,rows:H,rowSpan:H,sandbox:ke,scope:null,scoped:ae,seamless:ae,selected:ae,shadowRootClonable:ae,shadowRootDelegatesFocus:ae,shadowRootMode:null,shape:null,size:H,sizes:null,slot:null,span:H,spellCheck:ze,src:null,srcDoc:null,srcLang:null,srcSet:null,start:H,step:null,style:null,tabIndex:H,target:null,title:null,translate:null,type:null,typeMustMatch:ae,useMap:null,value:ze,width:H,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ke,axis:null,background:null,bgColor:null,border:H,borderColor:null,bottomMargin:H,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ae,declare:ae,event:null,face:null,frame:null,frameBorder:null,hSpace:H,leftMargin:H,link:null,longDesc:null,lowSrc:null,marginHeight:H,marginWidth:H,noResize:ae,noHref:ae,noShade:ae,noWrap:ae,object:null,profile:null,prompt:null,rev:null,rightMargin:H,rules:null,scheme:null,scrolling:ze,standby:null,summary:null,text:null,topMargin:H,valueType:null,version:null,vAlign:null,vLink:null,vSpace:H,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ae,disableRemotePlayback:ae,prefix:null,property:null,results:H,security:null,unselectable:null}});var sh=Ht({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:Ao,properties:{about:Et,accentHeight:H,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:H,amplitude:H,arabicForm:null,ascent:H,attributeName:null,attributeType:null,azimuth:H,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:H,by:null,calcMode:null,capHeight:H,className:ke,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:H,diffuseConstant:H,direction:null,display:null,dur:null,divisor:H,dominantBaseline:null,download:ae,dx:null,dy:null,edgeMode:null,editable:null,elevation:H,enableBackground:null,end:null,event:null,exponent:H,externalResourcesRequired:null,fill:null,fillOpacity:H,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Br,g2:Br,glyphName:Br,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:H,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:H,horizOriginX:H,horizOriginY:H,id:null,ideographic:H,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:H,k:H,k1:H,k2:H,k3:H,k4:H,kernelMatrix:Et,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:H,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:H,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:H,overlineThickness:H,paintOrder:null,panose1:null,path:null,pathLength:H,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ke,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:H,pointsAtY:H,pointsAtZ:H,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Et,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Et,rev:Et,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Et,requiredFeatures:Et,requiredFonts:Et,requiredFormats:Et,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:H,specularExponent:H,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:H,strikethroughThickness:H,string:null,stroke:null,strokeDashArray:Et,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:H,strokeOpacity:H,strokeWidth:null,style:null,surfaceScale:H,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Et,tabIndex:H,tableValues:null,target:null,targetX:H,targetY:H,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Et,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:H,underlineThickness:H,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:H,values:null,vAlphabetic:H,vMathematical:H,vectorEffect:null,vHanging:H,vIdeographic:H,version:null,vertAdvY:H,vertOriginX:H,vertOriginY:H,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:H,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}});var UE=/^data[-\w.:]+$/i,lh=/-[a-z]/g,HE=/[A-Z]/g;function mc(r,e){let t=Va(e),a=e,n=st;if(t in r.normal)return r.property[r.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&UE.test(e)){if(e.charAt(4)==="-"){let i=e.slice(5).replace(lh,WE);a="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{let i=e.slice(4);if(!lh.test(i)){let o=i.replace(HE,VE);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}n=_n}return new n(a,e)}function VE(r){return"-"+r.toLowerCase()}function WE(r){return r.charAt(1).toUpperCase()}var ch=oc([uc,cc,dc,pc,oh],"html"),Ro=oc([uc,cc,dc,pc,sh],"svg");var uh={}.hasOwnProperty;function dh(r,e){let t=e||{};function a(n,...i){let o=a.invalid,s=a.handlers;if(n&&uh.call(n,r)){let l=String(n[r]);o=uh.call(s,l)?s[l]:a.unknown}if(o)return o.call(this,n,...i)}return a.handlers=t.handlers||{},a.invalid=t.invalid,a.unknown=t.unknown,a}var jE=/["&'<>`]/g,qE=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,KE=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,$E=/[|\\{}()[\]^$+*?.]/g,ph=new WeakMap;function mh(r,e){if(r=r.replace(e.subset?XE(e.subset):jE,a),e.subset||e.escapeOnly)return r;return r.replace(qE,t).replace(KE,a);function t(n,i,o){return e.format((n.charCodeAt(0)-55296)*1024+n.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),e)}function a(n,i,o){return e.format(n.charCodeAt(0),o.charCodeAt(i+1),e)}}function XE(r){let e=ph.get(r);return e||(e=YE(r),ph.set(r,e)),e}function YE(r){let e=[],t=-1;for(;++t<r.length;)e.push(r[t].replace($E,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}var ZE=/[\dA-Fa-f]/;function hh(r,e,t){let a="&#x"+r.toString(16).toUpperCase();return t&&e&&!ZE.test(String.fromCharCode(e))?a:a+";"}var JE=/\d/;function gh(r,e,t){let a="&#"+String(r);return t&&e&&!JE.test(String.fromCharCode(e))?a:a+";"}var fh=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var Po={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var yh=["cent","copy","divide","gt","lt","not","para","times"];var bh={}.hasOwnProperty,hc={},Do;for(Do in Po)bh.call(Po,Do)&&(hc[Po[Do]]=Do);var QE=/[^\dA-Za-z]/;function vh(r,e,t,a){let n=String.fromCharCode(r);if(bh.call(hc,n)){let i=hc[n],o="&"+i;return t&&fh.includes(i)&&!yh.includes(i)&&(!a||e&&e!==61&&QE.test(String.fromCharCode(e)))?o:o+";"}return""}function _h(r,e,t){let a=hh(r,e,t.omitOptionalSemicolons),n;if((t.useNamedReferences||t.useShortestReferences)&&(n=vh(r,e,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!n)&&t.useShortestReferences){let i=gh(r,e,t.omitOptionalSemicolons);i.length<a.length&&(a=i)}return n&&(!t.useShortestReferences||n.length<a.length)?n:a}function Er(r,e){return mh(r,Object.assign({format:_h},e))}var ew=/^>|^->|<!--|-->|--!>|<!-$/g,tw=[">"],rw=["<",">"];function Sh(r,e,t,a){return a.settings.bogusComments?"<?"+Er(r.value,Object.assign({},a.settings.characterReferences,{subset:tw}))+">":"<!--"+r.value.replace(ew,n)+"-->";function n(i){return Er(i,Object.assign({},a.settings.characterReferences,{subset:rw}))}}function Eh(r,e,t,a){return"<!"+(a.settings.upperDoctype?"DOCTYPE":"doctype")+(a.settings.tightDoctype?"":" ")+"html>"}function gc(r,e){let t=String(r);if(typeof e!="string")throw new TypeError("Expected character");let a=0,n=t.indexOf(e);for(;n!==-1;)a++,n=t.indexOf(e,n+e.length);return a}function wh(r,e){let t=e||{};return(r[r.length-1]===""?[...r,""]:r).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}var He=Ch(1),fc=Ch(-1),nw=[];function Ch(r){return e;function e(t,a,n){let i=t?t.children:nw,o=(a||0)+r,s=i[o];if(!n)for(;s&&It(s);)o+=r,s=i[o];return s}}var aw={}.hasOwnProperty;function No(r){return e;function e(t,a,n){return aw.call(r,t.tagName)&&r[t.tagName](t,a,n)}}var ja=No({body:ow,caption:yc,colgroup:yc,dd:uw,dt:cw,head:yc,html:iw,li:lw,optgroup:dw,option:pw,p:sw,rp:kh,rt:kh,tbody:hw,td:Th,tfoot:gw,th:Th,thead:mw,tr:fw});function yc(r,e,t){let a=He(t,e,!0);return!a||a.type!=="comment"&&!(a.type==="text"&&It(a.value.charAt(0)))}function iw(r,e,t){let a=He(t,e);return!a||a.type!=="comment"}function ow(r,e,t){let a=He(t,e);return!a||a.type!=="comment"}function sw(r,e,t){let a=He(t,e);return a?a.type==="element"&&(a.tagName==="address"||a.tagName==="article"||a.tagName==="aside"||a.tagName==="blockquote"||a.tagName==="details"||a.tagName==="div"||a.tagName==="dl"||a.tagName==="fieldset"||a.tagName==="figcaption"||a.tagName==="figure"||a.tagName==="footer"||a.tagName==="form"||a.tagName==="h1"||a.tagName==="h2"||a.tagName==="h3"||a.tagName==="h4"||a.tagName==="h5"||a.tagName==="h6"||a.tagName==="header"||a.tagName==="hgroup"||a.tagName==="hr"||a.tagName==="main"||a.tagName==="menu"||a.tagName==="nav"||a.tagName==="ol"||a.tagName==="p"||a.tagName==="pre"||a.tagName==="section"||a.tagName==="table"||a.tagName==="ul"):!t||!(t.type==="element"&&(t.tagName==="a"||t.tagName==="audio"||t.tagName==="del"||t.tagName==="ins"||t.tagName==="map"||t.tagName==="noscript"||t.tagName==="video"))}function lw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&a.tagName==="li"}function cw(r,e,t){let a=He(t,e);return!!(a&&a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd"))}function uw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd")}function kh(r,e,t){let a=He(t,e);return!a||a.type==="element"&&(a.tagName==="rp"||a.tagName==="rt")}function dw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&a.tagName==="optgroup"}function pw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&(a.tagName==="option"||a.tagName==="optgroup")}function mw(r,e,t){let a=He(t,e);return!!(a&&a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot"))}function hw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot")}function gw(r,e,t){return!He(t,e)}function fw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&a.tagName==="tr"}function Th(r,e,t){let a=He(t,e);return!a||a.type==="element"&&(a.tagName==="td"||a.tagName==="th")}var xh=No({body:vw,colgroup:_w,head:bw,html:yw,tbody:Sw});function yw(r){let e=He(r,-1);return!e||e.type!=="comment"}function bw(r){let e=r.children,t=[],a=-1;for(;++a<e.length;){let n=e[a];if(n.type==="element"&&(n.tagName==="title"||n.tagName==="base")){if(t.includes(n.tagName))return!1;t.push(n.tagName)}}return e.length>0}function vw(r){let e=He(r,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&It(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function _w(r,e,t){let a=fc(t,e),n=He(r,-1,!0);return t&&a&&a.type==="element"&&a.tagName==="colgroup"&&ja(a,t.children.indexOf(a),t)?!1:!!(n&&n.type==="element"&&n.tagName==="col")}function Sw(r,e,t){let a=fc(t,e),n=He(r,-1);return t&&a&&a.type==="element"&&(a.tagName==="thead"||a.tagName==="tbody")&&ja(a,t.children.indexOf(a),t)?!1:!!(n&&n.type==="element"&&n.tagName==="tr")}var Oo={name:[[`
|
|
3438
3438
|
\f\r &/=>`.split(""),`
|
|
3439
3439
|
\f\r "&'/=>\``.split("")],[`\0
|
|
3440
3440
|
\f\r "&'/<=>`.split(""),`\0
|
|
@@ -3442,19 +3442,19 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3442
3442
|
\f\r &>`.split(""),`\0
|
|
3443
3443
|
\f\r "&'<=>\``.split("")],[`\0
|
|
3444
3444
|
\f\r "&'<=>\``.split(""),`\0
|
|
3445
|
-
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function kh(r,e,t,a){let n=a.schema,i=n.space==="svg"?!1:a.settings.omitOptionalTags,o=n.space==="svg"?a.settings.closeEmptyElements:a.settings.voids.includes(r.tagName.toLowerCase()),s=[],l;n.space==="html"&&r.tagName==="svg"&&(a.schema=Ao);let c=bw(a,r.properties),u=a.all(n.space==="html"&&r.tagName==="template"?r.content:r);return a.schema=n,u&&(o=!1),(c||!i||!Ch(r,e,t))&&(s.push("<",r.tagName,c?" "+c:""),o&&(n.space==="svg"||a.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!a.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(u),!o&&(!i||!Va(r,e,t))&&s.push("</"+r.tagName+">"),s.join("")}function bw(r,e){let t=[],a=-1,n;if(e){for(n in e)if(e[n]!==null&&e[n]!==void 0){let i=vw(r,n,e[n]);i&&t.push(i)}}for(;++a<t.length;){let i=r.settings.tightAttributes?t[a].charAt(t[a].length-1):void 0;a!==t.length-1&&i!=='"'&&i!=="'"&&(t[a]+=" ")}return t.join("")}function vw(r,e,t){let a=dc(r.schema,e),n=r.settings.allowParseErrors&&r.schema.space==="html"?0:1,i=r.settings.allowDangerousCharacters?0:1,o=r.quote,s;if(a.overloadedBoolean&&(t===a.attribute||t==="")?t=!0:(a.boolean||a.overloadedBoolean&&typeof t!="string")&&(t=!!t),t==null||t===!1||typeof t=="number"&&Number.isNaN(t))return"";let l=vr(a.attribute,Object.assign({},r.settings.characterReferences,{subset:Do.name[n][i]}));return t===!0||(t=Array.isArray(t)?(a.commaSeparated?_h:Wm)(t,{padLeft:!r.settings.tightCommaSeparatedLists}):String(t),r.settings.collapseEmptyAttributes&&!t)?l:(r.settings.preferUnquoted&&(s=vr(t,Object.assign({},r.settings.characterReferences,{attribute:!0,subset:Do.unquoted[n][i]}))),s!==t&&(r.settings.quoteSmart&&mc(t,o)>mc(t,r.alternative)&&(o=r.alternative),s=o+vr(t,Object.assign({},r.settings.characterReferences,{subset:(o==="'"?Do.single:Do.double)[n][i],attribute:!0}))+o),l+(s&&"="+s))}var _w=["<","&"];function No(r,e,t,a){return t&&t.type==="element"&&(t.tagName==="script"||t.tagName==="style")?r.value:vr(r.value,Object.assign({},a.settings.characterReferences,{subset:_w}))}function Th(r,e,t,a){return a.settings.allowDangerousHtml?r.value:No(r,e,t,a)}function xh(r,e,t,a){return a.all(r)}var Ah=lh("type",{invalid:Sw,unknown:Ew,handlers:{comment:bh,doctype:vh,element:kh,raw:Th,root:xh,text:No}});function Sw(r){throw new Error("Expected node, not `"+r+"`")}function Ew(r){let e=r;throw new Error("Cannot compile unknown node `"+e.type+"`")}var ww={},Cw={},kw=[];function fc(r,e){let t=e||ww,a=t.quote||'"',n=a==='"'?"'":'"';if(a!=='"'&&a!=="'")throw new Error("Invalid quote `"+a+"`, expected `'` or `\"`");return{one:Tw,all:xw,settings:{omitOptionalTags:t.omitOptionalTags||!1,allowParseErrors:t.allowParseErrors||!1,allowDangerousCharacters:t.allowDangerousCharacters||!1,quoteSmart:t.quoteSmart||!1,preferUnquoted:t.preferUnquoted||!1,tightAttributes:t.tightAttributes||!1,upperDoctype:t.upperDoctype||!1,tightDoctype:t.tightDoctype||!1,bogusComments:t.bogusComments||!1,tightCommaSeparatedLists:t.tightCommaSeparatedLists||!1,tightSelfClosing:t.tightSelfClosing||!1,collapseEmptyAttributes:t.collapseEmptyAttributes||!1,allowDangerousHtml:t.allowDangerousHtml||!1,voids:t.voids||th,characterReferences:t.characterReferences||Cw,closeSelfClosing:t.closeSelfClosing||!1,closeEmptyElements:t.closeEmptyElements||!1},schema:t.space==="svg"?Ao:oh,quote:a,alternative:n}.one(Array.isArray(r)?{type:"root",children:r}:r,void 0,void 0)}function Tw(r,e,t){return Ah(r,e,t,this)}function xw(r){let e=[],t=r&&r.children||kw,a=-1;for(;++a<t.length;)e[a]=this.one(t[a],a,r);return e.join("")}function Oo(r){let e=this,t={...e.data("settings"),...r};e.compiler=a;function a(n){return fc(n,t)}}var Aw={};function yc(r,e){let t=e||Aw,a=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,n=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return Rh(r,a,n)}function Rh(r,e,t){if(Iw(r)){if("value"in r)return r.type==="html"&&!t?"":r.value;if(e&&"alt"in r&&r.alt)return r.alt;if("children"in r)return Ih(r.children,e,t)}return Array.isArray(r)?Ih(r,e,t):""}function Ih(r,e,t){let a=[],n=-1;for(;++n<r.length;)a[n]=Rh(r[n],e,t);return a.join("")}function Iw(r){return!!(r&&typeof r=="object")}var Ph=document.createElement("i");function na(r){let e="&"+r+";";Ph.innerHTML=e;let t=Ph.textContent;return t.charCodeAt(t.length-1)===59&&r!=="semi"||t===e?!1:t}function lt(r,e,t,a){let n=r.length,i=0,o;if(e<0?e=-e>n?0:n+e:e=e>n?n:e,t=t>0?t:0,a.length<1e4)o=Array.from(a),o.unshift(e,t),r.splice(...o);else for(t&&r.splice(e,t);i<a.length;)o=a.slice(i,i+1e4),o.unshift(e,0),r.splice(...o),i+=1e4,e+=1e4}function pt(r,e){return r.length>0?(lt(r,r.length,0,e),r):e}var Dh={}.hasOwnProperty;function Nh(r){let e={},t=-1;for(;++t<r.length;)Rw(e,r[t]);return e}function Rw(r,e){let t;for(t in e){let n=(Dh.call(r,t)?r[t]:void 0)||(r[t]={}),i=e[t],o;if(i)for(o in i){Dh.call(n,o)||(n[o]=[]);let s=i[o];Pw(n[o],Array.isArray(s)?s:s?[s]:[])}}}function Pw(r,e){let t=-1,a=[];for(;++t<e.length;)(e[t].add==="after"?r:a).push(e[t]);lt(r,0,0,a)}function Lo(r,e){let t=Number.parseInt(r,e);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"\uFFFD":String.fromCodePoint(t)}function _r(r){return r.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var At=Fr(/[A-Za-z]/),Ze=Fr(/[\dA-Za-z]/),Oh=Fr(/[#-'*+\--9=?A-Z^-~]/);function Wa(r){return r!==null&&(r<32||r===127)}var ja=Fr(/\d/),Lh=Fr(/[\dA-Fa-f]/),Mh=Fr(/[!-/:-@[-`{-~]/);function $(r){return r!==null&&r<-2}function Ve(r){return r!==null&&(r<0||r===32)}function ie(r){return r===-2||r===-1||r===32}var Fh=Fr(/\p{P}|\p{S}/u),Bh=Fr(/\s/);function Fr(r){return e;function e(t){return t!==null&&t>-1&&r.test(String.fromCharCode(t))}}function Ut(r){let e=[],t=-1,a=0,n=0;for(;++t<r.length;){let i=r.charCodeAt(t),o="";if(i===37&&Ze(r.charCodeAt(t+1))&&Ze(r.charCodeAt(t+2)))n=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){let s=r.charCodeAt(t+1);i<56320&&s>56319&&s<57344?(o=String.fromCharCode(i,s),n=1):o="\uFFFD"}else o=String.fromCharCode(i);o&&(e.push(r.slice(a,t),encodeURIComponent(o)),a=t+n+1,o=""),n&&(t+=n,n=0)}return e.join("")+r.slice(a)}function oe(r,e,t,a){let n=a?a-1:Number.POSITIVE_INFINITY,i=0;return o;function o(l){return ie(l)?(r.enter(t),s(l)):e(l)}function s(l){return ie(l)&&i++<n?(r.consume(l),s):(r.exit(t),e(l))}}var Gh={tokenize:Dw};function Dw(r){let e=r.attempt(this.parser.constructs.contentInitial,a,n),t;return e;function a(s){if(s===null){r.consume(s);return}return r.enter("lineEnding"),r.consume(s),r.exit("lineEnding"),oe(r,e,"linePrefix")}function n(s){return r.enter("paragraph"),i(s)}function i(s){let l=r.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=l),t=l,o(s)}function o(s){if(s===null){r.exit("chunkText"),r.exit("paragraph"),r.consume(s);return}return $(s)?(r.consume(s),r.exit("chunkText"),i):(r.consume(s),o)}}var Uh={tokenize:Nw},zh={tokenize:Ow};function Nw(r){let e=this,t=[],a=0,n,i,o;return s;function s(E){if(a<t.length){let I=t[a];return e.containerState=I[1],r.attempt(I[0].continuation,l,c)(E)}return c(E)}function l(E){if(a++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,n&&T();let I=e.events.length,D=I,C;for(;D--;)if(e.events[D][0]==="exit"&&e.events[D][1].type==="chunkFlow"){C=e.events[D][1].end;break}v(a);let M=I;for(;M<e.events.length;)e.events[M][1].end=Object.assign({},C),M++;return lt(e.events,D+1,0,e.events.slice(I)),e.events.length=M,c(E)}return s(E)}function c(E){if(a===t.length){if(!n)return m(E);if(n.currentConstruct&&n.currentConstruct.concrete)return g(E);e.interrupt=!!(n.currentConstruct&&!n._gfmTableDynamicInterruptHack)}return e.containerState={},r.check(zh,u,p)(E)}function u(E){return n&&T(),v(a),m(E)}function p(E){return e.parser.lazy[e.now().line]=a!==t.length,o=e.now().offset,g(E)}function m(E){return e.containerState={},r.attempt(zh,d,g)(E)}function d(E){return a++,t.push([e.currentConstruct,e.containerState]),m(E)}function g(E){if(E===null){n&&T(),v(0),r.consume(E);return}return n=n||e.parser.flow(e.now()),r.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:n}),f(E)}function f(E){if(E===null){y(r.exit("chunkFlow"),!0),v(0),r.consume(E);return}return $(E)?(r.consume(E),y(r.exit("chunkFlow")),a=0,e.interrupt=void 0,s):(r.consume(E),f)}function y(E,I){let D=e.sliceStream(E);if(I&&D.push(null),E.previous=i,i&&(i.next=E),i=E,n.defineSkip(E.start),n.write(D),e.parser.lazy[E.start.line]){let C=n.events.length;for(;C--;)if(n.events[C][1].start.offset<o&&(!n.events[C][1].end||n.events[C][1].end.offset>o))return;let M=e.events.length,F=M,R,G;for(;F--;)if(e.events[F][0]==="exit"&&e.events[F][1].type==="chunkFlow"){if(R){G=e.events[F][1].end;break}R=!0}for(v(a),C=M;C<e.events.length;)e.events[C][1].end=Object.assign({},G),C++;lt(e.events,F+1,0,e.events.slice(M)),e.events.length=C}}function v(E){let I=t.length;for(;I-- >E;){let D=t[I];e.containerState=D[1],D[0].exit.call(e,r)}t.length=E}function T(){n.write([null]),i=void 0,n=void 0,e.containerState._closeFlow=void 0}}function Ow(r,e,t){return oe(r,r.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function bc(r){if(r===null||Ve(r)||Bh(r))return 1;if(Fh(r))return 2}function aa(r,e,t){let a=[],n=-1;for(;++n<r.length;){let i=r[n].resolveAll;i&&!a.includes(i)&&(e=i(e,t),a.push(i))}return e}var qa={name:"attention",tokenize:Mw,resolveAll:Lw};function Lw(r,e){let t=-1,a,n,i,o,s,l,c,u;for(;++t<r.length;)if(r[t][0]==="enter"&&r[t][1].type==="attentionSequence"&&r[t][1]._close){for(a=t;a--;)if(r[a][0]==="exit"&&r[a][1].type==="attentionSequence"&&r[a][1]._open&&e.sliceSerialize(r[a][1]).charCodeAt(0)===e.sliceSerialize(r[t][1]).charCodeAt(0)){if((r[a][1]._close||r[t][1]._open)&&(r[t][1].end.offset-r[t][1].start.offset)%3&&!((r[a][1].end.offset-r[a][1].start.offset+r[t][1].end.offset-r[t][1].start.offset)%3))continue;l=r[a][1].end.offset-r[a][1].start.offset>1&&r[t][1].end.offset-r[t][1].start.offset>1?2:1;let p=Object.assign({},r[a][1].end),m=Object.assign({},r[t][1].start);Hh(p,-l),Hh(m,l),o={type:l>1?"strongSequence":"emphasisSequence",start:p,end:Object.assign({},r[a][1].end)},s={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},r[t][1].start),end:m},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},r[a][1].end),end:Object.assign({},r[t][1].start)},n={type:l>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},s.end)},r[a][1].end=Object.assign({},o.start),r[t][1].start=Object.assign({},s.end),c=[],r[a][1].end.offset-r[a][1].start.offset&&(c=pt(c,[["enter",r[a][1],e],["exit",r[a][1],e]])),c=pt(c,[["enter",n,e],["enter",o,e],["exit",o,e],["enter",i,e]]),c=pt(c,aa(e.parser.constructs.insideSpan.null,r.slice(a+1,t),e)),c=pt(c,[["exit",i,e],["enter",s,e],["exit",s,e],["exit",n,e]]),r[t][1].end.offset-r[t][1].start.offset?(u=2,c=pt(c,[["enter",r[t][1],e],["exit",r[t][1],e]])):u=0,lt(r,a-1,t-a+3,c),t=a+c.length-u-2;break}}for(t=-1;++t<r.length;)r[t][1].type==="attentionSequence"&&(r[t][1].type="data");return r}function Mw(r,e){let t=this.parser.constructs.attentionMarkers.null,a=this.previous,n=bc(a),i;return o;function o(l){return i=l,r.enter("attentionSequence"),s(l)}function s(l){if(l===i)return r.consume(l),s;let c=r.exit("attentionSequence"),u=bc(l),p=!u||u===2&&n||t.includes(l),m=!n||n===2&&u||t.includes(a);return c._open=!!(i===42?p:p&&(n||!m)),c._close=!!(i===42?m:m&&(u||!p)),e(l)}}function Hh(r,e){r.column+=e,r.offset+=e,r._bufferIndex+=e}var vc={name:"autolink",tokenize:Fw};function Fw(r,e,t){let a=0;return n;function n(d){return r.enter("autolink"),r.enter("autolinkMarker"),r.consume(d),r.exit("autolinkMarker"),r.enter("autolinkProtocol"),i}function i(d){return At(d)?(r.consume(d),o):d===64?t(d):c(d)}function o(d){return d===43||d===45||d===46||Ze(d)?(a=1,s(d)):c(d)}function s(d){return d===58?(r.consume(d),a=0,l):(d===43||d===45||d===46||Ze(d))&&a++<32?(r.consume(d),s):(a=0,c(d))}function l(d){return d===62?(r.exit("autolinkProtocol"),r.enter("autolinkMarker"),r.consume(d),r.exit("autolinkMarker"),r.exit("autolink"),e):d===null||d===32||d===60||Wa(d)?t(d):(r.consume(d),l)}function c(d){return d===64?(r.consume(d),u):Oh(d)?(r.consume(d),c):t(d)}function u(d){return Ze(d)?p(d):t(d)}function p(d){return d===46?(r.consume(d),a=0,u):d===62?(r.exit("autolinkProtocol").type="autolinkEmail",r.enter("autolinkMarker"),r.consume(d),r.exit("autolinkMarker"),r.exit("autolink"),e):m(d)}function m(d){if((d===45||Ze(d))&&a++<63){let g=d===45?m:p;return r.consume(d),g}return t(d)}}var Br={tokenize:Bw,partial:!0};function Bw(r,e,t){return a;function a(i){return ie(i)?oe(r,n,"linePrefix")(i):n(i)}function n(i){return i===null||$(i)?e(i):t(i)}}var Mo={name:"blockQuote",tokenize:Gw,continuation:{tokenize:zw},exit:Uw};function Gw(r,e,t){let a=this;return n;function n(o){if(o===62){let s=a.containerState;return s.open||(r.enter("blockQuote",{_container:!0}),s.open=!0),r.enter("blockQuotePrefix"),r.enter("blockQuoteMarker"),r.consume(o),r.exit("blockQuoteMarker"),i}return t(o)}function i(o){return ie(o)?(r.enter("blockQuotePrefixWhitespace"),r.consume(o),r.exit("blockQuotePrefixWhitespace"),r.exit("blockQuotePrefix"),e):(r.exit("blockQuotePrefix"),e(o))}}function zw(r,e,t){let a=this;return n;function n(o){return ie(o)?oe(r,i,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return r.attempt(Mo,e,t)(o)}}function Uw(r){r.exit("blockQuote")}var Fo={name:"characterEscape",tokenize:Hw};function Hw(r,e,t){return a;function a(i){return r.enter("characterEscape"),r.enter("escapeMarker"),r.consume(i),r.exit("escapeMarker"),n}function n(i){return Mh(i)?(r.enter("characterEscapeValue"),r.consume(i),r.exit("characterEscapeValue"),r.exit("characterEscape"),e):t(i)}}var Bo={name:"characterReference",tokenize:Vw};function Vw(r,e,t){let a=this,n=0,i,o;return s;function s(p){return r.enter("characterReference"),r.enter("characterReferenceMarker"),r.consume(p),r.exit("characterReferenceMarker"),l}function l(p){return p===35?(r.enter("characterReferenceMarkerNumeric"),r.consume(p),r.exit("characterReferenceMarkerNumeric"),c):(r.enter("characterReferenceValue"),i=31,o=Ze,u(p))}function c(p){return p===88||p===120?(r.enter("characterReferenceMarkerHexadecimal"),r.consume(p),r.exit("characterReferenceMarkerHexadecimal"),r.enter("characterReferenceValue"),i=6,o=Lh,u):(r.enter("characterReferenceValue"),i=7,o=ja,u(p))}function u(p){if(p===59&&n){let m=r.exit("characterReferenceValue");return o===Ze&&!na(a.sliceSerialize(m))?t(p):(r.enter("characterReferenceMarker"),r.consume(p),r.exit("characterReferenceMarker"),r.exit("characterReference"),e)}return o(p)&&n++<i?(r.consume(p),u):t(p)}}var Vh={tokenize:jw,partial:!0},Go={name:"codeFenced",tokenize:Ww,concrete:!0};function Ww(r,e,t){let a=this,n={tokenize:D,partial:!0},i=0,o=0,s;return l;function l(C){return c(C)}function c(C){let M=a.events[a.events.length-1];return i=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,s=C,r.enter("codeFenced"),r.enter("codeFencedFence"),r.enter("codeFencedFenceSequence"),u(C)}function u(C){return C===s?(o++,r.consume(C),u):o<3?t(C):(r.exit("codeFencedFenceSequence"),ie(C)?oe(r,p,"whitespace")(C):p(C))}function p(C){return C===null||$(C)?(r.exit("codeFencedFence"),a.interrupt?e(C):r.check(Vh,f,I)(C)):(r.enter("codeFencedFenceInfo"),r.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||$(C)?(r.exit("chunkString"),r.exit("codeFencedFenceInfo"),p(C)):ie(C)?(r.exit("chunkString"),r.exit("codeFencedFenceInfo"),oe(r,d,"whitespace")(C)):C===96&&C===s?t(C):(r.consume(C),m)}function d(C){return C===null||$(C)?p(C):(r.enter("codeFencedFenceMeta"),r.enter("chunkString",{contentType:"string"}),g(C))}function g(C){return C===null||$(C)?(r.exit("chunkString"),r.exit("codeFencedFenceMeta"),p(C)):C===96&&C===s?t(C):(r.consume(C),g)}function f(C){return r.attempt(n,I,y)(C)}function y(C){return r.enter("lineEnding"),r.consume(C),r.exit("lineEnding"),v}function v(C){return i>0&&ie(C)?oe(r,T,"linePrefix",i+1)(C):T(C)}function T(C){return C===null||$(C)?r.check(Vh,f,I)(C):(r.enter("codeFlowValue"),E(C))}function E(C){return C===null||$(C)?(r.exit("codeFlowValue"),T(C)):(r.consume(C),E)}function I(C){return r.exit("codeFenced"),e(C)}function D(C,M,F){let R=0;return G;function G(B){return C.enter("lineEnding"),C.consume(B),C.exit("lineEnding"),z}function z(B){return C.enter("codeFencedFence"),ie(B)?oe(C,O,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):O(B)}function O(B){return B===s?(C.enter("codeFencedFenceSequence"),x(B)):F(B)}function x(B){return B===s?(R++,C.consume(B),x):R>=o?(C.exit("codeFencedFenceSequence"),ie(B)?oe(C,A,"whitespace")(B):A(B)):F(B)}function A(B){return B===null||$(B)?(C.exit("codeFencedFence"),M(B)):F(B)}}}function jw(r,e,t){let a=this;return n;function n(o){return o===null?t(o):(r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),i)}function i(o){return a.parser.lazy[a.now().line]?t(o):e(o)}}var Ka={name:"codeIndented",tokenize:Kw},qw={tokenize:$w,partial:!0};function Kw(r,e,t){let a=this;return n;function n(c){return r.enter("codeIndented"),oe(r,i,"linePrefix",5)(c)}function i(c){let u=a.events[a.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):t(c)}function o(c){return c===null?l(c):$(c)?r.attempt(qw,o,l)(c):(r.enter("codeFlowValue"),s(c))}function s(c){return c===null||$(c)?(r.exit("codeFlowValue"),o(c)):(r.consume(c),s)}function l(c){return r.exit("codeIndented"),e(c)}}function $w(r,e,t){let a=this;return n;function n(o){return a.parser.lazy[a.now().line]?t(o):$(o)?(r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),n):oe(r,i,"linePrefix",5)(o)}function i(o){let s=a.events[a.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):$(o)?n(o):t(o)}}var _c={name:"codeText",tokenize:Zw,resolve:Xw,previous:Yw};function Xw(r){let e=r.length-4,t=3,a,n;if((r[t][1].type==="lineEnding"||r[t][1].type==="space")&&(r[e][1].type==="lineEnding"||r[e][1].type==="space")){for(a=t;++a<e;)if(r[a][1].type==="codeTextData"){r[t][1].type="codeTextPadding",r[e][1].type="codeTextPadding",t+=2,e-=2;break}}for(a=t-1,e++;++a<=e;)n===void 0?a!==e&&r[a][1].type!=="lineEnding"&&(n=a):(a===e||r[a][1].type==="lineEnding")&&(r[n][1].type="codeTextData",a!==n+2&&(r[n][1].end=r[a-1][1].end,r.splice(n+2,a-n-2),e-=a-n-2,a=n+2),n=void 0);return r}function Yw(r){return r!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Zw(r,e,t){let a=this,n=0,i,o;return s;function s(m){return r.enter("codeText"),r.enter("codeTextSequence"),l(m)}function l(m){return m===96?(r.consume(m),n++,l):(r.exit("codeTextSequence"),c(m))}function c(m){return m===null?t(m):m===32?(r.enter("space"),r.consume(m),r.exit("space"),c):m===96?(o=r.enter("codeTextSequence"),i=0,p(m)):$(m)?(r.enter("lineEnding"),r.consume(m),r.exit("lineEnding"),c):(r.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||$(m)?(r.exit("codeTextData"),c(m)):(r.consume(m),u)}function p(m){return m===96?(r.consume(m),i++,p):i===n?(r.exit("codeTextSequence"),r.exit("codeText"),e(m)):(o.type="codeTextData",u(m))}}var zo=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let a=t??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(e,a):e>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(e,t,a){let n=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-n,Number.POSITIVE_INFINITY);return a&&$a(this.left,a),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),$a(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),$a(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,Number.POSITIVE_INFINITY);$a(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);$a(this.left,t.reverse())}}};function $a(r,e){let t=0;if(e.length<1e4)r.push(...e);else for(;t<e.length;)r.push(...e.slice(t,t+1e4)),t+=1e4}function Uo(r){let e={},t=-1,a,n,i,o,s,l,c,u=new zo(r);for(;++t<u.length;){for(;t in e;)t=e[t];if(a=u.get(t),t&&a[1].type==="chunkFlow"&&u.get(t-1)[1].type==="listItemPrefix"&&(l=a[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(a[0]==="enter")a[1].contentType&&(Object.assign(e,Jw(u,t)),t=e[t],c=!0);else if(a[1]._container){for(i=t,n=void 0;i--&&(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank");)o[0]==="enter"&&(n&&(u.get(n)[1].type="lineEndingBlank"),o[1].type="lineEnding",n=i);n&&(a[1].end=Object.assign({},u.get(n)[1].start),s=u.slice(n,t),s.unshift(a),u.splice(n,t-n+1,s))}}return lt(r,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function Jw(r,e){let t=r.get(e)[1],a=r.get(e)[2],n=e-1,i=[],o=t._tokenizer||a.parser[t.contentType](t.start),s=o.events,l=[],c={},u,p,m=-1,d=t,g=0,f=0,y=[f];for(;d;){for(;r.get(++n)[1]!==d;);i.push(n),d._tokenizer||(u=a.sliceStream(d),d.next||u.push(null),p&&o.defineSkip(d.start),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),p=d,d=d.next}for(d=t;++m<s.length;)s[m][0]==="exit"&&s[m-1][0]==="enter"&&s[m][1].type===s[m-1][1].type&&s[m][1].start.line!==s[m][1].end.line&&(f=m+1,y.push(f),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(o.events=[],d?(d._tokenizer=void 0,d.previous=void 0):y.pop(),m=y.length;m--;){let v=s.slice(y[m],y[m+1]),T=i.pop();l.push([T,T+v.length-1]),r.splice(T,2,v)}for(l.reverse(),m=-1;++m<l.length;)c[g+l[m][0]]=g+l[m][1],g+=l[m][1]-l[m][0]-1;return c}var Sc={tokenize:tC,resolve:eC},Qw={tokenize:rC,partial:!0};function eC(r){return Uo(r),r}function tC(r,e){let t;return a;function a(s){return r.enter("content"),t=r.enter("chunkContent",{contentType:"content"}),n(s)}function n(s){return s===null?i(s):$(s)?r.check(Qw,o,i)(s):(r.consume(s),n)}function i(s){return r.exit("chunkContent"),r.exit("content"),e(s)}function o(s){return r.consume(s),r.exit("chunkContent"),t.next=r.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,n}}function rC(r,e,t){let a=this;return n;function n(o){return r.exit("chunkContent"),r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),oe(r,i,"linePrefix")}function i(o){if(o===null||$(o))return t(o);let s=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):r.interrupt(a.parser.constructs.flow,t,e)(o)}}function Ho(r,e,t,a,n,i,o,s,l){let c=l||Number.POSITIVE_INFINITY,u=0;return p;function p(v){return v===60?(r.enter(a),r.enter(n),r.enter(i),r.consume(v),r.exit(i),m):v===null||v===32||v===41||Wa(v)?t(v):(r.enter(a),r.enter(o),r.enter(s),r.enter("chunkString",{contentType:"string"}),f(v))}function m(v){return v===62?(r.enter(i),r.consume(v),r.exit(i),r.exit(n),r.exit(a),e):(r.enter(s),r.enter("chunkString",{contentType:"string"}),d(v))}function d(v){return v===62?(r.exit("chunkString"),r.exit(s),m(v)):v===null||v===60||$(v)?t(v):(r.consume(v),v===92?g:d)}function g(v){return v===60||v===62||v===92?(r.consume(v),d):d(v)}function f(v){return!u&&(v===null||v===41||Ve(v))?(r.exit("chunkString"),r.exit(s),r.exit(o),r.exit(a),e(v)):u<c&&v===40?(r.consume(v),u++,f):v===41?(r.consume(v),u--,f):v===null||v===32||v===40||Wa(v)?t(v):(r.consume(v),v===92?y:f)}function y(v){return v===40||v===41||v===92?(r.consume(v),f):f(v)}}function Vo(r,e,t,a,n,i){let o=this,s=0,l;return c;function c(d){return r.enter(a),r.enter(n),r.consume(d),r.exit(n),r.enter(i),u}function u(d){return s>999||d===null||d===91||d===93&&!l||d===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?t(d):d===93?(r.exit(i),r.enter(n),r.consume(d),r.exit(n),r.exit(a),e):$(d)?(r.enter("lineEnding"),r.consume(d),r.exit("lineEnding"),u):(r.enter("chunkString",{contentType:"string"}),p(d))}function p(d){return d===null||d===91||d===93||$(d)||s++>999?(r.exit("chunkString"),u(d)):(r.consume(d),l||(l=!ie(d)),d===92?m:p)}function m(d){return d===91||d===92||d===93?(r.consume(d),s++,p):p(d)}}function Wo(r,e,t,a,n,i){let o;return s;function s(m){return m===34||m===39||m===40?(r.enter(a),r.enter(n),r.consume(m),r.exit(n),o=m===40?41:m,l):t(m)}function l(m){return m===o?(r.enter(n),r.consume(m),r.exit(n),r.exit(a),e):(r.enter(i),c(m))}function c(m){return m===o?(r.exit(i),l(o)):m===null?t(m):$(m)?(r.enter("lineEnding"),r.consume(m),r.exit("lineEnding"),oe(r,c,"linePrefix")):(r.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===o||m===null||$(m)?(r.exit("chunkString"),c(m)):(r.consume(m),m===92?p:u)}function p(m){return m===o||m===92?(r.consume(m),u):u(m)}}function vn(r,e){let t;return a;function a(n){return $(n)?(r.enter("lineEnding"),r.consume(n),r.exit("lineEnding"),t=!0,a):ie(n)?oe(r,a,t?"linePrefix":"lineSuffix")(n):e(n)}}var Ec={name:"definition",tokenize:aC},nC={tokenize:iC,partial:!0};function aC(r,e,t){let a=this,n;return i;function i(d){return r.enter("definition"),o(d)}function o(d){return Vo.call(a,r,s,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function s(d){return n=_r(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),d===58?(r.enter("definitionMarker"),r.consume(d),r.exit("definitionMarker"),l):t(d)}function l(d){return Ve(d)?vn(r,c)(d):c(d)}function c(d){return Ho(r,u,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function u(d){return r.attempt(nC,p,p)(d)}function p(d){return ie(d)?oe(r,m,"whitespace")(d):m(d)}function m(d){return d===null||$(d)?(r.exit("definition"),a.parser.defined.push(n),e(d)):t(d)}}function iC(r,e,t){return a;function a(s){return Ve(s)?vn(r,n)(s):t(s)}function n(s){return Wo(r,i,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function i(s){return ie(s)?oe(r,o,"whitespace")(s):o(s)}function o(s){return s===null||$(s)?e(s):t(s)}}var wc={name:"hardBreakEscape",tokenize:oC};function oC(r,e,t){return a;function a(i){return r.enter("hardBreakEscape"),r.consume(i),n}function n(i){return $(i)?(r.exit("hardBreakEscape"),e(i)):t(i)}}var Cc={name:"headingAtx",tokenize:lC,resolve:sC};function sC(r,e){let t=r.length-2,a=3,n,i;return r[a][1].type==="whitespace"&&(a+=2),t-2>a&&r[t][1].type==="whitespace"&&(t-=2),r[t][1].type==="atxHeadingSequence"&&(a===t-1||t-4>a&&r[t-2][1].type==="whitespace")&&(t-=a+1===t?2:4),t>a&&(n={type:"atxHeadingText",start:r[a][1].start,end:r[t][1].end},i={type:"chunkText",start:r[a][1].start,end:r[t][1].end,contentType:"text"},lt(r,a,t-a+1,[["enter",n,e],["enter",i,e],["exit",i,e],["exit",n,e]])),r}function lC(r,e,t){let a=0;return n;function n(u){return r.enter("atxHeading"),i(u)}function i(u){return r.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&a++<6?(r.consume(u),o):u===null||Ve(u)?(r.exit("atxHeadingSequence"),s(u)):t(u)}function s(u){return u===35?(r.enter("atxHeadingSequence"),l(u)):u===null||$(u)?(r.exit("atxHeading"),e(u)):ie(u)?oe(r,s,"whitespace")(u):(r.enter("atxHeadingText"),c(u))}function l(u){return u===35?(r.consume(u),l):(r.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||Ve(u)?(r.exit("atxHeadingText"),s(u)):(r.consume(u),c)}}var Wh=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],kc=["pre","script","style","textarea"];var Tc={name:"htmlFlow",tokenize:pC,resolveTo:dC,concrete:!0},cC={tokenize:hC,partial:!0},uC={tokenize:mC,partial:!0};function dC(r){let e=r.length;for(;e--&&!(r[e][0]==="enter"&&r[e][1].type==="htmlFlow"););return e>1&&r[e-2][1].type==="linePrefix"&&(r[e][1].start=r[e-2][1].start,r[e+1][1].start=r[e-2][1].start,r.splice(e-2,2)),r}function pC(r,e,t){let a=this,n,i,o,s,l;return c;function c(S){return u(S)}function u(S){return r.enter("htmlFlow"),r.enter("htmlFlowData"),r.consume(S),p}function p(S){return S===33?(r.consume(S),m):S===47?(r.consume(S),i=!0,f):S===63?(r.consume(S),n=3,a.interrupt?e:_):At(S)?(r.consume(S),o=String.fromCharCode(S),y):t(S)}function m(S){return S===45?(r.consume(S),n=2,d):S===91?(r.consume(S),n=5,s=0,g):At(S)?(r.consume(S),n=4,a.interrupt?e:_):t(S)}function d(S){return S===45?(r.consume(S),a.interrupt?e:_):t(S)}function g(S){let ne="CDATA[";return S===ne.charCodeAt(s++)?(r.consume(S),s===ne.length?a.interrupt?e:O:g):t(S)}function f(S){return At(S)?(r.consume(S),o=String.fromCharCode(S),y):t(S)}function y(S){if(S===null||S===47||S===62||Ve(S)){let ne=S===47,Te=o.toLowerCase();return!ne&&!i&&kc.includes(Te)?(n=1,a.interrupt?e(S):O(S)):Wh.includes(o.toLowerCase())?(n=6,ne?(r.consume(S),v):a.interrupt?e(S):O(S)):(n=7,a.interrupt&&!a.parser.lazy[a.now().line]?t(S):i?T(S):E(S))}return S===45||Ze(S)?(r.consume(S),o+=String.fromCharCode(S),y):t(S)}function v(S){return S===62?(r.consume(S),a.interrupt?e:O):t(S)}function T(S){return ie(S)?(r.consume(S),T):G(S)}function E(S){return S===47?(r.consume(S),G):S===58||S===95||At(S)?(r.consume(S),I):ie(S)?(r.consume(S),E):G(S)}function I(S){return S===45||S===46||S===58||S===95||Ze(S)?(r.consume(S),I):D(S)}function D(S){return S===61?(r.consume(S),C):ie(S)?(r.consume(S),D):E(S)}function C(S){return S===null||S===60||S===61||S===62||S===96?t(S):S===34||S===39?(r.consume(S),l=S,M):ie(S)?(r.consume(S),C):F(S)}function M(S){return S===l?(r.consume(S),l=null,R):S===null||$(S)?t(S):(r.consume(S),M)}function F(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||Ve(S)?D(S):(r.consume(S),F)}function R(S){return S===47||S===62||ie(S)?E(S):t(S)}function G(S){return S===62?(r.consume(S),z):t(S)}function z(S){return S===null||$(S)?O(S):ie(S)?(r.consume(S),z):t(S)}function O(S){return S===45&&n===2?(r.consume(S),X):S===60&&n===1?(r.consume(S),K):S===62&&n===4?(r.consume(S),ge):S===63&&n===3?(r.consume(S),_):S===93&&n===5?(r.consume(S),Z):$(S)&&(n===6||n===7)?(r.exit("htmlFlowData"),r.check(cC,Ie,x)(S)):S===null||$(S)?(r.exit("htmlFlowData"),x(S)):(r.consume(S),O)}function x(S){return r.check(uC,A,Ie)(S)}function A(S){return r.enter("lineEnding"),r.consume(S),r.exit("lineEnding"),B}function B(S){return S===null||$(S)?x(S):(r.enter("htmlFlowData"),O(S))}function X(S){return S===45?(r.consume(S),_):O(S)}function K(S){return S===47?(r.consume(S),o="",Q):O(S)}function Q(S){if(S===62){let ne=o.toLowerCase();return kc.includes(ne)?(r.consume(S),ge):O(S)}return At(S)&&o.length<8?(r.consume(S),o+=String.fromCharCode(S),Q):O(S)}function Z(S){return S===93?(r.consume(S),_):O(S)}function _(S){return S===62?(r.consume(S),ge):S===45&&n===2?(r.consume(S),_):O(S)}function ge(S){return S===null||$(S)?(r.exit("htmlFlowData"),Ie(S)):(r.consume(S),ge)}function Ie(S){return r.exit("htmlFlow"),e(S)}}function mC(r,e,t){let a=this;return n;function n(o){return $(o)?(r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),i):t(o)}function i(o){return a.parser.lazy[a.now().line]?t(o):e(o)}}function hC(r,e,t){return a;function a(n){return r.enter("lineEnding"),r.consume(n),r.exit("lineEnding"),r.attempt(Br,e,t)}}var xc={name:"htmlText",tokenize:gC};function gC(r,e,t){let a=this,n,i,o;return s;function s(_){return r.enter("htmlText"),r.enter("htmlTextData"),r.consume(_),l}function l(_){return _===33?(r.consume(_),c):_===47?(r.consume(_),D):_===63?(r.consume(_),E):At(_)?(r.consume(_),F):t(_)}function c(_){return _===45?(r.consume(_),u):_===91?(r.consume(_),i=0,g):At(_)?(r.consume(_),T):t(_)}function u(_){return _===45?(r.consume(_),d):t(_)}function p(_){return _===null?t(_):_===45?(r.consume(_),m):$(_)?(o=p,K(_)):(r.consume(_),p)}function m(_){return _===45?(r.consume(_),d):p(_)}function d(_){return _===62?X(_):_===45?m(_):p(_)}function g(_){let ge="CDATA[";return _===ge.charCodeAt(i++)?(r.consume(_),i===ge.length?f:g):t(_)}function f(_){return _===null?t(_):_===93?(r.consume(_),y):$(_)?(o=f,K(_)):(r.consume(_),f)}function y(_){return _===93?(r.consume(_),v):f(_)}function v(_){return _===62?X(_):_===93?(r.consume(_),v):f(_)}function T(_){return _===null||_===62?X(_):$(_)?(o=T,K(_)):(r.consume(_),T)}function E(_){return _===null?t(_):_===63?(r.consume(_),I):$(_)?(o=E,K(_)):(r.consume(_),E)}function I(_){return _===62?X(_):E(_)}function D(_){return At(_)?(r.consume(_),C):t(_)}function C(_){return _===45||Ze(_)?(r.consume(_),C):M(_)}function M(_){return $(_)?(o=M,K(_)):ie(_)?(r.consume(_),M):X(_)}function F(_){return _===45||Ze(_)?(r.consume(_),F):_===47||_===62||Ve(_)?R(_):t(_)}function R(_){return _===47?(r.consume(_),X):_===58||_===95||At(_)?(r.consume(_),G):$(_)?(o=R,K(_)):ie(_)?(r.consume(_),R):X(_)}function G(_){return _===45||_===46||_===58||_===95||Ze(_)?(r.consume(_),G):z(_)}function z(_){return _===61?(r.consume(_),O):$(_)?(o=z,K(_)):ie(_)?(r.consume(_),z):R(_)}function O(_){return _===null||_===60||_===61||_===62||_===96?t(_):_===34||_===39?(r.consume(_),n=_,x):$(_)?(o=O,K(_)):ie(_)?(r.consume(_),O):(r.consume(_),A)}function x(_){return _===n?(r.consume(_),n=void 0,B):_===null?t(_):$(_)?(o=x,K(_)):(r.consume(_),x)}function A(_){return _===null||_===34||_===39||_===60||_===61||_===96?t(_):_===47||_===62||Ve(_)?R(_):(r.consume(_),A)}function B(_){return _===47||_===62||Ve(_)?R(_):t(_)}function X(_){return _===62?(r.consume(_),r.exit("htmlTextData"),r.exit("htmlText"),e):t(_)}function K(_){return r.exit("htmlTextData"),r.enter("lineEnding"),r.consume(_),r.exit("lineEnding"),Q}function Q(_){return ie(_)?oe(r,Z,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):Z(_)}function Z(_){return r.enter("htmlTextData"),o(_)}}var _n={name:"labelEnd",tokenize:SC,resolveTo:_C,resolveAll:vC},fC={tokenize:EC},yC={tokenize:wC},bC={tokenize:CC};function vC(r){let e=-1;for(;++e<r.length;){let t=r[e][1];(t.type==="labelImage"||t.type==="labelLink"||t.type==="labelEnd")&&(r.splice(e+1,t.type==="labelImage"?4:2),t.type="data",e++)}return r}function _C(r,e){let t=r.length,a=0,n,i,o,s;for(;t--;)if(n=r[t][1],i){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;r[t][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(o){if(r[t][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(i=t,n.type!=="labelLink")){a=2;break}}else n.type==="labelEnd"&&(o=t);let l={type:r[i][1].type==="labelLink"?"link":"image",start:Object.assign({},r[i][1].start),end:Object.assign({},r[r.length-1][1].end)},c={type:"label",start:Object.assign({},r[i][1].start),end:Object.assign({},r[o][1].end)},u={type:"labelText",start:Object.assign({},r[i+a+2][1].end),end:Object.assign({},r[o-2][1].start)};return s=[["enter",l,e],["enter",c,e]],s=pt(s,r.slice(i+1,i+a+3)),s=pt(s,[["enter",u,e]]),s=pt(s,aa(e.parser.constructs.insideSpan.null,r.slice(i+a+4,o-3),e)),s=pt(s,[["exit",u,e],r[o-2],r[o-1],["exit",c,e]]),s=pt(s,r.slice(o+1)),s=pt(s,[["exit",l,e]]),lt(r,i,r.length,s),r}function SC(r,e,t){let a=this,n=a.events.length,i,o;for(;n--;)if((a.events[n][1].type==="labelImage"||a.events[n][1].type==="labelLink")&&!a.events[n][1]._balanced){i=a.events[n][1];break}return s;function s(m){return i?i._inactive?p(m):(o=a.parser.defined.includes(_r(a.sliceSerialize({start:i.end,end:a.now()}))),r.enter("labelEnd"),r.enter("labelMarker"),r.consume(m),r.exit("labelMarker"),r.exit("labelEnd"),l):t(m)}function l(m){return m===40?r.attempt(fC,u,o?u:p)(m):m===91?r.attempt(yC,u,o?c:p)(m):o?u(m):p(m)}function c(m){return r.attempt(bC,u,p)(m)}function u(m){return e(m)}function p(m){return i._balanced=!0,t(m)}}function EC(r,e,t){return a;function a(p){return r.enter("resource"),r.enter("resourceMarker"),r.consume(p),r.exit("resourceMarker"),n}function n(p){return Ve(p)?vn(r,i)(p):i(p)}function i(p){return p===41?u(p):Ho(r,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function o(p){return Ve(p)?vn(r,l)(p):u(p)}function s(p){return t(p)}function l(p){return p===34||p===39||p===40?Wo(r,c,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):u(p)}function c(p){return Ve(p)?vn(r,u)(p):u(p)}function u(p){return p===41?(r.enter("resourceMarker"),r.consume(p),r.exit("resourceMarker"),r.exit("resource"),e):t(p)}}function wC(r,e,t){let a=this;return n;function n(s){return Vo.call(a,r,i,o,"reference","referenceMarker","referenceString")(s)}function i(s){return a.parser.defined.includes(_r(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?e(s):t(s)}function o(s){return t(s)}}function CC(r,e,t){return a;function a(i){return r.enter("reference"),r.enter("referenceMarker"),r.consume(i),r.exit("referenceMarker"),n}function n(i){return i===93?(r.enter("referenceMarker"),r.consume(i),r.exit("referenceMarker"),r.exit("reference"),e):t(i)}}var Ac={name:"labelStartImage",tokenize:kC,resolveAll:_n.resolveAll};function kC(r,e,t){let a=this;return n;function n(s){return r.enter("labelImage"),r.enter("labelImageMarker"),r.consume(s),r.exit("labelImageMarker"),i}function i(s){return s===91?(r.enter("labelMarker"),r.consume(s),r.exit("labelMarker"),r.exit("labelImage"),o):t(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in a.parser.constructs?t(s):e(s)}}var Ic={name:"labelStartLink",tokenize:TC,resolveAll:_n.resolveAll};function TC(r,e,t){let a=this;return n;function n(o){return r.enter("labelLink"),r.enter("labelMarker"),r.consume(o),r.exit("labelMarker"),r.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in a.parser.constructs?t(o):e(o)}}var Xa={name:"lineEnding",tokenize:xC};function xC(r,e){return t;function t(a){return r.enter("lineEnding"),r.consume(a),r.exit("lineEnding"),oe(r,e,"linePrefix")}}var Sn={name:"thematicBreak",tokenize:AC};function AC(r,e,t){let a=0,n;return i;function i(c){return r.enter("thematicBreak"),o(c)}function o(c){return n=c,s(c)}function s(c){return c===n?(r.enter("thematicBreakSequence"),l(c)):a>=3&&(c===null||$(c))?(r.exit("thematicBreak"),e(c)):t(c)}function l(c){return c===n?(r.consume(c),a++,l):(r.exit("thematicBreakSequence"),ie(c)?oe(r,s,"whitespace")(c):s(c))}}var ct={name:"list",tokenize:PC,continuation:{tokenize:DC},exit:OC},IC={tokenize:LC,partial:!0},RC={tokenize:NC,partial:!0};function PC(r,e,t){let a=this,n=a.events[a.events.length-1],i=n&&n[1].type==="linePrefix"?n[2].sliceSerialize(n[1],!0).length:0,o=0;return s;function s(d){let g=a.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!a.containerState.marker||d===a.containerState.marker:ja(d)){if(a.containerState.type||(a.containerState.type=g,r.enter(g,{_container:!0})),g==="listUnordered")return r.enter("listItemPrefix"),d===42||d===45?r.check(Sn,t,c)(d):c(d);if(!a.interrupt||d===49)return r.enter("listItemPrefix"),r.enter("listItemValue"),l(d)}return t(d)}function l(d){return ja(d)&&++o<10?(r.consume(d),l):(!a.interrupt||o<2)&&(a.containerState.marker?d===a.containerState.marker:d===41||d===46)?(r.exit("listItemValue"),c(d)):t(d)}function c(d){return r.enter("listItemMarker"),r.consume(d),r.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||d,r.check(Br,a.interrupt?t:u,r.attempt(IC,m,p))}function u(d){return a.containerState.initialBlankLine=!0,i++,m(d)}function p(d){return ie(d)?(r.enter("listItemPrefixWhitespace"),r.consume(d),r.exit("listItemPrefixWhitespace"),m):t(d)}function m(d){return a.containerState.size=i+a.sliceSerialize(r.exit("listItemPrefix"),!0).length,e(d)}}function DC(r,e,t){let a=this;return a.containerState._closeFlow=void 0,r.check(Br,n,i);function n(s){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,oe(r,e,"listItemIndent",a.containerState.size+1)(s)}function i(s){return a.containerState.furtherBlankLines||!ie(s)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,o(s)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,r.attempt(RC,e,o)(s))}function o(s){return a.containerState._closeFlow=!0,a.interrupt=void 0,oe(r,r.attempt(ct,e,t),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function NC(r,e,t){let a=this;return oe(r,n,"listItemIndent",a.containerState.size+1);function n(i){let o=a.events[a.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===a.containerState.size?e(i):t(i)}}function OC(r){r.exit(this.containerState.type)}function LC(r,e,t){let a=this;return oe(r,n,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function n(i){let o=a.events[a.events.length-1];return!ie(i)&&o&&o[1].type==="listItemPrefixWhitespace"?e(i):t(i)}}var jo={name:"setextUnderline",tokenize:FC,resolveTo:MC};function MC(r,e){let t=r.length,a,n,i;for(;t--;)if(r[t][0]==="enter"){if(r[t][1].type==="content"){a=t;break}r[t][1].type==="paragraph"&&(n=t)}else r[t][1].type==="content"&&r.splice(t,1),!i&&r[t][1].type==="definition"&&(i=t);let o={type:"setextHeading",start:Object.assign({},r[n][1].start),end:Object.assign({},r[r.length-1][1].end)};return r[n][1].type="setextHeadingText",i?(r.splice(n,0,["enter",o,e]),r.splice(i+1,0,["exit",r[a][1],e]),r[a][1].end=Object.assign({},r[i][1].end)):r[a][1]=o,r.push(["exit",o,e]),r}function FC(r,e,t){let a=this,n;return i;function i(c){let u=a.events.length,p;for(;u--;)if(a.events[u][1].type!=="lineEnding"&&a.events[u][1].type!=="linePrefix"&&a.events[u][1].type!=="content"){p=a.events[u][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||p)?(r.enter("setextHeadingLine"),n=c,o(c)):t(c)}function o(c){return r.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===n?(r.consume(c),s):(r.exit("setextHeadingLineSequence"),ie(c)?oe(r,l,"lineSuffix")(c):l(c))}function l(c){return c===null||$(c)?(r.exit("setextHeadingLine"),e(c)):t(c)}}var jh={tokenize:BC};function BC(r){let e=this,t=r.attempt(Br,a,r.attempt(this.parser.constructs.flowInitial,n,oe(r,r.attempt(this.parser.constructs.flow,n,r.attempt(Sc,n)),"linePrefix")));return t;function a(i){if(i===null){r.consume(i);return}return r.enter("lineEndingBlank"),r.consume(i),r.exit("lineEndingBlank"),e.currentConstruct=void 0,t}function n(i){if(i===null){r.consume(i);return}return r.enter("lineEnding"),r.consume(i),r.exit("lineEnding"),e.currentConstruct=void 0,t}}var qh={resolveAll:Yh()},Kh=Xh("string"),$h=Xh("text");function Xh(r){return{tokenize:e,resolveAll:Yh(r==="text"?GC:void 0)};function e(t){let a=this,n=this.parser.constructs[r],i=t.attempt(n,o,s);return o;function o(u){return c(u)?i(u):s(u)}function s(u){if(u===null){t.consume(u);return}return t.enter("data"),t.consume(u),l}function l(u){return c(u)?(t.exit("data"),i(u)):(t.consume(u),l)}function c(u){if(u===null)return!0;let p=n[u],m=-1;if(p)for(;++m<p.length;){let d=p[m];if(!d.previous||d.previous.call(a,a.previous))return!0}return!1}}}function Yh(r){return e;function e(t,a){let n=-1,i;for(;++n<=t.length;)i===void 0?t[n]&&t[n][1].type==="data"&&(i=n,n++):(!t[n]||t[n][1].type!=="data")&&(n!==i+2&&(t[i][1].end=t[n-1][1].end,t.splice(i+2,n-i-2),n=i+2),i=void 0);return r?r(t,a):t}}function GC(r,e){let t=0;for(;++t<=r.length;)if((t===r.length||r[t][1].type==="lineEnding")&&r[t-1][1].type==="data"){let a=r[t-1][1],n=e.sliceStream(a),i=n.length,o=-1,s=0,l;for(;i--;){let c=n[i];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(c===-2)l=!0,s++;else if(c!==-1){i++;break}}if(s){let c={type:t===r.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{line:a.end.line,column:a.end.column-s,offset:a.end.offset-s,_index:a.start._index+i,_bufferIndex:i?o:a.start._bufferIndex+o},end:Object.assign({},a.end)};a.end=Object.assign({},c.start),a.start.offset===a.end.offset?Object.assign(a,c):(r.splice(t,0,["enter",c,e],["exit",c,e]),t+=2)}t++}return r}function Zh(r,e,t){let a=Object.assign(t?Object.assign({},t):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),n={},i=[],o=[],s=[],l=!0,c={consume:I,enter:D,exit:C,attempt:R(M),check:R(F),interrupt:R(F,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:r,sliceStream:f,sliceSerialize:g,now:y,defineSkip:v,write:d},p=e.tokenize.call(u,c),m;return e.resolveAll&&i.push(e),u;function d(x){return o=pt(o,x),T(),o[o.length-1]!==null?[]:(G(e,0),u.events=aa(i,u.events,u),u.events)}function g(x,A){return UC(f(x),A)}function f(x){return zC(o,x)}function y(){let{line:x,column:A,offset:B,_index:X,_bufferIndex:K}=a;return{line:x,column:A,offset:B,_index:X,_bufferIndex:K}}function v(x){n[x.line]=x.column,O()}function T(){let x;for(;a._index<o.length;){let A=o[a._index];if(typeof A=="string")for(x=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===x&&a._bufferIndex<A.length;)E(A.charCodeAt(a._bufferIndex));else E(A)}}function E(x){l=void 0,m=x,p=p(x)}function I(x){$(x)?(a.line++,a.column=1,a.offset+=x===-3?2:1,O()):x!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===o[a._index].length&&(a._bufferIndex=-1,a._index++)),u.previous=x,l=!0}function D(x,A){let B=A||{};return B.type=x,B.start=y(),u.events.push(["enter",B,u]),s.push(B),B}function C(x){let A=s.pop();return A.end=y(),u.events.push(["exit",A,u]),A}function M(x,A){G(x,A.from)}function F(x,A){A.restore()}function R(x,A){return B;function B(X,K,Q){let Z,_,ge,Ie;return Array.isArray(X)?ne(X):"tokenize"in X?ne([X]):S(X);function S(Re){return ut;function ut(Se){let Ce=Se!==null&&Re[Se],ht=Se!==null&&Re.null,je=[...Array.isArray(Ce)?Ce:Ce?[Ce]:[],...Array.isArray(ht)?ht:ht?[ht]:[]];return ne(je)(Se)}}function ne(Re){return Z=Re,_=0,Re.length===0?Q:Te(Re[_])}function Te(Re){return ut;function ut(Se){return Ie=z(),ge=Re,Re.partial||(u.currentConstruct=Re),Re.name&&u.parser.constructs.disable.null.includes(Re.name)?We(Se):Re.tokenize.call(A?Object.assign(Object.create(u),A):u,c,Be,We)(Se)}}function Be(Re){return l=!0,x(ge,Ie),K}function We(Re){return l=!0,Ie.restore(),++_<Z.length?Te(Z[_]):Q}}}function G(x,A){x.resolveAll&&!i.includes(x)&&i.push(x),x.resolve&<(u.events,A,u.events.length-A,x.resolve(u.events.slice(A),u)),x.resolveTo&&(u.events=x.resolveTo(u.events,u))}function z(){let x=y(),A=u.previous,B=u.currentConstruct,X=u.events.length,K=Array.from(s);return{restore:Q,from:X};function Q(){a=x,u.previous=A,u.currentConstruct=B,u.events.length=X,s=K,O()}}function O(){a.line in n&&a.column<2&&(a.column=n[a.line],a.offset+=n[a.line]-1)}}function zC(r,e){let t=e.start._index,a=e.start._bufferIndex,n=e.end._index,i=e.end._bufferIndex,o;if(t===n)o=[r[t].slice(a,i)];else{if(o=r.slice(t,n),a>-1){let s=o[0];typeof s=="string"?o[0]=s.slice(a):o.shift()}i>0&&o.push(r[n].slice(0,i))}return o}function UC(r,e){let t=-1,a=[],n;for(;++t<r.length;){let i=r[t],o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
|
|
3445
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Ah(r,e,t,a){let n=a.schema,i=n.space==="svg"?!1:a.settings.omitOptionalTags,o=n.space==="svg"?a.settings.closeEmptyElements:a.settings.voids.includes(r.tagName.toLowerCase()),s=[],l;n.space==="html"&&r.tagName==="svg"&&(a.schema=Ro);let c=Ew(a,r.properties),u=a.all(n.space==="html"&&r.tagName==="template"?r.content:r);return a.schema=n,u&&(o=!1),(c||!i||!xh(r,e,t))&&(s.push("<",r.tagName,c?" "+c:""),o&&(n.space==="svg"||a.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!a.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(u),!o&&(!i||!ja(r,e,t))&&s.push("</"+r.tagName+">"),s.join("")}function Ew(r,e){let t=[],a=-1,n;if(e){for(n in e)if(e[n]!==null&&e[n]!==void 0){let i=ww(r,n,e[n]);i&&t.push(i)}}for(;++a<t.length;){let i=r.settings.tightAttributes?t[a].charAt(t[a].length-1):void 0;a!==t.length-1&&i!=='"'&&i!=="'"&&(t[a]+=" ")}return t.join("")}function ww(r,e,t){let a=mc(r.schema,e),n=r.settings.allowParseErrors&&r.schema.space==="html"?0:1,i=r.settings.allowDangerousCharacters?0:1,o=r.quote,s;if(a.overloadedBoolean&&(t===a.attribute||t==="")?t=!0:(a.boolean||a.overloadedBoolean&&typeof t!="string")&&(t=!!t),t==null||t===!1||typeof t=="number"&&Number.isNaN(t))return"";let l=Er(a.attribute,Object.assign({},r.settings.characterReferences,{subset:Oo.name[n][i]}));return t===!0||(t=Array.isArray(t)?(a.commaSeparated?wh:Km)(t,{padLeft:!r.settings.tightCommaSeparatedLists}):String(t),r.settings.collapseEmptyAttributes&&!t)?l:(r.settings.preferUnquoted&&(s=Er(t,Object.assign({},r.settings.characterReferences,{attribute:!0,subset:Oo.unquoted[n][i]}))),s!==t&&(r.settings.quoteSmart&&gc(t,o)>gc(t,r.alternative)&&(o=r.alternative),s=o+Er(t,Object.assign({},r.settings.characterReferences,{subset:(o==="'"?Oo.single:Oo.double)[n][i],attribute:!0}))+o),l+(s&&"="+s))}var Cw=["<","&"];function Lo(r,e,t,a){return t&&t.type==="element"&&(t.tagName==="script"||t.tagName==="style")?r.value:Er(r.value,Object.assign({},a.settings.characterReferences,{subset:Cw}))}function Ih(r,e,t,a){return a.settings.allowDangerousHtml?r.value:Lo(r,e,t,a)}function Rh(r,e,t,a){return a.all(r)}var Ph=dh("type",{invalid:kw,unknown:Tw,handlers:{comment:Sh,doctype:Eh,element:Ah,raw:Ih,root:Rh,text:Lo}});function kw(r){throw new Error("Expected node, not `"+r+"`")}function Tw(r){let e=r;throw new Error("Cannot compile unknown node `"+e.type+"`")}var xw={},Aw={},Iw=[];function bc(r,e){let t=e||xw,a=t.quote||'"',n=a==='"'?"'":'"';if(a!=='"'&&a!=="'")throw new Error("Invalid quote `"+a+"`, expected `'` or `\"`");return{one:Rw,all:Pw,settings:{omitOptionalTags:t.omitOptionalTags||!1,allowParseErrors:t.allowParseErrors||!1,allowDangerousCharacters:t.allowDangerousCharacters||!1,quoteSmart:t.quoteSmart||!1,preferUnquoted:t.preferUnquoted||!1,tightAttributes:t.tightAttributes||!1,upperDoctype:t.upperDoctype||!1,tightDoctype:t.tightDoctype||!1,bogusComments:t.bogusComments||!1,tightCommaSeparatedLists:t.tightCommaSeparatedLists||!1,tightSelfClosing:t.tightSelfClosing||!1,collapseEmptyAttributes:t.collapseEmptyAttributes||!1,allowDangerousHtml:t.allowDangerousHtml||!1,voids:t.voids||ah,characterReferences:t.characterReferences||Aw,closeSelfClosing:t.closeSelfClosing||!1,closeEmptyElements:t.closeEmptyElements||!1},schema:t.space==="svg"?Ro:ch,quote:a,alternative:n}.one(Array.isArray(r)?{type:"root",children:r}:r,void 0,void 0)}function Rw(r,e,t){return Ph(r,e,t,this)}function Pw(r){let e=[],t=r&&r.children||Iw,a=-1;for(;++a<t.length;)e[a]=this.one(t[a],a,r);return e.join("")}function Mo(r){let e=this,t={...e.data("settings"),...r};e.compiler=a;function a(n){return bc(n,t)}}var Dw={};function vc(r,e){let t=e||Dw,a=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,n=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return Nh(r,a,n)}function Nh(r,e,t){if(Nw(r)){if("value"in r)return r.type==="html"&&!t?"":r.value;if(e&&"alt"in r&&r.alt)return r.alt;if("children"in r)return Dh(r.children,e,t)}return Array.isArray(r)?Dh(r,e,t):""}function Dh(r,e,t){let a=[],n=-1;for(;++n<r.length;)a[n]=Nh(r[n],e,t);return a.join("")}function Nw(r){return!!(r&&typeof r=="object")}var Oh=document.createElement("i");function ia(r){let e="&"+r+";";Oh.innerHTML=e;let t=Oh.textContent;return t.charCodeAt(t.length-1)===59&&r!=="semi"||t===e?!1:t}function lt(r,e,t,a){let n=r.length,i=0,o;if(e<0?e=-e>n?0:n+e:e=e>n?n:e,t=t>0?t:0,a.length<1e4)o=Array.from(a),o.unshift(e,t),r.splice(...o);else for(t&&r.splice(e,t);i<a.length;)o=a.slice(i,i+1e4),o.unshift(e,0),r.splice(...o),i+=1e4,e+=1e4}function mt(r,e){return r.length>0?(lt(r,r.length,0,e),r):e}var Lh={}.hasOwnProperty;function Mh(r){let e={},t=-1;for(;++t<r.length;)Ow(e,r[t]);return e}function Ow(r,e){let t;for(t in e){let n=(Lh.call(r,t)?r[t]:void 0)||(r[t]={}),i=e[t],o;if(i)for(o in i){Lh.call(n,o)||(n[o]=[]);let s=i[o];Lw(n[o],Array.isArray(s)?s:s?[s]:[])}}}function Lw(r,e){let t=-1,a=[];for(;++t<e.length;)(e[t].add==="after"?r:a).push(e[t]);lt(r,0,0,a)}function Fo(r,e){let t=Number.parseInt(r,e);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"\uFFFD":String.fromCodePoint(t)}function wr(r){return r.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var Rt=Gr(/[A-Za-z]/),Ze=Gr(/[\dA-Za-z]/),Fh=Gr(/[#-'*+\--9=?A-Z^-~]/);function qa(r){return r!==null&&(r<32||r===127)}var Ka=Gr(/\d/),Bh=Gr(/[\dA-Fa-f]/),Gh=Gr(/[!-/:-@[-`{-~]/);function $(r){return r!==null&&r<-2}function Ve(r){return r!==null&&(r<0||r===32)}function ie(r){return r===-2||r===-1||r===32}var zh=Gr(/\p{P}|\p{S}/u),Uh=Gr(/\s/);function Gr(r){return e;function e(t){return t!==null&&t>-1&&r.test(String.fromCharCode(t))}}function Vt(r){let e=[],t=-1,a=0,n=0;for(;++t<r.length;){let i=r.charCodeAt(t),o="";if(i===37&&Ze(r.charCodeAt(t+1))&&Ze(r.charCodeAt(t+2)))n=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){let s=r.charCodeAt(t+1);i<56320&&s>56319&&s<57344?(o=String.fromCharCode(i,s),n=1):o="\uFFFD"}else o=String.fromCharCode(i);o&&(e.push(r.slice(a,t),encodeURIComponent(o)),a=t+n+1,o=""),n&&(t+=n,n=0)}return e.join("")+r.slice(a)}function oe(r,e,t,a){let n=a?a-1:Number.POSITIVE_INFINITY,i=0;return o;function o(l){return ie(l)?(r.enter(t),s(l)):e(l)}function s(l){return ie(l)&&i++<n?(r.consume(l),s):(r.exit(t),e(l))}}var Hh={tokenize:Mw};function Mw(r){let e=r.attempt(this.parser.constructs.contentInitial,a,n),t;return e;function a(s){if(s===null){r.consume(s);return}return r.enter("lineEnding"),r.consume(s),r.exit("lineEnding"),oe(r,e,"linePrefix")}function n(s){return r.enter("paragraph"),i(s)}function i(s){let l=r.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=l),t=l,o(s)}function o(s){if(s===null){r.exit("chunkText"),r.exit("paragraph"),r.consume(s);return}return $(s)?(r.consume(s),r.exit("chunkText"),i):(r.consume(s),o)}}var Wh={tokenize:Fw},Vh={tokenize:Bw};function Fw(r){let e=this,t=[],a=0,n,i,o;return s;function s(E){if(a<t.length){let I=t[a];return e.containerState=I[1],r.attempt(I[0].continuation,l,c)(E)}return c(E)}function l(E){if(a++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,n&&T();let I=e.events.length,D=I,C;for(;D--;)if(e.events[D][0]==="exit"&&e.events[D][1].type==="chunkFlow"){C=e.events[D][1].end;break}v(a);let M=I;for(;M<e.events.length;)e.events[M][1].end=Object.assign({},C),M++;return lt(e.events,D+1,0,e.events.slice(I)),e.events.length=M,c(E)}return s(E)}function c(E){if(a===t.length){if(!n)return m(E);if(n.currentConstruct&&n.currentConstruct.concrete)return g(E);e.interrupt=!!(n.currentConstruct&&!n._gfmTableDynamicInterruptHack)}return e.containerState={},r.check(Vh,u,p)(E)}function u(E){return n&&T(),v(a),m(E)}function p(E){return e.parser.lazy[e.now().line]=a!==t.length,o=e.now().offset,g(E)}function m(E){return e.containerState={},r.attempt(Vh,d,g)(E)}function d(E){return a++,t.push([e.currentConstruct,e.containerState]),m(E)}function g(E){if(E===null){n&&T(),v(0),r.consume(E);return}return n=n||e.parser.flow(e.now()),r.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:n}),f(E)}function f(E){if(E===null){y(r.exit("chunkFlow"),!0),v(0),r.consume(E);return}return $(E)?(r.consume(E),y(r.exit("chunkFlow")),a=0,e.interrupt=void 0,s):(r.consume(E),f)}function y(E,I){let D=e.sliceStream(E);if(I&&D.push(null),E.previous=i,i&&(i.next=E),i=E,n.defineSkip(E.start),n.write(D),e.parser.lazy[E.start.line]){let C=n.events.length;for(;C--;)if(n.events[C][1].start.offset<o&&(!n.events[C][1].end||n.events[C][1].end.offset>o))return;let M=e.events.length,F=M,R,G;for(;F--;)if(e.events[F][0]==="exit"&&e.events[F][1].type==="chunkFlow"){if(R){G=e.events[F][1].end;break}R=!0}for(v(a),C=M;C<e.events.length;)e.events[C][1].end=Object.assign({},G),C++;lt(e.events,F+1,0,e.events.slice(M)),e.events.length=C}}function v(E){let I=t.length;for(;I-- >E;){let D=t[I];e.containerState=D[1],D[0].exit.call(e,r)}t.length=E}function T(){n.write([null]),i=void 0,n=void 0,e.containerState._closeFlow=void 0}}function Bw(r,e,t){return oe(r,r.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function _c(r){if(r===null||Ve(r)||Uh(r))return 1;if(zh(r))return 2}function oa(r,e,t){let a=[],n=-1;for(;++n<r.length;){let i=r[n].resolveAll;i&&!a.includes(i)&&(e=i(e,t),a.push(i))}return e}var $a={name:"attention",tokenize:zw,resolveAll:Gw};function Gw(r,e){let t=-1,a,n,i,o,s,l,c,u;for(;++t<r.length;)if(r[t][0]==="enter"&&r[t][1].type==="attentionSequence"&&r[t][1]._close){for(a=t;a--;)if(r[a][0]==="exit"&&r[a][1].type==="attentionSequence"&&r[a][1]._open&&e.sliceSerialize(r[a][1]).charCodeAt(0)===e.sliceSerialize(r[t][1]).charCodeAt(0)){if((r[a][1]._close||r[t][1]._open)&&(r[t][1].end.offset-r[t][1].start.offset)%3&&!((r[a][1].end.offset-r[a][1].start.offset+r[t][1].end.offset-r[t][1].start.offset)%3))continue;l=r[a][1].end.offset-r[a][1].start.offset>1&&r[t][1].end.offset-r[t][1].start.offset>1?2:1;let p=Object.assign({},r[a][1].end),m=Object.assign({},r[t][1].start);jh(p,-l),jh(m,l),o={type:l>1?"strongSequence":"emphasisSequence",start:p,end:Object.assign({},r[a][1].end)},s={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},r[t][1].start),end:m},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},r[a][1].end),end:Object.assign({},r[t][1].start)},n={type:l>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},s.end)},r[a][1].end=Object.assign({},o.start),r[t][1].start=Object.assign({},s.end),c=[],r[a][1].end.offset-r[a][1].start.offset&&(c=mt(c,[["enter",r[a][1],e],["exit",r[a][1],e]])),c=mt(c,[["enter",n,e],["enter",o,e],["exit",o,e],["enter",i,e]]),c=mt(c,oa(e.parser.constructs.insideSpan.null,r.slice(a+1,t),e)),c=mt(c,[["exit",i,e],["enter",s,e],["exit",s,e],["exit",n,e]]),r[t][1].end.offset-r[t][1].start.offset?(u=2,c=mt(c,[["enter",r[t][1],e],["exit",r[t][1],e]])):u=0,lt(r,a-1,t-a+3,c),t=a+c.length-u-2;break}}for(t=-1;++t<r.length;)r[t][1].type==="attentionSequence"&&(r[t][1].type="data");return r}function zw(r,e){let t=this.parser.constructs.attentionMarkers.null,a=this.previous,n=_c(a),i;return o;function o(l){return i=l,r.enter("attentionSequence"),s(l)}function s(l){if(l===i)return r.consume(l),s;let c=r.exit("attentionSequence"),u=_c(l),p=!u||u===2&&n||t.includes(l),m=!n||n===2&&u||t.includes(a);return c._open=!!(i===42?p:p&&(n||!m)),c._close=!!(i===42?m:m&&(u||!p)),e(l)}}function jh(r,e){r.column+=e,r.offset+=e,r._bufferIndex+=e}var Sc={name:"autolink",tokenize:Uw};function Uw(r,e,t){let a=0;return n;function n(d){return r.enter("autolink"),r.enter("autolinkMarker"),r.consume(d),r.exit("autolinkMarker"),r.enter("autolinkProtocol"),i}function i(d){return Rt(d)?(r.consume(d),o):d===64?t(d):c(d)}function o(d){return d===43||d===45||d===46||Ze(d)?(a=1,s(d)):c(d)}function s(d){return d===58?(r.consume(d),a=0,l):(d===43||d===45||d===46||Ze(d))&&a++<32?(r.consume(d),s):(a=0,c(d))}function l(d){return d===62?(r.exit("autolinkProtocol"),r.enter("autolinkMarker"),r.consume(d),r.exit("autolinkMarker"),r.exit("autolink"),e):d===null||d===32||d===60||qa(d)?t(d):(r.consume(d),l)}function c(d){return d===64?(r.consume(d),u):Fh(d)?(r.consume(d),c):t(d)}function u(d){return Ze(d)?p(d):t(d)}function p(d){return d===46?(r.consume(d),a=0,u):d===62?(r.exit("autolinkProtocol").type="autolinkEmail",r.enter("autolinkMarker"),r.consume(d),r.exit("autolinkMarker"),r.exit("autolink"),e):m(d)}function m(d){if((d===45||Ze(d))&&a++<63){let g=d===45?m:p;return r.consume(d),g}return t(d)}}var zr={tokenize:Hw,partial:!0};function Hw(r,e,t){return a;function a(i){return ie(i)?oe(r,n,"linePrefix")(i):n(i)}function n(i){return i===null||$(i)?e(i):t(i)}}var Bo={name:"blockQuote",tokenize:Vw,continuation:{tokenize:Ww},exit:jw};function Vw(r,e,t){let a=this;return n;function n(o){if(o===62){let s=a.containerState;return s.open||(r.enter("blockQuote",{_container:!0}),s.open=!0),r.enter("blockQuotePrefix"),r.enter("blockQuoteMarker"),r.consume(o),r.exit("blockQuoteMarker"),i}return t(o)}function i(o){return ie(o)?(r.enter("blockQuotePrefixWhitespace"),r.consume(o),r.exit("blockQuotePrefixWhitespace"),r.exit("blockQuotePrefix"),e):(r.exit("blockQuotePrefix"),e(o))}}function Ww(r,e,t){let a=this;return n;function n(o){return ie(o)?oe(r,i,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return r.attempt(Bo,e,t)(o)}}function jw(r){r.exit("blockQuote")}var Go={name:"characterEscape",tokenize:qw};function qw(r,e,t){return a;function a(i){return r.enter("characterEscape"),r.enter("escapeMarker"),r.consume(i),r.exit("escapeMarker"),n}function n(i){return Gh(i)?(r.enter("characterEscapeValue"),r.consume(i),r.exit("characterEscapeValue"),r.exit("characterEscape"),e):t(i)}}var zo={name:"characterReference",tokenize:Kw};function Kw(r,e,t){let a=this,n=0,i,o;return s;function s(p){return r.enter("characterReference"),r.enter("characterReferenceMarker"),r.consume(p),r.exit("characterReferenceMarker"),l}function l(p){return p===35?(r.enter("characterReferenceMarkerNumeric"),r.consume(p),r.exit("characterReferenceMarkerNumeric"),c):(r.enter("characterReferenceValue"),i=31,o=Ze,u(p))}function c(p){return p===88||p===120?(r.enter("characterReferenceMarkerHexadecimal"),r.consume(p),r.exit("characterReferenceMarkerHexadecimal"),r.enter("characterReferenceValue"),i=6,o=Bh,u):(r.enter("characterReferenceValue"),i=7,o=Ka,u(p))}function u(p){if(p===59&&n){let m=r.exit("characterReferenceValue");return o===Ze&&!ia(a.sliceSerialize(m))?t(p):(r.enter("characterReferenceMarker"),r.consume(p),r.exit("characterReferenceMarker"),r.exit("characterReference"),e)}return o(p)&&n++<i?(r.consume(p),u):t(p)}}var qh={tokenize:Xw,partial:!0},Uo={name:"codeFenced",tokenize:$w,concrete:!0};function $w(r,e,t){let a=this,n={tokenize:D,partial:!0},i=0,o=0,s;return l;function l(C){return c(C)}function c(C){let M=a.events[a.events.length-1];return i=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,s=C,r.enter("codeFenced"),r.enter("codeFencedFence"),r.enter("codeFencedFenceSequence"),u(C)}function u(C){return C===s?(o++,r.consume(C),u):o<3?t(C):(r.exit("codeFencedFenceSequence"),ie(C)?oe(r,p,"whitespace")(C):p(C))}function p(C){return C===null||$(C)?(r.exit("codeFencedFence"),a.interrupt?e(C):r.check(qh,f,I)(C)):(r.enter("codeFencedFenceInfo"),r.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||$(C)?(r.exit("chunkString"),r.exit("codeFencedFenceInfo"),p(C)):ie(C)?(r.exit("chunkString"),r.exit("codeFencedFenceInfo"),oe(r,d,"whitespace")(C)):C===96&&C===s?t(C):(r.consume(C),m)}function d(C){return C===null||$(C)?p(C):(r.enter("codeFencedFenceMeta"),r.enter("chunkString",{contentType:"string"}),g(C))}function g(C){return C===null||$(C)?(r.exit("chunkString"),r.exit("codeFencedFenceMeta"),p(C)):C===96&&C===s?t(C):(r.consume(C),g)}function f(C){return r.attempt(n,I,y)(C)}function y(C){return r.enter("lineEnding"),r.consume(C),r.exit("lineEnding"),v}function v(C){return i>0&&ie(C)?oe(r,T,"linePrefix",i+1)(C):T(C)}function T(C){return C===null||$(C)?r.check(qh,f,I)(C):(r.enter("codeFlowValue"),E(C))}function E(C){return C===null||$(C)?(r.exit("codeFlowValue"),T(C)):(r.consume(C),E)}function I(C){return r.exit("codeFenced"),e(C)}function D(C,M,F){let R=0;return G;function G(B){return C.enter("lineEnding"),C.consume(B),C.exit("lineEnding"),z}function z(B){return C.enter("codeFencedFence"),ie(B)?oe(C,O,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):O(B)}function O(B){return B===s?(C.enter("codeFencedFenceSequence"),x(B)):F(B)}function x(B){return B===s?(R++,C.consume(B),x):R>=o?(C.exit("codeFencedFenceSequence"),ie(B)?oe(C,A,"whitespace")(B):A(B)):F(B)}function A(B){return B===null||$(B)?(C.exit("codeFencedFence"),M(B)):F(B)}}}function Xw(r,e,t){let a=this;return n;function n(o){return o===null?t(o):(r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),i)}function i(o){return a.parser.lazy[a.now().line]?t(o):e(o)}}var Xa={name:"codeIndented",tokenize:Zw},Yw={tokenize:Jw,partial:!0};function Zw(r,e,t){let a=this;return n;function n(c){return r.enter("codeIndented"),oe(r,i,"linePrefix",5)(c)}function i(c){let u=a.events[a.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):t(c)}function o(c){return c===null?l(c):$(c)?r.attempt(Yw,o,l)(c):(r.enter("codeFlowValue"),s(c))}function s(c){return c===null||$(c)?(r.exit("codeFlowValue"),o(c)):(r.consume(c),s)}function l(c){return r.exit("codeIndented"),e(c)}}function Jw(r,e,t){let a=this;return n;function n(o){return a.parser.lazy[a.now().line]?t(o):$(o)?(r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),n):oe(r,i,"linePrefix",5)(o)}function i(o){let s=a.events[a.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):$(o)?n(o):t(o)}}var Ec={name:"codeText",tokenize:tC,resolve:Qw,previous:eC};function Qw(r){let e=r.length-4,t=3,a,n;if((r[t][1].type==="lineEnding"||r[t][1].type==="space")&&(r[e][1].type==="lineEnding"||r[e][1].type==="space")){for(a=t;++a<e;)if(r[a][1].type==="codeTextData"){r[t][1].type="codeTextPadding",r[e][1].type="codeTextPadding",t+=2,e-=2;break}}for(a=t-1,e++;++a<=e;)n===void 0?a!==e&&r[a][1].type!=="lineEnding"&&(n=a):(a===e||r[a][1].type==="lineEnding")&&(r[n][1].type="codeTextData",a!==n+2&&(r[n][1].end=r[a-1][1].end,r.splice(n+2,a-n-2),e-=a-n-2,a=n+2),n=void 0);return r}function eC(r){return r!==96||this.events[this.events.length-1][1].type==="characterEscape"}function tC(r,e,t){let a=this,n=0,i,o;return s;function s(m){return r.enter("codeText"),r.enter("codeTextSequence"),l(m)}function l(m){return m===96?(r.consume(m),n++,l):(r.exit("codeTextSequence"),c(m))}function c(m){return m===null?t(m):m===32?(r.enter("space"),r.consume(m),r.exit("space"),c):m===96?(o=r.enter("codeTextSequence"),i=0,p(m)):$(m)?(r.enter("lineEnding"),r.consume(m),r.exit("lineEnding"),c):(r.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||$(m)?(r.exit("codeTextData"),c(m)):(r.consume(m),u)}function p(m){return m===96?(r.consume(m),i++,p):i===n?(r.exit("codeTextSequence"),r.exit("codeText"),e(m)):(o.type="codeTextData",u(m))}}var Ho=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let a=t??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(e,a):e>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(e,t,a){let n=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-n,Number.POSITIVE_INFINITY);return a&&Ya(this.left,a),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Ya(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Ya(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,Number.POSITIVE_INFINITY);Ya(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Ya(this.left,t.reverse())}}};function Ya(r,e){let t=0;if(e.length<1e4)r.push(...e);else for(;t<e.length;)r.push(...e.slice(t,t+1e4)),t+=1e4}function Vo(r){let e={},t=-1,a,n,i,o,s,l,c,u=new Ho(r);for(;++t<u.length;){for(;t in e;)t=e[t];if(a=u.get(t),t&&a[1].type==="chunkFlow"&&u.get(t-1)[1].type==="listItemPrefix"&&(l=a[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(a[0]==="enter")a[1].contentType&&(Object.assign(e,rC(u,t)),t=e[t],c=!0);else if(a[1]._container){for(i=t,n=void 0;i--&&(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank");)o[0]==="enter"&&(n&&(u.get(n)[1].type="lineEndingBlank"),o[1].type="lineEnding",n=i);n&&(a[1].end=Object.assign({},u.get(n)[1].start),s=u.slice(n,t),s.unshift(a),u.splice(n,t-n+1,s))}}return lt(r,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function rC(r,e){let t=r.get(e)[1],a=r.get(e)[2],n=e-1,i=[],o=t._tokenizer||a.parser[t.contentType](t.start),s=o.events,l=[],c={},u,p,m=-1,d=t,g=0,f=0,y=[f];for(;d;){for(;r.get(++n)[1]!==d;);i.push(n),d._tokenizer||(u=a.sliceStream(d),d.next||u.push(null),p&&o.defineSkip(d.start),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),p=d,d=d.next}for(d=t;++m<s.length;)s[m][0]==="exit"&&s[m-1][0]==="enter"&&s[m][1].type===s[m-1][1].type&&s[m][1].start.line!==s[m][1].end.line&&(f=m+1,y.push(f),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(o.events=[],d?(d._tokenizer=void 0,d.previous=void 0):y.pop(),m=y.length;m--;){let v=s.slice(y[m],y[m+1]),T=i.pop();l.push([T,T+v.length-1]),r.splice(T,2,v)}for(l.reverse(),m=-1;++m<l.length;)c[g+l[m][0]]=g+l[m][1],g+=l[m][1]-l[m][0]-1;return c}var wc={tokenize:iC,resolve:aC},nC={tokenize:oC,partial:!0};function aC(r){return Vo(r),r}function iC(r,e){let t;return a;function a(s){return r.enter("content"),t=r.enter("chunkContent",{contentType:"content"}),n(s)}function n(s){return s===null?i(s):$(s)?r.check(nC,o,i)(s):(r.consume(s),n)}function i(s){return r.exit("chunkContent"),r.exit("content"),e(s)}function o(s){return r.consume(s),r.exit("chunkContent"),t.next=r.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,n}}function oC(r,e,t){let a=this;return n;function n(o){return r.exit("chunkContent"),r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),oe(r,i,"linePrefix")}function i(o){if(o===null||$(o))return t(o);let s=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):r.interrupt(a.parser.constructs.flow,t,e)(o)}}function Wo(r,e,t,a,n,i,o,s,l){let c=l||Number.POSITIVE_INFINITY,u=0;return p;function p(v){return v===60?(r.enter(a),r.enter(n),r.enter(i),r.consume(v),r.exit(i),m):v===null||v===32||v===41||qa(v)?t(v):(r.enter(a),r.enter(o),r.enter(s),r.enter("chunkString",{contentType:"string"}),f(v))}function m(v){return v===62?(r.enter(i),r.consume(v),r.exit(i),r.exit(n),r.exit(a),e):(r.enter(s),r.enter("chunkString",{contentType:"string"}),d(v))}function d(v){return v===62?(r.exit("chunkString"),r.exit(s),m(v)):v===null||v===60||$(v)?t(v):(r.consume(v),v===92?g:d)}function g(v){return v===60||v===62||v===92?(r.consume(v),d):d(v)}function f(v){return!u&&(v===null||v===41||Ve(v))?(r.exit("chunkString"),r.exit(s),r.exit(o),r.exit(a),e(v)):u<c&&v===40?(r.consume(v),u++,f):v===41?(r.consume(v),u--,f):v===null||v===32||v===40||qa(v)?t(v):(r.consume(v),v===92?y:f)}function y(v){return v===40||v===41||v===92?(r.consume(v),f):f(v)}}function jo(r,e,t,a,n,i){let o=this,s=0,l;return c;function c(d){return r.enter(a),r.enter(n),r.consume(d),r.exit(n),r.enter(i),u}function u(d){return s>999||d===null||d===91||d===93&&!l||d===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?t(d):d===93?(r.exit(i),r.enter(n),r.consume(d),r.exit(n),r.exit(a),e):$(d)?(r.enter("lineEnding"),r.consume(d),r.exit("lineEnding"),u):(r.enter("chunkString",{contentType:"string"}),p(d))}function p(d){return d===null||d===91||d===93||$(d)||s++>999?(r.exit("chunkString"),u(d)):(r.consume(d),l||(l=!ie(d)),d===92?m:p)}function m(d){return d===91||d===92||d===93?(r.consume(d),s++,p):p(d)}}function qo(r,e,t,a,n,i){let o;return s;function s(m){return m===34||m===39||m===40?(r.enter(a),r.enter(n),r.consume(m),r.exit(n),o=m===40?41:m,l):t(m)}function l(m){return m===o?(r.enter(n),r.consume(m),r.exit(n),r.exit(a),e):(r.enter(i),c(m))}function c(m){return m===o?(r.exit(i),l(o)):m===null?t(m):$(m)?(r.enter("lineEnding"),r.consume(m),r.exit("lineEnding"),oe(r,c,"linePrefix")):(r.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===o||m===null||$(m)?(r.exit("chunkString"),c(m)):(r.consume(m),m===92?p:u)}function p(m){return m===o||m===92?(r.consume(m),u):u(m)}}function Sn(r,e){let t;return a;function a(n){return $(n)?(r.enter("lineEnding"),r.consume(n),r.exit("lineEnding"),t=!0,a):ie(n)?oe(r,a,t?"linePrefix":"lineSuffix")(n):e(n)}}var Cc={name:"definition",tokenize:lC},sC={tokenize:cC,partial:!0};function lC(r,e,t){let a=this,n;return i;function i(d){return r.enter("definition"),o(d)}function o(d){return jo.call(a,r,s,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function s(d){return n=wr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),d===58?(r.enter("definitionMarker"),r.consume(d),r.exit("definitionMarker"),l):t(d)}function l(d){return Ve(d)?Sn(r,c)(d):c(d)}function c(d){return Wo(r,u,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function u(d){return r.attempt(sC,p,p)(d)}function p(d){return ie(d)?oe(r,m,"whitespace")(d):m(d)}function m(d){return d===null||$(d)?(r.exit("definition"),a.parser.defined.push(n),e(d)):t(d)}}function cC(r,e,t){return a;function a(s){return Ve(s)?Sn(r,n)(s):t(s)}function n(s){return qo(r,i,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function i(s){return ie(s)?oe(r,o,"whitespace")(s):o(s)}function o(s){return s===null||$(s)?e(s):t(s)}}var kc={name:"hardBreakEscape",tokenize:uC};function uC(r,e,t){return a;function a(i){return r.enter("hardBreakEscape"),r.consume(i),n}function n(i){return $(i)?(r.exit("hardBreakEscape"),e(i)):t(i)}}var Tc={name:"headingAtx",tokenize:pC,resolve:dC};function dC(r,e){let t=r.length-2,a=3,n,i;return r[a][1].type==="whitespace"&&(a+=2),t-2>a&&r[t][1].type==="whitespace"&&(t-=2),r[t][1].type==="atxHeadingSequence"&&(a===t-1||t-4>a&&r[t-2][1].type==="whitespace")&&(t-=a+1===t?2:4),t>a&&(n={type:"atxHeadingText",start:r[a][1].start,end:r[t][1].end},i={type:"chunkText",start:r[a][1].start,end:r[t][1].end,contentType:"text"},lt(r,a,t-a+1,[["enter",n,e],["enter",i,e],["exit",i,e],["exit",n,e]])),r}function pC(r,e,t){let a=0;return n;function n(u){return r.enter("atxHeading"),i(u)}function i(u){return r.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&a++<6?(r.consume(u),o):u===null||Ve(u)?(r.exit("atxHeadingSequence"),s(u)):t(u)}function s(u){return u===35?(r.enter("atxHeadingSequence"),l(u)):u===null||$(u)?(r.exit("atxHeading"),e(u)):ie(u)?oe(r,s,"whitespace")(u):(r.enter("atxHeadingText"),c(u))}function l(u){return u===35?(r.consume(u),l):(r.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||Ve(u)?(r.exit("atxHeadingText"),s(u)):(r.consume(u),c)}}var Kh=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],xc=["pre","script","style","textarea"];var Ac={name:"htmlFlow",tokenize:fC,resolveTo:gC,concrete:!0},mC={tokenize:bC,partial:!0},hC={tokenize:yC,partial:!0};function gC(r){let e=r.length;for(;e--&&!(r[e][0]==="enter"&&r[e][1].type==="htmlFlow"););return e>1&&r[e-2][1].type==="linePrefix"&&(r[e][1].start=r[e-2][1].start,r[e+1][1].start=r[e-2][1].start,r.splice(e-2,2)),r}function fC(r,e,t){let a=this,n,i,o,s,l;return c;function c(S){return u(S)}function u(S){return r.enter("htmlFlow"),r.enter("htmlFlowData"),r.consume(S),p}function p(S){return S===33?(r.consume(S),m):S===47?(r.consume(S),i=!0,f):S===63?(r.consume(S),n=3,a.interrupt?e:_):Rt(S)?(r.consume(S),o=String.fromCharCode(S),y):t(S)}function m(S){return S===45?(r.consume(S),n=2,d):S===91?(r.consume(S),n=5,s=0,g):Rt(S)?(r.consume(S),n=4,a.interrupt?e:_):t(S)}function d(S){return S===45?(r.consume(S),a.interrupt?e:_):t(S)}function g(S){let ne="CDATA[";return S===ne.charCodeAt(s++)?(r.consume(S),s===ne.length?a.interrupt?e:O:g):t(S)}function f(S){return Rt(S)?(r.consume(S),o=String.fromCharCode(S),y):t(S)}function y(S){if(S===null||S===47||S===62||Ve(S)){let ne=S===47,Te=o.toLowerCase();return!ne&&!i&&xc.includes(Te)?(n=1,a.interrupt?e(S):O(S)):Kh.includes(o.toLowerCase())?(n=6,ne?(r.consume(S),v):a.interrupt?e(S):O(S)):(n=7,a.interrupt&&!a.parser.lazy[a.now().line]?t(S):i?T(S):E(S))}return S===45||Ze(S)?(r.consume(S),o+=String.fromCharCode(S),y):t(S)}function v(S){return S===62?(r.consume(S),a.interrupt?e:O):t(S)}function T(S){return ie(S)?(r.consume(S),T):G(S)}function E(S){return S===47?(r.consume(S),G):S===58||S===95||Rt(S)?(r.consume(S),I):ie(S)?(r.consume(S),E):G(S)}function I(S){return S===45||S===46||S===58||S===95||Ze(S)?(r.consume(S),I):D(S)}function D(S){return S===61?(r.consume(S),C):ie(S)?(r.consume(S),D):E(S)}function C(S){return S===null||S===60||S===61||S===62||S===96?t(S):S===34||S===39?(r.consume(S),l=S,M):ie(S)?(r.consume(S),C):F(S)}function M(S){return S===l?(r.consume(S),l=null,R):S===null||$(S)?t(S):(r.consume(S),M)}function F(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||Ve(S)?D(S):(r.consume(S),F)}function R(S){return S===47||S===62||ie(S)?E(S):t(S)}function G(S){return S===62?(r.consume(S),z):t(S)}function z(S){return S===null||$(S)?O(S):ie(S)?(r.consume(S),z):t(S)}function O(S){return S===45&&n===2?(r.consume(S),X):S===60&&n===1?(r.consume(S),K):S===62&&n===4?(r.consume(S),fe):S===63&&n===3?(r.consume(S),_):S===93&&n===5?(r.consume(S),Z):$(S)&&(n===6||n===7)?(r.exit("htmlFlowData"),r.check(mC,Ie,x)(S)):S===null||$(S)?(r.exit("htmlFlowData"),x(S)):(r.consume(S),O)}function x(S){return r.check(hC,A,Ie)(S)}function A(S){return r.enter("lineEnding"),r.consume(S),r.exit("lineEnding"),B}function B(S){return S===null||$(S)?x(S):(r.enter("htmlFlowData"),O(S))}function X(S){return S===45?(r.consume(S),_):O(S)}function K(S){return S===47?(r.consume(S),o="",Q):O(S)}function Q(S){if(S===62){let ne=o.toLowerCase();return xc.includes(ne)?(r.consume(S),fe):O(S)}return Rt(S)&&o.length<8?(r.consume(S),o+=String.fromCharCode(S),Q):O(S)}function Z(S){return S===93?(r.consume(S),_):O(S)}function _(S){return S===62?(r.consume(S),fe):S===45&&n===2?(r.consume(S),_):O(S)}function fe(S){return S===null||$(S)?(r.exit("htmlFlowData"),Ie(S)):(r.consume(S),fe)}function Ie(S){return r.exit("htmlFlow"),e(S)}}function yC(r,e,t){let a=this;return n;function n(o){return $(o)?(r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),i):t(o)}function i(o){return a.parser.lazy[a.now().line]?t(o):e(o)}}function bC(r,e,t){return a;function a(n){return r.enter("lineEnding"),r.consume(n),r.exit("lineEnding"),r.attempt(zr,e,t)}}var Ic={name:"htmlText",tokenize:vC};function vC(r,e,t){let a=this,n,i,o;return s;function s(_){return r.enter("htmlText"),r.enter("htmlTextData"),r.consume(_),l}function l(_){return _===33?(r.consume(_),c):_===47?(r.consume(_),D):_===63?(r.consume(_),E):Rt(_)?(r.consume(_),F):t(_)}function c(_){return _===45?(r.consume(_),u):_===91?(r.consume(_),i=0,g):Rt(_)?(r.consume(_),T):t(_)}function u(_){return _===45?(r.consume(_),d):t(_)}function p(_){return _===null?t(_):_===45?(r.consume(_),m):$(_)?(o=p,K(_)):(r.consume(_),p)}function m(_){return _===45?(r.consume(_),d):p(_)}function d(_){return _===62?X(_):_===45?m(_):p(_)}function g(_){let fe="CDATA[";return _===fe.charCodeAt(i++)?(r.consume(_),i===fe.length?f:g):t(_)}function f(_){return _===null?t(_):_===93?(r.consume(_),y):$(_)?(o=f,K(_)):(r.consume(_),f)}function y(_){return _===93?(r.consume(_),v):f(_)}function v(_){return _===62?X(_):_===93?(r.consume(_),v):f(_)}function T(_){return _===null||_===62?X(_):$(_)?(o=T,K(_)):(r.consume(_),T)}function E(_){return _===null?t(_):_===63?(r.consume(_),I):$(_)?(o=E,K(_)):(r.consume(_),E)}function I(_){return _===62?X(_):E(_)}function D(_){return Rt(_)?(r.consume(_),C):t(_)}function C(_){return _===45||Ze(_)?(r.consume(_),C):M(_)}function M(_){return $(_)?(o=M,K(_)):ie(_)?(r.consume(_),M):X(_)}function F(_){return _===45||Ze(_)?(r.consume(_),F):_===47||_===62||Ve(_)?R(_):t(_)}function R(_){return _===47?(r.consume(_),X):_===58||_===95||Rt(_)?(r.consume(_),G):$(_)?(o=R,K(_)):ie(_)?(r.consume(_),R):X(_)}function G(_){return _===45||_===46||_===58||_===95||Ze(_)?(r.consume(_),G):z(_)}function z(_){return _===61?(r.consume(_),O):$(_)?(o=z,K(_)):ie(_)?(r.consume(_),z):R(_)}function O(_){return _===null||_===60||_===61||_===62||_===96?t(_):_===34||_===39?(r.consume(_),n=_,x):$(_)?(o=O,K(_)):ie(_)?(r.consume(_),O):(r.consume(_),A)}function x(_){return _===n?(r.consume(_),n=void 0,B):_===null?t(_):$(_)?(o=x,K(_)):(r.consume(_),x)}function A(_){return _===null||_===34||_===39||_===60||_===61||_===96?t(_):_===47||_===62||Ve(_)?R(_):(r.consume(_),A)}function B(_){return _===47||_===62||Ve(_)?R(_):t(_)}function X(_){return _===62?(r.consume(_),r.exit("htmlTextData"),r.exit("htmlText"),e):t(_)}function K(_){return r.exit("htmlTextData"),r.enter("lineEnding"),r.consume(_),r.exit("lineEnding"),Q}function Q(_){return ie(_)?oe(r,Z,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):Z(_)}function Z(_){return r.enter("htmlTextData"),o(_)}}var En={name:"labelEnd",tokenize:kC,resolveTo:CC,resolveAll:wC},_C={tokenize:TC},SC={tokenize:xC},EC={tokenize:AC};function wC(r){let e=-1;for(;++e<r.length;){let t=r[e][1];(t.type==="labelImage"||t.type==="labelLink"||t.type==="labelEnd")&&(r.splice(e+1,t.type==="labelImage"?4:2),t.type="data",e++)}return r}function CC(r,e){let t=r.length,a=0,n,i,o,s;for(;t--;)if(n=r[t][1],i){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;r[t][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(o){if(r[t][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(i=t,n.type!=="labelLink")){a=2;break}}else n.type==="labelEnd"&&(o=t);let l={type:r[i][1].type==="labelLink"?"link":"image",start:Object.assign({},r[i][1].start),end:Object.assign({},r[r.length-1][1].end)},c={type:"label",start:Object.assign({},r[i][1].start),end:Object.assign({},r[o][1].end)},u={type:"labelText",start:Object.assign({},r[i+a+2][1].end),end:Object.assign({},r[o-2][1].start)};return s=[["enter",l,e],["enter",c,e]],s=mt(s,r.slice(i+1,i+a+3)),s=mt(s,[["enter",u,e]]),s=mt(s,oa(e.parser.constructs.insideSpan.null,r.slice(i+a+4,o-3),e)),s=mt(s,[["exit",u,e],r[o-2],r[o-1],["exit",c,e]]),s=mt(s,r.slice(o+1)),s=mt(s,[["exit",l,e]]),lt(r,i,r.length,s),r}function kC(r,e,t){let a=this,n=a.events.length,i,o;for(;n--;)if((a.events[n][1].type==="labelImage"||a.events[n][1].type==="labelLink")&&!a.events[n][1]._balanced){i=a.events[n][1];break}return s;function s(m){return i?i._inactive?p(m):(o=a.parser.defined.includes(wr(a.sliceSerialize({start:i.end,end:a.now()}))),r.enter("labelEnd"),r.enter("labelMarker"),r.consume(m),r.exit("labelMarker"),r.exit("labelEnd"),l):t(m)}function l(m){return m===40?r.attempt(_C,u,o?u:p)(m):m===91?r.attempt(SC,u,o?c:p)(m):o?u(m):p(m)}function c(m){return r.attempt(EC,u,p)(m)}function u(m){return e(m)}function p(m){return i._balanced=!0,t(m)}}function TC(r,e,t){return a;function a(p){return r.enter("resource"),r.enter("resourceMarker"),r.consume(p),r.exit("resourceMarker"),n}function n(p){return Ve(p)?Sn(r,i)(p):i(p)}function i(p){return p===41?u(p):Wo(r,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function o(p){return Ve(p)?Sn(r,l)(p):u(p)}function s(p){return t(p)}function l(p){return p===34||p===39||p===40?qo(r,c,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):u(p)}function c(p){return Ve(p)?Sn(r,u)(p):u(p)}function u(p){return p===41?(r.enter("resourceMarker"),r.consume(p),r.exit("resourceMarker"),r.exit("resource"),e):t(p)}}function xC(r,e,t){let a=this;return n;function n(s){return jo.call(a,r,i,o,"reference","referenceMarker","referenceString")(s)}function i(s){return a.parser.defined.includes(wr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?e(s):t(s)}function o(s){return t(s)}}function AC(r,e,t){return a;function a(i){return r.enter("reference"),r.enter("referenceMarker"),r.consume(i),r.exit("referenceMarker"),n}function n(i){return i===93?(r.enter("referenceMarker"),r.consume(i),r.exit("referenceMarker"),r.exit("reference"),e):t(i)}}var Rc={name:"labelStartImage",tokenize:IC,resolveAll:En.resolveAll};function IC(r,e,t){let a=this;return n;function n(s){return r.enter("labelImage"),r.enter("labelImageMarker"),r.consume(s),r.exit("labelImageMarker"),i}function i(s){return s===91?(r.enter("labelMarker"),r.consume(s),r.exit("labelMarker"),r.exit("labelImage"),o):t(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in a.parser.constructs?t(s):e(s)}}var Pc={name:"labelStartLink",tokenize:RC,resolveAll:En.resolveAll};function RC(r,e,t){let a=this;return n;function n(o){return r.enter("labelLink"),r.enter("labelMarker"),r.consume(o),r.exit("labelMarker"),r.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in a.parser.constructs?t(o):e(o)}}var Za={name:"lineEnding",tokenize:PC};function PC(r,e){return t;function t(a){return r.enter("lineEnding"),r.consume(a),r.exit("lineEnding"),oe(r,e,"linePrefix")}}var wn={name:"thematicBreak",tokenize:DC};function DC(r,e,t){let a=0,n;return i;function i(c){return r.enter("thematicBreak"),o(c)}function o(c){return n=c,s(c)}function s(c){return c===n?(r.enter("thematicBreakSequence"),l(c)):a>=3&&(c===null||$(c))?(r.exit("thematicBreak"),e(c)):t(c)}function l(c){return c===n?(r.consume(c),a++,l):(r.exit("thematicBreakSequence"),ie(c)?oe(r,s,"whitespace")(c):s(c))}}var ct={name:"list",tokenize:LC,continuation:{tokenize:MC},exit:BC},NC={tokenize:GC,partial:!0},OC={tokenize:FC,partial:!0};function LC(r,e,t){let a=this,n=a.events[a.events.length-1],i=n&&n[1].type==="linePrefix"?n[2].sliceSerialize(n[1],!0).length:0,o=0;return s;function s(d){let g=a.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!a.containerState.marker||d===a.containerState.marker:Ka(d)){if(a.containerState.type||(a.containerState.type=g,r.enter(g,{_container:!0})),g==="listUnordered")return r.enter("listItemPrefix"),d===42||d===45?r.check(wn,t,c)(d):c(d);if(!a.interrupt||d===49)return r.enter("listItemPrefix"),r.enter("listItemValue"),l(d)}return t(d)}function l(d){return Ka(d)&&++o<10?(r.consume(d),l):(!a.interrupt||o<2)&&(a.containerState.marker?d===a.containerState.marker:d===41||d===46)?(r.exit("listItemValue"),c(d)):t(d)}function c(d){return r.enter("listItemMarker"),r.consume(d),r.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||d,r.check(zr,a.interrupt?t:u,r.attempt(NC,m,p))}function u(d){return a.containerState.initialBlankLine=!0,i++,m(d)}function p(d){return ie(d)?(r.enter("listItemPrefixWhitespace"),r.consume(d),r.exit("listItemPrefixWhitespace"),m):t(d)}function m(d){return a.containerState.size=i+a.sliceSerialize(r.exit("listItemPrefix"),!0).length,e(d)}}function MC(r,e,t){let a=this;return a.containerState._closeFlow=void 0,r.check(zr,n,i);function n(s){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,oe(r,e,"listItemIndent",a.containerState.size+1)(s)}function i(s){return a.containerState.furtherBlankLines||!ie(s)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,o(s)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,r.attempt(OC,e,o)(s))}function o(s){return a.containerState._closeFlow=!0,a.interrupt=void 0,oe(r,r.attempt(ct,e,t),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function FC(r,e,t){let a=this;return oe(r,n,"listItemIndent",a.containerState.size+1);function n(i){let o=a.events[a.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===a.containerState.size?e(i):t(i)}}function BC(r){r.exit(this.containerState.type)}function GC(r,e,t){let a=this;return oe(r,n,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function n(i){let o=a.events[a.events.length-1];return!ie(i)&&o&&o[1].type==="listItemPrefixWhitespace"?e(i):t(i)}}var Ko={name:"setextUnderline",tokenize:UC,resolveTo:zC};function zC(r,e){let t=r.length,a,n,i;for(;t--;)if(r[t][0]==="enter"){if(r[t][1].type==="content"){a=t;break}r[t][1].type==="paragraph"&&(n=t)}else r[t][1].type==="content"&&r.splice(t,1),!i&&r[t][1].type==="definition"&&(i=t);let o={type:"setextHeading",start:Object.assign({},r[n][1].start),end:Object.assign({},r[r.length-1][1].end)};return r[n][1].type="setextHeadingText",i?(r.splice(n,0,["enter",o,e]),r.splice(i+1,0,["exit",r[a][1],e]),r[a][1].end=Object.assign({},r[i][1].end)):r[a][1]=o,r.push(["exit",o,e]),r}function UC(r,e,t){let a=this,n;return i;function i(c){let u=a.events.length,p;for(;u--;)if(a.events[u][1].type!=="lineEnding"&&a.events[u][1].type!=="linePrefix"&&a.events[u][1].type!=="content"){p=a.events[u][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||p)?(r.enter("setextHeadingLine"),n=c,o(c)):t(c)}function o(c){return r.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===n?(r.consume(c),s):(r.exit("setextHeadingLineSequence"),ie(c)?oe(r,l,"lineSuffix")(c):l(c))}function l(c){return c===null||$(c)?(r.exit("setextHeadingLine"),e(c)):t(c)}}var $h={tokenize:HC};function HC(r){let e=this,t=r.attempt(zr,a,r.attempt(this.parser.constructs.flowInitial,n,oe(r,r.attempt(this.parser.constructs.flow,n,r.attempt(wc,n)),"linePrefix")));return t;function a(i){if(i===null){r.consume(i);return}return r.enter("lineEndingBlank"),r.consume(i),r.exit("lineEndingBlank"),e.currentConstruct=void 0,t}function n(i){if(i===null){r.consume(i);return}return r.enter("lineEnding"),r.consume(i),r.exit("lineEnding"),e.currentConstruct=void 0,t}}var Xh={resolveAll:Qh()},Yh=Jh("string"),Zh=Jh("text");function Jh(r){return{tokenize:e,resolveAll:Qh(r==="text"?VC:void 0)};function e(t){let a=this,n=this.parser.constructs[r],i=t.attempt(n,o,s);return o;function o(u){return c(u)?i(u):s(u)}function s(u){if(u===null){t.consume(u);return}return t.enter("data"),t.consume(u),l}function l(u){return c(u)?(t.exit("data"),i(u)):(t.consume(u),l)}function c(u){if(u===null)return!0;let p=n[u],m=-1;if(p)for(;++m<p.length;){let d=p[m];if(!d.previous||d.previous.call(a,a.previous))return!0}return!1}}}function Qh(r){return e;function e(t,a){let n=-1,i;for(;++n<=t.length;)i===void 0?t[n]&&t[n][1].type==="data"&&(i=n,n++):(!t[n]||t[n][1].type!=="data")&&(n!==i+2&&(t[i][1].end=t[n-1][1].end,t.splice(i+2,n-i-2),n=i+2),i=void 0);return r?r(t,a):t}}function VC(r,e){let t=0;for(;++t<=r.length;)if((t===r.length||r[t][1].type==="lineEnding")&&r[t-1][1].type==="data"){let a=r[t-1][1],n=e.sliceStream(a),i=n.length,o=-1,s=0,l;for(;i--;){let c=n[i];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(c===-2)l=!0,s++;else if(c!==-1){i++;break}}if(s){let c={type:t===r.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{line:a.end.line,column:a.end.column-s,offset:a.end.offset-s,_index:a.start._index+i,_bufferIndex:i?o:a.start._bufferIndex+o},end:Object.assign({},a.end)};a.end=Object.assign({},c.start),a.start.offset===a.end.offset?Object.assign(a,c):(r.splice(t,0,["enter",c,e],["exit",c,e]),t+=2)}t++}return r}function eg(r,e,t){let a=Object.assign(t?Object.assign({},t):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),n={},i=[],o=[],s=[],l=!0,c={consume:I,enter:D,exit:C,attempt:R(M),check:R(F),interrupt:R(F,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:r,sliceStream:f,sliceSerialize:g,now:y,defineSkip:v,write:d},p=e.tokenize.call(u,c),m;return e.resolveAll&&i.push(e),u;function d(x){return o=mt(o,x),T(),o[o.length-1]!==null?[]:(G(e,0),u.events=oa(i,u.events,u),u.events)}function g(x,A){return jC(f(x),A)}function f(x){return WC(o,x)}function y(){let{line:x,column:A,offset:B,_index:X,_bufferIndex:K}=a;return{line:x,column:A,offset:B,_index:X,_bufferIndex:K}}function v(x){n[x.line]=x.column,O()}function T(){let x;for(;a._index<o.length;){let A=o[a._index];if(typeof A=="string")for(x=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===x&&a._bufferIndex<A.length;)E(A.charCodeAt(a._bufferIndex));else E(A)}}function E(x){l=void 0,m=x,p=p(x)}function I(x){$(x)?(a.line++,a.column=1,a.offset+=x===-3?2:1,O()):x!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===o[a._index].length&&(a._bufferIndex=-1,a._index++)),u.previous=x,l=!0}function D(x,A){let B=A||{};return B.type=x,B.start=y(),u.events.push(["enter",B,u]),s.push(B),B}function C(x){let A=s.pop();return A.end=y(),u.events.push(["exit",A,u]),A}function M(x,A){G(x,A.from)}function F(x,A){A.restore()}function R(x,A){return B;function B(X,K,Q){let Z,_,fe,Ie;return Array.isArray(X)?ne(X):"tokenize"in X?ne([X]):S(X);function S(Re){return ut;function ut(Se){let Ce=Se!==null&&Re[Se],gt=Se!==null&&Re.null,je=[...Array.isArray(Ce)?Ce:Ce?[Ce]:[],...Array.isArray(gt)?gt:gt?[gt]:[]];return ne(je)(Se)}}function ne(Re){return Z=Re,_=0,Re.length===0?Q:Te(Re[_])}function Te(Re){return ut;function ut(Se){return Ie=z(),fe=Re,Re.partial||(u.currentConstruct=Re),Re.name&&u.parser.constructs.disable.null.includes(Re.name)?We(Se):Re.tokenize.call(A?Object.assign(Object.create(u),A):u,c,Be,We)(Se)}}function Be(Re){return l=!0,x(fe,Ie),K}function We(Re){return l=!0,Ie.restore(),++_<Z.length?Te(Z[_]):Q}}}function G(x,A){x.resolveAll&&!i.includes(x)&&i.push(x),x.resolve&<(u.events,A,u.events.length-A,x.resolve(u.events.slice(A),u)),x.resolveTo&&(u.events=x.resolveTo(u.events,u))}function z(){let x=y(),A=u.previous,B=u.currentConstruct,X=u.events.length,K=Array.from(s);return{restore:Q,from:X};function Q(){a=x,u.previous=A,u.currentConstruct=B,u.events.length=X,s=K,O()}}function O(){a.line in n&&a.column<2&&(a.column=n[a.line],a.offset+=n[a.line]-1)}}function WC(r,e){let t=e.start._index,a=e.start._bufferIndex,n=e.end._index,i=e.end._bufferIndex,o;if(t===n)o=[r[t].slice(a,i)];else{if(o=r.slice(t,n),a>-1){let s=o[0];typeof s=="string"?o[0]=s.slice(a):o.shift()}i>0&&o.push(r[n].slice(0,i))}return o}function jC(r,e){let t=-1,a=[],n;for(;++t<r.length;){let i=r[t],o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
|
|
3446
3446
|
`;break}case-3:{o=`\r
|
|
3447
|
-
`;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&n)continue;o=" ";break}default:o=String.fromCharCode(i)}n=i===-2,a.push(o)}return a.join("")}var Rc={};Ss(Rc,{attentionMarkers:()=>XC,contentInitial:()=>VC,disable:()=>YC,document:()=>HC,flow:()=>jC,flowInitial:()=>WC,insideSpan:()=>$C,string:()=>qC,text:()=>KC});var HC={42:ct,43:ct,45:ct,48:ct,49:ct,50:ct,51:ct,52:ct,53:ct,54:ct,55:ct,56:ct,57:ct,62:Mo},VC={91:Ec},WC={[-2]:Ka,[-1]:Ka,32:Ka},jC={35:Cc,42:Sn,45:[jo,Sn],60:Tc,61:jo,95:Sn,96:Go,126:Go},qC={38:Bo,92:Fo},KC={[-5]:Xa,[-4]:Xa,[-3]:Xa,33:Ac,38:Bo,42:qa,60:[vc,xc],91:Ic,92:[wc,Fo],93:_n,95:qa,96:_c},$C={null:[qa,qh]},XC={null:[42,95]},YC={null:[]};function Pc(r){let t=Nh([Rc,...(r||{}).extensions||[]]),a={defined:[],lazy:{},constructs:t,content:n(Gh),document:n(Uh),flow:n(jh),string:n(Kh),text:n($h)};return a;function n(i){return o;function o(s){return Zh(a,i,s)}}}function Dc(r){for(;!Uo(r););return r}var Jh=/[\0\t\n\r]/g;function Nc(){let r=1,e="",t=!0,a;return n;function n(i,o,s){let l=[],c,u,p,m,d;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),p=0,e="",t&&(i.charCodeAt(0)===65279&&p++,t=void 0);p<i.length;){if(Jh.lastIndex=p,c=Jh.exec(i),m=c&&c.index!==void 0?c.index:i.length,d=i.charCodeAt(m),!c){e=i.slice(p);break}if(d===10&&p===m&&a)l.push(-3),a=void 0;else switch(a&&(l.push(-5),a=void 0),p<m&&(l.push(i.slice(p,m)),r+=m-p),d){case 0:{l.push(65533),r++;break}case 9:{for(u=Math.ceil(r/4)*4,l.push(-2);r++<u;)l.push(-1);break}case 10:{l.push(-4),r=1;break}default:a=!0,r=1}p=m+1}return s&&(a&&l.push(-5),e&&l.push(e),l.push(null)),l}}var ZC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Qh(r){return r.replace(ZC,JC)}function JC(r,e,t){if(e)return e;if(t.charCodeAt(0)===35){let n=t.charCodeAt(1),i=n===120||n===88;return Lo(t.slice(i?2:1),i?16:10)}return na(t)||r}function Gr(r){return!r||typeof r!="object"?"":"position"in r||"type"in r?eg(r.position):"start"in r||"end"in r?eg(r):"line"in r||"column"in r?Oc(r):""}function Oc(r){return tg(r&&r.line)+":"+tg(r&&r.column)}function eg(r){return Oc(r&&r.start)+"-"+Oc(r&&r.end)}function tg(r){return r&&typeof r=="number"?r:1}var ng={}.hasOwnProperty;function Lc(r,e,t){return typeof e!="string"&&(t=e,e=void 0),QC(t)(Dc(Pc(t).document().write(Nc()(r,e,!0))))}function QC(r){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Jt),autolinkProtocol:R,autolinkEmail:R,atxHeading:i(fe),blockQuote:i(ut),characterEscape:R,characterReference:R,codeFenced:i(Se),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(Se,o),codeText:i(Ce,o),codeTextData:R,data:R,codeFlowValue:R,definition:i(ht),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(je),hardBreakEscape:i(Ht),hardBreakTrailing:i(Ht),htmlFlow:i(It,o),htmlFlowData:R,htmlText:i(It,o),htmlTextData:R,image:i(lr),label:o,link:i(Jt),listItem:i(gt),listItemValue:m,listOrdered:i(qe,p),listUnordered:i(qe),paragraph:i(at),reference:S,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(fe),strong:i(Qe),thematicBreak:i(dt)},exit:{atxHeading:l(),atxHeadingSequence:D,autolink:l(),autolinkEmail:Re,autolinkProtocol:We,blockQuote:l(),characterEscapeValue:G,characterReferenceMarkerHexadecimal:Te,characterReferenceMarkerNumeric:Te,characterReferenceValue:Be,codeFenced:l(y),codeFencedFence:f,codeFencedFenceInfo:d,codeFencedFenceMeta:g,codeFlowValue:G,codeIndented:l(v),codeText:l(B),codeTextData:G,data:G,definition:l(),definitionDestinationString:I,definitionLabelString:T,definitionTitleString:E,emphasis:l(),hardBreakEscape:l(O),hardBreakTrailing:l(O),htmlFlow:l(x),htmlFlowData:G,htmlText:l(A),htmlTextData:G,image:l(K),label:Z,labelText:Q,lineEnding:z,link:l(X),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ne,resourceDestinationString:_,resourceTitleString:ge,resource:Ie,setextHeading:l(F),setextHeadingLineSequence:M,setextHeadingText:C,strong:l(),thematicBreak:l()}};ag(e,(r||{}).mdastExtensions||[]);let t={};return a;function a(L){let V={type:"root",children:[]},J={stack:[V],tokenStack:[],config:e,enter:s,exit:c,buffer:o,resume:u,data:t},le=[],Ee=-1;for(;++Ee<L.length;)if(L[Ee][1].type==="listOrdered"||L[Ee][1].type==="listUnordered")if(L[Ee][0]==="enter")le.push(Ee);else{let ft=le.pop();Ee=n(L,ft,Ee)}for(Ee=-1;++Ee<L.length;){let ft=e[L[Ee][0]];ng.call(ft,L[Ee][1].type)&&ft[L[Ee][1].type].call(Object.assign({sliceSerialize:L[Ee][2].sliceSerialize},J),L[Ee][1])}if(J.tokenStack.length>0){let ft=J.tokenStack[J.tokenStack.length-1];(ft[1]||rg).call(J,void 0,ft[0])}for(V.position={start:zr(L.length>0?L[0][1].start:{line:1,column:1,offset:0}),end:zr(L.length>0?L[L.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee<e.transforms.length;)V=e.transforms[Ee](V)||V;return V}function n(L,V,J){let le=V-1,Ee=-1,ft=!1,Et,Pt,Ur,Hr;for(;++le<=J;){let it=L[le];switch(it[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{it[0]==="enter"?Ee++:Ee--,Hr=void 0;break}case"lineEndingBlank":{it[0]==="enter"&&(Et&&!Hr&&!Ee&&!Ur&&(Ur=le),Hr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Hr=void 0}if(!Ee&&it[0]==="enter"&&it[1].type==="listItemPrefix"||Ee===-1&&it[0]==="exit"&&(it[1].type==="listUnordered"||it[1].type==="listOrdered")){if(Et){let et=le;for(Pt=void 0;et--;){let Vt=L[et];if(Vt[1].type==="lineEnding"||Vt[1].type==="lineEndingBlank"){if(Vt[0]==="exit")continue;Pt&&(L[Pt][1].type="lineEndingBlank",ft=!0),Vt[1].type="lineEnding",Pt=et}else if(!(Vt[1].type==="linePrefix"||Vt[1].type==="blockQuotePrefix"||Vt[1].type==="blockQuotePrefixWhitespace"||Vt[1].type==="blockQuoteMarker"||Vt[1].type==="listItemIndent"))break}Ur&&(!Pt||Ur<Pt)&&(Et._spread=!0),Et.end=Object.assign({},Pt?L[Pt][1].start:it[1].end),L.splice(Pt||le,0,["exit",Et,it[2]]),le++,J++}if(it[1].type==="listItemPrefix"){let et={type:"listItem",_spread:!1,start:Object.assign({},it[1].start),end:void 0};Et=et,L.splice(le,0,["enter",et,it[2]]),le++,J++,Ur=void 0,Hr=!0}}}return L[V][1]._spread=ft,J}function i(L,V){return J;function J(le){s.call(this,L(le),le),V&&V.call(this,le)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(L,V,J){this.stack[this.stack.length-1].children.push(L),this.stack.push(L),this.tokenStack.push([V,J]),L.position={start:zr(V.start),end:void 0}}function l(L){return V;function V(J){L&&L.call(this,J),c.call(this,J)}}function c(L,V){let J=this.stack.pop(),le=this.tokenStack.pop();if(le)le[0].type!==L.type&&(V?V.call(this,L,le[0]):(le[1]||rg).call(this,L,le[0]));else throw new Error("Cannot close `"+L.type+"` ("+Gr({start:L.start,end:L.end})+"): it\u2019s not open");J.position.end=zr(L.end)}function u(){return yc(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(L){if(this.data.expectingFirstListItemValue){let V=this.stack[this.stack.length-2];V.start=Number.parseInt(this.sliceSerialize(L),10),this.data.expectingFirstListItemValue=void 0}}function d(){let L=this.resume(),V=this.stack[this.stack.length-1];V.lang=L}function g(){let L=this.resume(),V=this.stack[this.stack.length-1];V.meta=L}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){let L=this.resume(),V=this.stack[this.stack.length-1];V.value=L.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){let L=this.resume(),V=this.stack[this.stack.length-1];V.value=L.replace(/(\r?\n|\r)$/g,"")}function T(L){let V=this.resume(),J=this.stack[this.stack.length-1];J.label=V,J.identifier=_r(this.sliceSerialize(L)).toLowerCase()}function E(){let L=this.resume(),V=this.stack[this.stack.length-1];V.title=L}function I(){let L=this.resume(),V=this.stack[this.stack.length-1];V.url=L}function D(L){let V=this.stack[this.stack.length-1];if(!V.depth){let J=this.sliceSerialize(L).length;V.depth=J}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function M(L){let V=this.stack[this.stack.length-1];V.depth=this.sliceSerialize(L).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function R(L){let J=this.stack[this.stack.length-1].children,le=J[J.length-1];(!le||le.type!=="text")&&(le=Rt(),le.position={start:zr(L.start),end:void 0},J.push(le)),this.stack.push(le)}function G(L){let V=this.stack.pop();V.value+=this.sliceSerialize(L),V.position.end=zr(L.end)}function z(L){let V=this.stack[this.stack.length-1];if(this.data.atHardBreak){let J=V.children[V.children.length-1];J.position.end=zr(L.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(V.type)&&(R.call(this,L),G.call(this,L))}function O(){this.data.atHardBreak=!0}function x(){let L=this.resume(),V=this.stack[this.stack.length-1];V.value=L}function A(){let L=this.resume(),V=this.stack[this.stack.length-1];V.value=L}function B(){let L=this.resume(),V=this.stack[this.stack.length-1];V.value=L}function X(){let L=this.stack[this.stack.length-1];if(this.data.inReference){let V=this.data.referenceType||"shortcut";L.type+="Reference",L.referenceType=V,delete L.url,delete L.title}else delete L.identifier,delete L.label;this.data.referenceType=void 0}function K(){let L=this.stack[this.stack.length-1];if(this.data.inReference){let V=this.data.referenceType||"shortcut";L.type+="Reference",L.referenceType=V,delete L.url,delete L.title}else delete L.identifier,delete L.label;this.data.referenceType=void 0}function Q(L){let V=this.sliceSerialize(L),J=this.stack[this.stack.length-2];J.label=Qh(V),J.identifier=_r(V).toLowerCase()}function Z(){let L=this.stack[this.stack.length-1],V=this.resume(),J=this.stack[this.stack.length-1];if(this.data.inReference=!0,J.type==="link"){let le=L.children;J.children=le}else J.alt=V}function _(){let L=this.resume(),V=this.stack[this.stack.length-1];V.url=L}function ge(){let L=this.resume(),V=this.stack[this.stack.length-1];V.title=L}function Ie(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function ne(L){let V=this.resume(),J=this.stack[this.stack.length-1];J.label=V,J.identifier=_r(this.sliceSerialize(L)).toLowerCase(),this.data.referenceType="full"}function Te(L){this.data.characterReferenceType=L.type}function Be(L){let V=this.sliceSerialize(L),J=this.data.characterReferenceType,le;J?(le=Lo(V,J==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):le=na(V);let Ee=this.stack.pop();Ee.value+=le,Ee.position.end=zr(L.end)}function We(L){G.call(this,L);let V=this.stack[this.stack.length-1];V.url=this.sliceSerialize(L)}function Re(L){G.call(this,L);let V=this.stack[this.stack.length-1];V.url="mailto:"+this.sliceSerialize(L)}function ut(){return{type:"blockquote",children:[]}}function Se(){return{type:"code",lang:null,meta:null,value:""}}function Ce(){return{type:"inlineCode",value:""}}function ht(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function je(){return{type:"emphasis",children:[]}}function fe(){return{type:"heading",depth:0,children:[]}}function Ht(){return{type:"break"}}function It(){return{type:"html",value:""}}function lr(){return{type:"image",title:null,url:"",alt:null}}function Jt(){return{type:"link",title:null,url:"",children:[]}}function qe(L){return{type:"list",ordered:L.type==="listOrdered",start:null,spread:L._spread,children:[]}}function gt(L){return{type:"listItem",spread:L._spread,checked:null,children:[]}}function at(){return{type:"paragraph",children:[]}}function Qe(){return{type:"strong",children:[]}}function Rt(){return{type:"text",value:""}}function dt(){return{type:"thematicBreak"}}}function zr(r){return{line:r.line,column:r.column,offset:r.offset}}function ag(r,e){let t=-1;for(;++t<e.length;){let a=e[t];Array.isArray(a)?ag(r,a):ek(r,a)}}function ek(r,e){let t;for(t in e)if(ng.call(e,t))switch(t){case"canContainEols":{let a=e[t];a&&r[t].push(...a);break}case"transforms":{let a=e[t];a&&r[t].push(...a);break}case"enter":case"exit":{let a=e[t];a&&Object.assign(r[t],a);break}}}function rg(r,e){throw r?new Error("Cannot close `"+r.type+"` ("+Gr({start:r.start,end:r.end})+"): a different token (`"+e.type+"`, "+Gr({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Gr({start:e.start,end:e.end})+") is still open")}function qo(r){let e=this;e.parser=t;function t(a){return Lc(a,{...e.data("settings"),...r,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function ig(r,e){let t={type:"element",tagName:"blockquote",properties:{},children:r.wrap(r.all(e),!0)};return r.patch(e,t),r.applyData(e,t)}function og(r,e){let t={type:"element",tagName:"br",properties:{},children:[]};return r.patch(e,t),[r.applyData(e,t),{type:"text",value:`
|
|
3448
|
-
`}]}function
|
|
3449
|
-
`:"",a={};e.lang&&(a.className=["language-"+e.lang]);let n={type:"element",tagName:"code",properties:a,children:[{type:"text",value:t}]};return e.meta&&(n.data={meta:e.meta}),r.patch(e,n),n=r.applyData(e,n),n={type:"element",tagName:"pre",properties:{},children:[n]},r.patch(e,n),n}function
|
|
3447
|
+
`;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&n)continue;o=" ";break}default:o=String.fromCharCode(i)}n=i===-2,a.push(o)}return a.join("")}var Dc={};ws(Dc,{attentionMarkers:()=>QC,contentInitial:()=>KC,disable:()=>ek,document:()=>qC,flow:()=>XC,flowInitial:()=>$C,insideSpan:()=>JC,string:()=>YC,text:()=>ZC});var qC={42:ct,43:ct,45:ct,48:ct,49:ct,50:ct,51:ct,52:ct,53:ct,54:ct,55:ct,56:ct,57:ct,62:Bo},KC={91:Cc},$C={[-2]:Xa,[-1]:Xa,32:Xa},XC={35:Tc,42:wn,45:[Ko,wn],60:Ac,61:Ko,95:wn,96:Uo,126:Uo},YC={38:zo,92:Go},ZC={[-5]:Za,[-4]:Za,[-3]:Za,33:Rc,38:zo,42:$a,60:[Sc,Ic],91:Pc,92:[kc,Go],93:En,95:$a,96:Ec},JC={null:[$a,Xh]},QC={null:[42,95]},ek={null:[]};function Nc(r){let t=Mh([Dc,...(r||{}).extensions||[]]),a={defined:[],lazy:{},constructs:t,content:n(Hh),document:n(Wh),flow:n($h),string:n(Yh),text:n(Zh)};return a;function n(i){return o;function o(s){return eg(a,i,s)}}}function Oc(r){for(;!Vo(r););return r}var tg=/[\0\t\n\r]/g;function Lc(){let r=1,e="",t=!0,a;return n;function n(i,o,s){let l=[],c,u,p,m,d;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),p=0,e="",t&&(i.charCodeAt(0)===65279&&p++,t=void 0);p<i.length;){if(tg.lastIndex=p,c=tg.exec(i),m=c&&c.index!==void 0?c.index:i.length,d=i.charCodeAt(m),!c){e=i.slice(p);break}if(d===10&&p===m&&a)l.push(-3),a=void 0;else switch(a&&(l.push(-5),a=void 0),p<m&&(l.push(i.slice(p,m)),r+=m-p),d){case 0:{l.push(65533),r++;break}case 9:{for(u=Math.ceil(r/4)*4,l.push(-2);r++<u;)l.push(-1);break}case 10:{l.push(-4),r=1;break}default:a=!0,r=1}p=m+1}return s&&(a&&l.push(-5),e&&l.push(e),l.push(null)),l}}var tk=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function rg(r){return r.replace(tk,rk)}function rk(r,e,t){if(e)return e;if(t.charCodeAt(0)===35){let n=t.charCodeAt(1),i=n===120||n===88;return Fo(t.slice(i?2:1),i?16:10)}return ia(t)||r}function Ur(r){return!r||typeof r!="object"?"":"position"in r||"type"in r?ng(r.position):"start"in r||"end"in r?ng(r):"line"in r||"column"in r?Mc(r):""}function Mc(r){return ag(r&&r.line)+":"+ag(r&&r.column)}function ng(r){return Mc(r&&r.start)+"-"+Mc(r&&r.end)}function ag(r){return r&&typeof r=="number"?r:1}var og={}.hasOwnProperty;function Fc(r,e,t){return typeof e!="string"&&(t=e,e=void 0),nk(t)(Oc(Nc(t).document().write(Lc()(r,e,!0))))}function nk(r){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Qt),autolinkProtocol:R,autolinkEmail:R,atxHeading:i(ye),blockQuote:i(ut),characterEscape:R,characterReference:R,codeFenced:i(Se),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(Se,o),codeText:i(Ce,o),codeTextData:R,data:R,codeFlowValue:R,definition:i(gt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(je),hardBreakEscape:i(Wt),hardBreakTrailing:i(Wt),htmlFlow:i(Pt,o),htmlFlowData:R,htmlText:i(Pt,o),htmlTextData:R,image:i(cr),label:o,link:i(Qt),listItem:i(ft),listItemValue:m,listOrdered:i(qe,p),listUnordered:i(qe),paragraph:i(at),reference:S,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ye),strong:i(Qe),thematicBreak:i(dt)},exit:{atxHeading:l(),atxHeadingSequence:D,autolink:l(),autolinkEmail:Re,autolinkProtocol:We,blockQuote:l(),characterEscapeValue:G,characterReferenceMarkerHexadecimal:Te,characterReferenceMarkerNumeric:Te,characterReferenceValue:Be,codeFenced:l(y),codeFencedFence:f,codeFencedFenceInfo:d,codeFencedFenceMeta:g,codeFlowValue:G,codeIndented:l(v),codeText:l(B),codeTextData:G,data:G,definition:l(),definitionDestinationString:I,definitionLabelString:T,definitionTitleString:E,emphasis:l(),hardBreakEscape:l(O),hardBreakTrailing:l(O),htmlFlow:l(x),htmlFlowData:G,htmlText:l(A),htmlTextData:G,image:l(K),label:Z,labelText:Q,lineEnding:z,link:l(X),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ne,resourceDestinationString:_,resourceTitleString:fe,resource:Ie,setextHeading:l(F),setextHeadingLineSequence:M,setextHeadingText:C,strong:l(),thematicBreak:l()}};sg(e,(r||{}).mdastExtensions||[]);let t={};return a;function a(L){let V={type:"root",children:[]},J={stack:[V],tokenStack:[],config:e,enter:s,exit:c,buffer:o,resume:u,data:t},le=[],Ee=-1;for(;++Ee<L.length;)if(L[Ee][1].type==="listOrdered"||L[Ee][1].type==="listUnordered")if(L[Ee][0]==="enter")le.push(Ee);else{let yt=le.pop();Ee=n(L,yt,Ee)}for(Ee=-1;++Ee<L.length;){let yt=e[L[Ee][0]];og.call(yt,L[Ee][1].type)&&yt[L[Ee][1].type].call(Object.assign({sliceSerialize:L[Ee][2].sliceSerialize},J),L[Ee][1])}if(J.tokenStack.length>0){let yt=J.tokenStack[J.tokenStack.length-1];(yt[1]||ig).call(J,void 0,yt[0])}for(V.position={start:Hr(L.length>0?L[0][1].start:{line:1,column:1,offset:0}),end:Hr(L.length>0?L[L.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee<e.transforms.length;)V=e.transforms[Ee](V)||V;return V}function n(L,V,J){let le=V-1,Ee=-1,yt=!1,wt,Nt,Vr,Wr;for(;++le<=J;){let it=L[le];switch(it[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{it[0]==="enter"?Ee++:Ee--,Wr=void 0;break}case"lineEndingBlank":{it[0]==="enter"&&(wt&&!Wr&&!Ee&&!Vr&&(Vr=le),Wr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Wr=void 0}if(!Ee&&it[0]==="enter"&&it[1].type==="listItemPrefix"||Ee===-1&&it[0]==="exit"&&(it[1].type==="listUnordered"||it[1].type==="listOrdered")){if(wt){let et=le;for(Nt=void 0;et--;){let jt=L[et];if(jt[1].type==="lineEnding"||jt[1].type==="lineEndingBlank"){if(jt[0]==="exit")continue;Nt&&(L[Nt][1].type="lineEndingBlank",yt=!0),jt[1].type="lineEnding",Nt=et}else if(!(jt[1].type==="linePrefix"||jt[1].type==="blockQuotePrefix"||jt[1].type==="blockQuotePrefixWhitespace"||jt[1].type==="blockQuoteMarker"||jt[1].type==="listItemIndent"))break}Vr&&(!Nt||Vr<Nt)&&(wt._spread=!0),wt.end=Object.assign({},Nt?L[Nt][1].start:it[1].end),L.splice(Nt||le,0,["exit",wt,it[2]]),le++,J++}if(it[1].type==="listItemPrefix"){let et={type:"listItem",_spread:!1,start:Object.assign({},it[1].start),end:void 0};wt=et,L.splice(le,0,["enter",et,it[2]]),le++,J++,Vr=void 0,Wr=!0}}}return L[V][1]._spread=yt,J}function i(L,V){return J;function J(le){s.call(this,L(le),le),V&&V.call(this,le)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(L,V,J){this.stack[this.stack.length-1].children.push(L),this.stack.push(L),this.tokenStack.push([V,J]),L.position={start:Hr(V.start),end:void 0}}function l(L){return V;function V(J){L&&L.call(this,J),c.call(this,J)}}function c(L,V){let J=this.stack.pop(),le=this.tokenStack.pop();if(le)le[0].type!==L.type&&(V?V.call(this,L,le[0]):(le[1]||ig).call(this,L,le[0]));else throw new Error("Cannot close `"+L.type+"` ("+Ur({start:L.start,end:L.end})+"): it\u2019s not open");J.position.end=Hr(L.end)}function u(){return vc(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(L){if(this.data.expectingFirstListItemValue){let V=this.stack[this.stack.length-2];V.start=Number.parseInt(this.sliceSerialize(L),10),this.data.expectingFirstListItemValue=void 0}}function d(){let L=this.resume(),V=this.stack[this.stack.length-1];V.lang=L}function g(){let L=this.resume(),V=this.stack[this.stack.length-1];V.meta=L}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){let L=this.resume(),V=this.stack[this.stack.length-1];V.value=L.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){let L=this.resume(),V=this.stack[this.stack.length-1];V.value=L.replace(/(\r?\n|\r)$/g,"")}function T(L){let V=this.resume(),J=this.stack[this.stack.length-1];J.label=V,J.identifier=wr(this.sliceSerialize(L)).toLowerCase()}function E(){let L=this.resume(),V=this.stack[this.stack.length-1];V.title=L}function I(){let L=this.resume(),V=this.stack[this.stack.length-1];V.url=L}function D(L){let V=this.stack[this.stack.length-1];if(!V.depth){let J=this.sliceSerialize(L).length;V.depth=J}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function M(L){let V=this.stack[this.stack.length-1];V.depth=this.sliceSerialize(L).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function R(L){let J=this.stack[this.stack.length-1].children,le=J[J.length-1];(!le||le.type!=="text")&&(le=Dt(),le.position={start:Hr(L.start),end:void 0},J.push(le)),this.stack.push(le)}function G(L){let V=this.stack.pop();V.value+=this.sliceSerialize(L),V.position.end=Hr(L.end)}function z(L){let V=this.stack[this.stack.length-1];if(this.data.atHardBreak){let J=V.children[V.children.length-1];J.position.end=Hr(L.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(V.type)&&(R.call(this,L),G.call(this,L))}function O(){this.data.atHardBreak=!0}function x(){let L=this.resume(),V=this.stack[this.stack.length-1];V.value=L}function A(){let L=this.resume(),V=this.stack[this.stack.length-1];V.value=L}function B(){let L=this.resume(),V=this.stack[this.stack.length-1];V.value=L}function X(){let L=this.stack[this.stack.length-1];if(this.data.inReference){let V=this.data.referenceType||"shortcut";L.type+="Reference",L.referenceType=V,delete L.url,delete L.title}else delete L.identifier,delete L.label;this.data.referenceType=void 0}function K(){let L=this.stack[this.stack.length-1];if(this.data.inReference){let V=this.data.referenceType||"shortcut";L.type+="Reference",L.referenceType=V,delete L.url,delete L.title}else delete L.identifier,delete L.label;this.data.referenceType=void 0}function Q(L){let V=this.sliceSerialize(L),J=this.stack[this.stack.length-2];J.label=rg(V),J.identifier=wr(V).toLowerCase()}function Z(){let L=this.stack[this.stack.length-1],V=this.resume(),J=this.stack[this.stack.length-1];if(this.data.inReference=!0,J.type==="link"){let le=L.children;J.children=le}else J.alt=V}function _(){let L=this.resume(),V=this.stack[this.stack.length-1];V.url=L}function fe(){let L=this.resume(),V=this.stack[this.stack.length-1];V.title=L}function Ie(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function ne(L){let V=this.resume(),J=this.stack[this.stack.length-1];J.label=V,J.identifier=wr(this.sliceSerialize(L)).toLowerCase(),this.data.referenceType="full"}function Te(L){this.data.characterReferenceType=L.type}function Be(L){let V=this.sliceSerialize(L),J=this.data.characterReferenceType,le;J?(le=Fo(V,J==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):le=ia(V);let Ee=this.stack.pop();Ee.value+=le,Ee.position.end=Hr(L.end)}function We(L){G.call(this,L);let V=this.stack[this.stack.length-1];V.url=this.sliceSerialize(L)}function Re(L){G.call(this,L);let V=this.stack[this.stack.length-1];V.url="mailto:"+this.sliceSerialize(L)}function ut(){return{type:"blockquote",children:[]}}function Se(){return{type:"code",lang:null,meta:null,value:""}}function Ce(){return{type:"inlineCode",value:""}}function gt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function je(){return{type:"emphasis",children:[]}}function ye(){return{type:"heading",depth:0,children:[]}}function Wt(){return{type:"break"}}function Pt(){return{type:"html",value:""}}function cr(){return{type:"image",title:null,url:"",alt:null}}function Qt(){return{type:"link",title:null,url:"",children:[]}}function qe(L){return{type:"list",ordered:L.type==="listOrdered",start:null,spread:L._spread,children:[]}}function ft(L){return{type:"listItem",spread:L._spread,checked:null,children:[]}}function at(){return{type:"paragraph",children:[]}}function Qe(){return{type:"strong",children:[]}}function Dt(){return{type:"text",value:""}}function dt(){return{type:"thematicBreak"}}}function Hr(r){return{line:r.line,column:r.column,offset:r.offset}}function sg(r,e){let t=-1;for(;++t<e.length;){let a=e[t];Array.isArray(a)?sg(r,a):ak(r,a)}}function ak(r,e){let t;for(t in e)if(og.call(e,t))switch(t){case"canContainEols":{let a=e[t];a&&r[t].push(...a);break}case"transforms":{let a=e[t];a&&r[t].push(...a);break}case"enter":case"exit":{let a=e[t];a&&Object.assign(r[t],a);break}}}function ig(r,e){throw r?new Error("Cannot close `"+r.type+"` ("+Ur({start:r.start,end:r.end})+"): a different token (`"+e.type+"`, "+Ur({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Ur({start:e.start,end:e.end})+") is still open")}function $o(r){let e=this;e.parser=t;function t(a){return Fc(a,{...e.data("settings"),...r,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function lg(r,e){let t={type:"element",tagName:"blockquote",properties:{},children:r.wrap(r.all(e),!0)};return r.patch(e,t),r.applyData(e,t)}function cg(r,e){let t={type:"element",tagName:"br",properties:{},children:[]};return r.patch(e,t),[r.applyData(e,t),{type:"text",value:`
|
|
3448
|
+
`}]}function ug(r,e){let t=e.value?e.value+`
|
|
3449
|
+
`:"",a={};e.lang&&(a.className=["language-"+e.lang]);let n={type:"element",tagName:"code",properties:a,children:[{type:"text",value:t}]};return e.meta&&(n.data={meta:e.meta}),r.patch(e,n),n=r.applyData(e,n),n={type:"element",tagName:"pre",properties:{},children:[n]},r.patch(e,n),n}function dg(r,e){let t={type:"element",tagName:"del",properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function pg(r,e){let t={type:"element",tagName:"em",properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function mg(r,e){let t=typeof r.options.clobberPrefix=="string"?r.options.clobberPrefix:"user-content-",a=String(e.identifier).toUpperCase(),n=Vt(a.toLowerCase()),i=r.footnoteOrder.indexOf(a),o,s=r.footnoteCounts.get(a);s===void 0?(s=0,r.footnoteOrder.push(a),o=r.footnoteOrder.length):o=i+1,s+=1,r.footnoteCounts.set(a,s);let l={type:"element",tagName:"a",properties:{href:"#"+t+"fn-"+n,id:t+"fnref-"+n+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};r.patch(e,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return r.patch(e,c),r.applyData(e,c)}function hg(r,e){let t={type:"element",tagName:"h"+e.depth,properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function gg(r,e){if(r.options.allowDangerousHtml){let t={type:"raw",value:e.value};return r.patch(e,t),r.applyData(e,t)}}function Xo(r,e){let t=e.referenceType,a="]";if(t==="collapsed"?a+="[]":t==="full"&&(a+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+a}];let n=r.all(e),i=n[0];i&&i.type==="text"?i.value="["+i.value:n.unshift({type:"text",value:"["});let o=n[n.length-1];return o&&o.type==="text"?o.value+=a:n.push({type:"text",value:a}),n}function fg(r,e){let t=String(e.identifier).toUpperCase(),a=r.definitionById.get(t);if(!a)return Xo(r,e);let n={src:Vt(a.url||""),alt:e.alt};a.title!==null&&a.title!==void 0&&(n.title=a.title);let i={type:"element",tagName:"img",properties:n,children:[]};return r.patch(e,i),r.applyData(e,i)}function yg(r,e){let t={src:Vt(e.url)};e.alt!==null&&e.alt!==void 0&&(t.alt=e.alt),e.title!==null&&e.title!==void 0&&(t.title=e.title);let a={type:"element",tagName:"img",properties:t,children:[]};return r.patch(e,a),r.applyData(e,a)}function bg(r,e){let t={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};r.patch(e,t);let a={type:"element",tagName:"code",properties:{},children:[t]};return r.patch(e,a),r.applyData(e,a)}function vg(r,e){let t=String(e.identifier).toUpperCase(),a=r.definitionById.get(t);if(!a)return Xo(r,e);let n={href:Vt(a.url||"")};a.title!==null&&a.title!==void 0&&(n.title=a.title);let i={type:"element",tagName:"a",properties:n,children:r.all(e)};return r.patch(e,i),r.applyData(e,i)}function _g(r,e){let t={href:Vt(e.url)};e.title!==null&&e.title!==void 0&&(t.title=e.title);let a={type:"element",tagName:"a",properties:t,children:r.all(e)};return r.patch(e,a),r.applyData(e,a)}function Sg(r,e,t){let a=r.all(e),n=t?ik(t):Eg(e),i={},o=[];if(typeof e.checked=="boolean"){let u=a[0],p;u&&u.type==="element"&&u.tagName==="p"?p=u:(p={type:"element",tagName:"p",properties:{},children:[]},a.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let s=-1;for(;++s<a.length;){let u=a[s];(n||s!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
|
|
3450
3450
|
`}),u.type==="element"&&u.tagName==="p"&&!n?o.push(...u.children):o.push(u)}let l=a[a.length-1];l&&(n||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
3451
|
-
`});let c={type:"element",tagName:"li",properties:i,children:o};return r.patch(e,c),r.applyData(e,c)}function
|
|
3451
|
+
`});let c={type:"element",tagName:"li",properties:i,children:o};return r.patch(e,c),r.applyData(e,c)}function ik(r){let e=!1;if(r.type==="list"){e=r.spread||!1;let t=r.children,a=-1;for(;!e&&++a<t.length;)e=Eg(t[a])}return e}function Eg(r){let e=r.spread;return e??r.children.length>1}function wg(r,e){let t={},a=r.all(e),n=-1;for(typeof e.start=="number"&&e.start!==1&&(t.start=e.start);++n<a.length;){let o=a[n];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){t.className=["contains-task-list"];break}}let i={type:"element",tagName:e.ordered?"ol":"ul",properties:t,children:r.wrap(a,!0)};return r.patch(e,i),r.applyData(e,i)}function Cg(r,e){let t={type:"element",tagName:"p",properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function kg(r,e){let t={type:"root",children:r.wrap(r.all(e))};return r.patch(e,t),r.applyData(e,t)}function Tg(r,e){let t={type:"element",tagName:"strong",properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}var Yo=xg("end"),Zo=xg("start");function xg(r){return e;function e(t){let a=t&&t.position&&t.position[r]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function Bc(r){let e=Zo(r),t=Yo(r);if(e&&t)return{start:e,end:t}}function Ag(r,e){let t=r.all(e),a=t.shift(),n=[];if(a){let o={type:"element",tagName:"thead",properties:{},children:r.wrap([a],!0)};r.patch(e.children[0],o),n.push(o)}if(t.length>0){let o={type:"element",tagName:"tbody",properties:{},children:r.wrap(t,!0)},s=Zo(e.children[1]),l=Yo(e.children[e.children.length-1]);s&&l&&(o.position={start:s,end:l}),n.push(o)}let i={type:"element",tagName:"table",properties:{},children:r.wrap(n,!0)};return r.patch(e,i),r.applyData(e,i)}function Ig(r,e,t){let a=t?t.children:void 0,i=(a?a.indexOf(e):1)===0?"th":"td",o=t&&t.type==="table"?t.align:void 0,s=o?o.length:e.children.length,l=-1,c=[];for(;++l<s;){let p=e.children[l],m={},d=o?o[l]:void 0;d&&(m.align=d);let g={type:"element",tagName:i,properties:m,children:[]};p&&(g.children=r.all(p),r.patch(p,g),g=r.applyData(p,g)),c.push(g)}let u={type:"element",tagName:"tr",properties:{},children:r.wrap(c,!0)};return r.patch(e,u),r.applyData(e,u)}function Rg(r,e){let t={type:"element",tagName:"td",properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function Dg(r){let e=String(r),t=/\r?\n|\r/g,a=t.exec(e),n=0,i=[];for(;a;)i.push(Pg(e.slice(n,a.index),n>0,!0),a[0]),n=a.index+a[0].length,a=t.exec(e);return i.push(Pg(e.slice(n),n>0,!1)),i.join("")}function Pg(r,e,t){let a=0,n=r.length;if(e){let i=r.codePointAt(a);for(;i===9||i===32;)a++,i=r.codePointAt(a)}if(t){let i=r.codePointAt(n-1);for(;i===9||i===32;)n--,i=r.codePointAt(n-1)}return n>a?r.slice(a,n):""}function Ng(r,e){let t={type:"text",value:Dg(String(e.value))};return r.patch(e,t),r.applyData(e,t)}function Og(r,e){let t={type:"element",tagName:"hr",properties:{},children:[]};return r.patch(e,t),r.applyData(e,t)}var Lg={blockquote:lg,break:cg,code:ug,delete:dg,emphasis:pg,footnoteReference:mg,heading:hg,html:gg,imageReference:fg,image:yg,inlineCode:bg,linkReference:vg,link:_g,listItem:Sg,list:wg,paragraph:Cg,root:kg,strong:Tg,table:Ag,tableCell:Rg,tableRow:Ig,text:Ng,thematicBreak:Og,toml:Jo,yaml:Jo,definition:Jo,footnoteDefinition:Jo};function Jo(){}function ok(r,e){let t=[{type:"text",value:"\u21A9"}];return e>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),t}function sk(r,e){return"Back to reference "+(r+1)+(e>1?"-"+e:"")}function Mg(r){let e=typeof r.options.clobberPrefix=="string"?r.options.clobberPrefix:"user-content-",t=r.options.footnoteBackContent||ok,a=r.options.footnoteBackLabel||sk,n=r.options.footnoteLabel||"Footnotes",i=r.options.footnoteLabelTagName||"h2",o=r.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<r.footnoteOrder.length;){let c=r.footnoteById.get(r.footnoteOrder[l]);if(!c)continue;let u=r.all(c),p=String(c.identifier).toUpperCase(),m=Vt(p.toLowerCase()),d=0,g=[],f=r.footnoteCounts.get(p);for(;f!==void 0&&++d<=f;){g.length>0&&g.push({type:"text",value:" "});let T=typeof t=="string"?t:t(l,d);typeof T=="string"&&(T={type:"text",value:T}),g.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+m+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(l,d),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}let y=u[u.length-1];if(y&&y.type==="element"&&y.tagName==="p"){let T=y.children[y.children.length-1];T&&T.type==="text"?T.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...g)}else u.push(...g);let v={type:"element",tagName:"li",properties:{id:e+"fn-"+m},children:r.wrap(u,!0)};r.patch(c,v),s.push(v)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...ir(o),id:"footnote-label"},children:[{type:"text",value:n}]},{type:"text",value:`
|
|
3452
3452
|
`},{type:"element",tagName:"ol",properties:{},children:r.wrap(s,!0)},{type:"text",value:`
|
|
3453
|
-
`}]}}var
|
|
3453
|
+
`}]}}var Gc={}.hasOwnProperty,lk={};function Bg(r,e){let t=e||lk,a=new Map,n=new Map,i=new Map,o={...Lg,...t.handlers},s={all:c,applyData:uk,definitionById:a,footnoteById:n,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:t,patch:ck,wrap:pk};return Ua(r,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){let p=u.type==="definition"?a:n,m=String(u.identifier).toUpperCase();p.has(m)||p.set(m,u)}}),s;function l(u,p){let m=u.type,d=s.handlers[m];if(Gc.call(s.handlers,m)&&d)return d(s,u,p);if(s.options.passThrough&&s.options.passThrough.includes(m)){if("children"in u){let{children:f,...y}=u,v=ir(y);return v.children=s.all(u),v}return ir(u)}return(s.options.unknownHandler||dk)(s,u,p)}function c(u){let p=[];if("children"in u){let m=u.children,d=-1;for(;++d<m.length;){let g=s.one(m[d],u);if(g){if(d&&m[d-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=Fg(g.value)),!Array.isArray(g)&&g.type==="element")){let f=g.children[0];f&&f.type==="text"&&(f.value=Fg(f.value))}Array.isArray(g)?p.push(...g):p.push(g)}}}return p}}function ck(r,e){r.position&&(e.position=Bc(r))}function uk(r,e){let t=e;if(r&&r.data){let a=r.data.hName,n=r.data.hChildren,i=r.data.hProperties;if(typeof a=="string")if(t.type==="element")t.tagName=a;else{let o="children"in t?t.children:[t];t={type:"element",tagName:a,properties:{},children:o}}t.type==="element"&&i&&Object.assign(t.properties,ir(i)),"children"in t&&t.children&&n!==null&&n!==void 0&&(t.children=n)}return t}function dk(r,e){let t=e.data||{},a="value"in e&&!(Gc.call(t,"hProperties")||Gc.call(t,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:r.all(e)};return r.patch(e,a),r.applyData(e,a)}function pk(r,e){let t=[],a=-1;for(e&&t.push({type:"text",value:`
|
|
3454
3454
|
`});++a<r.length;)a&&t.push({type:"text",value:`
|
|
3455
3455
|
`}),t.push(r[a]);return e&&r.length>0&&t.push({type:"text",value:`
|
|
3456
|
-
`}),t}function
|
|
3457
|
-
`},n)),i}function Jo(r,e){return r&&"run"in r?async function(t,a){let n=Zo(t,{file:a,...e});await r.run(n,a)}:function(t,a){return Zo(t,{file:a,...e||r})}}function Bc(r){if(r)throw r}var ts=Es(Wg(),1);function Ya(r){if(typeof r!="object"||r===null)return!1;let e=Object.getPrototypeOf(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)}function Gc(){let r=[],e={run:t,use:a};return e;function t(...n){let i=-1,o=n.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);s(null,...n);function s(l,...c){let u=r[++i],p=-1;if(l){o(l);return}for(;++p<n.length;)(c[p]===null||c[p]===void 0)&&(c[p]=n[p]);n=c,u?jg(u,s)(...c):o(null,...c)}}function a(n){if(typeof n!="function")throw new TypeError("Expected `middelware` to be a function, not "+n);return r.push(n),e}}function jg(r,e){let t;return a;function a(...o){let s=r.length>o.length,l;s&&o.push(n);try{l=r.apply(this,o)}catch(c){let u=c;if(s&&t)throw u;return n(u)}s||(l&&l.then&&typeof l.then=="function"?l.then(i,n):l instanceof Error?n(l):i(l))}function n(o,...s){t||(t=!0,e(o,...s))}function i(o){n(null,o)}}var Je=class extends Error{constructor(e,t,a){super(),typeof t=="string"&&(a=t,t=void 0);let n="",i={},o=!1;if(t&&("line"in t&&"column"in t?i={place:t}:"start"in t&&"end"in t?i={place:t}:"type"in t?i={ancestors:[t],place:t.position}:i={...t}),typeof e=="string"?n=e:!i.cause&&e&&(o=!0,n=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof a=="string"){let l=a.indexOf(":");l===-1?i.ruleId=a:(i.source=a.slice(0,l),i.ruleId=a.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){let l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}let s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=n,this.line=s?s.line:void 0,this.name=Gr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}};Je.prototype.file="";Je.prototype.name="";Je.prototype.reason="";Je.prototype.message="";Je.prototype.stack="";Je.prototype.column=void 0;Je.prototype.line=void 0;Je.prototype.ancestors=void 0;Je.prototype.cause=void 0;Je.prototype.fatal=void 0;Je.prototype.place=void 0;Je.prototype.ruleId=void 0;Je.prototype.source=void 0;var Yt={basename:ck,dirname:uk,extname:dk,join:pk,sep:"/"};function ck(r,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Za(r);let t=0,a=-1,n=r.length,i;if(e===void 0||e.length===0||e.length>r.length){for(;n--;)if(r.codePointAt(n)===47){if(i){t=n+1;break}}else a<0&&(i=!0,a=n+1);return a<0?"":r.slice(t,a)}if(e===r)return"";let o=-1,s=e.length-1;for(;n--;)if(r.codePointAt(n)===47){if(i){t=n+1;break}}else o<0&&(i=!0,o=n+1),s>-1&&(r.codePointAt(n)===e.codePointAt(s--)?s<0&&(a=n):(s=-1,a=o));return t===a?a=o:a<0&&(a=r.length),r.slice(t,a)}function uk(r){if(Za(r),r.length===0)return".";let e=-1,t=r.length,a;for(;--t;)if(r.codePointAt(t)===47){if(a){e=t;break}}else a||(a=!0);return e<0?r.codePointAt(0)===47?"/":".":e===1&&r.codePointAt(0)===47?"//":r.slice(0,e)}function dk(r){Za(r);let e=r.length,t=-1,a=0,n=-1,i=0,o;for(;e--;){let s=r.codePointAt(e);if(s===47){if(o){a=e+1;break}continue}t<0&&(o=!0,t=e+1),s===46?n<0?n=e:i!==1&&(i=1):n>-1&&(i=-1)}return n<0||t<0||i===0||i===1&&n===t-1&&n===a+1?"":r.slice(n,t)}function pk(...r){let e=-1,t;for(;++e<r.length;)Za(r[e]),r[e]&&(t=t===void 0?r[e]:t+"/"+r[e]);return t===void 0?".":mk(t)}function mk(r){Za(r);let e=r.codePointAt(0)===47,t=hk(r,!e);return t.length===0&&!e&&(t="."),t.length>0&&r.codePointAt(r.length-1)===47&&(t+="/"),e?"/"+t:t}function hk(r,e){let t="",a=0,n=-1,i=0,o=-1,s,l;for(;++o<=r.length;){if(o<r.length)s=r.codePointAt(o);else{if(s===47)break;s=47}if(s===47){if(!(n===o-1||i===1))if(n!==o-1&&i===2){if(t.length<2||a!==2||t.codePointAt(t.length-1)!==46||t.codePointAt(t.length-2)!==46){if(t.length>2){if(l=t.lastIndexOf("/"),l!==t.length-1){l<0?(t="",a=0):(t=t.slice(0,l),a=t.length-1-t.lastIndexOf("/")),n=o,i=0;continue}}else if(t.length>0){t="",a=0,n=o,i=0;continue}}e&&(t=t.length>0?t+"/..":"..",a=2)}else t.length>0?t+="/"+r.slice(n+1,o):t=r.slice(n+1,o),a=o-n-1;n=o,i=0}else s===46&&i>-1?i++:i=-1}return t}function Za(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}var qg={cwd:gk};function gk(){return"/"}function ia(r){return!!(r!==null&&typeof r=="object"&&"href"in r&&r.href&&"protocol"in r&&r.protocol&&r.auth===void 0)}function Kg(r){if(typeof r=="string")r=new URL(r);else if(!ia(r)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+r+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(r.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return fk(r)}function fk(r){if(r.hostname!==""){let a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}let e=r.pathname,t=-1;for(;++t<e.length;)if(e.codePointAt(t)===37&&e.codePointAt(t+1)===50){let a=e.codePointAt(t+2);if(a===70||a===102){let n=new TypeError("File URL path must not include encoded / characters");throw n.code="ERR_INVALID_FILE_URL_PATH",n}}return decodeURIComponent(e)}var zc=["history","path","basename","stem","extname","dirname"],Ja=class{constructor(e){let t;e?ia(e)?t={path:e}:typeof e=="string"||yk(e)?t={value:e}:t=e:t={},this.cwd=qg.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<zc.length;){let i=zc[a];i in t&&t[i]!==void 0&&t[i]!==null&&(this[i]=i==="history"?[...t[i]]:t[i])}let n;for(n in t)zc.includes(n)||(this[n]=t[n])}get basename(){return typeof this.path=="string"?Yt.basename(this.path):void 0}set basename(e){Hc(e,"basename"),Uc(e,"basename"),this.path=Yt.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Yt.dirname(this.path):void 0}set dirname(e){$g(this.basename,"dirname"),this.path=Yt.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Yt.extname(this.path):void 0}set extname(e){if(Uc(e,"extname"),$g(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Yt.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){ia(e)&&(e=Kg(e)),Hc(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Yt.basename(this.path,this.extname):void 0}set stem(e){Hc(e,"stem"),Uc(e,"stem"),this.path=Yt.join(this.dirname||"",e+(this.extname||""))}fail(e,t,a){let n=this.message(e,t,a);throw n.fatal=!0,n}info(e,t,a){let n=this.message(e,t,a);return n.fatal=void 0,n}message(e,t,a){let n=new Je(e,t,a);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=!1,this.messages.push(n),n}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Uc(r,e){if(r&&r.includes(Yt.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Yt.sep+"`")}function Hc(r,e){if(!r)throw new Error("`"+e+"` cannot be empty")}function $g(r,e){if(!r)throw new Error("Setting `"+e+"` requires `path` to be set too")}function yk(r){return!!(r&&typeof r=="object"&&"byteLength"in r&&"byteOffset"in r)}var Xg=function(r){let a=this.constructor.prototype,n=a[r],i=function(){return n.apply(i,arguments)};Object.setPrototypeOf(i,a);let o=Object.getOwnPropertyNames(n);for(let s of o){let l=Object.getOwnPropertyDescriptor(n,s);l&&Object.defineProperty(i,s,l)}return i};var bk={}.hasOwnProperty,qc=class r extends Xg{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Gc()}copy(){let e=new r,t=-1;for(;++t<this.attachers.length;){let a=this.attachers[t];e.use(...a)}return e.data((0,ts.default)(!0,{},this.namespace)),e}data(e,t){return typeof e=="string"?arguments.length===2?(jc("data",this.frozen),this.namespace[e]=t,this):bk.call(this.namespace,e)&&this.namespace[e]||void 0:e?(jc("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);let n=t.call(e,...a);typeof n=="function"&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();let t=es(e),a=this.parser||this.Parser;return Vc("parse",a),a(String(t),t)}process(e,t){let a=this;return this.freeze(),Vc("process",this.parser||this.Parser),Wc("process",this.compiler||this.Compiler),t?n(void 0,t):new Promise(n);function n(i,o){let s=es(e),l=a.parse(s);a.run(l,s,function(u,p,m){if(u||!p||!m)return c(u);let d=p,g=a.stringify(d,m);_k(g)?m.value=g:m.result=g,c(u,m)});function c(u,p){u||!p?o(u):i?i(p):t(void 0,p)}}}processSync(e){let t=!1,a;return this.freeze(),Vc("processSync",this.parser||this.Parser),Wc("processSync",this.compiler||this.Compiler),this.process(e,n),Zg("processSync","process",t),a;function n(i,o){t=!0,Bc(i),a=o}}run(e,t,a){Yg(e),this.freeze();let n=this.transformers;return!a&&typeof t=="function"&&(a=t,t=void 0),a?i(void 0,a):new Promise(i);function i(o,s){let l=es(t);n.run(e,l,c);function c(u,p,m){let d=p||e;u?s(u):o?o(d):a(void 0,d,m)}}}runSync(e,t){let a=!1,n;return this.run(e,t,i),Zg("runSync","run",a),n;function i(o,s){Bc(o),n=s,a=!0}}stringify(e,t){this.freeze();let a=es(t),n=this.compiler||this.Compiler;return Wc("stringify",n),Yg(e),n(e,a)}use(e,...t){let a=this.attachers,n=this.namespace;if(jc("use",this.frozen),e!=null)if(typeof e=="function")l(e,t);else if(typeof e=="object")Array.isArray(e)?s(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[u,...p]=c;l(u,p)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(c.plugins),c.settings&&(n.settings=(0,ts.default)(!0,n.settings,c.settings))}function s(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){let p=c[u];i(p)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let p=-1,m=-1;for(;++p<a.length;)if(a[p][0]===c){m=p;break}if(m===-1)a.push([c,...u]);else if(u.length>0){let[d,...g]=u,f=a[m][1];Ya(f)&&Ya(d)&&(d=(0,ts.default)(!0,f,d)),a[m]=[c,d,...g]}}}},Kc=new qc().freeze();function Vc(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `parser`")}function Wc(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `compiler`")}function jc(r,e){if(e)throw new Error("Cannot call `"+r+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Yg(r){if(!Ya(r)||typeof r.type!="string")throw new TypeError("Expected node, got `"+r+"`")}function Zg(r,e,t){if(!t)throw new Error("`"+r+"` finished async. Use `"+e+"` instead")}function es(r){return vk(r)?r:new Ja(r)}function vk(r){return!!(r&&typeof r=="object"&&"message"in r&&"messages"in r)}function _k(r){return typeof r=="string"||Sk(r)}function Sk(r){return!!(r&&typeof r=="object"&&"byteLength"in r&&"byteOffset"in r)}var Qa=class extends Tt{constructor(){super(...arguments);this.html=()=>`
|
|
3456
|
+
`}),t}function Fg(r){let e=0,t=r.charCodeAt(e);for(;t===9||t===32;)e++,t=r.charCodeAt(e);return r.slice(e)}function Qo(r,e){let t=Bg(r,e),a=t.one(r,void 0),n=Mg(t),i=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return n&&("children"in i,i.children.push({type:"text",value:`
|
|
3457
|
+
`},n)),i}function es(r,e){return r&&"run"in r?async function(t,a){let n=Qo(t,{file:a,...e});await r.run(n,a)}:function(t,a){return Qo(t,{file:a,...e||r})}}function zc(r){if(r)throw r}var ns=Cs(Kg(),1);function Ja(r){if(typeof r!="object"||r===null)return!1;let e=Object.getPrototypeOf(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)}function Uc(){let r=[],e={run:t,use:a};return e;function t(...n){let i=-1,o=n.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);s(null,...n);function s(l,...c){let u=r[++i],p=-1;if(l){o(l);return}for(;++p<n.length;)(c[p]===null||c[p]===void 0)&&(c[p]=n[p]);n=c,u?$g(u,s)(...c):o(null,...c)}}function a(n){if(typeof n!="function")throw new TypeError("Expected `middelware` to be a function, not "+n);return r.push(n),e}}function $g(r,e){let t;return a;function a(...o){let s=r.length>o.length,l;s&&o.push(n);try{l=r.apply(this,o)}catch(c){let u=c;if(s&&t)throw u;return n(u)}s||(l&&l.then&&typeof l.then=="function"?l.then(i,n):l instanceof Error?n(l):i(l))}function n(o,...s){t||(t=!0,e(o,...s))}function i(o){n(null,o)}}var Je=class extends Error{constructor(e,t,a){super(),typeof t=="string"&&(a=t,t=void 0);let n="",i={},o=!1;if(t&&("line"in t&&"column"in t?i={place:t}:"start"in t&&"end"in t?i={place:t}:"type"in t?i={ancestors:[t],place:t.position}:i={...t}),typeof e=="string"?n=e:!i.cause&&e&&(o=!0,n=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof a=="string"){let l=a.indexOf(":");l===-1?i.ruleId=a:(i.source=a.slice(0,l),i.ruleId=a.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){let l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}let s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=n,this.line=s?s.line:void 0,this.name=Ur(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}};Je.prototype.file="";Je.prototype.name="";Je.prototype.reason="";Je.prototype.message="";Je.prototype.stack="";Je.prototype.column=void 0;Je.prototype.line=void 0;Je.prototype.ancestors=void 0;Je.prototype.cause=void 0;Je.prototype.fatal=void 0;Je.prototype.place=void 0;Je.prototype.ruleId=void 0;Je.prototype.source=void 0;var Zt={basename:mk,dirname:hk,extname:gk,join:fk,sep:"/"};function mk(r,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Qa(r);let t=0,a=-1,n=r.length,i;if(e===void 0||e.length===0||e.length>r.length){for(;n--;)if(r.codePointAt(n)===47){if(i){t=n+1;break}}else a<0&&(i=!0,a=n+1);return a<0?"":r.slice(t,a)}if(e===r)return"";let o=-1,s=e.length-1;for(;n--;)if(r.codePointAt(n)===47){if(i){t=n+1;break}}else o<0&&(i=!0,o=n+1),s>-1&&(r.codePointAt(n)===e.codePointAt(s--)?s<0&&(a=n):(s=-1,a=o));return t===a?a=o:a<0&&(a=r.length),r.slice(t,a)}function hk(r){if(Qa(r),r.length===0)return".";let e=-1,t=r.length,a;for(;--t;)if(r.codePointAt(t)===47){if(a){e=t;break}}else a||(a=!0);return e<0?r.codePointAt(0)===47?"/":".":e===1&&r.codePointAt(0)===47?"//":r.slice(0,e)}function gk(r){Qa(r);let e=r.length,t=-1,a=0,n=-1,i=0,o;for(;e--;){let s=r.codePointAt(e);if(s===47){if(o){a=e+1;break}continue}t<0&&(o=!0,t=e+1),s===46?n<0?n=e:i!==1&&(i=1):n>-1&&(i=-1)}return n<0||t<0||i===0||i===1&&n===t-1&&n===a+1?"":r.slice(n,t)}function fk(...r){let e=-1,t;for(;++e<r.length;)Qa(r[e]),r[e]&&(t=t===void 0?r[e]:t+"/"+r[e]);return t===void 0?".":yk(t)}function yk(r){Qa(r);let e=r.codePointAt(0)===47,t=bk(r,!e);return t.length===0&&!e&&(t="."),t.length>0&&r.codePointAt(r.length-1)===47&&(t+="/"),e?"/"+t:t}function bk(r,e){let t="",a=0,n=-1,i=0,o=-1,s,l;for(;++o<=r.length;){if(o<r.length)s=r.codePointAt(o);else{if(s===47)break;s=47}if(s===47){if(!(n===o-1||i===1))if(n!==o-1&&i===2){if(t.length<2||a!==2||t.codePointAt(t.length-1)!==46||t.codePointAt(t.length-2)!==46){if(t.length>2){if(l=t.lastIndexOf("/"),l!==t.length-1){l<0?(t="",a=0):(t=t.slice(0,l),a=t.length-1-t.lastIndexOf("/")),n=o,i=0;continue}}else if(t.length>0){t="",a=0,n=o,i=0;continue}}e&&(t=t.length>0?t+"/..":"..",a=2)}else t.length>0?t+="/"+r.slice(n+1,o):t=r.slice(n+1,o),a=o-n-1;n=o,i=0}else s===46&&i>-1?i++:i=-1}return t}function Qa(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}var Xg={cwd:vk};function vk(){return"/"}function sa(r){return!!(r!==null&&typeof r=="object"&&"href"in r&&r.href&&"protocol"in r&&r.protocol&&r.auth===void 0)}function Yg(r){if(typeof r=="string")r=new URL(r);else if(!sa(r)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+r+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(r.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return _k(r)}function _k(r){if(r.hostname!==""){let a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}let e=r.pathname,t=-1;for(;++t<e.length;)if(e.codePointAt(t)===37&&e.codePointAt(t+1)===50){let a=e.codePointAt(t+2);if(a===70||a===102){let n=new TypeError("File URL path must not include encoded / characters");throw n.code="ERR_INVALID_FILE_URL_PATH",n}}return decodeURIComponent(e)}var Hc=["history","path","basename","stem","extname","dirname"],ei=class{constructor(e){let t;e?sa(e)?t={path:e}:typeof e=="string"||Sk(e)?t={value:e}:t=e:t={},this.cwd=Xg.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<Hc.length;){let i=Hc[a];i in t&&t[i]!==void 0&&t[i]!==null&&(this[i]=i==="history"?[...t[i]]:t[i])}let n;for(n in t)Hc.includes(n)||(this[n]=t[n])}get basename(){return typeof this.path=="string"?Zt.basename(this.path):void 0}set basename(e){Wc(e,"basename"),Vc(e,"basename"),this.path=Zt.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Zt.dirname(this.path):void 0}set dirname(e){Zg(this.basename,"dirname"),this.path=Zt.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Zt.extname(this.path):void 0}set extname(e){if(Vc(e,"extname"),Zg(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Zt.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){sa(e)&&(e=Yg(e)),Wc(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Zt.basename(this.path,this.extname):void 0}set stem(e){Wc(e,"stem"),Vc(e,"stem"),this.path=Zt.join(this.dirname||"",e+(this.extname||""))}fail(e,t,a){let n=this.message(e,t,a);throw n.fatal=!0,n}info(e,t,a){let n=this.message(e,t,a);return n.fatal=void 0,n}message(e,t,a){let n=new Je(e,t,a);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=!1,this.messages.push(n),n}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Vc(r,e){if(r&&r.includes(Zt.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Zt.sep+"`")}function Wc(r,e){if(!r)throw new Error("`"+e+"` cannot be empty")}function Zg(r,e){if(!r)throw new Error("Setting `"+e+"` requires `path` to be set too")}function Sk(r){return!!(r&&typeof r=="object"&&"byteLength"in r&&"byteOffset"in r)}var Jg=function(r){let a=this.constructor.prototype,n=a[r],i=function(){return n.apply(i,arguments)};Object.setPrototypeOf(i,a);let o=Object.getOwnPropertyNames(n);for(let s of o){let l=Object.getOwnPropertyDescriptor(n,s);l&&Object.defineProperty(i,s,l)}return i};var Ek={}.hasOwnProperty,$c=class r extends Jg{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Uc()}copy(){let e=new r,t=-1;for(;++t<this.attachers.length;){let a=this.attachers[t];e.use(...a)}return e.data((0,ns.default)(!0,{},this.namespace)),e}data(e,t){return typeof e=="string"?arguments.length===2?(Kc("data",this.frozen),this.namespace[e]=t,this):Ek.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Kc("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);let n=t.call(e,...a);typeof n=="function"&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();let t=rs(e),a=this.parser||this.Parser;return jc("parse",a),a(String(t),t)}process(e,t){let a=this;return this.freeze(),jc("process",this.parser||this.Parser),qc("process",this.compiler||this.Compiler),t?n(void 0,t):new Promise(n);function n(i,o){let s=rs(e),l=a.parse(s);a.run(l,s,function(u,p,m){if(u||!p||!m)return c(u);let d=p,g=a.stringify(d,m);Ck(g)?m.value=g:m.result=g,c(u,m)});function c(u,p){u||!p?o(u):i?i(p):t(void 0,p)}}}processSync(e){let t=!1,a;return this.freeze(),jc("processSync",this.parser||this.Parser),qc("processSync",this.compiler||this.Compiler),this.process(e,n),ef("processSync","process",t),a;function n(i,o){t=!0,zc(i),a=o}}run(e,t,a){Qg(e),this.freeze();let n=this.transformers;return!a&&typeof t=="function"&&(a=t,t=void 0),a?i(void 0,a):new Promise(i);function i(o,s){let l=rs(t);n.run(e,l,c);function c(u,p,m){let d=p||e;u?s(u):o?o(d):a(void 0,d,m)}}}runSync(e,t){let a=!1,n;return this.run(e,t,i),ef("runSync","run",a),n;function i(o,s){zc(o),n=s,a=!0}}stringify(e,t){this.freeze();let a=rs(t),n=this.compiler||this.Compiler;return qc("stringify",n),Qg(e),n(e,a)}use(e,...t){let a=this.attachers,n=this.namespace;if(Kc("use",this.frozen),e!=null)if(typeof e=="function")l(e,t);else if(typeof e=="object")Array.isArray(e)?s(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[u,...p]=c;l(u,p)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(c.plugins),c.settings&&(n.settings=(0,ns.default)(!0,n.settings,c.settings))}function s(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){let p=c[u];i(p)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let p=-1,m=-1;for(;++p<a.length;)if(a[p][0]===c){m=p;break}if(m===-1)a.push([c,...u]);else if(u.length>0){let[d,...g]=u,f=a[m][1];Ja(f)&&Ja(d)&&(d=(0,ns.default)(!0,f,d)),a[m]=[c,d,...g]}}}},Xc=new $c().freeze();function jc(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `parser`")}function qc(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `compiler`")}function Kc(r,e){if(e)throw new Error("Cannot call `"+r+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Qg(r){if(!Ja(r)||typeof r.type!="string")throw new TypeError("Expected node, got `"+r+"`")}function ef(r,e,t){if(!t)throw new Error("`"+r+"` finished async. Use `"+e+"` instead")}function rs(r){return wk(r)?r:new ei(r)}function wk(r){return!!(r&&typeof r=="object"&&"message"in r&&"messages"in r)}function Ck(r){return typeof r=="string"||kk(r)}function kk(r){return!!(r&&typeof r=="object"&&"byteLength"in r&&"byteOffset"in r)}var ti=class extends At{constructor(){super(...arguments);this.html=()=>`
|
|
3458
3458
|
|
|
3459
3459
|
<!-- Styling -->
|
|
3460
3460
|
<style>
|
|
@@ -3541,7 +3541,7 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3541
3541
|
<div class='llm-selector-item-icon' style="background-image: url('${a.icon}'); "></div>
|
|
3542
3542
|
<div class='llm-selector-item-name'>${a.name}</div>
|
|
3543
3543
|
<div class='llm-selector-item-provider'>${a.provider}</div>
|
|
3544
|
-
`,n.addEventListener("click",i=>{this.dispatchEvent(new CustomEvent("select",{detail:a.id}))}),t.appendChild(n)}}};Qa.observedAttributes=["open"];var oa=new be("ONNXModel"),Zt=class r{constructor(e){this.stateTensors={};this.constantTensors={};this._runActive=!1;this.ignoreIfBusy=!1;this.session=e,oa.debug(`Model input parameters: ${e.inputNames.join(", ")}`),oa.debug(`Model output parameters: ${e.outputNames.join(", ")}`)}static isSupported(){return!!r.lib}static async load(e){if(!r.lib)throw new Error("ONNX runtime not loaded, please set the runtime loader. Example: ONNXModel.lib = () => import('onnxruntime-web')");this.onnx||(oa.debug("Loading ONNX runtime"),this.onnx=await r.lib()),oa.debug(`Loading model: ${e}`);let t=await this.onnx.InferenceSession.create(e);return new r(t)}makeTensor(e,t,a=0){let n=1;for(let o of t)n*=o;let i;if(e=="float32")i=new r.onnx.Tensor(new Float32Array(n),t);else if(e=="int8")i=new r.onnx.Tensor(new Int8Array(n),t);else if(e=="int16")i=new r.onnx.Tensor(new Int16Array(n),t);else if(e=="int32")i=new r.onnx.Tensor(new Int32Array(n),t);else if(e=="int64")i=new r.onnx.Tensor(new BigInt64Array(n),t);else if(e=="uint8")i=new r.onnx.Tensor(new Uint8Array(n),t);else if(e=="uint16")i=new r.onnx.Tensor(new Uint16Array(n),t);else if(e=="uint32")i=new r.onnx.Tensor(new Uint32Array(n),t);else if(e=="uint64")i=new r.onnx.Tensor(new BigUint64Array(n),t);else throw new Error(`Invalid type: ${e}`);return a!==0&&(e=="int64"||e=="uint64")?i.data.fill(BigInt(a)):a!==0&&i.data.fill(a),i}registerConstant(e,t){if(!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);return this.constantTensors[e]=t,t}makeConstant(e,t,a,n=0){return this.registerConstant(e,this.makeTensor(t,a,n))}registerState(e,t,a){if(t||(t=e),!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);if(!this.session.outputNames.includes(t))throw new Error(`Model does not have an output named: ${t}`);return this.stateTensors[e]={outputName:t,tensor:a},a}makeState(e,t,a,n,i=0){return this.registerState(e,t,this.makeTensor(a,n,i))}async run(e={}){if(this._runActive&&this.ignoreIfBusy)return oa.debug("Ignoring run request because a previous run is still active");if(this._runActive)throw new Error("A previous run is still active");this._runActive=!0;for(let t in this.stateTensors)e[t]=this.stateTensors[t].tensor;for(let t in this.constantTensors)e[t]=this.constantTensors[t];try{let t=await this.session.run(e);for(let a in this.stateTensors){let n=t[this.stateTensors[a].outputName];this.stateTensors[a].tensor=n}return t}finally{this._runActive=!1}}resetState(){oa.debug("Resetting state tensors");for(let e in this.stateTensors)this.stateTensors[e].tensor.data.fill(0)}};var Jg="data:application/javascript;base64,dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoaSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFpKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtpfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9aSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoaSx0KT0+aSt0Lmxlbmd0aCwwKX1mZWVkKGkpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChpKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQscik9PnQrci5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgaT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgaSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLHI9MDtmb3IoO3IhPXQubGVuZ3RoOyl7aWYocj50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtyfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGE9dC5sZW5ndGgtcixzPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sZj1zLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7ZjxhPyh0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCkscikscis9Zix0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrYSkscikscis9YSx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWEpfXJldHVybiB0fXBhZCgpe2xldCBpPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoaT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLHI9bmV3IHQoaSk7dGhpcy5mZWVkKHIpfX07dmFyIGQ9Y2xhc3N7Y29uc3RydWN0b3IoaSx0LHIsYSl7aWYoIWl8fCF0fHwhcil0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1pLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1yfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWEsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1pPT5pLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoaSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGkpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWksdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsaSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9aT0+e2xldCB0PWkubGVuZ3RoLHI9dGhpcy5jaGFubmVscyxhLHMsZixoLGUsbix1LG8sbDtpZih0JXIhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihhPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxzPXRoaXMucmF0aW9XZWlnaHQsZj10aGlzLmxhc3RXZWlnaHQsaD0wLGU9MCxuPTAsdT0wLG89dGhpcy5vdXRwdXRCdWZmZXI7ZjwxO2YrPXMpZm9yKGU9ZiUxLGg9MS1lLHRoaXMubGFzdFdlaWdodD1mJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpb1t1KytdPXRoaXMubGFzdE91dHB1dFtsXSpoK2lbbF0qZTtmb3IoZi09MSx0LT1yLG49TWF0aC5mbG9vcihmKSpyO3U8YSYmbjx0Oyl7Zm9yKGU9ZiUxLGg9MS1lLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKW9bdSsrXT1pW24rKGw+MD9sOjApXSpoK2lbbisocitsKV0qZTtmKz1zLG49TWF0aC5mbG9vcihmKSpyfWZvcihsPTA7bDxyOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09aVtuKytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKHUpfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWk9PntsZXQgdD1pLmxlbmd0aCxyLGEscz10aGlzLmNoYW5uZWxzLGYsaCxlLG4sdSxvLGwsbSxnO2lmKHQlcyE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKHI9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGE9W10sZj10aGlzLnJhdGlvV2VpZ2h0LGg9MCxuPTAsdT0wLG89IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsZz0wLGU9MDtlPHM7KytlKWFbZV09MDtkb3tpZihvKWZvcihoPWYsZT0wO2U8czsrK2UpYVtlXT0wO2Vsc2V7Zm9yKGg9dGhpcy5sYXN0V2VpZ2h0LGU9MDtlPHM7KytlKWFbZV09dGhpcy5sYXN0T3V0cHV0W2VdO289ITB9Zm9yKDtoPjAmJm48dDspaWYodT0xK24tZyxoPj11KXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKytdKnU7Zz1uLGgtPXV9ZWxzZXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKyhlPjA/ZTowKV0qaDtnKz1oLGg9MDticmVha31pZihoPT09MClmb3IoZT0wO2U8czsrK2UpbFttKytdPWFbZV0vZjtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9aCxlPTA7ZTxzOysrZSl0aGlzLmxhc3RPdXRwdXRbZV09YVtlXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKG48dCYmbTxyKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoaSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihpKX19O2Z1bmN0aW9uIFMocCl7bGV0IGk9cC5sZW5ndGgsdD1uZXcgRmxvYXQzMkFycmF5KGkpO2Zvcig7aS0tOyl7bGV0IHI9cFtpXTt0W2ldPXI+PTMyNzY4Py0oNjU1MzYtcikvMzI3Njg6ci8zMjc2N31yZXR1cm4gdH12YXIgeT0xMDI0KjgsQj1jbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3Nvcntjb25zdHJ1Y3Rvcih0KXtzdXBlcih0KTt0aGlzLmNodW5rcz1bXTt0aGlzLmNodW5rUG9zaXRpb249MDt0aGlzLmlzRW5kZWQ9ITE7dGhpcy5pc0NhbmNlbGxlZD0hMTt0aGlzLnNhbXBsZVJhdGU9MDt0aGlzLmZvcm1hdD0iaW50MTYiO3RoaXMuYnVmZmVyT2Zmc2V0PTA7dGhpcy5sYXN0UGxheWVkQnVmZmVyU2l6ZT0wO3RoaXMuX2hhc1NlbnRFbmRFdmVudD0hMTt0aGlzLnBvcnQub25tZXNzYWdlPXI9PnRoaXMub25NZXNzYWdlKHIpfW9uTWVzc2FnZSh0KXtpZih0LmRhdGEuYWN0aW9uPT0ic3RhcnQiKXRoaXMuZm9ybWF0PXQuZGF0YS5mb3JtYXQsdGhpcy5zYW1wbGVSYXRlPXQuZGF0YS5pbnB1dFNhbXBsZVJhdGUsdGhpcy5yZXNhbXBsZXI9bmV3IGQodC5kYXRhLmlucHV0U2FtcGxlUmF0ZSx0LmRhdGEub3V0cHV0U2FtcGxlUmF0ZSwxLHkpLHRoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMuaW5wdXRCdWZmZXI9bmV3IGMoVWludDhBcnJheSx5KjIpOnRoaXMuZm9ybWF0PT0iZmxvYXQzMiImJih0aGlzLmlucHV0QnVmZmVyPW5ldyBjKFVpbnQ4QXJyYXkseSo0KSk7ZWxzZSBpZih0LmRhdGEuYWN0aW9uPT0iZGF0YSIpe2xldCByPW5ldyBVaW50OEFycmF5KHQuZGF0YS5idWZmZXIpO2Zvcih0aGlzLmlucHV0QnVmZmVyLmZlZWQocik7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspdGhpcy5kcmFpbkJ1ZmZlcigpfWVsc2UgdC5kYXRhLmFjdGlvbj09ImVuZCI/KHRoaXMubGFzdFBsYXllZEJ1ZmZlclNpemUmJnRoaXMuY2h1bmtzLnB1c2gobmV3IEZsb2F0MzJBcnJheSh0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplKjIpKSx0aGlzLmlzRW5kZWQ9ITApOnQuZGF0YS5hY3Rpb249PSJjYW5jZWwiJiYodGhpcy5pc0VuZGVkPSEwLHRoaXMuaXNDYW5jZWxsZWQ9ITApfWRyYWluQnVmZmVyKCl7bGV0IHQ9dGhpcy5pbnB1dEJ1ZmZlci5kcmFpbigpO2lmKCF0KXJldHVybjtsZXQgcjtpZih0aGlzLmZvcm1hdD09ImludDE2Iil7bGV0IHM9bmV3IEludDE2QXJyYXkodC5idWZmZXIsdC5ieXRlT2Zmc2V0LHQuYnl0ZUxlbmd0aC8yKTtyPVMocyl9ZWxzZSBpZih0aGlzLmZvcm1hdD09ImZsb2F0MzIiKXI9bmV3IEZsb2F0MzJBcnJheSh0LmJ1ZmZlcix0LmJ5dGVPZmZzZXQsdC5ieXRlTGVuZ3RoLzQpO2Vsc2UgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGZvcm1hdDogJHt0aGlzLmZvcm1hdH1gKTtsZXQgYT10aGlzLnJlc2FtcGxlci5yZXNhbXBsZShyKTt0aGlzLmNodW5rcy5wdXNoKGEpfW5leHRGbG9hdCgpe2lmKCF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIDA7bGV0IHQ9dGhpcy5jaHVua3NbMF1bdGhpcy5jaHVua1Bvc2l0aW9uXTtyZXR1cm4gdGhpcy5jaHVua1Bvc2l0aW9uKyssdGhpcy5jaHVua1Bvc2l0aW9uPHRoaXMuY2h1bmtzWzBdLmxlbmd0aHx8KHRoaXMuY2h1bmtzLnNoaWZ0KCksdGhpcy5jaHVua1Bvc2l0aW9uPTApLHR9cHJvY2Vzcyh0LHIsYSl7aWYodGhpcy5pc0NhbmNlbGxlZClyZXR1cm4hMTtpZih0aGlzLmlzRW5kZWQmJiF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIHRoaXMuX2hhc1NlbnRFbmRFdmVudHx8KHRoaXMuX2hhc1NlbnRFbmRFdmVudD0hMCx0aGlzLnBvcnQucG9zdE1lc3NhZ2Uoe2FjdGlvbjoiZW5kIn0pKSwhMTtsZXQgcz1yWzBdPy5bMF0/Lmxlbmd0aDtpZighcylyZXR1cm4hMDt0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplPXM7Zm9yKGxldCBmPTA7ZjxzO2YrKyl7bGV0IGg9dGhpcy5uZXh0RmxvYXQoKTtmb3IobGV0IGU9MDtlPHIubGVuZ3RoO2UrKylmb3IobGV0IG49MDtuPHJbZV0ubGVuZ3RoO24rKylyW2VdW25dW2ZdPWh9cmV0dXJuITB9fTtyZWdpc3RlclByb2Nlc3NvcigicGNtLXBsYXllci1ub2RlIixCKTsK";var Qg="data:application/javascript;base64,dmFyIGc9Y2xhc3N7Y29uc3RydWN0b3IoZSx0LGksZil7aWYoIWV8fCF0fHwhaSl0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1lLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1pfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWYsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1lPT5lLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoZSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGUpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWUsdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsZSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9ZT0+e2xldCB0PWUubGVuZ3RoLGk9dGhpcy5jaGFubmVscyxmLGgsYSxzLHIsdSxuLHAsbDtpZih0JWkhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihmPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxoPXRoaXMucmF0aW9XZWlnaHQsYT10aGlzLmxhc3RXZWlnaHQscz0wLHI9MCx1PTAsbj0wLHA9dGhpcy5vdXRwdXRCdWZmZXI7YTwxO2ErPWgpZm9yKHI9YSUxLHM9MS1yLHRoaXMubGFzdFdlaWdodD1hJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpcFtuKytdPXRoaXMubGFzdE91dHB1dFtsXSpzK2VbbF0qcjtmb3IoYS09MSx0LT1pLHU9TWF0aC5mbG9vcihhKSppO248ZiYmdTx0Oyl7Zm9yKHI9YSUxLHM9MS1yLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKXBbbisrXT1lW3UrKGw+MD9sOjApXSpzK2VbdSsoaStsKV0qcjthKz1oLHU9TWF0aC5mbG9vcihhKSppfWZvcihsPTA7bDxpOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09ZVt1KytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKG4pfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWU9PntsZXQgdD1lLmxlbmd0aCxpLGYsaD10aGlzLmNoYW5uZWxzLGEscyxyLHUsbixwLGwsbSxCO2lmKHQlaCE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKGk9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGY9W10sYT10aGlzLnJhdGlvV2VpZ2h0LHM9MCx1PTAsbj0wLHA9IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsQj0wLHI9MDtyPGg7KytyKWZbcl09MDtkb3tpZihwKWZvcihzPWEscj0wO3I8aDsrK3IpZltyXT0wO2Vsc2V7Zm9yKHM9dGhpcy5sYXN0V2VpZ2h0LHI9MDtyPGg7KytyKWZbcl09dGhpcy5sYXN0T3V0cHV0W3JdO3A9ITB9Zm9yKDtzPjAmJnU8dDspaWYobj0xK3UtQixzPj1uKXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KytdKm47Qj11LHMtPW59ZWxzZXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KyhyPjA/cjowKV0qcztCKz1zLHM9MDticmVha31pZihzPT09MClmb3Iocj0wO3I8aDsrK3IpbFttKytdPWZbcl0vYTtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9cyxyPTA7cjxoOysrcil0aGlzLmxhc3RPdXRwdXRbcl09ZltyXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKHU8dCYmbTxpKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoZSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihlKX19O2Z1bmN0aW9uIGQobyl7bGV0IGU9by5sZW5ndGgsdD1uZXcgSW50MTZBcnJheShlKTtmb3IoO2UtLTspe2xldCBpPU1hdGgubWF4KC0xLE1hdGgubWluKDEsb1tlXSkpO3RbZV09aTwwP2kqMzI3Njg6aSozMjc2N31yZXR1cm4gdH1mdW5jdGlvbiB3KG8pe2xldCBlPW8ubGVuZ3RoLHQ9bmV3IEJpZ0ludDY0QXJyYXkoZSk7Zm9yKDtlLS07KXtsZXQgaT1NYXRoLm1heCgtMSxNYXRoLm1pbigxLG9bZV0pKTt0W2VdPUJpZ0ludChNYXRoLmZsb29yKGk8MD9pKjMyNzY4OmkqMzI3NjcpKSoweDEwMDAwMDAwMDAwMG59cmV0dXJuIHR9dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoZSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFlKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtlfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9ZSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoZSx0KT0+ZSt0Lmxlbmd0aCwwKX1mZWVkKGUpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChlKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQsaSk9PnQraS5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgZT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgZSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLGk9MDtmb3IoO2khPXQubGVuZ3RoOyl7aWYoaT50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtpfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGY9dC5sZW5ndGgtaSxoPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sYT1oLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7YTxmPyh0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCksaSksaSs9YSx0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrZiksaSksaSs9Zix0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWYpfXJldHVybiB0fXBhZCgpe2xldCBlPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoZT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLGk9bmV3IHQoZSk7dGhpcy5mZWVkKGkpfX07dmFyIHk9Y2xhc3MgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3J7Y29uc3RydWN0b3IodCl7c3VwZXIodCk7dGhpcy5mb3JtYXQ9ImludDE2Ijt0aGlzLmlucHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSw0MDk2KTt0aGlzLnBvcnQub25tZXNzYWdlPWk9PnRoaXMub25NZXNzYWdlKGkpfW9uTWVzc2FnZSh0KXt0LmRhdGEuYWN0aW9uPT0ic3RhcnQiJiYodGhpcy5mb3JtYXQ9dC5kYXRhLmZvcm1hdCx0aGlzLnJlc2FtcGxlcj1uZXcgZyh0LmRhdGEuaW5wdXRTYW1wbGVSYXRlLHQuZGF0YS5vdXRwdXRTYW1wbGVSYXRlLDEsNDA5NiksdGhpcy5mb3JtYXQ9PSJpbnQxNiI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoSW50MTZBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoQmlnSW50NjRBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJmbG9hdDMyIiYmKHRoaXMub3V0cHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSkpKX1wcm9jZXNzKHQsaSxmKXtmb3IobGV0IGE9MDthPGkubGVuZ3RoO2ErKyl7bGV0IHM9TWF0aC5taW4oaVthXS5sZW5ndGgsdFswXS5sZW5ndGgpO2ZvcihsZXQgcj0wO3I8cztyKyspaVthXVtyXS5zZXQodFswXVtyXSl9aWYoIXRoaXMucmVzYW1wbGVyKXJldHVybiEwO2xldCBoPW5ldyBGbG9hdDMyQXJyYXkoaVswXVswXS5sZW5ndGgpO2ZvcihoLnNldChpWzBdWzBdKSx0aGlzLmlucHV0QnVmZmVyLmZlZWQoaCk7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspe2xldCBhPXRoaXMuaW5wdXRCdWZmZXIuZHJhaW4oKSxzPXRoaXMucmVzYW1wbGVyLnJlc2FtcGxlKGEpO3RoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMub3V0cHV0QnVmZmVyLmZlZWQoZChzKSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXIuZmVlZCh3KHMpKTp0aGlzLmZvcm1hdD09ImZsb2F0MzIiJiZ0aGlzLm91dHB1dEJ1ZmZlci5mZWVkKHMpfWZvcig7dGhpcy5vdXRwdXRCdWZmZXIuY2FuRHJhaW47KXtsZXQgYT10aGlzLm91dHB1dEJ1ZmZlci5kcmFpbigpO2lmKCFhKWJyZWFrO3RoaXMucG9ydC5wb3N0TWVzc2FnZSh7YWN0aW9uOiJkYXRhIixidWZmZXI6YS5idWZmZXJ9LFthLmJ1ZmZlcl0pfXJldHVybiEwfX07cmVnaXN0ZXJQcm9jZXNzb3IoInBjbS1yZWNlaXZlci1ub2RlIix5KTsK";var Ck=new be("PCMPlayerNode"),rs=class extends AudioWorkletNode{constructor(t,a,n){super(t,"pcm-player-node",{numberOfInputs:0});this.sampleRate=0;this.format="int16";this.isCancelled=!1;if(!a||a<=0)throw new Error(`Invalid sample rate: ${a}`);if(!n||n!="int16"&&n!="float32")throw new Error(`Invalid format: ${n}`);this.sampleRate=a,this.format=n,this.port.onmessage=i=>this.onWorkletMessage(i),this.port.postMessage({action:"start",inputSampleRate:a,outputSampleRate:t.sampleRate,format:n})}feed(t){this.port.postMessage({action:"data",buffer:t.buffer},[t.buffer])}async play(t){if(this.isCancelled)throw new Error("PCMPlayerNode has already been cancelled.");if(this._playPromise)throw new Error("Already playing a stream");this._playPromise=new Promise(a=>this._playPromiseResolve=a),this.dispatchEvent(new CustomEvent("start",{detail:{player:this,stream:t}}));try{let a=t.getReader();for(;!this.isCancelled;){let{done:n,value:i}=await a.read();if(n||!i)break;this.feed(i)}}catch(a){Ck.warn("Stream error:",a),this.dispatchEvent(new CustomEvent("error",{detail:{player:this,stream:t,error:a}}))}this.port.postMessage({action:"end"}),await this._playPromise}onWorkletMessage(t){t.data.action=="end"&&(this._playPromiseResolve?.(),this.dispatchEvent(new CustomEvent("end",{detail:{player:this}})))}stop(){this.isCancelled=!0,this.port.postMessage({action:"cancel"}),this._playPromiseResolve?.()}};var ns=new be("SpeechOutput"),ef=.5,kk=.8,as=class extends EventTarget{constructor(t){super();this.maxVolumeHeard=0;this.ai=t,this.ai.addEventListener("output",a=>this.onTextOutputFromAI(a)),this.ai.audio?.speechRecognition.addEventListener("speechstart",a=>this.interrupt()),this.ai.knowledgeBase.registerSource(()=>[{id:"system.voice",type:"info",name:"Voice active",isContext:!0,disabled:!1,content:"Text-to-speech is active. The user can hear your voice."}])}onTextOutputFromAI(t){t.detail.isChunk||this.ai?.audio?.speechRecognition.isRunning&&this.speak(t.detail.message)}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let t=0;for(let n of this.analyserBuffer)t+=n*n;let a=Math.sqrt(t/this.analyserBuffer.length);return a>this.maxVolumeHeard&&(this.maxVolumeHeard=a),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,a/this.maxVolumeHeard))}async speak(t){if(!this.ai?.config?.voice?.providerID)return ns.warn("No voice provider configured");let a=`speech-${Tk++}`;await this.ai.audio.beginAccess(a);try{await this._speakWithLock(t)}finally{this.ai.audio.endAccess(a)}}async _speakWithLock(t){this.interrupt(),this.ai.audio.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=kk);let a=this.ai?._voiceTracker||ns.timer(`${this.ai.config.voice.providerID} voice`);a(`Speak: ${t}`),this.currentPlayerVolume?.disconnect(),this.currentPlayerVolume=this.ai.audio.context.createGain(),this.currentPlayerVolume.connect(this.ai.audio.context.destination),this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,this.analyserNode.connect(this.currentPlayerVolume),this.maxVolumeHeard=0,this.analyserBuffer=new Float32Array(this.analyserNode.fftSize);let n=new rs(this.ai.audio.context,24e3,"int16");this.currentPlayer=n,n.connect(this.analyserNode),n.addEventListener("end",o=>{let s=o;a(`PCM stream ${s.detail.interrupted?"interrupted":"ended"}`),this.currentPlayer==n&&!s.detail.interrupted&&(this.currentPlayer=void 0,this.onSpeechEnd())});let i;if(this.ai.config.voice.providerID=="openai")i=await fetch("https://api.openai.com/v1/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.ai.config.voice.apiKey}`},body:JSON.stringify({model:"tts-1",input:t,voice:this.ai.config.voice.voiceID,response_format:"pcm"})});else if(this.ai.config.voice.providerID=="elevenlabs")i=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${this.ai.config.voice.voiceID}?output_format=pcm_24000`,{method:"POST",headers:{"xi-api-key":`${this.ai.config.voice.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({text:t})});else{ns.warn(`Unknown voice provider: ${this.ai.config.voice.providerID}`);return}if(a(`Received response ${i.status} ${i.statusText}`),!i.ok){ns.warn(`Failed to generate voice sample: ${i.status} ${i.statusText}`);return}this.dispatchEvent(new CustomEvent("speechstart",{detail:{ai:this.ai,message:t}})),a("Playing PCM stream"),await n.play(i.body),a("Audio has ended")}get isSpeaking(){return!!this.currentPlayer}async interrupt(){if(!this.currentPlayerVolume)return;let t=this.currentPlayerVolume,a=this.currentPlayer;this.currentPlayerVolume=void 0,this.currentPlayer=void 0,this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=ef);let n=400;t.gain.linearRampToValueAtTime(0,n/1e3),await new Promise(i=>setTimeout(i,n+250)),t.disconnect(),a?.stop(),a?.disconnect()}onSpeechEnd(){this.dispatchEvent(new CustomEvent("speechend",{detail:{ai:this.ai}})),this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=ef)}},Tk=1;function is(r,e){let t=e.reduce((l,c)=>l+c.byteLength,0),a=new DataView(new ArrayBuffer(44));a.setUint8(0,82),a.setUint8(1,73),a.setUint8(2,70),a.setUint8(3,70),a.setUint32(4,44+t,!0),a.setUint8(8,87),a.setUint8(9,65),a.setUint8(10,86),a.setUint8(11,69);let n=1,i=32,o=n*i/8,s=r*o;return a.setUint8(12,102),a.setUint8(13,109),a.setUint8(14,116),a.setUint8(15,32),a.setUint32(16,16,!0),a.setUint16(20,3,!0),a.setUint16(22,n,!0),a.setUint32(24,r,!0),a.setUint32(28,s,!0),a.setUint16(32,o,!0),a.setUint16(34,i,!0),a.setUint8(36,100),a.setUint8(37,97),a.setUint8(38,116),a.setUint8(39,97),a.setUint32(40,t,!0),new File([a,...e],"audio.wav",{type:"audio/wav"})}var os=class extends AudioWorkletNode{constructor(t,a,n,i){super(t,"pcm-receiver-node",{numberOfInputs:1});this.format="int16";this.format=n;let o=["int16","int64","float32"];if(!a||a<=0)throw new Error(`Invalid sample rate: ${a}`);if(!o.includes(n))throw new Error(`Invalid format ${n}, must be one of: ${o.join(", ")}`);if(!i||i<=0)throw new Error(`Invalid buffer size: ${i}`);this.port.onmessage=s=>this.onWorkletMessage(s),this.port.postMessage({action:"start",inputSampleRate:t.sampleRate,outputSampleRate:a,format:n,bufferSize:i})}onWorkletMessage(t){if(t.data.action=="data"){let a=null;if(this.format=="int16"&&(a=new Int16Array(t.data.buffer)),this.format=="int64"&&(a=new BigInt64Array(t.data.buffer)),this.format=="float32"&&(a=new Float32Array(t.data.buffer)),!a)throw new Error(`Invalid format: ${this.format}`);this.onData(a),this.dispatchEvent(new CustomEvent("data",{detail:{data:a}}))}}onData(t){}};var $c=16e3,ss=256,sa=8,ei=new be("VoiceDetectionNode"),ti=class ti extends os{constructor(t){super(t,$c,"float32",ss*sa);this.isVoiceActive=!1;this.lastVoiceActiveDate=0;this.voiceEndTimeout=50;this.sensitivity=.5;this.sentivityEnd=.2;this.nextVadReset=0;this.currentProbability=0;this._lastVoiceActive=!1;if(!ti.vadModelURL)throw new Error("VAD model url not set, please load it and set it to VoiceDetectionNode.vadModelURL");this.loadModel()}get isVoicePossiblyEnding(){return this.isVoiceActive&&this.currentProbability<this.sensitivity}get sampleRate(){return $c}get numberOfSamples(){return ss}get numberOfSampleChunks(){return sa}get outputBufferSize(){return ss*sa}get isModelLoaded(){return!!this.vad}async loadModel(){ei.debug("Loading VAD model"),this.vad=await Zt.load(ti.vadModelURL),this.vad.ignoreIfBusy=!0,ei.debug("Model loaded"),this.vad.makeConstant("sr","int64",[1],$c),this.vad.makeState("h","hn","float32",[2,sa,64]),this.vad.makeState("c","cn","float32",[2,sa,64])}async onData(t){if(this.vad)try{let a=await this.vad.run({input:new Zt.onnx.Tensor(t,[sa,ss])});if(!a)return;this.currentProbability=0;for(let o=0;o<a.output.data.length;o++)a.output.data[o]>this.currentProbability&&(this.currentProbability=a.output.data[o]);let n=this.isVoiceActive?this.sentivityEnd:this.sensitivity,i=this.currentProbability>n;if(!i&&this._lastVoiceActive&&(this.nextVadReset=Date.now(),this.vad.resetState()),this._lastVoiceActive=i,i&&!this.isVoiceActive?(this.lastVoiceActiveDate=Date.now(),this.isVoiceActive=!0,this.dispatchEvent(new CustomEvent("speechstart")),this.onSpeechStart(),ei.debug("Started speaking")):i?this.lastVoiceActiveDate=Date.now():!i&&this.isVoiceActive&&Date.now()<this.lastVoiceActiveDate+this.voiceEndTimeout||!i&&this.isVoiceActive&&(this.isVoiceActive=!1,this.dispatchEvent(new CustomEvent("speechend")),this.onSpeechEnd(),ei.debug("Stopped speaking after timeout")),!i){let o=Date.now();o>this.nextVadReset&&(this.nextVadReset=o+5e3,this.vad.resetState())}}catch(a){ei.error("VAD failed:",a)}}onSpeechStart(){}onSpeechEnd(){}};ti.vadModelURL="";var la=ti;var tf=new be("VoiceChunkOutputNode"),ca=class extends la{constructor(){super(...arguments);this.buffers=[];this.recordedBuffers=[];this._voiceRecording=!1;this.backBufferDurationSeconds=3}get bufferDuration(){return this.buffers.reduce((t,a)=>t+a.length,0)/8e3}async onData(t){if(await super.onData(t),this.isVoiceActive&&!this._voiceRecording){tf.debug(`Voice detected, sending ${this.buffers.length} existing chunks`),this._voiceRecording=!0;for(let a of this.buffers)this.recordedBuffers.push(a),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:a,isFinal:!1}})),this.onVoiceChunk(a);this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!1}})),this.onVoiceChunk(t),this.buffers=[]}else if(this.isVoiceActive)this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!1}})),this.onVoiceChunk(t);else if(!this.isVoiceActive&&this._voiceRecording){this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!0}})),this.onVoiceChunk(t),this._voiceRecording=!1;let a=this.recordedBuffers.reduce((n,i)=>n+i.length,0);tf.debug(`Voice complete, recorded ${(a/8e3).toFixed(2)} seconds of audio, ${a*4/1024} KB of data`),this.dispatchEvent(new CustomEvent("voicedataend",{detail:{data:this.recordedBuffers}})),this.onVoiceEnd(this.recordedBuffers),this.recordedBuffers=[]}else for(this.buffers.push(t);this.bufferDuration>this.backBufferDurationSeconds;)this.buffers.shift()}onVoiceChunk(t){}onVoiceEnd(t){}};var ls=new be("OpenAITranscriptionNode"),cs=class extends ca{constructor(t,a){super(t);this.apiKey="";this.pendingBuffers=[];this.isTranscribing=!1;this.apiKey=a}async onVoiceEnd(t){let a=ls.timer("OpenAI Transcribe");this.isTranscribing=!0,this.pendingBuffers.push(...t);let n=is(this.sampleRate,this.pendingBuffers);this.lastRequestAbortController?.abort(),this.lastRequestAbortController=new AbortController;let i="";try{let o=new FormData;o.append("file",n),o.append("model","whisper-1"),o.append("response_format","text");let s=await fetch("https://api.openai.com/v1/audio/transcriptions",{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o,signal:this.lastRequestAbortController.signal});if(!s.ok)throw new Error(`Failed to generate voice sample: ${s.status} ${s.statusText}`);a("Response received"),i=await s.text(),a("Content received: "+i),this.lastRequestAbortController=void 0}catch(o){ls.error(`Failed to transcribe speech: ${o.message}`);return}finally{this.isTranscribing=!1}if(this.pendingBuffers=[],!i)return ls.debug("Transcription complete, but no text was found");ls.debug(`Transcription: ${i}`),this.onVoiceTranscription(i),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:i}}))}onVoiceTranscription(t){}};var us=class extends WebSocket{constructor(t){super(t);this.pendingData=[];this.addEventListener("open",()=>this._onOpen())}send(t){this.readyState==WebSocket.OPEN?super.send(t):this.pendingData.push(t)}_onOpen(){for(let t of this.pendingData)super.send(t);this.pendingData=[]}};var sr=new be("IntelliWeaveTranscriptionNode"),xk="wss://speech.intelliweave.ai/api/v1/transcribe",ps=class ps extends ca{constructor(t,a){super(t);this.apiAddress=xk;this.apiKey="";this.isTranscribing=!1;this.apiKey=a}async onVoiceChunk(t){this.isTranscribing=!0,this.ws?this.ws.send(t):(sr.debug("Opening WebSocket connection"),this.ws=new us(this.apiAddress),this.ws.send(JSON.stringify({type:"hello",sampleRate:16e3,channels:1,format:"float32",apiKey:this.apiKey})),this.ws.send(t.buffer),this.ws.onopen=()=>{sr.debug("WebSocket connection opened")},this.ws.addEventListener("message",n=>{let i=JSON.parse(n.data);if(i.error)return sr.warn("Error: "+i.error);if(i.type!="transcription")return sr.warn("Invalid response type",i);if(i.streaming&&!i.final)return sr.debug("Partial transcription: "+i.partialText);if(this.isTranscribing=!1,!i.text.trim())return sr.warn(`Empty transcription (${i.processingTime}ms)`);sr.debug(`Transcription: ${i.text} (${i.processingTime}ms)`),this.onVoiceTranscription(i.text),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:i.text}}))}),this.ws.addEventListener("close",()=>this.onSocketClose()),this.ws.addEventListener("error",n=>sr.warn("WebSocket error")));let a=1e3*60*1;this.shutdownTimer&&clearTimeout(this.shutdownTimer),this.shutdownTimer=setTimeout(()=>{sr.debug("Shutting down WebSocket connection"),this.ws?.close(),this.ws=void 0},a)}async onVoiceEnd(t){if(this.ws?.send(JSON.stringify({type:"end"})),ps.debugExportWav){let a=is(this.sampleRate,t),n=document.createElement("a");n.href=URL.createObjectURL(a),n.download="recording.wav",n.click()}}onVoiceTranscription(t){}onSocketClose(){sr.debug("WebSocket connection closed"),this.ws=void 0,this.isTranscribing=!1}};ps.debugExportWav=!1;var ds=ps;var Xc=new be("SpeechRecognition"),ms=class extends EventTarget{constructor(t){super();this.isRunning=!1;this._skipEvents=!1;this.maxVolumeHeard=0;this.ai=t,this.ai.knowledgeBase.registerSource(()=>[{id:"system.microphone.enable",type:"action",name:"Enable or disable microphone",isContext:!0,content:`Starts or stops listening to input from the user through the microphone. ${this.isRunning?"Microphone access is currently enabled and you can hear the user.":"Microphone access is currently disabled."}.`,parameters:[{name:"enable",type:"boolean",description:"If true, enables the microphone. If false, disables it."}],action:async a=>{a.enable?await this.start():this.stop()}}])}get isSupported(){if(!Zt.lib||!this.ai?.vadModel||!Sr().AudioWorkletNode)return!1;if(this.ai?.config?.transcription?.providerID!="intelliweave"){if(!(this.ai?.config?.transcription?.providerID=="openai"&&this.ai.config?.transcription?.apiKey))return!1}return!0}async start(){if(!this.isSupported)throw new Error("Speech recognition not supported in this persona and browser.");if(!this.isRunning){this.isRunning=!0;try{await this.ai.audio.beginAccess("speech-recognition"),this.micStream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}});let t=this.ai.audio.context.createMediaStreamSource(this.micStream);this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,t.connect(this.analyserNode),this.analyserBuffer=new Float32Array(this.analyserNode.fftSize),la.vadModelURL=URL.createObjectURL(this.ai.vadModel),this.ai?.config?.transcription?.providerID=="openai"?(this.voiceDetection=new cs(this.ai.audio.context,this.ai.config.transcription.apiKey),t.connect(this.voiceDetection)):(this.voiceDetection=new ds(this.ai.audio.context,this.ai.apiKey),this.voiceDetection.apiAddress=this.ai?.config?.transcription?.url||this.voiceDetection.apiAddress,t.connect(this.voiceDetection)),this.voiceDetection.addEventListener("speechstart",a=>{this.ai._voiceTracker=Xc.timer("voice interaction","Speech started"),this.dispatchEvent(new CustomEvent(a.type,{detail:a.detail}))}),this.voiceDetection.addEventListener("speechend",a=>{this.ai._voiceTracker?.("Speech ended"),this.dispatchEvent(new CustomEvent(a.type,{detail:a.detail}))}),this.voiceDetection.addEventListener("transcription",a=>{this.ai._voiceTracker?.(`Transcription: ${a.detail.text}`),this.onTranscription(a)}),this._skipEvents||this.dispatchEvent(new CustomEvent("start",{detail:{speechRecognition:this}}))}catch(t){Xc.error("Failed to start speech recognition:",t),this.stop()}}}stop(){this.isRunning&&(this.isRunning=!1,this.ai.audio.endAccess("speech-recognition"),this.voiceDetection?.disconnect(),this.voiceDetection=void 0,this.micStream?.getTracks().forEach(t=>t.stop()),this.micStream=void 0,this.analyserNode=void 0,this.analyserBuffer=void 0,this._skipEvents||this.dispatchEvent(new CustomEvent("end",{detail:{speechRecognition:this}})))}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let t=0;for(let n of this.analyserBuffer)t+=n*n;let a=Math.sqrt(t/this.analyserBuffer.length);return a>this.maxVolumeHeard&&(this.maxVolumeHeard=a),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,a/this.maxVolumeHeard))}get wordsCurrentlyBeingSpoken(){return!!this.voiceDetection?.isVoiceActive}get isTranscribing(){return!!this.voiceDetection?.isTranscribing}onTranscription(t){let a=t.detail.text;Xc.debug("Heard:",a),this.dispatchEvent(new CustomEvent("speech",{detail:{transcript:a,isFinal:!0}}))}async reset(){if(this.isRunning){this._skipEvents=!0;try{this.stop(),await this.start(),this._skipEvents=!1}catch(t){throw this._skipEvents=!1,t}}}};var hs=new be("AudioSystem"),ua=class{constructor(e){this.locks=[];if(!e)throw new Error("AI reference is required. Please pass in the IntelliWeave instance to the constructor.");this.ai=e,this.ai.audio=this,this.speechRecognition=new ms(this.ai),this.speechOutput=new as(this.ai)}static get isSupported(){return!(!Zt.lib||!Sr().AudioWorkletNode)}async beginAccess(e){hs.debug(`Began access for: ${e}`),this.locks.includes(e)||this.locks.push(e),!this.context&&(hs.debug("Creating AudioContext"),this.context=new AudioContext({latencyHint:"interactive"}),this.context.resume(),await Promise.all([this.context.audioWorklet.addModule(Jg),this.context.audioWorklet.addModule(Qg)]))}endAccess(e){hs.debug(`Ended access for: ${e}`),this.locks=this.locks.filter(t=>t!=e),!this.locks.length&&(hs.debug("Closing AudioContext"),this.context?.close(),this.context=void 0)}};var _F=new be("Stream");var En=Es(ff(),1);var IF=new be("React");var RF=(0,En.createContext)(void 0);var ni=new be("Embed"),wn=class extends Tt{constructor(){super();this.config={};this.suggestions=[];this.html=()=>`
|
|
3544
|
+
`,n.addEventListener("click",i=>{this.dispatchEvent(new CustomEvent("select",{detail:a.id}))}),t.appendChild(n)}}};ti.observedAttributes=["open"];var la=new ge("ONNXModel"),Jt=class r{constructor(e){this.stateTensors={};this.constantTensors={};this._runActive=!1;this.ignoreIfBusy=!1;this.session=e,la.debug(`Model input parameters: ${e.inputNames.join(", ")}`),la.debug(`Model output parameters: ${e.outputNames.join(", ")}`)}static isSupported(){return!!r.lib}static async load(e){if(!r.lib)throw new Error("ONNX runtime not loaded, please set the runtime loader. Example: ONNXModel.lib = () => import('onnxruntime-web')");this.onnx||(la.debug("Loading ONNX runtime"),this.onnx=await r.lib()),la.debug(`Loading model: ${e}`);let t=await this.onnx.InferenceSession.create(e);return new r(t)}makeTensor(e,t,a=0){let n=1;for(let o of t)n*=o;let i;if(e=="float32")i=new r.onnx.Tensor(new Float32Array(n),t);else if(e=="int8")i=new r.onnx.Tensor(new Int8Array(n),t);else if(e=="int16")i=new r.onnx.Tensor(new Int16Array(n),t);else if(e=="int32")i=new r.onnx.Tensor(new Int32Array(n),t);else if(e=="int64")i=new r.onnx.Tensor(new BigInt64Array(n),t);else if(e=="uint8")i=new r.onnx.Tensor(new Uint8Array(n),t);else if(e=="uint16")i=new r.onnx.Tensor(new Uint16Array(n),t);else if(e=="uint32")i=new r.onnx.Tensor(new Uint32Array(n),t);else if(e=="uint64")i=new r.onnx.Tensor(new BigUint64Array(n),t);else throw new Error(`Invalid type: ${e}`);return a!==0&&(e=="int64"||e=="uint64")?i.data.fill(BigInt(a)):a!==0&&i.data.fill(a),i}registerConstant(e,t){if(!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);return this.constantTensors[e]=t,t}makeConstant(e,t,a,n=0){return this.registerConstant(e,this.makeTensor(t,a,n))}registerState(e,t,a){if(t||(t=e),!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);if(!this.session.outputNames.includes(t))throw new Error(`Model does not have an output named: ${t}`);return this.stateTensors[e]={outputName:t,tensor:a},a}makeState(e,t,a,n,i=0){return this.registerState(e,t,this.makeTensor(a,n,i))}async run(e={}){if(this._runActive&&this.ignoreIfBusy)return la.debug("Ignoring run request because a previous run is still active");if(this._runActive)throw new Error("A previous run is still active");this._runActive=!0;for(let t in this.stateTensors)e[t]=this.stateTensors[t].tensor;for(let t in this.constantTensors)e[t]=this.constantTensors[t];try{let t=await this.session.run(e);for(let a in this.stateTensors){let n=t[this.stateTensors[a].outputName];this.stateTensors[a].tensor=n}return t}finally{this._runActive=!1}}resetState(){la.debug("Resetting state tensors");for(let e in this.stateTensors)this.stateTensors[e].tensor.data.fill(0)}};var tf="data:application/javascript;base64,dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoaSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFpKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtpfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9aSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoaSx0KT0+aSt0Lmxlbmd0aCwwKX1mZWVkKGkpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChpKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQscik9PnQrci5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgaT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgaSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLHI9MDtmb3IoO3IhPXQubGVuZ3RoOyl7aWYocj50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtyfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGE9dC5sZW5ndGgtcixzPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sZj1zLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7ZjxhPyh0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCkscikscis9Zix0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrYSkscikscis9YSx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWEpfXJldHVybiB0fXBhZCgpe2xldCBpPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoaT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLHI9bmV3IHQoaSk7dGhpcy5mZWVkKHIpfX07dmFyIGQ9Y2xhc3N7Y29uc3RydWN0b3IoaSx0LHIsYSl7aWYoIWl8fCF0fHwhcil0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1pLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1yfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWEsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1pPT5pLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoaSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGkpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWksdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsaSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9aT0+e2xldCB0PWkubGVuZ3RoLHI9dGhpcy5jaGFubmVscyxhLHMsZixoLGUsbix1LG8sbDtpZih0JXIhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihhPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxzPXRoaXMucmF0aW9XZWlnaHQsZj10aGlzLmxhc3RXZWlnaHQsaD0wLGU9MCxuPTAsdT0wLG89dGhpcy5vdXRwdXRCdWZmZXI7ZjwxO2YrPXMpZm9yKGU9ZiUxLGg9MS1lLHRoaXMubGFzdFdlaWdodD1mJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpb1t1KytdPXRoaXMubGFzdE91dHB1dFtsXSpoK2lbbF0qZTtmb3IoZi09MSx0LT1yLG49TWF0aC5mbG9vcihmKSpyO3U8YSYmbjx0Oyl7Zm9yKGU9ZiUxLGg9MS1lLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKW9bdSsrXT1pW24rKGw+MD9sOjApXSpoK2lbbisocitsKV0qZTtmKz1zLG49TWF0aC5mbG9vcihmKSpyfWZvcihsPTA7bDxyOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09aVtuKytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKHUpfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWk9PntsZXQgdD1pLmxlbmd0aCxyLGEscz10aGlzLmNoYW5uZWxzLGYsaCxlLG4sdSxvLGwsbSxnO2lmKHQlcyE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKHI9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGE9W10sZj10aGlzLnJhdGlvV2VpZ2h0LGg9MCxuPTAsdT0wLG89IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsZz0wLGU9MDtlPHM7KytlKWFbZV09MDtkb3tpZihvKWZvcihoPWYsZT0wO2U8czsrK2UpYVtlXT0wO2Vsc2V7Zm9yKGg9dGhpcy5sYXN0V2VpZ2h0LGU9MDtlPHM7KytlKWFbZV09dGhpcy5sYXN0T3V0cHV0W2VdO289ITB9Zm9yKDtoPjAmJm48dDspaWYodT0xK24tZyxoPj11KXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKytdKnU7Zz1uLGgtPXV9ZWxzZXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKyhlPjA/ZTowKV0qaDtnKz1oLGg9MDticmVha31pZihoPT09MClmb3IoZT0wO2U8czsrK2UpbFttKytdPWFbZV0vZjtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9aCxlPTA7ZTxzOysrZSl0aGlzLmxhc3RPdXRwdXRbZV09YVtlXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKG48dCYmbTxyKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoaSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihpKX19O2Z1bmN0aW9uIFMocCl7bGV0IGk9cC5sZW5ndGgsdD1uZXcgRmxvYXQzMkFycmF5KGkpO2Zvcig7aS0tOyl7bGV0IHI9cFtpXTt0W2ldPXI+PTMyNzY4Py0oNjU1MzYtcikvMzI3Njg6ci8zMjc2N31yZXR1cm4gdH12YXIgeT0xMDI0KjgsQj1jbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3Nvcntjb25zdHJ1Y3Rvcih0KXtzdXBlcih0KTt0aGlzLmNodW5rcz1bXTt0aGlzLmNodW5rUG9zaXRpb249MDt0aGlzLmlzRW5kZWQ9ITE7dGhpcy5pc0NhbmNlbGxlZD0hMTt0aGlzLnNhbXBsZVJhdGU9MDt0aGlzLmZvcm1hdD0iaW50MTYiO3RoaXMuYnVmZmVyT2Zmc2V0PTA7dGhpcy5sYXN0UGxheWVkQnVmZmVyU2l6ZT0wO3RoaXMuX2hhc1NlbnRFbmRFdmVudD0hMTt0aGlzLnBvcnQub25tZXNzYWdlPXI9PnRoaXMub25NZXNzYWdlKHIpfW9uTWVzc2FnZSh0KXtpZih0LmRhdGEuYWN0aW9uPT0ic3RhcnQiKXRoaXMuZm9ybWF0PXQuZGF0YS5mb3JtYXQsdGhpcy5zYW1wbGVSYXRlPXQuZGF0YS5pbnB1dFNhbXBsZVJhdGUsdGhpcy5yZXNhbXBsZXI9bmV3IGQodC5kYXRhLmlucHV0U2FtcGxlUmF0ZSx0LmRhdGEub3V0cHV0U2FtcGxlUmF0ZSwxLHkpLHRoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMuaW5wdXRCdWZmZXI9bmV3IGMoVWludDhBcnJheSx5KjIpOnRoaXMuZm9ybWF0PT0iZmxvYXQzMiImJih0aGlzLmlucHV0QnVmZmVyPW5ldyBjKFVpbnQ4QXJyYXkseSo0KSk7ZWxzZSBpZih0LmRhdGEuYWN0aW9uPT0iZGF0YSIpe2xldCByPW5ldyBVaW50OEFycmF5KHQuZGF0YS5idWZmZXIpO2Zvcih0aGlzLmlucHV0QnVmZmVyLmZlZWQocik7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspdGhpcy5kcmFpbkJ1ZmZlcigpfWVsc2UgdC5kYXRhLmFjdGlvbj09ImVuZCI/KHRoaXMubGFzdFBsYXllZEJ1ZmZlclNpemUmJnRoaXMuY2h1bmtzLnB1c2gobmV3IEZsb2F0MzJBcnJheSh0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplKjIpKSx0aGlzLmlzRW5kZWQ9ITApOnQuZGF0YS5hY3Rpb249PSJjYW5jZWwiJiYodGhpcy5pc0VuZGVkPSEwLHRoaXMuaXNDYW5jZWxsZWQ9ITApfWRyYWluQnVmZmVyKCl7bGV0IHQ9dGhpcy5pbnB1dEJ1ZmZlci5kcmFpbigpO2lmKCF0KXJldHVybjtsZXQgcjtpZih0aGlzLmZvcm1hdD09ImludDE2Iil7bGV0IHM9bmV3IEludDE2QXJyYXkodC5idWZmZXIsdC5ieXRlT2Zmc2V0LHQuYnl0ZUxlbmd0aC8yKTtyPVMocyl9ZWxzZSBpZih0aGlzLmZvcm1hdD09ImZsb2F0MzIiKXI9bmV3IEZsb2F0MzJBcnJheSh0LmJ1ZmZlcix0LmJ5dGVPZmZzZXQsdC5ieXRlTGVuZ3RoLzQpO2Vsc2UgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGZvcm1hdDogJHt0aGlzLmZvcm1hdH1gKTtsZXQgYT10aGlzLnJlc2FtcGxlci5yZXNhbXBsZShyKTt0aGlzLmNodW5rcy5wdXNoKGEpfW5leHRGbG9hdCgpe2lmKCF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIDA7bGV0IHQ9dGhpcy5jaHVua3NbMF1bdGhpcy5jaHVua1Bvc2l0aW9uXTtyZXR1cm4gdGhpcy5jaHVua1Bvc2l0aW9uKyssdGhpcy5jaHVua1Bvc2l0aW9uPHRoaXMuY2h1bmtzWzBdLmxlbmd0aHx8KHRoaXMuY2h1bmtzLnNoaWZ0KCksdGhpcy5jaHVua1Bvc2l0aW9uPTApLHR9cHJvY2Vzcyh0LHIsYSl7aWYodGhpcy5pc0NhbmNlbGxlZClyZXR1cm4hMTtpZih0aGlzLmlzRW5kZWQmJiF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIHRoaXMuX2hhc1NlbnRFbmRFdmVudHx8KHRoaXMuX2hhc1NlbnRFbmRFdmVudD0hMCx0aGlzLnBvcnQucG9zdE1lc3NhZ2Uoe2FjdGlvbjoiZW5kIn0pKSwhMTtsZXQgcz1yWzBdPy5bMF0/Lmxlbmd0aDtpZighcylyZXR1cm4hMDt0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplPXM7Zm9yKGxldCBmPTA7ZjxzO2YrKyl7bGV0IGg9dGhpcy5uZXh0RmxvYXQoKTtmb3IobGV0IGU9MDtlPHIubGVuZ3RoO2UrKylmb3IobGV0IG49MDtuPHJbZV0ubGVuZ3RoO24rKylyW2VdW25dW2ZdPWh9cmV0dXJuITB9fTtyZWdpc3RlclByb2Nlc3NvcigicGNtLXBsYXllci1ub2RlIixCKTsK";var rf="data:application/javascript;base64,dmFyIGc9Y2xhc3N7Y29uc3RydWN0b3IoZSx0LGksZil7aWYoIWV8fCF0fHwhaSl0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1lLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1pfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWYsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1lPT5lLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoZSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGUpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWUsdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsZSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9ZT0+e2xldCB0PWUubGVuZ3RoLGk9dGhpcy5jaGFubmVscyxmLGgsYSxzLHIsdSxuLHAsbDtpZih0JWkhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihmPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxoPXRoaXMucmF0aW9XZWlnaHQsYT10aGlzLmxhc3RXZWlnaHQscz0wLHI9MCx1PTAsbj0wLHA9dGhpcy5vdXRwdXRCdWZmZXI7YTwxO2ErPWgpZm9yKHI9YSUxLHM9MS1yLHRoaXMubGFzdFdlaWdodD1hJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpcFtuKytdPXRoaXMubGFzdE91dHB1dFtsXSpzK2VbbF0qcjtmb3IoYS09MSx0LT1pLHU9TWF0aC5mbG9vcihhKSppO248ZiYmdTx0Oyl7Zm9yKHI9YSUxLHM9MS1yLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKXBbbisrXT1lW3UrKGw+MD9sOjApXSpzK2VbdSsoaStsKV0qcjthKz1oLHU9TWF0aC5mbG9vcihhKSppfWZvcihsPTA7bDxpOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09ZVt1KytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKG4pfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWU9PntsZXQgdD1lLmxlbmd0aCxpLGYsaD10aGlzLmNoYW5uZWxzLGEscyxyLHUsbixwLGwsbSxCO2lmKHQlaCE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKGk9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGY9W10sYT10aGlzLnJhdGlvV2VpZ2h0LHM9MCx1PTAsbj0wLHA9IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsQj0wLHI9MDtyPGg7KytyKWZbcl09MDtkb3tpZihwKWZvcihzPWEscj0wO3I8aDsrK3IpZltyXT0wO2Vsc2V7Zm9yKHM9dGhpcy5sYXN0V2VpZ2h0LHI9MDtyPGg7KytyKWZbcl09dGhpcy5sYXN0T3V0cHV0W3JdO3A9ITB9Zm9yKDtzPjAmJnU8dDspaWYobj0xK3UtQixzPj1uKXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KytdKm47Qj11LHMtPW59ZWxzZXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KyhyPjA/cjowKV0qcztCKz1zLHM9MDticmVha31pZihzPT09MClmb3Iocj0wO3I8aDsrK3IpbFttKytdPWZbcl0vYTtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9cyxyPTA7cjxoOysrcil0aGlzLmxhc3RPdXRwdXRbcl09ZltyXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKHU8dCYmbTxpKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoZSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihlKX19O2Z1bmN0aW9uIGQobyl7bGV0IGU9by5sZW5ndGgsdD1uZXcgSW50MTZBcnJheShlKTtmb3IoO2UtLTspe2xldCBpPU1hdGgubWF4KC0xLE1hdGgubWluKDEsb1tlXSkpO3RbZV09aTwwP2kqMzI3Njg6aSozMjc2N31yZXR1cm4gdH1mdW5jdGlvbiB3KG8pe2xldCBlPW8ubGVuZ3RoLHQ9bmV3IEJpZ0ludDY0QXJyYXkoZSk7Zm9yKDtlLS07KXtsZXQgaT1NYXRoLm1heCgtMSxNYXRoLm1pbigxLG9bZV0pKTt0W2VdPUJpZ0ludChNYXRoLmZsb29yKGk8MD9pKjMyNzY4OmkqMzI3NjcpKSoweDEwMDAwMDAwMDAwMG59cmV0dXJuIHR9dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoZSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFlKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtlfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9ZSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoZSx0KT0+ZSt0Lmxlbmd0aCwwKX1mZWVkKGUpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChlKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQsaSk9PnQraS5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgZT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgZSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLGk9MDtmb3IoO2khPXQubGVuZ3RoOyl7aWYoaT50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtpfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGY9dC5sZW5ndGgtaSxoPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sYT1oLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7YTxmPyh0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCksaSksaSs9YSx0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrZiksaSksaSs9Zix0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWYpfXJldHVybiB0fXBhZCgpe2xldCBlPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoZT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLGk9bmV3IHQoZSk7dGhpcy5mZWVkKGkpfX07dmFyIHk9Y2xhc3MgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3J7Y29uc3RydWN0b3IodCl7c3VwZXIodCk7dGhpcy5mb3JtYXQ9ImludDE2Ijt0aGlzLmlucHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSw0MDk2KTt0aGlzLnBvcnQub25tZXNzYWdlPWk9PnRoaXMub25NZXNzYWdlKGkpfW9uTWVzc2FnZSh0KXt0LmRhdGEuYWN0aW9uPT0ic3RhcnQiJiYodGhpcy5mb3JtYXQ9dC5kYXRhLmZvcm1hdCx0aGlzLnJlc2FtcGxlcj1uZXcgZyh0LmRhdGEuaW5wdXRTYW1wbGVSYXRlLHQuZGF0YS5vdXRwdXRTYW1wbGVSYXRlLDEsNDA5NiksdGhpcy5mb3JtYXQ9PSJpbnQxNiI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoSW50MTZBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoQmlnSW50NjRBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJmbG9hdDMyIiYmKHRoaXMub3V0cHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSkpKX1wcm9jZXNzKHQsaSxmKXtmb3IobGV0IGE9MDthPGkubGVuZ3RoO2ErKyl7bGV0IHM9TWF0aC5taW4oaVthXS5sZW5ndGgsdFswXS5sZW5ndGgpO2ZvcihsZXQgcj0wO3I8cztyKyspaVthXVtyXS5zZXQodFswXVtyXSl9aWYoIXRoaXMucmVzYW1wbGVyKXJldHVybiEwO2xldCBoPW5ldyBGbG9hdDMyQXJyYXkoaVswXVswXS5sZW5ndGgpO2ZvcihoLnNldChpWzBdWzBdKSx0aGlzLmlucHV0QnVmZmVyLmZlZWQoaCk7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspe2xldCBhPXRoaXMuaW5wdXRCdWZmZXIuZHJhaW4oKSxzPXRoaXMucmVzYW1wbGVyLnJlc2FtcGxlKGEpO3RoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMub3V0cHV0QnVmZmVyLmZlZWQoZChzKSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXIuZmVlZCh3KHMpKTp0aGlzLmZvcm1hdD09ImZsb2F0MzIiJiZ0aGlzLm91dHB1dEJ1ZmZlci5mZWVkKHMpfWZvcig7dGhpcy5vdXRwdXRCdWZmZXIuY2FuRHJhaW47KXtsZXQgYT10aGlzLm91dHB1dEJ1ZmZlci5kcmFpbigpO2lmKCFhKWJyZWFrO3RoaXMucG9ydC5wb3N0TWVzc2FnZSh7YWN0aW9uOiJkYXRhIixidWZmZXI6YS5idWZmZXJ9LFthLmJ1ZmZlcl0pfXJldHVybiEwfX07cmVnaXN0ZXJQcm9jZXNzb3IoInBjbS1yZWNlaXZlci1ub2RlIix5KTsK";var Ak=new ge("PCMPlayerNode"),as=class extends AudioWorkletNode{constructor(t,a,n){super(t,"pcm-player-node",{numberOfInputs:0});this.sampleRate=0;this.format="int16";this.isCancelled=!1;if(!a||a<=0)throw new Error(`Invalid sample rate: ${a}`);if(!n||n!="int16"&&n!="float32")throw new Error(`Invalid format: ${n}`);this.sampleRate=a,this.format=n,this.port.onmessage=i=>this.onWorkletMessage(i),this.port.postMessage({action:"start",inputSampleRate:a,outputSampleRate:t.sampleRate,format:n})}feed(t){this.port.postMessage({action:"data",buffer:t.buffer},[t.buffer])}async play(t){if(this.isCancelled)throw new Error("PCMPlayerNode has already been cancelled.");if(this._playPromise)throw new Error("Already playing a stream");this._playPromise=new Promise(a=>this._playPromiseResolve=a),this.dispatchEvent(new CustomEvent("start",{detail:{player:this,stream:t}}));try{let a=t.getReader();for(;!this.isCancelled;){let{done:n,value:i}=await a.read();if(n||!i)break;this.feed(i)}}catch(a){Ak.warn("Stream error:",a),this.dispatchEvent(new CustomEvent("error",{detail:{player:this,stream:t,error:a}}))}this.port.postMessage({action:"end"}),await this._playPromise}onWorkletMessage(t){t.data.action=="end"&&(this._playPromiseResolve?.(),this.dispatchEvent(new CustomEvent("end",{detail:{player:this}})))}stop(){this.isCancelled=!0,this.port.postMessage({action:"cancel"}),this._playPromiseResolve?.()}};var is=new ge("SpeechOutput"),nf=.5,Ik=.8,os=class extends EventTarget{constructor(t){super();this.maxVolumeHeard=0;this.ai=t,this.ai.addEventListener("output",a=>this.onTextOutputFromAI(a)),this.ai.audio?.speechRecognition.addEventListener("speechstart",a=>this.interrupt()),this.ai.knowledgeBase.registerSource(()=>[{id:"system.voice",type:"info",name:"Voice active",isContext:!0,disabled:!1,content:"Text-to-speech is active. The user can hear your voice."}])}onTextOutputFromAI(t){t.detail.isChunk||this.ai?.audio?.speechRecognition.isRunning&&this.speak(t.detail.message)}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let t=0;for(let n of this.analyserBuffer)t+=n*n;let a=Math.sqrt(t/this.analyserBuffer.length);return a>this.maxVolumeHeard&&(this.maxVolumeHeard=a),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,a/this.maxVolumeHeard))}async speak(t){if(!this.ai?.config?.voice?.providerID)return is.warn("No voice provider configured");let a=`speech-${Rk++}`;await this.ai.audio.beginAccess(a);try{await this._speakWithLock(t)}finally{this.ai.audio.endAccess(a)}}async _speakWithLock(t){this.interrupt(),this.ai.audio.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=Ik);let a=this.ai?._voiceTracker||is.timer(`${this.ai.config.voice.providerID} voice`);a(`Speak: ${t}`),this.currentPlayerVolume?.disconnect(),this.currentPlayerVolume=this.ai.audio.context.createGain(),this.currentPlayerVolume.connect(this.ai.audio.context.destination),this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,this.analyserNode.connect(this.currentPlayerVolume),this.maxVolumeHeard=0,this.analyserBuffer=new Float32Array(this.analyserNode.fftSize);let n=new as(this.ai.audio.context,24e3,"int16");this.currentPlayer=n,n.connect(this.analyserNode),n.addEventListener("end",o=>{let s=o;a(`PCM stream ${s.detail.interrupted?"interrupted":"ended"}`),this.currentPlayer==n&&!s.detail.interrupted&&(this.currentPlayer=void 0,this.onSpeechEnd())});let i;if(this.ai.config.voice.providerID=="openai")i=await fetch("https://api.openai.com/v1/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.ai.config.voice.apiKey}`},body:JSON.stringify({model:"tts-1",input:t,voice:this.ai.config.voice.voiceID,response_format:"pcm"})});else if(this.ai.config.voice.providerID=="elevenlabs")i=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${this.ai.config.voice.voiceID}?output_format=pcm_24000`,{method:"POST",headers:{"xi-api-key":`${this.ai.config.voice.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({text:t})});else{is.warn(`Unknown voice provider: ${this.ai.config.voice.providerID}`);return}if(a(`Received response ${i.status} ${i.statusText}`),!i.ok){is.warn(`Failed to generate voice sample: ${i.status} ${i.statusText}`);return}this.dispatchEvent(new CustomEvent("speechstart",{detail:{ai:this.ai,message:t}})),a("Playing PCM stream"),await n.play(i.body),a("Audio has ended")}get isSpeaking(){return!!this.currentPlayer}async interrupt(){if(!this.currentPlayerVolume)return;let t=this.currentPlayerVolume,a=this.currentPlayer;this.currentPlayerVolume=void 0,this.currentPlayer=void 0,this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=nf);let n=400;t.gain.linearRampToValueAtTime(0,n/1e3),await new Promise(i=>setTimeout(i,n+250)),t.disconnect(),a?.stop(),a?.disconnect()}onSpeechEnd(){this.dispatchEvent(new CustomEvent("speechend",{detail:{ai:this.ai}})),this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=nf)}},Rk=1;function ss(r,e){let t=e.reduce((l,c)=>l+c.byteLength,0),a=new DataView(new ArrayBuffer(44));a.setUint8(0,82),a.setUint8(1,73),a.setUint8(2,70),a.setUint8(3,70),a.setUint32(4,44+t,!0),a.setUint8(8,87),a.setUint8(9,65),a.setUint8(10,86),a.setUint8(11,69);let n=1,i=32,o=n*i/8,s=r*o;return a.setUint8(12,102),a.setUint8(13,109),a.setUint8(14,116),a.setUint8(15,32),a.setUint32(16,16,!0),a.setUint16(20,3,!0),a.setUint16(22,n,!0),a.setUint32(24,r,!0),a.setUint32(28,s,!0),a.setUint16(32,o,!0),a.setUint16(34,i,!0),a.setUint8(36,100),a.setUint8(37,97),a.setUint8(38,116),a.setUint8(39,97),a.setUint32(40,t,!0),new File([a,...e],"audio.wav",{type:"audio/wav"})}var ls=class extends AudioWorkletNode{constructor(t,a,n,i){super(t,"pcm-receiver-node",{numberOfInputs:1});this.format="int16";this.format=n;let o=["int16","int64","float32"];if(!a||a<=0)throw new Error(`Invalid sample rate: ${a}`);if(!o.includes(n))throw new Error(`Invalid format ${n}, must be one of: ${o.join(", ")}`);if(!i||i<=0)throw new Error(`Invalid buffer size: ${i}`);this.port.onmessage=s=>this.onWorkletMessage(s),this.port.postMessage({action:"start",inputSampleRate:t.sampleRate,outputSampleRate:a,format:n,bufferSize:i})}onWorkletMessage(t){if(t.data.action=="data"){let a=null;if(this.format=="int16"&&(a=new Int16Array(t.data.buffer)),this.format=="int64"&&(a=new BigInt64Array(t.data.buffer)),this.format=="float32"&&(a=new Float32Array(t.data.buffer)),!a)throw new Error(`Invalid format: ${this.format}`);this.onData(a),this.dispatchEvent(new CustomEvent("data",{detail:{data:a}}))}}onData(t){}};var Yc=16e3,cs=256,ca=8,ri=new ge("VoiceDetectionNode"),ni=class ni extends ls{constructor(t){super(t,Yc,"float32",cs*ca);this.isVoiceActive=!1;this.lastVoiceActiveDate=0;this.voiceEndTimeout=50;this.sensitivity=.5;this.sentivityEnd=.2;this.nextVadReset=0;this.currentProbability=0;this._lastVoiceActive=!1;if(!ni.vadModelURL)throw new Error("VAD model url not set, please load it and set it to VoiceDetectionNode.vadModelURL");this.loadModel()}get isVoicePossiblyEnding(){return this.isVoiceActive&&this.currentProbability<this.sensitivity}get sampleRate(){return Yc}get numberOfSamples(){return cs}get numberOfSampleChunks(){return ca}get outputBufferSize(){return cs*ca}get isModelLoaded(){return!!this.vad}async loadModel(){ri.debug("Loading VAD model"),this.vad=await Jt.load(ni.vadModelURL),this.vad.ignoreIfBusy=!0,ri.debug("Model loaded"),this.vad.makeConstant("sr","int64",[1],Yc),this.vad.makeState("h","hn","float32",[2,ca,64]),this.vad.makeState("c","cn","float32",[2,ca,64])}async onData(t){if(this.vad)try{let a=await this.vad.run({input:new Jt.onnx.Tensor(t,[ca,cs])});if(!a)return;this.currentProbability=0;for(let o=0;o<a.output.data.length;o++)a.output.data[o]>this.currentProbability&&(this.currentProbability=a.output.data[o]);let n=this.isVoiceActive?this.sentivityEnd:this.sensitivity,i=this.currentProbability>n;if(!i&&this._lastVoiceActive&&(this.nextVadReset=Date.now(),this.vad.resetState()),this._lastVoiceActive=i,i&&!this.isVoiceActive?(this.lastVoiceActiveDate=Date.now(),this.isVoiceActive=!0,this.dispatchEvent(new CustomEvent("speechstart")),this.onSpeechStart(),ri.debug("Started speaking")):i?this.lastVoiceActiveDate=Date.now():!i&&this.isVoiceActive&&Date.now()<this.lastVoiceActiveDate+this.voiceEndTimeout||!i&&this.isVoiceActive&&(this.isVoiceActive=!1,this.dispatchEvent(new CustomEvent("speechend")),this.onSpeechEnd(),ri.debug("Stopped speaking after timeout")),!i){let o=Date.now();o>this.nextVadReset&&(this.nextVadReset=o+5e3,this.vad.resetState())}}catch(a){ri.error("VAD failed:",a)}}onSpeechStart(){}onSpeechEnd(){}};ni.vadModelURL="";var ua=ni;var af=new ge("VoiceChunkOutputNode"),da=class extends ua{constructor(){super(...arguments);this.buffers=[];this.recordedBuffers=[];this._voiceRecording=!1;this.backBufferDurationSeconds=3}get bufferDuration(){return this.buffers.reduce((t,a)=>t+a.length,0)/8e3}async onData(t){if(await super.onData(t),this.isVoiceActive&&!this._voiceRecording){af.debug(`Voice detected, sending ${this.buffers.length} existing chunks`),this._voiceRecording=!0;for(let a of this.buffers)this.recordedBuffers.push(a),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:a,isFinal:!1}})),this.onVoiceChunk(a);this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!1}})),this.onVoiceChunk(t),this.buffers=[]}else if(this.isVoiceActive)this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!1}})),this.onVoiceChunk(t);else if(!this.isVoiceActive&&this._voiceRecording){this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!0}})),this.onVoiceChunk(t),this._voiceRecording=!1;let a=this.recordedBuffers.reduce((n,i)=>n+i.length,0);af.debug(`Voice complete, recorded ${(a/8e3).toFixed(2)} seconds of audio, ${a*4/1024} KB of data`),this.dispatchEvent(new CustomEvent("voicedataend",{detail:{data:this.recordedBuffers}})),this.onVoiceEnd(this.recordedBuffers),this.recordedBuffers=[]}else for(this.buffers.push(t);this.bufferDuration>this.backBufferDurationSeconds;)this.buffers.shift()}onVoiceChunk(t){}onVoiceEnd(t){}};var us=new ge("OpenAITranscriptionNode"),ds=class extends da{constructor(t,a){super(t);this.apiKey="";this.pendingBuffers=[];this.isTranscribing=!1;this.apiKey=a}async onVoiceEnd(t){let a=us.timer("OpenAI Transcribe");this.isTranscribing=!0,this.pendingBuffers.push(...t);let n=ss(this.sampleRate,this.pendingBuffers);this.lastRequestAbortController?.abort(),this.lastRequestAbortController=new AbortController;let i="";try{let o=new FormData;o.append("file",n),o.append("model","whisper-1"),o.append("response_format","text");let s=await fetch("https://api.openai.com/v1/audio/transcriptions",{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o,signal:this.lastRequestAbortController.signal});if(!s.ok)throw new Error(`Failed to generate voice sample: ${s.status} ${s.statusText}`);a("Response received"),i=await s.text(),a("Content received: "+i),this.lastRequestAbortController=void 0}catch(o){us.error(`Failed to transcribe speech: ${o.message}`);return}finally{this.isTranscribing=!1}if(this.pendingBuffers=[],!i)return us.debug("Transcription complete, but no text was found");us.debug(`Transcription: ${i}`),this.onVoiceTranscription(i),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:i}}))}onVoiceTranscription(t){}};var ps=class extends WebSocket{constructor(t){super(t);this.pendingData=[];this.addEventListener("open",()=>this._onOpen())}send(t){this.readyState==WebSocket.OPEN?super.send(t):this.pendingData.push(t)}_onOpen(){for(let t of this.pendingData)super.send(t);this.pendingData=[]}};var lr=new ge("IntelliWeaveTranscriptionNode"),Pk="wss://speech.intelliweave.ai/api/v1/transcribe",hs=class hs extends da{constructor(t,a){super(t);this.apiAddress=Pk;this.apiKey="";this.isTranscribing=!1;this.apiKey=a}async onVoiceChunk(t){this.isTranscribing=!0,this.ws?this.ws.send(t):(lr.debug("Opening WebSocket connection"),this.ws=new ps(this.apiAddress),this.ws.send(JSON.stringify({type:"hello",sampleRate:16e3,channels:1,format:"float32",apiKey:this.apiKey})),this.ws.send(t.buffer),this.ws.onopen=()=>{lr.debug("WebSocket connection opened")},this.ws.addEventListener("message",n=>{let i=JSON.parse(n.data);if(i.error)return lr.warn("Error: "+i.error);if(i.type!="transcription")return lr.warn("Invalid response type",i);if(i.streaming&&!i.final)return lr.debug("Partial transcription: "+i.partialText);if(this.isTranscribing=!1,!i.text.trim())return lr.warn(`Empty transcription (${i.processingTime}ms)`);lr.debug(`Transcription: ${i.text} (${i.processingTime}ms)`),this.onVoiceTranscription(i.text),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:i.text}}))}),this.ws.addEventListener("close",()=>this.onSocketClose()),this.ws.addEventListener("error",n=>lr.warn("WebSocket error")));let a=1e3*60*1;this.shutdownTimer&&clearTimeout(this.shutdownTimer),this.shutdownTimer=setTimeout(()=>{lr.debug("Shutting down WebSocket connection"),this.ws?.close(),this.ws=void 0},a)}async onVoiceEnd(t){if(this.ws?.send(JSON.stringify({type:"end"})),hs.debugExportWav){let a=ss(this.sampleRate,t),n=document.createElement("a");n.href=URL.createObjectURL(a),n.download="recording.wav",n.click()}}onVoiceTranscription(t){}onSocketClose(){lr.debug("WebSocket connection closed"),this.ws=void 0,this.isTranscribing=!1}};hs.debugExportWav=!1;var ms=hs;var Zc=new ge("SpeechRecognition"),gs=class extends EventTarget{constructor(t){super();this.isRunning=!1;this._skipEvents=!1;this.maxVolumeHeard=0;this.ai=t,this.ai.knowledgeBase.registerSource(()=>[{id:"system.microphone.enable",type:"action",name:"Enable or disable microphone",isContext:!0,content:`Starts or stops listening to input from the user through the microphone. ${this.isRunning?"Microphone access is currently enabled and you can hear the user.":"Microphone access is currently disabled."}.`,parameters:[{name:"enable",type:"boolean",description:"If true, enables the microphone. If false, disables it."}],action:async a=>{a.enable?await this.start():this.stop()}}])}get isSupported(){if(!Jt.lib||!this.ai?.vadModel||!Cr().AudioWorkletNode)return!1;if(this.ai?.config?.transcription?.providerID!="intelliweave"){if(!(this.ai?.config?.transcription?.providerID=="openai"&&this.ai.config?.transcription?.apiKey))return!1}return!0}async start(){if(!this.isSupported)throw new Error("Speech recognition not supported in this persona and browser.");if(!this.isRunning){this.isRunning=!0;try{await this.ai.audio.beginAccess("speech-recognition"),this.micStream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}});let t=this.ai.audio.context.createMediaStreamSource(this.micStream);this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,t.connect(this.analyserNode),this.analyserBuffer=new Float32Array(this.analyserNode.fftSize),ua.vadModelURL=URL.createObjectURL(this.ai.vadModel),this.ai?.config?.transcription?.providerID=="openai"?(this.voiceDetection=new ds(this.ai.audio.context,this.ai.config.transcription.apiKey),t.connect(this.voiceDetection)):(this.voiceDetection=new ms(this.ai.audio.context,this.ai.apiKey),this.voiceDetection.apiAddress=this.ai?.config?.transcription?.url||this.voiceDetection.apiAddress,t.connect(this.voiceDetection)),this.voiceDetection.addEventListener("speechstart",a=>{this.ai._voiceTracker=Zc.timer("voice interaction","Speech started"),this.recordingStartTime=Date.now(),pt(this.ai,{event_type:"voice_start",event_properties:{audio_provider:this.ai.config?.transcription?.providerID||"intelliweave",sample_rate:16e3}}),this.dispatchEvent(new CustomEvent(a.type,{detail:a.detail}))}),this.voiceDetection.addEventListener("speechend",a=>{this.ai._voiceTracker?.("Speech ended");let n=this.recordingStartTime?Date.now()-this.recordingStartTime:0;pt(this.ai,{event_type:"voice_end",event_properties:{recording_duration_ms:n}}),this.dispatchEvent(new CustomEvent(a.type,{detail:a.detail}))}),this.voiceDetection.addEventListener("transcription",a=>{this.ai._voiceTracker?.(`Transcription: ${a.detail.text}`),pt(this.ai,{event_type:"voice_submit",value_str:"",event_properties:{transcription_provider:this.ai.config?.transcription?.providerID||"intelliweave",confidence_score:a.detail.confidence||void 0}}),this.onTranscription(a)}),this._skipEvents||this.dispatchEvent(new CustomEvent("start",{detail:{speechRecognition:this}}))}catch(t){Zc.error("Failed to start speech recognition:",t),this.stop()}}}stop(){this.isRunning&&(this.isRunning=!1,this.ai.audio.endAccess("speech-recognition"),this.voiceDetection?.disconnect(),this.voiceDetection=void 0,this.micStream?.getTracks().forEach(t=>t.stop()),this.micStream=void 0,this.analyserNode=void 0,this.analyserBuffer=void 0,this._skipEvents||this.dispatchEvent(new CustomEvent("end",{detail:{speechRecognition:this}})))}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let t=0;for(let n of this.analyserBuffer)t+=n*n;let a=Math.sqrt(t/this.analyserBuffer.length);return a>this.maxVolumeHeard&&(this.maxVolumeHeard=a),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,a/this.maxVolumeHeard))}get wordsCurrentlyBeingSpoken(){return!!this.voiceDetection?.isVoiceActive}get isTranscribing(){return!!this.voiceDetection?.isTranscribing}onTranscription(t){let a=t.detail.text;Zc.debug("Heard:",a),this.dispatchEvent(new CustomEvent("speech",{detail:{transcript:a,isFinal:!0}}))}async reset(){if(this.isRunning){this._skipEvents=!0;try{this.stop(),await this.start(),this._skipEvents=!1}catch(t){throw this._skipEvents=!1,t}}}};var fs=new ge("AudioSystem"),pa=class{constructor(e){this.locks=[];if(!e)throw new Error("AI reference is required. Please pass in the IntelliWeave instance to the constructor.");this.ai=e,this.ai.audio=this,this.speechRecognition=new gs(this.ai),this.speechOutput=new os(this.ai)}static get isSupported(){return!(!Jt.lib||!Cr().AudioWorkletNode)}async beginAccess(e){fs.debug(`Began access for: ${e}`),this.locks.includes(e)||this.locks.push(e),!this.context&&(fs.debug("Creating AudioContext"),this.context=new AudioContext({latencyHint:"interactive"}),this.context.resume(),await Promise.all([this.context.audioWorklet.addModule(tf),this.context.audioWorklet.addModule(rf)]))}endAccess(e){fs.debug(`Ended access for: ${e}`),this.locks=this.locks.filter(t=>t!=e),!this.locks.length&&(fs.debug("Closing AudioContext"),this.context?.close(),this.context=void 0)}};var DF=new ge("Stream");var Cn=Cs(vf(),1);var UF=new ge("React");var HF=(0,Cn.createContext)(void 0);var ii=new ge("Embed"),kn=class extends At{constructor(){super();this.config={};this.suggestions=[];this._previousOpenState=!1;this.html=()=>`
|
|
3545
3545
|
|
|
3546
3546
|
<!-- Styling -->
|
|
3547
3547
|
<style>
|
|
@@ -3706,7 +3706,7 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3706
3706
|
<div id='root' class='hidden'>
|
|
3707
3707
|
|
|
3708
3708
|
<!-- Logo -->
|
|
3709
|
-
${
|
|
3709
|
+
${Oa.add({id:"web-weaver-logo",logo:this.attr.logo})}
|
|
3710
3710
|
<div id='pulseanim' class="circle pulse"></div>
|
|
3711
3711
|
|
|
3712
3712
|
<!-- Inner container contains all the UI when the panel is open -->
|
|
@@ -3714,10 +3714,10 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3714
3714
|
</div>
|
|
3715
3715
|
|
|
3716
3716
|
<!-- LLM selector panel -->
|
|
3717
|
-
${
|
|
3717
|
+
${ti.add({id:"llm-selector-panel"})}
|
|
3718
3718
|
|
|
3719
3719
|
<!-- Interaction panel -->
|
|
3720
|
-
${
|
|
3720
|
+
${Na.add({id:"interaction-bar"})}
|
|
3721
3721
|
|
|
3722
3722
|
|
|
3723
3723
|
<!-- Powered by IW banner -->
|
|
@@ -3727,7 +3727,7 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3727
3727
|
|
|
3728
3728
|
</div>
|
|
3729
3729
|
|
|
3730
|
-
`;this._lastLogo="";this._lastBackground="";this._lastTextColor="";this._isProcessing=!1;this.ai=new
|
|
3730
|
+
`;this._lastLogo="";this._lastBackground="";this._lastTextColor="";this._isProcessing=!1;this.ai=new ra,pa.isSupported&&(this.ai.audio=new pa(this.ai))}onCreate(){Ne().embed&&ii.warn("Only one <web-weaver-embed> element should be on the page."),Ne().embed=this,this.child("root").addEventListener("click",n=>this.onContainerClick(n)),this.child("web-weaver-logo").addEventListener("click",n=>this.onLogoClick(n)),this.child("interaction-bar").addEventListener("input-message",n=>this.processInput(n.detail)),this.child("interaction-bar").addEventListener("llm-button-click",n=>this.state.llmPanelOpen=!this.state.llmPanelOpen),this.child("llm-selector-panel").addEventListener("select",n=>this.onLLMModelSelect(n)),this.child("interaction-bar").connectAI(this.ai),this.ai.onAIMessage=this.onAIMessage.bind(this),this.ai.onAIToolStart=this.onAIToolStart.bind(this),this.ai.knowledgeBase.addEntry({id:"ui.suggestResponse",type:"action",name:"Suggest a response",content:"Add a button with a suggested response for the user's next message. Supports multiple calls at once.",isContext:!0,parameters:[{name:"text",type:"string",description:"The suggested response for the user's next message."}],action:n=>(this.suggestions.push(n.text),this.ai.submitAnalyticsEvent({type:"suggest-response",text:n.text}),"Suggestion button added")});let a=this.attr.apiKey||Ne().apiKey;if(!a)return ii.warn("No API key specified, some features may be unavailable.");this.state.loading=!0,this.attr.hubAPI&&(this.ai.hubAPI=this.attr.hubAPI),this.ai.load(a).then(n=>{this.config=n,Ne().introductionMessage=this.config.introductionMessage,Ne().analytics=this.config.analytics!==void 0?!!this.config.analytics:Ne().analytics,this.applyConfigStylesAndAttributes(),this.child("root").classList.remove("hidden"),this.state.loading=!1,this.resetConversation()}).catch(n=>{ii.error("Failed to load AI configuration:",n),this.state.loading=!1;let i=this.child("web-weaver-embed-inner");i&&(i.innerHTML='<div class="output" style="color: red; padding: 20px;">Error loading configuration. Please try again later.</div>')})}applyConfigStylesAndAttributes(){let t=this.config,a=this.child("root");if(!a)return;let n=!1,o=this.getAttribute("logo")||t.logo;if(o&&o!==this._lastLogo){this._lastLogo=o,n=!0;let m=this.child("web-weaver-logo");m&&m.setAttribute("logo",o)}let l=this.getAttribute("background")||t.background;l!==this._lastBackground&&(this._lastBackground=l,n=!0,l?a.style.background=l:a.style.background="");let u=this.getAttribute("textColor")||t.textColor,p=this.child("interaction-bar");u!==this._lastTextColor&&(this._lastTextColor=u,n=!0,u?(a.style.color=u,p&&p.setAttribute("textColor",u)):(a.style.color="",p&&p.removeAttribute("textColor"))),n&&ii.debug("[WebWeaverEmbed] Applied UI Styling:",{finalLogo:o,finalBackground:a.style.background,finalTextColor:a.style.color})}onUpdate(){if(this.applyConfigStylesAndAttributes(),this.child("web-weaver-embed-inner").style.display=this.attr.open?"":"none",this.child("interaction-bar").style.display=this.attr.open?"":"none",this.child("llm-selector-panel").attr.open=this.state.llmPanelOpen,this.child("pulseanim").style.display=this.attr.open?"none":"",this.child("poweredby").style.display=this.attr.open?"flex":"none",this.attr.open&&!this._previousOpenState)this._uiSessionStartTime=Date.now(),pt(this.ai,{event_type:"ui_open",event_properties:{trigger:"button_click"}});else if(!this.attr.open&&this._previousOpenState){let t=this._uiSessionStartTime?Date.now()-this._uiSessionStartTime:0;pt(this.ai,{event_type:"ui_close",event_properties:{trigger:"button_click",session_duration_ms:t}})}this._previousOpenState=this.attr.open,this.attr.open?this.child("root").classList.add("open"):this.child("root").classList.remove("open"),this.child("root").style.right=this.attr.offsetX?this.attr.offsetX+"px":"20px",this.child("root").style.bottom=this.attr.offsetY?this.attr.offsetY+"px":"20px",this.child("interaction-bar").attr.loading=this.state.loading,this.child("interaction-bar").attr.llmName=this.ai.currentModel?.metadata?.name||this.ai.currentModel?.id||"None",this.child("interaction-bar").attr.llmButtonVisible=this.ai.models.length>1,this.child("llm-selector-panel").state.items=this.ai.models.sort((t,a)=>(a.priority||0)-(t.priority||0)),this.child("llm-selector-panel").state.selectedID=this.ai.currentModel?.id}onDestroy(){Ne().embed==this&&(Ne().embed=void 0)}onContainerClick(t){this.attr.open||(t.preventDefault(),this.attr.open=!0)}onLogoClick(t){t.preventDefault(),t.stopPropagation(),this.attr.focusID?this.attr.focusID="":this.attr.open=!this.attr.open}open(){this.attr.open=!0}close(){this.attr.open=!1}resetConversation(){let t=this.child("web-weaver-embed-inner");for(this.state.llmPanelOpen=!1;t.children.length>0;)t.children[0].remove();this.ai.resetConversation(),this.suggestions=[];let a=document.createElement("div");a.className="introduction-message",a.innerHTML=Ne().introductionMessage||`Welcome to <b>${document.title||"Web Weaver"}</b>. How can I help you?`,t.appendChild(a),this.ai.insertAssistantMessage(a.innerText);for(let n of Ne().introductionSuggestions||[]){let i=document.createElement("div");i.className="suggestion-button",i.innerText=n,i.addEventListener("click",o=>this.onSuggestionClick(o,n)),t.appendChild(i)}}async processInput(t){if(this._isProcessing)return;this._isProcessing=!0,this.state.loading=!0,this.state.llmPanelOpen=!1;let a=this.child("web-weaver-embed-inner");this.suggestions=[];try{for(let i of Array.from(a.querySelectorAll(".suggestion-button")))i.remove();this.attr.focusID="";let n=document.createElement("div");n.className="input",n.innerText=t,a.appendChild(n),a.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"}),await this.ai.sendMessage(t);for(let i of this.suggestions){let o=document.createElement("div");o.className="suggestion-button",o.innerText=i,o.addEventListener("click",s=>this.onSuggestionClick(s,i)),a.appendChild(o)}a.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}catch(n){ii.error("Failed to process input:",n);let i=document.createElement("div");i.className="output",i.innerText="Sorry, there was a problem getting a response. "+n.message,a.appendChild(i);let o=document.createElement("div");o.className="suggestion-button",o.innerText="Reset conversation",o.addEventListener("click",s=>this.resetConversation()),a.appendChild(o)}this.state.loading=!1,this._isProcessing=!1}async onAIMessage(t){let a=await Xc().use($o).use(es).use(ko,{target:"_blank",rel:["noopener","noreferrer"]}).use(xo).use(Mo).processSync(t),n=this.child("web-weaver-embed-inner"),i=n.lastElementChild;if(i&&i.classList.contains("output"))i.innerHTML=a.toString("utf-8");else{let o=document.createElement("div");o.className="output",o.innerHTML=a.toString("utf-8"),n.appendChild(o)}for(let o of Array.from(n.querySelectorAll(".tool")))o.remove();n.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}onAIToolStart(t,a){let n=`Running: ${t}`;t=="search"&&(n=`Searching: ${a?.query}`),t=="ui.focusElement"&&(n=`Focusing: #${a?.elementID}`),t=="ui.suggestResponse"&&(n=`Suggested response: ${a?.text}`);let i=this.child("web-weaver-embed-inner"),o=document.createElement("div");o.className="tool",o.innerText=n,i.appendChild(o),i.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}onSuggestionClick(t,a){this.processInput(a)}onLLMModelSelect(t){t.preventDefault(),this.ai.setModel(t.detail),this.state.llmPanelOpen=!1}};kn.tagName="intelliweave-embed",kn.observedAttributes=["logo","focusID","open","background","textColor"];Jt.lib=()=>import("./ort.bundle.min-IUPKB45H.js");document.body.appendChild(kn.create());
|
|
3731
3731
|
/*! Bundled license information:
|
|
3732
3732
|
|
|
3733
3733
|
uri-js/dist/es5/uri.all.js:
|