@intelliweave/embedded 1.8.60 → 1.8.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
- import{b as Ni,c as va,d as _a,e as J}from"./chunk-AIYMQX7V.js";var Sl=Ni((sw,_l)=>{"use strict";var pi=Object.prototype.hasOwnProperty,vl=Object.prototype.toString,ml=Object.defineProperty,gl=Object.getOwnPropertyDescriptor,hl=function(n){return typeof Array.isArray=="function"?Array.isArray(n):vl.call(n)==="[object Array]"},fl=function(n){if(!n||vl.call(n)!=="[object Object]")return!1;var t=pi.call(n,"constructor"),i=n.constructor&&n.constructor.prototype&&pi.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!t&&!i)return!1;var r;for(r in n);return typeof r>"u"||pi.call(n,r)},yl=function(n,t){ml&&t.name==="__proto__"?ml(n,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):n[t.name]=t.newValue},bl=function(n,t){if(t==="__proto__")if(pi.call(n,t)){if(gl)return gl(n,t).value}else return;return n[t]};_l.exports=function e(){var n,t,i,r,a,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(n=arguments[l],n!=null)for(t in n)i=bl(s,t),r=bl(n,t),s!==r&&(u&&r&&(fl(r)||(a=hl(r)))?(a?(a=!1,o=i&&hl(i)?i:[]):o=i&&fl(i)?i:{},yl(s,{name:t,newValue:e(u,o,r)})):typeof r<"u"&&yl(s,{name:t,newValue:r}));return s}});var Wl=Ni(V=>{"use strict";var un=Symbol.for("react.element"),og=Symbol.for("react.portal"),sg=Symbol.for("react.fragment"),lg=Symbol.for("react.strict_mode"),cg=Symbol.for("react.profiler"),ug=Symbol.for("react.provider"),dg=Symbol.for("react.context"),pg=Symbol.for("react.forward_ref"),mg=Symbol.for("react.suspense"),gg=Symbol.for("react.memo"),hg=Symbol.for("react.lazy"),Nl=Symbol.iterator;function fg(e){return e===null||typeof e!="object"?null:(e=Nl&&e[Nl]||e["@@iterator"],typeof e=="function"?e:null)}var Ol={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Bl=Object.assign,Fl={};function Dt(e,n,t){this.props=e,this.context=n,this.refs=Fl,this.updater=t||Ol}Dt.prototype.isReactComponent={};Dt.prototype.setState=function(e,n){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,n,"setState")};Dt.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Gl(){}Gl.prototype=Dt.prototype;function ua(e,n,t){this.props=e,this.context=n,this.refs=Fl,this.updater=t||Ol}var da=ua.prototype=new Gl;da.constructor=ua;Bl(da,Dt.prototype);da.isPureReactComponent=!0;var Ll=Array.isArray,zl=Object.prototype.hasOwnProperty,pa={current:null},Ul={key:!0,ref:!0,__self:!0,__source:!0};function Hl(e,n,t){var i,r={},a=null,o=null;if(n!=null)for(i in n.ref!==void 0&&(o=n.ref),n.key!==void 0&&(a=""+n.key),n)zl.call(n,i)&&!Ul.hasOwnProperty(i)&&(r[i]=n[i]);var s=arguments.length-2;if(s===1)r.children=t;else if(1<s){for(var l=Array(s),c=0;c<s;c++)l[c]=arguments[c+2];r.children=l}if(e&&e.defaultProps)for(i in s=e.defaultProps,s)r[i]===void 0&&(r[i]=s[i]);return{$$typeof:un,type:e,key:a,ref:o,props:r,_owner:pa.current}}function yg(e,n){return{$$typeof:un,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function ma(e){return typeof e=="object"&&e!==null&&e.$$typeof===un}function bg(e){var n={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(t){return n[t]})}var Ml=/\/+/g;function ca(e,n){return typeof e=="object"&&e!==null&&e.key!=null?bg(""+e.key):n.toString(36)}function Ii(e,n,t,i,r){var a=typeof e;(a==="undefined"||a==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(a){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case un:case og:o=!0}}if(o)return o=e,r=r(o),e=i===""?"."+ca(o,0):i,Ll(r)?(t="",e!=null&&(t=e.replace(Ml,"$&/")+"/"),Ii(r,n,t,"",function(c){return c})):r!=null&&(ma(r)&&(r=yg(r,t+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(Ml,"$&/")+"/")+e)),n.push(r)),1;if(o=0,i=i===""?".":i+":",Ll(e))for(var s=0;s<e.length;s++){a=e[s];var l=i+ca(a,s);o+=Ii(a,n,t,l,r)}else if(l=fg(e),typeof l=="function")for(e=l.call(e),s=0;!(a=e.next()).done;)a=a.value,l=i+ca(a,s++),o+=Ii(a,n,t,l,r);else if(a==="object")throw n=String(e),Error("Objects are not valid as a React child (found: "+(n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n)+"). If you meant to render a collection of children, use an array instead.");return o}function xi(e,n,t){if(e==null)return e;var i=[],r=0;return Ii(e,i,"","",function(a){return n.call(t,a,r++)}),i}function vg(e){if(e._status===-1){var n=e._result;n=n(),n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var ge={current:null},Ri={transition:null},_g={ReactCurrentDispatcher:ge,ReactCurrentBatchConfig:Ri,ReactCurrentOwner:pa};function Vl(){throw Error("act(...) is not supported in production builds of React.")}V.Children={map:xi,forEach:function(e,n,t){xi(e,function(){n.apply(this,arguments)},t)},count:function(e){var n=0;return xi(e,function(){n++}),n},toArray:function(e){return xi(e,function(n){return n})||[]},only:function(e){if(!ma(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};V.Component=Dt;V.Fragment=sg;V.Profiler=cg;V.PureComponent=ua;V.StrictMode=lg;V.Suspense=mg;V.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_g;V.act=Vl;V.cloneElement=function(e,n,t){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var i=Bl({},e.props),r=e.key,a=e.ref,o=e._owner;if(n!=null){if(n.ref!==void 0&&(a=n.ref,o=pa.current),n.key!==void 0&&(r=""+n.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(l in n)zl.call(n,l)&&!Ul.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&s!==void 0?s[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=t;else if(1<l){s=Array(l);for(var c=0;c<l;c++)s[c]=arguments[c+2];i.children=s}return{$$typeof:un,type:e.type,key:r,ref:a,props:i,_owner:o}};V.createContext=function(e){return e={$$typeof:dg,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:ug,_context:e},e.Consumer=e};V.createElement=Hl;V.createFactory=function(e){var n=Hl.bind(null,e);return n.type=e,n};V.createRef=function(){return{current:null}};V.forwardRef=function(e){return{$$typeof:pg,render:e}};V.isValidElement=ma;V.lazy=function(e){return{$$typeof:hg,_payload:{_status:-1,_result:e},_init:vg}};V.memo=function(e,n){return{$$typeof:gg,type:e,compare:n===void 0?null:n}};V.startTransition=function(e){var n=Ri.transition;Ri.transition={};try{e()}finally{Ri.transition=n}};V.unstable_act=Vl;V.useCallback=function(e,n){return ge.current.useCallback(e,n)};V.useContext=function(e){return ge.current.useContext(e)};V.useDebugValue=function(){};V.useDeferredValue=function(e){return ge.current.useDeferredValue(e)};V.useEffect=function(e,n){return ge.current.useEffect(e,n)};V.useId=function(){return ge.current.useId()};V.useImperativeHandle=function(e,n,t){return ge.current.useImperativeHandle(e,n,t)};V.useInsertionEffect=function(e,n){return ge.current.useInsertionEffect(e,n)};V.useLayoutEffect=function(e,n){return ge.current.useLayoutEffect(e,n)};V.useMemo=function(e,n){return ge.current.useMemo(e,n)};V.useReducer=function(e,n,t){return ge.current.useReducer(e,n,t)};V.useRef=function(e){return ge.current.useRef(e)};V.useState=function(e){return ge.current.useState(e)};V.useSyncExternalStore=function(e,n,t){return ge.current.useSyncExternalStore(e,n,t)};V.useTransition=function(){return ge.current.useTransition()};V.version="18.3.1"});var ql=Ni((OT,jl)=>{"use strict";jl.exports=Wl()});var le=[];for(mn=0;mn<256;++mn)le.push((mn+256).toString(16).slice(1));var mn;function Sa(e,n=0){return(le[e[n+0]]+le[e[n+1]]+le[e[n+2]]+le[e[n+3]]+"-"+le[e[n+4]]+le[e[n+5]]+"-"+le[e[n+6]]+le[e[n+7]]+"-"+le[e[n+8]]+le[e[n+9]]+"-"+le[e[n+10]]+le[e[n+11]]+le[e[n+12]]+le[e[n+13]]+le[e[n+14]]+le[e[n+15]]).toLowerCase()}var gn,Ql=new Uint8Array(16);function Li(){if(!gn&&(gn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!gn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return gn(Ql)}var ec=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Mi={randomUUID:ec};function tc(e,n,t){if(Mi.randomUUID&&!n&&!e)return Mi.randomUUID();e=e||{};var i=e.random||(e.rng||Li)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,n){t=t||0;for(var r=0;r<16;++r)n[t+r]=i[r];return n}return Sa(i)}var Te=tc;function Oi(e){let n=(e||"").split(`
2
- `);for(;n.length>0&&n[0].trim()=="";)n.shift();for(;n.length>0&&n[n.length-1].trim()=="";)n.pop();let t=1/0;for(let i of n){let r=i.match(/^\s*/)?.[0].length||0;t=Math.min(t,r)}return t>0&&t<1/0&&(n=n.map(i=>i.substring(t))),n.join(`
3
- `)}var nc={};function He(){return typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:nc}function $(){return He().intelliweave=He().intelliweave||He().webWeaver||{},He().intelliweave}async function*Ea(e){let n="",t=function*(){for(;;){let a=n.indexOf(`
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(`
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 Mf={};function Sr(){return typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:Mf}function Ne(){return Sr().intelliweave=Sr().intelliweave||Sr().webWeaver||{},Sr().intelliweave}async function*uu(r){let e="",t=function*(){for(;;){let i=e.indexOf(`
4
4
 
5
- `);if(a==-1)break;let o=n.slice(0,a);n=n.slice(a+2);let s={},l=o.split(`
6
- `);for(let c of l){a=c.indexOf(": ");let u=c.slice(0,a),d=c.slice(a+2);a==-1&&(u=c,d=""),u&&(s[u]!==void 0?s[u]+=`
7
- `+d:s[u]=d)}yield s}},i=new TextDecoder,r=e.getReader();for(;;){let{done:a,value:o}=await r.read();if(a)break;n+=i.decode(o,{stream:!0}),yield*t()}n+=i.decode()+`
5
+ `);if(i==-1)break;let o=e.slice(0,i);e=e.slice(i+2);let s={},l=o.split(`
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
+ `+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 Ca(){if($().userID)return $().userID||"";if(typeof localStorage<"u"){let e=localStorage.getItem("intelliweave.uid")||"";return e||(e=Te(),localStorage.setItem("intelliweave.uid",e),e)}else return Te()}var hn=class hn{constructor(n){this.module="IntelliWeave";this.module=n}get debugEnabled(){return hn.debug?!0:typeof window<"u"&&$().debug}log(...n){this.debugEnabled&&console.log(`[IntelliWeave > ${this.module}]`,...n)}debug(...n){this.debugEnabled&&console.debug(`[IntelliWeave > ${this.module}]`,...n)}info(...n){this.debugEnabled&&console.info(`[IntelliWeave > ${this.module}]`,...n)}warn(...n){console.warn(`[IntelliWeave > ${this.module}]`,...n)}error(...n){console.error(`[IntelliWeave > ${this.module}]`,...n)}timer(n,...t){let i=Date.now();return this.debug(`[${n} 0ms] Started`,...t),(...r)=>this.debug(`[${n} ${Math.floor(Date.now()-i)}ms]`,...r)}};hn.debug=!1;var q=hn;var ka=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/","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"," ",`
9
+ `,yield*t()}function du(){if(Ne().userID)return Ne().userID||"";if(typeof localStorage<"u"){let r=localStorage.getItem("intelliweave.uid")||"";return r||(r=Wt(),localStorage.setItem("intelliweave.uid",r),r)}else return Wt()}function pu(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 ci=class ci{constructor(e){this.module="IntelliWeave";this.module=e}get debugEnabled(){return ci.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)}};ci.debug=!1;var be=ci;var mu=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/","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 Ni,c as va,d as _a,e as J}from"./chunk-AIYMQX7V.js";var Sl=Ni((sw,_l
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'],wa=["IClient","ISODE","Issuer",`)}\r
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'],hu=["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,30 +3246,34 @@ import{b as Ni,c as va,d as _a,e as J}from"./chunk-AIYMQX7V.js";var Sl=Ni((sw,_l
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"],ic=ka.concat(wa);ka.length=0;wa.length=0;var Ta=ic;var mt="all";var Aa=e=>e<=127;function Bi(e){if(e.length===0)return!1;let n=e.charCodeAt(e.length-1);return n>=55296&&n<=56319}function rc(e){let n=0;for(;n<e.length;){let t=e[n],i=0,r=0;if(t<=127)i=1,r=t;else if((t&224)===192){if(i=2,r=t&31,t<=193)return!1}else if((t&240)===224)i=3,r=t&15;else if((t&248)===240){if(i=4,r=t&7,t>244)return!1}else return!1;if(n+i>e.length)return!1;for(let a=1;a<i;a++){let o=e[n+a];if(o===void 0||(o&192)!==128)return!1;r=r<<6|o&63}if(i===2&&r<128||i===3&&r<2048||i===4&&r<65536||r>=55296&&r<=57343||r>1114111)return!1;n+=i}return!0}var ac=new TextDecoder("utf8",{fatal:!1});function xa(e){if(rc(e))return ac.decode(e)}function Ia(e,n){let t=Math.min(e.length,n.length);for(let i=0;i<t;i++)if(e[i]!==n[i])return e[i]-n[i];return e.length-n.length}function Ra(e){let n=0;return e.forEach(t=>{n=Math.max(n,t)}),n}function Fi(e){return e.replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")}function Gi(e){let t=[...e].map(Fi).join("|");return new RegExp(`(${t})`)}var fn=new Uint8Array(0),gt=new TextDecoder("utf8"),yn=class{constructor({bytePairRankDecoder:n,specialTokensEncoder:t,tokenSplitRegex:i,mergeCacheSize:r=1e5}){J(this,"mergeableBytePairRankCount");J(this,"bytePairRankDecoder");J(this,"bytePairNonUtfRankDecoder",new Map);J(this,"bytePairNonUtfSortedEncoder");J(this,"bytePairStringRankEncoder");J(this,"tokenSplitRegex");J(this,"specialTokensEncoder");J(this,"specialTokensDecoder");J(this,"specialTokenPatternRegex");J(this,"textEncoder",new TextEncoder);J(this,"mergeCache");J(this,"mergeCacheSize");this.bytePairRankDecoder=n,this.bytePairStringRankEncoder=new Map,this.mergeCacheSize=r,r>0&&(this.mergeCache=new Map),this.mergeableBytePairRankCount=Object.keys(n).length;let a=[];n.forEach((l,c)=>{if(typeof l=="string"){this.bytePairStringRankEncoder.set(l,c);return}let u=new Uint8Array(l);a.push([u,c]),this.bytePairNonUtfRankDecoder.set(c,u)}),this.bytePairNonUtfSortedEncoder=a.sort((l,c)=>Ia(l[0],c[0])),this.specialTokensEncoder=t??new Map,this.specialTokensDecoder=t?new Map([...t].map(([l,c])=>[c,l])):new Map,this.tokenSplitRegex=i;let s=[...this.specialTokensEncoder.keys()].map(Fi).join("|");try{this.specialTokenPatternRegex=new RegExp(s,"y")}catch{throw new Error("Invalid regular expression pattern.")}}setMergeCacheSize(n){this.mergeCacheSize===0&&n>0&&(this.mergeCache=new Map),this.mergeCacheSize=n,n===0&&(this.mergeCache=void 0)}clearMergeCache(){this.mergeCache?.clear()}*encodeNativeGenerator(n,t){let i=0,r=0;for(;;){let a=this.findNextSpecialToken(n,t,i),o=a?.[0],s=o??n.length,l=i===0&&s===n.length?n:n.slice(i,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){r=1,yield[u];continue}let d=this.bytePairEncode(c);r=d.length,yield d}if(o!==void 0){let c=a[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],i=o+c.length,r=1}else break}return r}encodeNative(n,t){let i=0,r=[];for(;;){let a=this.findNextSpecialToken(n,t,i),o=a?.[0],s=o??n.length,l=i===0&&s===n.length?n:n.slice(i,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){r.push(u);continue}let d=this.bytePairEncode(c);r.push(...d)}if(o!==void 0){let c=a[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);r.push(u),i=o+c.length}else break}return r}countNative(n,t){let i=0,r=0;for(;;){let a=this.findNextSpecialToken(n,t,i),o=a?.[0],s=o??n.length,l=i===0&&s===n.length?n:n.slice(i,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){if(this.getBpeRankFromString(c)!==void 0){r++;continue}let d=this.bytePairEncode(c);r+=d.length}if(o!==void 0){let c=a[1];if(this.specialTokensEncoder.get(c)===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);r++,i=o+c.length}else break}return r}*decodeNativeGenerator(n){for(let t of n){let i=this.tryDecodeToken(t);i&&(yield i)}}decodeNative(n){let t="",i=fn;for(let r of n){let a=this.tryDecodeToken(r);if(a===void 0)throw new Error(`Token ${r} is not in the byte pair encoder.`);if(typeof a=="string")i!==fn&&(t+=gt.decode(i,{stream:!0}),i=fn),t+=a;else{let o=new Uint8Array(i.length+a.length);o.set(i),o.set(a,i.length),i=o}}return i!==fn&&(t+=gt.decode(i,{stream:!0})),t}async*decodeNativeAsyncIterable(n){for await(let t of n){let i=this.tryDecodeToken(t);i&&(yield i)}}getBpeRankFromString(n){return this.bytePairStringRankEncoder.get(n)}getBpeRankFromStringOrThrow(n){let t=this.getBpeRankFromString(n);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${n}`);return t}getBpeRankFromBytes(n){let t=xa(n);if(t!==void 0)return this.getBpeRankFromString(t);let i=this.binarySearch(n);if(i!==-1)return this.bytePairNonUtfSortedEncoder[i][1]}getBpeRankFromBytesOrThrow(n){let t=this.getBpeRankFromBytes(n);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${n.toString()}`);return t}binarySearch(n){let t=0,i=this.bytePairNonUtfSortedEncoder.length-1;for(;t<=i;){let r=t+i>>>1,a=this.bytePairNonUtfSortedEncoder[r][0],o=0,s=Math.min(a.length,n.length);for(let l=0;l<s&&(o=a[l]-n[l],o===0);l++);if(o===0&&(o=a.length-n.length),o===0)return r;o<0?t=r+1:i=r-1}return-1}findNextSpecialToken(n,t,i){let r=i;for(;;){this.specialTokenPatternRegex.lastIndex=r;let a=this.specialTokenPatternRegex.exec(n);if(!a)return;let o=a[0];if(t?.has(o))return[a.index+r,o];r=a.index+r+1}}tryDecodeToken(n){let t=this.bytePairRankDecoder[n];if(typeof t=="string")return t;if(typeof t=="object"){let i=this.bytePairNonUtfRankDecoder.get(n);if(i)return i}return this.specialTokensDecoder.get(n)}addToMergeCache(n,t){if(this.mergeCache){if(this.mergeCache.size>=this.mergeCacheSize){let i=this.mergeCache.keys().next().value;this.mergeCache.delete(i)}this.mergeCache.set(n,t)}}bytePairEncode(n){if(n.length===1&&Aa(n.codePointAt(0)))return[this.getBpeRankFromStringOrThrow(n)];if(this.mergeCache?.has(n)){let r=this.mergeCache.get(n);return this.mergeCache.delete(n),this.mergeCache.set(n,r),r}let t=this.textEncoder.encode(n),i=this.bytePairMerge(t);return this.addToMergeCache(n,i),i}bytePairMerge(n){let t=[],i=[],r=(o,s=t[o],l=t[o+2])=>{if(l===void 0)return Number.POSITIVE_INFINITY;let c=n.subarray(s,l);return this.getBpeRankFromBytes(c)??Number.POSITIVE_INFINITY};for(let o=0;o<=n.length;o++)t.push(o),o<n.length-1?i.push(r(o,o,o+2)):i.push(Number.POSITIVE_INFINITY);for(;t.length>1;){let o=Number.POSITIVE_INFINITY,s=-1;for(let l=0;l<i.length-1;l++){let c=i[l];c<o&&(o=c,s=l)}if(o===Number.POSITIVE_INFINITY||s===-1)break;t.splice(s+1,1),i.splice(s,1),i[s]=r(s),s>0&&(i[s-1]=r(s-1))}let a=[];for(let o=0;o<t.length-1;o++){let s=t[o],l=t[o+1],c=this.getBpeRankFromBytesOrThrow(n.subarray(s,l));a.push(c)}return a}};var Pa={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}},sc={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}},lc={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}},Da={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}},Na={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}},La={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}},Ma={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}},cc={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}},uc={humanName:"Text Embedding 3 Small",description:"Embedding model for small-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.02,batchInput:.01}},dc={humanName:"Text Embedding 3 Large",description:"Embedding model for large-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.13,batchInput:.065}},pc={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}},mc={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}},gc={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}},hc={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}},Oa={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}},fc={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}},yc={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}},bc={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}},Ba={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}},vc={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}},_c={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}},Sc={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}},Fa={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}},Ec={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}},Ga={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}},Cc={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}},za={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}},zi={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}},kc={...zi,humanName:"GPT-4 1106 Preview"},Ua={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}},Ha={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}},wc={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}},Tc={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}},Ac={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}},xc={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}},Ic={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}},Ui={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}},ja={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}},Rc=ja,Pc={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}},Dc={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}},Nc={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}},Lc={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}},Mc={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}},Oc={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}},Bc={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}},Fc={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}},Gc={humanName:"Ada",encoding:"r50k_base",description:"Base model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.4}},zc={humanName:"Babbage",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.5}},Uc={humanName:"Curie",encoding:"r50k_base",description:"Mid-range model for a variety of applications.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:2}},Hc={humanName:"Davinci",encoding:"p50k_base",description:"High-performance legacy model.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:20}},Vc={humanName:"Code Davinci 002",encoding:"p50k_base",description:"Legacy coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Va={humanName:"Code Davinci 001",encoding:"p50k_base",description:"Older coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Wc={humanName:"Code Davinci 001",encoding:"p50k_edit",description:"Older coding model.",shutdownDate:"2023-03-23"},jc={humanName:"Code Cushman 002",encoding:"p50k_base",description:"Legacy model for coding.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Wa={humanName:"Code Cushman 001",encoding:"p50k_base",description:"Older model for coding tasks.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},qc={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}},Kc={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}},Xc={...Ui,humanName:"GPT-4 32k 0314"},Yc={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}},Jc={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}},Zc={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}},$c={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}},Qc={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}},eu={humanName:"Text Davinci 001",encoding:"p50k_edit",description:"Older text model.",shutdownDate:"2023-03-23"},tu={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}},nu={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}},iu={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}},ru={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}},au={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}},ou={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}},su={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}},lu={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}},cu={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}},uu={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}},du={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}},Hi={o1:Na,"o1-2024-12-17":Na,"o1-preview":La,"o1-preview-2024-09-12":La,"o1-mini":Ma,"o1-mini-2024-09-12":Ma,"o3-mini":cc,"chatgpt-4o-latest":Cc,"gpt-4o":Pa,"gpt-4o-2024-11-20":sc,"gpt-4o-2024-08-06":Pa,"gpt-4o-2024-05-13":lc,"gpt-4o-mini":Da,"gpt-4o-mini-2024-07-18":Da,"gpt-4o-realtime-preview":mc,"gpt-4o-realtime-preview-2024-10-01":gc,"gpt-4o-realtime-preview-2024-12-17":hc,"gpt-4o-mini-realtime-preview":Oa,"gpt-4o-mini-realtime-preview-2024-12-17":Oa,"gpt-4o-audio-preview":fc,"gpt-4o-audio-preview-2024-10-01":yc,"gpt-4o-audio-preview-2024-12-17":bc,"gpt-4o-mini-audio-preview":Ba,"gpt-4o-mini-audio-preview-2024-12-17":Ba,"gpt-4o-2024-08-06-finetune":vc,"gpt-4o-mini-2024-07-18-finetune":_c,"gpt-4o-mini-training":Fa,"gpt-4o-mini-training-2024-07-18":Fa,"davinci-002-finetune":Ac,"babbage-002-finetune":Ic,"gpt-4-turbo":Ga,"gpt-4-turbo-2024-04-09":Ga,"gpt-4-turbo-preview":zi,"gpt-4-0125-preview":zi,"gpt-4-1106-preview":kc,"gpt-4":za,"gpt-4-0613":za,"gpt-3.5-turbo":Ua,"gpt-3.5-turbo-0125":Ua,"gpt-3.5-turbo-1106":wc,"gpt-3.5-turbo-finetune":Sc,"gpt-3.5-turbo-16k":Ec,"gpt-4-32k":Ui,"gpt-4-32k-0613":Ui,"gpt-4-vision-preview":ja,"gpt-4-1106-vision-preview":Rc,"gpt-4-0314":qc,"gpt-4-32k-0314":Xc,"gpt-3.5-turbo-0613":Pc,"gpt-3.5-turbo-16k-0613":Dc,"gpt-3.5-turbo-0301":Kc},bn={...Hi,"text-embedding-3-small":uc,"text-embedding-3-large":dc,"text-embedding-ada-002":pc,"gpt-3.5-turbo-instruct":Ha,"gpt-3.5-turbo-instruct-0914":Ha,"davinci-002":Tc,"babbage-002":xc,"text-ada-001":Nc,"text-babbage-001":Lc,"text-curie-001":Mc,"text-davinci-001":Oc,"text-davinci-002":Bc,"text-davinci-003":Fc,ada:Gc,babbage:zc,curie:Uc,davinci:Hc,"code-davinci-002":Vc,"code-davinci-001":Va,"davinci-codex":Va,"code-davinci-edit-001":Wc,"code-cushman-002":jc,"code-cushman-001":Wa,"cushman-codex":Wa,"code-search-ada-code-001":$c,"code-search-ada-text-001":Qc,"text-davinci-edit-001":eu,"text-similarity-ada-001":Yc,"text-search-ada-doc-001":Jc,"text-search-ada-query-001":Zc,"text-similarity-babbage-001":tu,"text-search-babbage-doc-001":nu,"text-search-babbage-query-001":iu,"code-search-babbage-code-001":ru,"code-search-babbage-text-001":au,"text-similarity-curie-001":ou,"text-search-curie-doc-001":su,"text-search-curie-query-001":lu,"text-similarity-davinci-001":cu,"text-search-davinci-doc-001":uu,"text-search-davinci-query-001":du};var Ee="<|endoftext|>",Ve="<|fim_prefix|>",We="<|fim_middle|>",je="<|fim_suffix|>",ht="<|im_start|>",ft="<|im_end|>",qe="<|im_sep|>",yt="<|endofprompt|>";var qa=Object.fromEntries(Object.entries(Hi).map(([e,n])=>[e,n.encoding])),Ka=Object.fromEntries(Object.entries(bn).map(([e,n])=>[e,n.encoding])),pu={messageSeparator:`
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:`
3250
3250
  `,roleSeparator:`
3251
- `},mu={messageSeparator:"",roleSeparator:qe},Xa=Object.fromEntries(Object.keys(qa).flatMap(e=>e.startsWith("gpt-4")?[[e,mu]]:e.startsWith("gpt-3.5-turbo")?[[e,pu]]:[])),Kg=Object.keys(qa);var bt=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,vn=/(?:'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 Ya(e){return{tokenSplitRegex:vn,bytePairRankDecoder:e,specialTokensEncoder:new Map([[Ee,100257],[Ve,100258],[We,100259],[je,100260],[ht,100264],[ft,100265],[qe,100266],[yt,100276]])}}function Ja(e){return{tokenSplitRegex:vn,bytePairRankDecoder:e,specialTokensEncoder:new Map([[Ee,199999],[Ve,2e5],[We,200001],[je,200002],[ht,200003],[ft,200004],[qe,200005],[yt,200006]])}}function Za(e){return{expectedVocabularySize:50281,tokenSplitRegex:bt,bytePairRankDecoder:e,specialTokensEncoder:new Map([[Ee,50256]])}}function $a(e){return{tokenSplitRegex:bt,bytePairRankDecoder:e,specialTokensEncoder:new Map([[Ee,50256],[Ve,50281],[We,50282],[je,50283]])}}function Qa(e){return{expectedVocabularySize:50257,tokenSplitRegex:bt,bytePairRankDecoder:e,specialTokensEncoder:new Map([[Ee,50256]])}}function Vi(e,n){let t=n(e);switch(e.toLowerCase()){case"r50k_base":return Qa(t);case"p50k_base":return Za(t);case"p50k_edit":return $a(t);case"cl100k_base":return Ya(t);case"o200k_base":return Ja(t);default:throw new Error(`Unknown encoding name: ${e}`)}}var Fe=class Fe{constructor({bytePairRankDecoder:n,specialTokensEncoder:t,expectedVocabularySize:i,modelName:r,...a}){J(this,"modelName");J(this,"bytePairEncodingCoreProcessor");J(this,"specialTokensEncoder");J(this,"specialTokensSet");J(this,"allSpecialTokenRegex");J(this,"defaultSpecialTokenConfig");J(this,"vocabularySize");this.specialTokensEncoder=t,this.specialTokensSet=new Set(this.specialTokensEncoder.keys()),this.allSpecialTokenRegex=Gi(this.specialTokensSet),this.bytePairEncodingCoreProcessor=new yn({bytePairRankDecoder:n,specialTokensEncoder:t,...a}),this.defaultSpecialTokenConfig=this.processSpecialTokens();let o=Math.max(n.length-1,Ra(t));if(this.vocabularySize=this.bytePairEncodingCoreProcessor.mergeableBytePairRankCount+t.size,i!==void 0){if(this.vocabularySize!==i)throw new Error("The number of mergeable tokens and special tokens must be equal to expectedVocabularySize.");if(o!==i-1)throw new Error(`The model encodings are invalid. The maximum token value must be equal to expectedVocabularySize - 1. Currently ${o}, expected ${i-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=r}static getEncodingApi(n,t){let i=Vi(n,t);return new Fe(i)}static getEncodingApiForModel(n,t){let i=Ka[n],r=Vi(i,t);return new Fe({...r,modelName:n})}processSpecialTokens({allowedSpecial:n,disallowedSpecial:t}={}){let i;if(n===mt||n?.has(mt)){n=new Set(this.specialTokensSet);let r=n;if(t===mt)throw new Error('allowedSpecial and disallowedSpecial cannot both be set to "all".');typeof t=="object"?t.forEach(a=>r.delete(a)):t=new Set}if(!t||t===mt||t.has(mt)){t=new Set(this.specialTokensSet);let r=t;n?.size?(n.forEach(a=>r.delete(a)),t.forEach(a=>n.delete(a)),t.size>0&&(i=Gi(t))):i=this.allSpecialTokenRegex}return{allowedSpecial:n,regexPattern:i}}encodeGenerator(n,t){let i=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(i.regexPattern){let r=n.match(i.regexPattern);if(r!==null)throw new Error(`Disallowed special token found: ${r[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNativeGenerator(n,i.allowedSpecial)}encode(n,t){let i=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(i.regexPattern){let r=n.match(i.regexPattern);if(r!==null)throw new Error(`Disallowed special token found: ${r[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNative(n,i.allowedSpecial)}*encodeChatGenerator(n,t=this.modelName){if(!t)throw new Error("Model name must be provided either during initialization or passed in to the method.");let i=Xa[t],r=this.specialTokensEncoder.get(ht),a=this.specialTokensEncoder.get(ft);if(!i||r===void 0||a===void 0)throw new Error(`Model '${t}' does not support chat.`);let o=new Set([qe]),{messageSeparator:s,roleSeparator:l}=i,c=s.length>0?this.encode(s):[],u=l.length>0?this.encode(l,{allowedSpecial:o}):[],d=new Map;for(let{role:m="system",name:p=m,content:f}of n){if(f===void 0)throw new Error("Content must be defined for all messages.");yield[r];let _=d.get(p)??this.encode(p);d.set(p,_),yield _,u.length>0&&(yield u),yield*this.encodeGenerator(f),yield[a],yield c}yield[r],yield*this.encodeGenerator("assistant"),u.length>0&&(yield u)}encodeChat(n,t=this.modelName){return[...this.encodeChatGenerator(n,t)].flat()}isWithinTokenLimit(n,t){let i=typeof n=="string"?this.encodeGenerator(n):this.encodeChatGenerator(n),r=0;for(let a of i)if(r+=a.length,r>t)return!1;return r}countTokens(n,t){if(typeof n=="string"){let a=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(a.regexPattern){let o=n.match(a.regexPattern);if(o!==null)throw new Error(`Disallowed special token found: ${o[0]}`)}return this.bytePairEncodingCoreProcessor.countNative(n,a.allowedSpecial)}let i=this.encodeChatGenerator(n),r=0;for(let a of i)r+=a.length;return r}setMergeCacheSize(n){this.bytePairEncodingCoreProcessor.setMergeCacheSize(n)}clearMergeCache(){this.bytePairEncodingCoreProcessor.clearMergeCache()}decode(n){return this.bytePairEncodingCoreProcessor.decodeNative(n)}*decodeGenerator(n){let t=this.bytePairEncodingCoreProcessor.decodeNativeGenerator(n),i="";for(let r of t)i+=typeof r=="string"?r:gt.decode(r,{stream:!0}),!(i.length===0||Bi(i))&&(yield i,i="");i.length>0&&(yield i)}async*decodeAsyncGenerator(n){let t=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(n),i="";for await(let r of t)i+=typeof r=="string"?r:gt.decode(r,{stream:!0}),!(i.length===0||Bi(i))&&(yield i,i="");i.length>0&&(yield i)}async decodeAsync(n){let t=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(n),i="";for await(let r of t)i+=typeof r=="string"?r:gt.decode(r,{stream:!0});return i}estimateCost(n,t=this.modelName){if(!t)throw new Error("Model name must be provided either during initialization or passed in to the method.");let i=bn[t];if(!i)throw new Error(`Unknown model: ${t}`);if(!i.cost)throw new Error(`No cost information available for model: ${t}`);let r=i.cost,a={},o=n/1e6;return r.input!==void 0&&(a.input=r.input*o),r.output!==void 0&&(a.output=r.output*o),r.batchInput!==void 0&&(a.batchInput=r.batchInput*o),r.batchOutput!==void 0&&(a.batchOutput=r.batchOutput*o),a}};J(Fe,"EndOfPrompt",yt),J(Fe,"EndOfText",Ee),J(Fe,"FimMiddle",We),J(Fe,"FimPrefix",Ve),J(Fe,"FimSuffix",je);var _n=Fe;var gu=_n.getEncodingApi("cl100k_base",()=>Ta),{decode:Dh,decodeAsyncGenerator:Nh,decodeGenerator:Lh,encode:Mh,encodeGenerator:Oh,isWithinTokenLimit:Bh,countTokens:Ot,encodeChat:Fh,encodeChatGenerator:Gh,vocabularySize:zh,setMergeCacheSize:Uh,clearMergeCache:Hh,estimateCost:Vh}=gu;var Sn=class{constructor(){this.size=4096;this.groups=[]}createGroup(n){let t=new Wi;return t.id=n,this.groups.push(t),t}group(n){return this.groups.find(t=>t.id===n)}countTokens(){return this.groups.reduce((n,t)=>n+t.tokenCount,0)}removeOverflow(){let n=this.countTokens(),t=this.groups.reduce((i,r)=>i+r.weight,0);for(;n>this.size;){let i=this.groups.slice().sort((a,o)=>{let s=Math.floor(a.weight/t*this.size),l=Math.floor(o.weight/t*this.size),c=a.tokenCount-s;return o.tokenCount-l-c}),r=this.removeOneItem(i);if(!r)throw new Error("Too many items in the token window that cannot be removed.");n-=r.tokenCount}}removeOneItem(n){for(let t of n){let i=t.items.findIndex(a=>!a.cannotRemove);if(i===-1)continue;let r=t.items[i];return t.items.splice(i,1),t.tokenCount-=r.tokenCount,r}return null}},Wi=class{constructor(){this.id="";this.items=[];this.weight=1;this.tokenCount=0;this.separator=`
3252
- `;this.itemPadding=0;this.sortFunction=(n,t)=>n.sortOrder!==t.sortOrder?n.sortOrder-t.sortOrder:n.dateAdded!==t.dateAdded?n.dateAdded-t.dateAdded:n.content.localeCompare(t.content)}setItemPadding(n){return this.itemPadding=n,this.recalculateTokens(),this}sortBy(n){return this.sortFunction=n,this.items.sort(this.sortFunction),this}setSeparator(n){return this.separator==n?this:(this.separator=n,this.recalculateTokens(),this)}setWeight(n){return this.weight=n,this}recalculateTokens(){this.tokenCount=this.items.reduce((n,t)=>(t.tokenCount=Ot(t.content)+Ot(this.separator)+this.itemPadding,n+t.tokenCount),0)}add(n){typeof n=="string"&&(n={content:n});let t=n;t.id===void 0&&(t.id=Te());let i=this.items.find(r=>r.id===t.id);return i?(this.tokenCount-=i.tokenCount,Object.assign(i,t),t=i):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:Ot(n.content)+Ot(this.separator)+this.itemPadding,this.tokenCount+=t.tokenCount,this.items.sort(this.sortFunction),t}getAllAsString(){return this.getAll().map(n=>n.content).join(this.separator)}getAll(){return this.items.filter(n=>!n.disabled)}empty(){this.items=[],this.tokenCount=0}};var vt=1,Ke=new q("ChatGPT"),En=class{constructor(n){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 n=new Sn;return n.createGroup("context").setSeparator(`
3251
+ `},Ky={messageSeparator:"",roleSeparator:kr},Fu=Object.fromEntries(Object.keys(Lu).flatMap(r=>r.startsWith("gpt-4")?[[r,Ky]]:r.startsWith("gpt-3.5-turbo")?[[r,qy]]:[])),wT=Object.keys(Lu);var Mn=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,mi=/(?:'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 Bu(r){return{tokenSplitRegex:mi,bytePairRankDecoder:r,specialTokensEncoder:new Map([[Ot,100257],[Er,100258],[wr,100259],[Cr,100260],[Nn,100264],[On,100265],[kr,100266],[Ln,100276]])}}function Gu(r){return{tokenSplitRegex:mi,bytePairRankDecoder:r,specialTokensEncoder:new Map([[Ot,199999],[Er,2e5],[wr,200001],[Cr,200002],[Nn,200003],[On,200004],[kr,200005],[Ln,200006]])}}function zu(r){return{expectedVocabularySize:50281,tokenSplitRegex:Mn,bytePairRankDecoder:r,specialTokensEncoder:new Map([[Ot,50256]])}}function Uu(r){return{tokenSplitRegex:Mn,bytePairRankDecoder:r,specialTokensEncoder:new Map([[Ot,50256],[Er,50281],[wr,50282],[Cr,50283]])}}function Hu(r){return{expectedVocabularySize:50257,tokenSplitRegex:Mn,bytePairRankDecoder:r,specialTokensEncoder:new Map([[Ot,50256]])}}function Ds(r,e){let t=e(r);switch(r.toLowerCase()){case"r50k_base":return Hu(t);case"p50k_base":return zu(t);case"p50k_edit":return Uu(t);case"cl100k_base":return Bu(t);case"o200k_base":return Gu(t);default:throw new Error(`Unknown encoding name: ${r}`)}}var pr=class pr{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=As(this.specialTokensSet),this.bytePairEncodingCoreProcessor=new di({bytePairRankDecoder:e,specialTokensEncoder:t,...i}),this.defaultSpecialTokenConfig=this.processSpecialTokens();let o=Math.max(e.length-1,vu(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=Ds(e,t);return new pr(a)}static getEncodingApiForModel(e,t){let a=Mu[e],n=Ds(a,t);return new pr({...n,modelName:e})}processSpecialTokens({allowedSpecial:e,disallowedSpecial:t}={}){let a;if(e===Pn||e?.has(Pn)){e=new Set(this.specialTokensSet);let n=e;if(t===Pn)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===Pn||t.has(Pn)){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=As(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=Fu[t],n=this.specialTokensEncoder.get(Nn),i=this.specialTokensEncoder.get(On);if(!a||n===void 0||i===void 0)throw new Error(`Model '${t}' does not support chat.`);let o=new Set([kr]),{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:Dn.decode(n,{stream:!0}),!(a.length===0||Ts(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:Dn.decode(n,{stream:!0}),!(a.length===0||Ts(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:Dn.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=pi[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(pr,"EndOfPrompt",Ln),Pe(pr,"EndOfText",Ot),Pe(pr,"FimMiddle",wr),Pe(pr,"FimPrefix",Er),Pe(pr,"FimSuffix",Cr);var hi=pr;var $y=hi.getEncodingApi("cl100k_base",()=>gu),{decode:lx,decodeAsyncGenerator:cx,decodeGenerator:ux,encode:dx,encodeGenerator:px,isWithinTokenLimit:mx,countTokens:ya,encodeChat:hx,encodeChatGenerator:gx,vocabularySize:fx,setMergeCacheSize:yx,clearMergeCache:bx,estimateCost:vx}=$y;var gi=class{constructor(){this.size=4096;this.groups=[]}createGroup(e){let t=new Ns;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}},Ns=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=ya(t.content)+ya(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=Wt());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:ya(e.content)+ya(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 Fn=1,Tr=new be("ChatGPT"),fi=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 gi;return e.createGroup("context").setSeparator(`
3253
3253
 
3254
- `),n.createGroup("actions").setItemPadding(25),n.createGroup("messages").setItemPadding(10),n})();this.config={...this.config,...n},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(n){let t={role:"user",content:n};this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(t),customData:t}),await this.processMessages();let r=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;return r?.role=="assistant"&&r.content||""}addAssistantMessage(n){let t={role:"assistant",content:n};this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(t),customData:t})}addUserMessage(n){let t={role:"user",content:n};this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(t),customData:t})}getMessages(){return this.messageGroup.items.map(n=>n.customData)}getLatestMessage(){return this.messageGroup.items.length?this.messageGroup.items[this.messageGroup.items.length-1]?.customData:void 0}async processMessages(){await this.config.onBeforeMessageProcessing?.(),Ke.debugEnabled&&Ke.debug("Process message state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(i=>i.customData),messages:this.messageGroup.items.map(i=>i.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 i of t.tool_calls)await this.processToolCall(i);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(n){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}Ke.debugEnabled&&Ke.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 i={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&&Ke.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:{type:"object",properties:{}}}};if(Array.isArray(c.params))for(let d of c.params)u.function.parameters.properties[d.name]={type:d.type,description:d.description};else if(c.params){let d=c.params;for(let m in d)u.function.parameters.properties[m]={type:"string",description:d[m]}}i.tools.push(u)}i.user||delete i.user,i.tools.length||delete i.tools;let r={};if(r["Content-Type"]="application/json",this.config.apiKey&&(r.Authorization=`Bearer ${this.config.apiKey}`),n)return i;let a=await fetch(this.config.endpoint||"https://api.openai.com/v1/chat/completions",{method:"POST",headers:r,body:JSON.stringify(i)});if(!a.ok){let l=`${a.status} ${a.statusText}`;try{let u=await a.json();l=u.errorText||u.error?.message||u.error||l}catch{}let c=new Error(l);throw c.code=a.status,c}let o=null,s=null;if(this.config.stream)for await(let l of Ea(a.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 d=s.tool_calls[u.index];d.function=d.function||{},d.function.name=(d.function.name||"")+(u.function?.name||""),d.function.arguments=(d.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 a.json(),this.stats.tokensUsed+=o.usage?.total_tokens||0,Ke.debug(`Used ${o.usage?.total_tokens||0} tokens, total used: ${this.stats.tokensUsed}`),s=o.choices?.[0]?.message;if(s||(Ke.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-"+vt++,content:JSON.stringify(s),customData:s}),s.content&&this.config.onAIMessage?.(s.content,!1)}processIncomingMessage(n){}registerTool(n){this.toolGroup.add({id:n.name,cannotRemove:!n.canRemove,content:JSON.stringify(n),customData:n})}async processToolCall(n){try{let i=this.toolGroup.items.find(s=>s.id==n.function.name)?.customData;if(!i)throw new Error(`Tool "${n.function.name}" not found.`);let r=JSON.parse(n.function.arguments);this.config.onAIToolStart?.(n.function.name,r);let a=await i.callback(r);typeof a!="string"&&(a=JSON.stringify(a)||""),(a===""||a==="undefined")&&(a="success");let o={role:"tool",content:a,tool_call_id:n.id};this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(o),customData:o})}catch(t){Ke.warn(`Unable to process tool call for "${n?.function?.name}"`,t);let i={role:"tool",content:`Error: ${t.message}`,tool_call_id:n.id};this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(i),customData:i})}}resetConversation(){this.messageGroup.empty()}};var Z=function(){return Z=Object.assign||function(n){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(n[a]=t[a])}return n},Z.apply(this,arguments)};function hu(e,n,t,i){function r(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(u){try{c(i.next(u))}catch(d){o(d)}}function l(u){try{c(i.throw(u))}catch(d){o(d)}}function c(u){u.done?a(u.value):r(u.value).then(s,l)}c((i=i.apply(e,n||[])).next())})}function fu(e,n){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,r,a,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(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(t=0)),t;)try{if(i=1,r&&(a=c[0]&2?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[c[0]&2,a.value]),c[0]){case 0:case 1:a=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,r=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){t.label=c[1];break}if(c[0]===6&&t.label<a[1]){t.label=a[1],a=c;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(c);break}a[2]&&t.ops.pop(),t.trys.pop();continue}c=n.call(e,t)}catch(u){c=[6,u],r=0}finally{i=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function U(e){var n=typeof Symbol=="function"&&Symbol.iterator,t=n&&e[n],i=0;if(t)return t.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function ee(e,n){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var i=t.call(e),r,a=[],o;try{for(;(n===void 0||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}var yu="ENTRIES",ro="KEYS",ao="VALUES",ce="",ji=function(){function e(n,t){var i=n._tree,r=Array.from(i.keys());this.set=n,this._type=t,this._path=r.length>0?[{node:i,keys:r}]:[]}return e.prototype.next=function(){var n=this.dive();return this.backtrack(),n},e.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var n=_t(this._path),t=n.node,i=n.keys;if(_t(i)===ce)return{done:!1,value:this.result()};var r=t.get(_t(i));return this._path.push({node:r,keys:Array.from(r.keys())}),this.dive()},e.prototype.backtrack=function(){if(this._path.length!==0){var n=_t(this._path).keys;n.pop(),!(n.length>0)&&(this._path.pop(),this.backtrack())}},e.prototype.key=function(){return this.set._prefix+this._path.map(function(n){var t=n.keys;return _t(t)}).filter(function(n){return n!==ce}).join("")},e.prototype.value=function(){return _t(this._path).node.get(ce)},e.prototype.result=function(){switch(this._type){case ao:return this.value();case ro:return this.key();default:return[this.key(),this.value()]}},e.prototype[Symbol.iterator]=function(){return this},e}(),_t=function(e){return e[e.length-1]},bu=function(e,n,t){var i=new Map;if(n===void 0)return i;for(var r=n.length+1,a=r+t,o=new Uint8Array(a*r).fill(t+1),s=0;s<r;++s)o[s]=s;for(var l=1;l<a;++l)o[l*r]=l;return oo(e,n,t,i,o,1,r,""),i},oo=function(e,n,t,i,r,a,o,s){var l,c,u=a*o;try{e:for(var d=U(e.keys()),m=d.next();!m.done;m=d.next()){var p=m.value;if(p===ce){var f=r[u-1];f<=t&&i.set(s,[e.get(p),f])}else{for(var _=a,E=0;E<p.length;++E,++_){for(var y=p[E],T=o*_,S=T-o,N=r[T],L=Math.max(0,_-t-1),b=Math.min(o-1,_+t),I=L;I<b;++I){var D=y!==n[I],P=r[S+I]+ +D,M=r[S+I+1]+1,H=r[T+I]+1,R=r[T+I+1]=Math.min(P,M,H);R<N&&(N=R)}if(N>t)continue e}oo(e.get(p),n,t,i,r,_,o,s+p)}}}catch(w){l={error:w}}finally{try{m&&!m.done&&(c=d.return)&&c.call(d)}finally{if(l)throw l.error}}},qi=function(){function e(n,t){n===void 0&&(n=new Map),t===void 0&&(t=""),this._size=void 0,this._tree=n,this._prefix=t}return e.prototype.atPrefix=function(n){var t,i;if(!n.startsWith(this._prefix))throw new Error("Mismatched prefix");var r=ee(kn(this._tree,n.slice(this._prefix.length)),2),a=r[0],o=r[1];if(a===void 0){var s=ee(er(o),2),l=s[0],c=s[1];try{for(var u=U(l.keys()),d=u.next();!d.done;d=u.next()){var m=d.value;if(m!==ce&&m.startsWith(c)){var p=new Map;return p.set(m.slice(c.length),l.get(m)),new e(p,n)}}}catch(f){t={error:f}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(t)throw t.error}}}return new e(a,n)},e.prototype.clear=function(){this._size=void 0,this._tree.clear()},e.prototype.delete=function(n){return this._size=void 0,vu(this._tree,n)},e.prototype.entries=function(){return new ji(this,yu)},e.prototype.forEach=function(n){var t,i;try{for(var r=U(this),a=r.next();!a.done;a=r.next()){var o=ee(a.value,2),s=o[0],l=o[1];n(s,l,this)}}catch(c){t={error:c}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},e.prototype.fuzzyGet=function(n,t){return bu(this._tree,n,t)},e.prototype.get=function(n){var t=Zi(this._tree,n);return t!==void 0?t.get(ce):void 0},e.prototype.has=function(n){var t=Zi(this._tree,n);return t!==void 0&&t.has(ce)},e.prototype.keys=function(){return new ji(this,ro)},e.prototype.set=function(n,t){if(typeof n!="string")throw new Error("key must be a string");this._size=void 0;var i=Ki(this._tree,n);return i.set(ce,t),this},Object.defineProperty(e.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var n=this.entries();!n.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),e.prototype.update=function(n,t){if(typeof n!="string")throw new Error("key must be a string");this._size=void 0;var i=Ki(this._tree,n);return i.set(ce,t(i.get(ce))),this},e.prototype.fetch=function(n,t){if(typeof n!="string")throw new Error("key must be a string");this._size=void 0;var i=Ki(this._tree,n),r=i.get(ce);return r===void 0&&i.set(ce,r=t()),r},e.prototype.values=function(){return new ji(this,ao)},e.prototype[Symbol.iterator]=function(){return this.entries()},e.from=function(n){var t,i,r=new e;try{for(var a=U(n),o=a.next();!o.done;o=a.next()){var s=ee(o.value,2),l=s[0],c=s[1];r.set(l,c)}}catch(u){t={error:u}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}return r},e.fromObject=function(n){return e.from(Object.entries(n))},e}(),kn=function(e,n,t){var i,r;if(t===void 0&&(t=[]),n.length===0||e==null)return[e,t];try{for(var a=U(e.keys()),o=a.next();!o.done;o=a.next()){var s=o.value;if(s!==ce&&n.startsWith(s))return t.push([e,s]),kn(e.get(s),n.slice(s.length),t)}}catch(l){i={error:l}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return t.push([e,n]),kn(void 0,"",t)},Zi=function(e,n){var t,i;if(n.length===0||e==null)return e;try{for(var r=U(e.keys()),a=r.next();!a.done;a=r.next()){var o=a.value;if(o!==ce&&n.startsWith(o))return Zi(e.get(o),n.slice(o.length))}}catch(s){t={error:s}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},Ki=function(e,n){var t,i,r=n.length;e:for(var a=0;e&&a<r;){try{for(var o=(t=void 0,U(e.keys())),s=o.next();!s.done;s=o.next()){var l=s.value;if(l!==ce&&n[a]===l[0]){for(var c=Math.min(r-a,l.length),u=1;u<c&&n[a+u]===l[u];)++u;var d=e.get(l);if(u===l.length)e=d;else{var m=new Map;m.set(l.slice(u),d),e.set(n.slice(a,a+u),m),e.delete(l),e=m}a+=u;continue e}}}catch(f){t={error:f}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(t)throw t.error}}var p=new Map;return e.set(n.slice(a),p),p}return e},vu=function(e,n){var t=ee(kn(e,n),2),i=t[0],r=t[1];if(i!==void 0){if(i.delete(ce),i.size===0)so(r);else if(i.size===1){var a=ee(i.entries().next().value,2),o=a[0],s=a[1];lo(r,o,s)}}},so=function(e){if(e.length!==0){var n=ee(er(e),2),t=n[0],i=n[1];if(t.delete(i),t.size===0)so(e.slice(0,-1));else if(t.size===1){var r=ee(t.entries().next().value,2),a=r[0],o=r[1];a!==ce&&lo(e.slice(0,-1),a,o)}}},lo=function(e,n,t){if(e.length!==0){var i=ee(er(e),2),r=i[0],a=i[1];r.set(a+n,t),r.delete(a)}},er=function(e){return e[e.length-1]},Bt,tr="or",co="and",_u="and_not",uo=function(){function e(n){if(n?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');var t=n.autoVacuum==null||n.autoVacuum===!0?Ji:n.autoVacuum;this._options=Z(Z(Z({},Yi),n),{autoVacuum:t,searchOptions:Z(Z({},eo),n.searchOptions||{}),autoSuggestOptions:Z(Z({},wu),n.autoSuggestOptions||{})}),this._index=new qi,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=Qi,this.addFields(this._options.fields)}return e.prototype.add=function(n){var t,i,r,a,o,s,l=this._options,c=l.extractField,u=l.tokenize,d=l.processTerm,m=l.fields,p=l.idField,f=c(n,p);if(f==null)throw new Error('MiniSearch: document does not have ID field "'.concat(p,'"'));if(this._idToShortId.has(f))throw new Error("MiniSearch: duplicate ID ".concat(f));var _=this.addDocumentId(f);this.saveStoredFields(_,n);try{for(var E=U(m),y=E.next();!y.done;y=E.next()){var T=y.value,S=c(n,T);if(S!=null){var N=u(S.toString(),T),L=this._fieldIds[T],b=new Set(N).size;this.addFieldLength(_,L,this._documentCount-1,b);try{for(var I=(r=void 0,U(N)),D=I.next();!D.done;D=I.next()){var P=D.value,M=d(P,T);if(Array.isArray(M))try{for(var H=(o=void 0,U(M)),R=H.next();!R.done;R=H.next()){var w=R.value;this.addTerm(L,_,w)}}catch(x){o={error:x}}finally{try{R&&!R.done&&(s=H.return)&&s.call(H)}finally{if(o)throw o.error}}else M&&this.addTerm(L,_,M)}}catch(x){r={error:x}}finally{try{D&&!D.done&&(a=I.return)&&a.call(I)}finally{if(r)throw r.error}}}}}catch(x){t={error:x}}finally{try{y&&!y.done&&(i=E.return)&&i.call(E)}finally{if(t)throw t.error}}},e.prototype.addAll=function(n){var t,i;try{for(var r=U(n),a=r.next();!a.done;a=r.next()){var o=a.value;this.add(o)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},e.prototype.addAllAsync=function(n,t){var i=this;t===void 0&&(t={});var r=t.chunkSize,a=r===void 0?10:r,o={chunk:[],promise:Promise.resolve()},s=n.reduce(function(u,d,m){var p=u.chunk,f=u.promise;return p.push(d),(m+1)%a===0?{chunk:[],promise:f.then(function(){return new Promise(function(_){return setTimeout(_,0)})}).then(function(){return i.addAll(p)})}:{chunk:p,promise:f}},o),l=s.chunk,c=s.promise;return c.then(function(){return i.addAll(l)})},e.prototype.remove=function(n){var t,i,r,a,o,s,l=this._options,c=l.tokenize,u=l.processTerm,d=l.extractField,m=l.fields,p=l.idField,f=d(n,p);if(f==null)throw new Error('MiniSearch: document does not have ID field "'.concat(p,'"'));var _=this._idToShortId.get(f);if(_==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(f,": it is not in the index"));try{for(var E=U(m),y=E.next();!y.done;y=E.next()){var T=y.value,S=d(n,T);if(S!=null){var N=c(S.toString(),T),L=this._fieldIds[T],b=new Set(N).size;this.removeFieldLength(_,L,this._documentCount,b);try{for(var I=(r=void 0,U(N)),D=I.next();!D.done;D=I.next()){var P=D.value,M=u(P,T);if(Array.isArray(M))try{for(var H=(o=void 0,U(M)),R=H.next();!R.done;R=H.next()){var w=R.value;this.removeTerm(L,_,w)}}catch(x){o={error:x}}finally{try{R&&!R.done&&(s=H.return)&&s.call(H)}finally{if(o)throw o.error}}else M&&this.removeTerm(L,_,M)}}catch(x){r={error:x}}finally{try{D&&!D.done&&(a=I.return)&&a.call(I)}finally{if(r)throw r.error}}}}}catch(x){t={error:x}}finally{try{y&&!y.done&&(i=E.return)&&i.call(E)}finally{if(t)throw t.error}}this._storedFields.delete(_),this._documentIds.delete(_),this._idToShortId.delete(f),this._fieldLength.delete(_),this._documentCount-=1},e.prototype.removeAll=function(n){var t,i;if(n)try{for(var r=U(n),a=r.next();!a.done;a=r.next()){var o=a.value;this.remove(o)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}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 qi,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},e.prototype.discard=function(n){var t=this,i=this._idToShortId.get(n);if(i==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(n,": it is not in the index"));this._idToShortId.delete(n),this._documentIds.delete(i),this._storedFields.delete(i),(this._fieldLength.get(i)||[]).forEach(function(r,a){t.removeFieldLength(i,a,t._documentCount,r)}),this._fieldLength.delete(i),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},e.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var n=this._options.autoVacuum,t=n.minDirtFactor,i=n.minDirtCount,r=n.batchSize,a=n.batchWait;this.conditionalVacuum({batchSize:r,batchWait:a},{minDirtCount:i,minDirtFactor:t})}},e.prototype.discardAll=function(n){var t,i,r=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var a=U(n),o=a.next();!o.done;o=a.next()){var s=o.value;this.discard(s)}}catch(l){t={error:l}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}}finally{this._options.autoVacuum=r}this.maybeAutoVacuum()},e.prototype.replace=function(n){var t=this._options,i=t.idField,r=t.extractField,a=r(n,i);this.discard(a),this.add(n)},e.prototype.vacuum=function(n){return n===void 0&&(n={}),this.conditionalVacuum(n)},e.prototype.conditionalVacuum=function(n,t){var i=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var r=i._enqueuedVacuumConditions;return i._enqueuedVacuumConditions=Qi,i.performVacuuming(n,r)}),this._enqueuedVacuum)):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(n),this._currentVacuum)},e.prototype.performVacuuming=function(n,t){return hu(this,void 0,void 0,function(){var i,r,a,o,s,l,c,u,d,m,p,f,_,E,y,T,S,N,L,b,I,D,P,M,H;return fu(this,function(R){switch(R.label){case 0:if(i=this._dirtCount,!this.vacuumConditionsMet(t))return[3,10];r=n.batchSize||$i.batchSize,a=n.batchWait||$i.batchWait,o=1,R.label=1;case 1:R.trys.push([1,7,8,9]),s=U(this._index),l=s.next(),R.label=2;case 2:if(l.done)return[3,6];c=ee(l.value,2),u=c[0],d=c[1];try{for(m=(D=void 0,U(d)),p=m.next();!p.done;p=m.next()){f=ee(p.value,2),_=f[0],E=f[1];try{for(y=(M=void 0,U(E)),T=y.next();!T.done;T=y.next())S=ee(T.value,1),N=S[0],!this._documentIds.has(N)&&(E.size<=1?d.delete(_):E.delete(N))}catch(w){M={error:w}}finally{try{T&&!T.done&&(H=y.return)&&H.call(y)}finally{if(M)throw M.error}}}}catch(w){D={error:w}}finally{try{p&&!p.done&&(P=m.return)&&P.call(m)}finally{if(D)throw D.error}}return this._index.get(u).size===0&&this._index.delete(u),o%r!==0?[3,4]:[4,new Promise(function(w){return setTimeout(w,a)})];case 3:R.sent(),R.label=4;case 4:o+=1,R.label=5;case 5:return l=s.next(),[3,2];case 6:return[3,9];case 7:return L=R.sent(),b={error:L},[3,9];case 8:try{l&&!l.done&&(I=s.return)&&I.call(s)}finally{if(b)throw b.error}return[7];case 9:this._dirtCount-=i,R.label=10;case 10:return[4,null];case 11:return R.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},e.prototype.vacuumConditionsMet=function(n){if(n==null)return!0;var t=n.minDirtCount,i=n.minDirtFactor;return t=t||Ji.minDirtCount,i=i||Ji.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=i},Object.defineProperty(e.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),e.prototype.has=function(n){return this._idToShortId.has(n)},e.prototype.getStoredFields=function(n){var t=this._idToShortId.get(n);if(t!=null)return this._storedFields.get(t)},e.prototype.search=function(n,t){var i,r;t===void 0&&(t={});var a=this.executeQuery(n,t),o=[];try{for(var s=U(a),l=s.next();!l.done;l=s.next()){var c=ee(l.value,2),u=c[0],d=c[1],m=d.score,p=d.terms,f=d.match,_=p.length||1,E={id:this._documentIds.get(u),score:m*_,terms:Object.keys(f),queryTerms:p,match:f};Object.assign(E,this._storedFields.get(u)),(t.filter==null||t.filter(E))&&o.push(E)}}catch(y){i={error:y}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return n===e.wildcard&&t.boostDocument==null&&this._options.searchOptions.boostDocument==null||o.sort(no),o},e.prototype.autoSuggest=function(n,t){var i,r,a,o;t===void 0&&(t={}),t=Z(Z({},this._options.autoSuggestOptions),t);var s=new Map;try{for(var l=U(this.search(n,t)),c=l.next();!c.done;c=l.next()){var u=c.value,d=u.score,m=u.terms,p=m.join(" "),f=s.get(p);f!=null?(f.score+=d,f.count+=1):s.set(p,{score:d,terms:m,count:1})}}catch(L){i={error:L}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(i)throw i.error}}var _=[];try{for(var E=U(s),y=E.next();!y.done;y=E.next()){var T=ee(y.value,2),f=T[0],S=T[1],d=S.score,m=S.terms,N=S.count;_.push({suggestion:f,terms:m,score:d/N})}}catch(L){a={error:L}}finally{try{y&&!y.done&&(o=E.return)&&o.call(E)}finally{if(a)throw a.error}}return _.sort(no),_},Object.defineProperty(e.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),e.loadJSON=function(n,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(n),t)},e.getDefault=function(n){if(Yi.hasOwnProperty(n))return Xi(Yi,n);throw new Error('MiniSearch: unknown option "'.concat(n,'"'))},e.loadJS=function(n,t){var i,r,a,o,s,l,c=n.index,u=n.documentCount,d=n.nextId,m=n.documentIds,p=n.fieldIds,f=n.fieldLength,_=n.averageFieldLength,E=n.storedFields,y=n.dirtCount,T=n.serializationVersion;if(T!==1&&T!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var S=new e(t);S._documentCount=u,S._nextId=d,S._documentIds=Cn(m),S._idToShortId=new Map,S._fieldIds=p,S._fieldLength=Cn(f),S._avgFieldLength=_,S._storedFields=Cn(E),S._dirtCount=y||0,S._index=new qi;try{for(var N=U(S._documentIds),L=N.next();!L.done;L=N.next()){var b=ee(L.value,2),I=b[0],D=b[1];S._idToShortId.set(D,I)}}catch(ie){i={error:ie}}finally{try{L&&!L.done&&(r=N.return)&&r.call(N)}finally{if(i)throw i.error}}try{for(var P=U(c),M=P.next();!M.done;M=P.next()){var H=ee(M.value,2),R=H[0],w=H[1],x=new Map;try{for(var O=(s=void 0,U(Object.keys(w))),j=O.next();!j.done;j=O.next()){var X=j.value,re=w[X];T===1&&(re=re.ds),x.set(parseInt(X,10),Cn(re))}}catch(ie){s={error:ie}}finally{try{j&&!j.done&&(l=O.return)&&l.call(O)}finally{if(s)throw s.error}}S._index.set(R,x)}}catch(ie){a={error:ie}}finally{try{M&&!M.done&&(o=P.return)&&o.call(P)}finally{if(a)throw a.error}}return S},e.prototype.executeQuery=function(n,t){var i=this;if(t===void 0&&(t={}),n===e.wildcard)return this.executeWildcardQuery(t);if(typeof n!="string"){var r=Z(Z(Z({},t),n),{queries:void 0}),a=n.queries.map(function(E){return i.executeQuery(E,r)});return this.combineResults(a,r.combineWith)}var o=this._options,s=o.tokenize,l=o.processTerm,c=o.searchOptions,u=Z(Z({tokenize:s,processTerm:l},c),t),d=u.tokenize,m=u.processTerm,p=d(n).flatMap(function(E){return m(E)}).filter(function(E){return!!E}),f=p.map(ku(u)),_=f.map(function(E){return i.executeQuerySpec(E,u)});return this.combineResults(_,u.combineWith)},e.prototype.executeQuerySpec=function(n,t){var i,r,a,o,s=Z(Z({},this._options.searchOptions),t),l=(s.fields||this._options.fields).reduce(function(X,re){var ie;return Z(Z({},X),(ie={},ie[re]=Xi(s.boost,re)||1,ie))},{}),c=s.boostDocument,u=s.weights,d=s.maxFuzzy,m=s.bm25,p=Z(Z({},eo.weights),u),f=p.fuzzy,_=p.prefix,E=this._index.get(n.term),y=this.termResults(n.term,n.term,1,E,l,c,m),T,S;if(n.prefix&&(T=this._index.atPrefix(n.term)),n.fuzzy){var N=n.fuzzy===!0?.2:n.fuzzy,L=N<1?Math.min(d,Math.round(n.term.length*N)):N;L&&(S=this._index.fuzzyGet(n.term,L))}if(T)try{for(var b=U(T),I=b.next();!I.done;I=b.next()){var D=ee(I.value,2),P=D[0],M=D[1],H=P.length-n.term.length;if(H){S?.delete(P);var R=_*P.length/(P.length+.3*H);this.termResults(n.term,P,R,M,l,c,m,y)}}}catch(X){i={error:X}}finally{try{I&&!I.done&&(r=b.return)&&r.call(b)}finally{if(i)throw i.error}}if(S)try{for(var w=U(S.keys()),x=w.next();!x.done;x=w.next()){var P=x.value,O=ee(S.get(P),2),j=O[0],H=O[1];if(H){var R=f*P.length/(P.length+H);this.termResults(n.term,P,R,j,l,c,m,y)}}}catch(X){a={error:X}}finally{try{x&&!x.done&&(o=w.return)&&o.call(w)}finally{if(a)throw a.error}}return y},e.prototype.executeWildcardQuery=function(n){var t,i,r=new Map,a=Z(Z({},this._options.searchOptions),n);try{for(var o=U(this._documentIds),s=o.next();!s.done;s=o.next()){var l=ee(s.value,2),c=l[0],u=l[1],d=a.boostDocument?a.boostDocument(u,"",this._storedFields.get(c)):1;r.set(c,{score:d,terms:[],match:{}})}}catch(m){t={error:m}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(t)throw t.error}}return r},e.prototype.combineResults=function(n,t){if(t===void 0&&(t=tr),n.length===0)return new Map;var i=t.toLowerCase();return n.reduce(Su[i])||new Map},e.prototype.toJSON=function(){var n,t,i,r,a=[];try{for(var o=U(this._index),s=o.next();!s.done;s=o.next()){var l=ee(s.value,2),c=l[0],u=l[1],d={};try{for(var m=(i=void 0,U(u)),p=m.next();!p.done;p=m.next()){var f=ee(p.value,2),_=f[0],E=f[1];d[_]=Object.fromEntries(E)}}catch(y){i={error:y}}finally{try{p&&!p.done&&(r=m.return)&&r.call(m)}finally{if(i)throw i.error}}a.push([c,d])}}catch(y){n={error:y}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(n)throw n.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:a,serializationVersion:2}},e.prototype.termResults=function(n,t,i,r,a,o,s,l){var c,u,d,m,p;if(l===void 0&&(l=new Map),r==null)return l;try{for(var f=U(Object.keys(a)),_=f.next();!_.done;_=f.next()){var E=_.value,y=a[E],T=this._fieldIds[E],S=r.get(T);if(S!=null){var N=S.size,L=this._avgFieldLength[T];try{for(var b=(d=void 0,U(S.keys())),I=b.next();!I.done;I=b.next()){var D=I.value;if(!this._documentIds.has(D)){this.removeTerm(T,D,t),N-=1;continue}var P=o?o(this._documentIds.get(D),t,this._storedFields.get(D)):1;if(P){var M=S.get(D),H=this._fieldLength.get(D)[T],R=Cu(M,N,this._documentCount,H,L,s),w=i*y*P*R,x=l.get(D);if(x){x.score+=w,Tu(x.terms,n);var O=Xi(x.match,t);O?O.push(E):x.match[t]=[E]}else l.set(D,{score:w,terms:[n],match:(p={},p[t]=[E],p)})}}}catch(j){d={error:j}}finally{try{I&&!I.done&&(m=b.return)&&m.call(b)}finally{if(d)throw d.error}}}}}catch(j){c={error:j}}finally{try{_&&!_.done&&(u=f.return)&&u.call(f)}finally{if(c)throw c.error}}return l},e.prototype.addTerm=function(n,t,i){var r=this._index.fetch(i,io),a=r.get(n);if(a==null)a=new Map,a.set(t,1),r.set(n,a);else{var o=a.get(t);a.set(t,(o||0)+1)}},e.prototype.removeTerm=function(n,t,i){if(!this._index.has(i)){this.warnDocumentChanged(t,n,i);return}var r=this._index.fetch(i,io),a=r.get(n);a==null||a.get(t)==null?this.warnDocumentChanged(t,n,i):a.get(t)<=1?a.size<=1?r.delete(n):a.delete(t):a.set(t,a.get(t)-1),this._index.get(i).size===0&&this._index.delete(i)},e.prototype.warnDocumentChanged=function(n,t,i){var r,a;try{for(var o=U(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(n),' has changed before removal: term "').concat(i,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(c){r={error:c}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}},e.prototype.addDocumentId=function(n){var t=this._nextId;return this._idToShortId.set(n,t),this._documentIds.set(t,n),this._documentCount+=1,this._nextId+=1,t},e.prototype.addFields=function(n){for(var t=0;t<n.length;t++)this._fieldIds[n[t]]=t},e.prototype.addFieldLength=function(n,t,i,r){var a=this._fieldLength.get(n);a==null&&this._fieldLength.set(n,a=[]),a[t]=r;var o=this._avgFieldLength[t]||0,s=o*i+r;this._avgFieldLength[t]=s/(i+1)},e.prototype.removeFieldLength=function(n,t,i,r){if(i===1){this._avgFieldLength[t]=0;return}var a=this._avgFieldLength[t]*i-r;this._avgFieldLength[t]=a/(i-1)},e.prototype.saveStoredFields=function(n,t){var i,r,a=this._options,o=a.storeFields,s=a.extractField;if(!(o==null||o.length===0)){var l=this._storedFields.get(n);l==null&&this._storedFields.set(n,l={});try{for(var c=U(o),u=c.next();!u.done;u=c.next()){var d=u.value,m=s(t,d);m!==void 0&&(l[d]=m)}}catch(p){i={error:p}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(i)throw i.error}}}},e.wildcard=Symbol("*"),e}(),Xi=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)?e[n]:void 0},Su=(Bt={},Bt[tr]=function(e,n){var t,i;try{for(var r=U(n.keys()),a=r.next();!a.done;a=r.next()){var o=a.value,s=e.get(o);if(s==null)e.set(o,n.get(o));else{var l=n.get(o),c=l.score,u=l.terms,d=l.match;s.score=s.score+c,s.match=Object.assign(s.match,d),to(s.terms,u)}}}catch(m){t={error:m}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}return e},Bt[co]=function(e,n){var t,i,r=new Map;try{for(var a=U(n.keys()),o=a.next();!o.done;o=a.next()){var s=o.value,l=e.get(s);if(l!=null){var c=n.get(s),u=c.score,d=c.terms,m=c.match;to(l.terms,d),r.set(s,{score:l.score+u,terms:l.terms,match:Object.assign(l.match,m)})}}}catch(p){t={error:p}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}return r},Bt[_u]=function(e,n){var t,i;try{for(var r=U(n.keys()),a=r.next();!a.done;a=r.next()){var o=a.value;e.delete(o)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}return e},Bt),Eu={k:1.2,b:.7,d:.5},Cu=function(e,n,t,i,r,a){var o=a.k,s=a.b,l=a.d,c=Math.log(1+(t-n+.5)/(n+.5));return c*(l+e*(o+1)/(e+o*(1-s+s*i/r)))},ku=function(e){return function(n,t,i){var r=typeof e.fuzzy=="function"?e.fuzzy(n,t,i):e.fuzzy||!1,a=typeof e.prefix=="function"?e.prefix(n,t,i):e.prefix===!0;return{term:n,fuzzy:r,prefix:a}}},Yi={idField:"id",extractField:function(e,n){return e[n]},tokenize:function(e){return e.split(Au)},processTerm:function(e){return e.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(e,n){typeof console?.[e]=="function"&&console[e](n)},autoVacuum:!0},eo={combineWith:tr,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:Eu},wu={combineWith:co,prefix:function(e,n,t){return n===t.length-1}},$i={batchSize:1e3,batchWait:10},Qi={minDirtFactor:.1,minDirtCount:20},Ji=Z(Z({},$i),Qi),Tu=function(e,n){e.includes(n)||e.push(n)},to=function(e,n){var t,i;try{for(var r=U(n),a=r.next();!a.done;a=r.next()){var o=a.value;e.includes(o)||e.push(o)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},no=function(e,n){var t=e.score,i=n.score;return i-t},io=function(){return new Map},Cn=function(e){var n,t,i=new Map;try{for(var r=U(Object.keys(e)),a=r.next();!a.done;a=r.next()){var o=a.value;i.set(parseInt(o,10),e[o])}}catch(s){n={error:s}}finally{try{a&&!a.done&&(t=r.return)&&t.call(r)}finally{if(n)throw n.error}}return i},Au=/[\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 po=[{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(e,n)=>{let t=await n.knowledgeBase.search(e.query),i=n;i._lastKBsearch=e.query,i._nextRequestUseKBitems=t,n.submitAnalyticsEvent({type:"kb-search",query:e.query,results:t});let r=t.filter(o=>o.type!="action").map(o=>"id="+o.id).join(", ")||"(none)",a=t.filter(o=>o.type=="action").map(o=>"name="+o._functionID).join(", ")||"(none)";return`Search complete, context has been updated. New info entries found: ${r}. New tools available: ${a}.`}}];var tt=new q("KnowledgeBase"),mo=1,wn=class e{constructor(n){this._sources=[{id:"core.internal",query:async()=>po}];this._windowSources=[];this.lastResults=[];this.manualEntries=[];this.ai=n}registerSource(n,t){let i=n;return typeof n=="function"&&(t=n,i=`source.${mo++}`),this._sources.push({id:i,query:t}),i}removeSource(n){this._sources=this.sources.filter(t=>t.id!==n&&t.query!==n)}addEntry(n){this.manualEntries.push(n)}removeEntry(n){this.manualEntries=this.manualEntries.filter(t=>t.id!==n)}get sources(){let n=this._sources;return $().knowledgeBaseSources&&(n=n.concat($().knowledgeBaseSources)),n=n.concat(this._windowSources),n=n.filter(t=>!t.disabled),n}async search(n){tt.debug(`Searching knowledge base for: ${n}`);let t=new Event("webweaver_kb_search",{bubbles:!0,cancelable:!0});t.query=n,t.entries=[],t.sources=[],typeof document<"u"&&document.dispatchEvent(t),this._windowSources=t.sources;let r=(await Promise.all(this.sources.map(async l=>{try{let c=Date.now(),u=await l.query(n);return tt.debug(`Source '${l.id}' took ${Date.now()-c}ms`),u||[]}catch(c){return tt.warn(`Knowledge source '${l.id}' failed:`,c),[]}}))).flat();r=r.concat(t.entries),r=r.concat(this.manualEntries),$().knowledgeBase&&(r=r.concat($().knowledgeBase)),r=r.filter(l=>l&&!l.disabled);for(let l=0;l<r.length;l++){let c=r[l];if(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.")}),c.parameters&&!Array.isArray(c.parameters)){let u=c.parameters,d=[];for(let m in u)d.push({name:m,type:"string",description:c.parameters[m]});c.parameters=d}}let a=new uo({fields:["id","type","name","content","tags"],storeFields:[],searchOptions:{boost:{name:3,tags:2},fuzzy:.2}});a.addAll(r);let s=a.search(n).map(l=>r.find(c=>c.id==l.id));for(let l of r)l.isContext&&(s.find(c=>c.id===l.id)||s.push(l));return this.lastResults=s,tt.debug("Found results:",s),s}getCachedEntry(n){return this.lastResults.find(t=>t.id==n||t._functionID==n)}registerSourceFromURL(n,t){t||(t=`external.${mo++}`),tt.debug(`Registering remote knowledge base source: ${n}`);let i=[],r=[],a=!0,o=async(l,c)=>{tt.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},d=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!d.ok)throw new Error(`HTTP Error ${d.status} ${d.statusText}`);let m=await d.json();return s(m.updateItems||[]),m.response},s=l=>{for(let c of l){if(!c.id){tt.warn("KB item skipped since it has no ID.",c);continue}let u=i.find(d=>d.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}i.push({...c,action:d=>o(c,d)})}};this.registerSource(t,async l=>{if(a&&r.includes(l))return i;let c={type:"search",userID:this.ai?.userID||"",extra:this.ai?.extra||{},query:l},u=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error(`HTTP Error ${u.status} ${u.statusText}`);let d=await u.json();return a=!d.noCache,r.includes(l)||r.push(l),s(d.items),i})}clone(){let n=new e(this.ai);return n._sources=this._sources,n._windowSources=this._windowSources,n.manualEntries=this.manualEntries,n}};var go={name:"@intelliweave/embedded",version:"1.8.60",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 && 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:{"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 Tn=class{constructor(n){this.ai=n}async boolean(n){let t=await this.instruct({...n,instruction:`${n.instruction}
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 ro(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:v}));break;default:t(new ro(`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 qS(r){let e=[],t="",a=0;for(;a<r.length;){let n=r.indexOf("\r",a),i=r.indexOf(`
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}
3255
3259
 
3256
- 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(n){let t=await this.instruct({...n,instruction:`${n.instruction}
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}
3257
3261
 
3258
3262
  Reply only with one of the following options:
3259
- ${n.options.map(i=>`- "${i}"`).join(`
3263
+ ${e.options.map(a=>`- "${a}"`).join(`
3260
3264
  `)}
3261
3265
 
3262
- Do not include any additional text or explanations.`});return n.options.includes(t)?t:n.options.find(i=>t.toLowerCase().includes(i.toLowerCase()))}async extract(n){let t=`
3263
- You will receive some data. Extraction instructions: ${n.instruction}
3266
+ Do not include any additional text or explanations.`});return e.options.includes(t)?t:e.options.find(a=>t.toLowerCase().includes(a.toLowerCase()))}async extract(e){let t=`
3267
+ You will receive some data. Extraction instructions: ${e.instruction}
3264
3268
 
3265
- ${n.allowMultiple?"Return a JSONL string only, one JSON object on each line.":"Return a valid JSON object only."}
3269
+ ${e.allowMultiple?"Return a JSONL string only, one JSON object on each line.":"Return a valid JSON object only."}
3266
3270
 
3267
3271
  Objects should have the following keys:
3268
- ${n.extractions.map(r=>`- ${r.name} (${r.type}): ${r.description||"No description provided."}`).join(`
3272
+ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No description provided."}`).join(`
3269
3273
  `)}
3270
- `,i=await this.instruct({...n,instruction:t});if(i=i.replace(/```jsonl/g,"").replace(/```json/g,"").replace(/```/g,""),n.allowMultiple){let r=i.split(`
3271
- `).map(o=>o.trim()).filter(o=>!!o.trim()),a=[];for(let o of r)try{a.push(JSON.parse(o))}catch(s){console.error("Failed to parse line as JSON:",o,s.message)}return a}else return[JSON.parse(i.trim())]}async generateMarkdown(n){return this.instruct({...n,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(n){let t=this.ai.clone();return t.resetConversation(),t.getContextPrefix=async()=>n.instruction,n.callback&&t.addEventListener("output",i=>{n.callback(i.detail.message)}),n.allowKB||(t.knowledgeBase._sources=[]),await t.sendMessage(typeof n.data=="string"?n.data:JSON.stringify(n.data))||""}};var Ae=new q("Main"),An=class An extends EventTarget{constructor(){super(...arguments);this.conversationID=Te();this.knowledgeBase=new wn(this);this._lastKBsearch="";this.models=[];this.audio=null;this.apiKey="";this.logic=new Tn(this);this.userID=Ca();this.extra=$().extra||{};this.hubAPI="https://intelliweave.ai/api";this._lastSystemMsg="";this.isProcessing=!1}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()=>{Ae.debug("Loading configuration...");let i=await fetch(this.hubAPI+"/config/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t})});if(!i.ok)throw new Error(`Failed to load configuration: ${i.status} ${i.statusText}`);try{this.config=await i.json(),Ae.debug("Config loaded successfully:",this.config),this.config&&Ae.debug("UI Properties - logo:",this.config.logo,"background:",this.config.background,"textColor:",this.config.textColor)}catch(r){Ae.error("Failed to parse JSON response:",r);try{let a=await i.clone().text();Ae.error("Raw response that failed parsing:",a)}catch{Ae.error("Could not get raw response text either")}throw new Error(`Failed to parse configuration: ${r}`)}})(),(async()=>{try{let i=await fetch("https://cdn.intelliweave.ai/models/silero_vad_3.onnx");if(!i.ok)throw new Error(`Failed to load VAD model: ${i.status} ${i.statusText}`);this.vadModel=await i.blob()}catch(i){Ae.warn(`Failed to load VAD model, some features will be unavailable. ${i.message}`)}})()]),this.models=[{id:this.config.id,config:this.config.model}],this.setModel(this.config.id);for(let i of this.config.knowledge||[])i.url&&this.knowledgeBase.registerSourceFromURL(i.url);for(let i of this.config.knowledge||[])i.entries?.length&&this.knowledgeBase.registerSource(i.id,()=>i.entries||[]);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(i){throw Ae.warn("Failed to load:",i),this.error=i,this.dispatchEvent(new CustomEvent("error",{detail:{ai:this,error:i}})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("webweaver_error",{detail:{ai:this,error:i}})),i}}setModel(t){let i=this.models.find(r=>r.id==t);if(!i)throw new Error(`Model with ID "${t}" not found.`);this.currentModel=new En({...i.config,systemMessage:"",onBeforeMessageProcessing:this.onBeforeMessageProcessing.bind(this),onAIMessage:this.processIncomingMessage.bind(this),onAIToolStart:(r,a)=>{let o=this.knowledgeBase.getCachedEntry(r);this.onAIToolStart?.(o?.id||r,a)}}),this.currentModel.id=i.id,this.currentModel.metadata=i}async getContextPrefix(){let t=$().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 i=this._nextRequestUseKBitems||await this.knowledgeBase.search(this._lastKBsearch);this._nextRequestUseKBitems=void 0;for(let a of i)if(a.type=="info"||a.type=="tour"||a.type=="input-event")this.currentModel.contextGroup.add({id:a.id,customData:a,cannotRemove:a.isContext,sortOrder:101,disabled:a.disabled,content:JSON.stringify({id:a.id,type:a.type,name:a.name,content:Oi(typeof a.content=="function"?a.content():a.content)})+`
3272
- `});else if(a.type=="action"){let o={name:a._functionID,description:Oi(typeof a.content=="function"?a.content():a.content),params:a.parameters||[{name:"value",type:"string",description:"Input"}],removeFromMessageHistory:!!a.removeFromMessageHistory,callback:s=>this.toolRunKBAction(a,s),kb:a};this.currentModel.toolGroup.add({id:a._functionID,customData:o,cannotRemove:a.isContext,sortOrder:101,disabled:a.disabled,content:JSON.stringify(o)})}else continue;let r=this.currentModel.contextGroup.getAllAsString();this._lastSystemMsg!=r&&(this._lastSystemMsg=r,this.submitAnalyticsEvent({type:"system-msg",txt:r}))}processIncomingMessage(t,i){i||this.submitAnalyticsEvent({type:"message",role:"assistant",message:t});let r="";this._lastOutput===void 0?(r=t,this._lastOutput=t):t.startsWith(this._lastOutput)?(r=t.substring(this._lastOutput.length),this._lastOutput=t):(Ae.warn("Message was changed during chunking. This should not happen.",t,this._lastOutput),r=t,this._lastOutput=t),i||(this._lastOutput=void 0),this.dispatchEvent(new CustomEvent("output",{detail:{ai:this,isChunk:i,message:t,messageChunk:r}})),this.onAIMessage?.(t,!!i)}async sendMessage(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(this.isProcessing)return Ae.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,i){try{this.dispatchEvent(new CustomEvent("toolstart",{detail:{knowledgeBaseEntry:t,input:i,ai:this}}));let r=await t.action(i,this);return this.submitAnalyticsEvent({type:"action",action:t.id,value:i,result:r}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:t,input:i,ai:this,result:r}})),r}catch(r){throw this.submitAnalyticsEvent({type:"action",action:t.id,value:i,error:r.message}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:t,input:i,ai:this,error:r}})),r}}submitAnalyticsEvent(t){$().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(i=>{Ae.debug("Failed to submit analytics event:",i)})}resetConversation(){this.currentModel&&(this.currentModel.resetConversation(),this.conversationID=Te(),this._lastSystemMsg="")}insertAssistantMessage(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");let i={role:"assistant",content:t};this.currentModel.messageGroup.add({id:Te(),content:JSON.stringify(i),customData:i})}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 i of t.messages)this.currentModel.messageGroup.add({id:Te(),content:JSON.stringify(i),customData:i})}clone(){let t=new An;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}};An.version=go.version;var St=An;var be=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={},i=""){this.register();let r=document.createElement(this.tagName);for(let a in t)r.setAttribute(a,t[a]);return r.onBeforeCreate(),r.innerHTML=i,r}static add(t={},i=""){return this.register(),`<${this.tagName} ${Object.keys(t).map(r=>`${r}="${(t[r]+"").replaceAll('"',"&quot;")}"`).join(" ")}>${i}</${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,i,r){this._shadow&&this.onUpdate()}get attr(){if(this._attrProxy)return this._attrProxy;let t=i=>(xn=xn||document.createElement("div"),xn.innerText=i||"",xn.innerHTML);return this._attrProxy=new Proxy({},{get:(i,r)=>t(this.getAttribute(r.toString())||""),set:(i,r,a)=>(this.getAttribute(r.toString())===a||(a?this.setAttribute(r.toString(),a):this.removeAttribute(r.toString()),this._shadow&&this.onUpdate()),!0)}),this._attrProxy}get state(){return this._stateProxy?this._stateProxy:(this._stateProxy=new Proxy({},{get:(t,i)=>this._state[i],set:(t,i,r)=>(this._state[i]=r,this._shadow&&this.onUpdate(),!0)}),this._stateProxy)}hasChild(t){return!!this.root?.getElementById(t)}child(t){let i=this.root?.getElementById(t);if(!i)throw new Error(`Child with ID ${t} not found`);return i}};be.observedAttributes=[],be.tagName="",be._isRegistered=!1;var xn;var ho='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 fo='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 yo='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 Ft=class extends be{constructor(){super(...arguments);this.html=()=>`
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 Xt=new be("Main"),ho=class ho extends EventTarget{constructor(){super(...arguments);this.conversationID=Wt();this.knowledgeBase=new po(this);this._lastKBsearch="";this.models=[];this.audio=null;this.apiKey="";this.logic=new mo(this);this.userID=du();this.extra=Ne().extra||{};this.hubAPI="https://intelliweave.ai/api";this._lastSystemMsg="";this.isProcessing=!1}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()=>{Xt.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(),Xt.debug("Config loaded successfully:",this.config),this.config&&Xt.debug("UI Properties - logo:",this.config.logo,"background:",this.config.background,"textColor:",this.config.textColor)}catch(n){Xt.error("Failed to parse JSON response:",n);try{let i=await a.clone().text();Xt.error("Raw response that failed parsing:",i)}catch{Xt.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){Xt.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 Xt.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 fi({...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:ks(typeof i.content=="function"?i.content():i.content)})+`
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('"',"&quot;")}"`).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=()=>`
3273
3277
 
3274
3278
  <!-- Styling -->
3275
3279
  <style>
@@ -3309,7 +3313,7 @@ ${n.extractions.map(r=>`- ${r.name} (${r.type}): ${r.description||"No descriptio
3309
3313
  }
3310
3314
 
3311
3315
  :host #loader {
3312
- background-image: url('${ho}');
3316
+ background-image: url('${Bm}');
3313
3317
  background-size: 64px 64px;
3314
3318
  background-position: center;
3315
3319
  background-repeat: no-repeat;
@@ -3332,7 +3336,7 @@ ${n.extractions.map(r=>`- ${r.name} (${r.type}): ${r.description||"No descriptio
3332
3336
  }
3333
3337
 
3334
3338
  :host #microphone-button {
3335
- background-image: url('${fo}');
3339
+ background-image: url('${Gm}');
3336
3340
  z-index: 2;
3337
3341
  margin-right: -10px;
3338
3342
  }
@@ -3356,7 +3360,7 @@ ${n.extractions.map(r=>`- ${r.name} (${r.type}): ${r.description||"No descriptio
3356
3360
  }
3357
3361
 
3358
3362
  :host #cancel-speech-button {
3359
- background-image: url('${yo}');
3363
+ background-image: url('${zm}');
3360
3364
  z-index: 2;
3361
3365
  }
3362
3366
 
@@ -3380,7 +3384,7 @@ ${n.extractions.map(r=>`- ${r.name} (${r.type}): ${r.description||"No descriptio
3380
3384
  <!-- Loader bar -->
3381
3385
  <div id='loader'></div>
3382
3386
 
3383
- `;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",i=>this.onSpeechEvent(i)),this.ai.audio?.speechRecognition.addEventListener("start",i=>this.onUpdate()),this.ai.audio?.speechRecognition.addEventListener("end",i=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechstart",i=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechend",i=>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(i=>i.remove()),this.voiceAnimationPieces=[],clearInterval(this.micStateAnimationTimer),this.micStateAnimationTimer=void 0)}onInputKeyPress(t){if(t.stopPropagation(),t.key!="Enter")return;let i=this.child("input-field"),r=i.value?.trim();i.value="",r&&this.dispatchEvent(new CustomEvent("input-message",{detail:r}))}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 i=this.ai?.audio?.speechRecognition.volumeLevel||0,r=30,a=6,o=Math.round(i*(r-a)+a),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 i=this.voiceAnimationPieces[t];i.posX+=2,i.style.transform=`translate(${i.posX}px, 0px)`,!(i.posX<400)&&(this.voiceAnimationPieces.splice(t--,1),i.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()}};Ft.observedAttributes=["loading","llmName","llmButtonVisible","textColor"];var nr='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 Gt=class extends be{constructor(){super(...arguments);this.html=()=>`
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()}};Pa.observedAttributes=["loading","llmName","llmButtonVisible","textColor"];var Vl='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 Da=class extends Tt{constructor(){super(...arguments);this.html=()=>`
3384
3388
 
3385
3389
  <!-- Styling -->
3386
3390
  <style>
@@ -3423,14 +3427,14 @@ ${n.extractions.map(r=>`- ${r.name} (${r.type}): ${r.description||"No descriptio
3423
3427
  </style>
3424
3428
 
3425
3429
  <!-- Logo -->
3426
- <img id='root' src='${this.attr.logo||nr}' />
3430
+ <img id='root' src='${this.attr.logo||Vl}' />
3427
3431
 
3428
- `;this._lastLogoSrc=""}onCreate(){this.layoutUpdateTimer=setInterval(()=>this.onUpdate(),250)}onDestroy(){clearInterval(this.layoutUpdateTimer)}onUpdate(){let t=this.child("root");if(!t)return;let i=this.attr.logo||nr;this._lastLogoSrc!=i&&(this._lastLogoSrc=i,t.src=i);let r=window.visualViewport?.offsetTop||0,a=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+a)+"px",t.style.top=Math.round(s.y+s.height/2-128/2+r)+"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+a)+"px",t.style.top=Math.round(s.y+r)+"px"}}refreshLayout(){setTimeout(()=>this.onUpdate(),100)}};Gt.observedAttributes=["logo","focusID"];var bo=typeof self=="object"?self:globalThis,Nu=(e,n)=>{let t=(r,a)=>(e.set(a,r),r),i=r=>{if(e.has(r))return e.get(r);let[a,o]=n[r];switch(a){case 0:case-1:return t(o,r);case 1:{let s=t([],r);for(let l of o)s.push(i(l));return s}case 2:{let s=t({},r);for(let[l,c]of o)s[i(l)]=i(c);return s}case 3:return t(new Date(o),r);case 4:{let{source:s,flags:l}=o;return t(new RegExp(s,l),r)}case 5:{let s=t(new Map,r);for(let[l,c]of o)s.set(i(l),i(c));return s}case 6:{let s=t(new Set,r);for(let l of o)s.add(i(l));return s}case 7:{let{name:s,message:l}=o;return t(new bo[s](l),r)}case 8:return t(BigInt(o),r);case"BigInt":return t(Object(BigInt(o)),r)}return t(new bo[a](o),r)};return i},or=e=>Nu(new Map,e)(0);var Et="",{toString:Lu}={},{keys:Mu}=Object,Vt=e=>{let n=typeof e;if(n!=="object"||!e)return[0,n];let t=Lu.call(e).slice(8,-1);switch(t){case"Array":return[1,Et];case"Object":return[2,Et];case"Date":return[3,Et];case"RegExp":return[4,Et];case"Map":return[5,Et];case"Set":return[6,Et]}return t.includes("Array")?[1,t]:t.includes("Error")?[7,t]:[2,t]},Nn=([e,n])=>e===0&&(n==="function"||n==="symbol"),Ou=(e,n,t,i)=>{let r=(o,s)=>{let l=i.push(o)-1;return t.set(s,l),l},a=o=>{if(t.has(o))return t.get(o);let[s,l]=Vt(o);switch(s){case 0:{let u=o;switch(l){case"bigint":s=8,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return r([-1],o)}return r([s,u],o)}case 1:{if(l)return r([l,[...o]],o);let u=[],d=r([s,u],o);for(let m of o)u.push(a(m));return d}case 2:{if(l)switch(l){case"BigInt":return r([l,o.toString()],o);case"Boolean":case"Number":case"String":return r([l,o.valueOf()],o)}if(n&&"toJSON"in o)return a(o.toJSON());let u=[],d=r([s,u],o);for(let m of Mu(o))(e||!Nn(Vt(o[m])))&&u.push([a(m),a(o[m])]);return d}case 3:return r([s,o.toISOString()],o);case 4:{let{source:u,flags:d}=o;return r([s,{source:u,flags:d}],o)}case 5:{let u=[],d=r([s,u],o);for(let[m,p]of o)(e||!(Nn(Vt(m))||Nn(Vt(p))))&&u.push([a(m),a(p)]);return d}case 6:{let u=[],d=r([s,u],o);for(let m of o)(e||!Nn(Vt(m)))&&u.push(a(m));return d}}let{message:c}=o;return r([s,{name:l,message:c}],o)};return a},sr=(e,{json:n,lossy:t}={})=>{let i=[];return Ou(!(n||t),!!n,new Map,i)(e),i};var Pe=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?or(sr(e,n)):structuredClone(e):(e,n)=>or(sr(e,n));var De=function(e,n,t,i,r){let a=Ne(n);if(t!=null&&(typeof t!="number"||t<0||t===Number.POSITIVE_INFINITY))throw new Error("Expected positive finite `index`");if(i!=null&&(!i.type||!i.children))throw new Error("Expected valid `parent`");if(t==null!=(i==null))throw new Error("Expected both `index` and `parent`");return vo(e)?a.call(r,e,t,i):!1},Ne=function(e){if(e==null)return Gu;if(typeof e=="string")return Fu(e);if(typeof e=="object")return Bu(e);if(typeof e=="function")return lr(e);throw new Error("Expected function, string, or array as `test`")};function Bu(e){let n=[],t=-1;for(;++t<e.length;)n[t]=Ne(e[t]);return lr(i);function i(...r){let a=-1;for(;++a<n.length;)if(n[a].apply(this,r))return!0;return!1}}function Fu(e){return lr(n);function n(t){return t.tagName===e}}function lr(e){return n;function n(t,i,r){return!!(vo(t)&&e.call(this,t,typeof i=="number"?i:void 0,r||void 0))}}function Gu(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function vo(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}var zu=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,Uu=/^[a-zA-Z]:\\/;function cr(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return Uu.test(e)?!1:zu.test(e)}function _o(e){let n=String(e||"").trim();return n?n.split(/[ \t\n\r\f]+/g):[]}function So(e){return e.join(" ").trim()}var Ct=function(e){if(e==null)return ju;if(typeof e=="function")return Ln(e);if(typeof e=="object")return Array.isArray(e)?Hu(e):Vu(e);if(typeof e=="string")return Wu(e);throw new Error("Expected function, string, or object as test")};function Hu(e){let n=[],t=-1;for(;++t<e.length;)n[t]=Ct(e[t]);return Ln(i);function i(...r){let a=-1;for(;++a<n.length;)if(n[a].apply(this,r))return!0;return!1}}function Vu(e){let n=e;return Ln(t);function t(i){let r=i,a;for(a in e)if(r[a]!==n[a])return!1;return!0}}function Wu(e){return Ln(n);function n(t){return t&&t.type===e}}function Ln(e){return n;function n(t,i,r){return!!(qu(t)&&e.call(this,t,typeof i=="number"?i:void 0,r||void 0))}}function ju(){return!0}function qu(e){return e!==null&&typeof e=="object"&&"type"in e}var Eo=[],ur=!0,Mn=!1,Wt="skip";function jt(e,n,t,i){let r;typeof n=="function"&&typeof t!="function"?(i=t,t=n):r=n;let a=Ct(r),o=i?-1:1;s(e,void 0,[])();function s(l,c,u){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return m;function m(){let p=Eo,f,_,E;if((!n||a(l,c,u[u.length-1]||void 0))&&(p=Ku(t(l,u)),p[0]===Mn))return p;if("children"in l&&l.children){let y=l;if(y.children&&p[0]!==Wt)for(_=(i?y.children.length:-1)+o,E=u.concat(y);_>-1&&_<y.children.length;){let T=y.children[_];if(f=s(T,_,E)(),f[0]===Mn)return f;_=typeof f[1]=="number"?f[1]:_+o}}return p}}}function Ku(e){return Array.isArray(e)?e:typeof e=="number"?[ur,e]:e==null?Eo:[e]}function qt(e,n,t,i){let r,a,o;typeof n=="function"&&typeof t!="function"?(a=void 0,o=n,r=t):(a=n,o=t,r=i),jt(e,a,s,r);function s(l,c){let u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}var Xu=["http","https"],Yu=["nofollow"],Ju={};function On(e){let n=e||Ju,t=n.protocols||Xu,i=Ne(n.test);return function(r){qt(r,"element",function(a,o,s){if(a.tagName==="a"&&typeof a.properties.href=="string"&&i(a,o,s)){let l=a.properties.href;if(cr(l)?t.includes(l.slice(0,l.indexOf(":"))):l.startsWith("//")){let c=Kt(n.content,a),u=c&&!Array.isArray(c)?[c]:c,d=Kt(n.rel,a)||Yu,m=typeof d=="string"?_o(d):d,p=Kt(n.target,a),f=Kt(n.properties,a);if(f&&Object.assign(a.properties,Pe(f)),m.length>0&&(a.properties.rel=[...m]),p&&(a.properties.target=p),u){let _=Kt(n.contentProperties,a)||{};a.children.push({type:"element",tagName:"span",properties:Pe(_),children:Pe(u)})}}}})}}function Kt(e,n){return typeof e=="function"?e(n):e}var nt=Ne(function(e){return e.tagName==="audio"||e.tagName==="canvas"||e.tagName==="embed"||e.tagName==="iframe"||e.tagName==="img"||e.tagName==="math"||e.tagName==="object"||e.tagName==="picture"||e.tagName==="svg"||e.tagName==="video"});var Zu={}.hasOwnProperty;function dr(e,n){let t=e.type==="element"&&Zu.call(e.properties,n)&&e.properties[n];return t!=null&&t!==!1}var $u=new Set(["pingback","prefetch","stylesheet"]);function pr(e){if(e.type!=="element"||e.tagName!=="link")return!1;if(e.properties.itemProp)return!0;let n=e.properties.rel,t=-1;if(!Array.isArray(n)||n.length===0)return!1;for(;++t<n.length;)if(!$u.has(String(n[t])))return!1;return!0}var Qu=Ne(["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"]),ed=Ne("meta");function mr(e){return!!(e.type==="text"||Qu(e)||nt(e)||pr(e)||ed(e)&&dr(e,"itemProp"))}var td=/[ \t\n\f\r]/g;function ve(e){return typeof e=="object"?e.type==="text"?Co(e.value):!1:Co(e)}function Co(e){return e.replace(td,"")===""}var gr=["pre","script","style","textarea"];var ko=["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 wo=["button","input","select","textarea"];var To=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"];var nd={},hr=Ct(["doctype","comment"]);function Bn(e){let t=cd((e||nd).newlines?sd:ld);return function(i){xo(i,{collapse:t,whitespace:"normal"})}}function xo(e,n){if("children"in e){let t={...n};return(e.type==="root"||Po(e))&&(t.before=!0,t.after=!0),t.whitespace=ud(e,n),rd(e,t)}if(e.type==="text"){if(n.whitespace==="normal")return id(e,n);n.whitespace==="nowrap"&&(e.value=n.collapse(e.value))}return{ignore:hr(e),stripAtStart:!1,remove:!1}}function id(e,n){let t=n.collapse(e.value),i={ignore:!1,stripAtStart:!1,remove:!1},r=0,a=t.length;return n.before&&Ao(t.charAt(0))&&r++,r!==a&&Ao(t.charAt(a-1))&&(n.after?a--:i.stripAtStart=!0),r===a?i.remove=!0:e.value=t.slice(r,a),i}function rd(e,n){let t=n.before,i=n.after,r=e.children,a=r.length,o=-1;for(;++o<a;){let s=xo(r[o],{...n,after:Io(r,o,i),before:t});s.remove?(r.splice(o,1),o--,a--):s.ignore||(t=s.stripAtStart),Ro(r[o])&&(t=!1)}return{ignore:!1,stripAtStart:!!(t||i),remove:!1}}function Io(e,n,t){for(;++n<e.length;){let i=e[n],r=ad(i);if(r===void 0&&"children"in i&&!od(i)&&(r=Io(i.children,-1)),typeof r=="boolean")return r}return t}function ad(e){if(e.type==="element"){if(Ro(e))return!1;if(Po(e))return!0}else if(e.type==="text"){if(!ve(e))return!1}else if(!hr(e))return!1}function Ro(e){return nt(e)||De(e,wo)}function Po(e){return De(e,ko)}function od(e){return!!(e.type==="element"&&e.properties.hidden)||hr(e)||De(e,To)}function Ao(e){return e===" "||e===`
3429
- `}function sd(e){let n=/\r?\n|\r/.exec(e);return n?n[0]:" "}function ld(){return" "}function cd(e){return n;function n(t){return String(t).replace(/[\t\n\v\f\r ]+/g,e)}}function ud(e,n){if("tagName"in e&&e.properties)switch(e.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return e.properties.wrap?"pre-wrap":"pre";case"td":case"th":return e.properties.noWrap?"nowrap":n.whitespace;case"textarea":return"pre-wrap";default:}return n.whitespace}var dd={},pd=Bn({newlines:!0});function Fn(e){let n=e||dd,t=n.indent||2,i=n.indentInitial;return typeof t=="number"&&(t=" ".repeat(t)),i==null&&(i=!0),function(o){let s;pd(o),jt(o,function(l,c){let u=-1;if(!("children"in l))return;if(De(l,"head")&&(s=!0),s&&De(l,"body")&&(s=void 0),De(l,gr))return Wt;let d=l.children,m=c.length;if(d.length===0||!fr(l,s))return;i||m--;let p;for(;++u<d.length;){let E=d[u];(E.type==="text"||E.type==="comment")&&(E.value.includes(`
3430
- `)&&(p=!0),E.value=E.value.replace(/ *\n/g,"$&"+String(t).repeat(m)))}let f=[],_;for(u=-1;++u<d.length;){let E=d[u];(fr(E,s)||p&&!u)&&(r(f,m,E),p=!0),_=E,f.push(E)}_&&(p||fr(_,s))&&(ve(_)&&(f.pop(),_=f[f.length-1]),r(f,m-1)),l.children=f})};function r(o,s,l){let c=o[o.length-1],u=c&&ve(c)?o[o.length-2]:c,d=(a(u)&&a(l)?`
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 IE(r){let e=/\r?\n|\r/.exec(r);return e?e[0]:" "}function RE(){return" "}function PE(r){return e;function e(t){return String(t).replace(/[\t\n\v\f\r ]+/g,r)}}function DE(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 NE={},OE=Co({newlines:!0});function ko(r){let e=r||NE,t=e.indent||2,a=e.indentInitial;return typeof t=="number"&&(t=" ".repeat(t)),a==null&&(a=!0),function(o){let s;OE(o),Ba(o,function(l,c){let u=-1;if(!("children"in l))return;if(ir(l,"head")&&(s=!0),s&&ir(l,"body")&&(s=void 0),ir(l,tc))return Fa;let p=l.children,m=c.length;if(p.length===0||!nc(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];(nc(y,s)||d&&!u)&&(n(g,m,y),d=!0),f=y,g.push(y)}f&&(d||nc(f,s))&&(xt(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&&xt(c)?o[o.length-2]:c,p=(i(u)&&i(l)?`
3431
3435
 
3432
3436
  `:`
3433
- `)+String(t).repeat(Math.max(s,0));c&&c.type==="text"?c.value=ve(c)?d:c.value+d:o.push({type:"text",value:d})}function a(o){return!!(o&&o.type==="element"&&n.blanks&&n.blanks.length>0&&n.blanks.includes(o.tagName))}}function fr(e,n){return e.type==="root"||(e.type==="element"?n||De(e,"script")||nt(e)||!mr(e):!1)}var Do=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var Ge=class{constructor(n,t,i){this.property=n,this.normal=t,i&&(this.space=i)}};Ge.prototype.property={};Ge.prototype.normal={};Ge.prototype.space=null;function yr(e,n){let t={},i={},r=-1;for(;++r<e.length;)Object.assign(t,e[r].property),Object.assign(i,e[r].normal);return new Ge(t,i,n)}function Xt(e){return e.toLowerCase()}var ue=class{constructor(n,t){this.property=n,this.attribute=t}};ue.prototype.space=null;ue.prototype.boolean=!1;ue.prototype.booleanish=!1;ue.prototype.overloadedBoolean=!1;ue.prototype.number=!1;ue.prototype.commaSeparated=!1;ue.prototype.spaceSeparated=!1;ue.prototype.commaOrSpaceSeparated=!1;ue.prototype.mustUseProperty=!1;ue.prototype.defined=!1;var Yt={};va(Yt,{boolean:()=>B,booleanish:()=>Q,commaOrSpaceSeparated:()=>he,commaSeparated:()=>Xe,number:()=>C,overloadedBoolean:()=>br,spaceSeparated:()=>K});var md=0,B=it(),Q=it(),br=it(),C=it(),K=it(),Xe=it(),he=it();function it(){return 2**++md}var vr=Object.keys(Yt),rt=class extends ue{constructor(n,t,i,r){let a=-1;if(super(n,t),No(this,"space",r),typeof i=="number")for(;++a<vr.length;){let o=vr[a];No(this,vr[a],(i&Yt[o])===Yt[o])}}};rt.prototype.defined=!0;function No(e,n,t){t&&(e[n]=t)}var gd={}.hasOwnProperty;function Ce(e){let n={},t={},i;for(i in e.properties)if(gd.call(e.properties,i)){let r=e.properties[i],a=new rt(i,e.transform(e.attributes||{},i),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(a.mustUseProperty=!0),n[i]=a,t[Xt(i)]=i,t[Xt(a.attribute)]=i}return new Ge(n,t,e.space)}var _r=Ce({space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}});var Sr=Ce({space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function Gn(e,n){return n in e?e[n]:n}function zn(e,n){return Gn(e,n.toLowerCase())}var Er=Ce({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:zn,properties:{xmlns:null,xmlnsXLink:null}});var Cr=Ce({transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:Q,ariaAutoComplete:null,ariaBusy:Q,ariaChecked:Q,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:K,ariaCurrent:null,ariaDescribedBy:K,ariaDetails:null,ariaDisabled:Q,ariaDropEffect:K,ariaErrorMessage:null,ariaExpanded:Q,ariaFlowTo:K,ariaGrabbed:Q,ariaHasPopup:null,ariaHidden:Q,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:K,ariaLevel:C,ariaLive:null,ariaModal:Q,ariaMultiLine:Q,ariaMultiSelectable:Q,ariaOrientation:null,ariaOwns:K,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:Q,ariaReadOnly:Q,ariaRelevant:null,ariaRequired:Q,ariaRoleDescription:K,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:Q,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null}});var Lo=Ce({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:zn,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Xe,acceptCharset:K,accessKey:K,action:null,allow:null,allowFullScreen:B,allowPaymentRequest:B,allowUserMedia:B,alt:null,as:null,async:B,autoCapitalize:null,autoComplete:K,autoFocus:B,autoPlay:B,blocking:K,capture:null,charSet:null,checked:B,cite:null,className:K,cols:C,colSpan:null,content:null,contentEditable:Q,controls:B,controlsList:K,coords:C|Xe,crossOrigin:null,data:null,dateTime:null,decoding:null,default:B,defer:B,dir:null,dirName:null,disabled:B,download:br,draggable:Q,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:B,formTarget:null,headers:K,height:C,hidden:B,high:C,href:null,hrefLang:null,htmlFor:K,httpEquiv:K,id:null,imageSizes:null,imageSrcSet:null,inert:B,inputMode:null,integrity:null,is:null,isMap:B,itemId:null,itemProp:K,itemRef:K,itemScope:B,itemType:K,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:B,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:B,muted:B,name:null,nonce:null,noModule:B,noValidate:B,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:B,optimum:C,pattern:null,ping:K,placeholder:null,playsInline:B,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:B,referrerPolicy:null,rel:K,required:B,reversed:B,rows:C,rowSpan:C,sandbox:K,scope:null,scoped:B,seamless:B,selected:B,shadowRootClonable:B,shadowRootDelegatesFocus:B,shadowRootMode:null,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:Q,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:B,useMap:null,value:Q,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:K,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:B,declare:B,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:B,noHref:B,noShade:B,noWrap:B,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:Q,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:B,disableRemotePlayback:B,prefix:null,property:null,results:C,security:null,unselectable:null}});var Mo=Ce({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:Gn,properties:{about:he,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:K,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:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:B,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,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:Xe,g2:Xe,glyphName:Xe,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:he,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,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:C,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:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:K,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:he,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:he,rev:he,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:he,requiredFeatures:he,requiredFonts:he,requiredFormats:he,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:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:he,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:he,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:he,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}});var hd=/^data[-\w.:]+$/i,Oo=/-[a-z]/g,fd=/[A-Z]/g;function kr(e,n){let t=Xt(n),i=n,r=ue;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&hd.test(n)){if(n.charAt(4)==="-"){let a=n.slice(5).replace(Oo,bd);i="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{let a=n.slice(4);if(!Oo.test(a)){let o=a.replace(fd,yd);o.charAt(0)!=="-"&&(o="-"+o),n="data"+o}}r=rt}return new r(i,n)}function yd(e){return"-"+e.toLowerCase()}function bd(e){return e.charAt(1).toUpperCase()}var Bo=yr([Sr,_r,Er,Cr,Lo],"html"),Un=yr([Sr,_r,Er,Cr,Mo],"svg");var Fo={}.hasOwnProperty;function Go(e,n){let t=n||{};function i(r,...a){let o=i.invalid,s=i.handlers;if(r&&Fo.call(r,e)){let l=String(r[e]);o=Fo.call(s,l)?s[l]:i.unknown}if(o)return o.call(this,r,...a)}return i.handlers=t.handlers||{},i.invalid=t.invalid,i.unknown=t.unknown,i}var vd=/["&'<>`]/g,_d=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Sd=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Ed=/[|\\{}()[\]^$+*?.]/g,zo=new WeakMap;function Uo(e,n){if(e=e.replace(n.subset?Cd(n.subset):vd,i),n.subset||n.escapeOnly)return e;return e.replace(_d,t).replace(Sd,i);function t(r,a,o){return n.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,o.charCodeAt(a+2),n)}function i(r,a,o){return n.format(r.charCodeAt(0),o.charCodeAt(a+1),n)}}function Cd(e){let n=zo.get(e);return n||(n=kd(e),zo.set(e,n)),n}function kd(e){let n=[],t=-1;for(;++t<e.length;)n.push(e[t].replace(Ed,"\\$&"));return new RegExp("(?:"+n.join("|")+")","g")}var wd=/[\dA-Fa-f]/;function Ho(e,n,t){let i="&#x"+e.toString(16).toUpperCase();return t&&n&&!wd.test(String.fromCharCode(n))?i:i+";"}var Td=/\d/;function Vo(e,n,t){let i="&#"+String(e);return t&&n&&!Td.test(String.fromCharCode(n))?i:i+";"}var Wo=["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 Hn={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 jo=["cent","copy","divide","gt","lt","not","para","times"];var qo={}.hasOwnProperty,wr={},Vn;for(Vn in Hn)qo.call(Hn,Vn)&&(wr[Hn[Vn]]=Vn);var Ad=/[^\dA-Za-z]/;function Ko(e,n,t,i){let r=String.fromCharCode(e);if(qo.call(wr,r)){let a=wr[r],o="&"+a;return t&&Wo.includes(a)&&!jo.includes(a)&&(!i||n&&n!==61&&Ad.test(String.fromCharCode(n)))?o:o+";"}return""}function Xo(e,n,t){let i=Ho(e,n,t.omitOptionalSemicolons),r;if((t.useNamedReferences||t.useShortestReferences)&&(r=Ko(e,n,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!r)&&t.useShortestReferences){let a=Vo(e,n,t.omitOptionalSemicolons);a.length<i.length&&(i=a)}return r&&(!t.useShortestReferences||r.length<i.length)?r:i}function ze(e,n){return Uo(e,Object.assign({format:Xo},n))}var xd=/^>|^->|<!--|-->|--!>|<!-$/g,Id=[">"],Rd=["<",">"];function Yo(e,n,t,i){return i.settings.bogusComments?"<?"+ze(e.value,Object.assign({},i.settings.characterReferences,{subset:Id}))+">":"<!--"+e.value.replace(xd,r)+"-->";function r(a){return ze(a,Object.assign({},i.settings.characterReferences,{subset:Rd}))}}function Jo(e,n,t,i){return"<!"+(i.settings.upperDoctype?"DOCTYPE":"doctype")+(i.settings.tightDoctype?"":" ")+"html>"}function Tr(e,n){let t=String(e);if(typeof n!="string")throw new TypeError("Expected character");let i=0,r=t.indexOf(n);for(;r!==-1;)i++,r=t.indexOf(n,r+n.length);return i}function Zo(e,n){let t=n||{};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}var te=$o(1),Ar=$o(-1),Pd=[];function $o(e){return n;function n(t,i,r){let a=t?t.children:Pd,o=(i||0)+e,s=a[o];if(!r)for(;s&&ve(s);)o+=e,s=a[o];return s}}var Dd={}.hasOwnProperty;function Wn(e){return n;function n(t,i,r){return Dd.call(e,t.tagName)&&e[t.tagName](t,i,r)}}var Jt=Wn({body:Ld,caption:xr,colgroup:xr,dd:Fd,dt:Bd,head:xr,html:Nd,li:Od,optgroup:Gd,option:zd,p:Md,rp:Qo,rt:Qo,tbody:Hd,td:es,tfoot:Vd,th:es,thead:Ud,tr:Wd});function xr(e,n,t){let i=te(t,n,!0);return!i||i.type!=="comment"&&!(i.type==="text"&&ve(i.value.charAt(0)))}function Nd(e,n,t){let i=te(t,n);return!i||i.type!=="comment"}function Ld(e,n,t){let i=te(t,n);return!i||i.type!=="comment"}function Md(e,n,t){let i=te(t,n);return i?i.type==="element"&&(i.tagName==="address"||i.tagName==="article"||i.tagName==="aside"||i.tagName==="blockquote"||i.tagName==="details"||i.tagName==="div"||i.tagName==="dl"||i.tagName==="fieldset"||i.tagName==="figcaption"||i.tagName==="figure"||i.tagName==="footer"||i.tagName==="form"||i.tagName==="h1"||i.tagName==="h2"||i.tagName==="h3"||i.tagName==="h4"||i.tagName==="h5"||i.tagName==="h6"||i.tagName==="header"||i.tagName==="hgroup"||i.tagName==="hr"||i.tagName==="main"||i.tagName==="menu"||i.tagName==="nav"||i.tagName==="ol"||i.tagName==="p"||i.tagName==="pre"||i.tagName==="section"||i.tagName==="table"||i.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 Od(e,n,t){let i=te(t,n);return!i||i.type==="element"&&i.tagName==="li"}function Bd(e,n,t){let i=te(t,n);return!!(i&&i.type==="element"&&(i.tagName==="dt"||i.tagName==="dd"))}function Fd(e,n,t){let i=te(t,n);return!i||i.type==="element"&&(i.tagName==="dt"||i.tagName==="dd")}function Qo(e,n,t){let i=te(t,n);return!i||i.type==="element"&&(i.tagName==="rp"||i.tagName==="rt")}function Gd(e,n,t){let i=te(t,n);return!i||i.type==="element"&&i.tagName==="optgroup"}function zd(e,n,t){let i=te(t,n);return!i||i.type==="element"&&(i.tagName==="option"||i.tagName==="optgroup")}function Ud(e,n,t){let i=te(t,n);return!!(i&&i.type==="element"&&(i.tagName==="tbody"||i.tagName==="tfoot"))}function Hd(e,n,t){let i=te(t,n);return!i||i.type==="element"&&(i.tagName==="tbody"||i.tagName==="tfoot")}function Vd(e,n,t){return!te(t,n)}function Wd(e,n,t){let i=te(t,n);return!i||i.type==="element"&&i.tagName==="tr"}function es(e,n,t){let i=te(t,n);return!i||i.type==="element"&&(i.tagName==="td"||i.tagName==="th")}var ts=Wn({body:Kd,colgroup:Xd,head:qd,html:jd,tbody:Yd});function jd(e){let n=te(e,-1);return!n||n.type!=="comment"}function qd(e){let n=e.children,t=[],i=-1;for(;++i<n.length;){let r=n[i];if(r.type==="element"&&(r.tagName==="title"||r.tagName==="base")){if(t.includes(r.tagName))return!1;t.push(r.tagName)}}return n.length>0}function Kd(e){let n=te(e,-1,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&ve(n.value.charAt(0)))&&!(n.type==="element"&&(n.tagName==="meta"||n.tagName==="link"||n.tagName==="script"||n.tagName==="style"||n.tagName==="template"))}function Xd(e,n,t){let i=Ar(t,n),r=te(e,-1,!0);return t&&i&&i.type==="element"&&i.tagName==="colgroup"&&Jt(i,t.children.indexOf(i),t)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function Yd(e,n,t){let i=Ar(t,n),r=te(e,-1);return t&&i&&i.type==="element"&&(i.tagName==="thead"||i.tagName==="tbody")&&Jt(i,t.children.indexOf(i),t)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}var jn={name:[[`
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:[[`
3434
3438
  \f\r &/=>`.split(""),`
3435
3439
  \f\r "&'/=>\``.split("")],[`\0
3436
3440
  \f\r "&'/<=>`.split(""),`\0
@@ -3438,19 +3442,19 @@ ${n.extractions.map(r=>`- ${r.name} (${r.type}): ${r.description||"No descriptio
3438
3442
  \f\r &>`.split(""),`\0
3439
3443
  \f\r "&'<=>\``.split("")],[`\0
3440
3444
  \f\r "&'<=>\``.split(""),`\0
3441
- \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function ns(e,n,t,i){let r=i.schema,a=r.space==="svg"?!1:i.settings.omitOptionalTags,o=r.space==="svg"?i.settings.closeEmptyElements:i.settings.voids.includes(e.tagName.toLowerCase()),s=[],l;r.space==="html"&&e.tagName==="svg"&&(i.schema=Un);let c=Jd(i,e.properties),u=i.all(r.space==="html"&&e.tagName==="template"?e.content:e);return i.schema=r,u&&(o=!1),(c||!a||!ts(e,n,t))&&(s.push("<",e.tagName,c?" "+c:""),o&&(r.space==="svg"||i.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!i.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(u),!o&&(!a||!Jt(e,n,t))&&s.push("</"+e.tagName+">"),s.join("")}function Jd(e,n){let t=[],i=-1,r;if(n){for(r in n)if(n[r]!==null&&n[r]!==void 0){let a=Zd(e,r,n[r]);a&&t.push(a)}}for(;++i<t.length;){let a=e.settings.tightAttributes?t[i].charAt(t[i].length-1):void 0;i!==t.length-1&&a!=='"'&&a!=="'"&&(t[i]+=" ")}return t.join("")}function Zd(e,n,t){let i=kr(e.schema,n),r=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,a=e.settings.allowDangerousCharacters?0:1,o=e.quote,s;if(i.overloadedBoolean&&(t===i.attribute||t==="")?t=!0:(i.boolean||i.overloadedBoolean&&typeof t!="string")&&(t=!!t),t==null||t===!1||typeof t=="number"&&Number.isNaN(t))return"";let l=ze(i.attribute,Object.assign({},e.settings.characterReferences,{subset:jn.name[r][a]}));return t===!0||(t=Array.isArray(t)?(i.commaSeparated?Zo:So)(t,{padLeft:!e.settings.tightCommaSeparatedLists}):String(t),e.settings.collapseEmptyAttributes&&!t)?l:(e.settings.preferUnquoted&&(s=ze(t,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:jn.unquoted[r][a]}))),s!==t&&(e.settings.quoteSmart&&Tr(t,o)>Tr(t,e.alternative)&&(o=e.alternative),s=o+ze(t,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?jn.single:jn.double)[r][a],attribute:!0}))+o),l+(s&&"="+s))}var $d=["<","&"];function qn(e,n,t,i){return t&&t.type==="element"&&(t.tagName==="script"||t.tagName==="style")?e.value:ze(e.value,Object.assign({},i.settings.characterReferences,{subset:$d}))}function is(e,n,t,i){return i.settings.allowDangerousHtml?e.value:qn(e,n,t,i)}function rs(e,n,t,i){return i.all(e)}var as=Go("type",{invalid:Qd,unknown:ep,handlers:{comment:Yo,doctype:Jo,element:ns,raw:is,root:rs,text:qn}});function Qd(e){throw new Error("Expected node, not `"+e+"`")}function ep(e){let n=e;throw new Error("Cannot compile unknown node `"+n.type+"`")}var tp={},np={},ip=[];function Ir(e,n){let t=n||tp,i=t.quote||'"',r=i==='"'?"'":'"';if(i!=='"'&&i!=="'")throw new Error("Invalid quote `"+i+"`, expected `'` or `\"`");return{one:rp,all:ap,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||Do,characterReferences:t.characterReferences||np,closeSelfClosing:t.closeSelfClosing||!1,closeEmptyElements:t.closeEmptyElements||!1},schema:t.space==="svg"?Un:Bo,quote:i,alternative:r}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function rp(e,n,t){return as(e,n,t,this)}function ap(e){let n=[],t=e&&e.children||ip,i=-1;for(;++i<t.length;)n[i]=this.one(t[i],i,e);return n.join("")}function Kn(e){let n=this,t={...n.data("settings"),...e};n.compiler=i;function i(r){return Ir(r,t)}}var op={};function Rr(e,n){let t=n||op,i=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,r=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return ss(e,i,r)}function ss(e,n,t){if(sp(e)){if("value"in e)return e.type==="html"&&!t?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return os(e.children,n,t)}return Array.isArray(e)?os(e,n,t):""}function os(e,n,t){let i=[],r=-1;for(;++r<e.length;)i[r]=ss(e[r],n,t);return i.join("")}function sp(e){return!!(e&&typeof e=="object")}var ls=document.createElement("i");function kt(e){let n="&"+e+";";ls.innerHTML=n;let t=ls.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===n?!1:t}function de(e,n,t,i){let r=e.length,a=0,o;if(n<0?n=-n>r?0:r+n:n=n>r?r:n,t=t>0?t:0,i.length<1e4)o=Array.from(i),o.unshift(n,t),e.splice(...o);else for(t&&e.splice(n,t);a<i.length;)o=i.slice(a,a+1e4),o.unshift(n,0),e.splice(...o),a+=1e4,n+=1e4}function me(e,n){return e.length>0?(de(e,e.length,0,n),e):n}var cs={}.hasOwnProperty;function us(e){let n={},t=-1;for(;++t<e.length;)lp(n,e[t]);return n}function lp(e,n){let t;for(t in n){let r=(cs.call(e,t)?e[t]:void 0)||(e[t]={}),a=n[t],o;if(a)for(o in a){cs.call(r,o)||(r[o]=[]);let s=a[o];cp(r[o],Array.isArray(s)?s:s?[s]:[])}}}function cp(e,n){let t=-1,i=[];for(;++t<n.length;)(n[t].add==="after"?e:i).push(n[t]);de(e,0,0,i)}function Xn(e,n){let t=Number.parseInt(e,n);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 Ue(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var _e=Ye(/[A-Za-z]/),ae=Ye(/[\dA-Za-z]/),ds=Ye(/[#-'*+\--9=?A-Z^-~]/);function Zt(e){return e!==null&&(e<32||e===127)}var $t=Ye(/\d/),ps=Ye(/[\dA-Fa-f]/),ms=Ye(/[!-/:-@[-`{-~]/);function A(e){return e!==null&&e<-2}function ne(e){return e!==null&&(e<0||e===32)}function F(e){return e===-2||e===-1||e===32}var gs=Ye(/\p{P}|\p{S}/u),hs=Ye(/\s/);function Ye(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function ke(e){let n=[],t=-1,i=0,r=0;for(;++t<e.length;){let a=e.charCodeAt(t),o="";if(a===37&&ae(e.charCodeAt(t+1))&&ae(e.charCodeAt(t+2)))r=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let s=e.charCodeAt(t+1);a<56320&&s>56319&&s<57344?(o=String.fromCharCode(a,s),r=1):o="\uFFFD"}else o=String.fromCharCode(a);o&&(n.push(e.slice(i,t),encodeURIComponent(o)),i=t+r+1,o=""),r&&(t+=r,r=0)}return n.join("")+e.slice(i)}function z(e,n,t,i){let r=i?i-1:Number.POSITIVE_INFINITY,a=0;return o;function o(l){return F(l)?(e.enter(t),s(l)):n(l)}function s(l){return F(l)&&a++<r?(e.consume(l),s):(e.exit(t),n(l))}}var fs={tokenize:up};function up(e){let n=e.attempt(this.parser.constructs.contentInitial,i,r),t;return n;function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),z(e,n,"linePrefix")}function r(s){return e.enter("paragraph"),a(s)}function a(s){let l=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=l),t=l,o(s)}function o(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return A(s)?(e.consume(s),e.exit("chunkText"),a):(e.consume(s),o)}}var bs={tokenize:dp},ys={tokenize:pp};function dp(e){let n=this,t=[],i=0,r,a,o;return s;function s(S){if(i<t.length){let N=t[i];return n.containerState=N[1],e.attempt(N[0].continuation,l,c)(S)}return c(S)}function l(S){if(i++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,r&&T();let N=n.events.length,L=N,b;for(;L--;)if(n.events[L][0]==="exit"&&n.events[L][1].type==="chunkFlow"){b=n.events[L][1].end;break}y(i);let I=N;for(;I<n.events.length;)n.events[I][1].end=Object.assign({},b),I++;return de(n.events,L+1,0,n.events.slice(N)),n.events.length=I,c(S)}return s(S)}function c(S){if(i===t.length){if(!r)return m(S);if(r.currentConstruct&&r.currentConstruct.concrete)return f(S);n.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(ys,u,d)(S)}function u(S){return r&&T(),y(i),m(S)}function d(S){return n.parser.lazy[n.now().line]=i!==t.length,o=n.now().offset,f(S)}function m(S){return n.containerState={},e.attempt(ys,p,f)(S)}function p(S){return i++,t.push([n.currentConstruct,n.containerState]),m(S)}function f(S){if(S===null){r&&T(),y(0),e.consume(S);return}return r=r||n.parser.flow(n.now()),e.enter("chunkFlow",{contentType:"flow",previous:a,_tokenizer:r}),_(S)}function _(S){if(S===null){E(e.exit("chunkFlow"),!0),y(0),e.consume(S);return}return A(S)?(e.consume(S),E(e.exit("chunkFlow")),i=0,n.interrupt=void 0,s):(e.consume(S),_)}function E(S,N){let L=n.sliceStream(S);if(N&&L.push(null),S.previous=a,a&&(a.next=S),a=S,r.defineSkip(S.start),r.write(L),n.parser.lazy[S.start.line]){let b=r.events.length;for(;b--;)if(r.events[b][1].start.offset<o&&(!r.events[b][1].end||r.events[b][1].end.offset>o))return;let I=n.events.length,D=I,P,M;for(;D--;)if(n.events[D][0]==="exit"&&n.events[D][1].type==="chunkFlow"){if(P){M=n.events[D][1].end;break}P=!0}for(y(i),b=I;b<n.events.length;)n.events[b][1].end=Object.assign({},M),b++;de(n.events,D+1,0,n.events.slice(I)),n.events.length=b}}function y(S){let N=t.length;for(;N-- >S;){let L=t[N];n.containerState=L[1],L[0].exit.call(n,e)}t.length=S}function T(){r.write([null]),a=void 0,r=void 0,n.containerState._closeFlow=void 0}}function pp(e,n,t){return z(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Pr(e){if(e===null||ne(e)||hs(e))return 1;if(gs(e))return 2}function wt(e,n,t){let i=[],r=-1;for(;++r<e.length;){let a=e[r].resolveAll;a&&!i.includes(a)&&(n=a(n,t),i.push(a))}return n}var Qt={name:"attention",tokenize:gp,resolveAll:mp};function mp(e,n){let t=-1,i,r,a,o,s,l,c,u;for(;++t<e.length;)if(e[t][0]==="enter"&&e[t][1].type==="attentionSequence"&&e[t][1]._close){for(i=t;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&n.sliceSerialize(e[i][1]).charCodeAt(0)===n.sliceSerialize(e[t][1]).charCodeAt(0)){if((e[i][1]._close||e[t][1]._open)&&(e[t][1].end.offset-e[t][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[t][1].end.offset-e[t][1].start.offset)%3))continue;l=e[i][1].end.offset-e[i][1].start.offset>1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;let d=Object.assign({},e[i][1].end),m=Object.assign({},e[t][1].start);vs(d,-l),vs(m,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},e[i][1].end)},s={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[t][1].start),end:m},a={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[i][1].end),end:Object.assign({},e[t][1].start)},r={type:l>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},s.end)},e[i][1].end=Object.assign({},o.start),e[t][1].start=Object.assign({},s.end),c=[],e[i][1].end.offset-e[i][1].start.offset&&(c=me(c,[["enter",e[i][1],n],["exit",e[i][1],n]])),c=me(c,[["enter",r,n],["enter",o,n],["exit",o,n],["enter",a,n]]),c=me(c,wt(n.parser.constructs.insideSpan.null,e.slice(i+1,t),n)),c=me(c,[["exit",a,n],["enter",s,n],["exit",s,n],["exit",r,n]]),e[t][1].end.offset-e[t][1].start.offset?(u=2,c=me(c,[["enter",e[t][1],n],["exit",e[t][1],n]])):u=0,de(e,i-1,t-i+3,c),t=i+c.length-u-2;break}}for(t=-1;++t<e.length;)e[t][1].type==="attentionSequence"&&(e[t][1].type="data");return e}function gp(e,n){let t=this.parser.constructs.attentionMarkers.null,i=this.previous,r=Pr(i),a;return o;function o(l){return a=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===a)return e.consume(l),s;let c=e.exit("attentionSequence"),u=Pr(l),d=!u||u===2&&r||t.includes(l),m=!r||r===2&&u||t.includes(i);return c._open=!!(a===42?d:d&&(r||!m)),c._close=!!(a===42?m:m&&(u||!d)),n(l)}}function vs(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}var Dr={name:"autolink",tokenize:hp};function hp(e,n,t){let i=0;return r;function r(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(p){return _e(p)?(e.consume(p),o):p===64?t(p):c(p)}function o(p){return p===43||p===45||p===46||ae(p)?(i=1,s(p)):c(p)}function s(p){return p===58?(e.consume(p),i=0,l):(p===43||p===45||p===46||ae(p))&&i++<32?(e.consume(p),s):(i=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),n):p===null||p===32||p===60||Zt(p)?t(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),u):ds(p)?(e.consume(p),c):t(p)}function u(p){return ae(p)?d(p):t(p)}function d(p){return p===46?(e.consume(p),i=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),n):m(p)}function m(p){if((p===45||ae(p))&&i++<63){let f=p===45?m:d;return e.consume(p),f}return t(p)}}var Je={tokenize:fp,partial:!0};function fp(e,n,t){return i;function i(a){return F(a)?z(e,r,"linePrefix")(a):r(a)}function r(a){return a===null||A(a)?n(a):t(a)}}var Yn={name:"blockQuote",tokenize:yp,continuation:{tokenize:bp},exit:vp};function yp(e,n,t){let i=this;return r;function r(o){if(o===62){let s=i.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),a}return t(o)}function a(o){return F(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(o))}}function bp(e,n,t){let i=this;return r;function r(o){return F(o)?z(e,a,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):a(o)}function a(o){return e.attempt(Yn,n,t)(o)}}function vp(e){e.exit("blockQuote")}var Jn={name:"characterEscape",tokenize:_p};function _p(e,n,t){return i;function i(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),r}function r(a){return ms(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):t(a)}}var Zn={name:"characterReference",tokenize:Sp};function Sp(e,n,t){let i=this,r=0,a,o;return s;function s(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),a=31,o=ae,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,o=ps,u):(e.enter("characterReferenceValue"),a=7,o=$t,u(d))}function u(d){if(d===59&&r){let m=e.exit("characterReferenceValue");return o===ae&&!kt(i.sliceSerialize(m))?t(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return o(d)&&r++<a?(e.consume(d),u):t(d)}}var _s={tokenize:Cp,partial:!0},$n={name:"codeFenced",tokenize:Ep,concrete:!0};function Ep(e,n,t){let i=this,r={tokenize:L,partial:!0},a=0,o=0,s;return l;function l(b){return c(b)}function c(b){let I=i.events[i.events.length-1];return a=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,s=b,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(b)}function u(b){return b===s?(o++,e.consume(b),u):o<3?t(b):(e.exit("codeFencedFenceSequence"),F(b)?z(e,d,"whitespace")(b):d(b))}function d(b){return b===null||A(b)?(e.exit("codeFencedFence"),i.interrupt?n(b):e.check(_s,_,N)(b)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||A(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(b)):F(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),z(e,p,"whitespace")(b)):b===96&&b===s?t(b):(e.consume(b),m)}function p(b){return b===null||A(b)?d(b):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===null||A(b)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(b)):b===96&&b===s?t(b):(e.consume(b),f)}function _(b){return e.attempt(r,N,E)(b)}function E(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),y}function y(b){return a>0&&F(b)?z(e,T,"linePrefix",a+1)(b):T(b)}function T(b){return b===null||A(b)?e.check(_s,_,N)(b):(e.enter("codeFlowValue"),S(b))}function S(b){return b===null||A(b)?(e.exit("codeFlowValue"),T(b)):(e.consume(b),S)}function N(b){return e.exit("codeFenced"),n(b)}function L(b,I,D){let P=0;return M;function M(O){return b.enter("lineEnding"),b.consume(O),b.exit("lineEnding"),H}function H(O){return b.enter("codeFencedFence"),F(O)?z(b,R,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):R(O)}function R(O){return O===s?(b.enter("codeFencedFenceSequence"),w(O)):D(O)}function w(O){return O===s?(P++,b.consume(O),w):P>=o?(b.exit("codeFencedFenceSequence"),F(O)?z(b,x,"whitespace")(O):x(O)):D(O)}function x(O){return O===null||A(O)?(b.exit("codeFencedFence"),I(O)):D(O)}}}function Cp(e,n,t){let i=this;return r;function r(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a)}function a(o){return i.parser.lazy[i.now().line]?t(o):n(o)}}var en={name:"codeIndented",tokenize:wp},kp={tokenize:Tp,partial:!0};function wp(e,n,t){let i=this;return r;function r(c){return e.enter("codeIndented"),z(e,a,"linePrefix",5)(c)}function a(c){let u=i.events[i.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):A(c)?e.attempt(kp,o,l)(c):(e.enter("codeFlowValue"),s(c))}function s(c){return c===null||A(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),s)}function l(c){return e.exit("codeIndented"),n(c)}}function Tp(e,n,t){let i=this;return r;function r(o){return i.parser.lazy[i.now().line]?t(o):A(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):z(e,a,"linePrefix",5)(o)}function a(o){let s=i.events[i.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?n(o):A(o)?r(o):t(o)}}var Nr={name:"codeText",tokenize:Ip,resolve:Ap,previous:xp};function Ap(e){let n=e.length-4,t=3,i,r;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(i=t;++i<n;)if(e[i][1].type==="codeTextData"){e[t][1].type="codeTextPadding",e[n][1].type="codeTextPadding",t+=2,n-=2;break}}for(i=t-1,n++;++i<=n;)r===void 0?i!==n&&e[i][1].type!=="lineEnding"&&(r=i):(i===n||e[i][1].type==="lineEnding")&&(e[r][1].type="codeTextData",i!==r+2&&(e[r][1].end=e[i-1][1].end,e.splice(r+2,i-r-2),n-=i-r-2,i=r+2),r=void 0);return e}function xp(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Ip(e,n,t){let i=this,r=0,a,o;return s;function s(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),r++,l):(e.exit("codeTextSequence"),c(m))}function c(m){return m===null?t(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),c):m===96?(o=e.enter("codeTextSequence"),a=0,d(m)):A(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||A(m)?(e.exit("codeTextData"),c(m)):(e.consume(m),u)}function d(m){return m===96?(e.consume(m),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),n(m)):(o.type="codeTextData",u(m))}}var Qn=class{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,t){let i=t??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(n,i):n>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(n,t,i){let r=t||0;this.setCursor(Math.trunc(n));let a=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return i&&tn(this.left,i),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),tn(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),tn(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){let t=this.left.splice(n,Number.POSITIVE_INFINITY);tn(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);tn(this.left,t.reverse())}}};function tn(e,n){let t=0;if(n.length<1e4)e.push(...n);else for(;t<n.length;)e.push(...n.slice(t,t+1e4)),t+=1e4}function ei(e){let n={},t=-1,i,r,a,o,s,l,c,u=new Qn(e);for(;++t<u.length;){for(;t in n;)t=n[t];if(i=u.get(t),t&&i[1].type==="chunkFlow"&&u.get(t-1)[1].type==="listItemPrefix"&&(l=i[1]._tokenizer.events,a=0,a<l.length&&l[a][1].type==="lineEndingBlank"&&(a+=2),a<l.length&&l[a][1].type==="content"))for(;++a<l.length&&l[a][1].type!=="content";)l[a][1].type==="chunkText"&&(l[a][1]._isInFirstContentOfListItem=!0,a++);if(i[0]==="enter")i[1].contentType&&(Object.assign(n,Rp(u,t)),t=n[t],c=!0);else if(i[1]._container){for(a=t,r=void 0;a--&&(o=u.get(a),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank");)o[0]==="enter"&&(r&&(u.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=a);r&&(i[1].end=Object.assign({},u.get(r)[1].start),s=u.slice(r,t),s.unshift(i),u.splice(r,t-r+1,s))}}return de(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function Rp(e,n){let t=e.get(n)[1],i=e.get(n)[2],r=n-1,a=[],o=t._tokenizer||i.parser[t.contentType](t.start),s=o.events,l=[],c={},u,d,m=-1,p=t,f=0,_=0,E=[_];for(;p;){for(;e.get(++r)[1]!==p;);a.push(r),p._tokenizer||(u=i.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=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&&(_=m+1,E.push(_),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):E.pop(),m=E.length;m--;){let y=s.slice(E[m],E[m+1]),T=a.pop();l.push([T,T+y.length-1]),e.splice(T,2,y)}for(l.reverse(),m=-1;++m<l.length;)c[f+l[m][0]]=f+l[m][1],f+=l[m][1]-l[m][0]-1;return c}var Lr={tokenize:Np,resolve:Dp},Pp={tokenize:Lp,partial:!0};function Dp(e){return ei(e),e}function Np(e,n){let t;return i;function i(s){return e.enter("content"),t=e.enter("chunkContent",{contentType:"content"}),r(s)}function r(s){return s===null?a(s):A(s)?e.check(Pp,o,a)(s):(e.consume(s),r)}function a(s){return e.exit("chunkContent"),e.exit("content"),n(s)}function o(s){return e.consume(s),e.exit("chunkContent"),t.next=e.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,r}}function Lp(e,n,t){let i=this;return r;function r(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),z(e,a,"linePrefix")}function a(o){if(o===null||A(o))return t(o);let s=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?n(o):e.interrupt(i.parser.constructs.flow,t,n)(o)}}function ti(e,n,t,i,r,a,o,s,l){let c=l||Number.POSITIVE_INFINITY,u=0;return d;function d(y){return y===60?(e.enter(i),e.enter(r),e.enter(a),e.consume(y),e.exit(a),m):y===null||y===32||y===41||Zt(y)?t(y):(e.enter(i),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),_(y))}function m(y){return y===62?(e.enter(a),e.consume(y),e.exit(a),e.exit(r),e.exit(i),n):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(s),m(y)):y===null||y===60||A(y)?t(y):(e.consume(y),y===92?f:p)}function f(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function _(y){return!u&&(y===null||y===41||ne(y))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(i),n(y)):u<c&&y===40?(e.consume(y),u++,_):y===41?(e.consume(y),u--,_):y===null||y===32||y===40||Zt(y)?t(y):(e.consume(y),y===92?E:_)}function E(y){return y===40||y===41||y===92?(e.consume(y),_):_(y)}}function ni(e,n,t,i,r,a){let o=this,s=0,l;return c;function c(p){return e.enter(i),e.enter(r),e.consume(p),e.exit(r),e.enter(a),u}function u(p){return s>999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?t(p):p===93?(e.exit(a),e.enter(r),e.consume(p),e.exit(r),e.exit(i),n):A(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||A(p)||s++>999?(e.exit("chunkString"),u(p)):(e.consume(p),l||(l=!F(p)),p===92?m:d)}function m(p){return p===91||p===92||p===93?(e.consume(p),s++,d):d(p)}}function ii(e,n,t,i,r,a){let o;return s;function s(m){return m===34||m===39||m===40?(e.enter(i),e.enter(r),e.consume(m),e.exit(r),o=m===40?41:m,l):t(m)}function l(m){return m===o?(e.enter(r),e.consume(m),e.exit(r),e.exit(i),n):(e.enter(a),c(m))}function c(m){return m===o?(e.exit(a),l(o)):m===null?t(m):A(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),z(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===o||m===null||A(m)?(e.exit("chunkString"),c(m)):(e.consume(m),m===92?d:u)}function d(m){return m===o||m===92?(e.consume(m),u):u(m)}}function at(e,n){let t;return i;function i(r){return A(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t=!0,i):F(r)?z(e,i,t?"linePrefix":"lineSuffix")(r):n(r)}}var Mr={name:"definition",tokenize:Op},Mp={tokenize:Bp,partial:!0};function Op(e,n,t){let i=this,r;return a;function a(p){return e.enter("definition"),o(p)}function o(p){return ni.call(i,e,s,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return r=Ue(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):t(p)}function l(p){return ne(p)?at(e,c)(p):c(p)}function c(p){return ti(e,u,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(Mp,d,d)(p)}function d(p){return F(p)?z(e,m,"whitespace")(p):m(p)}function m(p){return p===null||A(p)?(e.exit("definition"),i.parser.defined.push(r),n(p)):t(p)}}function Bp(e,n,t){return i;function i(s){return ne(s)?at(e,r)(s):t(s)}function r(s){return ii(e,a,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return F(s)?z(e,o,"whitespace")(s):o(s)}function o(s){return s===null||A(s)?n(s):t(s)}}var Or={name:"hardBreakEscape",tokenize:Fp};function Fp(e,n,t){return i;function i(a){return e.enter("hardBreakEscape"),e.consume(a),r}function r(a){return A(a)?(e.exit("hardBreakEscape"),n(a)):t(a)}}var Br={name:"headingAtx",tokenize:zp,resolve:Gp};function Gp(e,n){let t=e.length-2,i=3,r,a;return e[i][1].type==="whitespace"&&(i+=2),t-2>i&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(i===t-1||t-4>i&&e[t-2][1].type==="whitespace")&&(t-=i+1===t?2:4),t>i&&(r={type:"atxHeadingText",start:e[i][1].start,end:e[t][1].end},a={type:"chunkText",start:e[i][1].start,end:e[t][1].end,contentType:"text"},de(e,i,t-i+1,[["enter",r,n],["enter",a,n],["exit",a,n],["exit",r,n]])),e}function zp(e,n,t){let i=0;return r;function r(u){return e.enter("atxHeading"),a(u)}function a(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&i++<6?(e.consume(u),o):u===null||ne(u)?(e.exit("atxHeadingSequence"),s(u)):t(u)}function s(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||A(u)?(e.exit("atxHeading"),n(u)):F(u)?z(e,s,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||ne(u)?(e.exit("atxHeadingText"),s(u)):(e.consume(u),c)}}var Ss=["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"],Fr=["pre","script","style","textarea"];var Gr={name:"htmlFlow",tokenize:Wp,resolveTo:Vp,concrete:!0},Up={tokenize:qp,partial:!0},Hp={tokenize:jp,partial:!0};function Vp(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function Wp(e,n,t){let i=this,r,a,o,s,l;return c;function c(h){return u(h)}function u(h){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(h),d}function d(h){return h===33?(e.consume(h),m):h===47?(e.consume(h),a=!0,_):h===63?(e.consume(h),r=3,i.interrupt?n:g):_e(h)?(e.consume(h),o=String.fromCharCode(h),E):t(h)}function m(h){return h===45?(e.consume(h),r=2,p):h===91?(e.consume(h),r=5,s=0,f):_e(h)?(e.consume(h),r=4,i.interrupt?n:g):t(h)}function p(h){return h===45?(e.consume(h),i.interrupt?n:g):t(h)}function f(h){let fe="CDATA[";return h===fe.charCodeAt(s++)?(e.consume(h),s===fe.length?i.interrupt?n:R:f):t(h)}function _(h){return _e(h)?(e.consume(h),o=String.fromCharCode(h),E):t(h)}function E(h){if(h===null||h===47||h===62||ne(h)){let fe=h===47,Qe=o.toLowerCase();return!fe&&!a&&Fr.includes(Qe)?(r=1,i.interrupt?n(h):R(h)):Ss.includes(o.toLowerCase())?(r=6,fe?(e.consume(h),y):i.interrupt?n(h):R(h)):(r=7,i.interrupt&&!i.parser.lazy[i.now().line]?t(h):a?T(h):S(h))}return h===45||ae(h)?(e.consume(h),o+=String.fromCharCode(h),E):t(h)}function y(h){return h===62?(e.consume(h),i.interrupt?n:R):t(h)}function T(h){return F(h)?(e.consume(h),T):M(h)}function S(h){return h===47?(e.consume(h),M):h===58||h===95||_e(h)?(e.consume(h),N):F(h)?(e.consume(h),S):M(h)}function N(h){return h===45||h===46||h===58||h===95||ae(h)?(e.consume(h),N):L(h)}function L(h){return h===61?(e.consume(h),b):F(h)?(e.consume(h),L):S(h)}function b(h){return h===null||h===60||h===61||h===62||h===96?t(h):h===34||h===39?(e.consume(h),l=h,I):F(h)?(e.consume(h),b):D(h)}function I(h){return h===l?(e.consume(h),l=null,P):h===null||A(h)?t(h):(e.consume(h),I)}function D(h){return h===null||h===34||h===39||h===47||h===60||h===61||h===62||h===96||ne(h)?L(h):(e.consume(h),D)}function P(h){return h===47||h===62||F(h)?S(h):t(h)}function M(h){return h===62?(e.consume(h),H):t(h)}function H(h){return h===null||A(h)?R(h):F(h)?(e.consume(h),H):t(h)}function R(h){return h===45&&r===2?(e.consume(h),j):h===60&&r===1?(e.consume(h),X):h===62&&r===4?(e.consume(h),Se):h===63&&r===3?(e.consume(h),g):h===93&&r===5?(e.consume(h),ie):A(h)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(Up,Me,w)(h)):h===null||A(h)?(e.exit("htmlFlowData"),w(h)):(e.consume(h),R)}function w(h){return e.check(Hp,x,Me)(h)}function x(h){return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),O}function O(h){return h===null||A(h)?w(h):(e.enter("htmlFlowData"),R(h))}function j(h){return h===45?(e.consume(h),g):R(h)}function X(h){return h===47?(e.consume(h),o="",re):R(h)}function re(h){if(h===62){let fe=o.toLowerCase();return Fr.includes(fe)?(e.consume(h),Se):R(h)}return _e(h)&&o.length<8?(e.consume(h),o+=String.fromCharCode(h),re):R(h)}function ie(h){return h===93?(e.consume(h),g):R(h)}function g(h){return h===62?(e.consume(h),Se):h===45&&r===2?(e.consume(h),g):R(h)}function Se(h){return h===null||A(h)?(e.exit("htmlFlowData"),Me(h)):(e.consume(h),Se)}function Me(h){return e.exit("htmlFlow"),n(h)}}function jp(e,n,t){let i=this;return r;function r(o){return A(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):t(o)}function a(o){return i.parser.lazy[i.now().line]?t(o):n(o)}}function qp(e,n,t){return i;function i(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(Je,n,t)}}var zr={name:"htmlText",tokenize:Kp};function Kp(e,n,t){let i=this,r,a,o;return s;function s(g){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(g),l}function l(g){return g===33?(e.consume(g),c):g===47?(e.consume(g),L):g===63?(e.consume(g),S):_e(g)?(e.consume(g),D):t(g)}function c(g){return g===45?(e.consume(g),u):g===91?(e.consume(g),a=0,f):_e(g)?(e.consume(g),T):t(g)}function u(g){return g===45?(e.consume(g),p):t(g)}function d(g){return g===null?t(g):g===45?(e.consume(g),m):A(g)?(o=d,X(g)):(e.consume(g),d)}function m(g){return g===45?(e.consume(g),p):d(g)}function p(g){return g===62?j(g):g===45?m(g):d(g)}function f(g){let Se="CDATA[";return g===Se.charCodeAt(a++)?(e.consume(g),a===Se.length?_:f):t(g)}function _(g){return g===null?t(g):g===93?(e.consume(g),E):A(g)?(o=_,X(g)):(e.consume(g),_)}function E(g){return g===93?(e.consume(g),y):_(g)}function y(g){return g===62?j(g):g===93?(e.consume(g),y):_(g)}function T(g){return g===null||g===62?j(g):A(g)?(o=T,X(g)):(e.consume(g),T)}function S(g){return g===null?t(g):g===63?(e.consume(g),N):A(g)?(o=S,X(g)):(e.consume(g),S)}function N(g){return g===62?j(g):S(g)}function L(g){return _e(g)?(e.consume(g),b):t(g)}function b(g){return g===45||ae(g)?(e.consume(g),b):I(g)}function I(g){return A(g)?(o=I,X(g)):F(g)?(e.consume(g),I):j(g)}function D(g){return g===45||ae(g)?(e.consume(g),D):g===47||g===62||ne(g)?P(g):t(g)}function P(g){return g===47?(e.consume(g),j):g===58||g===95||_e(g)?(e.consume(g),M):A(g)?(o=P,X(g)):F(g)?(e.consume(g),P):j(g)}function M(g){return g===45||g===46||g===58||g===95||ae(g)?(e.consume(g),M):H(g)}function H(g){return g===61?(e.consume(g),R):A(g)?(o=H,X(g)):F(g)?(e.consume(g),H):P(g)}function R(g){return g===null||g===60||g===61||g===62||g===96?t(g):g===34||g===39?(e.consume(g),r=g,w):A(g)?(o=R,X(g)):F(g)?(e.consume(g),R):(e.consume(g),x)}function w(g){return g===r?(e.consume(g),r=void 0,O):g===null?t(g):A(g)?(o=w,X(g)):(e.consume(g),w)}function x(g){return g===null||g===34||g===39||g===60||g===61||g===96?t(g):g===47||g===62||ne(g)?P(g):(e.consume(g),x)}function O(g){return g===47||g===62||ne(g)?P(g):t(g)}function j(g){return g===62?(e.consume(g),e.exit("htmlTextData"),e.exit("htmlText"),n):t(g)}function X(g){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),re}function re(g){return F(g)?z(e,ie,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(g):ie(g)}function ie(g){return e.enter("htmlTextData"),o(g)}}var ot={name:"labelEnd",tokenize:Qp,resolveTo:$p,resolveAll:Zp},Xp={tokenize:em},Yp={tokenize:tm},Jp={tokenize:nm};function Zp(e){let n=-1;for(;++n<e.length;){let t=e[n][1];(t.type==="labelImage"||t.type==="labelLink"||t.type==="labelEnd")&&(e.splice(n+1,t.type==="labelImage"?4:2),t.type="data",n++)}return e}function $p(e,n){let t=e.length,i=0,r,a,o,s;for(;t--;)if(r=e[t][1],a){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;e[t][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(o){if(e[t][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(a=t,r.type!=="labelLink")){i=2;break}}else r.type==="labelEnd"&&(o=t);let l={type:e[a][1].type==="labelLink"?"link":"image",start:Object.assign({},e[a][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"label",start:Object.assign({},e[a][1].start),end:Object.assign({},e[o][1].end)},u={type:"labelText",start:Object.assign({},e[a+i+2][1].end),end:Object.assign({},e[o-2][1].start)};return s=[["enter",l,n],["enter",c,n]],s=me(s,e.slice(a+1,a+i+3)),s=me(s,[["enter",u,n]]),s=me(s,wt(n.parser.constructs.insideSpan.null,e.slice(a+i+4,o-3),n)),s=me(s,[["exit",u,n],e[o-2],e[o-1],["exit",c,n]]),s=me(s,e.slice(o+1)),s=me(s,[["exit",l,n]]),de(e,a,e.length,s),e}function Qp(e,n,t){let i=this,r=i.events.length,a,o;for(;r--;)if((i.events[r][1].type==="labelImage"||i.events[r][1].type==="labelLink")&&!i.events[r][1]._balanced){a=i.events[r][1];break}return s;function s(m){return a?a._inactive?d(m):(o=i.parser.defined.includes(Ue(i.sliceSerialize({start:a.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):t(m)}function l(m){return m===40?e.attempt(Xp,u,o?u:d)(m):m===91?e.attempt(Yp,u,o?c:d)(m):o?u(m):d(m)}function c(m){return e.attempt(Jp,u,d)(m)}function u(m){return n(m)}function d(m){return a._balanced=!0,t(m)}}function em(e,n,t){return i;function i(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),r}function r(d){return ne(d)?at(e,a)(d):a(d)}function a(d){return d===41?u(d):ti(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return ne(d)?at(e,l)(d):u(d)}function s(d){return t(d)}function l(d){return d===34||d===39||d===40?ii(e,c,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return ne(d)?at(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),n):t(d)}}function tm(e,n,t){let i=this;return r;function r(s){return ni.call(i,e,a,o,"reference","referenceMarker","referenceString")(s)}function a(s){return i.parser.defined.includes(Ue(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?n(s):t(s)}function o(s){return t(s)}}function nm(e,n,t){return i;function i(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),r}function r(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),n):t(a)}}var Ur={name:"labelStartImage",tokenize:im,resolveAll:ot.resolveAll};function im(e,n,t){let i=this;return r;function r(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),a}function a(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),o):t(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(s):n(s)}}var Hr={name:"labelStartLink",tokenize:rm,resolveAll:ot.resolveAll};function rm(e,n,t){let i=this;return r;function r(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),a}function a(o){return o===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(o):n(o)}}var nn={name:"lineEnding",tokenize:am};function am(e,n){return t;function t(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),z(e,n,"linePrefix")}}var st={name:"thematicBreak",tokenize:om};function om(e,n,t){let i=0,r;return a;function a(c){return e.enter("thematicBreak"),o(c)}function o(c){return r=c,s(c)}function s(c){return c===r?(e.enter("thematicBreakSequence"),l(c)):i>=3&&(c===null||A(c))?(e.exit("thematicBreak"),n(c)):t(c)}function l(c){return c===r?(e.consume(c),i++,l):(e.exit("thematicBreakSequence"),F(c)?z(e,s,"whitespace")(c):s(c))}}var pe={name:"list",tokenize:cm,continuation:{tokenize:um},exit:pm},sm={tokenize:mm,partial:!0},lm={tokenize:dm,partial:!0};function cm(e,n,t){let i=this,r=i.events[i.events.length-1],a=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,o=0;return s;function s(p){let f=i.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(f==="listUnordered"?!i.containerState.marker||p===i.containerState.marker:$t(p)){if(i.containerState.type||(i.containerState.type=f,e.enter(f,{_container:!0})),f==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(st,t,c)(p):c(p);if(!i.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return t(p)}function l(p){return $t(p)&&++o<10?(e.consume(p),l):(!i.interrupt||o<2)&&(i.containerState.marker?p===i.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):t(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||p,e.check(Je,i.interrupt?t:u,e.attempt(sm,m,d))}function u(p){return i.containerState.initialBlankLine=!0,a++,m(p)}function d(p){return F(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):t(p)}function m(p){return i.containerState.size=a+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(p)}}function um(e,n,t){let i=this;return i.containerState._closeFlow=void 0,e.check(Je,r,a);function r(s){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,z(e,n,"listItemIndent",i.containerState.size+1)(s)}function a(s){return i.containerState.furtherBlankLines||!F(s)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,o(s)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(lm,n,o)(s))}function o(s){return i.containerState._closeFlow=!0,i.interrupt=void 0,z(e,e.attempt(pe,n,t),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function dm(e,n,t){let i=this;return z(e,r,"listItemIndent",i.containerState.size+1);function r(a){let o=i.events[i.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===i.containerState.size?n(a):t(a)}}function pm(e){e.exit(this.containerState.type)}function mm(e,n,t){let i=this;return z(e,r,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(a){let o=i.events[i.events.length-1];return!F(a)&&o&&o[1].type==="listItemPrefixWhitespace"?n(a):t(a)}}var ri={name:"setextUnderline",tokenize:hm,resolveTo:gm};function gm(e,n){let t=e.length,i,r,a;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){i=t;break}e[t][1].type==="paragraph"&&(r=t)}else e[t][1].type==="content"&&e.splice(t,1),!a&&e[t][1].type==="definition"&&(a=t);let o={type:"setextHeading",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[r][1].type="setextHeadingText",a?(e.splice(r,0,["enter",o,n]),e.splice(a+1,0,["exit",e[i][1],n]),e[i][1].end=Object.assign({},e[a][1].end)):e[i][1]=o,e.push(["exit",o,n]),e}function hm(e,n,t){let i=this,r;return a;function a(c){let u=i.events.length,d;for(;u--;)if(i.events[u][1].type!=="lineEnding"&&i.events[u][1].type!=="linePrefix"&&i.events[u][1].type!=="content"){d=i.events[u][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||d)?(e.enter("setextHeadingLine"),r=c,o(c)):t(c)}function o(c){return e.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===r?(e.consume(c),s):(e.exit("setextHeadingLineSequence"),F(c)?z(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||A(c)?(e.exit("setextHeadingLine"),n(c)):t(c)}}var Es={tokenize:fm};function fm(e){let n=this,t=e.attempt(Je,i,e.attempt(this.parser.constructs.flowInitial,r,z(e,e.attempt(this.parser.constructs.flow,r,e.attempt(Lr,r)),"linePrefix")));return t;function i(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n.currentConstruct=void 0,t}}var Cs={resolveAll:As()},ks=Ts("string"),ws=Ts("text");function Ts(e){return{tokenize:n,resolveAll:As(e==="text"?ym:void 0)};function n(t){let i=this,r=this.parser.constructs[e],a=t.attempt(r,o,s);return o;function o(u){return c(u)?a(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"),a(u)):(t.consume(u),l)}function c(u){if(u===null)return!0;let d=r[u],m=-1;if(d)for(;++m<d.length;){let p=d[m];if(!p.previous||p.previous.call(i,i.previous))return!0}return!1}}}function As(e){return n;function n(t,i){let r=-1,a;for(;++r<=t.length;)a===void 0?t[r]&&t[r][1].type==="data"&&(a=r,r++):(!t[r]||t[r][1].type!=="data")&&(r!==a+2&&(t[a][1].end=t[r-1][1].end,t.splice(a+2,r-a-2),r=a+2),a=void 0);return e?e(t,i):t}}function ym(e,n){let t=0;for(;++t<=e.length;)if((t===e.length||e[t][1].type==="lineEnding")&&e[t-1][1].type==="data"){let i=e[t-1][1],r=n.sliceStream(i),a=r.length,o=-1,s=0,l;for(;a--;){let c=r[a];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){a++;break}}if(s){let c={type:t===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{line:i.end.line,column:i.end.column-s,offset:i.end.offset-s,_index:i.start._index+a,_bufferIndex:a?o:i.start._bufferIndex+o},end:Object.assign({},i.end)};i.end=Object.assign({},c.start),i.start.offset===i.end.offset?Object.assign(i,c):(e.splice(t,0,["enter",c,n],["exit",c,n]),t+=2)}t++}return e}function xs(e,n,t){let i=Object.assign(t?Object.assign({},t):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),r={},a=[],o=[],s=[],l=!0,c={consume:N,enter:L,exit:b,attempt:P(I),check:P(D),interrupt:P(D,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:_,sliceSerialize:f,now:E,defineSkip:y,write:p},d=n.tokenize.call(u,c),m;return n.resolveAll&&a.push(n),u;function p(w){return o=me(o,w),T(),o[o.length-1]!==null?[]:(M(n,0),u.events=wt(a,u.events,u),u.events)}function f(w,x){return vm(_(w),x)}function _(w){return bm(o,w)}function E(){let{line:w,column:x,offset:O,_index:j,_bufferIndex:X}=i;return{line:w,column:x,offset:O,_index:j,_bufferIndex:X}}function y(w){r[w.line]=w.column,R()}function T(){let w;for(;i._index<o.length;){let x=o[i._index];if(typeof x=="string")for(w=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===w&&i._bufferIndex<x.length;)S(x.charCodeAt(i._bufferIndex));else S(x)}}function S(w){l=void 0,m=w,d=d(w)}function N(w){A(w)?(i.line++,i.column=1,i.offset+=w===-3?2:1,R()):w!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===o[i._index].length&&(i._bufferIndex=-1,i._index++)),u.previous=w,l=!0}function L(w,x){let O=x||{};return O.type=w,O.start=E(),u.events.push(["enter",O,u]),s.push(O),O}function b(w){let x=s.pop();return x.end=E(),u.events.push(["exit",x,u]),x}function I(w,x){M(w,x.from)}function D(w,x){x.restore()}function P(w,x){return O;function O(j,X,re){let ie,g,Se,Me;return Array.isArray(j)?fe(j):"tokenize"in j?fe([j]):h(j);function h(se){return Nt;function Nt(Re){let ut=Re!==null&&se[Re],dt=Re!==null&&se.null,Di=[...Array.isArray(ut)?ut:ut?[ut]:[],...Array.isArray(dt)?dt:dt?[dt]:[]];return fe(Di)(Re)}}function fe(se){return ie=se,g=0,se.length===0?re:Qe(se[g])}function Qe(se){return Nt;function Nt(Re){return Me=H(),Se=se,se.partial||(u.currentConstruct=se),se.name&&u.parser.constructs.disable.null.includes(se.name)?pn(Re):se.tokenize.call(x?Object.assign(Object.create(u),x):u,c,Pi,pn)(Re)}}function Pi(se){return l=!0,w(Se,Me),X}function pn(se){return l=!0,Me.restore(),++g<ie.length?Qe(ie[g]):re}}}function M(w,x){w.resolveAll&&!a.includes(w)&&a.push(w),w.resolve&&de(u.events,x,u.events.length-x,w.resolve(u.events.slice(x),u)),w.resolveTo&&(u.events=w.resolveTo(u.events,u))}function H(){let w=E(),x=u.previous,O=u.currentConstruct,j=u.events.length,X=Array.from(s);return{restore:re,from:j};function re(){i=w,u.previous=x,u.currentConstruct=O,u.events.length=j,s=X,R()}}function R(){i.line in r&&i.column<2&&(i.column=r[i.line],i.offset+=r[i.line]-1)}}function bm(e,n){let t=n.start._index,i=n.start._bufferIndex,r=n.end._index,a=n.end._bufferIndex,o;if(t===r)o=[e[t].slice(i,a)];else{if(o=e.slice(t,r),i>-1){let s=o[0];typeof s=="string"?o[0]=s.slice(i):o.shift()}a>0&&o.push(e[r].slice(0,a))}return o}function vm(e,n){let t=-1,i=[],r;for(;++t<e.length;){let a=e[t],o;if(typeof a=="string")o=a;else switch(a){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 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&&lt(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=`
3442
3446
  `;break}case-3:{o=`\r
3443
- `;break}case-2:{o=n?" ":" ";break}case-1:{if(!n&&r)continue;o=" ";break}default:o=String.fromCharCode(a)}r=a===-2,i.push(o)}return i.join("")}var Vr={};va(Vr,{attentionMarkers:()=>Am,contentInitial:()=>Sm,disable:()=>xm,document:()=>_m,flow:()=>Cm,flowInitial:()=>Em,insideSpan:()=>Tm,string:()=>km,text:()=>wm});var _m={42:pe,43:pe,45:pe,48:pe,49:pe,50:pe,51:pe,52:pe,53:pe,54:pe,55:pe,56:pe,57:pe,62:Yn},Sm={91:Mr},Em={[-2]:en,[-1]:en,32:en},Cm={35:Br,42:st,45:[ri,st],60:Gr,61:ri,95:st,96:$n,126:$n},km={38:Zn,92:Jn},wm={[-5]:nn,[-4]:nn,[-3]:nn,33:Ur,38:Zn,42:Qt,60:[Dr,zr],91:Hr,92:[Or,Jn],93:ot,95:Qt,96:Nr},Tm={null:[Qt,Cs]},Am={null:[42,95]},xm={null:[]};function Wr(e){let t=us([Vr,...(e||{}).extensions||[]]),i={defined:[],lazy:{},constructs:t,content:r(fs),document:r(bs),flow:r(Es),string:r(ks),text:r(ws)};return i;function r(a){return o;function o(s){return xs(i,a,s)}}}function jr(e){for(;!ei(e););return e}var Is=/[\0\t\n\r]/g;function qr(){let e=1,n="",t=!0,i;return r;function r(a,o,s){let l=[],c,u,d,m,p;for(a=n+(typeof a=="string"?a.toString():new TextDecoder(o||void 0).decode(a)),d=0,n="",t&&(a.charCodeAt(0)===65279&&d++,t=void 0);d<a.length;){if(Is.lastIndex=d,c=Is.exec(a),m=c&&c.index!==void 0?c.index:a.length,p=a.charCodeAt(m),!c){n=a.slice(d);break}if(p===10&&d===m&&i)l.push(-3),i=void 0;else switch(i&&(l.push(-5),i=void 0),d<m&&(l.push(a.slice(d,m)),e+=m-d),p){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:i=!0,e=1}d=m+1}return s&&(i&&l.push(-5),n&&l.push(n),l.push(null)),l}}var Im=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Rs(e){return e.replace(Im,Rm)}function Rm(e,n,t){if(n)return n;if(t.charCodeAt(0)===35){let r=t.charCodeAt(1),a=r===120||r===88;return Xn(t.slice(a?2:1),a?16:10)}return kt(t)||e}function Ze(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ps(e.position):"start"in e||"end"in e?Ps(e):"line"in e||"column"in e?Kr(e):""}function Kr(e){return Ds(e&&e.line)+":"+Ds(e&&e.column)}function Ps(e){return Kr(e&&e.start)+"-"+Kr(e&&e.end)}function Ds(e){return e&&typeof e=="number"?e:1}var Ls={}.hasOwnProperty;function Xr(e,n,t){return typeof n!="string"&&(t=n,n=void 0),Pm(t)(jr(Wr(t).document().write(qr()(e,n,!0))))}function Pm(e){let n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(ya),autolinkProtocol:P,autolinkEmail:P,atxHeading:a(ga),blockQuote:a(Nt),characterEscape:P,characterReference:P,codeFenced:a(Re),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(Re,o),codeText:a(ut,o),codeTextData:P,data:P,codeFlowValue:P,definition:a(dt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(Di),hardBreakEscape:a(ha),hardBreakTrailing:a(ha),htmlFlow:a(fa,o),htmlFlowData:P,htmlText:a(fa,o),htmlTextData:P,image:a(Kl),label:o,link:a(ya),listItem:a(Xl),listItemValue:m,listOrdered:a(ba,d),listUnordered:a(ba),paragraph:a(Yl),reference:h,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ga),strong:a(Jl),thematicBreak:a($l)},exit:{atxHeading:l(),atxHeadingSequence:L,autolink:l(),autolinkEmail:se,autolinkProtocol:pn,blockQuote:l(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:Qe,characterReferenceMarkerNumeric:Qe,characterReferenceValue:Pi,codeFenced:l(E),codeFencedFence:_,codeFencedFenceInfo:p,codeFencedFenceMeta:f,codeFlowValue:M,codeIndented:l(y),codeText:l(O),codeTextData:M,data:M,definition:l(),definitionDestinationString:N,definitionLabelString:T,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(R),hardBreakTrailing:l(R),htmlFlow:l(w),htmlFlowData:M,htmlText:l(x),htmlTextData:M,image:l(X),label:ie,labelText:re,lineEnding:H,link:l(j),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:fe,resourceDestinationString:g,resourceTitleString:Se,resource:Me,setextHeading:l(D),setextHeadingLineSequence:I,setextHeadingText:b,strong:l(),thematicBreak:l()}};Ms(n,(e||{}).mdastExtensions||[]);let t={};return i;function i(v){let k={type:"root",children:[]},G={stack:[k],tokenStack:[],config:n,enter:s,exit:c,buffer:o,resume:u,data:t},W=[],Y=-1;for(;++Y<v.length;)if(v[Y][1].type==="listOrdered"||v[Y][1].type==="listUnordered")if(v[Y][0]==="enter")W.push(Y);else{let we=W.pop();Y=r(v,we,Y)}for(Y=-1;++Y<v.length;){let we=n[v[Y][0]];Ls.call(we,v[Y][1].type)&&we[v[Y][1].type].call(Object.assign({sliceSerialize:v[Y][2].sliceSerialize},G),v[Y][1])}if(G.tokenStack.length>0){let we=G.tokenStack[G.tokenStack.length-1];(we[1]||Ns).call(G,void 0,we[0])}for(k.position={start:$e(v.length>0?v[0][1].start:{line:1,column:1,offset:0}),end:$e(v.length>0?v[v.length-2][1].end:{line:1,column:1,offset:0})},Y=-1;++Y<n.transforms.length;)k=n.transforms[Y](k)||k;return k}function r(v,k,G){let W=k-1,Y=-1,we=!1,et,Oe,Lt,Mt;for(;++W<=G;){let ye=v[W];switch(ye[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ye[0]==="enter"?Y++:Y--,Mt=void 0;break}case"lineEndingBlank":{ye[0]==="enter"&&(et&&!Mt&&!Y&&!Lt&&(Lt=W),Mt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Mt=void 0}if(!Y&&ye[0]==="enter"&&ye[1].type==="listItemPrefix"||Y===-1&&ye[0]==="exit"&&(ye[1].type==="listUnordered"||ye[1].type==="listOrdered")){if(et){let pt=W;for(Oe=void 0;pt--;){let Be=v[pt];if(Be[1].type==="lineEnding"||Be[1].type==="lineEndingBlank"){if(Be[0]==="exit")continue;Oe&&(v[Oe][1].type="lineEndingBlank",we=!0),Be[1].type="lineEnding",Oe=pt}else if(!(Be[1].type==="linePrefix"||Be[1].type==="blockQuotePrefix"||Be[1].type==="blockQuotePrefixWhitespace"||Be[1].type==="blockQuoteMarker"||Be[1].type==="listItemIndent"))break}Lt&&(!Oe||Lt<Oe)&&(et._spread=!0),et.end=Object.assign({},Oe?v[Oe][1].start:ye[1].end),v.splice(Oe||W,0,["exit",et,ye[2]]),W++,G++}if(ye[1].type==="listItemPrefix"){let pt={type:"listItem",_spread:!1,start:Object.assign({},ye[1].start),end:void 0};et=pt,v.splice(W,0,["enter",pt,ye[2]]),W++,G++,Lt=void 0,Mt=!0}}}return v[k][1]._spread=we,G}function a(v,k){return G;function G(W){s.call(this,v(W),W),k&&k.call(this,W)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(v,k,G){this.stack[this.stack.length-1].children.push(v),this.stack.push(v),this.tokenStack.push([k,G]),v.position={start:$e(k.start),end:void 0}}function l(v){return k;function k(G){v&&v.call(this,G),c.call(this,G)}}function c(v,k){let G=this.stack.pop(),W=this.tokenStack.pop();if(W)W[0].type!==v.type&&(k?k.call(this,v,W[0]):(W[1]||Ns).call(this,v,W[0]));else throw new Error("Cannot close `"+v.type+"` ("+Ze({start:v.start,end:v.end})+"): it\u2019s not open");G.position.end=$e(v.end)}function u(){return Rr(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function m(v){if(this.data.expectingFirstListItemValue){let k=this.stack[this.stack.length-2];k.start=Number.parseInt(this.sliceSerialize(v),10),this.data.expectingFirstListItemValue=void 0}}function p(){let v=this.resume(),k=this.stack[this.stack.length-1];k.lang=v}function f(){let v=this.resume(),k=this.stack[this.stack.length-1];k.meta=v}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){let v=this.resume(),k=this.stack[this.stack.length-1];k.value=v.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){let v=this.resume(),k=this.stack[this.stack.length-1];k.value=v.replace(/(\r?\n|\r)$/g,"")}function T(v){let k=this.resume(),G=this.stack[this.stack.length-1];G.label=k,G.identifier=Ue(this.sliceSerialize(v)).toLowerCase()}function S(){let v=this.resume(),k=this.stack[this.stack.length-1];k.title=v}function N(){let v=this.resume(),k=this.stack[this.stack.length-1];k.url=v}function L(v){let k=this.stack[this.stack.length-1];if(!k.depth){let G=this.sliceSerialize(v).length;k.depth=G}}function b(){this.data.setextHeadingSlurpLineEnding=!0}function I(v){let k=this.stack[this.stack.length-1];k.depth=this.sliceSerialize(v).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function P(v){let G=this.stack[this.stack.length-1].children,W=G[G.length-1];(!W||W.type!=="text")&&(W=Zl(),W.position={start:$e(v.start),end:void 0},G.push(W)),this.stack.push(W)}function M(v){let k=this.stack.pop();k.value+=this.sliceSerialize(v),k.position.end=$e(v.end)}function H(v){let k=this.stack[this.stack.length-1];if(this.data.atHardBreak){let G=k.children[k.children.length-1];G.position.end=$e(v.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(k.type)&&(P.call(this,v),M.call(this,v))}function R(){this.data.atHardBreak=!0}function w(){let v=this.resume(),k=this.stack[this.stack.length-1];k.value=v}function x(){let v=this.resume(),k=this.stack[this.stack.length-1];k.value=v}function O(){let v=this.resume(),k=this.stack[this.stack.length-1];k.value=v}function j(){let v=this.stack[this.stack.length-1];if(this.data.inReference){let k=this.data.referenceType||"shortcut";v.type+="Reference",v.referenceType=k,delete v.url,delete v.title}else delete v.identifier,delete v.label;this.data.referenceType=void 0}function X(){let v=this.stack[this.stack.length-1];if(this.data.inReference){let k=this.data.referenceType||"shortcut";v.type+="Reference",v.referenceType=k,delete v.url,delete v.title}else delete v.identifier,delete v.label;this.data.referenceType=void 0}function re(v){let k=this.sliceSerialize(v),G=this.stack[this.stack.length-2];G.label=Rs(k),G.identifier=Ue(k).toLowerCase()}function ie(){let v=this.stack[this.stack.length-1],k=this.resume(),G=this.stack[this.stack.length-1];if(this.data.inReference=!0,G.type==="link"){let W=v.children;G.children=W}else G.alt=k}function g(){let v=this.resume(),k=this.stack[this.stack.length-1];k.url=v}function Se(){let v=this.resume(),k=this.stack[this.stack.length-1];k.title=v}function Me(){this.data.inReference=void 0}function h(){this.data.referenceType="collapsed"}function fe(v){let k=this.resume(),G=this.stack[this.stack.length-1];G.label=k,G.identifier=Ue(this.sliceSerialize(v)).toLowerCase(),this.data.referenceType="full"}function Qe(v){this.data.characterReferenceType=v.type}function Pi(v){let k=this.sliceSerialize(v),G=this.data.characterReferenceType,W;G?(W=Xn(k,G==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):W=kt(k);let Y=this.stack.pop();Y.value+=W,Y.position.end=$e(v.end)}function pn(v){M.call(this,v);let k=this.stack[this.stack.length-1];k.url=this.sliceSerialize(v)}function se(v){M.call(this,v);let k=this.stack[this.stack.length-1];k.url="mailto:"+this.sliceSerialize(v)}function Nt(){return{type:"blockquote",children:[]}}function Re(){return{type:"code",lang:null,meta:null,value:""}}function ut(){return{type:"inlineCode",value:""}}function dt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Di(){return{type:"emphasis",children:[]}}function ga(){return{type:"heading",depth:0,children:[]}}function ha(){return{type:"break"}}function fa(){return{type:"html",value:""}}function Kl(){return{type:"image",title:null,url:"",alt:null}}function ya(){return{type:"link",title:null,url:"",children:[]}}function ba(v){return{type:"list",ordered:v.type==="listOrdered",start:null,spread:v._spread,children:[]}}function Xl(v){return{type:"listItem",spread:v._spread,checked:null,children:[]}}function Yl(){return{type:"paragraph",children:[]}}function Jl(){return{type:"strong",children:[]}}function Zl(){return{type:"text",value:""}}function $l(){return{type:"thematicBreak"}}}function $e(e){return{line:e.line,column:e.column,offset:e.offset}}function Ms(e,n){let t=-1;for(;++t<n.length;){let i=n[t];Array.isArray(i)?Ms(e,i):Dm(e,i)}}function Dm(e,n){let t;for(t in n)if(Ls.call(n,t))switch(t){case"canContainEols":{let i=n[t];i&&e[t].push(...i);break}case"transforms":{let i=n[t];i&&e[t].push(...i);break}case"enter":case"exit":{let i=n[t];i&&Object.assign(e[t],i);break}}}function Ns(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Ze({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Ze({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Ze({start:n.start,end:n.end})+") is still open")}function ai(e){let n=this;n.parser=t;function t(i){return Xr(i,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function Os(e,n){let t={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,t),e.applyData(n,t)}function Bs(e,n){let t={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,t),[e.applyData(n,t),{type:"text",value:`
3444
- `}]}function Fs(e,n){let t=n.value?n.value+`
3445
- `:"",i={};n.lang&&(i.className=["language-"+n.lang]);let r={type:"element",tagName:"code",properties:i,children:[{type:"text",value:t}]};return n.meta&&(r.data={meta:n.meta}),e.patch(n,r),r=e.applyData(n,r),r={type:"element",tagName:"pre",properties:{},children:[r]},e.patch(n,r),r}function Gs(e,n){let t={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function zs(e,n){let t={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function Us(e,n){let t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(n.identifier).toUpperCase(),r=ke(i.toLowerCase()),a=e.footnoteOrder.indexOf(i),o,s=e.footnoteCounts.get(i);s===void 0?(s=0,e.footnoteOrder.push(i),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(i,s);let l={type:"element",tagName:"a",properties:{href:"#"+t+"fn-"+r,id:t+"fnref-"+r+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(n,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(n,c),e.applyData(n,c)}function Hs(e,n){let t={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function Vs(e,n){if(e.options.allowDangerousHtml){let t={type:"raw",value:n.value};return e.patch(n,t),e.applyData(n,t)}}function oi(e,n){let t=n.referenceType,i="]";if(t==="collapsed"?i+="[]":t==="full"&&(i+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+i}];let r=e.all(n),a=r[0];a&&a.type==="text"?a.value="["+a.value:r.unshift({type:"text",value:"["});let o=r[r.length-1];return o&&o.type==="text"?o.value+=i:r.push({type:"text",value:i}),r}function Ws(e,n){let t=String(n.identifier).toUpperCase(),i=e.definitionById.get(t);if(!i)return oi(e,n);let r={src:ke(i.url||""),alt:n.alt};i.title!==null&&i.title!==void 0&&(r.title=i.title);let a={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,a),e.applyData(n,a)}function js(e,n){let t={src:ke(n.url)};n.alt!==null&&n.alt!==void 0&&(t.alt=n.alt),n.title!==null&&n.title!==void 0&&(t.title=n.title);let i={type:"element",tagName:"img",properties:t,children:[]};return e.patch(n,i),e.applyData(n,i)}function qs(e,n){let t={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,t);let i={type:"element",tagName:"code",properties:{},children:[t]};return e.patch(n,i),e.applyData(n,i)}function Ks(e,n){let t=String(n.identifier).toUpperCase(),i=e.definitionById.get(t);if(!i)return oi(e,n);let r={href:ke(i.url||"")};i.title!==null&&i.title!==void 0&&(r.title=i.title);let a={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function Xs(e,n){let t={href:ke(n.url)};n.title!==null&&n.title!==void 0&&(t.title=n.title);let i={type:"element",tagName:"a",properties:t,children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function Ys(e,n,t){let i=e.all(n),r=t?Nm(t):Js(n),a={},o=[];if(typeof n.checked=="boolean"){let u=i[0],d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},i.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<i.length;){let u=i[s];(r||s!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
3446
- `}),u.type==="element"&&u.tagName==="p"&&!r?o.push(...u.children):o.push(u)}let l=i[i.length-1];l&&(r||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
3447
- `});let c={type:"element",tagName:"li",properties:a,children:o};return e.patch(n,c),e.applyData(n,c)}function Nm(e){let n=!1;if(e.type==="list"){n=e.spread||!1;let t=e.children,i=-1;for(;!n&&++i<t.length;)n=Js(t[i])}return n}function Js(e){let n=e.spread;return n??e.children.length>1}function Zs(e,n){let t={},i=e.all(n),r=-1;for(typeof n.start=="number"&&n.start!==1&&(t.start=n.start);++r<i.length;){let o=i[r];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 a={type:"element",tagName:n.ordered?"ol":"ul",properties:t,children:e.wrap(i,!0)};return e.patch(n,a),e.applyData(n,a)}function $s(e,n){let t={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function Qs(e,n){let t={type:"root",children:e.wrap(e.all(n))};return e.patch(n,t),e.applyData(n,t)}function el(e,n){let t={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}var si=tl("end"),li=tl("start");function tl(e){return n;function n(t){let i=t&&t.position&&t.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function Yr(e){let n=li(e),t=si(e);if(n&&t)return{start:n,end:t}}function nl(e,n){let t=e.all(n),i=t.shift(),r=[];if(i){let o={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(n.children[0],o),r.push(o)}if(t.length>0){let o={type:"element",tagName:"tbody",properties:{},children:e.wrap(t,!0)},s=li(n.children[1]),l=si(n.children[n.children.length-1]);s&&l&&(o.position={start:s,end:l}),r.push(o)}let a={type:"element",tagName:"table",properties:{},children:e.wrap(r,!0)};return e.patch(n,a),e.applyData(n,a)}function il(e,n,t){let i=t?t.children:void 0,a=(i?i.indexOf(n):1)===0?"th":"td",o=t&&t.type==="table"?t.align:void 0,s=o?o.length:n.children.length,l=-1,c=[];for(;++l<s;){let d=n.children[l],m={},p=o?o[l]:void 0;p&&(m.align=p);let f={type:"element",tagName:a,properties:m,children:[]};d&&(f.children=e.all(d),e.patch(d,f),f=e.applyData(d,f)),c.push(f)}let u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(n,u),e.applyData(n,u)}function rl(e,n){let t={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function ol(e){let n=String(e),t=/\r?\n|\r/g,i=t.exec(n),r=0,a=[];for(;i;)a.push(al(n.slice(r,i.index),r>0,!0),i[0]),r=i.index+i[0].length,i=t.exec(n);return a.push(al(n.slice(r),r>0,!1)),a.join("")}function al(e,n,t){let i=0,r=e.length;if(n){let a=e.codePointAt(i);for(;a===9||a===32;)i++,a=e.codePointAt(i)}if(t){let a=e.codePointAt(r-1);for(;a===9||a===32;)r--,a=e.codePointAt(r-1)}return r>i?e.slice(i,r):""}function sl(e,n){let t={type:"text",value:ol(String(n.value))};return e.patch(n,t),e.applyData(n,t)}function ll(e,n){let t={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,t),e.applyData(n,t)}var cl={blockquote:Os,break:Bs,code:Fs,delete:Gs,emphasis:zs,footnoteReference:Us,heading:Hs,html:Vs,imageReference:Ws,image:js,inlineCode:qs,linkReference:Ks,link:Xs,listItem:Ys,list:Zs,paragraph:$s,root:Qs,strong:el,table:nl,tableCell:rl,tableRow:il,text:sl,thematicBreak:ll,toml:ci,yaml:ci,definition:ci,footnoteDefinition:ci};function ci(){}function Lm(e,n){let t=[{type:"text",value:"\u21A9"}];return n>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),t}function Mm(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function ul(e){let n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",t=e.options.footnoteBackContent||Lm,i=e.options.footnoteBackLabel||Mm,r=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<e.footnoteOrder.length;){let c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;let u=e.all(c),d=String(c.identifier).toUpperCase(),m=ke(d.toLowerCase()),p=0,f=[],_=e.footnoteCounts.get(d);for(;_!==void 0&&++p<=_;){f.length>0&&f.push({type:"text",value:" "});let T=typeof t=="string"?t:t(l,p);typeof T=="string"&&(T={type:"text",value:T}),f.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(l,p),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}let E=u[u.length-1];if(E&&E.type==="element"&&E.tagName==="p"){let T=E.children[E.children.length-1];T&&T.type==="text"?T.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...f)}else u.push(...f);let y={type:"element",tagName:"li",properties:{id:n+"fn-"+m},children:e.wrap(u,!0)};e.patch(c,y),s.push(y)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Pe(o),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:`
3448
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:`
3449
- `}]}}var Jr={}.hasOwnProperty,Om={};function pl(e,n){let t=n||Om,i=new Map,r=new Map,a=new Map,o={...cl,...t.handlers},s={all:c,applyData:Fm,definitionById:i,footnoteById:r,footnoteCounts:a,footnoteOrder:[],handlers:o,one:l,options:t,patch:Bm,wrap:zm};return qt(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){let d=u.type==="definition"?i:r,m=String(u.identifier).toUpperCase();d.has(m)||d.set(m,u)}}),s;function l(u,d){let m=u.type,p=s.handlers[m];if(Jr.call(s.handlers,m)&&p)return p(s,u,d);if(s.options.passThrough&&s.options.passThrough.includes(m)){if("children"in u){let{children:_,...E}=u,y=Pe(E);return y.children=s.all(u),y}return Pe(u)}return(s.options.unknownHandler||Gm)(s,u,d)}function c(u){let d=[];if("children"in u){let m=u.children,p=-1;for(;++p<m.length;){let f=s.one(m[p],u);if(f){if(p&&m[p-1].type==="break"&&(!Array.isArray(f)&&f.type==="text"&&(f.value=dl(f.value)),!Array.isArray(f)&&f.type==="element")){let _=f.children[0];_&&_.type==="text"&&(_.value=dl(_.value))}Array.isArray(f)?d.push(...f):d.push(f)}}}return d}}function Bm(e,n){e.position&&(n.position=Yr(e))}function Fm(e,n){let t=n;if(e&&e.data){let i=e.data.hName,r=e.data.hChildren,a=e.data.hProperties;if(typeof i=="string")if(t.type==="element")t.tagName=i;else{let o="children"in t?t.children:[t];t={type:"element",tagName:i,properties:{},children:o}}t.type==="element"&&a&&Object.assign(t.properties,Pe(a)),"children"in t&&t.children&&r!==null&&r!==void 0&&(t.children=r)}return t}function Gm(e,n){let t=n.data||{},i="value"in n&&!(Jr.call(t,"hProperties")||Jr.call(t,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function zm(e,n){let t=[],i=-1;for(n&&t.push({type:"text",value:`
3450
- `});++i<e.length;)i&&t.push({type:"text",value:`
3451
- `}),t.push(e[i]);return n&&e.length>0&&t.push({type:"text",value:`
3452
- `}),t}function dl(e){let n=0,t=e.charCodeAt(n);for(;t===9||t===32;)n++,t=e.charCodeAt(n);return e.slice(n)}function ui(e,n){let t=pl(e,n),i=t.one(e,void 0),r=ul(t),a=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return r&&("children"in a,a.children.push({type:"text",value:`
3453
- `},r)),a}function di(e,n){return e&&"run"in e?async function(t,i){let r=ui(t,{file:i,...n});await e.run(r,i)}:function(t,i){return ui(t,{file:i,...n||e})}}function Zr(e){if(e)throw e}var gi=_a(Sl(),1);function rn(e){if(typeof e!="object"||e===null)return!1;let n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function $r(){let e=[],n={run:t,use:i};return n;function t(...r){let a=-1,o=r.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);s(null,...r);function s(l,...c){let u=e[++a],d=-1;if(l){o(l);return}for(;++d<r.length;)(c[d]===null||c[d]===void 0)&&(c[d]=r[d]);r=c,u?El(u,s)(...c):o(null,...c)}}function i(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),n}}function El(e,n){let t;return i;function i(...o){let s=e.length>o.length,l;s&&o.push(r);try{l=e.apply(this,o)}catch(c){let u=c;if(s&&t)throw u;return r(u)}s||(l&&l.then&&typeof l.then=="function"?l.then(a,r):l instanceof Error?r(l):a(l))}function r(o,...s){t||(t=!0,n(o,...s))}function a(o){r(null,o)}}var oe=class extends Error{constructor(n,t,i){super(),typeof t=="string"&&(i=t,t=void 0);let r="",a={},o=!1;if(t&&("line"in t&&"column"in t?a={place:t}:"start"in t&&"end"in t?a={place:t}:"type"in t?a={ancestors:[t],place:t.position}:a={...t}),typeof n=="string"?r=n:!a.cause&&n&&(o=!0,r=n.message,a.cause=n),!a.ruleId&&!a.source&&typeof i=="string"){let l=i.indexOf(":");l===-1?a.ruleId=i:(a.source=i.slice(0,l),a.ruleId=i.slice(l+1))}if(!a.place&&a.ancestors&&a.ancestors){let l=a.ancestors[a.ancestors.length-1];l&&(a.place=l.position)}let s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=s?s.line:void 0,this.name=Ze(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual,this.expected,this.note,this.url}};oe.prototype.file="";oe.prototype.name="";oe.prototype.reason="";oe.prototype.message="";oe.prototype.stack="";oe.prototype.column=void 0;oe.prototype.line=void 0;oe.prototype.ancestors=void 0;oe.prototype.cause=void 0;oe.prototype.fatal=void 0;oe.prototype.place=void 0;oe.prototype.ruleId=void 0;oe.prototype.source=void 0;var xe={basename:Um,dirname:Hm,extname:Vm,join:Wm,sep:"/"};function Um(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');an(e);let t=0,i=-1,r=e.length,a;if(n===void 0||n.length===0||n.length>e.length){for(;r--;)if(e.codePointAt(r)===47){if(a){t=r+1;break}}else i<0&&(a=!0,i=r+1);return i<0?"":e.slice(t,i)}if(n===e)return"";let o=-1,s=n.length-1;for(;r--;)if(e.codePointAt(r)===47){if(a){t=r+1;break}}else o<0&&(a=!0,o=r+1),s>-1&&(e.codePointAt(r)===n.codePointAt(s--)?s<0&&(i=r):(s=-1,i=o));return t===i?i=o:i<0&&(i=e.length),e.slice(t,i)}function Hm(e){if(an(e),e.length===0)return".";let n=-1,t=e.length,i;for(;--t;)if(e.codePointAt(t)===47){if(i){n=t;break}}else i||(i=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function Vm(e){an(e);let n=e.length,t=-1,i=0,r=-1,a=0,o;for(;n--;){let s=e.codePointAt(n);if(s===47){if(o){i=n+1;break}continue}t<0&&(o=!0,t=n+1),s===46?r<0?r=n:a!==1&&(a=1):r>-1&&(a=-1)}return r<0||t<0||a===0||a===1&&r===t-1&&r===i+1?"":e.slice(r,t)}function Wm(...e){let n=-1,t;for(;++n<e.length;)an(e[n]),e[n]&&(t=t===void 0?e[n]:t+"/"+e[n]);return t===void 0?".":jm(t)}function jm(e){an(e);let n=e.codePointAt(0)===47,t=qm(e,!n);return t.length===0&&!n&&(t="."),t.length>0&&e.codePointAt(e.length-1)===47&&(t+="/"),n?"/"+t:t}function qm(e,n){let t="",i=0,r=-1,a=0,o=-1,s,l;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else{if(s===47)break;s=47}if(s===47){if(!(r===o-1||a===1))if(r!==o-1&&a===2){if(t.length<2||i!==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="",i=0):(t=t.slice(0,l),i=t.length-1-t.lastIndexOf("/")),r=o,a=0;continue}}else if(t.length>0){t="",i=0,r=o,a=0;continue}}n&&(t=t.length>0?t+"/..":"..",i=2)}else t.length>0?t+="/"+e.slice(r+1,o):t=e.slice(r+1,o),i=o-r-1;r=o,a=0}else s===46&&a>-1?a++:a=-1}return t}function an(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var Cl={cwd:Km};function Km(){return"/"}function Tt(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function kl(e){if(typeof e=="string")e=new URL(e);else if(!Tt(e)){let n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){let n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return Xm(e)}function Xm(e){if(e.hostname!==""){let i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}let n=e.pathname,t=-1;for(;++t<n.length;)if(n.codePointAt(t)===37&&n.codePointAt(t+1)===50){let i=n.codePointAt(t+2);if(i===70||i===102){let r=new TypeError("File URL path must not include encoded / characters");throw r.code="ERR_INVALID_FILE_URL_PATH",r}}return decodeURIComponent(n)}var Qr=["history","path","basename","stem","extname","dirname"],on=class{constructor(n){let t;n?Tt(n)?t={path:n}:typeof n=="string"||Ym(n)?t={value:n}:t=n:t={},this.cwd=Cl.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Qr.length;){let a=Qr[i];a in t&&t[a]!==void 0&&t[a]!==null&&(this[a]=a==="history"?[...t[a]]:t[a])}let r;for(r in t)Qr.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path=="string"?xe.basename(this.path):void 0}set basename(n){ta(n,"basename"),ea(n,"basename"),this.path=xe.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?xe.dirname(this.path):void 0}set dirname(n){wl(this.basename,"dirname"),this.path=xe.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?xe.extname(this.path):void 0}set extname(n){if(ea(n,"extname"),wl(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=xe.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Tt(n)&&(n=kl(n)),ta(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?xe.basename(this.path,this.extname):void 0}set stem(n){ta(n,"stem"),ea(n,"stem"),this.path=xe.join(this.dirname||"",n+(this.extname||""))}fail(n,t,i){let r=this.message(n,t,i);throw r.fatal=!0,r}info(n,t,i){let r=this.message(n,t,i);return r.fatal=void 0,r}message(n,t,i){let r=new oe(n,t,i);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}};function ea(e,n){if(e&&e.includes(xe.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+xe.sep+"`")}function ta(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function wl(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function Ym(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var Tl=function(e){let i=this.constructor.prototype,r=i[e],a=function(){return r.apply(a,arguments)};Object.setPrototypeOf(a,i);let o=Object.getOwnPropertyNames(r);for(let s of o){let l=Object.getOwnPropertyDescriptor(r,s);l&&Object.defineProperty(a,s,l)}return a};var Jm={}.hasOwnProperty,aa=class e extends Tl{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=$r()}copy(){let n=new e,t=-1;for(;++t<this.attachers.length;){let i=this.attachers[t];n.use(...i)}return n.data((0,gi.default)(!0,{},this.namespace)),n}data(n,t){return typeof n=="string"?arguments.length===2?(ra("data",this.frozen),this.namespace[n]=t,this):Jm.call(this.namespace,n)&&this.namespace[n]||void 0:n?(ra("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;let n=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);let r=t.call(n,...i);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();let t=mi(n),i=this.parser||this.Parser;return na("parse",i),i(String(t),t)}process(n,t){let i=this;return this.freeze(),na("process",this.parser||this.Parser),ia("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(a,o){let s=mi(n),l=i.parse(s);i.run(l,s,function(u,d,m){if(u||!d||!m)return c(u);let p=d,f=i.stringify(p,m);$m(f)?m.value=f:m.result=f,c(u,m)});function c(u,d){u||!d?o(u):a?a(d):t(void 0,d)}}}processSync(n){let t=!1,i;return this.freeze(),na("processSync",this.parser||this.Parser),ia("processSync",this.compiler||this.Compiler),this.process(n,r),xl("processSync","process",t),i;function r(a,o){t=!0,Zr(a),i=o}}run(n,t,i){Al(n),this.freeze();let r=this.transformers;return!i&&typeof t=="function"&&(i=t,t=void 0),i?a(void 0,i):new Promise(a);function a(o,s){let l=mi(t);r.run(n,l,c);function c(u,d,m){let p=d||n;u?s(u):o?o(p):i(void 0,p,m)}}}runSync(n,t){let i=!1,r;return this.run(n,t,a),xl("runSync","run",i),r;function a(o,s){Zr(o),r=s,i=!0}}stringify(n,t){this.freeze();let i=mi(t),r=this.compiler||this.Compiler;return ia("stringify",r),Al(n),r(n,i)}use(n,...t){let i=this.attachers,r=this.namespace;if(ra("use",this.frozen),n!=null)if(typeof n=="function")l(n,t);else if(typeof n=="object")Array.isArray(n)?s(n):o(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function a(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[u,...d]=c;l(u,d)}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&&(r.settings=(0,gi.default)(!0,r.settings,c.settings))}function s(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){let d=c[u];a(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,m=-1;for(;++d<i.length;)if(i[d][0]===c){m=d;break}if(m===-1)i.push([c,...u]);else if(u.length>0){let[p,...f]=u,_=i[m][1];rn(_)&&rn(p)&&(p=(0,gi.default)(!0,_,p)),i[m]=[c,p,...f]}}}},oa=new aa().freeze();function na(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ia(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ra(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Al(e){if(!rn(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function xl(e,n,t){if(!t)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function mi(e){return Zm(e)?e:new on(e)}function Zm(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function $m(e){return typeof e=="string"||Qm(e)}function Qm(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var sn=class extends be{constructor(){super(...arguments);this.html=()=>`
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 sg(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 lg(r,e){let t={type:"element",tagName:"del",properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function cg(r,e){let t={type:"element",tagName:"em",properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function ug(r,e){let t=typeof r.options.clobberPrefix=="string"?r.options.clobberPrefix:"user-content-",a=String(e.identifier).toUpperCase(),n=Ut(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 dg(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 pg(r,e){if(r.options.allowDangerousHtml){let t={type:"raw",value:e.value};return r.patch(e,t),r.applyData(e,t)}}function Ko(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 mg(r,e){let t=String(e.identifier).toUpperCase(),a=r.definitionById.get(t);if(!a)return Ko(r,e);let n={src:Ut(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 hg(r,e){let t={src:Ut(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 gg(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 fg(r,e){let t=String(e.identifier).toUpperCase(),a=r.definitionById.get(t);if(!a)return Ko(r,e);let n={href:Ut(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 yg(r,e){let t={href:Ut(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 bg(r,e,t){let a=r.all(e),n=t?tk(t):vg(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
+ `}),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 tk(r){let e=!1;if(r.type==="list"){e=r.spread||!1;let t=r.children,a=-1;for(;!e&&++a<t.length;)e=vg(t[a])}return e}function vg(r){let e=r.spread;return e??r.children.length>1}function _g(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 Sg(r,e){let t={type:"element",tagName:"p",properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function Eg(r,e){let t={type:"root",children:r.wrap(r.all(e))};return r.patch(e,t),r.applyData(e,t)}function wg(r,e){let t={type:"element",tagName:"strong",properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}var $o=Cg("end"),Xo=Cg("start");function Cg(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 Mc(r){let e=Xo(r),t=$o(r);if(e&&t)return{start:e,end:t}}function kg(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=Xo(e.children[1]),l=$o(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 Tg(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 xg(r,e){let t={type:"element",tagName:"td",properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function Ig(r){let e=String(r),t=/\r?\n|\r/g,a=t.exec(e),n=0,i=[];for(;a;)i.push(Ag(e.slice(n,a.index),n>0,!0),a[0]),n=a.index+a[0].length,a=t.exec(e);return i.push(Ag(e.slice(n),n>0,!1)),i.join("")}function Ag(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 Rg(r,e){let t={type:"text",value:Ig(String(e.value))};return r.patch(e,t),r.applyData(e,t)}function Pg(r,e){let t={type:"element",tagName:"hr",properties:{},children:[]};return r.patch(e,t),r.applyData(e,t)}var Dg={blockquote:ig,break:og,code:sg,delete:lg,emphasis:cg,footnoteReference:ug,heading:dg,html:pg,imageReference:mg,image:hg,inlineCode:gg,linkReference:fg,link:yg,listItem:bg,list:_g,paragraph:Sg,root:Eg,strong:wg,table:kg,tableCell:xg,tableRow:Tg,text:Rg,thematicBreak:Pg,toml:Yo,yaml:Yo,definition:Yo,footnoteDefinition:Yo};function Yo(){}function rk(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 nk(r,e){return"Back to reference "+(r+1)+(e>1?"-"+e:"")}function Ng(r){let e=typeof r.options.clobberPrefix=="string"?r.options.clobberPrefix:"user-content-",t=r.options.footnoteBackContent||rk,a=r.options.footnoteBackLabel||nk,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=Ut(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:{...ar(o),id:"footnote-label"},children:[{type:"text",value:n}]},{type:"text",value:`
3452
+ `},{type:"element",tagName:"ol",properties:{},children:r.wrap(s,!0)},{type:"text",value:`
3453
+ `}]}}var Fc={}.hasOwnProperty,ak={};function Lg(r,e){let t=e||ak,a=new Map,n=new Map,i=new Map,o={...Dg,...t.handlers},s={all:c,applyData:ok,definitionById:a,footnoteById:n,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:t,patch:ik,wrap:lk};return Ga(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(Fc.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=ar(y);return v.children=s.all(u),v}return ar(u)}return(s.options.unknownHandler||sk)(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=Og(g.value)),!Array.isArray(g)&&g.type==="element")){let f=g.children[0];f&&f.type==="text"&&(f.value=Og(f.value))}Array.isArray(g)?p.push(...g):p.push(g)}}}return p}}function ik(r,e){r.position&&(e.position=Mc(r))}function ok(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,ar(i)),"children"in t&&t.children&&n!==null&&n!==void 0&&(t.children=n)}return t}function sk(r,e){let t=e.data||{},a="value"in e&&!(Fc.call(t,"hProperties")||Fc.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 lk(r,e){let t=[],a=-1;for(e&&t.push({type:"text",value:`
3454
+ `});++a<r.length;)a&&t.push({type:"text",value:`
3455
+ `}),t.push(r[a]);return e&&r.length>0&&t.push({type:"text",value:`
3456
+ `}),t}function Og(r){let e=0,t=r.charCodeAt(e);for(;t===9||t===32;)e++,t=r.charCodeAt(e);return r.slice(e)}function Zo(r,e){let t=Lg(r,e),a=t.one(r,void 0),n=Ng(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 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=()=>`
3454
3458
 
3455
3459
  <!-- Styling -->
3456
3460
  <style>
@@ -3533,11 +3537,11 @@ ${n.extractions.map(r=>`- ${r.name} (${r.type}): ${r.description||"No descriptio
3533
3537
  <div id='llm-selector-list'></div>
3534
3538
  </div>
3535
3539
 
3536
- `}onUpdate(){this.child("llm-selector-panel").className=this.attr.open?"open":"closed";let t=this.child("llm-selector-list");for(;t.lastChild;)t.lastChild.remove();for(let i of this.state.items||[]){let r=document.createElement("div");r.className="llm-selector-item"+(i.id==this.state.selectedID?" selected":""),r.innerHTML=`
3537
- <div class='llm-selector-item-icon' style="background-image: url('${i.icon}'); "></div>
3538
- <div class='llm-selector-item-name'>${i.name}</div>
3539
- <div class='llm-selector-item-provider'>${i.provider}</div>
3540
- `,r.addEventListener("click",a=>{this.dispatchEvent(new CustomEvent("select",{detail:i.id}))}),t.appendChild(r)}}};sn.observedAttributes=["open"];var At=new q("ONNXModel"),Ie=class e{constructor(n){this.stateTensors={};this.constantTensors={};this._runActive=!1;this.ignoreIfBusy=!1;this.session=n,At.debug(`Model input parameters: ${n.inputNames.join(", ")}`),At.debug(`Model output parameters: ${n.outputNames.join(", ")}`)}static isSupported(){return!!e.lib}static async load(n){if(!e.lib)throw new Error("ONNX runtime not loaded, please set the runtime loader. Example: ONNXModel.lib = () => import('onnxruntime-web')");this.onnx||(At.debug("Loading ONNX runtime"),this.onnx=await e.lib()),At.debug(`Loading model: ${n}`);let t=await this.onnx.InferenceSession.create(n);return new e(t)}makeTensor(n,t,i=0){let r=1;for(let o of t)r*=o;let a;if(n=="float32")a=new e.onnx.Tensor(new Float32Array(r),t);else if(n=="int8")a=new e.onnx.Tensor(new Int8Array(r),t);else if(n=="int16")a=new e.onnx.Tensor(new Int16Array(r),t);else if(n=="int32")a=new e.onnx.Tensor(new Int32Array(r),t);else if(n=="int64")a=new e.onnx.Tensor(new BigInt64Array(r),t);else if(n=="uint8")a=new e.onnx.Tensor(new Uint8Array(r),t);else if(n=="uint16")a=new e.onnx.Tensor(new Uint16Array(r),t);else if(n=="uint32")a=new e.onnx.Tensor(new Uint32Array(r),t);else if(n=="uint64")a=new e.onnx.Tensor(new BigUint64Array(r),t);else throw new Error(`Invalid type: ${n}`);return i!==0&&(n=="int64"||n=="uint64")?a.data.fill(BigInt(i)):i!==0&&a.data.fill(i),a}registerConstant(n,t){if(!this.session.inputNames.includes(n))throw new Error(`Model does not have an input named: ${n}`);return this.constantTensors[n]=t,t}makeConstant(n,t,i,r=0){return this.registerConstant(n,this.makeTensor(t,i,r))}registerState(n,t,i){if(t||(t=n),!this.session.inputNames.includes(n))throw new Error(`Model does not have an input named: ${n}`);if(!this.session.outputNames.includes(t))throw new Error(`Model does not have an output named: ${t}`);return this.stateTensors[n]={outputName:t,tensor:i},i}makeState(n,t,i,r,a=0){return this.registerState(n,t,this.makeTensor(i,r,a))}async run(n={}){if(this._runActive&&this.ignoreIfBusy)return At.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)n[t]=this.stateTensors[t].tensor;for(let t in this.constantTensors)n[t]=this.constantTensors[t];try{let t=await this.session.run(n);for(let i in this.stateTensors){let r=t[this.stateTensors[i].outputName];this.stateTensors[i].tensor=r}return t}finally{this._runActive=!1}}resetState(){At.debug("Resetting state tensors");for(let n in this.stateTensors)this.stateTensors[n].tensor.data.fill(0)}};var Il="data:application/javascript;base64,dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoaSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFpKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtpfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9aSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoaSx0KT0+aSt0Lmxlbmd0aCwwKX1mZWVkKGkpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChpKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQscik9PnQrci5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgaT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgaSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLHI9MDtmb3IoO3IhPXQubGVuZ3RoOyl7aWYocj50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtyfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGE9dC5sZW5ndGgtcixzPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sZj1zLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7ZjxhPyh0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCkscikscis9Zix0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrYSkscikscis9YSx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWEpfXJldHVybiB0fXBhZCgpe2xldCBpPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoaT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLHI9bmV3IHQoaSk7dGhpcy5mZWVkKHIpfX07dmFyIGQ9Y2xhc3N7Y29uc3RydWN0b3IoaSx0LHIsYSl7aWYoIWl8fCF0fHwhcil0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1pLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1yfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWEsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1pPT5pLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoaSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGkpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWksdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsaSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9aT0+e2xldCB0PWkubGVuZ3RoLHI9dGhpcy5jaGFubmVscyxhLHMsZixoLGUsbix1LG8sbDtpZih0JXIhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihhPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxzPXRoaXMucmF0aW9XZWlnaHQsZj10aGlzLmxhc3RXZWlnaHQsaD0wLGU9MCxuPTAsdT0wLG89dGhpcy5vdXRwdXRCdWZmZXI7ZjwxO2YrPXMpZm9yKGU9ZiUxLGg9MS1lLHRoaXMubGFzdFdlaWdodD1mJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpb1t1KytdPXRoaXMubGFzdE91dHB1dFtsXSpoK2lbbF0qZTtmb3IoZi09MSx0LT1yLG49TWF0aC5mbG9vcihmKSpyO3U8YSYmbjx0Oyl7Zm9yKGU9ZiUxLGg9MS1lLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKW9bdSsrXT1pW24rKGw+MD9sOjApXSpoK2lbbisocitsKV0qZTtmKz1zLG49TWF0aC5mbG9vcihmKSpyfWZvcihsPTA7bDxyOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09aVtuKytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKHUpfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWk9PntsZXQgdD1pLmxlbmd0aCxyLGEscz10aGlzLmNoYW5uZWxzLGYsaCxlLG4sdSxvLGwsbSxnO2lmKHQlcyE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKHI9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGE9W10sZj10aGlzLnJhdGlvV2VpZ2h0LGg9MCxuPTAsdT0wLG89IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsZz0wLGU9MDtlPHM7KytlKWFbZV09MDtkb3tpZihvKWZvcihoPWYsZT0wO2U8czsrK2UpYVtlXT0wO2Vsc2V7Zm9yKGg9dGhpcy5sYXN0V2VpZ2h0LGU9MDtlPHM7KytlKWFbZV09dGhpcy5sYXN0T3V0cHV0W2VdO289ITB9Zm9yKDtoPjAmJm48dDspaWYodT0xK24tZyxoPj11KXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKytdKnU7Zz1uLGgtPXV9ZWxzZXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKyhlPjA/ZTowKV0qaDtnKz1oLGg9MDticmVha31pZihoPT09MClmb3IoZT0wO2U8czsrK2UpbFttKytdPWFbZV0vZjtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9aCxlPTA7ZTxzOysrZSl0aGlzLmxhc3RPdXRwdXRbZV09YVtlXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKG48dCYmbTxyKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoaSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihpKX19O2Z1bmN0aW9uIFMocCl7bGV0IGk9cC5sZW5ndGgsdD1uZXcgRmxvYXQzMkFycmF5KGkpO2Zvcig7aS0tOyl7bGV0IHI9cFtpXTt0W2ldPXI+PTMyNzY4Py0oNjU1MzYtcikvMzI3Njg6ci8zMjc2N31yZXR1cm4gdH12YXIgeT0xMDI0KjgsQj1jbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3Nvcntjb25zdHJ1Y3Rvcih0KXtzdXBlcih0KTt0aGlzLmNodW5rcz1bXTt0aGlzLmNodW5rUG9zaXRpb249MDt0aGlzLmlzRW5kZWQ9ITE7dGhpcy5pc0NhbmNlbGxlZD0hMTt0aGlzLnNhbXBsZVJhdGU9MDt0aGlzLmZvcm1hdD0iaW50MTYiO3RoaXMuYnVmZmVyT2Zmc2V0PTA7dGhpcy5sYXN0UGxheWVkQnVmZmVyU2l6ZT0wO3RoaXMuX2hhc1NlbnRFbmRFdmVudD0hMTt0aGlzLnBvcnQub25tZXNzYWdlPXI9PnRoaXMub25NZXNzYWdlKHIpfW9uTWVzc2FnZSh0KXtpZih0LmRhdGEuYWN0aW9uPT0ic3RhcnQiKXRoaXMuZm9ybWF0PXQuZGF0YS5mb3JtYXQsdGhpcy5zYW1wbGVSYXRlPXQuZGF0YS5pbnB1dFNhbXBsZVJhdGUsdGhpcy5yZXNhbXBsZXI9bmV3IGQodC5kYXRhLmlucHV0U2FtcGxlUmF0ZSx0LmRhdGEub3V0cHV0U2FtcGxlUmF0ZSwxLHkpLHRoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMuaW5wdXRCdWZmZXI9bmV3IGMoVWludDhBcnJheSx5KjIpOnRoaXMuZm9ybWF0PT0iZmxvYXQzMiImJih0aGlzLmlucHV0QnVmZmVyPW5ldyBjKFVpbnQ4QXJyYXkseSo0KSk7ZWxzZSBpZih0LmRhdGEuYWN0aW9uPT0iZGF0YSIpe2xldCByPW5ldyBVaW50OEFycmF5KHQuZGF0YS5idWZmZXIpO2Zvcih0aGlzLmlucHV0QnVmZmVyLmZlZWQocik7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspdGhpcy5kcmFpbkJ1ZmZlcigpfWVsc2UgdC5kYXRhLmFjdGlvbj09ImVuZCI/KHRoaXMubGFzdFBsYXllZEJ1ZmZlclNpemUmJnRoaXMuY2h1bmtzLnB1c2gobmV3IEZsb2F0MzJBcnJheSh0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplKjIpKSx0aGlzLmlzRW5kZWQ9ITApOnQuZGF0YS5hY3Rpb249PSJjYW5jZWwiJiYodGhpcy5pc0VuZGVkPSEwLHRoaXMuaXNDYW5jZWxsZWQ9ITApfWRyYWluQnVmZmVyKCl7bGV0IHQ9dGhpcy5pbnB1dEJ1ZmZlci5kcmFpbigpO2lmKCF0KXJldHVybjtsZXQgcjtpZih0aGlzLmZvcm1hdD09ImludDE2Iil7bGV0IHM9bmV3IEludDE2QXJyYXkodC5idWZmZXIsdC5ieXRlT2Zmc2V0LHQuYnl0ZUxlbmd0aC8yKTtyPVMocyl9ZWxzZSBpZih0aGlzLmZvcm1hdD09ImZsb2F0MzIiKXI9bmV3IEZsb2F0MzJBcnJheSh0LmJ1ZmZlcix0LmJ5dGVPZmZzZXQsdC5ieXRlTGVuZ3RoLzQpO2Vsc2UgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGZvcm1hdDogJHt0aGlzLmZvcm1hdH1gKTtsZXQgYT10aGlzLnJlc2FtcGxlci5yZXNhbXBsZShyKTt0aGlzLmNodW5rcy5wdXNoKGEpfW5leHRGbG9hdCgpe2lmKCF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIDA7bGV0IHQ9dGhpcy5jaHVua3NbMF1bdGhpcy5jaHVua1Bvc2l0aW9uXTtyZXR1cm4gdGhpcy5jaHVua1Bvc2l0aW9uKyssdGhpcy5jaHVua1Bvc2l0aW9uPHRoaXMuY2h1bmtzWzBdLmxlbmd0aHx8KHRoaXMuY2h1bmtzLnNoaWZ0KCksdGhpcy5jaHVua1Bvc2l0aW9uPTApLHR9cHJvY2Vzcyh0LHIsYSl7aWYodGhpcy5pc0NhbmNlbGxlZClyZXR1cm4hMTtpZih0aGlzLmlzRW5kZWQmJiF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIHRoaXMuX2hhc1NlbnRFbmRFdmVudHx8KHRoaXMuX2hhc1NlbnRFbmRFdmVudD0hMCx0aGlzLnBvcnQucG9zdE1lc3NhZ2Uoe2FjdGlvbjoiZW5kIn0pKSwhMTtsZXQgcz1yWzBdPy5bMF0/Lmxlbmd0aDtpZighcylyZXR1cm4hMDt0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplPXM7Zm9yKGxldCBmPTA7ZjxzO2YrKyl7bGV0IGg9dGhpcy5uZXh0RmxvYXQoKTtmb3IobGV0IGU9MDtlPHIubGVuZ3RoO2UrKylmb3IobGV0IG49MDtuPHJbZV0ubGVuZ3RoO24rKylyW2VdW25dW2ZdPWh9cmV0dXJuITB9fTtyZWdpc3RlclByb2Nlc3NvcigicGNtLXBsYXllci1ub2RlIixCKTsK";var Rl="data:application/javascript;base64,dmFyIGc9Y2xhc3N7Y29uc3RydWN0b3IoZSx0LGksZil7aWYoIWV8fCF0fHwhaSl0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1lLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1pfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWYsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1lPT5lLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoZSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGUpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWUsdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsZSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9ZT0+e2xldCB0PWUubGVuZ3RoLGk9dGhpcy5jaGFubmVscyxmLGgsYSxzLHIsdSxuLHAsbDtpZih0JWkhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihmPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxoPXRoaXMucmF0aW9XZWlnaHQsYT10aGlzLmxhc3RXZWlnaHQscz0wLHI9MCx1PTAsbj0wLHA9dGhpcy5vdXRwdXRCdWZmZXI7YTwxO2ErPWgpZm9yKHI9YSUxLHM9MS1yLHRoaXMubGFzdFdlaWdodD1hJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpcFtuKytdPXRoaXMubGFzdE91dHB1dFtsXSpzK2VbbF0qcjtmb3IoYS09MSx0LT1pLHU9TWF0aC5mbG9vcihhKSppO248ZiYmdTx0Oyl7Zm9yKHI9YSUxLHM9MS1yLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKXBbbisrXT1lW3UrKGw+MD9sOjApXSpzK2VbdSsoaStsKV0qcjthKz1oLHU9TWF0aC5mbG9vcihhKSppfWZvcihsPTA7bDxpOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09ZVt1KytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKG4pfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWU9PntsZXQgdD1lLmxlbmd0aCxpLGYsaD10aGlzLmNoYW5uZWxzLGEscyxyLHUsbixwLGwsbSxCO2lmKHQlaCE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKGk9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGY9W10sYT10aGlzLnJhdGlvV2VpZ2h0LHM9MCx1PTAsbj0wLHA9IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsQj0wLHI9MDtyPGg7KytyKWZbcl09MDtkb3tpZihwKWZvcihzPWEscj0wO3I8aDsrK3IpZltyXT0wO2Vsc2V7Zm9yKHM9dGhpcy5sYXN0V2VpZ2h0LHI9MDtyPGg7KytyKWZbcl09dGhpcy5sYXN0T3V0cHV0W3JdO3A9ITB9Zm9yKDtzPjAmJnU8dDspaWYobj0xK3UtQixzPj1uKXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KytdKm47Qj11LHMtPW59ZWxzZXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KyhyPjA/cjowKV0qcztCKz1zLHM9MDticmVha31pZihzPT09MClmb3Iocj0wO3I8aDsrK3IpbFttKytdPWZbcl0vYTtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9cyxyPTA7cjxoOysrcil0aGlzLmxhc3RPdXRwdXRbcl09ZltyXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKHU8dCYmbTxpKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoZSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihlKX19O2Z1bmN0aW9uIGQobyl7bGV0IGU9by5sZW5ndGgsdD1uZXcgSW50MTZBcnJheShlKTtmb3IoO2UtLTspe2xldCBpPU1hdGgubWF4KC0xLE1hdGgubWluKDEsb1tlXSkpO3RbZV09aTwwP2kqMzI3Njg6aSozMjc2N31yZXR1cm4gdH1mdW5jdGlvbiB3KG8pe2xldCBlPW8ubGVuZ3RoLHQ9bmV3IEJpZ0ludDY0QXJyYXkoZSk7Zm9yKDtlLS07KXtsZXQgaT1NYXRoLm1heCgtMSxNYXRoLm1pbigxLG9bZV0pKTt0W2VdPUJpZ0ludChNYXRoLmZsb29yKGk8MD9pKjMyNzY4OmkqMzI3NjcpKSoweDEwMDAwMDAwMDAwMG59cmV0dXJuIHR9dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoZSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFlKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtlfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9ZSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoZSx0KT0+ZSt0Lmxlbmd0aCwwKX1mZWVkKGUpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChlKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQsaSk9PnQraS5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgZT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgZSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLGk9MDtmb3IoO2khPXQubGVuZ3RoOyl7aWYoaT50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtpfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGY9dC5sZW5ndGgtaSxoPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sYT1oLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7YTxmPyh0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCksaSksaSs9YSx0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrZiksaSksaSs9Zix0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWYpfXJldHVybiB0fXBhZCgpe2xldCBlPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoZT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLGk9bmV3IHQoZSk7dGhpcy5mZWVkKGkpfX07dmFyIHk9Y2xhc3MgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3J7Y29uc3RydWN0b3IodCl7c3VwZXIodCk7dGhpcy5mb3JtYXQ9ImludDE2Ijt0aGlzLmlucHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSw0MDk2KTt0aGlzLnBvcnQub25tZXNzYWdlPWk9PnRoaXMub25NZXNzYWdlKGkpfW9uTWVzc2FnZSh0KXt0LmRhdGEuYWN0aW9uPT0ic3RhcnQiJiYodGhpcy5mb3JtYXQ9dC5kYXRhLmZvcm1hdCx0aGlzLnJlc2FtcGxlcj1uZXcgZyh0LmRhdGEuaW5wdXRTYW1wbGVSYXRlLHQuZGF0YS5vdXRwdXRTYW1wbGVSYXRlLDEsNDA5NiksdGhpcy5mb3JtYXQ9PSJpbnQxNiI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoSW50MTZBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoQmlnSW50NjRBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJmbG9hdDMyIiYmKHRoaXMub3V0cHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSkpKX1wcm9jZXNzKHQsaSxmKXtmb3IobGV0IGE9MDthPGkubGVuZ3RoO2ErKyl7bGV0IHM9TWF0aC5taW4oaVthXS5sZW5ndGgsdFswXS5sZW5ndGgpO2ZvcihsZXQgcj0wO3I8cztyKyspaVthXVtyXS5zZXQodFswXVtyXSl9aWYoIXRoaXMucmVzYW1wbGVyKXJldHVybiEwO2xldCBoPW5ldyBGbG9hdDMyQXJyYXkoaVswXVswXS5sZW5ndGgpO2ZvcihoLnNldChpWzBdWzBdKSx0aGlzLmlucHV0QnVmZmVyLmZlZWQoaCk7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspe2xldCBhPXRoaXMuaW5wdXRCdWZmZXIuZHJhaW4oKSxzPXRoaXMucmVzYW1wbGVyLnJlc2FtcGxlKGEpO3RoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMub3V0cHV0QnVmZmVyLmZlZWQoZChzKSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXIuZmVlZCh3KHMpKTp0aGlzLmZvcm1hdD09ImZsb2F0MzIiJiZ0aGlzLm91dHB1dEJ1ZmZlci5mZWVkKHMpfWZvcig7dGhpcy5vdXRwdXRCdWZmZXIuY2FuRHJhaW47KXtsZXQgYT10aGlzLm91dHB1dEJ1ZmZlci5kcmFpbigpO2lmKCFhKWJyZWFrO3RoaXMucG9ydC5wb3N0TWVzc2FnZSh7YWN0aW9uOiJkYXRhIixidWZmZXI6YS5idWZmZXJ9LFthLmJ1ZmZlcl0pfXJldHVybiEwfX07cmVnaXN0ZXJQcm9jZXNzb3IoInBjbS1yZWNlaXZlci1ub2RlIix5KTsK";var ng=new q("PCMPlayerNode"),hi=class extends AudioWorkletNode{constructor(t,i,r){super(t,"pcm-player-node",{numberOfInputs:0});this.sampleRate=0;this.format="int16";this.isCancelled=!1;if(!i||i<=0)throw new Error(`Invalid sample rate: ${i}`);if(!r||r!="int16"&&r!="float32")throw new Error(`Invalid format: ${r}`);this.sampleRate=i,this.format=r,this.port.onmessage=a=>this.onWorkletMessage(a),this.port.postMessage({action:"start",inputSampleRate:i,outputSampleRate:t.sampleRate,format:r})}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(i=>this._playPromiseResolve=i),this.dispatchEvent(new CustomEvent("start",{detail:{player:this,stream:t}}));try{let i=t.getReader();for(;!this.isCancelled;){let{done:r,value:a}=await i.read();if(r||!a)break;this.feed(a)}}catch(i){ng.warn("Stream error:",i),this.dispatchEvent(new CustomEvent("error",{detail:{player:this,stream:t,error:i}}))}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 fi=new q("SpeechOutput"),Pl=.5,ig=.8,yi=class extends EventTarget{constructor(t){super();this.maxVolumeHeard=0;this.ai=t,this.ai.addEventListener("output",i=>this.onTextOutputFromAI(i)),this.ai.audio?.speechRecognition.addEventListener("speechstart",i=>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 r of this.analyserBuffer)t+=r*r;let i=Math.sqrt(t/this.analyserBuffer.length);return i>this.maxVolumeHeard&&(this.maxVolumeHeard=i),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,i/this.maxVolumeHeard))}async speak(t){if(!this.ai?.config?.voice?.providerID)return fi.warn("No voice provider configured");let i=`speech-${rg++}`;await this.ai.audio.beginAccess(i);try{await this._speakWithLock(t)}finally{this.ai.audio.endAccess(i)}}async _speakWithLock(t){this.interrupt(),this.ai.audio.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=ig);let i=this.ai?._voiceTracker||fi.timer(`${this.ai.config.voice.providerID} voice`);i(`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 r=new hi(this.ai.audio.context,24e3,"int16");this.currentPlayer=r,r.connect(this.analyserNode),r.addEventListener("end",o=>{let s=o;i(`PCM stream ${s.detail.interrupted?"interrupted":"ended"}`),this.currentPlayer==r&&!s.detail.interrupted&&(this.currentPlayer=void 0,this.onSpeechEnd())});let a;if(this.ai.config.voice.providerID=="openai")a=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")a=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{fi.warn(`Unknown voice provider: ${this.ai.config.voice.providerID}`);return}if(i(`Received response ${a.status} ${a.statusText}`),!a.ok){fi.warn(`Failed to generate voice sample: ${a.status} ${a.statusText}`);return}this.dispatchEvent(new CustomEvent("speechstart",{detail:{ai:this.ai,message:t}})),i("Playing PCM stream"),await r.play(a.body),i("Audio has ended")}get isSpeaking(){return!!this.currentPlayer}async interrupt(){if(!this.currentPlayerVolume)return;let t=this.currentPlayerVolume,i=this.currentPlayer;this.currentPlayerVolume=void 0,this.currentPlayer=void 0,this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=Pl);let r=400;t.gain.linearRampToValueAtTime(0,r/1e3),await new Promise(a=>setTimeout(a,r+250)),t.disconnect(),i?.stop(),i?.disconnect()}onSpeechEnd(){this.dispatchEvent(new CustomEvent("speechend",{detail:{ai:this.ai}})),this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=Pl)}},rg=1;function bi(e,n){let t=n.reduce((l,c)=>l+c.byteLength,0),i=new DataView(new ArrayBuffer(44));i.setUint8(0,82),i.setUint8(1,73),i.setUint8(2,70),i.setUint8(3,70),i.setUint32(4,44+t,!0),i.setUint8(8,87),i.setUint8(9,65),i.setUint8(10,86),i.setUint8(11,69);let r=1,a=32,o=r*a/8,s=e*o;return i.setUint8(12,102),i.setUint8(13,109),i.setUint8(14,116),i.setUint8(15,32),i.setUint32(16,16,!0),i.setUint16(20,3,!0),i.setUint16(22,r,!0),i.setUint32(24,e,!0),i.setUint32(28,s,!0),i.setUint16(32,o,!0),i.setUint16(34,a,!0),i.setUint8(36,100),i.setUint8(37,97),i.setUint8(38,116),i.setUint8(39,97),i.setUint32(40,t,!0),new File([i,...n],"audio.wav",{type:"audio/wav"})}var vi=class extends AudioWorkletNode{constructor(t,i,r,a){super(t,"pcm-receiver-node",{numberOfInputs:1});this.format="int16";this.format=r;let o=["int16","int64","float32"];if(!i||i<=0)throw new Error(`Invalid sample rate: ${i}`);if(!o.includes(r))throw new Error(`Invalid format ${r}, must be one of: ${o.join(", ")}`);if(!a||a<=0)throw new Error(`Invalid buffer size: ${a}`);this.port.onmessage=s=>this.onWorkletMessage(s),this.port.postMessage({action:"start",inputSampleRate:t.sampleRate,outputSampleRate:i,format:r,bufferSize:a})}onWorkletMessage(t){if(t.data.action=="data"){let i=null;if(this.format=="int16"&&(i=new Int16Array(t.data.buffer)),this.format=="int64"&&(i=new BigInt64Array(t.data.buffer)),this.format=="float32"&&(i=new Float32Array(t.data.buffer)),!i)throw new Error(`Invalid format: ${this.format}`);this.onData(i),this.dispatchEvent(new CustomEvent("data",{detail:{data:i}}))}}onData(t){}};var sa=16e3,_i=256,xt=8,ln=new q("VoiceDetectionNode"),cn=class cn extends vi{constructor(t){super(t,sa,"float32",_i*xt);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(!cn.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 sa}get numberOfSamples(){return _i}get numberOfSampleChunks(){return xt}get outputBufferSize(){return _i*xt}get isModelLoaded(){return!!this.vad}async loadModel(){ln.debug("Loading VAD model"),this.vad=await Ie.load(cn.vadModelURL),this.vad.ignoreIfBusy=!0,ln.debug("Model loaded"),this.vad.makeConstant("sr","int64",[1],sa),this.vad.makeState("h","hn","float32",[2,xt,64]),this.vad.makeState("c","cn","float32",[2,xt,64])}async onData(t){if(this.vad)try{let i=await this.vad.run({input:new Ie.onnx.Tensor(t,[xt,_i])});if(!i)return;this.currentProbability=0;for(let o=0;o<i.output.data.length;o++)i.output.data[o]>this.currentProbability&&(this.currentProbability=i.output.data[o]);let r=this.isVoiceActive?this.sentivityEnd:this.sensitivity,a=this.currentProbability>r;if(!a&&this._lastVoiceActive&&(this.nextVadReset=Date.now(),this.vad.resetState()),this._lastVoiceActive=a,a&&!this.isVoiceActive?(this.lastVoiceActiveDate=Date.now(),this.isVoiceActive=!0,this.dispatchEvent(new CustomEvent("speechstart")),this.onSpeechStart(),ln.debug("Started speaking")):a?this.lastVoiceActiveDate=Date.now():!a&&this.isVoiceActive&&Date.now()<this.lastVoiceActiveDate+this.voiceEndTimeout||!a&&this.isVoiceActive&&(this.isVoiceActive=!1,this.dispatchEvent(new CustomEvent("speechend")),this.onSpeechEnd(),ln.debug("Stopped speaking after timeout")),!a){let o=Date.now();o>this.nextVadReset&&(this.nextVadReset=o+5e3,this.vad.resetState())}}catch(i){ln.error("VAD failed:",i)}}onSpeechStart(){}onSpeechEnd(){}};cn.vadModelURL="";var It=cn;var Dl=new q("VoiceChunkOutputNode"),Rt=class extends It{constructor(){super(...arguments);this.buffers=[];this.recordedBuffers=[];this._voiceRecording=!1;this.backBufferDurationSeconds=3}get bufferDuration(){return this.buffers.reduce((t,i)=>t+i.length,0)/8e3}async onData(t){if(await super.onData(t),this.isVoiceActive&&!this._voiceRecording){Dl.debug(`Voice detected, sending ${this.buffers.length} existing chunks`),this._voiceRecording=!0;for(let i of this.buffers)this.recordedBuffers.push(i),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:i,isFinal:!1}})),this.onVoiceChunk(i);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 i=this.recordedBuffers.reduce((r,a)=>r+a.length,0);Dl.debug(`Voice complete, recorded ${(i/8e3).toFixed(2)} seconds of audio, ${i*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 Si=new q("OpenAITranscriptionNode"),Ei=class extends Rt{constructor(t,i){super(t);this.apiKey="";this.pendingBuffers=[];this.isTranscribing=!1;this.apiKey=i}async onVoiceEnd(t){let i=Si.timer("OpenAI Transcribe");this.isTranscribing=!0,this.pendingBuffers.push(...t);let r=bi(this.sampleRate,this.pendingBuffers);this.lastRequestAbortController?.abort(),this.lastRequestAbortController=new AbortController;let a="";try{let o=new FormData;o.append("file",r),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}`);i("Response received"),a=await s.text(),i("Content received: "+a),this.lastRequestAbortController=void 0}catch(o){Si.error(`Failed to transcribe speech: ${o.message}`);return}finally{this.isTranscribing=!1}if(this.pendingBuffers=[],!a)return Si.debug("Transcription complete, but no text was found");Si.debug(`Transcription: ${a}`),this.onVoiceTranscription(a),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:a}}))}onVoiceTranscription(t){}};var Ci=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 Le=new q("IntelliWeaveTranscriptionNode"),ag="wss://speech.intelliweave.ai/api/v1/transcribe",wi=class wi extends Rt{constructor(t,i){super(t);this.apiAddress=ag;this.apiKey="";this.isTranscribing=!1;this.apiKey=i}async onVoiceChunk(t){this.isTranscribing=!0,this.ws?this.ws.send(t):(Le.debug("Opening WebSocket connection"),this.ws=new Ci(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=()=>{Le.debug("WebSocket connection opened")},this.ws.addEventListener("message",r=>{let a=JSON.parse(r.data);if(a.error)return Le.warn("Error: "+a.error);if(a.type!="transcription")return Le.warn("Invalid response type",a);if(a.streaming&&!a.final)return Le.debug("Partial transcription: "+a.partialText);if(this.isTranscribing=!1,!a.text.trim())return Le.warn(`Empty transcription (${a.processingTime}ms)`);Le.debug(`Transcription: ${a.text} (${a.processingTime}ms)`),this.onVoiceTranscription(a.text),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:a.text}}))}),this.ws.addEventListener("close",()=>this.onSocketClose()),this.ws.addEventListener("error",r=>Le.warn("WebSocket error")));let i=1e3*60*1;this.shutdownTimer&&clearTimeout(this.shutdownTimer),this.shutdownTimer=setTimeout(()=>{Le.debug("Shutting down WebSocket connection"),this.ws?.close(),this.ws=void 0},i)}async onVoiceEnd(t){if(this.ws?.send(JSON.stringify({type:"end"})),wi.debugExportWav){let i=bi(this.sampleRate,t),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download="recording.wav",r.click()}}onVoiceTranscription(t){}onSocketClose(){Le.debug("WebSocket connection closed"),this.ws=void 0,this.isTranscribing=!1}};wi.debugExportWav=!1;var ki=wi;var la=new q("SpeechRecognition"),Ti=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 i=>{i.enable?await this.start():this.stop()}}])}get isSupported(){if(!Ie.lib||!this.ai?.vadModel||!He().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),It.vadModelURL=URL.createObjectURL(this.ai.vadModel),this.ai?.config?.transcription?.providerID=="openai"?(this.voiceDetection=new Ei(this.ai.audio.context,this.ai.config.transcription.apiKey),t.connect(this.voiceDetection)):(this.voiceDetection=new ki(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",i=>{this.ai._voiceTracker=la.timer("voice interaction","Speech started"),this.dispatchEvent(new CustomEvent(i.type,{detail:i.detail}))}),this.voiceDetection.addEventListener("speechend",i=>{this.ai._voiceTracker?.("Speech ended"),this.dispatchEvent(new CustomEvent(i.type,{detail:i.detail}))}),this.voiceDetection.addEventListener("transcription",i=>{this.ai._voiceTracker?.(`Transcription: ${i.detail.text}`),this.onTranscription(i)}),this._skipEvents||this.dispatchEvent(new CustomEvent("start",{detail:{speechRecognition:this}}))}catch(t){la.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 r of this.analyserBuffer)t+=r*r;let i=Math.sqrt(t/this.analyserBuffer.length);return i>this.maxVolumeHeard&&(this.maxVolumeHeard=i),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,i/this.maxVolumeHeard))}get wordsCurrentlyBeingSpoken(){return!!this.voiceDetection?.isVoiceActive}get isTranscribing(){return!!this.voiceDetection?.isTranscribing}onTranscription(t){let i=t.detail.text;la.debug("Heard:",i),this.dispatchEvent(new CustomEvent("speech",{detail:{transcript:i,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 Ai=new q("AudioSystem"),Pt=class{constructor(n){this.locks=[];if(!n)throw new Error("AI reference is required. Please pass in the IntelliWeave instance to the constructor.");this.ai=n,this.ai.audio=this,this.speechRecognition=new Ti(this.ai),this.speechOutput=new yi(this.ai)}static get isSupported(){return!(!Ie.lib||!He().AudioWorkletNode)}async beginAccess(n){Ai.debug(`Began access for: ${n}`),this.locks.includes(n)||this.locks.push(n),!this.context&&(Ai.debug("Creating AudioContext"),this.context=new AudioContext({latencyHint:"interactive"}),this.context.resume(),await Promise.all([this.context.audioWorklet.addModule(Il),this.context.audioWorklet.addModule(Rl)]))}endAccess(n){Ai.debug(`Ended access for: ${n}`),this.locks=this.locks.filter(t=>t!=n),!this.locks.length&&(Ai.debug("Closing AudioContext"),this.context?.close(),this.context=void 0)}};var NT=new q("Stream");var lt=_a(ql(),1);var HT=new q("React");var VT=(0,lt.createContext)(void 0);var dn=new q("Embed"),ct=class extends be{constructor(){super();this.config={};this.suggestions=[];this.html=()=>`
3540
+ `}onUpdate(){this.child("llm-selector-panel").className=this.attr.open?"open":"closed";let t=this.child("llm-selector-list");for(;t.lastChild;)t.lastChild.remove();for(let a of this.state.items||[]){let n=document.createElement("div");n.className="llm-selector-item"+(a.id==this.state.selectedID?" selected":""),n.innerHTML=`
3541
+ <div class='llm-selector-item-icon' style="background-image: url('${a.icon}'); "></div>
3542
+ <div class='llm-selector-item-name'>${a.name}</div>
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=()=>`
3541
3545
 
3542
3546
  <!-- Styling -->
3543
3547
  <style>
@@ -3702,7 +3706,7 @@ ${n.extractions.map(r=>`- ${r.name} (${r.type}): ${r.description||"No descriptio
3702
3706
  <div id='root' class='hidden'>
3703
3707
 
3704
3708
  <!-- Logo -->
3705
- ${Gt.add({id:"web-weaver-logo",logo:this.attr.logo})}
3709
+ ${Da.add({id:"web-weaver-logo",logo:this.attr.logo})}
3706
3710
  <div id='pulseanim' class="circle pulse"></div>
3707
3711
 
3708
3712
  <!-- Inner container contains all the UI when the panel is open -->
@@ -3710,10 +3714,10 @@ ${n.extractions.map(r=>`- ${r.name} (${r.type}): ${r.description||"No descriptio
3710
3714
  </div>
3711
3715
 
3712
3716
  <!-- LLM selector panel -->
3713
- ${sn.add({id:"llm-selector-panel"})}
3717
+ ${Qa.add({id:"llm-selector-panel"})}
3714
3718
 
3715
3719
  <!-- Interaction panel -->
3716
- ${Ft.add({id:"interaction-bar"})}
3720
+ ${Pa.add({id:"interaction-bar"})}
3717
3721
 
3718
3722
 
3719
3723
  <!-- Powered by IW banner -->
@@ -3723,9 +3727,12 @@ ${n.extractions.map(r=>`- ${r.name} (${r.type}): ${r.description||"No descriptio
3723
3727
 
3724
3728
  </div>
3725
3729
 
3726
- `;this._lastLogo="";this._lastBackground="";this._lastTextColor="";this._isProcessing=!1;this.ai=new St,Pt.isSupported&&(this.ai.audio=new Pt(this.ai))}onCreate(){$().embed&&dn.warn("Only one <web-weaver-embed> element should be on the page."),$().embed=this,this.child("root").addEventListener("click",r=>this.onContainerClick(r)),this.child("web-weaver-logo").addEventListener("click",r=>this.onLogoClick(r)),this.child("interaction-bar").addEventListener("input-message",r=>this.processInput(r.detail)),this.child("interaction-bar").addEventListener("llm-button-click",r=>this.state.llmPanelOpen=!this.state.llmPanelOpen),this.child("llm-selector-panel").addEventListener("select",r=>this.onLLMModelSelect(r)),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:r=>(this.suggestions.push(r.text),this.ai.submitAnalyticsEvent({type:"suggest-response",text:r.text}),"Suggestion button added")});let i=this.attr.apiKey||$().apiKey;if(!i)return dn.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(i).then(r=>{this.config=r,$().introductionMessage=this.config.introductionMessage,$().analytics=this.config.analytics!==void 0?!!this.config.analytics:$().analytics,this.applyConfigStylesAndAttributes(),this.child("root").classList.remove("hidden"),this.state.loading=!1,this.resetConversation()}).catch(r=>{dn.error("Failed to load AI configuration:",r),this.state.loading=!1;let a=this.child("web-weaver-embed-inner");a&&(a.innerHTML='<div class="output" style="color: red; padding: 20px;">Error loading configuration. Please try again later.</div>')})}applyConfigStylesAndAttributes(){let t=this.config,i=this.child("root");if(!i)return;let r=!1,o=this.getAttribute("logo")||t.logo;if(o&&o!==this._lastLogo){this._lastLogo=o,r=!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,r=!0,l?i.style.background=l:i.style.background="");let u=this.getAttribute("textColor")||t.textColor,d=this.child("interaction-bar");u!==this._lastTextColor&&(this._lastTextColor=u,r=!0,u?(i.style.color=u,d&&d.setAttribute("textColor",u)):(i.style.color="",d&&d.removeAttribute("textColor"))),r&&dn.debug("[WebWeaverEmbed] Applied UI Styling:",{finalLogo:o,finalBackground:i.style.background,finalTextColor:i.style.color})}onUpdate(){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.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,i)=>(i.priority||0)-(t.priority||0)),this.child("llm-selector-panel").state.selectedID=this.ai.currentModel?.id}onDestroy(){$().embed==this&&($().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 i=document.createElement("div");i.className="introduction-message",i.innerHTML=$().introductionMessage||`Welcome to <b>${document.title||"Web Weaver"}</b>. How can I help you?`,t.appendChild(i),this.ai.insertAssistantMessage(i.innerText);for(let r of $().introductionSuggestions||[]){let a=document.createElement("div");a.className="suggestion-button",a.innerText=r,a.addEventListener("click",o=>this.onSuggestionClick(o,r)),t.appendChild(a)}}async processInput(t){if(this._isProcessing)return;this._isProcessing=!0,this.state.loading=!0,this.state.llmPanelOpen=!1;let i=this.child("web-weaver-embed-inner");this.suggestions=[];try{for(let a of Array.from(i.querySelectorAll(".suggestion-button")))a.remove();this.attr.focusID="";let r=document.createElement("div");r.className="input",r.innerText=t,i.appendChild(r),i.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"}),await this.ai.sendMessage(t);for(let a of this.suggestions){let o=document.createElement("div");o.className="suggestion-button",o.innerText=a,o.addEventListener("click",s=>this.onSuggestionClick(s,a)),i.appendChild(o)}i.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}catch(r){dn.error("Failed to process input:",r);let a=document.createElement("div");a.className="output",a.innerText="Sorry, there was a problem getting a response. "+r.message,i.appendChild(a);let o=document.createElement("div");o.className="suggestion-button",o.innerText="Reset conversation",o.addEventListener("click",s=>this.resetConversation()),i.appendChild(o)}this.state.loading=!1,this._isProcessing=!1}async onAIMessage(t){let i=await oa().use(ai).use(di).use(On,{target:"_blank",rel:["noopener","noreferrer"]}).use(Fn).use(Kn).processSync(t),r=this.child("web-weaver-embed-inner"),a=r.lastElementChild;if(a&&a.classList.contains("output"))a.innerHTML=i.toString("utf-8");else{let o=document.createElement("div");o.className="output",o.innerHTML=i.toString("utf-8"),r.appendChild(o)}for(let o of Array.from(r.querySelectorAll(".tool")))o.remove();r.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}onAIToolStart(t,i){let r=`Running: ${t}`;t=="search"&&(r=`Searching: ${i?.query}`),t=="ui.focusElement"&&(r=`Focusing: #${i?.elementID}`),t=="ui.suggestResponse"&&(r=`Suggested response: ${i?.text}`);let a=this.child("web-weaver-embed-inner"),o=document.createElement("div");o.className="tool",o.innerText=r,a.appendChild(o),a.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}onSuggestionClick(t,i){this.processInput(i)}onLLMModelSelect(t){t.preventDefault(),this.ai.setModel(t.detail),this.state.llmPanelOpen=!1}};ct.tagName="intelliweave-embed",ct.observedAttributes=["logo","focusID","open","background","textColor"];Ie.lib=()=>import("./ort.bundle.min-IUPKB45H.js");document.body.appendChild(ct.create());
3730
+ `;this._lastLogo="";this._lastBackground="";this._lastTextColor="";this._isProcessing=!1;this.ai=new ea,ua.isSupported&&(this.ai.audio=new ua(this.ai))}onCreate(){Ne().embed&&ni.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 ni.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=>{ni.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&&ni.debug("[WebWeaverEmbed] Applied UI Styling:",{finalLogo:o,finalBackground:a.style.background,finalTextColor:a.style.color})}onUpdate(){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.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){ni.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 Kc().use(qo).use(Jo).use(wo,{target:"_blank",rel:["noopener","noreferrer"]}).use(ko).use(Oo).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}};wn.tagName="intelliweave-embed",wn.observedAttributes=["logo","focusID","open","background","textColor"];Zt.lib=()=>import("./ort.bundle.min-IUPKB45H.js");document.body.appendChild(wn.create());
3727
3731
  /*! Bundled license information:
3728
3732
 
3733
+ uri-js/dist/es5/uri.all.js:
3734
+ (** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js *)
3735
+
3729
3736
  react/cjs/react.production.min.js:
3730
3737
  (**
3731
3738
  * @license React