/*! Botric v1.4.0 */
!function(e){"function"==typeof define&&define.amd?define(e):e()}(function(){"use strict";var e,t,n,r,o,a,i,l,s,c,u,d,p,h,f,m={},g=[],b=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,y=Array.isArray;function v(e,t){for(var n in t)e[n]=t[n];return e}function x(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function w(t,n,r){var o,a,i,l={};for(i in n)"key"==i?o=n[i]:"ref"==i?a=n[i]:l[i]=n[i];if(arguments.length>2&&(l.children=arguments.length>3?e.call(arguments,2):r),"function"==typeof t&&null!=t.defaultProps)for(i in t.defaultProps)void 0===l[i]&&(l[i]=t.defaultProps[i]);return k(t,l,o,a,null)}function k(e,r,o,a,i){var l={type:e,props:r,key:o,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==i?++n:i,__i:-1,__u:0};return null==i&&null!=t.vnode&&t.vnode(l),l}function _(e){return e.children}function E(e,t){this.props=e,this.context=t}function S(e,t){if(null==t)return e.__?S(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?S(e):null}function C(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,o=[],a=[],i=v({},n);i.__v=n.__v+1,t.vnode&&t.vnode(i),R(e.__P,i,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,o,null==r?S(n):r,!!(32&n.__u),a),i.__v=n.__v,i.__.__k[i.__i]=i,$(o,i,a),n.__e=n.__=null,i.__e!=r&&N(i)}}function N(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),N(e)}function T(e){(!e.__d&&(e.__d=!0)&&r.push(e)&&!I.__r++||o!=t.debounceRendering)&&((o=t.debounceRendering)||a)(I)}function I(){try{for(var e,t=1;r.length;)r.length>t&&r.sort(i),e=r.shift(),t=r.length,C(e)}finally{r.length=I.__r=0}}function L(e,t,n,r,o,a,i,l,s,c,u){var d,p,h,f,b,v,x,w=r&&r.__k||g,E=t.length;for(s=function(e,t,n,r,o){var a,i,l,s,c,u=n.length,d=u,p=0;for(e.__k=new Array(o),a=0;a<o;a++)null!=(i=t[a])&&"boolean"!=typeof i&&"function"!=typeof i?("string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?i=e.__k[a]=k(null,i,null,null,null):y(i)?i=e.__k[a]=k(_,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?i=e.__k[a]=k(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[a]=i,s=a+p,i.__=e,i.__b=e.__b+1,l=null,-1!=(c=i.__i=D(i,n,s,d))&&(d--,(l=n[c])&&(l.__u|=2)),null==l||null==l.__v?(-1==c&&(o>u?p--:o<u&&p++),"function"!=typeof i.type&&(i.__u|=4)):c!=s&&(c==s-1?p--:c==s+1?p++:(c>s?p--:p++,i.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)null!=(l=n[a])&&!(2&l.__u)&&(l.__e==r&&(r=S(l)),q(l,l));return r}(n,t,w,s,E),d=0;d<E;d++)null!=(h=n.__k[d])&&(p=-1!=h.__i&&w[h.__i]||m,h.__i=d,v=R(e,h,p,o,a,i,l,s,c,u),f=h.__e,h.ref&&p.ref!=h.ref&&(p.ref&&B(p.ref,null,h),u.push(h.ref,h.__c||f,h)),null==b&&null!=f&&(b=f),(x=!!(4&h.__u))||p.__k===h.__k?(s=M(h,s,e,x),x&&p.__e&&(p.__e=null)):"function"==typeof h.type&&void 0!==v?s=v:f&&(s=f.nextSibling),h.__u&=-7);return n.__e=b,s}function M(e,t,n,r){var o,a;if("function"==typeof e.type){for(o=e.__k,a=0;o&&a<o.length;a++)o[a]&&(o[a].__=e,t=M(o[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=S(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function P(e,t){return t=t||[],null==e||"boolean"==typeof e||(y(e)?e.some(function(e){P(e,t)}):t.push(e)),t}function D(e,t,n,r){var o,a,i,l=e.key,s=e.type,c=t[n],u=null!=c&&!(2&c.__u);if(null===c&&null==l||u&&l==c.key&&s==c.type)return n;if(r>(u?1:0))for(o=n-1,a=n+1;o>=0||a<t.length;)if(null!=(c=t[i=o>=0?o--:a++])&&!(2&c.__u)&&l==c.key&&s==c.type)return i;return-1}function A(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||b.test(t)?n:n+"px"}function O(e,t,n,r,o){var a,i;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||A(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||A(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])a=t!=(t=t.replace(u,"$1")),i=t.toLowerCase(),t=i in e||"onFocusOut"==t||"onFocusIn"==t?i.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?r?n[c]=r[c]:(n[c]=d,e.addEventListener(t,a?h:p,a)):e.removeEventListener(t,a?h:p,a);else{if("http://www.w3.org/2000/svg"==o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function z(e){return function(n){if(this.l){var r=this.l[n.type+e];if(null==n[s])n[s]=d++;else if(n[s]<r[c])return;return r(t.event?t.event(n):n)}}}function R(e,n,r,o,a,i,l,s,c,u){var d,p,h,f,m,b,w,k,S,C,N,T,I,M,P,D=n.type;if(void 0!==n.constructor)return null;128&r.__u&&(c=!!(32&r.__u),i=[s=n.__e=r.__e]),(d=t.__b)&&d(n);e:if("function"==typeof D)try{if(k=n.props,S=D.prototype&&D.prototype.render,C=(d=D.contextType)&&o[d.__c],N=d?C?C.props.value:d.__:o,r.__c?w=(p=n.__c=r.__c).__=p.__E:(S?n.__c=p=new D(k,N):(n.__c=p=new E(k,N),p.constructor=D,p.render=U),C&&C.sub(p),p.state||(p.state={}),p.__n=o,h=p.__d=!0,p.__h=[],p._sb=[]),S&&null==p.__s&&(p.__s=p.state),S&&null!=D.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,D.getDerivedStateFromProps(k,p.__s))),f=p.props,m=p.state,p.__v=n,h)S&&null==D.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),S&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(S&&null==D.getDerivedStateFromProps&&k!==f&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(k,N),n.__v==r.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(k,p.__s,N)){n.__v!=r.__v&&(p.props=k,p.state=p.__s,p.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(e){e&&(e.__=n)}),g.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&l.push(p);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(k,p.__s,N),S&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(f,m,b)})}if(p.context=N,p.props=k,p.__P=e,p.__e=!1,T=t.__r,I=0,S)p.state=p.__s,p.__d=!1,T&&T(n),d=p.render(p.props,p.state,p.context),g.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,T&&T(n),d=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++I<25);p.state=p.__s,null!=p.getChildContext&&(o=v(v({},o),p.getChildContext())),S&&!h&&null!=p.getSnapshotBeforeUpdate&&(b=p.getSnapshotBeforeUpdate(f,m)),M=null!=d&&d.type===_&&null==d.key?j(d.props.children):d,s=L(e,y(M)?M:[M],n,r,o,a,i,l,s,c,u),p.base=n.__e,n.__u&=-161,p.__h.length&&l.push(p),w&&(p.__E=p.__=null)}catch(e){if(n.__v=null,c||null!=i)if(e.then){for(n.__u|=c?160:128;s&&8==s.nodeType&&s.nextSibling;)s=s.nextSibling;i[i.indexOf(s)]=null,n.__e=s}else{for(P=i.length;P--;)x(i[P]);F(n)}else n.__e=r.__e,n.__k=r.__k,e.then||F(n);t.__e(e,n,r)}else null==i&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):s=n.__e=H(r.__e,n,r,o,a,i,l,c,u);return(d=t.diffed)&&d(n),128&n.__u?void 0:s}function F(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(F))}function $(e,n,r){for(var o=0;o<r.length;o++)B(r[o],r[++o],r[++o]);t.__c&&t.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){t.__e(e,n.__v)}})}function j(e){return"object"!=typeof e||null==e||e.__b>0?e:y(e)?e.map(j):v({},e)}function H(n,r,o,a,i,l,s,c,u){var d,p,h,f,g,b,v,w=o.props||m,k=r.props,_=r.type;if("svg"==_?i="http://www.w3.org/2000/svg":"math"==_?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),null!=l)for(d=0;d<l.length;d++)if((g=l[d])&&"setAttribute"in g==!!_&&(_?g.localName==_:3==g.nodeType)){n=g,l[d]=null;break}if(null==n){if(null==_)return document.createTextNode(k);n=document.createElementNS(i,_,k.is&&k),c&&(t.__m&&t.__m(r,l),c=!1),l=null}if(null==_)w===k||c&&n.data==k||(n.data=k);else{if(l=l&&e.call(n.childNodes),!c&&null!=l)for(w={},d=0;d<n.attributes.length;d++)w[(g=n.attributes[d]).name]=g.value;for(d in w)g=w[d],"dangerouslySetInnerHTML"==d?h=g:"children"==d||d in k||"value"==d&&"defaultValue"in k||"checked"==d&&"defaultChecked"in k||O(n,d,null,g,i);for(d in k)g=k[d],"children"==d?f=g:"dangerouslySetInnerHTML"==d?p=g:"value"==d?b=g:"checked"==d?v=g:c&&"function"!=typeof g||w[d]===g||O(n,d,g,w[d],i);if(p)c||h&&(p.__html==h.__html||p.__html==n.innerHTML)||(n.innerHTML=p.__html),r.__k=[];else if(h&&(n.innerHTML=""),L("template"==r.type?n.content:n,y(f)?f:[f],r,o,a,"foreignObject"==_?"http://www.w3.org/1999/xhtml":i,l,s,l?l[0]:o.__k&&S(o,0),c,u),null!=l)for(d=l.length;d--;)x(l[d]);c||(d="value","progress"==_&&null==b?n.removeAttribute("value"):null!=b&&(b!==n[d]||"progress"==_&&!b||"option"==_&&b!=w[d])&&O(n,d,b,w[d],i),d="checked",null!=v&&v!=n[d]&&O(n,d,v,w[d],i))}return n}function B(e,n,r){try{if("function"==typeof e){var o="function"==typeof e.__u;o&&e.__u(),o&&null==n||(e.__u=e(n))}else e.current=n}catch(e){t.__e(e,r)}}function q(e,n,r){var o,a;if(t.unmount&&t.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||B(o,null,n)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){t.__e(e,n)}o.base=o.__P=null}if(o=e.__k)for(a=0;a<o.length;a++)o[a]&&q(o[a],n,r||"function"!=typeof e.type);r||x(e.__e),e.__c=e.__=e.__e=void 0}function U(e,t,n){return this.constructor(e,n)}function V(n,r,o){var a,i,l,s;r==document&&(r=document.documentElement),t.__&&t.__(n,r),i=(a="function"==typeof o)?null:o&&o.__k||r.__k,l=[],s=[],R(r,n=(!a&&o||r).__k=w(_,null,[n]),i||m,m,r.namespaceURI,!a&&o?[o]:i?null:r.firstChild?e.call(r.childNodes):null,l,!a&&o?o:i?i.__e:r.firstChild,a,s),$(l,n,s)}function W(e,t){V(e,t,W)}function Y(t,n,r){var o,a,i,l,s=v({},t.props);for(i in t.type&&t.type.defaultProps&&(l=t.type.defaultProps),n)"key"==i?o=n[i]:"ref"==i?a=n[i]:s[i]=void 0===n[i]&&null!=l?l[i]:n[i];return arguments.length>2&&(s.children=arguments.length>3?e.call(arguments,2):r),k(t.type,s,o||t.key,a||t.ref,null)}function Z(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,T(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+f++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}e=g.slice,t={__e:function(e,t,n,r){for(var o,a,i;t=t.__;)if((o=t.__c)&&!o.__)try{if((a=o.constructor)&&null!=a.getDerivedStateFromError&&(o.setState(a.getDerivedStateFromError(e)),i=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),i=o.__d),i)return o.__E=o}catch(t){e=t}throw e}},n=0,E.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=v({},this.state),"function"==typeof e&&(e=e(v({},n),this.props)),e&&v(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),T(this))},E.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),T(this))},E.prototype.render=_,r=[],a="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,i=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0,l=Math.random().toString(8),s="__d"+l,c="__a"+l,u=/(PointerCapture)$|Capture$/i,d=0,p=z(!1),h=z(!0),f=0;var G,Q,K,X,J=0,ee=[],te=t,ne=te.__b,re=te.__r,oe=te.diffed,ae=te.__c,ie=te.unmount,le=te.__;function se(e,t){te.__h&&te.__h(Q,e,J||t),J=0;var n=Q.__H||(Q.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ce(e){return J=1,ue(Ce,e)}function ue(e,t,n){var r=se(G++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ce(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Q,!Q.__f)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var i=r.__c.props!==e;return o.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(i=!0)}}),a&&a.call(this,e,t,n)||i};Q.__f=!0;var a=Q.shouldComponentUpdate,i=Q.componentWillUpdate;Q.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,o(e,t,n),a=r}i&&i.call(this,e,t,n)},Q.shouldComponentUpdate=o}return r.__N||r.__}function de(e,t){var n=se(G++,3);!te.__s&&Se(n.__H,t)&&(n.__=e,n.u=t,Q.__H.__h.push(n))}function pe(e,t){var n=se(G++,4);!te.__s&&Se(n.__H,t)&&(n.__=e,n.u=t,Q.__h.push(n))}function he(e){return J=5,me(function(){return{current:e}},[])}function fe(e,t,n){J=6,pe(function(){if("function"==typeof e){var n=e(t());return function(){e(null),n&&"function"==typeof n&&n()}}if(e)return e.current=t(),function(){return e.current=null}},null==n?n:n.concat(e))}function me(e,t){var n=se(G++,7);return Se(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ge(e,t){return J=8,me(function(){return e},t)}function be(e){var t=Q.context[e.__c],n=se(G++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Q)),t.props.value):e.__}function ye(e,t){te.useDebugValue&&te.useDebugValue(t?t(e):e)}function ve(){var e=se(G++,11);if(!e.__){for(var t=Q.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function xe(){for(var e;e=ee.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(_e),t.__h.some(Ee),t.__h=[]}catch(n){t.__h=[],te.__e(n,e.__v)}}}te.__b=function(e){Q=null,ne&&ne(e)},te.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),le&&le(e,t)},te.__r=function(e){re&&re(e),G=0;var t=(Q=e.__c).__H;t&&(K===Q?(t.__h=[],Q.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(_e),t.__h.some(Ee),t.__h=[],G=0)),K=Q},te.diffed=function(e){oe&&oe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==ee.push(t)&&X===te.requestAnimationFrame||((X=te.requestAnimationFrame)||ke)(xe)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),K=Q=null},te.__c=function(e,t){t.some(function(e){try{e.__h.some(_e),e.__h=e.__h.filter(function(e){return!e.__||Ee(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],te.__e(n,e.__v)}}),ae&&ae(e,t)},te.unmount=function(e){ie&&ie(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{_e(e)}catch(e){t=e}}),n.__H=void 0,t&&te.__e(t,n.__v))};var we="function"==typeof requestAnimationFrame;function ke(e){var t,n=function(){clearTimeout(r),we&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);we&&(t=requestAnimationFrame(n))}function _e(e){var t=Q,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Q=t}function Ee(e){var t=Q;e.__c=e.__(),Q=t}function Se(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Ce(e,t){return"function"==typeof t?t(e):t}function Ne(e,t){for(var n in t)e[n]=t[n];return e}function Te(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function Ie(e,t){var n=t(),r=ce({t:{__:n,u:t}}),o=r[0].t,a=r[1];return pe(function(){o.__=n,o.u=t,Le(o)&&a({t:o})},[e,n,t]),de(function(){return Le(o)&&a({t:o}),e(function(){Le(o)&&a({t:o})})},[e]),n}function Le(e){try{return!((t=e.__)===(n=e.u())&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}var t,n}function Me(e){e()}function Pe(e){return e}function De(){return[!1,Me]}var Ae=pe;function Oe(e,t){this.props=e,this.context=t}function ze(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&("function"==typeof n?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:Te(this.props,e)}function r(t){return this.shouldComponentUpdate=n,w(e,t)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.__f=r.prototype.isReactComponent=!0,r.type=e,r}(Oe.prototype=new E).isPureReactComponent=!0,Oe.prototype.shouldComponentUpdate=function(e,t){return Te(this.props,e)||Te(this.state,t)};var Re=t.__b;t.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Re&&Re(e)};var Fe="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function $e(e){function t(t){var n=Ne({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=Fe,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var je=function(e,t){return null==e?null:P(P(e).map(t))},He={map:je,forEach:je,count:function(e){return e?P(e).length:0},only:function(e){var t=P(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:P},Be=t.__e;t.__e=function(e,t,n,r){if(e.then)for(var o,a=t;a=a.__;)if((o=a.__c)&&o.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t);Be(e,t,n,r)};var qe=t.unmount;function Ue(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=Ne({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Ue(e,t,n)})),e}function Ve(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Ve(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function We(){this.__u=0,this.o=null,this.__b=null}function Ye(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Ze(e){var t,n,r,o=null;function a(a){if(t||(t=e()).then(function(e){e&&(o=e.default||e),r=!0},function(e){n=e,r=!0}),n)throw n;if(!r)throw t;return o?w(o,a):null}return a.displayName="Lazy",a.__f=!0,a}function Ge(){this.i=null,this.l=null}t.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),qe&&qe(e)},(We.prototype=new E).__c=function(e,t){var n=t.__c,r=this;null==r.o&&(r.o=[]),r.o.push(n);var o=Ye(r.__v),a=!1,i=function(){a||r.__z||(a=!0,n.__R=null,o?o(s):s())};n.__R=i;var l=n.__P;n.__P=null;var s=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=Ve(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=l,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(i,i)},We.prototype.componentWillUnmount=function(){this.o=[]},We.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Ue(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&w(_,null,e.fallback);return o&&(o.__u&=-33),[w(_,null,t.__a?null:e.children),o]};var Qe=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function Ke(e){return this.getChildContext=function(){return e.context},e.children}function Xe(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){V(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var r=t.__v;null!==r&&!r.__m&&null!==r.__;)r=r.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}V(w(Ke,{context:t.context},e.__v),t.v)}function Je(e,t){var n=w(Xe,{__v:e,h:t});return n.containerInfo=t,n}(Ge.prototype=new E).__a=function(e){var t=this,n=Ye(t.__v),r=t.l.get(e);return r[0]++,function(o){var a=function(){t.props.revealOrder?(r.push(o),Qe(t,e,r)):o()};n?n(a):a()}},Ge.prototype.render=function(e){this.i=null,this.l=new Map;var t=P(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Ge.prototype.componentDidUpdate=Ge.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Qe(e,n,t)})};var et="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,tt=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,nt=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,rt=/[A-Z0-9]/g,ot="undefined"!=typeof document,at=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};function it(e,t,n){return null==t.__k&&(t.textContent=""),V(e,t),"function"==typeof n&&n(),e?e.__c:null}function lt(e,t,n){return W(e,t),"function"==typeof n&&n(),e?e.__c:null}E.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(E.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var st=t.event;t.event=function(e){return st&&(e=st(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var ct,ut={configurable:!0,get:function(){return this.class}},dt=t.vnode;t.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,r={},o=-1==n.indexOf("-");for(var a in t){var i=t[a];if(!("value"===a&&"defaultValue"in t&&null==i||ot&&"children"===a&&"noscript"===n||"class"===a||"className"===a)){var l=a.toLowerCase();"defaultValue"===a&&"value"in t&&null==t.value?a="value":"download"===a&&!0===i?i="":"translate"===l&&"no"===i?i=!1:"o"===l[0]&&"n"===l[1]?"ondoubleclick"===l?a="ondblclick":"onchange"!==l||"input"!==n&&"textarea"!==n||at(t.type)?"onfocus"===l?a="onfocusin":"onblur"===l?a="onfocusout":nt.test(a)&&(a=l):l=a="oninput":o&&tt.test(a)?a=a.replace(rt,"-$&").toLowerCase():null===i&&(i=void 0),"oninput"===l&&r[a=l]&&(a="oninputCapture"),r[a]=i}}"select"==n&&(r.multiple&&Array.isArray(r.value)&&(r.value=P(t.children).forEach(function(e){e.props.selected=-1!=r.value.indexOf(e.props.value)})),null!=r.defaultValue&&(r.value=P(t.children).forEach(function(e){e.props.selected=r.multiple?-1!=r.defaultValue.indexOf(e.props.value):r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",ut)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=et,dt&&dt(e)};var pt=t.__r;t.__r=function(e){pt&&pt(e),ct=e.__c};var ht=t.diffed;t.diffed=function(e){ht&&ht(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),ct=null};var ft={ReactCurrentDispatcher:{current:{readContext:function(e){return ct.__n[e.__c].props.value},useCallback:ge,useContext:be,useDebugValue:ye,useDeferredValue:Pe,useEffect:de,useId:ve,useImperativeHandle:fe,useInsertionEffect:Ae,useLayoutEffect:pe,useMemo:me,useReducer:ue,useRef:he,useState:ce,useSyncExternalStore:Ie,useTransition:De}}};function mt(e){return!!e&&e.$$typeof===et}function gt(e){return mt(e)?Y.apply(null,arguments):e}function bt(e){return!!e.__k&&(V(null,e),!0)}var yt={useState:ce,useId:ve,useReducer:ue,useEffect:de,useLayoutEffect:pe,useInsertionEffect:Ae,useTransition:De,useDeferredValue:Pe,useSyncExternalStore:Ie,startTransition:Me,useRef:he,useImperativeHandle:fe,useMemo:me,useCallback:ge,useContext:be,useDebugValue:ye,version:"18.3.1",Children:He,render:it,hydrate:lt,unmountComponentAtNode:bt,createPortal:Je,createElement:w,createContext:Z,createFactory:function(e){return w.bind(null,e)},cloneElement:gt,createRef:function(){return{current:null}},Fragment:_,isValidElement:mt,isElement:mt,isFragment:function(e){return mt(e)&&e.type===_},isMemo:function(e){return!!e&&"string"==typeof e.displayName&&0==e.displayName.indexOf("Memo(")},findDOMNode:function(e){return e&&(e.base||1===e.nodeType&&e)||null},Component:E,PureComponent:Oe,memo:ze,forwardRef:$e,flushSync:function(e,n){var r=t.debounceRendering;t.debounceRendering=function(e){return e()};var o=e(n);return t.debounceRendering=r,o},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:_,Suspense:We,SuspenseList:Ge,lazy:Ze,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:ft};function vt(e){return{render:function(t){it(t,e)},unmount:function(){bt(e)}}}var xt={createRoot:vt,hydrateRoot:function(e,t){return lt(t,e),vt(e)}};const wt=({children:e,isOpen:t,botricView:n="default",mode:r,isExpanded:o=!1})=>{let a="font-sans bg-body-bg shadow-[rgba(0,0,0,0.16)_0_5px_40px] overflow-hidden grid grid-rows-[auto_1fr_auto] gap-0 z-[2147483646]";return a+="modal"===r?" fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[90vw] max-w-[1200px] h-[80vh] max-h-[800px] rounded-xl shadow-[rgba(0,0,0,0.3)_0_10px_60px] opacity-100":"iframe"===n?" fixed bottom-0 right-0 w-full h-full":o?" fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[90vw] max-w-[1200px] h-[80vh] max-h-[800px] rounded-xl shadow-[rgba(0,0,0,0.3)_0_10px_60px]":" fixed bottom-8 right-8 w-[400px] h-[min(704px,calc(100%-104px))] rounded-lg animate-size-expand origin-bottom-right max-[500px]:w-full max-[500px]:h-full max-[500px]:bottom-0 max-[500px]:right-0 max-[500px]:rounded-none",yt.createElement("div",{className:a},e)};function kt(){return kt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kt.apply(null,arguments)}const _t=({children:e,className:t="",...n})=>yt.createElement("button",kt({className:`p-0 bg-transparent border-none text-header-fg text-xl cursor-pointer justify-self-center ${t}`},n),e);function Et({children:e,content:t,placement:n="top"}){const[r,o]=ce(!1);return yt.createElement("div",{className:"relative inline-block",onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1)},e,r&&yt.createElement("div",{className:"bg-gray-800 text-white py-2 px-3 rounded text-sm z-2147483646 absolute whitespace-nowrap pointer-events-none",style:{top:{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:8},bottom:{top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:8},left:{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:8},right:{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:8}}[n]},t))}
/**
	 * @license lucide-react v0.554.0 - ISC
	 *
	 * This source code is licensed under the ISC license.
	 * See the LICENSE file in the root directory of this source tree.
	 */const St=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ct=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},Nt=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),Tt=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
/**
	 * @license lucide-react v0.554.0 - ISC
	 *
	 * This source code is licensed under the ISC license.
	 * See the LICENSE file in the root directory of this source tree.
	 */
var It={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
/**
	 * @license lucide-react v0.554.0 - ISC
	 *
	 * This source code is licensed under the ISC license.
	 * See the LICENSE file in the root directory of this source tree.
	 */const Lt=$e(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:a,iconNode:i,...l},s)=>w("svg",{ref:s,...It,width:t,height:t,stroke:e,strokeWidth:r?24*Number(n)/Number(t):n,className:Nt("lucide",o),...!a&&!Tt(l)&&{"aria-hidden":"true"},...l},[...i.map(([e,t])=>w(e,t)),...Array.isArray(a)?a:[a]])),Mt=(e,t)=>{const n=$e(({className:n,...r},o)=>w(Lt,{ref:o,iconNode:t,className:Nt(`lucide-${St(Ct(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Ct(e),n},Pt=Mt("calendar-days",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]),Dt=Mt("calendar-search",[["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 11.75V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.25",key:"1jrsq6"}],["path",{d:"m22 22-1.875-1.875",key:"13zax7"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]),At=Mt("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Ot=Mt("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),zt=Mt("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Rt=Mt("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),Ft=Mt("circle-user",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]),$t=Mt("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),jt=Mt("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),Ht=Mt("message-circle",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]),Bt=Mt("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),qt=Mt("ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]),Ut=Mt("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);
/**
	 * @license lucide-react v0.554.0 - ISC
	 *
	 * This source code is licensed under the ISC license.
	 * See the LICENSE file in the root directory of this source tree.
	 */function Vt({chatbotData:e,handleOpen:t,createNewSession:n,resetMessages:r,botricView:o,isExpanded:a,onToggleExpanded:i}){const[l,s]=ce(!1),c=he(null);return de(()=>{const e=e=>{c.current&&!c.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),yt.createElement("header",{className:"bg-header-bg border-b border-black/10 p-4 flex justify-between items-center row-start-1 row-end-1 h-fit"},yt.createElement("div",{className:"flex items-center gap-2"},e?.design?.icon&&yt.createElement("img",{src:e.design.icon,alt:"Chatbot Icon",className:"w-8 h-8 object-cover rounded-full"}),yt.createElement("p",{className:"text-lg leading-normal max-w-[300px] font-semibold font-sans text-header-fg"},e?.name?e.name:"")),yt.createElement("div",{className:"flex items-center gap-3"},"floating"===e?.design?.viewMode&&yt.createElement(Et,{content:a?"Collapse":"Expand",placement:"bottom"},yt.createElement(_t,{onClick:i},yt.createElement("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},yt.createElement("path",{d:"M1.4 20L0 18.6L6.6 12H2V10H10V18H8V13.4L1.4 20ZM10 10V2H12V6.6L18.6 0L20 1.4L13.4 8H18V10H10Z",fill:"var(--header-fg, #374151)"})))),"default"===o&&yt.createElement(Et,{content:"Close",placement:"bottom"},yt.createElement(_t,{onClick:t(!1)},yt.createElement(Ut,{size:20,stroke:"var(--header-fg, #374151)",strokeWidth:2}))),yt.createElement("div",{className:"relative",ref:c},yt.createElement(Et,{content:"More options",placement:"bottom"},yt.createElement(_t,{onClick:()=>s(!l)},yt.createElement(jt,{size:20,stroke:"var(--header-fg, #374151)",strokeWidth:2}))),l&&yt.createElement("div",{className:"absolute right-0 top-full mt-2 w-40 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50"},yt.createElement("button",{onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),(()=>{const e=localStorage.getItem("infoSubmitted");localStorage.clear(),e&&localStorage.setItem("infoSubmitted",e),n(),r(),s(!1)})()},className:"w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-100 flex items-center gap-2"},yt.createElement(Bt,{size:16,stroke:"currentColor",strokeWidth:2}),"Restart Chat")))))}const Wt=e=>{const t=new Date(e);let n=t.getHours();const r=n>=12?"PM":"AM";return n=n%12||12,`${n}:${t.getMinutes().toString().padStart(2,"0")} ${r}`},Yt=e=>{if(!e)return!1;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(e).toLowerCase())};btoa('<svg width="3" height="3" xmlns="http://www.w3.org/2000/svg"><path fill="black" d="m 0 3 L 1 3 L 3 3 C 2 3 0 1 0 0"/></svg>'),btoa('<svg width="3" height="3" xmlns="http://www.w3.org/2000/svg"><path fill="black" d="m 3 3 L 2 3 L 0 3 C 1 3 3 1 3 0"/></svg>');const Zt="USER",Gt="BOT",Qt="SYSTEM",Kt=({sender:e,children:t})=>{const n=e===Zt,r=he(null),o=he(null);de(()=>{const e=o.current,t=r.current;if(!e||!t)return;const n=new ResizeObserver(()=>{t.style.height=`${e.offsetHeight}px`});return n.observe(e),()=>n.disconnect()},[]);return yt.createElement("div",{ref:r,className:"break-words w-fit max-w-[85%] rounded-[12px] animate-fade-in relative whitespace-pre-wrap font-normal font-sans text-base leading-normal transition-[height] duration-200 ease-out overflow-hidden "+(n?"bg-bubble-user-bg text-bubble-user-fg":"bg-bubble-bot-bg text-bubble-bot-fg")},yt.createElement("div",{ref:o,className:"py-3 px-4"},t))},Xt=({questions:e=[],onQuestionClick:t})=>w(_,null,!!e.length&&w("div",{className:"absolute bottom-6 right-6 flex flex-wrap gap-2 max-w-[320px] justify-end z-20 max-[480px]:bottom-4 max-[480px]:right-4 max-[480px]:max-w-[calc(100%-32px)] max-[480px]:justify-center"},e.map((e,n)=>w("button",{key:n,onClick:()=>t?.(e),className:"bg-chatbot-primary/5 border border-chatbot-primary/20 py-2.5 px-4 rounded-full text-sm font-medium text-bubble-bot-fg cursor-pointer transition-all duration-200 shadow-sm whitespace-normal break-words hover:bg-chatbot-primary hover:text-white max-[480px]:py-2 max-[480px]:px-3 max-[480px]:text-[13px]"},e)))),Jt=function(e){if(null==e)return tn;if("function"==typeof e)return en(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Jt(e[n]);return en(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}(e):function(e){const t=e;return en(n);function n(n){const r=n;let o;for(o in e)if(r[o]!==t[o])return!1;return!0}}(e);if("string"==typeof e)return function(e){return en(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function en(e){return function(t,n,r){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function tn(){return!0}const nn=[],rn=!0,on=!1,an="skip";function ln(e,t,n,r){let o;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):o=t;const a=Jt(o),i=r?-1:1;!function e(o,l,s){const c=o&&"object"==typeof o?o:{};if("string"==typeof c.type){const e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(u,"name",{value:"node ("+o.type+(e?"<"+e+">":"")+")"})}return u;function u(){let c,u,d,p=nn;if((!t||a(o,l,s[s.length-1]||void 0))&&(p=function(e){if(Array.isArray(e))return e;if("number"==typeof e)return[rn,e];return null==e?nn:[e]}(n(o,s)),p[0]===on))return p;if("children"in o&&o.children){const t=o;if(t.children&&p[0]!==an)for(u=(r?t.children.length:-1)+i,d=s.concat(t);u>-1&&u<t.children.length;){const n=t.children[u];if(c=e(n,u,d)(),c[0]===on)return c;u="number"==typeof c[1]?c[1]:u+i}}return p}}(e,void 0,[])()}function sn(e,t,n,r){let o,a,i;"function"==typeof t&&"function"!=typeof n?(a=void 0,i=t,o=n):(a=t,i=n,o=r),ln(e,a,function(e,t){const n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return i(e,r,n)},o)}const cn="indicator",un="text-only",dn="remove";function pn(e,t){if("string"!=typeof e)return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))try{return new URL(e,"http://example.com")}catch{return null}return null}}const hn=new Set(["https:","http:","irc:","ircs:","mailto:","xmpp:","blob:"]),fn=new Set(["javascript:","data:","file:","vbscript:"]);function mn(e,t,n,r=!1,o=!1,a=[]){if(!e)return null;if("string"==typeof e&&e.startsWith("#")&&!o)try{if(new URL(e,"http://example.com").hash===e)return e}catch{}if("string"==typeof e&&e.startsWith("data:"))return o&&r&&e.startsWith("data:image/")?e:null;if("string"==typeof e&&e.startsWith("blob:")){try{if("blob:"===new URL(e).protocol&&e.length>5){const t=e.substring(5);if(t&&t.length>0&&"invalid"!==t)return e}}catch{return null}return null}const i=pn(e,n);if(!i)return null;if(fn.has(i.protocol))return null;if(!(hn.has(i.protocol)||a.includes(i.protocol)||a.includes("*")))return null;if("mailto:"===i.protocol||!i.protocol.match(/^https?:$/))return i.href;const l=function(e){return"string"==typeof e&&(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))}(e);return i&&t.some(e=>{const t=pn(e,n);return!!t&&(t.origin===i.origin&&i.href.startsWith(t.href))})?l?i.pathname+i.search+i.hash:i.href:t.includes("*")?"https:"!==i.protocol&&"http:"!==i.protocol?null:l?i.pathname+i.search+i.hash:i.href:null}function gn(e){if("children"in e&&Array.isArray(e.children)){e.children=e.children.filter(e=>null!=e);for(const t of e.children)gn(t)}}const bn=Symbol("node-seen");const yn=(e,t,n,r,o,a,i,l,s)=>{const c=(u,d,p)=>{if("element"!==u.type||u[bn])return rn;if("a"===u.tagName){const n=mn(u.properties.href,t,e,!1,!1,o);if(null===n){if(u[bn]=!0,sn(u,c),p&&"number"==typeof d){const e=function(e,t,n){return t===dn?{type:"remove"}:t===un?{type:"replace",element:{type:"element",tagName:"span",properties:{},children:[...e.children]}}:{type:"replace",element:{type:"element",tagName:"span",properties:{title:"Blocked URL: "+String(e.properties.href),class:n},children:[...e.children,{type:"text",value:" [blocked]"}]}}}(u,l,i);if("remove"===e.type)return p.children.splice(d,1),[an,d];p.children[d]=e.element}return an}return u.properties.href=n,u.properties.target="_blank",u.properties.rel="noopener noreferrer",rn}if("img"===u.tagName){const t=mn(u.properties.src,n,e,r,!0,o);if(null===t){if(u[bn]=!0,sn(u,c),p&&"number"==typeof d){const e=function(e,t,n){if(t===dn)return{type:"remove"};if(t===un){const t=String(e.properties.alt||"");return t?{type:"replace",element:{type:"element",tagName:"span",properties:{},children:[{type:"text",value:t}]}}:{type:"remove"}}return{type:"replace",element:{type:"element",tagName:"span",properties:{class:n},children:[{type:"text",value:"[Image blocked: "+String(e.properties.alt||"No description")+"]"}]}}}(u,s,a);if("remove"===e.type)return p.children.splice(d,1),[an,d];p.children[d]=e.element}return an}return u.properties.src=t,rn}return rn};return c};function vn(){return e=>e}const xn="object"==typeof self?self:globalThis,wn=e=>((e,t)=>{const n=(t,n)=>(e.set(n,t),t),r=o=>{if(e.has(o))return e.get(o);const[a,i]=t[o];switch(a){case 0:case-1:return n(i,o);case 1:{const e=n([],o);for(const t of i)e.push(r(t));return e}case 2:{const e=n({},o);for(const[t,n]of i)e[r(t)]=r(n);return e}case 3:return n(new Date(i),o);case 4:{const{source:e,flags:t}=i;return n(new RegExp(e,t),o)}case 5:{const e=n(new Map,o);for(const[t,n]of i)e.set(r(t),r(n));return e}case 6:{const e=n(new Set,o);for(const t of i)e.add(r(t));return e}case 7:{const{name:e,message:t}=i;return n(new xn[e](t),o)}case 8:return n(BigInt(i),o);case"BigInt":return n(Object(BigInt(i)),o);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:e}=new Uint8Array(i);return n(new DataView(e),i)}}return n(new xn[a](i),o)};return r})(new Map,e)(0),kn="",{toString:_n}={},{keys:En}=Object,Sn=e=>{const t=typeof e;if("object"!==t||!e)return[0,t];const n=_n.call(e).slice(8,-1);switch(n){case"Array":return[1,kn];case"Object":return[2,kn];case"Date":return[3,kn];case"RegExp":return[4,kn];case"Map":return[5,kn];case"Set":return[6,kn];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},Cn=([e,t])=>0===e&&("function"===t||"symbol"===t),Nn=(e,{json:t,lossy:n}={})=>{const r=[];return((e,t,n,r)=>{const o=(e,t)=>{const o=r.push(e)-1;return n.set(t,o),o},a=r=>{if(n.has(r))return n.get(r);let[i,l]=Sn(r);switch(i){case 0:{let t=r;switch(l){case"bigint":i=8,t=r.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);t=null;break;case"undefined":return o([-1],r)}return o([i,t],r)}case 1:{if(l){let e=r;return"DataView"===l?e=new Uint8Array(r.buffer):"ArrayBuffer"===l&&(e=new Uint8Array(r)),o([l,[...e]],r)}const e=[],t=o([i,e],r);for(const t of r)e.push(a(t));return t}case 2:{if(l)switch(l){case"BigInt":return o([l,r.toString()],r);case"Boolean":case"Number":case"String":return o([l,r.valueOf()],r)}if(t&&"toJSON"in r)return a(r.toJSON());const n=[],s=o([i,n],r);for(const t of En(r))!e&&Cn(Sn(r[t]))||n.push([a(t),a(r[t])]);return s}case 3:return o([i,r.toISOString()],r);case 4:{const{source:e,flags:t}=r;return o([i,{source:e,flags:t}],r)}case 5:{const t=[],n=o([i,t],r);for(const[n,o]of r)(e||!Cn(Sn(n))&&!Cn(Sn(o)))&&t.push([a(n),a(o)]);return n}case 6:{const t=[],n=o([i,t],r);for(const n of r)!e&&Cn(Sn(n))||t.push(a(n));return n}}const{message:s}=r;return o([i,{name:l,message:s}],r)};return a})(!(t||n),!!t,new Map,r)(e),r};var Tn="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?wn(Nn(e,t)):structuredClone(e):(e,t)=>wn(Nn(e,t));const In=Mn("end"),Ln=Mn("start");function Mn(e){return function(t){const n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function Pn(e){const t=Ln(e),n=In(e);if(t&&n)return{start:t,end:n}}const Dn=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],An={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...Dn,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...Dn],h2:[["className","sr-only"]],img:[...Dn,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...Dn,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...Dn],table:[...Dn],ul:[...Dn,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},On={}.hasOwnProperty;function zn(e,t){if(t&&"object"==typeof t){const n=t;switch("string"==typeof n.type?n.type:""){case"comment":return function(e,t){if(e.schema.allowComments){const e="string"==typeof t.value?t.value:"",n=e.indexOf("--\x3e"),r={type:"comment",value:n<0?e:e.slice(0,n)};return jn(r,t),r}}(e,n);case"doctype":return function(e,t){if(e.schema.allowDoctypes){const e={type:"doctype"};return jn(e,t),e}}(e,n);case"element":return function(e,t){const n="string"==typeof t.tagName?t.tagName:"";e.stack.push(n);const r=Rn(e,t.children),o=function(e,t){const n=e.stack[e.stack.length-1],r=e.schema.attributes,o=e.schema.required,a=r&&On.call(r,n)?r[n]:void 0,i=r&&On.call(r,"*")?r["*"]:void 0,l=t&&"object"==typeof t?t:{},s={};let c;for(c in l)if(On.call(l,c)){const t=l[c];let n=Fn(e,Hn(a,c),c,t);null==n&&(n=Fn(e,Hn(i,c),c,t)),null!=n&&(s[c]=n)}if(o&&On.call(o,n)){const e=o[n];for(c in e)On.call(e,c)&&!On.call(s,c)&&(s[c]=e[c])}return s}(e,t.properties);e.stack.pop();let a=!1;if(n&&"*"!==n&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(a=!0,e.schema.ancestors&&On.call(e.schema.ancestors,n))){const t=e.schema.ancestors[n];let r=-1;for(a=!1;++r<t.length;)e.stack.includes(t[r])&&(a=!0)}if(!a)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;const i={type:"element",tagName:n,properties:o,children:r};return jn(i,t),i}(e,n);case"root":return function(e,t){const n=Rn(e,t.children),r={type:"root",children:n};return jn(r,t),r}(e,n);case"text":return function(e,t){const n="string"==typeof t.value?t.value:"",r={type:"text",value:n};return jn(r,t),r}(0,n)}}}function Rn(e,t){const n=[];if(Array.isArray(t)){const r=t;let o=-1;for(;++o<r.length;){const t=zn(e,r[o]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function Fn(e,t,n,r){return t?Array.isArray(r)?function(e,t,n,r){let o=-1;const a=[];for(;++o<r.length;){const i=$n(e,t,n,r[o]);"number"!=typeof i&&"string"!=typeof i||a.push(i)}return a}(e,t,n,r):$n(e,t,n,r):void 0}function $n(e,t,n,r){if(("boolean"==typeof r||"number"==typeof r||"string"==typeof r)&&function(e,t,n){const r=e.schema.protocols&&On.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||0===r.length)return!0;const o=String(n),a=o.indexOf(":"),i=o.indexOf("?"),l=o.indexOf("#"),s=o.indexOf("/");if(a<0||s>-1&&a>s||i>-1&&a>i||l>-1&&a>l)return!0;let c=-1;for(;++c<r.length;){const e=r[c];if(a===e.length&&o.slice(0,e.length)===e)return!0}return!1}(e,n,r)){if("object"==typeof t&&t.length>1){let e=!1,n=0;for(;++n<t.length;){const o=t[n];if(o&&"object"==typeof o&&"flags"in o){if(o.test(String(r))){e=!0;break}}else if(o===r){e=!0;break}}if(!e)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function jn(e,t){const n=Pn(t);t.data&&(e.data=Tn(t.data)),n&&(e.position=n)}function Hn(e,t){let n,r=-1;if(e)for(;++r<e.length;){const o=e[r],a="string"==typeof o?o:o[0];if(a===t)return o;"data*"===a&&(n=o)}if(t.length>4&&"data"===t.slice(0,4).toLowerCase())return n}function Bn(e){return function(t){const n=function(e,t){let n={type:"root",children:[]};const r=zn({schema:t?{...An,...t}:An,stack:[]},e);return r&&(Array.isArray(r)?1===r.length?n=r[0]:n.children=r:n=r),n}(t,e);return n}}function qn(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,o=n.indexOf(t);for(;-1!==o;)r++,o=n.indexOf(t,o+t.length);return r}function Un(){}const Vn=rr(/[A-Za-z]/),Wn=rr(/[\dA-Za-z]/),Yn=rr(/[#-'*+\--9=?A-Z^-~]/);function Zn(e){return null!==e&&(e<32||127===e)}const Gn=rr(/\d/),Qn=rr(/[\dA-Fa-f]/),Kn=rr(/[!-/:-@[-`{-~]/);function Xn(e){return null!==e&&e<-2}function Jn(e){return null!==e&&(e<0||32===e)}function er(e){return-2===e||-1===e||32===e}const tr=rr(/\p{P}|\p{S}/u),nr=rr(/\s/);function rr(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function or(e,t,n){const r=Jt((n||{}).ignore||[]),o=function(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const e=n[r];t.push([ar(e[0]),ir(e[1])])}return t}(t);let a=-1;for(;++a<o.length;)ln(e,"text",i);function i(e,t){let n,i=-1;for(;++i<t.length;){const e=t[i],o=n?n.children:void 0;if(r(e,o?o.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){const n=t[t.length-1],r=o[a][0],i=o[a][1];let l=0;const s=n.children.indexOf(e);let c=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){const n=d.index,o={index:d.index,input:d.input,stack:[...t,e]};let a=i(...d,o);if("string"==typeof a&&(a=a.length>0?{type:"text",value:a}:void 0),!1===a?r.lastIndex=n+1:(l!==n&&u.push({type:"text",value:e.value.slice(l,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),l=n+d[0].length,c=!0),!r.global)break;d=r.exec(e.value)}c?(l<e.value.length&&u.push({type:"text",value:e.value.slice(l)}),n.children.splice(s,1,...u)):u=[e];return s+u.length}(e,t)}}function ar(e){return"string"==typeof e?new RegExp(function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e}function ir(e){return"function"==typeof e?e:function(){return e}}const lr="phrasing",sr=["autolink","link","image","label"];function cr(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ur(e){this.config.enter.autolinkProtocol.call(this,e)}function dr(e){this.config.exit.autolinkProtocol.call(this,e)}function pr(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function hr(e){this.config.exit.autolinkEmail.call(this,e)}function fr(e){this.exit(e)}function mr(e){or(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,gr],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,br]],{ignore:["link","linkReference"]})}function gr(e,t,n,r,o){let a="";if(!yr(o))return!1;if(/^w/i.test(t)&&(n=t+n,t="",a="http://"),!function(e){const t=e.split(".");if(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))return!1;return!0}(n))return!1;const i=function(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const o=qn(e,"(");let a=qn(e,")");for(;-1!==r&&o>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),a++;return[e,n]}(n+r);if(!i[0])return!1;const l={type:"link",title:null,url:a+t+i[0],children:[{type:"text",value:t+i[0]}]};return i[1]?[l,{type:"text",value:i[1]}]:l}function br(e,t,n,r){return!(!yr(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function yr(e,t){const n=e.input.charCodeAt(e.index-1);return(0===e.index||nr(n)||tr(n))&&(!t||47!==n)}function vr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}function xr(){this.buffer()}function wr(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function kr(){this.buffer()}function _r(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Er(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Sr(e){this.exit(e)}function Cr(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Nr(e){this.exit(e)}function Tr(e,t,n,r){const o=n.createTracker(r);let a=o.move("[^");const i=n.enter("footnoteReference"),l=n.enter("reference");return a+=o.move(n.safe(n.associationId(e),{after:"]",before:a})),l(),i(),a+=o.move("]"),a}function Ir(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:function(e,n,r,o){const a=r.createTracker(o);let i=a.move("[^");const l=r.enter("footnoteDefinition"),s=r.enter("label");i+=a.move(r.safe(r.associationId(e),{before:i,after:"]"})),s(),i+=a.move("]:"),e.children&&e.children.length>0&&(a.shift(4),i+=a.move((t?"\n":" ")+r.indentLines(r.containerFlow(e,a.current()),t?Mr:Lr)));return l(),i},footnoteReference:Tr},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}}function Lr(e,t,n){return 0===t?e:Mr(e,t,n)}function Mr(e,t,n){return(n?"":"    ")+e}Tr.peek=function(){return"["};const Pr=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function Dr(e){this.enter({type:"delete",children:[]},e)}function Ar(e){this.exit(e)}function Or(e,t,n,r){const o=n.createTracker(r),a=n.enter("strikethrough");let i=o.move("~~");return i+=n.containerPhrasing(e,{...o.current(),before:i,after:"~"}),i+=o.move("~~"),a(),i}function zr(e){return e.length}function Rr(e){return null==e?"":String(e)}function Fr(e){const t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:82===t||114===t?114:0}function $r(e,t,n){return">"+(n?"":" ")+e}function jr(e,t){return Hr(e,t.inConstruct,!0)&&!Hr(e,t.notInConstruct,!1)}function Hr(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Br(e,t,n,r){let o=-1;for(;++o<n.unsafe.length;)if("\n"===n.unsafe[o].character&&jr(n.stack,n.unsafe[o]))return/[ \t]/.test(r.before)?"":" ";return"\\\n"}function qr(e,t,n){return(n?"":"    ")+e}function Ur(e){const t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Vr(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Wr(e){return null===e||Jn(e)||nr(e)?1:tr(e)?2:void 0}function Yr(e,t,n){const r=Wr(e),o=Wr(t);return void 0===r?void 0===o?"_"===n?{inside:!0,outside:!0}:{inside:!1,outside:!1}:1===o?{inside:!0,outside:!0}:{inside:!1,outside:!0}:1===r?void 0===o?{inside:!1,outside:!1}:1===o?{inside:!0,outside:!0}:{inside:!1,outside:!1}:void 0===o?{inside:!1,outside:!1}:1===o?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function Zr(e,t,n,r){const o=function(e){const t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(n),a=n.enter("emphasis"),i=n.createTracker(r),l=i.move(o);let s=i.move(n.containerPhrasing(e,{after:o,before:l,...i.current()}));const c=s.charCodeAt(0),u=Yr(r.before.charCodeAt(r.before.length-1),c,o);u.inside&&(s=Vr(c)+s.slice(1));const d=s.charCodeAt(s.length-1),p=Yr(r.after.charCodeAt(0),d,o);p.inside&&(s=s.slice(0,-1)+Vr(d));const h=i.move(o);return a(),n.attentionEncodeSurroundingInfo={after:p.outside,before:u.outside},l+s+h}Or.peek=function(){return"~"},Zr.peek=function(e,t,n){return n.options.emphasis||"*"};const Gr={};function Qr(e,t){const n=t||Gr;return Kr(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function Kr(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Xr(e.children,t,n)}return Array.isArray(e)?Xr(e,t,n):""}function Xr(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=Kr(e[o],t,n);return r.join("")}function Jr(e){return e.value||""}function eo(e,t,n,r){const o=Ur(n),a='"'===o?"Quote":"Apostrophe",i=n.enter("image");let l=n.enter("label");const s=n.createTracker(r);let c=s.move("![");return c+=s.move(n.safe(e.alt,{before:c,after:"]",...s.current()})),c+=s.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=s.move("<"),c+=s.move(n.safe(e.url,{before:c,after:">",...s.current()})),c+=s.move(">")):(l=n.enter("destinationRaw"),c+=s.move(n.safe(e.url,{before:c,after:e.title?" ":")",...s.current()}))),l(),e.title&&(l=n.enter(`title${a}`),c+=s.move(" "+o),c+=s.move(n.safe(e.title,{before:c,after:o,...s.current()})),c+=s.move(o),l()),c+=s.move(")"),i(),c}function to(e,t,n,r){const o=e.referenceType,a=n.enter("imageReference");let i=n.enter("label");const l=n.createTracker(r);let s=l.move("![");const c=n.safe(e.alt,{before:s,after:"]",...l.current()});s+=l.move(c+"]["),i();const u=n.stack;n.stack=[],i=n.enter("reference");const d=n.safe(n.associationId(e),{before:s,after:"]",...l.current()});return i(),n.stack=u,a(),"full"!==o&&c&&c===d?"shortcut"===o?s=s.slice(0,-1):s+=l.move("]"):s+=l.move(d+"]"),s}function no(e,t,n){let r=e.value||"",o="`",a=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){const e=n.unsafe[a],t=n.compilePattern(e);let o;if(e.atBreak)for(;o=t.exec(r);){let e=o.index;10===r.charCodeAt(e)&&13===r.charCodeAt(e-1)&&e--,r=r.slice(0,e)+" "+r.slice(o.index+1)}}return o+r+o}function ro(e,t){const n=Qr(e);return Boolean(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function oo(e,t,n,r){const o=Ur(n),a='"'===o?"Quote":"Apostrophe",i=n.createTracker(r);let l,s;if(ro(e,n)){const t=n.stack;n.stack=[],l=n.enter("autolink");let r=i.move("<");return r+=i.move(n.containerPhrasing(e,{before:r,after:">",...i.current()})),r+=i.move(">"),l(),n.stack=t,r}l=n.enter("link"),s=n.enter("label");let c=i.move("[");return c+=i.move(n.containerPhrasing(e,{before:c,after:"](",...i.current()})),c+=i.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),c+=i.move("<"),c+=i.move(n.safe(e.url,{before:c,after:">",...i.current()})),c+=i.move(">")):(s=n.enter("destinationRaw"),c+=i.move(n.safe(e.url,{before:c,after:e.title?" ":")",...i.current()}))),s(),e.title&&(s=n.enter(`title${a}`),c+=i.move(" "+o),c+=i.move(n.safe(e.title,{before:c,after:o,...i.current()})),c+=i.move(o),s()),c+=i.move(")"),l(),c}function ao(e,t,n,r){const o=e.referenceType,a=n.enter("linkReference");let i=n.enter("label");const l=n.createTracker(r);let s=l.move("[");const c=n.containerPhrasing(e,{before:s,after:"]",...l.current()});s+=l.move(c+"]["),i();const u=n.stack;n.stack=[],i=n.enter("reference");const d=n.safe(n.associationId(e),{before:s,after:"]",...l.current()});return i(),n.stack=u,a(),"full"!==o&&c&&c===d?"shortcut"===o?s=s.slice(0,-1):s+=l.move("]"):s+=l.move(d+"]"),s}function io(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function lo(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}Jr.peek=function(){return"<"},eo.peek=function(){return"!"},to.peek=function(){return"!"},no.peek=function(){return"`"},oo.peek=function(e,t,n){return ro(e,n)?"<":"["},ao.peek=function(){return"["};const so=Jt(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function co(e,t,n,r){const o=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(n),a=n.enter("strong"),i=n.createTracker(r),l=i.move(o+o);let s=i.move(n.containerPhrasing(e,{after:o,before:l,...i.current()}));const c=s.charCodeAt(0),u=Yr(r.before.charCodeAt(r.before.length-1),c,o);u.inside&&(s=Vr(c)+s.slice(1));const d=s.charCodeAt(s.length-1),p=Yr(r.after.charCodeAt(0),d,o);p.inside&&(s=s.slice(0,-1)+Vr(d));const h=i.move(o+o);return a(),n.attentionEncodeSurroundingInfo={after:p.outside,before:u.outside},l+s+h}co.peek=function(e,t,n){return n.options.strong||"*"};const uo={blockquote:function(e,t,n,r){const o=n.enter("blockquote"),a=n.createTracker(r);a.move("> "),a.shift(2);const i=n.indentLines(n.containerFlow(e,a.current()),$r);return o(),i},break:Br,code:function(e,t,n,r){const o=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(n),a=e.value||"",i="`"===o?"GraveAccent":"Tilde";if(function(e,t){return Boolean(!1===t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}(e,n)){const e=n.enter("codeIndented"),t=n.indentLines(a,qr);return e(),t}const l=n.createTracker(r),s=o.repeat(Math.max(function(e,t){const n=String(e);let r=n.indexOf(t),o=r,a=0,i=0;if("string"!=typeof t)throw new TypeError("Expected substring");for(;-1!==r;)r===o?++a>i&&(i=a):a=1,o=r+t.length,r=n.indexOf(t,o);return i}(a,o)+1,3)),c=n.enter("codeFenced");let u=l.move(s);if(e.lang){const t=n.enter(`codeFencedLang${i}`);u+=l.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...l.current()})),t()}if(e.lang&&e.meta){const t=n.enter(`codeFencedMeta${i}`);u+=l.move(" "),u+=l.move(n.safe(e.meta,{before:u,after:"\n",encode:["`"],...l.current()})),t()}return u+=l.move("\n"),a&&(u+=l.move(a+"\n")),u+=l.move(s),c(),u},definition:function(e,t,n,r){const o=Ur(n),a='"'===o?"Quote":"Apostrophe",i=n.enter("definition");let l=n.enter("label");const s=n.createTracker(r);let c=s.move("[");return c+=s.move(n.safe(n.associationId(e),{before:c,after:"]",...s.current()})),c+=s.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=s.move("<"),c+=s.move(n.safe(e.url,{before:c,after:">",...s.current()})),c+=s.move(">")):(l=n.enter("destinationRaw"),c+=s.move(n.safe(e.url,{before:c,after:e.title?" ":"\n",...s.current()}))),l(),e.title&&(l=n.enter(`title${a}`),c+=s.move(" "+o),c+=s.move(n.safe(e.title,{before:c,after:o,...s.current()})),c+=s.move(o),l()),i(),c},emphasis:Zr,hardBreak:Br,heading:function(e,t,n,r){const o=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(function(e,t){let n=!1;return sn(e,function(e){if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return n=!0,on}),Boolean((!e.depth||e.depth<3)&&Qr(e)&&(t.options.setext||n))}(e,n)){const t=n.enter("headingSetext"),r=n.enter("phrasing"),i=n.containerPhrasing(e,{...a.current(),before:"\n",after:"\n"});return r(),t(),i+"\n"+(1===o?"=":"-").repeat(i.length-(Math.max(i.lastIndexOf("\r"),i.lastIndexOf("\n"))+1))}const i="#".repeat(o),l=n.enter("headingAtx"),s=n.enter("phrasing");a.move(i+" ");let c=n.containerPhrasing(e,{before:"# ",after:"\n",...a.current()});return/^[\t ]/.test(c)&&(c=Vr(c.charCodeAt(0))+c.slice(1)),c=c?i+" "+c:i,n.options.closeAtx&&(c+=" "+i),s(),l(),c},html:Jr,image:eo,imageReference:to,inlineCode:no,link:oo,linkReference:ao,list:function(e,t,n,r){const o=n.enter("list"),a=n.bulletCurrent;let i=e.ordered?function(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}(n):io(n);const l=e.ordered?"."===i?")":".":function(e){const t=io(e),n=e.options.bulletOther;if(!n)return"*"===t?"-":"*";if("*"!==n&&"+"!==n&&"-"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}(n);let s=!(!t||!n.bulletLastUsed)&&i===n.bulletLastUsed;if(!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==i&&"-"!==i||!t||t.children&&t.children[0]||"list"!==n.stack[n.stack.length-1]||"listItem"!==n.stack[n.stack.length-2]||"list"!==n.stack[n.stack.length-3]||"listItem"!==n.stack[n.stack.length-4]||0!==n.indexStack[n.indexStack.length-1]||0!==n.indexStack[n.indexStack.length-2]||0!==n.indexStack[n.indexStack.length-3]||(s=!0),lo(n)===i&&t){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n&&"listItem"===n.type&&n.children&&n.children[0]&&"thematicBreak"===n.children[0].type){s=!0;break}}}}s&&(i=l),n.bulletCurrent=i;const c=n.containerFlow(e,r);return n.bulletLastUsed=i,n.bulletCurrent=a,o(),c},listItem:function(e,t,n,r){const o=function(e){const t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let a=n.bulletCurrent||io(n);t&&"list"===t.type&&t.ordered&&(a=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+a);let i=a.length+1;("tab"===o||"mixed"===o&&(t&&"list"===t.type&&t.spread||e.spread))&&(i=4*Math.ceil(i/4));const l=n.createTracker(r);l.move(a+" ".repeat(i-a.length)),l.shift(i);const s=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,l.current()),function(e,t,n){if(t)return(n?"":" ".repeat(i))+e;return(n?a:a+" ".repeat(i-a.length))+e});return s(),c},paragraph:function(e,t,n,r){const o=n.enter("paragraph"),a=n.enter("phrasing"),i=n.containerPhrasing(e,r);return a(),o(),i},root:function(e,t,n,r){const o=e.children.some(function(e){return so(e)});return(o?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:co,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){const r=(lo(n)+(n.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(n));return n.options.ruleSpaces?r.slice(0,-1):r}},po=document.createElement("i");function ho(e){const t="&"+e+";";po.innerHTML=t;const n=po.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&(n!==t&&n)}function fo(e,t){const n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"�":String.fromCodePoint(n)}const mo=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function go(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return fo(n.slice(t?2:1),t?16:10)}return ho(n)||e}function bo(e){const t=e._align;this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function yo(e){this.exit(e),this.data.inTable=void 0}function vo(e){this.enter({type:"tableRow",children:[]},e)}function xo(e){this.exit(e)}function wo(e){this.enter({type:"tableCell",children:[]},e)}function ko(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,_o));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function _o(e,t){return"|"===t?t:e}function Eo(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,o=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=uo.inlineCode(e,t,n);n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&"));return r},table:function(e,t,n,r){return l(function(e,t,n){const r=e.children;let o=-1;const a=[],i=t.enter("table");for(;++o<r.length;)a[o]=s(r[o],t,n);return i(),a}(e,n,r),e.align)},tableCell:i,tableRow:function(e,t,n,r){const o=s(e,n,r),a=l([o]);return a.slice(0,a.indexOf("\n"))}}};function i(e,t,n,r){const o=n.enter("tableCell"),i=n.enter("phrasing"),l=n.containerPhrasing(e,{...r,before:a,after:a});return i(),o(),l}function l(e,t){return function(e,t){const n=t||{},r=(n.align||[]).concat(),o=n.stringLength||zr,a=[],i=[],l=[],s=[];let c=0,u=-1;for(;++u<e.length;){const t=[],r=[];let a=-1;for(e[u].length>c&&(c=e[u].length);++a<e[u].length;){const i=Rr(e[u][a]);if(!1!==n.alignDelimiters){const e=o(i);r[a]=e,(void 0===s[a]||e>s[a])&&(s[a]=e)}t.push(i)}i[u]=t,l[u]=r}let d=-1;if("object"==typeof r&&"length"in r)for(;++d<c;)a[d]=Fr(r[d]);else{const e=Fr(r);for(;++d<c;)a[d]=e}d=-1;const p=[],h=[];for(;++d<c;){const e=a[d];let t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let o=!1===n.alignDelimiters?1:Math.max(1,s[d]-t.length-r.length);const i=t+"-".repeat(o)+r;!1!==n.alignDelimiters&&(o=t.length+o+r.length,o>s[d]&&(s[d]=o),h[d]=o),p[d]=i}i.splice(1,0,p),l.splice(1,0,h),u=-1;const f=[];for(;++u<i.length;){const e=i[u],t=l[u];d=-1;const r=[];for(;++d<c;){const o=e[d]||"";let i="",l="";if(!1!==n.alignDelimiters){const e=s[d]-(t[d]||0),n=a[d];114===n?i=" ".repeat(e):99===n?e%2?(i=" ".repeat(e/2+.5),l=" ".repeat(e/2-.5)):(i=" ".repeat(e/2),l=i):l=" ".repeat(e)}!1===n.delimiterStart||d||r.push("|"),!1===n.padding||!1===n.alignDelimiters&&""===o||!1===n.delimiterStart&&!d||r.push(" "),!1!==n.alignDelimiters&&r.push(i),r.push(o),!1!==n.alignDelimiters&&r.push(l),!1!==n.padding&&r.push(" "),!1===n.delimiterEnd&&d===c-1||r.push("|")}f.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return f.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:o})}function s(e,t,n){const r=e.children;let o=-1;const a=[],l=t.enter("tableRow");for(;++o<r.length;)a[o]=i(r[o],0,t,n);return l(),a}}function So(e){const t=this.stack[this.stack.length-2];t.type,t.checked="taskListCheckValueChecked"===e.type}function Co(e){const t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){const e=this.stack[this.stack.length-1];e.type;const n=e.children[0];if(n&&"text"===n.type){const r=t.children;let o,a=-1;for(;++a<r.length;){const e=r[a];if("paragraph"===e.type){o=e;break}}o===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function No(e,t,n,r){const o=e.children[0],a="boolean"==typeof e.checked&&o&&"paragraph"===o.type,i="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);a&&l.move(i);let s=uo.listItem(e,t,n,{...r,...l.current()});return a&&(s=s.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+i})),s}function To(e,t,n,r){const o=e.length;let a,i=0;if(t=t<0?-t>o?0:o+t:t>o?o:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i<r.length;)a=r.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function Io(e,t){return e.length>0?(To(e,e.length,0,t),e):t}const Lo={}.hasOwnProperty;function Mo(e){const t={};let n=-1;for(;++n<e.length;)Po(t,e[n]);return t}function Po(e,t){let n;for(n in t){const r=(Lo.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let a;if(o)for(a in o){Lo.call(r,a)||(r[a]=[]);const e=o[a];Do(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Do(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);To(e,0,0,r)}const Ao={tokenize:function(e,t,n){let r=0;return function t(a){if((87===a||119===a)&&r<3)return r++,e.consume(a),t;if(46===a&&3===r)return e.consume(a),o;return n(a)};function o(e){return null===e?n(e):t(e)}},partial:!0},Oo={tokenize:function(e,t,n){let r,o,a;return i;function i(t){return 46===t||95===t?e.check(Ro,s,l)(t):null===t||Jn(t)||nr(t)||45!==t&&tr(t)?s(t):(a=!0,e.consume(t),i)}function l(t){return 95===t?r=!0:(o=r,r=void 0),e.consume(t),i}function s(e){return o||r||!a?n(e):t(e)}},partial:!0},zo={tokenize:function(e,t){let n=0,r=0;return o;function o(i){return 40===i?(n++,e.consume(i),o):41===i&&r<n?a(i):33===i||34===i||38===i||39===i||41===i||42===i||44===i||46===i||58===i||59===i||60===i||63===i||93===i||95===i||126===i?e.check(Ro,t,a)(i):null===i||Jn(i)||nr(i)?t(i):(e.consume(i),o)}function a(t){return 41===t&&r++,e.consume(t),o}},partial:!0},Ro={tokenize:function(e,t,n){return r;function r(i){return 33===i||34===i||39===i||41===i||42===i||44===i||46===i||58===i||59===i||63===i||95===i||126===i?(e.consume(i),r):38===i?(e.consume(i),a):93===i?(e.consume(i),o):60===i||null===i||Jn(i)||nr(i)?t(i):n(i)}function o(e){return null===e||40===e||91===e||Jn(e)||nr(e)?t(e):r(e)}function a(e){return Vn(e)?i(e):n(e)}function i(t){return 59===t?(e.consume(t),r):Vn(t)?(e.consume(t),i):n(t)}},partial:!0},Fo={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return Wn(e)?n(e):t(e)}},partial:!0},$o={name:"wwwAutolink",tokenize:function(e,t,n){const r=this;return function(t){if(87!==t&&119!==t||!Uo.call(r,r.previous)||Zo(r.events))return n(t);return e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Ao,e.attempt(Oo,e.attempt(zo,o),n),n)(t)};function o(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:Uo},jo={name:"protocolAutolink",tokenize:function(e,t,n){const r=this;let o="",a=!1;return function(t){if((72===t||104===t)&&Vo.call(r,r.previous)&&!Zo(r.events))return e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(t),e.consume(t),i;return n(t)};function i(t){if(Vn(t)&&o.length<5)return o+=String.fromCodePoint(t),e.consume(t),i;if(58===t){const n=o.toLowerCase();if("http"===n||"https"===n)return e.consume(t),l}return n(t)}function l(t){return 47===t?(e.consume(t),a?s:(a=!0,l)):n(t)}function s(t){return null===t||Zn(t)||Jn(t)||nr(t)||tr(t)?n(t):e.attempt(Oo,e.attempt(zo,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:Vo},Ho={name:"emailAutolink",tokenize:function(e,t,n){const r=this;let o,a;return function(t){if(!Yo(t)||!Wo.call(r,r.previous)||Zo(r.events))return n(t);return e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),i(t)};function i(t){return Yo(t)?(e.consume(t),i):64===t?(e.consume(t),l):n(t)}function l(t){return 46===t?e.check(Fo,c,s)(t):45===t||95===t||Wn(t)?(a=!0,e.consume(t),l):c(t)}function s(t){return e.consume(t),o=!0,l}function c(i){return a&&o&&Vn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(i)):n(i)}},previous:Wo},Bo={};let qo=48;for(;qo<123;)Bo[qo]=Ho,qo++,58===qo?qo=65:91===qo&&(qo=97);function Uo(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||Jn(e)}function Vo(e){return!Vn(e)}function Wo(e){return!(47===e||Yo(e))}function Yo(e){return 43===e||45===e||46===e||95===e||Wn(e)}function Zo(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function Go(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const a=e.charCodeAt(n);let i="";if(37===a&&Wn(e.charCodeAt(n+1))&&Wn(e.charCodeAt(n+2)))o=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(i=String.fromCharCode(a));else if(a>55295&&a<57344){const t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(i=String.fromCharCode(a,t),o=1):i="�"}else i=String.fromCharCode(a);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+o+1,i=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function Qo(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const a=e[o].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}Bo[43]=Ho,Bo[45]=Ho,Bo[46]=Ho,Bo[95]=Ho,Bo[72]=[Ho,jo],Bo[104]=[Ho,jo],Bo[87]=[Ho,$o],Bo[119]=[Ho,$o];const Ko={name:"attention",resolveAll:function(e,t){let n,r,o,a,i,l,s,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close)for(n=u;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[n][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;l=e[n][1].end.offset-e[n][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;const d={...e[n][1].end},p={...e[u][1].start};Xo(d,-l),Xo(p,l),a={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},i={type:l>1?"strongSequence":"emphasisSequence",start:{...e[u][1].start},end:p},o={type:l>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[u][1].start}},r={type:l>1?"strong":"emphasis",start:{...a.start},end:{...i.end}},e[n][1].end={...a.start},e[u][1].start={...i.end},s=[],e[n][1].end.offset-e[n][1].start.offset&&(s=Io(s,[["enter",e[n][1],t],["exit",e[n][1],t]])),s=Io(s,[["enter",r,t],["enter",a,t],["exit",a,t],["enter",o,t]]),s=Io(s,Qo(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),s=Io(s,[["exit",o,t],["enter",i,t],["exit",i,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,s=Io(s,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,To(e,n-1,u-n+3,s),u=n+s.length-c-2;break}u=-1;for(;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e},tokenize:function(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=Wr(r);let a;return function(t){return a=t,e.enter("attentionSequence"),i(t)};function i(l){if(l===a)return e.consume(l),i;const s=e.exit("attentionSequence"),c=Wr(l),u=!c||2===c&&o||n.includes(l),d=!o||2===o&&c||n.includes(r);return s._open=Boolean(42===a?u:u&&(o||!d)),s._close=Boolean(42===a?d:d&&(c||!u)),t(l)}}};function Xo(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Jo={name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o};function o(t){return Vn(t)?(e.consume(t),a):64===t?n(t):s(t)}function a(e){return 43===e||45===e||46===e||Wn(e)?(r=1,i(e)):s(e)}function i(t){return 58===t?(e.consume(t),r=0,l):(43===t||45===t||46===t||Wn(t))&&r++<32?(e.consume(t),i):(r=0,s(t))}function l(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||Zn(r)?n(r):(e.consume(r),l)}function s(t){return 64===t?(e.consume(t),c):Yn(t)?(e.consume(t),s):n(t)}function c(e){return Wn(e)?u(e):n(e)}function u(n){return 46===n?(e.consume(n),r=0,c):62===n?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):d(n)}function d(t){if((45===t||Wn(t))&&r++<63){const n=45===t?d:u;return e.consume(t),n}return n(t)}}};function ea(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let a=0;return function(r){if(er(r))return e.enter(n),i(r);return t(r)};function i(r){return er(r)&&a++<o?(e.consume(r),i):(e.exit(n),t(r))}}const ta={partial:!0,tokenize:function(e,t,n){return function(t){return er(t)?ea(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||Xn(e)?t(e):n(e)}}};const na={continuation:{tokenize:function(e,t,n){const r=this;return function(t){if(er(t))return ea(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t);return o(t)};function o(r){return e.attempt(na,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){const r=this;return function(t){if(62===t){const n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),o}return n(t)};function o(n){return er(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}};const ra={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return Kn(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}};const oa={name:"characterReference",tokenize:function(e,t,n){const r=this;let o,a,i=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),l};function l(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),s):(e.enter("characterReferenceValue"),o=31,a=Wn,c(t))}function s(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,a=Qn,c):(e.enter("characterReferenceValue"),o=7,a=Gn,c(t))}function c(l){if(59===l&&i){const o=e.exit("characterReferenceValue");return a!==Wn||ho(r.sliceSerialize(o))?(e.enter("characterReferenceMarker"),e.consume(l),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(l)}return a(l)&&i++<o?(e.consume(l),c):n(l)}}};const aa={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){if(null===t)return n(t);return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},ia={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){const r=this,o={partial:!0,tokenize:function(e,t,n){let o=0;return i;function i(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s}function s(t){return e.enter("codeFencedFence"),er(t)?ea(e,c,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):c(t)}function c(t){return t===a?(e.enter("codeFencedFenceSequence"),u(t)):n(t)}function u(t){return t===a?(o++,e.consume(t),u):o>=l?(e.exit("codeFencedFenceSequence"),er(t)?ea(e,d,"whitespace")(t):d(t)):n(t)}function d(r){return null===r||Xn(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}};let a,i=0,l=0;return function(t){return function(t){const n=r.events[r.events.length-1];return i=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,a=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),s(t)}(t)};function s(t){return t===a?(l++,e.consume(t),s):l<3?n(t):(e.exit("codeFencedFenceSequence"),er(t)?ea(e,c,"whitespace")(t):c(t))}function c(n){return null===n||Xn(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(aa,h,y)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),u(n))}function u(t){return null===t||Xn(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(t)):er(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ea(e,d,"whitespace")(t)):96===t&&t===a?n(t):(e.consume(t),u)}function d(t){return null===t||Xn(t)?c(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(t))}function p(t){return null===t||Xn(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(t)):96===t&&t===a?n(t):(e.consume(t),p)}function h(t){return e.attempt(o,y,f)(t)}function f(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),m}function m(t){return i>0&&er(t)?ea(e,g,"linePrefix",i+1)(t):g(t)}function g(t){return null===t||Xn(t)?e.check(aa,h,y)(t):(e.enter("codeFlowValue"),b(t))}function b(t){return null===t||Xn(t)?(e.exit("codeFlowValue"),g(t)):(e.consume(t),b)}function y(n){return e.exit("codeFenced"),t(n)}}};const la={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),ea(e,o,"linePrefix",5)(t)};function o(e){const t=r.events[r.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?a(e):n(e)}function a(t){return null===t?l(t):Xn(t)?e.attempt(sa,a,l)(t):(e.enter("codeFlowValue"),i(t))}function i(t){return null===t||Xn(t)?(e.exit("codeFlowValue"),a(t)):(e.consume(t),i)}function l(n){return e.exit("codeIndented"),t(n)}}},sa={partial:!0,tokenize:function(e,t,n){const r=this;return o;function o(t){return r.parser.lazy[r.now().line]?n(t):Xn(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o):ea(e,a,"linePrefix",5)(t)}function a(e){const a=r.events[r.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Xn(e)?o(e):n(e)}}};const ca={name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,o=3;if(!("lineEnding"!==e[o][1].type&&"space"!==e[o][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=o;++t<r;)if("codeTextData"===e[t][1].type){e[o][1].type="codeTextPadding",e[r][1].type="codeTextPadding",o+=2,r-=2;break}t=o-1,r++;for(;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):t!==r&&"lineEnding"!==e[t][1].type||(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,o,a=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),i(t)};function i(t){return 96===t?(e.consume(t),a++,i):(e.exit("codeTextSequence"),l(t))}function l(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),l):96===t?(o=e.enter("codeTextSequence"),r=0,c(t)):Xn(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),l):(e.enter("codeTextData"),s(t))}function s(t){return null===t||32===t||96===t||Xn(t)?(e.exit("codeTextData"),l(t)):(e.consume(t),s)}function c(n){return 96===n?(e.consume(n),r++,c):r===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(o.type="codeTextData",s(n))}}};class ua{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){const n=null==t?Number.POSITIVE_INFINITY:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){const r=t||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return n&&da(this.left,n),o.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),da(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),da(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&0===this.right.length||e<0&&0===this.left.length))if(e<this.left.length){const t=this.left.splice(e,Number.POSITIVE_INFINITY);da(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);da(this.left,t.reverse())}}}function da(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function pa(e){const t={};let n,r,o,a,i,l,s,c=-1;const u=new ua(e);for(;++c<u.length;){for(;c in t;)c=t[c];if(n=u.get(c),c&&"chunkFlow"===n[1].type&&"listItemPrefix"===u.get(c-1)[1].type&&(l=n[1]._tokenizer.events,o=0,o<l.length&&"lineEndingBlank"===l[o][1].type&&(o+=2),o<l.length&&"content"===l[o][1].type))for(;++o<l.length&&"content"!==l[o][1].type;)"chunkText"===l[o][1].type&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,ha(u,c)),c=t[c],s=!0);else if(n[1]._container){for(o=c,r=void 0;o--;)if(a=u.get(o),"lineEnding"===a[1].type||"lineEndingBlank"===a[1].type)"enter"===a[0]&&(r&&(u.get(r)[1].type="lineEndingBlank"),a[1].type="lineEnding",r=o);else if("linePrefix"!==a[1].type&&"listItemIndent"!==a[1].type)break;r&&(n[1].end={...u.get(r)[1].start},i=u.slice(r,c),i.unshift(n),u.splice(r,c-r+1,i))}}return To(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!s}function ha(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const a=[];let i=n._tokenizer;i||(i=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const l=i.events,s=[],c={};let u,d,p=-1,h=n,f=0,m=0;const g=[m];for(;h;){for(;e.get(++o)[1]!==h;);a.push(o),h._tokenizer||(u=r.sliceStream(h),h.next||u.push(null),d&&i.defineSkip(h.start),h._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(u),h._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),d=h,h=h.next}for(h=n;++p<l.length;)"exit"===l[p][0]&&"enter"===l[p-1][0]&&l[p][1].type===l[p-1][1].type&&l[p][1].start.line!==l[p][1].end.line&&(m=p+1,g.push(m),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(i.events=[],h?(h._tokenizer=void 0,h.previous=void 0):g.pop(),p=g.length;p--;){const t=l.slice(g[p],g[p+1]),n=a.pop();s.push([n,n+t.length-1]),e.splice(n,2,t)}for(s.reverse(),p=-1;++p<s.length;)c[f+s[p][0]]=f+s[p][1],f+=s[p][1]-s[p][0]-1;return c}const fa={resolve:function(e){return pa(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?o(t):Xn(t)?e.check(ma,a,o)(t):(e.consume(t),r)}function o(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function a(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},ma={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),ea(e,o,"linePrefix")};function o(o){if(null===o||Xn(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}};function ga(e,t,n,r,o,a,i,l,s){const c=s||Number.POSITIVE_INFINITY;let u=0;return function(t){if(60===t)return e.enter(r),e.enter(o),e.enter(a),e.consume(t),e.exit(a),d;if(null===t||32===t||41===t||Zn(t))return n(t);return e.enter(r),e.enter(i),e.enter(l),e.enter("chunkString",{contentType:"string"}),f(t)};function d(n){return 62===n?(e.enter(a),e.consume(n),e.exit(a),e.exit(o),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(n))}function p(t){return 62===t?(e.exit("chunkString"),e.exit(l),d(t)):null===t||60===t||Xn(t)?n(t):(e.consume(t),92===t?h:p)}function h(t){return 60===t||62===t||92===t?(e.consume(t),p):p(t)}function f(o){return u||null!==o&&41!==o&&!Jn(o)?u<c&&40===o?(e.consume(o),u++,f):41===o?(e.consume(o),u--,f):null===o||32===o||40===o||Zn(o)?n(o):(e.consume(o),92===o?m:f):(e.exit("chunkString"),e.exit(l),e.exit(i),e.exit(r),t(o))}function m(t){return 40===t||41===t||92===t?(e.consume(t),f):f(t)}}function ba(e,t,n,r,o,a){const i=this;let l,s=0;return function(t){return e.enter(r),e.enter(o),e.consume(t),e.exit(o),e.enter(a),c};function c(d){return s>999||null===d||91===d||93===d&&!l||94===d&&!s&&"_hiddenFootnoteSupport"in i.parser.constructs?n(d):93===d?(e.exit(a),e.enter(o),e.consume(d),e.exit(o),e.exit(r),t):Xn(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||Xn(t)||s++>999?(e.exit("chunkString"),c(t)):(e.consume(t),l||(l=!er(t)),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),s++,u):u(t)}}function ya(e,t,n,r,o,a){let i;return function(t){if(34===t||39===t||40===t)return e.enter(r),e.enter(o),e.consume(t),e.exit(o),i=40===t?41:t,l;return n(t)};function l(n){return n===i?(e.enter(o),e.consume(n),e.exit(o),e.exit(r),t):(e.enter(a),s(n))}function s(t){return t===i?(e.exit(a),l(i)):null===t?n(t):Xn(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),ea(e,s,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===i||null===t||Xn(t)?(e.exit("chunkString"),s(t)):(e.consume(t),92===t?u:c)}function u(t){return t===i||92===t?(e.consume(t),c):c(t)}}function va(e,t){let n;return function r(o){if(Xn(o))return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r;if(er(o))return ea(e,r,n?"linePrefix":"lineSuffix")(o);return t(o)}}const xa={name:"definition",tokenize:function(e,t,n){const r=this;let o;return function(t){return e.enter("definition"),function(t){return ba.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function a(t){return o=vr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),i):n(t)}function i(t){return Jn(t)?va(e,l)(t):l(t)}function l(t){return ga(e,s,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function s(t){return e.attempt(wa,c,c)(t)}function c(t){return er(t)?ea(e,u,"whitespace")(t):u(t)}function u(a){return null===a||Xn(a)?(e.exit("definition"),r.parser.defined.push(o),t(a)):n(a)}}},wa={partial:!0,tokenize:function(e,t,n){return function(t){return Jn(t)?va(e,r)(t):n(t)};function r(t){return ya(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function o(t){return er(t)?ea(e,a,"whitespace")(t):a(t)}function a(e){return null===e||Xn(e)?t(e):n(e)}}};const ka={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return Xn(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}};const _a={name:"headingAtx",resolve:function(e,t){let n,r,o=e.length-2,a=3;"whitespace"===e[a][1].type&&(a+=2);o-2>a&&"whitespace"===e[o][1].type&&(o-=2);"atxHeadingSequence"===e[o][1].type&&(a===o-1||o-4>a&&"whitespace"===e[o-2][1].type)&&(o-=a+1===o?2:4);o>a&&(n={type:"atxHeadingText",start:e[a][1].start,end:e[o][1].end},r={type:"chunkText",start:e[a][1].start,end:e[o][1].end,contentType:"text"},To(e,a,o-a+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]]));return e},tokenize:function(e,t,n){let r=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),o(t)}(t)};function o(t){return 35===t&&r++<6?(e.consume(t),o):null===t||Jn(t)?(e.exit("atxHeadingSequence"),a(t)):n(t)}function a(n){return 35===n?(e.enter("atxHeadingSequence"),i(n)):null===n||Xn(n)?(e.exit("atxHeading"),t(n)):er(n)?ea(e,a,"whitespace")(n):(e.enter("atxHeadingText"),l(n))}function i(t){return 35===t?(e.consume(t),i):(e.exit("atxHeadingSequence"),a(t))}function l(t){return null===t||35===t||Jn(t)?(e.exit("atxHeadingText"),a(t)):(e.consume(t),l)}}};const Ea=["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"],Sa=["pre","script","style","textarea"],Ca={concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2));return e},tokenize:function(e,t,n){const r=this;let o,a,i,l,s;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c}(t)};function c(l){return 33===l?(e.consume(l),u):47===l?(e.consume(l),a=!0,h):63===l?(e.consume(l),o=3,r.interrupt?t:A):Vn(l)?(e.consume(l),i=String.fromCharCode(l),f):n(l)}function u(a){return 45===a?(e.consume(a),o=2,d):91===a?(e.consume(a),o=5,l=0,p):Vn(a)?(e.consume(a),o=4,r.interrupt?t:A):n(a)}function d(o){return 45===o?(e.consume(o),r.interrupt?t:A):n(o)}function p(o){const a="CDATA[";return o===a.charCodeAt(l++)?(e.consume(o),6===l?r.interrupt?t:C:p):n(o)}function h(t){return Vn(t)?(e.consume(t),i=String.fromCharCode(t),f):n(t)}function f(l){if(null===l||47===l||62===l||Jn(l)){const s=47===l,c=i.toLowerCase();return s||a||!Sa.includes(c)?Ea.includes(i.toLowerCase())?(o=6,s?(e.consume(l),m):r.interrupt?t(l):C(l)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(l):a?g(l):b(l)):(o=1,r.interrupt?t(l):C(l))}return 45===l||Wn(l)?(e.consume(l),i+=String.fromCharCode(l),f):n(l)}function m(o){return 62===o?(e.consume(o),r.interrupt?t:C):n(o)}function g(t){return er(t)?(e.consume(t),g):E(t)}function b(t){return 47===t?(e.consume(t),E):58===t||95===t||Vn(t)?(e.consume(t),y):er(t)?(e.consume(t),b):E(t)}function y(t){return 45===t||46===t||58===t||95===t||Wn(t)?(e.consume(t),y):v(t)}function v(t){return 61===t?(e.consume(t),x):er(t)?(e.consume(t),v):b(t)}function x(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),s=t,w):er(t)?(e.consume(t),x):k(t)}function w(t){return t===s?(e.consume(t),s=null,_):null===t||Xn(t)?n(t):(e.consume(t),w)}function k(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||Jn(t)?v(t):(e.consume(t),k)}function _(e){return 47===e||62===e||er(e)?b(e):n(e)}function E(t){return 62===t?(e.consume(t),S):n(t)}function S(t){return null===t||Xn(t)?C(t):er(t)?(e.consume(t),S):n(t)}function C(t){return 45===t&&2===o?(e.consume(t),L):60===t&&1===o?(e.consume(t),M):62===t&&4===o?(e.consume(t),O):63===t&&3===o?(e.consume(t),A):93===t&&5===o?(e.consume(t),D):!Xn(t)||6!==o&&7!==o?null===t||Xn(t)?(e.exit("htmlFlowData"),N(t)):(e.consume(t),C):(e.exit("htmlFlowData"),e.check(Na,z,N)(t))}function N(t){return e.check(Ta,T,z)(t)}function T(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),I}function I(t){return null===t||Xn(t)?N(t):(e.enter("htmlFlowData"),C(t))}function L(t){return 45===t?(e.consume(t),A):C(t)}function M(t){return 47===t?(e.consume(t),i="",P):C(t)}function P(t){if(62===t){const n=i.toLowerCase();return Sa.includes(n)?(e.consume(t),O):C(t)}return Vn(t)&&i.length<8?(e.consume(t),i+=String.fromCharCode(t),P):C(t)}function D(t){return 93===t?(e.consume(t),A):C(t)}function A(t){return 62===t?(e.consume(t),O):45===t&&2===o?(e.consume(t),A):C(t)}function O(t){return null===t||Xn(t)?(e.exit("htmlFlowData"),z(t)):(e.consume(t),O)}function z(n){return e.exit("htmlFlow"),t(n)}}},Na={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(ta,t,n)}}},Ta={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){if(Xn(t))return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o;return n(t)};function o(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}};const Ia={name:"htmlText",tokenize:function(e,t,n){const r=this;let o,a,i;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),l};function l(t){return 33===t?(e.consume(t),s):47===t?(e.consume(t),x):63===t?(e.consume(t),y):Vn(t)?(e.consume(t),_):n(t)}function s(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),a=0,h):Vn(t)?(e.consume(t),b):n(t)}function c(t){return 45===t?(e.consume(t),p):n(t)}function u(t){return null===t?n(t):45===t?(e.consume(t),d):Xn(t)?(i=u,P(t)):(e.consume(t),u)}function d(t){return 45===t?(e.consume(t),p):u(t)}function p(e){return 62===e?M(e):45===e?d(e):u(e)}function h(t){const r="CDATA[";return t===r.charCodeAt(a++)?(e.consume(t),6===a?f:h):n(t)}function f(t){return null===t?n(t):93===t?(e.consume(t),m):Xn(t)?(i=f,P(t)):(e.consume(t),f)}function m(t){return 93===t?(e.consume(t),g):f(t)}function g(t){return 62===t?M(t):93===t?(e.consume(t),g):f(t)}function b(t){return null===t||62===t?M(t):Xn(t)?(i=b,P(t)):(e.consume(t),b)}function y(t){return null===t?n(t):63===t?(e.consume(t),v):Xn(t)?(i=y,P(t)):(e.consume(t),y)}function v(e){return 62===e?M(e):y(e)}function x(t){return Vn(t)?(e.consume(t),w):n(t)}function w(t){return 45===t||Wn(t)?(e.consume(t),w):k(t)}function k(t){return Xn(t)?(i=k,P(t)):er(t)?(e.consume(t),k):M(t)}function _(t){return 45===t||Wn(t)?(e.consume(t),_):47===t||62===t||Jn(t)?E(t):n(t)}function E(t){return 47===t?(e.consume(t),M):58===t||95===t||Vn(t)?(e.consume(t),S):Xn(t)?(i=E,P(t)):er(t)?(e.consume(t),E):M(t)}function S(t){return 45===t||46===t||58===t||95===t||Wn(t)?(e.consume(t),S):C(t)}function C(t){return 61===t?(e.consume(t),N):Xn(t)?(i=C,P(t)):er(t)?(e.consume(t),C):E(t)}function N(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),o=t,T):Xn(t)?(i=N,P(t)):er(t)?(e.consume(t),N):(e.consume(t),I)}function T(t){return t===o?(e.consume(t),o=void 0,L):null===t?n(t):Xn(t)?(i=T,P(t)):(e.consume(t),T)}function I(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||Jn(t)?E(t):(e.consume(t),I)}function L(e){return 47===e||62===e||Jn(e)?E(e):n(e)}function M(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function P(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),D}function D(t){return er(t)?ea(e,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):A(t)}function A(t){return e.enter("htmlTextData"),i(t)}}};const La={name:"labelEnd",resolveAll:function(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){const e="labelImage"===r.type?4:2;r.type="data",t+=e}}e.length!==n.length&&To(e,0,e.length,n);return e},resolveTo:function(e,t){let n,r,o,a,i=e.length,l=0;for(;i--;)if(n=e[i][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[i][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(o){if("enter"===e[i][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=i,"labelLink"!==n.type)){l=2;break}}else"labelEnd"===n.type&&(o=i);const s={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[r+l+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",s,t],["enter",c,t]],a=Io(a,e.slice(r+1,r+l+3)),a=Io(a,[["enter",u,t]]),a=Io(a,Qo(t.parser.constructs.insideSpan.null,e.slice(r+l+4,o-3),t)),a=Io(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=Io(a,e.slice(o+1)),a=Io(a,[["exit",s,t]]),To(e,r,e.length,a),e},tokenize:function(e,t,n){const r=this;let o,a,i=r.events.length;for(;i--;)if(("labelImage"===r.events[i][1].type||"labelLink"===r.events[i][1].type)&&!r.events[i][1]._balanced){o=r.events[i][1];break}return function(t){if(!o)return n(t);if(o._inactive)return u(t);return a=r.parser.defined.includes(vr(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),l};function l(t){return 40===t?e.attempt(Ma,c,a?c:u)(t):91===t?e.attempt(Pa,c,a?s:u)(t):a?c(t):u(t)}function s(t){return e.attempt(Da,c,u)(t)}function c(e){return t(e)}function u(e){return o._balanced=!0,n(e)}}},Ma={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return Jn(t)?va(e,o)(t):o(t)}function o(t){return 41===t?c(t):ga(e,a,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function a(t){return Jn(t)?va(e,l)(t):c(t)}function i(e){return n(e)}function l(t){return 34===t||39===t||40===t?ya(e,s,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function s(t){return Jn(t)?va(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},Pa={tokenize:function(e,t,n){const r=this;return function(t){return ba.call(r,e,o,a,"reference","referenceMarker","referenceString")(t)};function o(e){return r.parser.defined.includes(vr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function a(e){return n(e)}}},Da={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}};const Aa={name:"labelStartImage",resolveAll:La.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),o};function o(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),a):n(t)}function a(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const Oa={name:"labelStartLink",resolveAll:La.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),o};function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const za={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),ea(e,t,"linePrefix")}}};const Ra={name:"thematicBreak",tokenize:function(e,t,n){let r,o=0;return function(t){return e.enter("thematicBreak"),function(e){return r=e,a(e)}(t)};function a(a){return a===r?(e.enter("thematicBreakSequence"),i(a)):o>=3&&(null===a||Xn(a))?(e.exit("thematicBreak"),t(a)):n(a)}function i(t){return t===r?(e.consume(t),o++,i):(e.exit("thematicBreakSequence"),er(t)?ea(e,a,"whitespace")(t):a(t))}}};const Fa={continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ta,o,a);function o(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ea(e,t,"listItemIndent",r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!er(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ja,t,i)(n))}function i(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,ea(e,e.attempt(Fa,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){const r=this,o=r.events[r.events.length-1];let a=o&&"linePrefix"===o[1].type?o[2].sliceSerialize(o[1],!0).length:0,i=0;return function(t){const o=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===o?!r.containerState.marker||t===r.containerState.marker:Gn(t)){if(r.containerState.type||(r.containerState.type=o,e.enter(o,{_container:!0})),"listUnordered"===o)return e.enter("listItemPrefix"),42===t||45===t?e.check(Ra,n,s)(t):s(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(t)}return n(t)};function l(t){return Gn(t)&&++i<10?(e.consume(t),l):(!r.interrupt||i<2)&&(r.containerState.marker?t===r.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),s(t)):n(t)}function s(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(ta,r.interrupt?n:c,e.attempt($a,d,u))}function c(e){return r.containerState.initialBlankLine=!0,a++,d(e)}function u(t){return er(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):n(t)}function d(n){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},$a={partial:!0,tokenize:function(e,t,n){const r=this;return ea(e,function(e){const o=r.events[r.events.length-1];return!er(e)&&o&&"listItemPrefixWhitespace"===o[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},ja={partial:!0,tokenize:function(e,t,n){const r=this;return ea(e,function(e){const o=r.events[r.events.length-1];return o&&"listItemIndent"===o[1].type&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}};const Ha={name:"setextUnderline",resolveTo:function(e,t){let n,r,o,a=e.length;for(;a--;)if("enter"===e[a][0]){if("content"===e[a][1].type){n=a;break}"paragraph"===e[a][1].type&&(r=a)}else"content"===e[a][1].type&&e.splice(a,1),o||"definition"!==e[a][1].type||(o=a);const i={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};e[r][1].type="setextHeadingText",o?(e.splice(r,0,["enter",i,t]),e.splice(o+1,0,["exit",e[n][1],t]),e[n][1].end={...e[o][1].end}):e[n][1]=i;return e.push(["exit",i,t]),e},tokenize:function(e,t,n){const r=this;let o;return function(t){let i,l=r.events.length;for(;l--;)if("lineEnding"!==r.events[l][1].type&&"linePrefix"!==r.events[l][1].type&&"content"!==r.events[l][1].type){i="paragraph"===r.events[l][1].type;break}if(!r.parser.lazy[r.now().line]&&(r.interrupt||i))return e.enter("setextHeadingLine"),o=t,function(t){return e.enter("setextHeadingLineSequence"),a(t)}(t);return n(t)};function a(t){return t===o?(e.consume(t),a):(e.exit("setextHeadingLineSequence"),er(t)?ea(e,i,"lineSuffix")(t):i(t))}function i(r){return null===r||Xn(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};const Ba={tokenize:function(e,t,n){const r=this;return ea(e,function(e){const o=r.events[r.events.length-1];return o&&"gfmFootnoteDefinitionIndent"===o[1].type&&4===o[2].sliceSerialize(o[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function qa(e,t,n){const r=this;let o=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i;for(;o--;){const e=r.events[o][1];if("labelImage"===e.type){i=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(o){if(!i||!i._balanced)return n(o);const l=vr(r.sliceSerialize({start:i.end,end:r.now()}));if(94!==l.codePointAt(0)||!a.includes(l.slice(1)))return n(o);return e.enter("gfmFootnoteCallLabelMarker"),e.consume(o),e.exit("gfmFootnoteCallLabelMarker"),t(o)}}function Ua(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},i={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function Va(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,i=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),l};function l(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",s)}function s(l){if(i>999||93===l&&!a||null===l||91===l||Jn(l))return n(l);if(93===l){e.exit("chunkString");const a=e.exit("gfmFootnoteCallString");return o.includes(vr(r.sliceSerialize(a)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(l)}return Jn(l)||(a=!0),i++,e.consume(l),92===l?c:s}function c(t){return 91===t||92===t||93===t?(e.consume(t),i++,s):s(t)}}function Wa(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,i,l=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),s};function s(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(l>999||93===t&&!i||null===t||91===t||Jn(t))return n(t);if(93===t){e.exit("chunkString");const n=e.exit("gfmFootnoteDefinitionLabelString");return a=vr(r.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return Jn(t)||(i=!0),l++,e.consume(t),92===t?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(a)||o.push(a),ea(e,p,"gfmFootnoteDefinitionWhitespace")):n(t)}function p(e){return t(e)}}function Ya(e,t,n){return e.check(ta,t,e.attempt(Ba,t,n))}function Za(e){e.exit("gfmFootnoteDefinition")}function Ga(e){let t=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:function(e,n,r){const o=this.previous,a=this.events;let i=0;return function(t){if(126===o&&"characterEscape"!==a[a.length-1][1].type)return r(t);return e.enter("strikethroughSequenceTemporary"),l(t)};function l(a){const s=Wr(o);if(126===a)return i>1?r(a):(e.consume(a),i++,l);if(i<2&&!t)return r(a);const c=e.exit("strikethroughSequenceTemporary"),u=Wr(a);return c._open=!u||2===u&&Boolean(s),c._close=!s||2===s&&Boolean(u),n(a)}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";const o={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},i=[["enter",o,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",a,t]],l=t.parser.constructs.insideSpan.null;l&&To(i,i.length,0,Qo(l,e.slice(r+1,n),t)),To(i,i.length,0,[["exit",a,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",o,t]]),To(e,r-1,n-r+3,i),n=r+i.length-2;break}}n=-1;for(;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}};return null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}}class Qa{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let o=0;if(0===n&&0===r.length)return;for(;o<e.map.length;){if(e.map[o][0]===t)return e.map[o][1]+=n,void e.map[o][2].push(...r);o+=1}e.map.push([t,n,r])}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length;const n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(const t of r)e.push(t);r=n.pop()}this.map.length=0}}function Ka(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if("enter"===o[0])"tableContent"===o[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===o[1].type){if("tableDelimiterMarker"===e[t-1][1].type){const e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===o[1].type)break}else"enter"===o[0]&&"tableDelimiterRow"===o[1].type&&(n=!0);t+=1}return r}function Xa(e,t,n){const r=this;let o,a=0,i=0;return function(e){let t=r.events.length-1;for(;t>-1;){const e=r.events[t][1].type;if("lineEnding"!==e&&"linePrefix"!==e)break;t--}const o=t>-1?r.events[t][1].type:null,a="tableHead"===o||"tableRow"===o?x:l;if(a===x&&r.parser.lazy[r.now().line])return n(e);return a(e)};function l(t){return e.enter("tableHead"),e.enter("tableRow"),function(e){if(124===e)return s(e);return o=!0,i+=1,s(e)}(t)}function s(t){return null===t?n(t):Xn(t)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):er(t)?ea(e,s,"whitespace")(t):(i+=1,o&&(o=!1,a+=1),124===t?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),o=!0,s):(e.enter("data"),c(t)))}function c(t){return null===t||124===t||Jn(t)?(e.exit("data"),s(t)):(e.consume(t),92===t?u:c)}function u(t){return 92===t||124===t?(e.consume(t),c):c(t)}function d(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter("tableDelimiterRow"),o=!1,er(t)?ea(e,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):p(t))}function p(t){return 45===t||58===t?f(t):124===t?(o=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),h):v(t)}function h(t){return er(t)?ea(e,f,"whitespace")(t):f(t)}function f(t){return 58===t?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),m):45===t?(i+=1,m(t)):null===t||Xn(t)?y(t):v(t)}function m(t){return 45===t?(e.enter("tableDelimiterFiller"),g(t)):v(t)}function g(t){return 45===t?(e.consume(t),g):58===t?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),b):(e.exit("tableDelimiterFiller"),b(t))}function b(t){return er(t)?ea(e,y,"whitespace")(t):y(t)}function y(n){return 124===n?p(n):(null===n||Xn(n))&&o&&a===i?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(n)):v(n)}function v(e){return n(e)}function x(t){return e.enter("tableRow"),w(t)}function w(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),w):null===n||Xn(n)?(e.exit("tableRow"),t(n)):er(n)?ea(e,w,"whitespace")(n):(e.enter("data"),k(n))}function k(t){return null===t||124===t||Jn(t)?(e.exit("data"),w(t)):(e.consume(t),92===t?_:k)}function _(t){return 92===t||124===t?(e.consume(t),k):k(t)}}function Ja(e,t){let n,r,o,a=-1,i=!0,l=0,s=[0,0,0,0],c=[0,0,0,0],u=!1,d=0;const p=new Qa;for(;++a<e.length;){const h=e[a],f=h[1];"enter"===h[0]?"tableHead"===f.type?(u=!1,0!==d&&(ti(p,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},p.add(a,0,[["enter",n,t]])):"tableRow"===f.type||"tableDelimiterRow"===f.type?(i=!0,o=void 0,s=[0,0,0,0],c=[0,a+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},f.start),end:Object.assign({},f.end)},p.add(a,0,[["enter",r,t]])),l="tableDelimiterRow"===f.type?2:r?3:1):!l||"data"!==f.type&&"tableDelimiterMarker"!==f.type&&"tableDelimiterFiller"!==f.type?"tableCellDivider"===f.type&&(i?i=!1:(0!==s[1]&&(c[0]=c[1],o=ei(p,t,s,l,void 0,o)),s=c,c=[s[1],a,0,0])):(i=!1,0===c[2]&&(0!==s[1]&&(c[0]=c[1],o=ei(p,t,s,l,void 0,o),s=[0,0,0,0]),c[2]=a)):"tableHead"===f.type?(u=!0,d=a):"tableRow"===f.type||"tableDelimiterRow"===f.type?(d=a,0!==s[1]?(c[0]=c[1],o=ei(p,t,s,l,a,o)):0!==c[1]&&(o=ei(p,t,c,l,a,o)),l=0):!l||"data"!==f.type&&"tableDelimiterMarker"!==f.type&&"tableDelimiterFiller"!==f.type||(c[3]=a)}for(0!==d&&ti(p,t,d,n,r),p.consume(t.events),a=-1;++a<t.events.length;){const e=t.events[a];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=Ka(t.events,a))}return e}function ei(e,t,n,r,o,a){const i=1===r?"tableHeader":2===r?"tableDelimiter":"tableData";0!==n[0]&&(a.end=Object.assign({},ni(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));const l=ni(t.events,n[1]);if(a={type:i,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",a,t]]),0!==n[2]){const o=ni(t.events,n[2]),a=ni(t.events,n[3]),i={type:"tableContent",start:Object.assign({},o),end:Object.assign({},a)};if(e.add(n[2],0,[["enter",i,t]]),2!==r){const r=t.events[n[2]],o=t.events[n[3]];if(r[1].end=Object.assign({},o[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){const t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",i,t]])}return void 0!==o&&(a.end=Object.assign({},ni(t.events,o)),e.add(o,0,[["exit",a,t]]),a=void 0),a}function ti(e,t,n,r,o){const a=[],i=ni(t.events,n);o&&(o.end=Object.assign({},i),a.push(["exit",o,t])),r.end=Object.assign({},i),a.push(["exit",r,t]),e.add(n+1,0,a)}function ni(e,t){const n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}const ri={name:"tasklistCheck",tokenize:function(e,t,n){const r=this;return function(t){if(null!==r.previous||!r._gfmTasklistFirstContentOfListItem)return n(t);return e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),o};function o(t){return Jn(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),a):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),a):n(t)}function a(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),i):n(t)}function i(r){return Xn(r)?t(r):er(r)?e.check({tokenize:oi},t,n)(r):n(r)}}};function oi(e,t,n){return ea(e,function(e){return null===e?n(e):t(e)},"whitespace")}const ai={};var ii=Object.defineProperty,li=Object.defineProperties,si=Object.getOwnPropertyDescriptors,ci=Object.getOwnPropertySymbols,ui=Object.prototype.hasOwnProperty,di=Object.prototype.propertyIsEnumerable,pi=(e,t,n)=>t in e?ii(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hi=(e,t)=>{for(var n in t||(t={}))ui.call(t,n)&&pi(e,n,t[n]);if(ci)for(var n of ci(t))di.call(t,n)&&pi(e,n,t[n]);return e},fi=(e,t)=>li(e,si(t)),mi=(e,t)=>{let n=!1,r=!1;for(let o=0;o<t;o+=1)"\\"===e[o]&&o+1<e.length&&"`"===e[o+1]?o+=1:"```"!==e.substring(o,o+3)?!r&&"`"===e[o]&&(n=!n):(r=!r,o+=2);return n||r},gi=(e,t)=>{let n="```"===e.substring(t,t+3),r=t>0&&"```"===e.substring(t-1,t+2),o=t>1&&"```"===e.substring(t-2,t+1);return n||r||o},bi=(e,t)=>{let n=!1,r=!1,o=-1;for(let a=0;a<e.length;a+=1)if("\\"===e[a]&&a+1<e.length&&"`"===e[a+1])a+=1;else if("```"!==e.substring(a,a+3)){if(!r&&"`"===e[a])if(n){if(o<t&&t<a)return!0;n=!1,o=-1}else n=!0,o=a}else r=!r,a+=2;return!1},yi=/^(\s*(?:[-*+]|\d+[.)]) +)>(=?\s*[$]?\d)/gm,vi=/(\*\*)([^*]*\*?)$/,xi=/(__)([^_]*?)$/,wi=/(\*\*\*)([^*]*?)$/,ki=/(\*)([^*]*?)$/,_i=/(_)([^_]*?)$/,Ei=/(`)([^`]*?)$/,Si=/(~~)([^~]*?)$/,Ci=/^[\s_~*`]*$/,Ni=/^[\s]*[-*+][\s]+$/,Ti=/[\p{L}\p{N}_]/u,Ii=/^```[^`\n]*```?$/,Li=/^\*{4,}$/,Mi=/(__)([^_]+)_$/,Pi=/(~~)([^~]+)~$/,Di=/~~/g,Ai=e=>{if(!e)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||95===t||Ti.test(e)},Oi=(e,t)=>{let n=1;for(let r=t+1;r<e.length;r+=1)if("["===e[r])n+=1;else if("]"===e[r]&&(n-=1,0===n))return r;return-1},zi=(e,t)=>{let n=!1,r=!1;for(let o=0;o<e.length&&o<t;o+=1)"\\"!==e[o]||"$"!==e[o+1]?"$"===e[o]&&("$"===e[o+1]?(r=!r,o+=1,n=!1):r||(n=!n)):o+=1;return n||r},Ri=(e,t)=>{for(let n=t;n<e.length;n+=1){if(")"===e[n])return!0;if("\n"===e[n])return!1}return!1},Fi=(e,t)=>{for(let n=t-1;n>=0;n-=1){if(")"===e[n])return!1;if("("===e[n])return n>0&&"]"===e[n-1]&&Ri(e,t);if("\n"===e[n])return!1}return!1},$i=(e,t,n)=>{let r=0;for(let n=t-1;n>=0;n-=1)if("\n"===e[n]){r=n+1;break}let o=e.length;for(let n=t;n<e.length;n+=1)if("\n"===e[n]){o=n;break}let a=e.substring(r,o),i=0,l=!1;for(let e of a)if(e===n)i+=1;else if(" "!==e&&"\t"!==e){l=!0;break}return i>=3&&!l},ji=(e,t,n,r)=>!!("\\"===n||e.includes("$")&&zi(e,t))||("*"!==n&&"*"===r?"*"!==(t<e.length-2?e[t+2]:""):!(!("*"===n||n&&r&&Ai(n)&&Ai(r))&&(n&&" "!==n&&"\t"!==n&&"\n"!==n||r&&" "!==r&&"\t"!==r&&"\n"!==r))),Hi=e=>{let t=0,n=!1,r=e.length;for(let o=0;o<r;o+=1){if("`"===e[o]&&o+2<r&&"`"===e[o+1]&&"`"===e[o+2]){n=!n,o+=2;continue}if(n||"*"!==e[o])continue;let a=o>0?e[o-1]:"",i=o<r-1?e[o+1]:"";ji(e,o,a,i)||(t+=1)}return t},Bi=(e,t,n,r)=>!!("\\"===n||e.includes("$")&&zi(e,t)||Fi(e,t)||((e,t)=>{for(let n=t-1;n>=0;n-=1){if(">"===e[n])return!1;if("<"===e[n]){let t=n+1<e.length?e[n+1]:"";return t>="a"&&t<="z"||t>="A"&&t<="Z"||"/"===t}if("\n"===e[n])return!1}return!1})(e,t)||"_"===n||"_"===r||n&&r&&Ai(n)&&Ai(r)),qi=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1)"`"===e[r]&&r+2<e.length&&"`"===e[r+1]&&"`"===e[r+2]?(n=!n,r+=2):n||"*"===e[r]&&r+1<e.length&&"*"===e[r+1]&&(t+=1,r+=1);return t},Ui=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1)"`"===e[r]&&r+2<e.length&&"`"===e[r+1]&&"`"===e[r+2]?(n=!n,r+=2):n||"_"===e[r]&&r+1<e.length&&"_"===e[r+1]&&(t+=1,r+=1);return t},Vi=e=>{let t=!1;for(let n=0;n<e.length;n+=1)if("`"===e[n]&&n+2<e.length&&"`"===e[n+1]&&"`"===e[n+2])t=!t,n+=2;else if(!t&&"_"===e[n]&&"_"!==e[n-1]&&"_"!==e[n+1]&&"\\"!==e[n-1]&&!zi(e,n)&&!Fi(e,n)){let t=n>0?e[n-1]:"",r=n<e.length-1?e[n+1]:"";if(t&&r&&Ai(t)&&Ai(r))continue;return n}return-1},Wi=/<[a-zA-Z/][^>]*$/,Yi=(e,t)=>t>=2&&"```"===e.substring(t-2,t+1)||t>=1&&"```"===e.substring(t-1,t+2)||t<=e.length-3&&"```"===e.substring(t,t+3),Zi=(e,t)=>{for(let n=0;n<t;n++)if("["===e[n]&&!mi(e,n)){if(n>0&&"!"===e[n-1])continue;let t=Oi(e,n);if(-1===t)return n;if(t+1<e.length&&"("===e[t+1]){let r=e.indexOf(")",t+2);-1!==r&&(n=r)}}return t},Gi=(e,t,n)=>{let r=t>0&&"!"===e[t-1],o=r?t-1:t;if(!e.substring(t+1).includes("]")){let a=e.substring(0,o);if(r)return a;if("text-only"===n){let n=Zi(e,t);return e.substring(0,n)+e.substring(n+1)}return`${e}](streamdown:incomplete-link)`}if(-1===Oi(e,t)){let a=e.substring(0,o);if(r)return a;if("text-only"===n){let n=Zi(e,t);return e.substring(0,n)+e.substring(n+1)}return`${e}](streamdown:incomplete-link)`}return null},Qi=(e,t="protocol")=>{let n=e.lastIndexOf("](");if(-1!==n&&!mi(e,n)){let r=((e,t,n)=>{if(e.substring(t+2).includes(")"))return null;let r=((e,t)=>{let n=1;for(let r=t-1;r>=0;r-=1)if("]"===e[r])n+=1;else if("["===e[r]&&(n-=1,0===n))return r;return-1})(e,t);if(-1===r||mi(e,r))return null;let o=r>0&&"!"===e[r-1],a=o?r-1:r,i=e.substring(0,a);if(o)return i;let l=e.substring(r+1,t);return"text-only"===n?`${i}${l}`:`${i}[${l}](streamdown:incomplete-link)`})(e,n,t);if(null!==r)return r}for(let n=e.length-1;n>=0;n-=1)if("["===e[n]&&!mi(e,n)){let r=Gi(e,n,t);if(null!==r)return r}return e},Ki=/^-{1,2}$/,Xi=/^[\s]*-{1,2}[\s]+$/,Ji=/^={1,2}$/,el=/^[\s]*={1,2}[\s]+$/,tl=new RegExp("(?<=[\\p{L}\\p{N}_])~(?!~)(?=[\\p{L}\\p{N}_])","gu"),nl=e=>!1!==e,rl=100,ol=[{handler:{name:"singleTilde",handle:e=>e&&"string"==typeof e&&e.includes("~")?e.replace(tl,(t,n)=>mi(e,n)?t:"\\~"):e,priority:0},optionKey:"singleTilde"},{handler:{name:"comparisonOperators",handle:e=>e&&"string"==typeof e&&e.includes(">")?e.replace(yi,(t,n,r,o)=>mi(e,o)?t:`${n}\\>${r}`):e,priority:5},optionKey:"comparisonOperators"},{handler:{name:"htmlTags",handle:e=>{let t=e.match(Wi);return!t||void 0===t.index||mi(e,t.index)?e:e.substring(0,t.index).trimEnd()},priority:10},optionKey:"htmlTags"},{handler:{name:"setextHeadings",handle:e=>{if(!e||"string"!=typeof e)return e;let t=e.lastIndexOf("\n");if(-1===t)return e;let n=e.substring(t+1),r=e.substring(0,t),o=n.trim();if(Ki.test(o)&&!n.match(Xi)){let t=r.split("\n").at(-1);if(t&&t.trim().length>0)return`${e}​`}if(Ji.test(o)&&!n.match(el)){let t=r.split("\n").at(-1);if(t&&t.trim().length>0)return`${e}​`}return e},priority:15},optionKey:"setextHeadings"},{handler:{name:"links",handle:Qi,priority:20},optionKey:"links",earlyReturn:e=>e.endsWith("](streamdown:incomplete-link)")},{handler:{name:"boldItalic",handle:e=>{if(Li.test(e))return e;let t=e.match(wi);if(!t)return e;let n=t[2],r=e.lastIndexOf(t[1]);return((e,t,n)=>!(t&&!Ci.test(t)&&!mi(e,n)&&!bi(e,n))||$i(e,n,"*"))(e,n,r)?e:(e=>{let t=0,n=0,r=!1;for(let o=0;o<e.length;o+=1)"`"===e[o]&&o+2<e.length&&"`"===e[o+1]&&"`"===e[o+2]?(n>=3&&(t+=Math.floor(n/3)),n=0,r=!r,o+=2):r||("*"===e[o]?n+=1:(n>=3&&(t+=Math.floor(n/3)),n=0));return n>=3&&(t+=Math.floor(n/3)),t})(e)%2==1?(e=>{let t=qi(e),n=Hi(e);return t%2==0&&n%2==0})(e)?e:`${e}***`:e},priority:30},optionKey:"boldItalic"},{handler:{name:"bold",handle:e=>{let t=e.match(vi);if(!t)return e;let n=t[2],r=e.lastIndexOf(t[1]);return mi(e,r)||bi(e,r)||((e,t,n)=>{if(!t||Ci.test(t))return!0;let r=e.substring(0,n).lastIndexOf("\n"),o=-1===r?0:r+1,a=e.substring(o,n);return!(!Ni.test(a)||!t.includes("\n"))||$i(e,n,"*")})(e,n,r)?e:qi(e)%2==1?n.endsWith("*")?`${e}*`:`${e}**`:e},priority:35},optionKey:"bold"},{handler:{name:"italicDoubleUnderscore",handle:e=>{let t=e.match(xi);if(!t){let t=e.match(Mi);if(t){let n=e.lastIndexOf(t[1]);if(!mi(e,n)&&!bi(e,n)&&Ui(e)%2==1)return`${e}_`}return e}let n=t[2],r=e.lastIndexOf(t[1]);return mi(e,r)||bi(e,r)||((e,t,n)=>{if(!t||Ci.test(t))return!0;let r=e.substring(0,n).lastIndexOf("\n"),o=-1===r?0:r+1,a=e.substring(o,n);return!(!Ni.test(a)||!t.includes("\n"))||$i(e,n,"_")})(e,n,r)?e:Ui(e)%2==1?`${e}__`:e},priority:40},optionKey:"italic"},{handler:{name:"italicSingleAsterisk",handle:e=>{if(!e.match(ki))return e;let t=(e=>{let t=!1;for(let n=0;n<e.length;n+=1)if("`"===e[n]&&n+2<e.length&&"`"===e[n+1]&&"`"===e[n+2])t=!t,n+=2;else if(!t&&"*"===e[n]&&"*"!==e[n-1]&&"*"!==e[n+1]&&"\\"!==e[n-1]&&!zi(e,n)){let t=n>0?e[n-1]:"",r=n<e.length-1?e[n+1]:"";if((!t||" "===t||"\t"===t||"\n"===t)&&(!r||" "===r||"\t"===r||"\n"===r)||t&&r&&Ai(t)&&Ai(r))continue;return n}return-1})(e);if(-1===t||mi(e,t)||bi(e,t))return e;let n=e.substring(t+1);return!n||Ci.test(n)?e:Hi(e)%2==1?`${e}*`:e},priority:41},optionKey:"italic"},{handler:{name:"italicSingleUnderscore",handle:e=>{if(!e.match(_i))return e;let t=Vi(e);if(-1===t)return e;let n=e.substring(t+1);if(!n||Ci.test(n)||mi(e,t)||bi(e,t))return e;if((e=>{let t=0,n=!1,r=e.length;for(let o=0;o<r;o+=1){if("`"===e[o]&&o+2<r&&"`"===e[o+1]&&"`"===e[o+2]){n=!n,o+=2;continue}if(n||"_"!==e[o])continue;let a=o>0?e[o-1]:"",i=o<r-1?e[o+1]:"";Bi(e,o,a,i)||(t+=1)}return t})(e)%2==1){let t=(e=>{if(!e.endsWith("**"))return null;let t=e.slice(0,-2);if(qi(t)%2!=1)return null;let n=t.indexOf("**"),r=Vi(t);return-1!==n&&-1!==r&&n<r?`${t}_**`:null})(e);return null!==t?t:(e=>{let t=e.length;for(;t>0&&"\n"===e[t-1];)t-=1;if(t<e.length)return`${e.slice(0,t)}_${e.slice(t)}`;return`${e}_`})(e)}return e},priority:42},optionKey:"italic"},{handler:{name:"inlineCode",handle:e=>{let t=(e=>!e.match(Ii)||e.includes("\n")?null:e.endsWith("``")&&!e.endsWith("```")?`${e}\``:e)(e);if(null!==t)return t;let n=e.match(Ei);if(n&&!(e=>(e.match(/```/g)||[]).length%2==1)(e)){let t=n[2];if(!t||Ci.test(t))return e;if((e=>{let t=0;for(let n=0;n<e.length;n+=1)"\\"===e[n]&&n+1<e.length&&"`"===e[n+1]?n+=1:"`"===e[n]&&!gi(e,n)&&(t+=1);return t})(e)%2==1)return`${e}\``}return e},priority:50},optionKey:"inlineCode"},{handler:{name:"strikethrough",handle:e=>{var t,n;let r=e.match(Si);if(r){let n=r[2];if(!n||Ci.test(n))return e;let o=e.lastIndexOf(r[1]);if(mi(e,o)||bi(e,o))return e;if((null==(t=e.match(Di))?void 0:t.length)%2==1)return`${e}~~`}else{let t=e.match(Pi);if(t){let r=e.lastIndexOf(t[0].slice(0,2));if(mi(e,r)||bi(e,r))return e;if((null==(n=e.match(Di))?void 0:n.length)%2==1)return`${e}~`}}return e},priority:60},optionKey:"strikethrough"},{handler:{name:"katex",handle:e=>(e=>{let t=0,n=!1;for(let r=0;r<e.length-1;r+=1)"`"===e[r]&&!Yi(e,r)&&(n=!n),!n&&"$"===e[r]&&"$"===e[r+1]&&(t+=1,r+=1);return t})(e)%2==0?e:(e=>{if(e.endsWith("$")&&!e.endsWith("$$"))return`${e}$`;let t=e.indexOf("$$");return-1===t||-1===e.indexOf("\n",t)||e.endsWith("\n")?`${e}$$`:`${e}\n$$`})(e),priority:70},optionKey:"katex"},{handler:{name:"inlineKatex",handle:e=>(e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1)"\\"!==e[r]?"`"!==e[r]||Yi(e,r)?!n&&"$"===e[r]&&(r+1<e.length&&"$"===e[r+1]?r+=1:t+=1):n=!n:r+=1;return t})(e)%2==1?`${e}$`:e,priority:75},optionKey:"inlineKatex"}],al=(e,t)=>{var n;if(!e||"string"!=typeof e)return e;let r=e.endsWith(" ")&&!e.endsWith("  ")?e.slice(0,-1):e,o=(e=>{var t;let n=null!=(t=null==e?void 0:e.linkMode)?t:"protocol";return ol.filter(({handler:t,optionKey:n})=>"links"===t.name?nl(null==e?void 0:e.links)||nl(null==e?void 0:e.images):"inlineKatex"===t.name?(e=>!0===e)(null==e?void 0:e.inlineKatex):nl(null==e?void 0:e[n])).map(({handler:e,earlyReturn:t})=>"links"===e.name?{handler:fi(hi({},e),{handle:e=>Qi(e,n)}),earlyReturn:"protocol"===n?t:void 0}:{handler:e,earlyReturn:t})})(t),a=(null!=(n=null==t?void 0:t.handlers)?n:[]).map(e=>{var t;return{handler:fi(hi({},e),{priority:null!=(t=e.priority)?t:rl}),earlyReturn:void 0}}),i=[...o,...a].sort((e,t)=>{var n,r;return(null!=(n=e.handler.priority)?n:0)-(null!=(r=t.handler.priority)?r:0)});for(let{handler:e,earlyReturn:t}of i)if(r=e.handle(r),null!=t&&t(r))return r;return r};function il(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=il(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ll(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=il(e))&&(r&&(r+=" "),r+=t);return r}function sl(...e){return e.filter(Boolean).join(" ")}var cl=0;function ul(e,n,r,o,a,i){n||(n={});var l,s,c=n;if("ref"in c)for(s in c={},n)"ref"==s?l=n[s]:c[s]=n[s];var u={type:e,props:c,key:r,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--cl,__i:-1,__u:0,__source:a,__self:i};if("function"==typeof e&&(l=e.defaultProps))for(s in l)void 0===c[s]&&(c[s]=l[s]);return t.vnode&&t.vnode(u),u}const dl=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,pl=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hl={};function fl(e,t){return((t||hl).jsx?pl:dl).test(e)}const ml=/[ \t\n\f\r]/g;function gl(e){return""===e.replace(ml,"")}class bl{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function yl(e,t){const n={},r={};for(const t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new bl(n,r,t)}function vl(e){return e.toLowerCase()}bl.prototype.normal={},bl.prototype.property={},bl.prototype.space=void 0;class xl{constructor(e,t){this.attribute=t,this.property=e}}xl.prototype.attribute="",xl.prototype.booleanish=!1,xl.prototype.boolean=!1,xl.prototype.commaOrSpaceSeparated=!1,xl.prototype.commaSeparated=!1,xl.prototype.defined=!1,xl.prototype.mustUseProperty=!1,xl.prototype.number=!1,xl.prototype.overloadedBoolean=!1,xl.prototype.property="",xl.prototype.spaceSeparated=!1,xl.prototype.space=void 0;let wl=0;const kl=Il(),_l=Il(),El=Il(),Sl=Il(),Cl=Il(),Nl=Il(),Tl=Il();function Il(){return 2**++wl}var Ll=Object.freeze({__proto__:null,boolean:kl,booleanish:_l,overloadedBoolean:El,number:Sl,spaceSeparated:Cl,commaSeparated:Nl,commaOrSpaceSeparated:Tl});const Ml=Object.keys(Ll);class Pl extends xl{constructor(e,t,n,r){let o=-1;if(super(e,t),Dl(this,"space",r),"number"==typeof n)for(;++o<Ml.length;){const e=Ml[o];Dl(this,Ml[o],(n&Ll[e])===Ll[e])}}}function Dl(e,t,n){n&&(e[t]=n)}function Al(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const a=new Pl(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[vl(r)]=r,n[vl(a.attribute)]=r}return new bl(t,n,e.space)}Pl.prototype.defined=!0;const Ol=Al({properties:{ariaActiveDescendant:null,ariaAtomic:_l,ariaAutoComplete:null,ariaBusy:_l,ariaChecked:_l,ariaColCount:Sl,ariaColIndex:Sl,ariaColSpan:Sl,ariaControls:Cl,ariaCurrent:null,ariaDescribedBy:Cl,ariaDetails:null,ariaDisabled:_l,ariaDropEffect:Cl,ariaErrorMessage:null,ariaExpanded:_l,ariaFlowTo:Cl,ariaGrabbed:_l,ariaHasPopup:null,ariaHidden:_l,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Cl,ariaLevel:Sl,ariaLive:null,ariaModal:_l,ariaMultiLine:_l,ariaMultiSelectable:_l,ariaOrientation:null,ariaOwns:Cl,ariaPlaceholder:null,ariaPosInSet:Sl,ariaPressed:_l,ariaReadOnly:_l,ariaRelevant:null,ariaRequired:_l,ariaRoleDescription:Cl,ariaRowCount:Sl,ariaRowIndex:Sl,ariaRowSpan:Sl,ariaSelected:_l,ariaSetSize:Sl,ariaSort:null,ariaValueMax:Sl,ariaValueMin:Sl,ariaValueNow:Sl,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function zl(e,t){return t in e?e[t]:t}function Rl(e,t){return zl(e,t.toLowerCase())}const Fl=Al({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Nl,acceptCharset:Cl,accessKey:Cl,action:null,allow:null,allowFullScreen:kl,allowPaymentRequest:kl,allowUserMedia:kl,alt:null,as:null,async:kl,autoCapitalize:null,autoComplete:Cl,autoFocus:kl,autoPlay:kl,blocking:Cl,capture:null,charSet:null,checked:kl,cite:null,className:Cl,cols:Sl,colSpan:null,content:null,contentEditable:_l,controls:kl,controlsList:Cl,coords:Sl|Nl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:kl,defer:kl,dir:null,dirName:null,disabled:kl,download:El,draggable:_l,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:kl,formTarget:null,headers:Cl,height:Sl,hidden:El,high:Sl,href:null,hrefLang:null,htmlFor:Cl,httpEquiv:Cl,id:null,imageSizes:null,imageSrcSet:null,inert:kl,inputMode:null,integrity:null,is:null,isMap:kl,itemId:null,itemProp:Cl,itemRef:Cl,itemScope:kl,itemType:Cl,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:kl,low:Sl,manifest:null,max:null,maxLength:Sl,media:null,method:null,min:null,minLength:Sl,multiple:kl,muted:kl,name:null,nonce:null,noModule:kl,noValidate:kl,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:kl,optimum:Sl,pattern:null,ping:Cl,placeholder:null,playsInline:kl,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:kl,referrerPolicy:null,rel:Cl,required:kl,reversed:kl,rows:Sl,rowSpan:Sl,sandbox:Cl,scope:null,scoped:kl,seamless:kl,selected:kl,shadowRootClonable:kl,shadowRootDelegatesFocus:kl,shadowRootMode:null,shape:null,size:Sl,sizes:null,slot:null,span:Sl,spellCheck:_l,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Sl,step:null,style:null,tabIndex:Sl,target:null,title:null,translate:null,type:null,typeMustMatch:kl,useMap:null,value:_l,width:Sl,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Cl,axis:null,background:null,bgColor:null,border:Sl,borderColor:null,bottomMargin:Sl,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:kl,declare:kl,event:null,face:null,frame:null,frameBorder:null,hSpace:Sl,leftMargin:Sl,link:null,longDesc:null,lowSrc:null,marginHeight:Sl,marginWidth:Sl,noResize:kl,noHref:kl,noShade:kl,noWrap:kl,object:null,profile:null,prompt:null,rev:null,rightMargin:Sl,rules:null,scheme:null,scrolling:_l,standby:null,summary:null,text:null,topMargin:Sl,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Sl,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:kl,disableRemotePlayback:kl,prefix:null,property:null,results:Sl,security:null,unselectable:null},space:"html",transform:Rl}),$l=Al({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"},properties:{about:Tl,accentHeight:Sl,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Sl,amplitude:Sl,arabicForm:null,ascent:Sl,attributeName:null,attributeType:null,azimuth:Sl,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Sl,by:null,calcMode:null,capHeight:Sl,className:Cl,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:Sl,diffuseConstant:Sl,direction:null,display:null,dur:null,divisor:Sl,dominantBaseline:null,download:kl,dx:null,dy:null,edgeMode:null,editable:null,elevation:Sl,enableBackground:null,end:null,event:null,exponent:Sl,externalResourcesRequired:null,fill:null,fillOpacity:Sl,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:Nl,g2:Nl,glyphName:Nl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Sl,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Sl,horizOriginX:Sl,horizOriginY:Sl,id:null,ideographic:Sl,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Sl,k:Sl,k1:Sl,k2:Sl,k3:Sl,k4:Sl,kernelMatrix:Tl,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Sl,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:Sl,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:Sl,overlineThickness:Sl,paintOrder:null,panose1:null,path:null,pathLength:Sl,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Cl,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Sl,pointsAtY:Sl,pointsAtZ:Sl,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Tl,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Tl,rev:Tl,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Tl,requiredFeatures:Tl,requiredFonts:Tl,requiredFormats:Tl,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:Sl,specularExponent:Sl,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Sl,strikethroughThickness:Sl,string:null,stroke:null,strokeDashArray:Tl,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Sl,strokeOpacity:Sl,strokeWidth:null,style:null,surfaceScale:Sl,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Tl,tabIndex:Sl,tableValues:null,target:null,targetX:Sl,targetY:Sl,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Tl,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Sl,underlineThickness:Sl,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Sl,values:null,vAlphabetic:Sl,vMathematical:Sl,vectorEffect:null,vHanging:Sl,vIdeographic:Sl,version:null,vertAdvY:Sl,vertOriginX:Sl,vertOriginY:Sl,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Sl,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:zl}),jl=Al({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),Hl=Al({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Rl}),Bl=Al({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),ql={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Ul=/[A-Z]/g,Vl=/-[a-z]/g,Wl=/^data[-\w.:]+$/i;function Yl(e){return"-"+e.toLowerCase()}function Zl(e){return e.charAt(1).toUpperCase()}const Gl=yl([Ol,Fl,jl,Hl,Bl],"html"),Ql=yl([Ol,$l,jl,Hl,Bl],"svg");var Kl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Xl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jl={},es=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,ts=/\n/g,ns=/^\s*/,rs=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,os=/^:\s*/,as=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,is=/^[;\s]*/,ls=/^\s+|\s+$/g,ss="";function cs(e){return e?e.replace(ls,ss):ss}var us=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function o(e){var t=e.match(ts);t&&(n+=t.length);var o=e.lastIndexOf("\n");r=~o?e.length-o:r+e.length}function a(){var e={line:n,column:r};return function(t){return t.position=new i(e),c(),t}}function i(e){this.start=e,this.end={line:n,column:r},this.source=t.source}function l(o){var a=new Error(t.source+":"+n+":"+r+": "+o);if(a.reason=o,a.filename=t.source,a.line=n,a.column=r,a.source=e,!t.silent)throw a}function s(t){var n=t.exec(e);if(n){var r=n[0];return o(r),e=e.slice(r.length),n}}function c(){s(ns)}function u(e){var t;for(e=e||[];t=d();)!1!==t&&e.push(t);return e}function d(){var t=a();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;ss!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,ss===e.charAt(n-1))return l("End of comment missing");var i=e.slice(2,n-2);return r+=2,o(i),e=e.slice(n),r+=2,t({type:"comment",comment:i})}}function p(){var e=a(),t=s(rs);if(t){if(d(),!s(os))return l("property missing ':'");var n=s(as),r=e({type:"declaration",property:cs(t[0].replace(es,ss)),value:n?cs(n[0].replace(es,ss)):ss});return s(is),r}}return i.prototype.content=e,c(),function(){var e,t=[];for(u(t);e=p();)!1!==e&&(t.push(e),u(t));return t}()},ds=Kl&&Kl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Jl,"__esModule",{value:!0}),Jl.default=function(e,t){let n=null;if(!e||"string"!=typeof e)return n;const r=(0,ps.default)(e),o="function"==typeof t;return r.forEach(e=>{if("declaration"!==e.type)return;const{property:r,value:a}=e;o?t(r,a,e):a&&(n=n||{},n[r]=a)}),n};const ps=ds(us);var hs={};Object.defineProperty(hs,"__esModule",{value:!0}),hs.camelCase=void 0;var fs=/^--[a-zA-Z0-9_-]+$/,ms=/-([a-z])/g,gs=/^[^-]+$/,bs=/^-(webkit|moz|ms|o|khtml)-/,ys=/^-(ms)-/,vs=function(e,t){return t.toUpperCase()},xs=function(e,t){return"".concat(t,"-")};hs.camelCase=function(e,t){return void 0===t&&(t={}),function(e){return!e||gs.test(e)||fs.test(e)}(e)?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(ys,xs):e.replace(bs,xs)).replace(ms,vs))};var ws=(Kl&&Kl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Jl),ks=hs;function _s(e,t){var n={};return e&&"string"==typeof e?((0,ws.default)(e,function(e,r){e&&r&&(n[(0,ks.camelCase)(e,t)]=r)}),n):n}_s.default=_s;var Es=Xl(_s);function Ss(e){return e&&"object"==typeof e?"position"in e||"type"in e?Ns(e.position):"start"in e||"end"in e?Ns(e):"line"in e||"column"in e?Cs(e):"":""}function Cs(e){return Ts(e&&e.line)+":"+Ts(e&&e.column)}function Ns(e){return Cs(e&&e.start)+"-"+Cs(e&&e.end)}function Ts(e){return e&&"number"==typeof e?e:1}class Is extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",o={},a=!1;if(t&&(o="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!o.cause&&e&&(a=!0,r=e.message,o.cause=e),!o.ruleId&&!o.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?o.ruleId=n:(o.source=n.slice(0,e),o.ruleId=n.slice(e+1))}if(!o.place&&o.ancestors&&o.ancestors){const e=o.ancestors[o.ancestors.length-1];e&&(o.place=e.position)}const i=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=i?i.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=i?i.line:void 0,this.name=Ss(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&"string"==typeof o.cause.stack?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Is.prototype.file="",Is.prototype.name="",Is.prototype.reason="",Is.prototype.message="",Is.prototype.stack="",Is.prototype.column=void 0,Is.prototype.line=void 0,Is.prototype.ancestors=void 0,Is.prototype.cause=void 0,Is.prototype.fatal=void 0,Is.prototype.place=void 0,Is.prototype.ruleId=void 0,Is.prototype.source=void 0;const Ls={}.hasOwnProperty,Ms=new Map,Ps=/[A-Z]/g,Ds=new Set(["table","tbody","thead","tfoot","tr"]),As=new Set(["td","th"]),Os="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function zs(e,t){if(!t||void 0===t.Fragment)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if("function"!=typeof t.jsxDEV)throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=function(e,t){return n;function n(n,r,o,a){const i=Array.isArray(o.children),l=Ln(n);return t(r,o,a,i,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}(n,t.jsxDEV)}else{if("function"!=typeof t.jsx)throw new TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw new TypeError("Expected `jsxs` in production options");r=function(e,t,n){return r;function r(e,r,o,a){const i=Array.isArray(o.children)?n:t;return a?i(r,o,a):i(r,o)}}(0,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?Ql:Gl,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},a=Rs(o,e,void 0);return a&&"string"!=typeof a?a:o.create(e,o.Fragment,{children:a||void 0},void 0)}function Rs(e,t,n){return"element"===t.type?function(e,t,n){const r=e.schema;let o=r;"svg"===t.tagName.toLowerCase()&&"html"===r.space&&(o=Ql,e.schema=o);e.ancestors.push(t);const a=Bs(e,t.tagName,!1),i=function(e,t){const n={};let r,o;for(o in t.properties)if("children"!==o&&Ls.call(t.properties,o)){const a=Hs(e,o,t.properties[o]);if(a){const[o,i]=a;e.tableCellAlignToStyle&&"align"===o&&"string"==typeof i&&As.has(t.tagName)?r=i:n[o]=i}}if(r){(n.style||(n.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r}return n}(e,t);let l=js(e,t);Ds.has(t.tagName)&&(l=l.filter(function(e){return"string"!=typeof e||!("object"==typeof(t=e)?"text"===t.type&&gl(t.value):gl(t));var t}));return Fs(e,i,a,t),$s(i,l),e.ancestors.pop(),e.schema=r,e.create(t,a,i,n)}(e,t,n):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}qs(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?function(e,t,n){const r=e.schema;let o=r;"svg"===t.name&&"html"===r.space&&(o=Ql,e.schema=o);e.ancestors.push(t);const a=null===t.name?e.Fragment:Bs(e,t.name,!0),i=function(e,t){const n={};for(const r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){const t=r.data.estree.body[0];Un(t.type);const o=t.expression;Un(o.type);const a=o.properties[0];Un(a.type),Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else qs(e,t.position);else{const o=r.name;let a;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){const t=r.value.data.estree.body[0];Un(t.type),a=e.evaluater.evaluateExpression(t.expression)}else qs(e,t.position);else a=null===r.value||r.value;n[o]=a}return n}(e,t),l=js(e,t);return Fs(e,i,a,t),$s(i,l),e.ancestors.pop(),e.schema=r,e.create(t,a,i,n)}(e,t,n):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);qs(e,t.position)}(e,t):"root"===t.type?function(e,t,n){const r={};return $s(r,js(e,t)),e.create(t,e.Fragment,r,n)}(e,t,n):"text"===t.type?function(e,t){return t.value}(0,t):void 0}function Fs(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function $s(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function js(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:Ms;for(;++r<t.children.length;){const a=t.children[r];let i;if(e.passKeys){const e="element"===a.type?a.tagName:"mdxJsxFlowElement"===a.type||"mdxJsxTextElement"===a.type?a.name:void 0;if(e){const t=o.get(e)||0;i=e+"-"+t,o.set(e,t+1)}}const l=Rs(e,a,i);void 0!==l&&n.push(l)}return n}function Hs(e,t,n){const r=function(e,t){const n=vl(t);let r=t,o=xl;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&Wl.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(Vl,Zl);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!Vl.test(e)){let n=e.replace(Ul,Yl);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}o=Pl}return new o(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?function(e,t){const n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}(n):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return Es(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};const n=t,r=new Is("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=Os+"#cannot-parse-style-attribute",r}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){const t={};let n;for(n in e)Ls.call(e,n)&&(t[Us(n)]=e[n]);return t}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?ql[r.property]||r.property:r.attribute,n]}}function Bs(e,t,n){let r;if(n)if(t.includes(".")){const e=t.split(".");let n,o=-1;for(;++o<e.length;){const t=fl(e[o])?{type:"Identifier",name:e[o]}:{type:"Literal",value:e[o]};n=n?{type:"MemberExpression",object:n,property:t,computed:Boolean(o&&"Literal"===t.type),optional:!1}:t}r=n}else r=fl(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else r={type:"Literal",value:t};if("Literal"===r.type){const t=r.value;return Ls.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);qs(e)}function qs(e,t){const n=new Is("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Os+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Us(e){let t=e.replace(Ps,Vs);return"ms-"===t.slice(0,3)&&(t="-"+t),t}function Vs(e){return"-"+e.toLowerCase()}const Ws={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Ys={tokenize:function(e){const t=e.attempt(this.parser.constructs.contentInitial,function(n){if(null===n)return void e.consume(n);return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),ea(e,t,"linePrefix")},function(t){return e.enter("paragraph"),r(t)});let n;return t;function r(t){const r=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){return null===t?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(t)):Xn(t)?(e.consume(t),e.exit("chunkText"),r):(e.consume(t),o)}}};const Zs={tokenize:function(e){const t=this,n=[];let r,o,a,i=0;return l;function l(r){if(i<n.length){const o=n[i];return t.containerState=o[1],e.attempt(o[0].continuation,s,c)(r)}return c(r)}function s(e){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&y();const n=t.events.length;let o,a=n;for(;a--;)if("exit"===t.events[a][0]&&"chunkFlow"===t.events[a][1].type){o=t.events[a][1].end;break}b(i);let l=n;for(;l<t.events.length;)t.events[l][1].end={...o},l++;return To(t.events,a+1,0,t.events.slice(n)),t.events.length=l,c(e)}return l(e)}function c(o){if(i===n.length){if(!r)return p(o);if(r.currentConstruct&&r.currentConstruct.concrete)return f(o);t.interrupt=Boolean(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Gs,u,d)(o)}function u(e){return r&&y(),b(i),p(e)}function d(e){return t.parser.lazy[t.now().line]=i!==n.length,a=t.now().offset,f(e)}function p(n){return t.containerState={},e.attempt(Gs,h,f)(n)}function h(e){return i++,n.push([t.currentConstruct,t.containerState]),p(e)}function f(n){return null===n?(r&&y(),b(0),void e.consume(n)):(r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:o}),m(n))}function m(n){return null===n?(g(e.exit("chunkFlow"),!0),b(0),void e.consume(n)):Xn(n)?(e.consume(n),g(e.exit("chunkFlow")),i=0,t.interrupt=void 0,l):(e.consume(n),m)}function g(e,n){const l=t.sliceStream(e);if(n&&l.push(null),e.previous=o,o&&(o.next=e),o=e,r.defineSkip(e.start),r.write(l),t.parser.lazy[e.start.line]){let e=r.events.length;for(;e--;)if(r.events[e][1].start.offset<a&&(!r.events[e][1].end||r.events[e][1].end.offset>a))return;const n=t.events.length;let o,l,s=n;for(;s--;)if("exit"===t.events[s][0]&&"chunkFlow"===t.events[s][1].type){if(o){l=t.events[s][1].end;break}o=!0}for(b(i),e=n;e<t.events.length;)t.events[e][1].end={...l},e++;To(t.events,s+1,0,t.events.slice(n)),t.events.length=e}}function b(r){let o=n.length;for(;o-- >r;){const r=n[o];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function y(){r.write([null]),o=void 0,r=void 0,t.containerState._closeFlow=void 0}}},Gs={tokenize:function(e,t,n){return ea(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};const Qs={tokenize:function(e){const t=this,n=e.attempt(ta,function(r){if(null===r)return void e.consume(r);return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n},e.attempt(this.parser.constructs.flowInitial,r,ea(e,e.attempt(this.parser.constructs.flow,r,e.attempt(fa,r)),"linePrefix")));return n;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(r)}}};const Ks={resolveAll:tc()},Xs=ec("string"),Js=ec("text");function ec(e){return{resolveAll:tc("text"===e?nc:void 0),tokenize:function(t){const n=this,r=this.parser.constructs[e],o=t.attempt(r,a,i);return a;function a(e){return s(e)?o(e):i(e)}function i(e){if(null!==e)return t.enter("data"),t.consume(e),l;t.consume(e)}function l(e){return s(e)?(t.exit("data"),o(e)):(t.consume(e),l)}function s(e){if(null===e)return!0;const t=r[e];let o=-1;if(t)for(;++o<t.length;){const e=t[o];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function tc(e){return function(t,n){let r,o=-1;for(;++o<=t.length;)void 0===r?t[o]&&"data"===t[o][1].type&&(r=o,o++):t[o]&&"data"===t[o][1].type||(o!==r+2&&(t[r][1].end=t[o-1][1].end,t.splice(r+2,o-r-2),o=r+2),r=void 0);return e?e(t,n):t}}function nc(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){const r=e[n-1][1],o=t.sliceStream(r);let a,i=o.length,l=-1,s=0;for(;i--;){const e=o[i];if("string"==typeof e){for(l=e.length;32===e.charCodeAt(l-1);)s++,l--;if(l)break;l=-1}else if(-2===e)a=!0,s++;else if(-1!==e){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const o={type:n===e.length||a||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?l:r.start._bufferIndex+l,_index:r.start._index+i,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...o.start},r.start.offset===r.end.offset?Object.assign(r,o):(e.splice(n,0,["enter",o,t],["exit",o,t]),n+=2)}n++}return e}const rc={42:Fa,43:Fa,45:Fa,48:Fa,49:Fa,50:Fa,51:Fa,52:Fa,53:Fa,54:Fa,55:Fa,56:Fa,57:Fa,62:na},oc={91:xa},ac={[-2]:la,[-1]:la,32:la},ic={35:_a,42:Ra,45:[Ha,Ra],60:Ca,61:Ha,95:Ra,96:ia,126:ia},lc={38:oa,92:ra},sc={[-5]:za,[-4]:za,[-3]:za,33:Aa,38:oa,42:Ko,60:[Jo,Ia],91:Oa,92:[ka,ra],93:La,95:Ko,96:ca},cc={null:[Ko,Ks]};var uc=Object.freeze({__proto__:null,document:rc,contentInitial:oc,flowInitial:ac,flow:ic,string:lc,text:sc,insideSpan:cc,attentionMarkers:{null:[42,95]},disable:{null:[]}});function dc(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},a=[];let i=[],l=[];const s={attempt:g(function(e,t){b(e,t.from)}),check:g(m),consume:function(e){Xn(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,y()):-1!==e&&(r.column++,r.offset++);r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===i[r._index].length&&(r._bufferIndex=-1,r._index++));c.previous=e},enter:function(e,t){const n=t||{};return n.type=e,n.start=p(),c.events.push(["enter",n,c]),l.push(n),n},exit:function(e){const t=l.pop();return t.end=p(),c.events.push(["exit",t,c]),t},interrupt:g(m,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){o[e.line]=e.column,y()},events:[],now:p,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const a=e[n];let i;if("string"==typeof a)i=a;else switch(a){case-5:i="\r";break;case-4:i="\n";break;case-3:i="\r\n";break;case-2:i=t?" ":"\t";break;case-1:if(!t&&o)continue;i=" ";break;default:i=String.fromCharCode(a)}o=-2===a,r.push(i)}return r.join("")}(d(e),t)},sliceStream:d,write:function(e){if(i=Io(i,e),h(),null!==i[i.length-1])return[];return b(t,0),c.events=Qo(a,c.events,c),c.events}};let u=t.tokenize.call(c,s);return t.resolveAll&&a.push(t),c;function d(e){return function(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,a=t.end._bufferIndex;let i;if(n===o)i=[e[n].slice(r,a)];else{if(i=e.slice(n,o),r>-1){const e=i[0];"string"==typeof e?i[0]=e.slice(r):i.shift()}a>0&&i.push(e[o].slice(0,a))}return i}(i,e)}function p(){const{_bufferIndex:e,_index:t,line:n,column:o,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:o,offset:a}}function h(){let e;for(;r._index<i.length;){const t=i[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)f(t.charCodeAt(r._bufferIndex));else f(t)}}function f(e){u=u(e)}function m(e,t){t.restore()}function g(e,t){return function(n,o,a){let i,u,d,h;return Array.isArray(n)?f(n):"tokenize"in n?f([n]):function(e){return t;function t(t){const n=null!==t&&e[t],r=null!==t&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}(n);function f(e){return i=e,u=0,0===e.length?a:m(e[u])}function m(e){return function(n){h=function(){const e=p(),t=c.previous,n=c.currentConstruct,o=c.events.length,a=Array.from(l);return{from:o,restore:i};function i(){r=e,c.previous=t,c.currentConstruct=n,c.events.length=o,l=a,y()}}(),d=e,e.partial||(c.currentConstruct=e);if(e.name&&c.parser.constructs.disable.null.includes(e.name))return b();return e.tokenize.call(t?Object.assign(Object.create(c),t):c,s,g,b)(n)}}function g(t){return e(d,h),o}function b(e){return h.restore(),++u<i.length?m(i[u]):a}}}function b(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&To(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function y(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}const pc=/[\0\t\n\r]/g;const hc={}.hasOwnProperty;function fc(e,t,n){return t&&"object"==typeof t&&(n=t,t=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(te),autolinkProtocol:S,autolinkEmail:S,atxHeading:a(K),blockQuote:a(W),characterEscape:S,characterReference:S,codeFenced:a(Y),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:a(Y,i),codeText:a(Z,i),codeTextData:S,data:S,codeFlowValue:S,definition:a(G),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:a(Q),hardBreakEscape:a(X),hardBreakTrailing:a(X),htmlFlow:a(J,i),htmlFlowData:S,htmlText:a(J,i),htmlTextData:S,image:a(ee),label:i,link:a(te),listItem:a(re),listItemValue:p,listOrdered:a(ne,d),listUnordered:a(ne),paragraph:a(oe),reference:$,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:a(K),strong:a(ae),thematicBreak:a(le)},exit:{atxHeading:s(),atxHeadingSequence:w,autolink:s(),autolinkEmail:V,autolinkProtocol:U,blockQuote:s(),characterEscapeValue:C,characterReferenceMarkerHexadecimal:H,characterReferenceMarkerNumeric:H,characterReferenceValue:B,characterReference:q,codeFenced:s(g),codeFencedFence:m,codeFencedFenceInfo:h,codeFencedFenceMeta:f,codeFlowValue:C,codeIndented:s(b),codeText:s(M),codeTextData:C,data:C,definition:s(),definitionDestinationString:x,definitionLabelString:y,definitionTitleString:v,emphasis:s(),hardBreakEscape:s(T),hardBreakTrailing:s(T),htmlFlow:s(I),htmlFlowData:C,htmlText:s(L),htmlTextData:C,image:s(D),label:O,labelText:A,lineEnding:N,link:s(P),listItem:s(),listOrdered:s(),listUnordered:s(),paragraph:s(),referenceString:j,resourceDestinationString:z,resourceTitleString:R,resource:F,setextHeading:s(E),setextHeadingLineSequence:_,setextHeadingText:k,strong:s(),thematicBreak:s()}};gc(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(e){let r={type:"root",children:[]};const a={stack:[r],tokenStack:[],config:t,enter:l,exit:c,buffer:i,resume:u,data:n},s=[];let d=-1;for(;++d<e.length;)if("listOrdered"===e[d][1].type||"listUnordered"===e[d][1].type)if("enter"===e[d][0])s.push(d);else{d=o(e,s.pop(),d)}for(d=-1;++d<e.length;){const n=t[e[d][0]];hc.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){const e=a.tokenStack[a.tokenStack.length-1];(e[1]||yc).call(a,void 0,e[0])}for(r.position={start:mc(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:mc(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function o(e,t,n){let r,o,a,i,l=t-1,s=-1,c=!1;for(;++l<=n;){const t=e[l];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?s++:s--,i=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||i||s||a||(a=l),i=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:i=void 0}if(!s&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===s&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let i=l;for(o=void 0;i--;){const t=e[i];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;o&&(e[o][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",o=i}else if("linePrefix"!==t[1].type&&"blockQuotePrefix"!==t[1].type&&"blockQuotePrefixWhitespace"!==t[1].type&&"blockQuoteMarker"!==t[1].type&&"listItemIndent"!==t[1].type)break}a&&(!o||a<o)&&(r._spread=!0),r.end=Object.assign({},o?e[o][1].start:t[1].end),e.splice(o||l,0,["exit",r,t[2]]),l++,n++}if("listItemPrefix"===t[1].type){const o={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=o,e.splice(l,0,["enter",o,t[2]]),l++,n++,a=void 0,i=!0}}}return e[t][1]._spread=c,n}function a(e,t){return n;function n(n){l.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function l(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:mc(t.start),end:void 0}}function s(e){return t;function t(t){e&&e.call(this,t),c.call(this,t)}}function c(e,t){const n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+Ss({start:e.start,end:e.end})+"): it’s not open");if(r[0].type!==e.type)if(t)t.call(this,e,r[0]);else{(r[1]||yc).call(this,e,r[0])}n.position.end=mc(e.end)}function u(){return Qr(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(e){if(this.data.expectingFirstListItemValue){this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function h(){const e=this.resume();this.stack[this.stack.length-1].lang=e}function f(){const e=this.resume();this.stack[this.stack.length-1].meta=e}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}function y(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=vr(this.sliceSerialize(e)).toLowerCase()}function v(){const e=this.resume();this.stack[this.stack.length-1].title=e}function x(){const e=this.resume();this.stack[this.stack.length-1].url=e}function w(e){const t=this.stack[this.stack.length-1];if(!t.depth){const n=this.sliceSerialize(e).length;t.depth=n}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function _(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2}function E(){this.data.setextHeadingSlurpLineEnding=void 0}function S(e){const t=this.stack[this.stack.length-1].children;let n=t[t.length-1];n&&"text"===n.type||(n=ie(),n.position={start:mc(e.start),end:void 0},t.push(n)),this.stack.push(n)}function C(e){const t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=mc(e.end)}function N(e){const n=this.stack[this.stack.length-1];if(this.data.atHardBreak){return n.children[n.children.length-1].position.end=mc(e.end),void(this.data.atHardBreak=void 0)}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(S.call(this,e),C.call(this,e))}function T(){this.data.atHardBreak=!0}function I(){const e=this.resume();this.stack[this.stack.length-1].value=e}function L(){const e=this.resume();this.stack[this.stack.length-1].value=e}function M(){const e=this.resume();this.stack[this.stack.length-1].value=e}function P(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function D(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function A(e){const t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=function(e){return e.replace(mo,go)}(t),n.identifier=vr(t).toLowerCase()}function O(){const e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];if(this.data.inReference=!0,"link"===n.type){const t=e.children;n.children=t}else n.alt=t}function z(){const e=this.resume();this.stack[this.stack.length-1].url=e}function R(){const e=this.resume();this.stack[this.stack.length-1].title=e}function F(){this.data.inReference=void 0}function $(){this.data.referenceType="collapsed"}function j(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=vr(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"}function H(e){this.data.characterReferenceType=e.type}function B(e){const t=this.sliceSerialize(e),n=this.data.characterReferenceType;let r;if(n)r=fo(t,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0;else{r=ho(t)}this.stack[this.stack.length-1].value+=r}function q(e){this.stack.pop().position.end=mc(e.end)}function U(e){C.call(this,e);this.stack[this.stack.length-1].url=this.sliceSerialize(e)}function V(e){C.call(this,e);this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)}function W(){return{type:"blockquote",children:[]}}function Y(){return{type:"code",lang:null,meta:null,value:""}}function Z(){return{type:"inlineCode",value:""}}function G(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Q(){return{type:"emphasis",children:[]}}function K(){return{type:"heading",depth:0,children:[]}}function X(){return{type:"break"}}function J(){return{type:"html",value:""}}function ee(){return{type:"image",title:null,url:"",alt:null}}function te(){return{type:"link",title:null,url:"",children:[]}}function ne(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}function re(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}function oe(){return{type:"paragraph",children:[]}}function ae(){return{type:"strong",children:[]}}function ie(){return{type:"text",value:""}}function le(){return{type:"thematicBreak"}}}(n)(function(e){for(;!pa(e););return e}(function(e){const t={constructs:Mo([uc,...(e||{}).extensions||[]]),content:n(Ys),defined:[],document:n(Zs),flow:n(Qs),lazy:{},string:n(Xs),text:n(Js)};return t;function n(e){return function(n){return dc(t,e,n)}}}(n).document().write(function(){let e,t=1,n="",r=!0;return function(o,a,i){const l=[];let s,c,u,d,p;for(o=n+("string"==typeof o?o.toString():new TextDecoder(a||void 0).decode(o)),u=0,n="",r&&(65279===o.charCodeAt(0)&&u++,r=void 0);u<o.length;){if(pc.lastIndex=u,s=pc.exec(o),d=s&&void 0!==s.index?s.index:o.length,p=o.charCodeAt(d),!s){n=o.slice(u);break}if(10===p&&u===d&&e)l.push(-3),e=void 0;else switch(e&&(l.push(-5),e=void 0),u<d&&(l.push(o.slice(u,d)),t+=d-u),p){case 0:l.push(65533),t++;break;case 9:for(c=4*Math.ceil(t/4),l.push(-2);t++<c;)l.push(-1);break;case 10:l.push(-4),t=1;break;default:e=!0,t=1}u=d+1}return i&&(e&&l.push(-5),n&&l.push(n),l.push(null)),l}}()(e,t,!0))))}function mc(e){return{line:e.line,column:e.column,offset:e.offset}}function gc(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?gc(e,r):bc(e,r)}}function bc(e,t){let n;for(n in t)if(hc.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function yc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ss({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ss({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ss({start:t.start,end:t.end})+") is still open")}function vc(e){const t=this;t.parser=function(n){return fc(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function xc(e,t){const n=t.referenceType;let r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];const o=e.all(t),a=o[0];a&&"text"===a.type?a.value="["+a.value:o.unshift({type:"text",value:"["});const i=o[o.length-1];return i&&"text"===i.type?i.value+=r:o.push({type:"text",value:r}),o}function wc(e){const t=e.spread;return null==t?e.children.length>1:t}function kc(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const a=[];for(;r;)a.push(_c(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return a.push(_c(t.slice(o),o>0,!1)),a.join("")}function _c(e,t,n){let r=0,o=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(o-1);for(;9===t||32===t;)o--,t=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}const Ec={blockquote:function(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){const n=t.value?t.value+"\n":"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a},delete:function(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){const n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=Go(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let i,l=e.footnoteCounts.get(r);void 0===l?(l=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=a+1,l+=1,e.footnoteCounts.set(r,l);const s={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,s);const c={type:"element",tagName:"sup",properties:{},children:[s]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return xc(e,t);const o={src:Go(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(o.title=r.title);const a={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,a),e.applyData(t,a)},image:function(e,t){const n={src:Go(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return xc(e,t);const o={href:Go(r.url||"")};null!==r.title&&void 0!==r.title&&(o.title=r.title);const a={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)},link:function(e,t){const n={href:Go(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){const r=e.all(t),o=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=wc(n[r])}return t}(n):wc(t),a={},i=[];if("boolean"==typeof t.checked){const e=r[0];let n;e&&"element"===e.type&&"p"===e.tagName?n=e:(n={type:"element",tagName:"p",properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:"text",value:" "}),n.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const e=r[l];(o||0!==l||"element"!==e.type||"p"!==e.tagName)&&i.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||o?i.push(e):i.push(...e.children)}const s=r[r.length-1];s&&(o||"element"!==s.type||"p"!==s.tagName)&&i.push({type:"text",value:"\n"});const c={type:"element",tagName:"li",properties:a,children:i};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){const n={},r=e.all(t);let o=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++o<r.length;){const e=r[o];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)},paragraph:function(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),o.push(n)}if(n.length>0){const r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=Ln(t.children[1]),i=In(t.children[t.children.length-1]);a&&i&&(r.position={start:a,end:i}),o.push(r)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,a),e.applyData(t,a)},tableCell:function(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){const r=n?n.children:void 0,o=0===(r?r.indexOf(t):1)?"th":"td",a=n&&"table"===n.type?n.align:void 0,i=a?a.length:t.children.length;let l=-1;const s=[];for(;++l<i;){const n=t.children[l],r={},i=a?a[l]:void 0;i&&(r.align=i);let c={type:"element",tagName:o,properties:r,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(n,c)),s.push(c)}const c={type:"element",tagName:"tr",properties:{},children:e.wrap(s,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){const n={type:"text",value:kc(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:Sc,yaml:Sc,definition:Sc,footnoteDefinition:Sc};function Sc(){}function Cc(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Nc(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}const Tc={}.hasOwnProperty,Ic={};function Lc(e,t){e.position&&(t.position=Pn(e))}function Mc(e,t){let n=t;if(e&&e.data){const t=e.data.hName,r=e.data.hChildren,o=e.data.hProperties;if("string"==typeof t)if("element"===n.type)n.tagName=t;else{n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}}"element"===n.type&&o&&Object.assign(n.properties,Tn(o)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function Pc(e,t){const n=t.data||{},r=!("value"in t)||Tc.call(n,"hProperties")||Tc.call(n,"hChildren")?{type:"element",tagName:"div",properties:{},children:e.all(t)}:{type:"text",value:t.value};return e.patch(t,r),e.applyData(t,r)}function Dc(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function Ac(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function Oc(e,t){const n=function(e,t){const n=t||Ic,r=new Map,o=new Map,a=new Map,i={...Ec,...n.handlers},l={all:function(e){const t=[];if("children"in e){const n=e.children;let r=-1;for(;++r<n.length;){const o=l.one(n[r],e);if(o){if(r&&"break"===n[r-1].type&&(Array.isArray(o)||"text"!==o.type||(o.value=Ac(o.value)),!Array.isArray(o)&&"element"===o.type)){const e=o.children[0];e&&"text"===e.type&&(e.value=Ac(e.value))}Array.isArray(o)?t.push(...o):t.push(o)}}}return t},applyData:Mc,definitionById:r,footnoteById:o,footnoteCounts:a,footnoteOrder:[],handlers:i,one:function(e,t){const n=e.type,r=l.handlers[n];if(Tc.call(l.handlers,n)&&r)return r(l,e,t);if(l.options.passThrough&&l.options.passThrough.includes(n)){if("children"in e){const{children:t,...n}=e,r=Tn(n);return r.children=l.all(e),r}return Tn(e)}return(l.options.unknownHandler||Pc)(l,e,t)},options:n,patch:Lc,wrap:Dc};return sn(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){const t="definition"===e.type?r:o,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),l}(e,t),r=n.one(e,void 0),o=function(e){const t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Cc,r=e.options.footnoteBackLabel||Nc,o=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let s=-1;for(;++s<e.footnoteOrder.length;){const o=e.footnoteById.get(e.footnoteOrder[s]);if(!o)continue;const a=e.all(o),i=String(o.identifier).toUpperCase(),c=Go(i.toLowerCase());let u=0;const d=[],p=e.footnoteCounts.get(i);for(;void 0!==p&&++u<=p;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof n?n:n(s,u);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(u>1?"-"+u:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(s,u),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}const h=a[a.length-1];if(h&&"element"===h.type&&"p"===h.tagName){const e=h.children[h.children.length-1];e&&"text"===e.type?e.value+=" ":h.children.push({type:"text",value:" "}),h.children.push(...d)}else a.push(...d);const f={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(a,!0)};e.patch(o,f),l.push(f)}if(0!==l.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Tn(i),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:"\n"}]}}(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&a.children.push({type:"text",value:"\n"},o),a}function zc(e,t){return e&&"run"in e?async function(n,r){const o=Oc(n,{file:r,...t});await e.run(o,r)}:function(n,r){return Oc(n,{file:r,...e||t})}}function Rc(e){if(e)throw e}var Fc=Object.prototype.hasOwnProperty,$c=Object.prototype.toString,jc=Object.defineProperty,Hc=Object.getOwnPropertyDescriptor,Bc=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===$c.call(e)},qc=function(e){if(!e||"[object Object]"!==$c.call(e))return!1;var t,n=Fc.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Fc.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||Fc.call(e,t)},Uc=function(e,t){jc&&"__proto__"===t.name?jc(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},Vc=function(e,t){if("__proto__"===t){if(!Fc.call(e,t))return;if(Hc)return Hc(e,t).value}return e[t]},Wc=function e(){var t,n,r,o,a,i,l=arguments[0],s=1,c=arguments.length,u=!1;for("boolean"==typeof l&&(u=l,l=arguments[1]||{},s=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});s<c;++s)if(null!=(t=arguments[s]))for(n in t)r=Vc(l,n),l!==(o=Vc(t,n))&&(u&&o&&(qc(o)||(a=Bc(o)))?(a?(a=!1,i=r&&Bc(r)?r:[]):i=r&&qc(r)?r:{},Uc(l,{name:n,newValue:e(u,i,o)})):void 0!==o&&Uc(l,{name:n,newValue:o}));return l},Yc=Xl(Wc);function Zc(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function Gc(){const e=[],t={run:function(...t){let n=-1;const r=t.pop();if("function"!=typeof r)throw new TypeError("Expected function as last argument, not "+r);!function o(a,...i){const l=e[++n];let s=-1;if(a)r(a);else{for(;++s<t.length;)null!==i[s]&&void 0!==i[s]||(i[s]=t[s]);t=i,l?function(e,t){let n;return r;function r(...t){const r=e.length>t.length;let i;r&&t.push(o);try{i=e.apply(this,t)}catch(e){if(r&&n)throw e;return o(e)}r||(i&&i.then&&"function"==typeof i.then?i.then(a,o):i instanceof Error?o(i):a(i))}function o(e,...r){n||(n=!0,t(e,...r))}function a(e){o(null,e)}}(l,o)(...i):r(null,...i)}}(null,...t)},use:function(n){if("function"!=typeof n)throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}const Qc={basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');Kc(e);let n,r=0,o=-1,a=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;a--;)if(47===e.codePointAt(a)){if(n){r=a+1;break}}else o<0&&(n=!0,o=a+1);return o<0?"":e.slice(r,o)}if(t===e)return"";let i=-1,l=t.length-1;for(;a--;)if(47===e.codePointAt(a)){if(n){r=a+1;break}}else i<0&&(n=!0,i=a+1),l>-1&&(e.codePointAt(a)===t.codePointAt(l--)?l<0&&(o=a):(l=-1,o=i));r===o?o=i:o<0&&(o=e.length);return e.slice(r,o)},dirname:function(e){if(Kc(e),0===e.length)return".";let t,n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},extname:function(e){Kc(e);let t,n=e.length,r=-1,o=0,a=-1,i=0;for(;n--;){const l=e.codePointAt(n);if(47!==l)r<0&&(t=!0,r=n+1),46===l?a<0?a=n:1!==i&&(i=1):a>-1&&(i=-1);else if(t){o=n+1;break}}if(a<0||r<0||0===i||1===i&&a===r-1&&a===o+1)return"";return e.slice(a,r)},join:function(...e){let t,n=-1;for(;++n<e.length;)Kc(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){Kc(e);const t=47===e.codePointAt(0);let n=function(e,t){let n,r,o="",a=0,i=-1,l=0,s=-1;for(;++s<=e.length;){if(s<e.length)n=e.codePointAt(s);else{if(47===n)break;n=47}if(47===n){if(i===s-1||1===l);else if(i!==s-1&&2===l){if(o.length<2||2!==a||46!==o.codePointAt(o.length-1)||46!==o.codePointAt(o.length-2))if(o.length>2){if(r=o.lastIndexOf("/"),r!==o.length-1){r<0?(o="",a=0):(o=o.slice(0,r),a=o.length-1-o.lastIndexOf("/")),i=s,l=0;continue}}else if(o.length>0){o="",a=0,i=s,l=0;continue}t&&(o=o.length>0?o+"/..":"..",a=2)}else o.length>0?o+="/"+e.slice(i+1,s):o=e.slice(i+1,s),a=s-i-1;i=s,l=0}else 46===n&&l>-1?l++:l=-1}return o}(e,!t);0!==n.length||t||(n=".");n.length>0&&47===e.codePointAt(e.length-1)&&(n+="/");return t?"/"+n:n}(t)},sep:"/"};function Kc(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Xc={cwd:function(){return"/"}};function Jc(e){return Boolean(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}function eu(e){if("string"==typeof e)e=new URL(e);else if(!Jc(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const t=e.pathname;let n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){const e=t.codePointAt(n+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}const tu=["history","path","basename","stem","extname","dirname"];class nu{constructor(e){let t;t=e?Jc(e)?{path:e}:"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":Xc.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n,r=-1;for(;++r<tu.length;){const e=tu[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)tu.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?Qc.basename(this.path):void 0}set basename(e){ou(e,"basename"),ru(e,"basename"),this.path=Qc.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?Qc.dirname(this.path):void 0}set dirname(e){au(this.basename,"dirname"),this.path=Qc.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?Qc.extname(this.path):void 0}set extname(e){if(ru(e,"extname"),au(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Qc.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Jc(e)&&(e=eu(e)),ou(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?Qc.basename(this.path,this.extname):void 0}set stem(e){ou(e,"stem"),ru(e,"stem"),this.path=Qc.join(this.dirname||"",e+(this.extname||""))}fail(e,t,n){const r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){const r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){const r=new Is(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){if(void 0===this.value)return"";if("string"==typeof this.value)return this.value;return new TextDecoder(e||void 0).decode(this.value)}}function ru(e,t){if(e&&e.includes(Qc.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Qc.sep+"`")}function ou(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function au(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}const iu=function(e){const t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},lu={}.hasOwnProperty;class su extends iu{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(){const e=new su;let t=-1;for(;++t<this.attachers.length;){const n=this.attachers[t];e.use(...n)}return e.data(Yc(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2===arguments.length?(pu("data",this.frozen),this.namespace[e]=t,this):lu.call(this.namespace,e)&&this.namespace[e]||void 0:e?(pu("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...n]=this.attachers[this.freezeIndex];if(!1===n[0])continue;!0===n[0]&&(n[0]=void 0);const r=t.call(e,...n);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=mu(e),n=this.parser||this.Parser;return uu("parse",n),n(String(t),t)}process(e,t){const n=this;return this.freeze(),uu("process",this.parser||this.Parser),du("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,o){const a=mu(e),i=n.parse(a);function l(e,n){e||!n?o(e):r?r(n):t(void 0,n)}n.run(i,a,function(e,t,r){if(e||!t||!r)return l(e);const o=t,a=n.stringify(o,r);var i;"string"==typeof(i=a)||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(i)?r.value=a:r.result=a,l(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),uu("processSync",this.parser||this.Parser),du("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,Rc(e),t=r}),fu("processSync","process",n),t}run(e,t,n){hu(e),this.freeze();const r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?o(void 0,n):new Promise(o);function o(o,a){const i=mu(t);r.run(e,i,function(t,r,i){const l=r||e;t?a(t):o?o(l):n(void 0,l,i)})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){Rc(e),n=t,r=!0}),fu("runSync","run",r),n}stringify(e,t){this.freeze();const n=mu(t),r=this.compiler||this.Compiler;return du("stringify",r),hu(e),r(e,n)}use(e,...t){const n=this.attachers,r=this.namespace;if(pu("use",this.frozen),null==e);else if("function"==typeof e)l(e,t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?i(e):a(e)}return this;function o(e){if("function"==typeof e)l(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;l(t,n)}else a(e)}}function a(e){if(!("plugins"in e)&&!("settings"in e))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");i(e.plugins),e.settings&&(r.settings=Yc(!0,r.settings,e.settings))}function i(e){let t=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;){o(e[t])}}}function l(e,t){let r=-1,o=-1;for(;++r<n.length;)if(n[r][0]===e){o=r;break}if(-1===o)n.push([e,...t]);else if(t.length>0){let[r,...a]=t;const i=n[o][1];Zc(i)&&Zc(r)&&(r=Yc(!0,i,r)),n[o]=[e,r,...a]}}}}const cu=(new su).freeze();function uu(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function du(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function pu(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function hu(e){if(!Zc(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function fu(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function mu(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new nu(e)}function gu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var bu={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function yu(e){bu=e}var vu={exec:()=>null};function xu(e,t=""){let n="string"==typeof e?e:e.source,r={replace:(e,t)=>{let o="string"==typeof t?t:t.source;return o=o.replace(ku.caret,"$1"),n=n.replace(e,o),r},getRegex:()=>new RegExp(n,t)};return r}var wu=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ku={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},_u=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Eu=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Su=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Cu=xu(Su).replace(/bull/g,Eu).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Nu=xu(Su).replace(/bull/g,Eu).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Tu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Iu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Lu=xu(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Iu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Mu=xu(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Eu).getRegex(),Pu="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Du=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Au=xu("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",Du).replace("tag",Pu).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ou=xu(Tu).replace("hr",_u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pu).getRegex(),zu={blockquote:xu(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ou).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:Lu,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:_u,html:Au,lheading:Cu,list:Mu,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:Ou,table:vu,text:/^[^\n]+/},Ru=xu("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",_u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pu).getRegex(),Fu={...zu,lheading:Nu,table:Ru,paragraph:xu(Tu).replace("hr",_u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ru).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pu).getRegex()},$u={...zu,html:xu("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Du).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:vu,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:xu(Tu).replace("hr",_u).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Cu).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ju=/^( {2,}|\\)\n(?!\s*$)/,Hu=/[\p{P}\p{S}]/u,Bu=/[\s\p{P}\p{S}]/u,qu=/[^\s\p{P}\p{S}]/u,Uu=xu(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Bu).getRegex(),Vu=/(?!~)[\p{P}\p{S}]/u,Wu=xu(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",wu?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Yu=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Zu=xu(Yu,"u").replace(/punct/g,Hu).getRegex(),Gu=xu(Yu,"u").replace(/punct/g,Vu).getRegex(),Qu="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ku=xu(Qu,"gu").replace(/notPunctSpace/g,qu).replace(/punctSpace/g,Bu).replace(/punct/g,Hu).getRegex(),Xu=xu(Qu,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,Vu).getRegex(),Ju=xu("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,qu).replace(/punctSpace/g,Bu).replace(/punct/g,Hu).getRegex(),ed=xu(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Hu).getRegex(),td=xu("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)","gu").replace(/notPunctSpace/g,qu).replace(/punctSpace/g,Bu).replace(/punct/g,Hu).getRegex(),nd=xu(/\\(punct)/,"gu").replace(/punct/g,Hu).getRegex(),rd=xu(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),od=xu(Du).replace("(?:--\x3e|$)","--\x3e").getRegex(),ad=xu("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",od).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),id=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ld=xu(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",id).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),sd=xu(/^!?\[(label)\]\[(ref)\]/).replace("label",id).replace("ref",Iu).getRegex(),cd=xu(/^!?\[(ref)\](?:\[\])?/).replace("ref",Iu).getRegex(),ud=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,dd={_backpedal:vu,anyPunctuation:nd,autolink:rd,blockSkip:Wu,br:ju,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:vu,delLDelim:vu,delRDelim:vu,emStrongLDelim:Zu,emStrongRDelimAst:Ku,emStrongRDelimUnd:Ju,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:ld,nolink:cd,punctuation:Uu,reflink:sd,reflinkSearch:xu("reflink|nolink(?!\\()","g").replace("reflink",sd).replace("nolink",cd).getRegex(),tag:ad,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:vu},pd={...dd,link:xu(/^!?\[(label)\]\((.*?)\)/).replace("label",id).getRegex(),reflink:xu(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",id).getRegex()},hd={...dd,emStrongRDelimAst:Xu,emStrongLDelim:Gu,delLDelim:ed,delRDelim:td,url:xu(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ud).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:xu(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ud).getRegex()},fd={...hd,br:xu(ju).replace("{2,}","*").getRegex(),text:xu(hd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},md={normal:zu,gfm:Fu,pedantic:$u},gd={normal:dd,gfm:hd,breaks:fd,pedantic:pd},bd={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},yd=e=>bd[e];function vd(e,t){if(t){if(ku.escapeTest.test(e))return e.replace(ku.escapeReplace,yd)}else if(ku.escapeTestNoEncode.test(e))return e.replace(ku.escapeReplaceNoEncode,yd);return e}function xd(e){try{e=encodeURI(e).replace(ku.percentDecode,"%")}catch{return null}return e}function wd(e,t){let n=e.replace(ku.findPipe,(e,t,n)=>{let r=!1,o=t;for(;--o>=0&&"\\"===n[o];)r=!r;return r?"|":" |"}),r=n.split(ku.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(ku.slashPipe,"|");return r}function kd(e,t,n){let r=e.length;if(0===r)return"";let o=0;for(;o<r;){let a=e.charAt(r-o-1);if(a!==t||n){if(a===t||!n)break;o++}else o++}return e.slice(0,r-o)}function _d(e,t=0){let n=t,r="";for(let t of e)if("\t"===t){let e=4-n%4;r+=" ".repeat(e),n+=e}else r+=t,n++;return r}function Ed(e,t,n,r,o){let a=t.href,i=t.title||null,l=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let s={type:"!"===e[0].charAt(0)?"image":"link",raw:n,href:a,title:i,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,s}var Sd=class{options;rules;lexer;constructor(e){this.options=e||bu}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:kd(e,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=function(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(null===r)return t;let o=r[1];return t.split("\n").map(e=>{let t=e.match(n.other.beginningSpace);if(null===t)return e;let[r]=t;return r.length>=o.length?e.slice(o.length):e}).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=kd(e,"#");(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:kd(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=kd(t[0],"\n").split("\n"),n="",r="",o=[];for(;e.length>0;){let t,a=!1,i=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))i.push(e[t]),a=!0;else{if(a)break;i.push(e[t])}e=e.slice(t);let l=i.join("\n"),s=l.replace(this.rules.other.blockquoteSetextReplace,"\n    $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${l}`:l,r=r?`${r}\n${s}`:s;let c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(s,o,!0),this.lexer.state.top=c,0===e.length)break;let u=o.at(-1);if("code"===u?.type)break;if("blockquote"===u?.type){let t=u,a=t.raw+"\n"+e.join("\n"),i=this.blockquote(a);o[o.length-1]=i,n=n.substring(0,n.length-t.raw.length)+i.raw,r=r.substring(0,r.length-t.text.length)+i.text;break}if("list"===u?.type){let t=u,a=t.raw+"\n"+e.join("\n"),i=this.list(a);o[o.length-1]=i,n=n.substring(0,n.length-u.raw.length)+i.raw,r=r.substring(0,r.length-t.raw.length)+i.raw,e=a.substring(o.at(-1).raw.length).split("\n");continue}}return{type:"blockquote",raw:n,tokens:o,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let a=this.rules.other.listItemRegex(n),i=!1;for(;e;){let n=!1,r="",l="";if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let s=_d(t[2].split("\n",1)[0],t[1].length),c=e.split("\n",1)[0],u=!s.trim(),d=0;if(this.options.pedantic?(d=2,l=s.trimStart()):u?d=t[1].length+1:(d=s.search(this.rules.other.nonSpaceChar),d=d>4?1:d,l=s.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(c)&&(r+=c+"\n",e=e.substring(c.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),o=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),i=this.rules.other.htmlBeginRegex(d),p=this.rules.other.blockquoteBeginRegex(d);for(;e;){let h,f=e.split("\n",1)[0];if(c=f,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting,"  "),h=c):h=c.replace(this.rules.other.tabCharGlobal,"    "),o.test(c)||a.test(c)||i.test(c)||p.test(c)||t.test(c)||n.test(c))break;if(h.search(this.rules.other.nonSpaceChar)>=d||!c.trim())l+="\n"+h.slice(d);else{if(u||s.replace(this.rules.other.tabCharGlobal,"    ").search(this.rules.other.nonSpaceChar)>=4||o.test(s)||a.test(s)||n.test(s))break;l+="\n"+c}u=!c.trim(),r+=f+"\n",e=e.substring(f.length+1),s=h.slice(d)}}o.loose||(i?o.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(i=!0)),o.items.push({type:"list_item",raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(l),loose:!1,text:l,tokens:[]}),o.raw+=r}let l=o.items.at(-1);if(!l)return;l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd(),o.raw=o.raw.trimEnd();for(let e of o.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,""),"text"===e.tokens[0]?.type||"paragraph"===e.tokens[0]?.type){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,"");break}}let t=this.rules.other.listTaskCheckbox.exec(e.raw);if(t){let n={type:"checkbox",raw:t[0]+" ",checked:"[ ]"!==t[0]};e.checked=n.checked,o.loose?e.tokens[0]&&["paragraph","text"].includes(e.tokens[0].type)&&"tokens"in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=n.raw+e.tokens[0].raw,e.tokens[0].text=n.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(n)):e.tokens.unshift({type:"paragraph",raw:n.raw,text:n.raw,tokens:[n]}):e.tokens.unshift(n)}}if(!o.loose){let t=e.tokens.filter(e=>"space"===e.type),n=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw));o.loose=n}}if(o.loose)for(let e of o.items){e.loose=!0;for(let t of e.tokens)"text"===t.type&&(t.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=wd(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push("right"):this.rules.other.tableAlignCenter.test(e)?a.align.push("center"):this.rules.other.tableAlignLeft.test(e)?a.align.push("left"):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of o)a.rows.push(wd(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=kd(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}(t[2],"()");if(-2===e)return;if(e>-1){let n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),Ed(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return Ed(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(r&&(r[1]||r[2]||r[3]||r[4])&&(!r[4]||!n.match(this.rules.other.unicodeAlphaNumeric))&&(!r[1]&&!r[3]||!n||this.rules.inline.punctuation.exec(n))){let n,o,a=[...r[0]].length-1,i=a,l=0,s="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(s.lastIndex=0,t=t.slice(-1*e.length+a);null!==(r=s.exec(t));){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n)continue;if(o=[...n].length,r[3]||r[4]){i+=o;continue}if((r[5]||r[6])&&a%3&&!((a+o)%3)){l+=o;continue}if(i-=o,i>0)continue;o=Math.min(o,o+i+l);let t=[...r[0]][0].length,s=e.slice(0,a+r.index+t+o);if(Math.min(a,o)%2){let e=s.slice(1,-1);return{type:"em",raw:s,text:e,tokens:this.lexer.inlineTokens(e)}}let c=s.slice(2,-2);return{type:"strong",raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n,o,a=[...r[0]].length-1,i=a,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*e.length+a);null!==(r=l.exec(t));){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n||(o=[...n].length,o!==a))continue;if(r[3]||r[4]){i+=o;continue}if(i-=o,i>0)continue;o=Math.min(o,o+i);let t=[...r[0]][0].length,l=e.slice(0,a+r.index+t+o),s=l.slice(a,-a);return{type:"del",raw:l,text:s,tokens:this.lexer.inlineTokens(s)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=t[0],n="mailto:"+e;else{let r;do{r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(r!==t[0]);e=t[0],n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},Cd=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||bu,this.options.tokenizer=this.options.tokenizer||new Sd,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:ku,block:md.normal,inline:gd.normal};this.options.pedantic?(t.block=md.pedantic,t.inline=gd.pedantic):this.options.gfm&&(t.block=md.gfm,this.options.breaks?t.inline=gd.breaks:t.inline=gd.gfm),this.tokenizer.rules=t}static get rules(){return{block:md,inline:gd}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(ku.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(ku.tabCharGlobal,"    ").replace(ku.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0)))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);1===r.raw.length&&void 0!==n?n.raw+="\n":t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startBlock){let t,n=1/0,r=e.slice(1);this.options.extensions.startBlock.forEach(e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(o=e.substring(0,n+1))}if(this.state.top&&(r=this.tokenizer.paragraph(o))){let a=t.at(-1);n&&"paragraph"===a?.type?(a.raw+=(a.raw.endsWith("\n")?"":"\n")+r.raw,a.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=o.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n,r=e,o=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!==(o=this.tokenizer.rules.inline.reflinkSearch.exec(r));)e.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!==(o=this.tokenizer.rules.inline.anyPunctuation.exec(r));)r=r.slice(0,o.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!==(o=this.tokenizer.rules.inline.blockSkip.exec(r));)n=o[2]?o[2].length:0,r=r.slice(0,o.index+n)+"["+"a".repeat(o[0].length-n-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let a=!1,i="";for(;e;){let n;if(a||(i=""),a=!1,this.options.extensions?.inline?.some(r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))continue;if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length);let r=t.at(-1);"text"===n.type&&"text"===r?.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,r,i)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e,r,i)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}let o=e;if(this.options.extensions?.startInline){let t,n=1/0,r=e.slice(1);this.options.extensions.startInline.forEach(e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(o=e.substring(0,n+1))}if(n=this.tokenizer.inlineText(o)){e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(i=n.raw.slice(-1)),a=!0;let r=t.at(-1);"text"===r?.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}},Nd=class{options;parser;constructor(e){this.options=e||bu}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(ku.notSpaceStart)?.[0],o=e.replace(ku.endingNewline,"")+"\n";return r?'<pre><code class="language-'+vd(r)+'">'+(n?o:vd(o,!0))+"</code></pre>\n":"<pre><code>"+(n?o:vd(o,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){let t=e.ordered,n=e.start,r="";for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let o=t?"ol":"ul";return"<"+o+(t&&1!==n?' start="'+n+'"':"")+">\n"+r+"</"+o+">\n"}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r="";for(let t=0;t<e.rows.length;t++){let o=e.rows[t];n="";for(let e=0;e<o.length;e++)n+=this.tablecell(o[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+r+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${vd(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),o=xd(e);if(null===o)return r;let a='<a href="'+(e=o)+'"';return t&&(a+=' title="'+vd(t)+'"'),a+=">"+r+"</a>",a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=xd(e);if(null===o)return vd(n);let a=`<img src="${e=o}" alt="${vd(n)}"`;return t&&(a+=` title="${vd(t)}"`),a+=">",a}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:vd(e.text)}},Td=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Id=class e{options;renderer;textRenderer;constructor(e){this.options=e||bu,this.options.renderer=this.options.renderer||new Nd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Td}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t="";for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==n||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(e.type)){t+=n||"";continue}}let o=r;switch(o.type){case"space":t+=this.renderer.space(o);break;case"hr":t+=this.renderer.hr(o);break;case"heading":t+=this.renderer.heading(o);break;case"code":t+=this.renderer.code(o);break;case"table":t+=this.renderer.table(o);break;case"blockquote":t+=this.renderer.blockquote(o);break;case"list":t+=this.renderer.list(o);break;case"checkbox":t+=this.renderer.checkbox(o);break;case"html":t+=this.renderer.html(o);break;case"def":t+=this.renderer.def(o);break;case"paragraph":t+=this.renderer.paragraph(o);break;case"text":t+=this.renderer.text(o);break;default:{let e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n="";for(let r=0;r<e.length;r++){let o=e[r];if(this.options.extensions?.renderers?.[o.type]){let e=this.options.extensions.renderers[o.type].call({parser:this},o);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=e||"";continue}}let a=o;switch(a.type){case"escape":case"text":n+=t.text(a);break;case"html":n+=t.html(a);break;case"link":n+=t.link(a);break;case"image":n+=t.image(a);break;case"checkbox":n+=t.checkbox(a);break;case"strong":n+=t.strong(a);break;case"em":n+=t.em(a);break;case"codespan":n+=t.codespan(a);break;case"br":n+=t.br(a);break;case"del":n+=t.del(a);break;default:{let e='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}},Ld=class{options;block;constructor(e){this.options=e||bu}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Cd.lex:Cd.lexInline}provideParser(e=this.block){return e?Id.parse:Id.parseInline}},Md=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Id;Renderer=Nd;TextRenderer=Td;Lexer=Cd;Tokenizer=Sd;Hooks=Ld;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let o=e[r].flat(1/0);n=n.concat(this.walkTokens(o,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Nd(this.defaults);for(let n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let r=n,o=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=o.apply(t,e);return!1===n&&(n=a.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Sd(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let r=n,o=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=o.apply(t,e);return!1===n&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Ld;for(let n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let r=n,o=e.hooks[r],a=t[r];Ld.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Ld.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await o.call(t,e);return a.call(t,n)})();let r=o.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await o.apply(t,e);return!1===n&&(n=await a.apply(t,e)),n})();let n=o.apply(t,e);return!1===n&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Cd.lex(e,t??this.defaults)}parser(e,t){return Id.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},o={...this.defaults,...r},a=this.onError(!!o.silent,!!o.async);if(!0===this.defaults.async&&!1===r.async)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return a(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let n=o.hooks?await o.hooks.preprocess(t):t,r=await(o.hooks?await o.hooks.provideLexer(e):e?Cd.lex:Cd.lexInline)(n,o),a=o.hooks?await o.hooks.processAllTokens(r):r;o.walkTokens&&await Promise.all(this.walkTokens(a,o.walkTokens));let i=await(o.hooks?await o.hooks.provideParser(e):e?Id.parse:Id.parseInline)(a,o);return o.hooks?await o.hooks.postprocess(i):i})().catch(a);try{o.hooks&&(t=o.hooks.preprocess(t));let n=(o.hooks?o.hooks.provideLexer(e):e?Cd.lex:Cd.lexInline)(t,o);o.hooks&&(n=o.hooks.processAllTokens(n)),o.walkTokens&&this.walkTokens(n,o.walkTokens);let r=(o.hooks?o.hooks.provideParser(e):e?Id.parse:Id.parseInline)(n,o);return o.hooks&&(r=o.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+vd(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Pd(e,t){return Md.parse(e,t)}Pd.options=Pd.setOptions=function(e){return Md.setOptions(e),Pd.defaults=Md.defaults,yu(Pd.defaults),Pd},Pd.getDefaults=gu,Pd.defaults=bu,Pd.use=function(...e){return Md.use(...e),Pd.defaults=Md.defaults,yu(Pd.defaults),Pd},Pd.walkTokens=function(e,t){return Md.walkTokens(e,t)},Pd.parseInline=Md.parseInline,Pd.Parser=Id,Pd.parser=Id.parse,Pd.Renderer=Nd,Pd.TextRenderer=Td,Pd.Lexer=Cd,Pd.lexer=Cd.lex,Pd.Tokenizer=Sd,Pd.Hooks=Ld,Pd.parse=Pd,Pd.options,Pd.setOptions,Pd.use,Pd.walkTokens,Pd.parseInline,Id.parse,Cd.lex;var Dd=300,Ad="300px",Od=500;function zd(e={}){let{immediate:t=!1,debounceDelay:n=Dd,rootMargin:r=Ad,idleTimeout:o=Od}=e,[a,i]=ce(!1),l=he(null),s=he(null),c=he(null),u=me(()=>e=>{let t=Date.now();return window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1)},[]),d=me(()=>"undefined"!=typeof window&&window.requestIdleCallback?(e,t)=>window.requestIdleCallback(e,t):u,[u]),p=me(()=>"undefined"!=typeof window&&window.cancelIdleCallback?e=>window.cancelIdleCallback(e):e=>{clearTimeout(e)},[]);return de(()=>{if(t)return void i(!0);let e=l.current;if(!e)return;s.current&&(clearTimeout(s.current),s.current=null),c.current&&(p(c.current),c.current=null);let a=()=>{s.current&&(clearTimeout(s.current),s.current=null),c.current&&(p(c.current),c.current=null)},u=e=>{a(),s.current=window.setTimeout(()=>{var t,n;let r=e.takeRecords();(0===r.length||null!=(n=null==(t=r.at(-1))?void 0:t.isIntersecting)&&n)&&(e=>{c.current=d(t=>{t.timeRemaining()>0||t.didTimeout?(i(!0),e.disconnect()):c.current=d(()=>{i(!0),e.disconnect()},{timeout:o/2})},{timeout:o})})(e)},n)},h=(e,t)=>{e.isIntersecting?u(t):a()},f=new IntersectionObserver(e=>{for(let t of e)h(t,f)},{rootMargin:r,threshold:0});return f.observe(e),()=>{s.current&&clearTimeout(s.current),c.current&&p(c.current),f.disconnect()}},[t,n,r,o,p,d]),{shouldRender:a,containerRef:l}}var Rd=/\s/,Fd=/^\s+$/,$d=new Set(["code","pre","svg","math","annotation"]),jd=(e,t,n,r,o)=>{let a=t.at(-1);if(!a||!("children"in a))return;if((e=>e.some(e=>(e=>"object"==typeof e&&null!==e&&"type"in e&&"element"===e.type)(e)&&$d.has(e.tagName)))(t))return an;let i=a,l=i.children.indexOf(e);if(-1===l)return;let s=e.value;if(!s.trim())return void(o.count+=s.length);let c="char"===n.sep?(e=>{let t=[],n="";for(let r of e)Rd.test(r)?n+=r:(n&&(t.push(n),n=""),t.push(r));return n&&t.push(n),t})(s):(e=>{let t=[],n="",r=!1;for(let o of e){let e=Rd.test(o);e!==r&&n&&(t.push(n),n=""),n+=o,r=e}return n&&t.push(n),t})(s),u=r.prevContentLength,d=c.map(e=>{let t=o.count;if(o.count+=e.length,Fd.test(e))return{type:"text",value:e};let r=u>0&&t<u,a=r?0:o.newIndex++*n.stagger;return((e,t,n,r,o,a)=>{let i=`--sd-animation:sd-${t};--sd-duration:${o?0:n}ms;--sd-easing:${r}`;return a&&(i+=`;--sd-delay:${a}ms`),{type:"element",tagName:"span",properties:{"data-sd-animate":!0,style:i},children:[{type:"text",value:e}]}})(e,n.animation,n.duration,n.easing,r,a)});return i.children.splice(l,1,...d),l+d.length},Hd=0;function Bd(e){var t,n,r,o,a;let i={animation:null!=(t=null==e?void 0:e.animation)?t:"fadeIn",duration:null!=(n=null==e?void 0:e.duration)?n:150,easing:null!=(r=null==e?void 0:e.easing)?r:"ease",sep:null!=(o=null==e?void 0:e.sep)?o:"word",stagger:null!=(a=null==e?void 0:e.stagger)?a:40},l={prevContentLength:0,lastRenderCharCount:0},s=Hd++,c=()=>e=>{let t={count:0,newIndex:0};ln(e,"text",(e,n)=>jd(e,n,i,l,t)),l.lastRenderCharCount=t.count,l.prevContentLength=0};return Object.defineProperty(c,"name",{value:`rehypeAnimate$${s}`}),{name:"animate",type:"animate",rehypePlugin:c,setPrevContentLength(e){l.prevContentLength=e},getLastRenderCharCount(){let e=l.lastRenderCharCount;return l.lastRenderCharCount=0,e}}}Bd();var qd=Z(!1),Ud=(...e)=>sl(ll(e)),Vd=e=>e?(...t)=>((e,t)=>{if(!e||!t)return t;let n=`${e}:`;return t.split(/\s+/).filter(Boolean).map(t=>t.startsWith(n)?t:`${e}:${t}`).join(" ")})(e,sl(ll(t))):Ud,Wd=(e,t,n)=>{let r="string"==typeof t&&n.startsWith("text/csv")?"\ufeff":"",o="string"==typeof t?new Blob([r+t],{type:n}):t,a=URL.createObjectURL(o),i=document.createElement("a");i.href=a,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(a)},Yd=Z(Ud),Zd=()=>be(Yd),Gd=Ud("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-6","before:mr-4","before:text-[13px]","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),Qd=ze(({children:e,result:t,language:n,className:r,startLine:o,lineNumbers:a=!0,...i})=>{let l=Zd(),s=me(()=>l(Gd),[l]),c=me(()=>{let e={};return t.bg&&(e["--sdm-bg"]=t.bg),t.fg&&(e["--sdm-fg"]=t.fg),t.rootStyle&&Object.assign(e,(e=>{let t={};for(let n of e.split(";")){let e=n.indexOf(":");if(e>0){let r=n.slice(0,e).trim(),o=n.slice(e+1).trim();r&&o&&(t[r]=o)}}return t})(t.rootStyle)),e},[t.bg,t.fg,t.rootStyle]);return ul("div",{className:l(r,"overflow-x-auto rounded-md border border-border bg-background p-4 text-sm"),"data-language":n,"data-streamdown":"code-block-body",...i,children:ul("pre",{className:l(r,"bg-[var(--sdm-bg,inherit]","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]"),style:c,children:ul("code",{className:a?l("[counter-increment:line_0] [counter-reset:line]"):void 0,style:a&&o&&o>1?{counterReset:"line "+(o-1)}:void 0,children:t.tokens.map((e,t)=>ul("span",{className:a?s:void 0,children:0===e.length||1===e.length&&""===e[0].content?"\n":e.map((e,t)=>{let n={},r=!!e.bgColor;if(e.color&&(n["--sdm-c"]=e.color),e.bgColor&&(n["--sdm-tbg"]=e.bgColor),e.htmlStyle)for(let[t,o]of Object.entries(e.htmlStyle))"color"===t?n["--sdm-c"]=o:"background-color"===t?(n["--sdm-tbg"]=o,r=!0):n[t]=o;return ul("span",{className:l("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",r&&"bg-[var(--sdm-tbg)]",r&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:n,...e.htmlAttrs,children:e.content},t)})},t))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine&&e.lineNumbers===t.lineNumbers),Kd=({className:e,language:t,style:n,isIncomplete:r,...o})=>ul("div",{className:Zd()("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",e),"data-incomplete":r||void 0,"data-language":t,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...n},...o}),Xd=Z({code:""}),Jd=()=>be(Xd),ep=({language:e})=>{let t=Zd();return ul("div",{className:t("flex h-8 items-center text-muted-foreground text-xs"),"data-language":e,"data-streamdown":"code-block-header",children:ul("span",{className:t("ml-1 font-mono lowercase"),children:e})})},tp=Ze(()=>Promise.resolve().then(function(){return sg}).then(e=>({default:e.HighlightedCodeBlockBody}))),np=({code:e,language:t,className:n,children:r,isIncomplete:o=!1,startLine:a,lineNumbers:i,...l})=>{let s=Zd(),c=me(()=>(e=>{let t=e.length;for(;t>0&&"\n"===e[t-1];)t--;return e.slice(0,t)})(e),[e]),u=me(()=>({bg:"transparent",fg:"inherit",tokens:c.split("\n").map(e=>[{content:e,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[c]);return ul(Xd.Provider,{value:{code:e},children:ul(Kd,{isIncomplete:o,language:t,children:[ul(ep,{language:t}),r?ul("div",{className:s("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:ul("div",{className:s("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),"data-streamdown":"code-block-actions",children:r})}):null,ul(We,{fallback:ul(Qd,{className:n,language:t,lineNumbers:i,result:u,startLine:a,...l}),children:ul(tp,{className:n,code:c,language:t,lineNumbers:i,raw:u,startLine:a,...l})})]})})},rp={CheckIcon:e=>ul("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ul("path",{clipRule:"evenodd",d:"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z",fill:"currentColor",fillRule:"evenodd"})}),CopyIcon:e=>ul("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ul("path",{clipRule:"evenodd",d:"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z",fill:"currentColor",fillRule:"evenodd"})}),DownloadIcon:e=>ul("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ul("path",{clipRule:"evenodd",d:"M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z",fill:"currentColor",fillRule:"evenodd"})}),ExternalLinkIcon:e=>ul("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ul("path",{clipRule:"evenodd",d:"M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z",fill:"currentColor",fillRule:"evenodd"})}),Loader2Icon:e=>ul("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:[ul("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),ul("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),ul("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),ul("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),ul("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),ul("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),ul("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),ul("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),ul("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),ul("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),Maximize2Icon:e=>ul("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ul("path",{clipRule:"evenodd",d:"M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z",fill:"currentColor",fillRule:"evenodd"})}),RotateCcwIcon:e=>ul("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ul("path",{clipRule:"evenodd",d:"M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z",fill:"currentColor",fillRule:"evenodd"})}),XIcon:e=>ul("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ul("path",{clipRule:"evenodd",d:"M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z",fill:"currentColor",fillRule:"evenodd"})}),ZoomInIcon:e=>ul("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ul("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})}),ZoomOutIcon:e=>ul("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ul("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})})},op=Z(rp),ap=({icons:e,children:t})=>{let n=he(e),r=he(e?{...rp,...e}:rp);((e,t)=>{if(e===t)return!0;if(!e||!t)return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>e[n]===t[n])})(n.current,e)||(n.current=e,r.current=e?{...rp,...e}:rp);let o=r.current;return ul(op.Provider,{value:o,children:t})},ip=()=>be(op),lp={copyCode:"Copy Code",downloadFile:"Download file",downloadDiagram:"Download diagram",downloadDiagramAsSvg:"Download diagram as SVG",downloadDiagramAsPng:"Download diagram as PNG",downloadDiagramAsMmd:"Download diagram as MMD",viewFullscreen:"View fullscreen",exitFullscreen:"Exit fullscreen",mermaidFormatSvg:"SVG",mermaidFormatPng:"PNG",mermaidFormatMmd:"MMD",copyTable:"Copy table",copyTableAsMarkdown:"Copy table as Markdown",copyTableAsCsv:"Copy table as CSV",copyTableAsTsv:"Copy table as TSV",downloadTable:"Download table",downloadTableAsCsv:"Download table as CSV",downloadTableAsMarkdown:"Download table as Markdown",tableFormatMarkdown:"Markdown",tableFormatCsv:"CSV",tableFormatTsv:"TSV",imageNotAvailable:"Image not available",downloadImage:"Download image",openExternalLink:"Open external link?",externalLinkWarning:"You're about to visit an external website.",close:"Close",copyLink:"Copy link",copied:"Copied",openLink:"Open link"},sp=Z(lp),cp=()=>be(sp),up=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:o,code:a,...i})=>{let l=Zd(),[s,c]=ce(!1),u=he(0),{code:d}=Jd(),{isAnimating:p}=be(af),h=cp(),f=null!=a?a:d;de(()=>()=>{window.clearTimeout(u.current)},[]);let m=ip(),g=s?m.CheckIcon:m.CopyIcon;return ul("button",{className:l("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",o),"data-streamdown":"code-block-copy-button",disabled:p,onClick:async()=>{var r;if("undefined"!=typeof window&&null!=(r=null==navigator?void 0:navigator.clipboard)&&r.writeText)try{s||(await navigator.clipboard.writeText(f),c(!0),null==e||e(),u.current=window.setTimeout(()=>c(!1),n))}catch(e){null==t||t(e)}else null==t||t(new Error("Clipboard API not available"))},title:h.copyCode,type:"button",...i,children:null!=r?r:ul(g,{size:14})})},dp={"1c":"1c","1c-query":"1cq",abap:"abap","actionscript-3":"as",ada:"ada",adoc:"adoc","angular-html":"html","angular-ts":"ts",apache:"conf",apex:"cls",apl:"apl",applescript:"applescript",ara:"ara",asciidoc:"adoc",asm:"asm",astro:"astro",awk:"awk",ballerina:"bal",bash:"sh",bat:"bat",batch:"bat",be:"be",beancount:"beancount",berry:"berry",bibtex:"bib",bicep:"bicep",blade:"blade.php",bsl:"bsl",c:"c","c#":"cs","c++":"cpp",cadence:"cdc",cairo:"cairo",cdc:"cdc",clarity:"clar",clj:"clj",clojure:"clj","closure-templates":"soy",cmake:"cmake",cmd:"cmd",cobol:"cob",codeowners:"CODEOWNERS",codeql:"ql",coffee:"coffee",coffeescript:"coffee","common-lisp":"lisp",console:"sh",coq:"v",cpp:"cpp",cql:"cql",crystal:"cr",cs:"cs",csharp:"cs",css:"css",csv:"csv",cue:"cue",cypher:"cql",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",docker:"dockerfile",dockerfile:"dockerfile",dotenv:"env","dream-maker":"dm",edge:"edge",elisp:"el",elixir:"ex",elm:"elm","emacs-lisp":"el",erb:"erb",erl:"erl",erlang:"erl",f:"f","f#":"fs",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"f90",f95:"f95",fennel:"fnl",fish:"fish",fluent:"ftl",for:"for","fortran-fixed-form":"f","fortran-free-form":"f90",fs:"fs",fsharp:"fs",fsl:"fsl",ftl:"ftl",gdresource:"tres",gdscript:"gd",gdshader:"gdshader",genie:"gs",gherkin:"feature","git-commit":"gitcommit","git-rebase":"gitrebase",gjs:"js",gleam:"gleam","glimmer-js":"js","glimmer-ts":"ts",glsl:"glsl",gnuplot:"plt",go:"go",gql:"gql",graphql:"graphql",groovy:"groovy",gts:"gts",hack:"hack",haml:"haml",handlebars:"hbs",haskell:"hs",haxe:"hx",hbs:"hbs",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",hs:"hs",html:"html","html-derivative":"html",http:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",jade:"jade",java:"java",javascript:"js",jinja:"jinja",jison:"jison",jl:"jl",js:"js",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",julia:"jl",kotlin:"kt",kql:"kql",kt:"kt",kts:"kts",kusto:"kql",latex:"tex",lean:"lean",lean4:"lean",less:"less",liquid:"liquid",lisp:"lisp",lit:"lit",llvm:"ll",log:"log",logo:"logo",lua:"lua",luau:"luau",make:"mak",makefile:"mak",markdown:"md",marko:"marko",matlab:"m",md:"md",mdc:"mdc",mdx:"mdx",mediawiki:"wiki",mermaid:"mmd",mips:"s",mipsasm:"s",mmd:"mmd",mojo:"mojo",move:"move",nar:"nar",narrat:"narrat",nextflow:"nf",nf:"nf",nginx:"conf",nim:"nim",nix:"nix",nu:"nu",nushell:"nu",objc:"m","objective-c":"m","objective-cpp":"mm",ocaml:"ml",pascal:"pas",perl:"pl",perl6:"p6",php:"php",plsql:"pls",po:"po",polar:"polar",postcss:"pcss",pot:"pot",potx:"potx",powerquery:"pq",powershell:"ps1",prisma:"prisma",prolog:"pl",properties:"properties",proto:"proto",protobuf:"proto",ps:"ps",ps1:"ps1",pug:"pug",puppet:"pp",purescript:"purs",py:"py",python:"py",ql:"ql",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",racket:"rkt",raku:"raku",razor:"cshtml",rb:"rb",reg:"reg",regex:"regex",regexp:"regexp",rel:"rel",riscv:"s",rs:"rs",rst:"rst",ruby:"rb",rust:"rs",sas:"sas",sass:"sass",scala:"scala",scheme:"scm",scss:"scss",sdbl:"sdbl",sh:"sh",shader:"shader",shaderlab:"shader",shell:"sh",shellscript:"sh",shellsession:"sh",smalltalk:"st",solidity:"sol",soy:"soy",sparql:"rq",spl:"spl",splunk:"spl",sql:"sql","ssh-config":"config",stata:"do",styl:"styl",stylus:"styl",svelte:"svelte",swift:"swift","system-verilog":"sv",systemd:"service",talon:"talon",talonscript:"talon",tasl:"tasl",tcl:"tcl",templ:"templ",terraform:"tf",tex:"tex",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"ts","ts-tags":"ts",tsp:"tsp",tsv:"tsv",tsx:"tsx",turtle:"ttl",twig:"twig",typ:"typ",typescript:"ts",typespec:"tsp",typst:"typ",v:"v",vala:"vala",vb:"vb",verilog:"v",vhdl:"vhdl",vim:"vim",viml:"vim",vimscript:"vim",vue:"vue","vue-html":"html","vue-vine":"vine",vy:"vy",vyper:"vy",wasm:"wasm",wenyan:"wy",wgsl:"wgsl",wiki:"wiki",wikitext:"wiki",wit:"wit",wl:"wl",wolfram:"wl",xml:"xml",xsl:"xsl",yaml:"yaml",yml:"yml",zenscript:"zs",zig:"zig",zsh:"zsh","文言":"wy"},pp=({onDownload:e,onError:t,language:n,children:r,className:o,code:a,...i})=>{let l=Zd(),{code:s}=Jd(),{isAnimating:c}=be(af),u=cp(),d=ip(),p=null!=a?a:s,h=`file.${n&&n in dp?dp[n]:"txt"}`;return ul("button",{className:l("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",o),"data-streamdown":"code-block-download-button",disabled:c,onClick:()=>{try{Wd(h,p,"text/plain"),null==e||e()}catch(e){null==t||t(e)}},title:u.downloadFile,type:"button",...i,children:null!=r?r:ul(d.DownloadIcon,{size:14})})},hp=()=>{let{Loader2Icon:e}=ip(),t=Zd();return ul("div",{className:t("w-full divide-y divide-border overflow-hidden rounded-xl border border-border"),children:[ul("div",{className:t("h-[46px] w-full bg-muted/80")}),ul("div",{className:t("flex w-full items-center justify-center p-4"),children:ul(e,{className:t("size-4 animate-spin")})})]})},fp=/\.[^/.]+$/,mp=0,gp=()=>{1===(mp+=1)&&(document.body.style.overflow="hidden")},bp=()=>{0===(mp=Math.max(0,mp-1))&&(document.body.style.overflow="")},yp=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:o,CopyIcon:a,ExternalLinkIcon:i,XIcon:l}=ip(),s=Zd(),[c,u]=ce(!1),d=cp(),p=ge(async()=>{try{await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch(e){}},[e]),h=ge(()=>{r(),n()},[r,n]);return de(()=>{if(t){gp();let e=e=>{"Escape"===e.key&&n()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e),bp()}}},[t,n]),t?ul("div",{className:s("fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm"),"data-streamdown":"link-safety-modal",onClick:n,onKeyDown:e=>{"Escape"===e.key&&n()},role:"button",tabIndex:0,children:ul("div",{className:s("relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg"),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:"presentation",children:[ul("button",{className:s("absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:n,title:d.close,type:"button",children:ul(l,{size:16})}),ul("div",{className:s("flex flex-col gap-2"),children:[ul("div",{className:s("flex items-center gap-2 font-semibold text-lg"),children:[ul(i,{size:20}),ul("span",{children:d.openExternalLink})]}),ul("p",{className:s("text-muted-foreground text-sm"),children:d.externalLinkWarning})]}),ul("div",{className:s("break-all rounded-md bg-muted p-3 font-mono text-sm",e.length>100&&"max-h-32 overflow-y-auto"),children:e}),ul("div",{className:s("flex gap-2"),children:[ul("button",{className:s("flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted"),onClick:p,type:"button",children:ul(_,c?{children:[ul(o,{size:14}),ul("span",{children:d.copied})]}:{children:[ul(a,{size:14}),ul("span",{children:d.copyLink})]})}),ul("button",{className:s("flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90"),onClick:h,type:"button",children:[ul(i,{size:14}),ul("span",{children:d.openLink})]})]})]})}):null},vp=Z(null),xp=()=>be(vp),wp=()=>{var e;let t=xp();return null!=(e=null==t?void 0:t.mermaid)?e:null},kp=({chart:e,children:t,className:n,onDownload:r,config:o,onError:a})=>{let i=Zd(),[l,s]=ce(!1),c=he(null),{isAnimating:u}=be(af),d=ip(),p=wp(),h=cp(),f=async t=>{try{if("mmd"===t)return Wd("diagram.mmd",e,"text/plain"),s(!1),void(null==r||r(t));if(!p)return void(null==a||a(new Error("Mermaid plugin not available")));let n=p.getMermaid(o),i=e.split("").reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),l=`mermaid-${Math.abs(i)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:c}=await n.render(l,e);if(!c)return void(null==a||a(new Error("SVG not found. Please wait for the diagram to render.")));if("svg"===t)return Wd("diagram.svg",c,"image/svg+xml"),s(!1),void(null==r||r(t));if("png"===t){let e=await(e=>{let t=5;return new Promise((n,r)=>{let o="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e))),a=new Image;a.crossOrigin="anonymous",a.onload=()=>{let e=document.createElement("canvas"),o=a.width*t,i=a.height*t;e.width=o,e.height=i;let l=e.getContext("2d");l?(l.drawImage(a,0,0,o,i),e.toBlob(e=>{e?n(e):r(new Error("Failed to create PNG blob"))},"image/png")):r(new Error("Failed to create 2D canvas context for PNG export"))},a.onerror=()=>r(new Error("Failed to load SVG image")),a.src=o})})(c);return Wd("diagram.png",e,"image/png"),null==r||r(t),void s(!1)}}catch(e){null==a||a(e)}};return de(()=>{let e=e=>{let t=e.composedPath();c.current&&!t.includes(c.current)&&s(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]),ul("div",{className:i("relative"),ref:c,children:[ul("button",{className:i("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",n),disabled:u,onClick:()=>s(!l),title:h.downloadDiagram,type:"button",children:null!=t?t:ul(d.DownloadIcon,{size:14})}),l?ul("div",{className:i("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[ul("button",{className:i("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>f("svg"),title:h.downloadDiagramAsSvg,type:"button",children:h.mermaidFormatSvg}),ul("button",{className:i("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>f("png"),title:h.downloadDiagramAsPng,type:"button",children:h.mermaidFormatPng}),ul("button",{className:i("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>f("mmd"),title:h.downloadDiagramAsMmd,type:"button",children:h.mermaidFormatMmd})]}):null]})},_p=({chart:e,config:t,onFullscreen:n,onExit:r,className:o,...a})=>{let{Maximize2Icon:i,XIcon:l}=ip(),s=Zd(),[c,u]=ce(!1),{isAnimating:d,controls:p}=be(af),h=cp(),f=(()=>{if("boolean"==typeof p)return p;let e=p.mermaid;return!1!==e&&(!0===e||void 0===e||!1!==e.panZoom)})(),m=()=>{u(!c)};return de(()=>{if(c){gp();let e=e=>{"Escape"===e.key&&u(!1)};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e),bp()}}},[c]),de(()=>{c?null==n||n():r&&r()},[c,n,r]),ul(_,{children:[ul("button",{className:s("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",o),disabled:d,onClick:m,title:h.viewFullscreen,type:"button",...a,children:ul(i,{size:14})}),c?Je(ul("div",{className:s("fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm"),onClick:m,onKeyDown:e=>{"Escape"===e.key&&m()},role:"button",tabIndex:0,children:[ul("button",{className:s("absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:m,title:h.exitFullscreen,type:"button",children:ul(l,{size:20})}),ul("div",{className:s("flex size-full items-center justify-center p-4"),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:"presentation",children:ul(uf,{chart:e,className:s("size-full [&_svg]:h-auto [&_svg]:w-auto"),config:t,fullscreen:!0,showControls:f})})]}),document.body):null]})},Ep=e=>{var t,n;let r=[],o=[],a=e.querySelectorAll("thead th");for(let e of a)r.push((null==(t=e.textContent)?void 0:t.trim())||"");let i=e.querySelectorAll("tbody tr");for(let e of i){let t=[],r=e.querySelectorAll("td");for(let e of r)t.push((null==(n=e.textContent)?void 0:n.trim())||"");o.push(t)}return{headers:r,rows:o}},Sp=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1,n=!1;for(let r of e){if('"'===r){t=!0,n=!0;break}(","===r||"\n"===r)&&(t=!0)}return t?n?`"${e.replace(/"/g,'""')}"`:`"${e}"`:e},o=t.length>0?n.length+1:n.length,a=new Array(o),i=0;t.length>0&&(a[i]=t.map(r).join(","),i+=1);for(let e of n)a[i]=e.map(r).join(","),i+=1;return a.join("\n")},Cp=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1;for(let n of e)if("\t"===n||"\n"===n||"\r"===n){t=!0;break}if(!t)return e;let n=[];for(let t of e)"\t"===t?n.push("\\t"):"\n"===t?n.push("\\n"):"\r"===t?n.push("\\r"):n.push(t);return n.join("")},o=t.length>0?n.length+1:n.length,a=new Array(o),i=0;t.length>0&&(a[i]=t.map(r).join("\t"),i+=1);for(let e of n)a[i]=e.map(r).join("\t"),i+=1;return a.join("\n")},Np=e=>{let t=!1;for(let n of e)if("\\"===n||"|"===n){t=!0;break}if(!t)return e;let n=[];for(let t of e)"\\"===t?n.push("\\\\"):"|"===t?n.push("\\|"):n.push(t);return n.join("")},Tp=e=>{let{headers:t,rows:n}=e;if(0===t.length)return"";let r=new Array(n.length+2),o=0,a=t.map(e=>Np(e));r[o]=`| ${a.join(" | ")} |`,o+=1;let i=new Array(t.length);for(let e=0;e<t.length;e+=1)i[e]="---";r[o]=`| ${i.join(" | ")} |`,o+=1;for(let e of n)if(e.length<t.length){let n=new Array(t.length);for(let r=0;r<t.length;r+=1)n[r]=r<e.length?Np(e[r]):"";r[o]=`| ${n.join(" | ")} |`,o+=1}else{let t=e.map(e=>Np(e));r[o]=`| ${t.join(" | ")} |`,o+=1}return r.join("\n")},Ip=({children:e,className:t,onCopy:n,onError:r,timeout:o=2e3})=>{let a=Zd(),[i,l]=ce(!1),[s,c]=ce(!1),u=he(null),d=he(0),{isAnimating:p}=be(af),h=cp(),f=async e=>{var t,a;if("undefined"!=typeof window&&null!=(t=null==navigator?void 0:navigator.clipboard)&&t.write)try{let t=null==(a=u.current)?void 0:a.closest('[data-streamdown="table-wrapper"]'),i=null==t?void 0:t.querySelector("table");if(!i)return void(null==r||r(new Error("Table not found")));let s=Ep(i),p=({csv:Sp,tsv:Cp,md:Tp}[e]||Tp)(s),h=new ClipboardItem({"text/plain":new Blob([p],{type:"text/plain"}),"text/html":new Blob([i.outerHTML],{type:"text/html"})});await navigator.clipboard.write([h]),c(!0),l(!1),null==n||n(e),d.current=window.setTimeout(()=>c(!1),o)}catch(e){null==r||r(e)}else null==r||r(new Error("Clipboard API not available"))};de(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&l(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e),window.clearTimeout(d.current)}},[]);let m=ip(),g=s?m.CheckIcon:m.CopyIcon;return ul("div",{className:a("relative"),ref:u,children:[ul("button",{className:a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:p,onClick:()=>l(!i),title:h.copyTable,type:"button",children:null!=e?e:ul(g,{height:14,width:14})}),i?ul("div",{className:a("absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[ul("button",{className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>f("md"),title:h.copyTableAsMarkdown,type:"button",children:h.tableFormatMarkdown}),ul("button",{className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>f("csv"),title:h.copyTableAsCsv,type:"button",children:h.tableFormatCsv}),ul("button",{className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>f("tsv"),title:h.copyTableAsTsv,type:"button",children:h.tableFormatTsv})]}):null]})},Lp=({children:e,className:t,onDownload:n,onError:r})=>{let o=Zd(),[a,i]=ce(!1),l=he(null),{isAnimating:s}=be(af),c=cp(),u=ip(),d=e=>{var t;try{let o=null==(t=l.current)?void 0:t.closest('[data-streamdown="table-wrapper"]'),a=null==o?void 0:o.querySelector("table");if(!a)return void(null==r||r(new Error("Table not found")));let s=Ep(a),c="csv"===e?Sp(s):Tp(s);Wd("table."+("csv"===e?"csv":"md"),c,"csv"===e?"text/csv":"text/markdown"),i(!1),null==n||n(e)}catch(e){null==r||r(e)}};return de(()=>{let e=e=>{let t=e.composedPath();l.current&&!t.includes(l.current)&&i(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]),ul("div",{className:o("relative"),ref:l,children:[ul("button",{className:o("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:s,onClick:()=>i(!a),title:c.downloadTable,type:"button",children:null!=e?e:ul(u.DownloadIcon,{size:14})}),a?ul("div",{className:o("absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[ul("button",{className:o("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>d("csv"),title:c.downloadTableAsCsv,type:"button",children:c.tableFormatCsv}),ul("button",{className:o("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>d("markdown"),title:c.downloadTableAsMarkdown,type:"button",children:c.tableFormatMarkdown})]}):null]})},Mp=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:o,XIcon:a}=ip(),i=Zd(),[l,s]=ce(!1),{isAnimating:c}=be(af),u=cp(),d=()=>{s(!1)};return de(()=>{if(l){gp();let e=e=>{"Escape"===e.key&&s(!1)};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e),bp()}}},[l]),ul(_,{children:[ul("button",{className:i("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:c,onClick:()=>{s(!0)},title:u.viewFullscreen,type:"button",children:ul(o,{size:14})}),l?Je(ul("div",{"aria-label":u.viewFullscreen,"aria-modal":"true",className:i("fixed inset-0 z-50 flex flex-col bg-background"),"data-streamdown":"table-fullscreen",onClick:d,onKeyDown:e=>{"Escape"===e.key&&d()},role:"dialog",children:ul("div",{className:i("flex h-full flex-col"),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:"presentation",children:[ul("div",{className:i("flex items-center justify-end gap-1 p-4"),children:[n?ul(Ip,{}):null,r?ul(Lp,{}):null,ul("button",{className:i("rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:d,title:u.exitFullscreen,type:"button",children:ul(a,{size:20})})]}),ul("div",{className:i("flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10"),children:ul("table",{className:i("w-full border-collapse border border-border"),"data-streamdown":"table",children:e})})]})}),document.body):null]})},Pp=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:o=!0,showFullscreen:a=!0,...i})=>{let l=Zd(),s=n&&r,c=n&&o,u=n&&a,d=s||c||u;return ul("div",{className:l("my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2"),"data-streamdown":"table-wrapper",children:[d?ul("div",{className:l("flex items-center justify-end gap-1"),children:[s?ul(Ip,{}):null,c?ul(Lp,{}):null,u?ul(Mp,{showCopy:s,showDownload:c,children:e}):null]}):null,ul("div",{className:l("border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background"),children:ul("table",{className:l("w-full divide-y divide-border",t),"data-streamdown":"table",...i,children:e})})]})},Dp=/startLine=(\d+)/,Ap=/\bnoLineNumbers\b/,Op=Ze(()=>Promise.resolve().then(function(){return cg}).then(e=>({default:e.Mermaid}))),zp=/language-([^\s]+)/;function Rp(e,t){if(!(null!=e&&e.position||null!=t&&t.position))return!0;if(null==e||!e.position||null==t||!t.position)return!1;let n=e.position.start,r=t.position.start,o=e.position.end,a=t.position.end;return(null==n?void 0:n.line)===(null==r?void 0:r.line)&&(null==n?void 0:n.column)===(null==r?void 0:r.column)&&(null==o?void 0:o.line)===(null==a?void 0:a.line)&&(null==o?void 0:o.column)===(null==a?void 0:a.column)}function Fp(e,t){return e.className===t.className&&Rp(e.node,t.node)}var $p=(e,t)=>"boolean"==typeof e?e:!1!==e[t],jp=(e,t)=>{if("boolean"==typeof e)return e;let n=e.table;return!1!==n&&(!0===n||void 0===n||!1!==n[t])},Hp=(e,t)=>{if("boolean"==typeof e)return e;let n=e.code;return!1!==n&&(!0===n||void 0===n||!1!==n[t])},Bp=(e,t)=>{if("boolean"==typeof e)return e;let n=e.mermaid;return!1!==n&&(!0===n||void 0===n||!1!==n[t])},qp=ze(({children:e,className:t,node:n,...r})=>ul("ol",{className:Zd()("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...r,children:e}),(e,t)=>Fp(e,t));qp.displayName="MarkdownOl";var Up=ze(({children:e,className:t,node:n,...r})=>ul("li",{className:Zd()("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...r,children:e}),(e,t)=>e.className===t.className&&Rp(e.node,t.node));Up.displayName="MarkdownLi";var Vp=ze(({children:e,className:t,node:n,...r})=>ul("ul",{className:Zd()("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...r,children:e}),(e,t)=>Fp(e,t));Vp.displayName="MarkdownUl";var Wp=ze(({className:e,node:t,...n})=>ul("hr",{className:Zd()("my-6 border-border",e),"data-streamdown":"horizontal-rule",...n}),(e,t)=>Fp(e,t));Wp.displayName="MarkdownHr";var Yp=ze(({children:e,className:t,node:n,...r})=>ul("span",{className:Zd()("font-semibold",t),"data-streamdown":"strong",...r,children:e}),(e,t)=>Fp(e,t));Yp.displayName="MarkdownStrong";var Zp=ze(({children:e,className:t,href:n,node:r,...o})=>{let a=Zd(),{linkSafety:i}=be(af),[l,s]=ce(!1),c="streamdown:incomplete-link"===n,u=ge(async e=>{if(null!=i&&i.enabled&&n&&!c){if(e.preventDefault(),i.onLinkCheck&&await i.onLinkCheck(n))return void window.open(n,"_blank","noreferrer");s(!0)}},[i,n,c]),d=ge(()=>{n&&window.open(n,"_blank","noreferrer")},[n]),p=ge(()=>{s(!1)},[]),h={url:null!=n?n:"",isOpen:l,onClose:p,onConfirm:d};return null!=i&&i.enabled&&n?ul(_,{children:[ul("button",{className:a("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":c,"data-streamdown":"link",onClick:u,type:"button",children:e}),i.renderModal?i.renderModal(h):ul(yp,{...h})]}):ul("a",{className:a("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":c,"data-streamdown":"link",href:n,rel:"noreferrer",target:"_blank",...o,children:e})},(e,t)=>Fp(e,t)&&e.href===t.href);Zp.displayName="MarkdownA";var Gp=ze(({children:e,className:t,node:n,...r})=>ul("h1",{className:Zd()("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...r,children:e}),(e,t)=>Fp(e,t));Gp.displayName="MarkdownH1";var Qp=ze(({children:e,className:t,node:n,...r})=>ul("h2",{className:Zd()("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...r,children:e}),(e,t)=>Fp(e,t));Qp.displayName="MarkdownH2";var Kp=ze(({children:e,className:t,node:n,...r})=>ul("h3",{className:Zd()("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...r,children:e}),(e,t)=>Fp(e,t));Kp.displayName="MarkdownH3";var Xp=ze(({children:e,className:t,node:n,...r})=>ul("h4",{className:Zd()("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...r,children:e}),(e,t)=>Fp(e,t));Xp.displayName="MarkdownH4";var Jp=ze(({children:e,className:t,node:n,...r})=>ul("h5",{className:Zd()("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...r,children:e}),(e,t)=>Fp(e,t));Jp.displayName="MarkdownH5";var eh=ze(({children:e,className:t,node:n,...r})=>ul("h6",{className:Zd()("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...r,children:e}),(e,t)=>Fp(e,t));eh.displayName="MarkdownH6";var th=ze(({children:e,className:t,node:n,...r})=>{let{controls:o}=be(af),a=$p(o,"table"),i=jp(o,"copy"),l=jp(o,"download"),s=jp(o,"fullscreen");return ul(Pp,{className:t,showControls:a,showCopy:i,showDownload:l,showFullscreen:s,...r,children:e})},(e,t)=>Fp(e,t));th.displayName="MarkdownTable";var nh=ze(({children:e,className:t,node:n,...r})=>ul("thead",{className:Zd()("bg-muted/80",t),"data-streamdown":"table-header",...r,children:e}),(e,t)=>Fp(e,t));nh.displayName="MarkdownThead";var rh=ze(({children:e,className:t,node:n,...r})=>ul("tbody",{className:Zd()("divide-y divide-border",t),"data-streamdown":"table-body",...r,children:e}),(e,t)=>Fp(e,t));rh.displayName="MarkdownTbody";var oh=ze(({children:e,className:t,node:n,...r})=>ul("tr",{className:Zd()("border-border",t),"data-streamdown":"table-row",...r,children:e}),(e,t)=>Fp(e,t));oh.displayName="MarkdownTr";var ah=ze(({children:e,className:t,node:n,...r})=>ul("th",{className:Zd()("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...r,children:e}),(e,t)=>Fp(e,t));ah.displayName="MarkdownTh";var ih=ze(({children:e,className:t,node:n,...r})=>ul("td",{className:Zd()("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...r,children:e}),(e,t)=>Fp(e,t));ih.displayName="MarkdownTd";var lh=ze(({children:e,className:t,node:n,...r})=>ul("blockquote",{className:Zd()("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...r,children:e}),(e,t)=>Fp(e,t));lh.displayName="MarkdownBlockquote";var sh=ze(({children:e,className:t,node:n,...r})=>ul("sup",{className:Zd()("text-sm",t),"data-streamdown":"superscript",...r,children:e}),(e,t)=>Fp(e,t));sh.displayName="MarkdownSup";var ch=ze(({children:e,className:t,node:n,...r})=>ul("sub",{className:Zd()("text-sm",t),"data-streamdown":"subscript",...r,children:e}),(e,t)=>Fp(e,t));ch.displayName="MarkdownSub";var uh=ze(({children:e,className:t,node:n,...r})=>{if("data-footnotes"in r){let n=e=>{var t,n;if(!mt(e))return!1;let r=Array.isArray(e.props.children)?e.props.children:[e.props.children],o=!1,a=!1;for(let e of r)if(e)if("string"==typeof e)""!==e.trim()&&(o=!0);else if(mt(e))if(void 0!==(null==(t=e.props)?void 0:t["data-footnote-backref"]))a=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if("string"==typeof e&&""!==e.trim()){o=!0;break}if(mt(e)&&void 0===(null==(n=e.props)?void 0:n["data-footnote-backref"])){o=!0;break}}}return a&&!o},o=Array.isArray(e)?e.map(e=>{if(!mt(e))return e;if(e.type===qp){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return 0===t.length?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(o)?o.some(e=>null!==e):null!==o)?ul("section",{className:t,...r,children:o}):null}return ul("section",{className:t,...r,children:e})},(e,t)=>Fp(e,t));uh.displayName="MarkdownSection";var dh=ze(({node:e,className:t,children:n,...r})=>{var o,a;let i=Zd(),l=!("data-block"in r),{mermaid:s,controls:c,lineNumbers:u}=be(af),d=wp(),p=be(qd),h=null==t?void 0:t.match(zp),f=null!=(o=null==h?void 0:h.at(1))?o:"",m=(e=>{var t;let n=xp();return null!=n&&n.renderers&&e&&null!=(t=n.renderers.find(t=>Array.isArray(t.language)?t.language.includes(e):t.language===e))?t:null})(f);if(l)return ul("code",{className:i("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...r,children:n});let g=null==(a=null==e?void 0:e.properties)?void 0:a.metastring,b=null==g?void 0:g.match(Dp),y=b?Number.parseInt(b[1],10):void 0,v=void 0!==y&&y>=1?y:void 0,x=!(g&&Ap.test(g))&&!1!==u,w="";if(mt(n)&&n.props&&"object"==typeof n.props&&"children"in n.props&&"string"==typeof n.props.children?w=n.props.children:"string"==typeof n&&(w=n),m){let e=m.component;return ul(We,{fallback:ul(hp,{}),children:ul(e,{code:w,isIncomplete:p,language:f,meta:g})})}if("mermaid"===f&&d){let e=$p(c,"mermaid"),n=Bp(c,"download"),r=Bp(c,"copy"),o=Bp(c,"fullscreen"),a=Bp(c,"panZoom"),l=e&&(n||r||o);return ul(We,{fallback:ul(hp,{}),children:ul("div",{className:i("group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",t),"data-streamdown":"mermaid-block",children:[ul("div",{className:i("flex h-8 items-center text-muted-foreground text-xs"),children:ul("span",{className:i("ml-1 font-mono lowercase"),children:"mermaid"})}),l?ul("div",{className:i("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:ul("div",{className:i("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),"data-streamdown":"mermaid-block-actions",children:[n?ul(kp,{chart:w,config:null==s?void 0:s.config}):null,r?ul(up,{code:w}):null,o?ul(_p,{chart:w,config:null==s?void 0:s.config}):null]})}):null,ul("div",{className:i("rounded-md border border-border bg-background"),children:ul(Op,{chart:w,config:null==s?void 0:s.config,showControls:a})})]})})}let k=$p(c,"code"),E=Hp(c,"download"),S=Hp(c,"copy");return ul(np,{className:t,code:w,isIncomplete:p,language:f,lineNumbers:x,startLine:v,children:k?ul(_,{children:[E?ul(pp,{code:w,language:f}):null,S?ul(up,{}):null]}):null})},(e,t)=>e.className===t.className&&Rp(e.node,t.node));dh.displayName="MarkdownCode";var ph=ze(({node:e,className:t,src:n,alt:r,onLoad:o,onError:a,...i})=>{let{DownloadIcon:l}=ip(),s=Zd(),c=he(null),[u,d]=ce(!1),[p,h]=ce(!1),f=cp(),m=null!=i.width||null!=i.height,g=(u||m)&&!p,b=p&&!m;de(()=>{let e=c.current;if(null!=e&&e.complete){let t=e.naturalWidth>0;d(t),h(!t)}},[]);let y=ge(e=>{d(!0),h(!1),null==o||o(e)},[o]),v=ge(e=>{d(!1),h(!0),null==a||a(e)},[a]);return n?ul("div",{className:s("group relative my-4 inline-block"),"data-streamdown":"image-wrapper",children:[ul("img",{alt:r,className:s("max-w-full rounded-lg",b&&"hidden",t),"data-streamdown":"image",onError:v,onLoad:y,ref:c,src:n,...i}),b&&ul("span",{className:s("text-muted-foreground text-xs italic"),"data-streamdown":"image-fallback",children:f.imageNotAvailable}),ul("div",{className:s("pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block")}),g&&ul("button",{className:s("absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background","opacity-0 group-hover:opacity-100"),onClick:async()=>{if(n)try{let e=await(await fetch(n)).blob(),t=new URL(n,window.location.origin).pathname.split("/").pop()||"",o=t.split(".").pop(),a=t.includes(".")&&void 0!==o&&o.length<=4,i="";if(a)i=t;else{let n=e.type,o="png";n.includes("jpeg")||n.includes("jpg")?o="jpg":n.includes("png")?o="png":n.includes("svg")?o="svg":n.includes("gif")?o="gif":n.includes("webp")&&(o="webp"),i=`${(r||t||"image").replace(fp,"")}.${o}`}Wd(i,e,e.type)}catch(e){window.open(n,"_blank")}},title:f.downloadImage,type:"button",children:ul(l,{size:14})})]}):null},(e,t)=>e.className===t.className&&Rp(e.node,t.node));ph.displayName="MarkdownImg";var hh=ze(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>null!=e&&""!==e);if(1===r.length&&mt(r[0])){let t=r[0].props.node,n=null==t?void 0:t.tagName;if("img"===n)return ul(_,{children:e});if("code"===n&&"data-block"in r[0].props)return ul(_,{children:e})}return ul("p",{...n,children:e})},(e,t)=>Fp(e,t));hh.displayName="MarkdownParagraph";var fh={ol:qp,li:Up,ul:Vp,hr:Wp,strong:Yp,a:Zp,h1:Gp,h2:Qp,h3:Kp,h4:Xp,h5:Jp,h6:eh,table:th,thead:nh,tbody:rh,tr:oh,th:ah,td:ih,blockquote:lh,code:dh,img:ph,pre:({children:e})=>mt(e)?gt(e,{"data-block":"true"}):e,sup:sh,sub:ch,p:hh,section:uh},mh=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,gh=/\p{L}/u;function bh(e){let t=e.replace(/^#{1,6}\s+/gm,"").replace(/(\*{1,3}|_{1,3})/g,"").replace(/`[^`]*`/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^[\s>*\-+\d.]+/gm,"");for(let e of t){if(mh.test(e))return"rtl";if(gh.test(e))return"ltr"}return"ltr"}var yh,vh,xh,wh,kh=/^[ \t]{0,3}(`{3,}|~{3,})/,_h=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,Eh=e=>{let t=e.split("\n"),n=null,r=0;for(let e of t){let t=kh.exec(e);if(null===n){if(t){let e=t[1];n=e[0],r=e.length}}else if(t){let e=t[1],o=e[0],a=e.length;o===n&&a>=r&&(n=null,r=0)}}return null!==n},Sh=()=>e=>{sn(e,"html",(e,t,n)=>{!n||"number"!=typeof t||(n.children[t]={type:"text",value:e.value})})},Ch=[],Nh={allowDangerousHtml:!0},Th=new WeakMap,Ih=new class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,o=e.remarkRehypeOptions;if(!(n||r||o)){let t="default";return this.keyCache.set(e,t),t}let a=e=>{if(!e||0===e.length)return"";let t="";for(let n=0;n<e.length;n+=1){let r=e[n];if(n>0&&(t+=","),Array.isArray(r)){let[e,n]=r;if("function"==typeof e){let n=Th.get(e);n||(n=e.name,Th.set(e,n)),t+=n}else t+=String(e);t+=":",t+=JSON.stringify(n)}else if("function"==typeof r){let e=Th.get(r);e||(e=r.name,Th.set(r,e)),t+=e}else t+=String(r)}return t},i=a(n),l=`${a(r)}::${i}::${o?JSON.stringify(o):""}`;return this.keyCache.set(e,l),l}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}this.cache.set(n,t)}clear(){this.cache.clear()}},Lh=e=>{let t=Mh(e),n=e.children||"",r=t.runSync(t.parse(n),n);return Ah(r,e)},Mh=e=>{let t=Ih.get(e);if(t)return t;let n=Ph(e);return Ih.set(e,n),n},Ph=e=>{let t=e.rehypePlugins||Ch,n=e.remarkPlugins||Ch,r=(e=>e.some(e=>Array.isArray(e)?e[0]===vn:e===vn))(t)?n:[...n,Sh],o=e.remarkRehypeOptions?{...Nh,...e.remarkRehypeOptions}:Nh;return cu().use(vc).use(r).use(zc,o).use(t)},Dh=e=>e,Ah=(e,t)=>{let{allowElement:n,allowedElements:r,disallowedElements:o,skipHtml:a,unwrapDisallowed:i,urlTransform:l}=t;if(n||r||o||a||l){let t=l||Dh;sn(e,(e,l,s)=>"raw"===e.type&&s&&"number"==typeof l?(((e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:"text",value:r}})(s,l,a,e.value),l):"element"===e.type&&(((e,t)=>{var n;for(let r in Ws)if(Object.hasOwn(Ws,r)&&Object.hasOwn(e.properties,r)){let o=e.properties[r],a=Ws[r];(null===a||a.includes(e.tagName))&&(e.properties[r]=null!=(n=t(String(o||""),r,e))?n:void 0)}})(e,t),((e,t,n,r,o,a)=>{let i=!1;return r?i=!r.includes(e.tagName):o&&(i=o.includes(e.tagName)),!i&&a&&"number"==typeof t&&(i=!a(e,t,n)),i})(e,l,s,r,o,n)&&s&&"number"==typeof l)?(i&&e.children?s.children.splice(l,1,...e.children):s.children.splice(l,1),l):void 0)}return zs(e,{Fragment:_,components:t.components,ignoreInvalidStyle:!0,jsx:ul,jsxs:ul,passKeys:!0,passNode:!0})},Oh=/\[\^[\w-]{1,200}\](?!:)/,zh=/\[\^[\w-]{1,200}\]:/,Rh=/<(\w+)[\s>]/,Fh=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),$h=new Map,jh=new Map,Hh=(e,t)=>{if(Fh.has(t.toLowerCase()))return 0;let n=e.match((e=>{let t=e.toLowerCase(),n=$h.get(t);if(n)return n;let r=new RegExp(`<${t}(?=[\\s>/])[^>]*>`,"gi");return $h.set(t,r),r})(t));if(!n)return 0;let r=0;for(let e of n)e.trimEnd().endsWith("/>")||(r+=1);return r},Bh=(e,t)=>{let n=e.match((e=>{let t=e.toLowerCase(),n=jh.get(t);if(n)return n;let r=new RegExp(`</${t}(?=[\\s>])[^>]*>`,"gi");return jh.set(t,r),r})(t));return n?n.length:0},qh=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)"$"===e[n]&&"$"===e[n+1]&&(t+=1,n+=1);return t},Uh=e=>{let t=Oh.test(e),n=zh.test(e);if(t||n)return[e];let r=Cd.lex(e,{gfm:!0}),o=[],a=[],i=!1;for(let e of r){let t=e.raw,n=o.length;if(a.length>0){o[n-1]+=t;let e=a.at(-1),r=Hh(t,e),i=Bh(t,e);for(let t=0;t<r;t+=1)a.push(e);for(let t=0;t<i;t+=1)a.length>0&&a.at(-1)===e&&a.pop();continue}if("html"===e.type&&e.block){let e=t.match(Rh);if(e){let n=e[1];Hh(t,n)>Bh(t,n)&&a.push(n)}}if(n>0&&!i){let e=o[n-1];if(qh(e)%2==1){o[n-1]=e+t;continue}}o.push(t),"space"!==e.type&&(i="code"===e.type)}return o},Vh=/([\\`*_~[\]|])/g,Wh=e=>e.replace(Vh,"\\$1"),Yh=e=>"text"===e.type?e.value:"children"in e&&Array.isArray(e.children)?e.children.map(Yh).join(""):"",Zh=e=>t=>{if(!e||0===e.length)return;let n=new Set(e.map(e=>e.toLowerCase()));sn(t,"element",e=>{if(n.has(e.tagName.toLowerCase())){let t=Yh(e);e.children=t?[{type:"text",value:t}]:[]}})},Gh=/^[ \t]*<[\w!/?-]/,Qh=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,Kh={...An,protocols:{...An.protocols,href:[...null!=(vh=null==(yh=An.protocols)?void 0:yh.href)?vh:[],"tel"]},attributes:{...An.attributes,code:[...null!=(wh=null==(xh=An.attributes)?void 0:xh.code)?wh:[],"metastring"]}},Xh={raw:vn,sanitize:[Bn,Kh],harden:[function({defaultOrigin:e="",allowedLinkPrefixes:t=[],allowedImagePrefixes:n=[],allowDataImages:r=!1,allowedProtocols:o=[],blockedImageClass:a="inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm",blockedLinkClass:i="text-gray-500",linkBlockPolicy:l=cn,imageBlockPolicy:s=cn}){const c=t.length&&!t.every(e=>"*"===e),u=n.length&&!n.every(e=>"*"===e);if(!e&&(c||u))throw new Error("defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided");return c=>{const u=yn(e,t,n,r,o,a,i,l,s);gn(c),sn(c,u)}},{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},Jh={gfm:[function(e){const t=e||ai,n=this.data(),r=n.micromarkExtensions||(n.micromarkExtensions=[]),o=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),a=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);r.push(function(e){return Mo([{text:Bo},{document:{91:{name:"gfmFootnoteDefinition",tokenize:Wa,continuation:{tokenize:Ya},exit:Za}},text:{91:{name:"gfmFootnoteCall",tokenize:Va},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:qa,resolveTo:Ua}}},Ga(e),{flow:{null:{name:"table",tokenize:Xa,resolveAll:Ja}}},{text:{91:ri}}])}(t)),o.push([{transforms:[mr],enter:{literalAutolink:cr,literalAutolinkEmail:ur,literalAutolinkHttp:ur,literalAutolinkWww:ur},exit:{literalAutolink:fr,literalAutolinkEmail:hr,literalAutolinkHttp:dr,literalAutolinkWww:pr}},{enter:{gfmFootnoteCallString:xr,gfmFootnoteCall:wr,gfmFootnoteDefinitionLabelString:kr,gfmFootnoteDefinition:_r},exit:{gfmFootnoteCallString:Er,gfmFootnoteCall:Sr,gfmFootnoteDefinitionLabelString:Cr,gfmFootnoteDefinition:Nr}},{canContainEols:["delete"],enter:{strikethrough:Dr},exit:{strikethrough:Ar}},{enter:{table:bo,tableData:wo,tableHeader:wo,tableRow:vo},exit:{codeText:ko,table:yo,tableData:xo,tableHeader:xo,tableRow:xo}},{exit:{taskListCheckValueChecked:So,taskListCheckValueUnchecked:So,paragraph:Co}}]),a.push(function(e){return{extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:lr,notInConstruct:sr},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:lr,notInConstruct:sr},{character:":",before:"[ps]",after:"\\/",inConstruct:lr,notInConstruct:sr}]},Ir(e),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Pr}],handlers:{delete:Or}},Eo(e),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:No}}]}}(t))},{}],codeMeta:()=>e=>{sn(e,"code",e=>{var t,n;e.meta&&(e.data=null!=(t=e.data)?t:{},e.data.hProperties={...null!=(n=e.data.hProperties)?n:{},metastring:e.meta})})}},ef=Object.values(Xh),tf=Object.values(Jh),nf={block:" ▋",circle:" ●"},rf=["github-light","github-dark"],of={enabled:!0},af=Z({shikiTheme:rf,controls:!0,isAnimating:!1,lineNumbers:!0,mode:"streaming",mermaid:void 0,linkSafety:of}),lf=ze(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:n,index:r,isIncomplete:o,dir:a,animatePlugin:i,...l})=>{if(i){let e=i.getLastRenderCharCount();i.setPrevContentLength(e)}let s="string"==typeof e&&n?(e=>"string"==typeof e&&0!==e.length&&Gh.test(e)?e.replace(Qh,"$1"):e)(e):e,c=ul(Lh,{...l,children:s});return ul(qd.Provider,{value:o,children:a?ul("div",{dir:a,style:{display:"contents"},children:c}):c})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(n=>{var r,o;return(null==(r=e.components)?void 0:r[n])!==(null==(o=t.components)?void 0:o[n])}))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});lf.displayName="Block";var sf=ze(({children:e,mode:t="streaming",dir:n,parseIncompleteMarkdown:r=!0,normalizeHtmlIndentation:o=!1,components:a,rehypePlugins:i=ef,remarkPlugins:l=tf,className:s,shikiTheme:c=rf,mermaid:u,controls:d=!0,isAnimating:p=!1,animated:h,BlockComponent:f=lf,parseMarkdownIntoBlocksFn:m=Uh,caret:g,plugins:b,remend:y,linkSafety:v=of,lineNumbers:x=!0,allowedTags:k,literalTagContent:_,translations:E,icons:S,prefix:C,onAnimationStart:N,onAnimationEnd:T,...I})=>{let L=ve(),[M,P]=De(),D=me(()=>Vd(C),[C]),A=he(null),O=he(N),z=he(T);O.current=N,z.current=T,de(()=>{var e,n,r;if("static"===t)return;let o=A.current;A.current=p,null!==o?p&&!o?null==(n=O.current)||n.call(O):!p&&o&&(null==(r=z.current)||r.call(z)):p&&(null==(e=O.current)||e.call(O))},[p,t]);let R=me(()=>k?Object.keys(k):[],[k]),F=me(()=>{if("string"!=typeof e)return"";let n="streaming"===t&&r?al(e,y):e;return _&&_.length>0&&(n=((e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=new RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,"gi");n=n.replace(t,(e,t,n,r)=>t+Wh(n).replace(/\n\n/g,"&#10;&#10;")+r)}return n})(n,_)),R.length>0&&(n=((e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=new RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,"gi");n=n.replace(t,(e,t,n,r)=>{if(!n.includes("\n\n"))return t+n+r;let o=n.replace(/\n\n/g,"\n\x3c!----\x3e\n");return`${t}${(o.startsWith("\n")?"":"\n")+o+(o.endsWith("\n")?"":"\n")}${r}\n\n`})}return n})(n,R)),n},[e,t,r,y,R,_]),$=me(()=>m(F),[F,m]),[j,H]=ce($);de(()=>{"streaming"!==t||W?H($):P(()=>{H($)})},[$,t]);let B="streaming"===t?j:$,q=me(()=>"auto"===n?B.map(bh):void 0,[B,n]),U=me(()=>B.map((e,t)=>`${L}-${t}`),[B.length,L]),V=me(()=>!0===h?"true":h?JSON.stringify(h):"",[h]),W=me(()=>V?"true"===V?Bd():Bd(h):null,[V]),Y=me(()=>{var e,n;return{shikiTheme:null!=(n=null==(e=null==b?void 0:b.code)?void 0:e.getThemes())?n:c,controls:d,isAnimating:p,lineNumbers:x,mode:t,mermaid:u,linkSafety:v}},[c,d,p,x,t,u,v,null==b?void 0:b.code]),Z=me(()=>E?JSON.stringify(E):"",[E]),G=me(()=>({...lp,...E}),[Z]),Q=me(()=>{let{inlineCode:e,...t}=null!=a?a:{},n={...fh,...t};if(e){let t=n.code;n.code=n=>"data-block"in n?t?w(t,n):null:w(e,n)}return n},[a]),K=me(()=>{let e=[];return null!=b&&b.cjk&&(e=[...e,...b.cjk.remarkPluginsBefore]),e=[...e,...l],null!=b&&b.cjk&&(e=[...e,...b.cjk.remarkPluginsAfter]),null!=b&&b.math&&(e=[...e,b.math.remarkPlugin]),e},[l,null==b?void 0:b.math,null==b?void 0:b.cjk]),X=me(()=>{var e;let t=i;if(k&&Object.keys(k).length>0&&i===ef){let n={...Kh,tagNames:[...null!=(e=Kh.tagNames)?e:[],...Object.keys(k)],attributes:{...Kh.attributes,...k}};t=[Xh.raw,[Bn,n],Xh.harden]}return _&&_.length>0&&(t=[...t,[Zh,_]]),null!=b&&b.math&&(t=[...t,b.math.rehypePlugin]),W&&p&&(t=[...t,W.rehypePlugin]),t},[i,null==b?void 0:b.math,W,p,k,_]),J=me(()=>{if(!p||0===B.length)return!1;let e=B.at(-1);return Eh(e)||(e=>{let t=e.split("\n");for(let e of t){let t=e.trim();if(t.length>0&&t.includes("|")&&_h.test(t))return!0}return!1})(e)},[p,B]),ee=me(()=>g&&p&&!J?{"--streamdown-caret":`"${nf[g]}"`}:void 0,[g,p,J]);return ul(sp.Provider,"static"===t?{value:G,children:ul(vp.Provider,{value:null!=b?b:null,children:ul(af.Provider,{value:Y,children:ul(ap,{icons:S,children:ul(Yd.Provider,{value:D,children:ul("div",{className:D("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",s),dir:"auto"===n?bh(F):n,children:ul(Lh,{components:Q,rehypePlugins:X,remarkPlugins:K,...I,children:F})})})})})})}:{value:G,children:ul(vp.Provider,{value:null!=b?b:null,children:ul(af.Provider,{value:Y,children:ul(ap,{icons:S,children:ul(Yd.Provider,{value:D,children:ul("div",{className:D("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",g&&!J?"[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]":null,s),style:ee,children:[0===B.length&&g&&p&&ul("span",{}),B.map((e,t)=>{var a;let i=t===B.length-1,l=p&&i&&Eh(e);return ul(f,{animatePlugin:W,components:Q,content:e,dir:null!=(a=null==q?void 0:q[t])?a:"auto"!==n?n:void 0,index:t,isIncomplete:l,rehypePlugins:X,remarkPlugins:K,shouldNormalizeHtmlIndentation:o,shouldParseIncompleteMarkdown:r,...I},U[t])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir);sf.displayName="Streamdown";var cf=({children:e,className:t,minZoom:n=.5,maxZoom:r=3,zoomStep:o=.1,showControls:a=!0,initialZoom:i=1,fullscreen:l=!1})=>{let{RotateCcwIcon:s,ZoomInIcon:c,ZoomOutIcon:u}=ip(),d=Zd(),p=he(null),h=he(null),[f,m]=ce(i),[g,b]=ce({x:0,y:0}),[y,v]=ce(!1),[x,w]=ce({x:0,y:0}),[k,_]=ce({x:0,y:0}),E=ge(e=>{m(t=>Math.max(n,Math.min(r,t+e)))},[n,r]),S=ge(()=>{E(o)},[E,o]),C=ge(()=>{E(-o)},[E,o]),N=ge(()=>{m(i),b({x:0,y:0})},[i]),T=ge(e=>{e.preventDefault();let t=e.deltaY>0?-o:o;E(t)},[E,o]),I=ge(e=>{if(0!==e.button||!1===e.isPrimary)return;v(!0),w({x:e.clientX,y:e.clientY}),_(g);let t=e.currentTarget;t instanceof HTMLElement&&t.setPointerCapture(e.pointerId)},[g]),L=ge(e=>{if(!y)return;e.preventDefault();let t=e.clientX-x.x,n=e.clientY-x.y;b({x:k.x+t,y:k.y+n})},[y,x,k]),M=ge(e=>{v(!1);let t=e.currentTarget;t instanceof HTMLElement&&t.releasePointerCapture(e.pointerId)},[]);return de(()=>{let e=p.current;if(e)return e.addEventListener("wheel",T,{passive:!1}),()=>{e.removeEventListener("wheel",T)}},[T]),de(()=>{let e=h.current;if(e&&y)return document.body.style.userSelect="none",e.addEventListener("pointermove",L,{passive:!1}),e.addEventListener("pointerup",M),e.addEventListener("pointercancel",M),()=>{document.body.style.userSelect="",e.removeEventListener("pointermove",L),e.removeEventListener("pointerup",M),e.removeEventListener("pointercancel",M)}},[y,L,M]),ul("div",{className:d("relative flex flex-col",l?"h-full w-full":"min-h-28 w-full",t),ref:p,style:{cursor:y?"grabbing":"grab"},children:[a?ul("div",{className:d("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/80 p-1 supports-[backdrop-filter]:bg-background/70 supports-[backdrop-filter]:backdrop-blur-sm",l?"bottom-4 left-4":"bottom-2 left-2"),children:[ul("button",{className:d("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50"),disabled:f>=r,onClick:S,title:"Zoom in",type:"button",children:ul(c,{size:16})}),ul("button",{className:d("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50"),disabled:f<=n,onClick:C,title:"Zoom out",type:"button",children:ul(u,{size:16})}),ul("button",{className:d("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"),onClick:N,title:"Reset zoom and pan",type:"button",children:ul(s,{size:16})})]}):null,ul("div",{className:d("flex-1 origin-center transition-transform duration-150 ease-out",l?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:I,ref:h,role:"application",style:{transform:`translate(${g.x}px, ${g.y}px) scale(${f})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})},uf=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:o=!0})=>{let a=Zd(),[i,l]=ce(null),[s,c]=ce(!1),[u,d]=ce(""),[p,h]=ce(""),[f,m]=ce(0),{mermaid:g}=be(af),b=wp(),y=null==g?void 0:g.errorComponent,{shouldRender:v,containerRef:x}=zd({immediate:r});if(de(()=>{v&&(b?(async()=>{try{l(null),c(!0);let t=b.getMermaid(n),r=e.split("").reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),o=`mermaid-${Math.abs(r)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:a}=await t.render(o,e);d(a),h(a)}catch(e){if(!p&&!u){let t=e instanceof Error?e.message:"Failed to render Mermaid chart";l(t)}}finally{c(!1)}})():l("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering."))},[e,n,f,v,b]),!(v||u||p))return ul("div",{className:a("my-4 min-h-[200px]",t),ref:x});if(s&&!u&&!p)return ul("div",{className:a("my-4 flex justify-center p-4",t),ref:x,children:ul("div",{className:a("flex items-center space-x-2 text-muted-foreground"),children:[ul("div",{className:a("h-4 w-4 animate-spin rounded-full border-current border-b-2")}),ul("span",{className:a("text-sm"),children:"Loading diagram..."})]})});if(i&&!u&&!p){let n=()=>m(e=>e+1);return ul("div",y?{ref:x,children:ul(y,{chart:e,error:i,retry:n})}:{className:a("rounded-md bg-red-50 p-4",t),ref:x,children:[ul("p",{className:a("font-mono text-red-700 text-sm"),children:["Mermaid Error: ",i]}),ul("details",{className:a("mt-2"),children:[ul("summary",{className:a("cursor-pointer text-red-600 text-xs"),children:"Show Code"}),ul("pre",{className:a("mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs"),children:e})]})]})}let w=u||p;return ul("div",{className:a("size-full",t),"data-streamdown":"mermaid",ref:x,children:ul(cf,{className:a(r?"size-full overflow-hidden":"overflow-hidden",t),fullscreen:r,maxZoom:3,minZoom:.5,showControls:o,zoomStep:.1,children:ul("div",{"aria-label":"Mermaid chart",className:a("flex justify-center",r?"size-full items-center":null),dangerouslySetInnerHTML:{__html:w},role:"img"})})})};const df={p:({children:e})=>yt.createElement("p",null,e),li:({children:e})=>yt.createElement("li",{className:"max-h-fit ml-3 mb-3 max-w-2xl"},e),ul:({children:e})=>yt.createElement("ul",{className:"list-disc max-h-fit whitespace-normal pl-4 mb-4"},e),ol:({children:e})=>yt.createElement("ol",{className:"list-decimal max-h-fit whitespace-normal pl-4 mb-4"},e),a:({children:e,...t})=>yt.createElement("a",kt({target:"_blank",rel:"noopener noreferrer",className:"text-[#196b8c] font-semibold hover:underline"},t),e)},pf=({content:e="",isStreaming:t=!1})=>{const n=e?.replace(/\\n/g,"\n")?.replace(/\\([^\\]+)\\/g,'"$1"')??"";return yt.createElement("div",{className:"wrap-break-word [&_p]:leading-relaxed [&_p]:mb-2 [&_p:last-child]:mb-0"},yt.createElement(sf,{mode:t?"streaming":"static",animated:t,isAnimating:t,plugins:{},components:df,linkSafety:{enabled:!0},controls:{table:!0}},n))},hf=ze(({text:e,isStreaming:t=!1})=>{const{stream:n,addPart:r}=(()=>{const[e,t]=ce([]),[n,r]=ce(""),o=he(null),a=he(0),i=he(0),l=he(!1),s=ge(e=>{e&&t(t=>[...t,e])},[]),c=ge(()=>{t([]),r(""),i.current=0,o.current&&cancelAnimationFrame(o.current),o.current=null,a.current=0,l.current=!1},[]);return de(()=>{if(l.current)return;const t=e.join("");if(i.current>=t.length)return void r(t);l.current=!0;const n=t=>{const s=e.join("");i.current<s.length?(t-a.current>10&&(i.current++,r(s.slice(0,i.current)),a.current=t),o.current=requestAnimationFrame(n)):l.current=!1};return o.current=requestAnimationFrame(n),()=>{o.current&&cancelAnimationFrame(o.current),l.current=!1}},[e]),{stream:n,addPart:s,reset:c}})(),o=he(t?"":e),a=he(!1);de(()=>{if(e&&o.current!==e){const t=e.slice(o.current.length);t&&(a.current=!0,r(t)),o.current=e}},[e,r]);const i=a.current&&n.length<e.length,l=t||i?n||"":e;return yt.createElement(pf,{content:l,isStreaming:t||i})}),ff=({questions:e,onSelect:t})=>yt.createElement("div",{className:"mt-4 flex flex-wrap gap-2 font-sans"},e.map((e,n)=>{const r="exit"===e.toLowerCase();return yt.createElement("button",{key:n,onClick:()=>t(e),className:"block border-none py-2 px-3 rounded-xl cursor-pointer text-[0.85rem] font-medium text-left transition-all duration-300 "+(r?"bg-red-600 text-white hover:bg-red-700":"bg-chatbot-primary/20 text-bubble-bot-fg hover:bg-chatbot-primary hover:text-white")},e)})),mf=({children:e,className:t})=>yt.createElement("span",{className:t},e),gf=()=>yt.createElement("div",{className:"flex justify-center items-center h-5"},yt.createElement("div",{className:"w-2 h-2 bg-chatbot-primary rounded-full inline-block mx-[3px] animate-bounce-dot-1"}),yt.createElement("div",{className:"w-2 h-2 bg-chatbot-primary rounded-full inline-block mx-[3px] animate-bounce-dot-2"}),yt.createElement("div",{className:"w-2 h-2 bg-chatbot-primary rounded-full inline-block mx-[3px] animate-bounce-dot-3"}));class bf extends Error{constructor(e,t){super(t),this.name="ApiError",this.status=e}}const yf=e=>{const t=async(t,{data:n,isSSE:r=!1,...o}={})=>{const a={"Content-Type":"application/json",...e.headers,...o.headers},i={...e,...o,headers:a};n&&(i.body=JSON.stringify(n));try{const n=await fetch(`${e.baseUrl}${t}`,i);if(!n.ok){const e=await n.json().catch(()=>({})),t=e.error||e.message||`Request failed with status ${n.status}`;throw new bf(n.status,t)}return r?n:await n.json()}catch(e){if(e instanceof bf)throw e;if(e instanceof TypeError&&"Failed to fetch"===e.message)throw new bf(0,"Unable to connect. Please check your internet connection.");throw e}};return{get:(e,n)=>t(e,{...n,method:"GET"}),post:(e,n,r)=>t(e,{...r,method:"POST",data:n}),put:(e,n,r)=>t(e,{...r,method:"PUT",data:n}),delete:(e,n)=>t(e,{...n,method:"DELETE"})}},vf=async e=>{const t=yf({baseUrl:"https://api.botric.ai/api/v1"});try{return await t.post("/tickets",e)}catch(e){throw console.error("Error in creating lead:",e),e}};function xf(e){return e instanceof bf||null!==e&&"object"==typeof e&&"name"in e&&"ApiError"===e.name&&"status"in e&&"number"==typeof e.status}function wf(e){return e.status}const kf={0:{default:"Unable to connect. Please check your internet connection and try again."},400:{default:"Invalid request. Please check your input and try again.",chat:"Please enter a message before sending.",session:"Failed to initialize session. Please refresh and try again.",lead:"Please fill in all required fields.",ticket:"Please fill in all required details.",booking:"Please fill in all required booking details.",slots:"Unable to load time slots. Please try a different date."},403:{default:"Access restricted.",chat:"This domain is not authorized to use this chatbot.",session:"This domain is not authorized to use this chatbot."},404:{default:"The requested resource was not found.",chat:"Chatbot not found. Please verify the configuration.",session:"Session expired. Please start a new conversation.",chatbot:"Chatbot not found. Please verify the configuration.",lead:"Service unavailable. Please try again later.",ticket:"Service unavailable. Please try again later.",booking:"Service unavailable. Please try again later.",slots:"Booking service unavailable. Please try again later."},429:{default:"Too many requests. Please try again later.",chat:"Something went wrong. Please try again later.",session:"Rate limit reached. Please try again later.",chatbot:"Rate limit reached. Please try again later."},500:{default:"Something went wrong on our end. Please try again later.",chat:"Something went wrong. Please try sending your message again.",session:"Failed to initialize chat session. Please try again.",chatbot:"Failed to load chatbot. Please try again later.",lead:"Failed to submit. Please try again.",ticket:"Failed to create ticket. Please try again.",booking:"Failed to create booking. Please try again.",slots:"Failed to load time slots. Please try again."}},_f=["chat","session"];function Ef(e,t="general"){if(xf(e)){const n=wf(e);if(_f.includes(t)||429===n||403===n){const e=kf[n]||kf[500];return e[t]||e.default}const r=e.message;if(r&&!r.startsWith("Request failed with status"))return r;const o=kf[n]||kf[500];return o[t]||o.default}return _f.includes(t)?kf[0][t]||kf[0].default:e instanceof Error&&e.message||"An unexpected error occurred. Please try again."}const Sf=({chatbotData:e,timestamp:t,onBookingSuccess:n,addSystemMessage:r,userInfo:o={}})=>{const[a,i]=ce(o.Name||""),[l,s]=ce(o.Email||""),[c,u]=ce(""),[d,p]=ce({}),[h,f]=ce(!1),[m,g]=ce(!1),[b,y]=ce(""),v=localStorage.getItem(`chat_session_${e.id}`),x=localStorage.getItem(`ticketData-${v}`);de(()=>{if(x)try{const e=JSON.parse(x),{ticketId:t,name:n,email:r,message:o}=e;y(t),i(n),s(r),u(o),f(!0)}catch{}},[x]);return h?yt.createElement("div",null,yt.createElement("div",{className:"rounded-2xl p-5 mb-1 max-w-[520px] w-full animate-slide-in bg-body-bg border border-body-fg/10 shadow-sm"},yt.createElement("p",{className:"m-0 text-base leading-snug text-body-fg pb-4 border-b border-body-fg/10"},"Great! Your support ticket has been created successfully. Our team will review your request and get back to you soon."),yt.createElement("div",{className:"flex items-center gap-3 py-4 border-b border-body-fg/10"},yt.createElement("div",{className:"w-14 h-14 rounded-full flex items-center justify-center bg-(--chatbot-primary)"},yt.createElement(Ft,{size:32,stroke:"white",strokeWidth:1.5})),yt.createElement("div",null,yt.createElement("p",{className:"text-base font-semibold text-body-fg m-0"},a),yt.createElement("p",{className:"text-sm text-chatbot-primary m-0"},l))),yt.createElement("div",{className:"flex items-center gap-6 pt-4"},yt.createElement("div",{className:"flex items-center gap-2 text-body-fg/70"},yt.createElement(qt,{size:18,className:"text-chatbot-primary"}),yt.createElement("span",{className:"text-sm"},"#",b)),yt.createElement("div",{className:"flex items-center gap-2 text-body-fg/70"},yt.createElement("span",{className:"w-2 h-2 rounded-full bg-green-500"}),yt.createElement("span",{className:"text-sm"},"Open")))),yt.createElement("div",{className:"flex gap-2 items-center text-sm text-body-fg/60 font-normal mt-1 ml-1"},yt.createElement(Ht,{size:16,stroke:"var(--chatbot-primary, #2662D9)",strokeWidth:1.5}),yt.createElement("span",null,e?.agentName?e.agentName:e?.name),yt.createElement("span",{className:"w-1 h-1 rounded-full bg-current opacity-50"}),yt.createElement(mf,null,Wt(t)))):yt.createElement("div",{className:"relative overflow-hidden rounded-lg p-5 w-full max-w-[340px] shadow-md bg-linear-to-br from-body-bg to-body-bg/95 text-body-fg border border-bubble-bot-bg/30"},yt.createElement("div",{className:"flex items-center gap-3 mb-4 pb-3 border-b border-body-fg/20"},yt.createElement("h3",{className:"m-0 text-base font-semibold text-body-fg"},"Create Support Ticket")),yt.createElement("div",{className:"grid gap-4"},yt.createElement("div",null,yt.createElement("label",{className:"text-sm font-medium mb-2 flex items-center gap-2 text-body-fg"},yt.createElement("span",null,"Full Name")),yt.createElement("input",{className:"w-full px-4! py-3! rounded-lg text-sm outline-none transition transform duration-200 bg-input-bg/95 text-input-fg border-2 border-input-fg/40 shadow-none "+(d.name?"ring-2 ring-red-400":""),placeholder:"Enter your full name",value:a,onChange:e=>i(e.target.value)}),d.name&&yt.createElement("div",{className:"text-xs text-red-500 mt-2"},"⚠️ ",d.name)),yt.createElement("div",null,yt.createElement("label",{className:"text-sm font-medium mb-2 flex items-center gap-2 text-body-fg"},yt.createElement("span",null,"Email Address")),yt.createElement("input",{type:"email",className:"w-full px-4! py-3! rounded-lg text-sm outline-none transition transform duration-200 bg-input-bg/95 text-input-fg border-2 border-input-fg/40 shadow-none "+(d.email?"ring-2 ring-red-400":""),placeholder:"your@email.com",value:l,onChange:e=>s(e.target.value)}),d.email&&yt.createElement("div",{className:"text-xs text-red-500 mt-2"},"⚠️ ",d.email)),yt.createElement("div",{className:"relative"},yt.createElement("label",{className:"text-sm font-medium mb-2 flex items-center gap-2 text-body-fg"},yt.createElement("span",null,"Describe Your Issue")),yt.createElement("textarea",{className:"w-full px-4! py-3! rounded-lg text-sm outline-none transition transform duration-200 bg-input-bg/95 text-input-fg border-2 border-input-fg/40 shadow-none resize-none min-h-20 max-h-[120px] "+(d.message?"ring-2 ring-red-400":""),placeholder:"Please describe your issue in detail...",value:c,onChange:e=>u(e.target.value.slice(0,200)),rows:4}),yt.createElement("div",{className:"absolute bottom-3 right-3 text-xs font-semibold rounded px-2! py-0.5! bg-body-fg/10 "+(c.length>180?"text-amber-500":"text-body-fg/80")},c.length,"/200"),d.message&&yt.createElement("div",{className:"text-xs text-red-500 mt-2"},"⚠️ ",d.message)),(!d.message||d.name||d.email,null)),yt.createElement("div",{className:"flex gap-3 mt-5"},yt.createElement("button",{onClick:async()=>{await(async e=>{const t=yf({baseUrl:"https://api.botric.ai/api/v1/tickets"});try{return await t.get(`/cancel/${e}`)}catch(e){throw console.error("Error cancelling ticket:",e),e}})(v||""),r("Ticket creation cancelled.")},disabled:m,className:"flex-1 px-5 py-3 rounded-full text-sm font-semibold transition-all duration-300 ease-out flex items-center justify-center gap-2 bg-transparent border-2 border-gray-300 text-gray-700 hover:bg-gray-50 disabled:opacity-60 disabled:cursor-not-allowed"},"Cancel"),yt.createElement("button",{onClick:async()=>{const t={};if(a.trim()||(t.name="Name is required"),Yt(l)||(t.email="Please enter a valid email"),c.trim()||(t.message="Message is required"),c.length>200&&(t.message="Message too long (max 200 chars)"),Object.keys(t).length>0)p(t);else{g(!0),p({});try{const t=await vf({agentId:e._id,orgId:e.organizationId,sessionId:v||"",name:a,email:l,message:c});if(t?.success&&t.data){const e=t.data;y(e.ticketId),localStorage.setItem(`ticketData-${v}`,JSON.stringify({ticketId:e.ticketId,name:a,email:l,message:c,timestamp:Date.now()})),f(!0),n?.()}else p({message:"Failed to create ticket. Please try again."})}catch(e){p({message:Ef(e,"ticket")})}finally{g(!1)}}},disabled:m,className:"flex-1 px-5 py-3 rounded-full text-sm font-semibold transition-all duration-300 ease-out flex items-center justify-center gap-2 shadow-md bg-blue-600 text-white hover:bg-blue-700 disabled:shadow-none disabled:opacity-60 disabled:cursor-not-allowed"},m&&yt.createElement("svg",{className:"w-4 h-4 animate-spin mr-1",viewBox:"0 0 24 24",fill:"none"},yt.createElement("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",strokeOpacity:"0.2"}),yt.createElement("path",{d:"M22 12a10 10 0 00-10-10",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round"})),m?"Creating...":"Create Ticket")),d.message&&yt.createElement("div",{className:"mt-3 text-xs text-red-500 flex items-center gap-2"},"⚠️ ",d.message))},Cf=6048e5,Nf=Symbol.for("constructDateFrom");function Tf(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&Nf in e?e[Nf](t):e instanceof Date?new e.constructor(t):new Date(t)}function If(e,t){return Tf(t||e,e)}function Lf(e,t,n){const r=If(e,n?.in);return isNaN(t)?Tf(n?.in||e,NaN):t?(r.setDate(r.getDate()+t),r):r}function Mf(e,t,n){const r=If(e,n?.in);if(isNaN(t))return Tf(n?.in||e,NaN);if(!t)return r;const o=r.getDate(),a=Tf(n?.in||e,r.getTime());a.setMonth(r.getMonth()+t+1,0);return o>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),o),r)}let Pf={};function Df(){return Pf}function Af(e,t){const n=Df(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=If(e,t?.in),a=o.getDay(),i=(a<r?7:0)+a-r;return o.setDate(o.getDate()-i),o.setHours(0,0,0,0),o}function Of(e,t){return Af(e,{...t,weekStartsOn:1})}function zf(e,t){const n=If(e,t?.in),r=n.getFullYear(),o=Tf(n,0);o.setFullYear(r+1,0,4),o.setHours(0,0,0,0);const a=Of(o),i=Tf(n,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const l=Of(i);return n.getTime()>=a.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function Rf(e){const t=If(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Ff(e,...t){const n=Tf.bind(null,e||t.find(e=>"object"==typeof e));return t.map(n)}function $f(e,t){const n=If(e,t?.in);return n.setHours(0,0,0,0),n}function jf(e,t,n){const[r,o]=Ff(n?.in,e,t);return+$f(r)===+$f(o)}function Hf(e){return!(!((t=e)instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t))&&"number"!=typeof e||isNaN(+If(e)));var t}function Bf(e,t){const n=If(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}const qf={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function Uf(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Vf={date:Uf({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Uf({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:Uf({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Wf={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Yf(e){return(t,n)=>{let r;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,o=n?.width?String(n.width):t;r=e.formattingValues[o]||e.formattingValues[t]}else{const t=e.defaultWidth,o=n?.width?String(n.width):e.defaultWidth;r=e.values[o]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}const Zf={ordinalNumber:(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:Yf({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Yf({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:Yf({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:Yf({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:Yf({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function Gf(e){return(t,n={})=>{const r=n.width,o=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(o);if(!a)return null;const i=a[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(l)?function(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n;return}(l,e=>e.test(i)):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(l,e=>e.test(i));let c;c=e.valueCallback?e.valueCallback(s):s,c=n.valueCallback?n.valueCallback(c):c;return{value:c,rest:t.slice(i.length)}}}const Qf={ordinalNumber:(Kf={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(Kf.matchPattern);if(!n)return null;const r=n[0],o=e.match(Kf.parsePattern);if(!o)return null;let a=Kf.valueCallback?Kf.valueCallback(o[0]):o[0];return a=t.valueCallback?t.valueCallback(a):a,{value:a,rest:e.slice(r.length)}}),era:Gf({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:Gf({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:Gf({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:Gf({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:Gf({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})};var Kf;const Xf={code:"en-US",formatDistance:(e,t,n)=>{let r;const o=qf[e];return r="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:Vf,formatRelative:(e,t,n,r)=>Wf[e],localize:Zf,match:Qf,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Jf(e,t){const n=If(e,t?.in),r=function(e,t,n){const[r,o]=Ff(n?.in,e,t),a=$f(r),i=$f(o),l=+a-Rf(a),s=+i-Rf(i);return Math.round((l-s)/864e5)}(n,function(e,t){const n=If(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}(n));return r+1}function em(e,t){const n=If(e,t?.in),r=+Of(n)-+function(e,t){const n=zf(e,t),r=Tf(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Of(r)}(n);return Math.round(r/Cf)+1}function tm(e,t){const n=If(e,t?.in),r=n.getFullYear(),o=Df(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,i=Tf(t?.in||e,0);i.setFullYear(r+1,0,a),i.setHours(0,0,0,0);const l=Af(i,t),s=Tf(t?.in||e,0);s.setFullYear(r,0,a),s.setHours(0,0,0,0);const c=Af(s,t);return+n>=+l?r+1:+n>=+c?r:r-1}function nm(e,t){const n=If(e,t?.in),r=+Af(n,t)-+function(e,t){const n=Df(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=tm(e,t),a=Tf(t?.in||e,0);return a.setFullYear(o,0,r),a.setHours(0,0,0,0),Af(a,t)}(n,t);return Math.round(r/Cf)+1}function rm(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const om={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return rm("yy"===t?r%100:r,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):rm(n+1,2)},d:(e,t)=>rm(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>rm(e.getHours()%12||12,t.length),H:(e,t)=>rm(e.getHours(),t.length),m:(e,t)=>rm(e.getMinutes(),t.length),s:(e,t)=>rm(e.getSeconds(),t.length),S(e,t){const n=t.length,r=e.getMilliseconds();return rm(Math.trunc(r*Math.pow(10,n-3)),t.length)}},am="midnight",im="noon",lm="morning",sm="afternoon",cm="evening",um="night",dm={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:"year"})}return om.y(e,t)},Y:function(e,t,n,r){const o=tm(e,r),a=o>0?o:1-o;if("YY"===t){return rm(a%100,2)}return"Yo"===t?n.ordinalNumber(a,{unit:"year"}):rm(a,t.length)},R:function(e,t){return rm(zf(e),t.length)},u:function(e,t){return rm(e.getFullYear(),t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return rm(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return rm(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return om.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return rm(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const o=nm(e,r);return"wo"===t?n.ordinalNumber(o,{unit:"week"}):rm(o,t.length)},I:function(e,t,n){const r=em(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):rm(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):om.d(e,t)},D:function(e,t,n){const r=Jf(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):rm(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const o=e.getDay(),a=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return rm(a,2);case"eo":return n.ordinalNumber(a,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const o=e.getDay(),a=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return rm(a,t.length);case"co":return n.ordinalNumber(a,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),o=0===r?7:r;switch(t){case"i":return String(o);case"ii":return rm(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let o;switch(o=12===r?im:0===r?am:r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let o;switch(o=r>=17?cm:r>=12?sm:r>=4?lm:um,t){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return om.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):om.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):rm(r,t.length)},k:function(e,t,n){let r=e.getHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):rm(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):om.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):om.s(e,t)},S:function(e,t){return om.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return hm(r);case"XXXX":case"XX":return fm(r);default:return fm(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return hm(r);case"xxxx":case"xx":return fm(r);default:return fm(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+pm(r,":");default:return"GMT"+fm(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+pm(r,":");default:return"GMT"+fm(r,":")}},t:function(e,t,n){return rm(Math.trunc(+e/1e3),t.length)},T:function(e,t,n){return rm(+e,t.length)}};function pm(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=Math.trunc(r/60),a=r%60;return 0===a?n+String(o):n+String(o)+t+rm(a,2)}function hm(e,t){if(e%60==0){return(e>0?"-":"+")+rm(Math.abs(e)/60,2)}return fm(e,t)}function fm(e,t=""){const n=e>0?"-":"+",r=Math.abs(e);return n+rm(Math.trunc(r/60),2)+t+rm(r%60,2)}const mm=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},gm=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},bm={p:gm,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],o=n[2];if(!o)return mm(e,t);let a;switch(r){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;default:a=t.dateTime({width:"full"})}return a.replace("{{date}}",mm(r,t)).replace("{{time}}",gm(o,t))}},ym=/^D+$/,vm=/^Y+$/,xm=["D","DD","YY","YYYY"];const wm=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,km=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,_m=/^'([^]*?)'?$/,Em=/''/g,Sm=/[a-zA-Z]/;function Cm(e,t,n){const r=Df(),o=n?.locale??r.locale??Xf,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,l=If(e,n?.in);if(!Hf(l))throw new RangeError("Invalid time value");let s=t.match(km).map(e=>{const t=e[0];if("p"===t||"P"===t){return(0,bm[t])(e,o.formatLong)}return e}).join("").match(wm).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Nm(e)};if(dm[t])return{isToken:!0,value:e};if(t.match(Sm))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});o.localize.preprocessor&&(s=o.localize.preprocessor(l,s));const c={firstWeekContainsDate:a,weekStartsOn:i,locale:o};return s.map(r=>{if(!r.isToken)return r.value;const a=r.value;(!n?.useAdditionalWeekYearTokens&&function(e){return vm.test(e)}(a)||!n?.useAdditionalDayOfYearTokens&&function(e){return ym.test(e)}(a))&&function(e,t,n){const r=function(e,t,n){const r="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(r),xm.includes(e))throw new RangeError(r)}(a,t,String(e));return(0,dm[a[0]])(l,a,o.localize,c)}).join("")}function Nm(e){const t=e.match(_m);return t?t[1].replace(Em,"'"):e}function Tm(e,t,n){const[r,o]=Ff(n?.in,e,t);return r.getFullYear()===o.getFullYear()&&r.getMonth()===o.getMonth()}const Im=["SUN","MON","TUE","WED","THU","FRI","SAT"],Lm=["January","February","March","April","May","June","July","August","September","October","November","December"];function Mm({value:e,onChange:t,chatbotData:n}){const r=new Date,[o,a]=ce(Bf(e||r)),[i,l]=ce(e||r),[s,c]=ce(!1),u=yt.useRef(null);de(()=>{const e=e=>{u.current&&!u.current.contains(e.target)&&c(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);de(()=>{i&&t&&t(i)},[i]);return yt.createElement("div",{className:"w-full font-sans py-2 bg-body-bg"},yt.createElement("div",{className:"flex justify-between items-center mb-4 text-body-fg px-1"},yt.createElement("button",{onClick:()=>{return a(Mf(o,-1,e));var e},className:"bg-transparent border-none cursor-pointer p-2 leading-none hover:bg-chatbot-primary/10 text-body-fg hover:text-chatbot-primary"},yt.createElement(Ot,{size:20})),yt.createElement("div",{className:"relative",ref:u},yt.createElement("button",{onClick:()=>c(e=>!e),className:"flex items-center gap-1 bg-transparent border-none cursor-pointer text-lg font-medium text-body-fg hover:opacity-70"},Cm(o,"MMMM yyyy"),yt.createElement(At,{size:18,className:"transition-transform duration-200 "+(s?"rotate-180":"")})),s&&yt.createElement("div",{className:"absolute top-full left-1/2 -translate-x-1/2 mt-2 bg-body-bg border border-body-fg/15 rounded-lg shadow-[0_8px_24px_rgba(0,0,0,0.12)] py-1 z-50 max-h-52 overflow-y-auto w-40"},Lm.map((e,t)=>yt.createElement("button",{key:e,onMouseDown:e=>{e.preventDefault(),(e=>{const t=new Date(o.getFullYear(),e,1);a(Bf(t)),c(!1)})(t)},className:"w-full text-left px-4 py-2 text-sm border-none cursor-pointer transition-colors duration-150 "+(t===o.getMonth()?"bg-chatbot-primary text-white font-medium":"bg-transparent text-body-fg hover:bg-chatbot-primary/10")},e)))),yt.createElement("button",{onClick:()=>a(Mf(o,1)),className:"bg-transparent text-body-fg border-none cursor-pointer p-2 rounded-full leading-none hover:bg-chatbot-primary/10 hover:text-chatbot-primary"},yt.createElement(zt,{size:20}))),yt.createElement("div",{className:"grid grid-cols-7 text-center mb-3"},Im.map(e=>yt.createElement("div",{key:e,className:"text-xs font-semibold tracking-wide py-1 w-10 text-center text-body-fg/60"},e))),(()=>{const e=Bf(o),t=function(e,t){const n=If(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}(e),n=Af(e,{weekStartsOn:0}),a=function(e,t){const n=Df(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=If(e,t?.in),a=o.getDay(),i=6+(a<r?-7:0)-(a-r);return o.setDate(o.getDate()+i),o.setHours(23,59,59,999),o}(t,{weekStartsOn:0}),s=[];let c=n;for(;c<=a;){const t=c,n=Tm(c,e),o=c<$f(r),a=!!i&&jf(c,i),u=()=>n?o?{color:"var(--body-fg, #000)",opacity:.25}:a?{backgroundColor:"var(--chatbot-primary, #2662D9)",color:"var(--send-btn-fg, #fff)"}:{backgroundColor:"var(--body-bg, #fff)",color:"var(--body-fg, #000)"}:{},d=()=>{let e="h-10 w-10 border-none rounded-full flex items-center justify-center text-base font-medium transition-colors duration-150";return e+=n?o?" cursor-not-allowed":a?" cursor-pointer":" cursor-pointer hover:opacity-80":" invisible",e};s.push(yt.createElement("button",{key:c.toString(),className:d(),style:u(),onClick:()=>n&&!o&&l(t),disabled:!n||o},Cm(c,"d"))),c=Lf(c,1)}return yt.createElement("div",{className:"grid grid-cols-7 gap-y-2"},s)})())}const Pm=({chatbotData:e,timestamp:t,onBookingSuccess:n,addSystemMessage:r,userInfo:o={}})=>{const[a,i]=ce(1),[l,s]=ce(new Date),[c,u]=ce(""),[d,p]=ce([]),[h,f]=ce(!1),[m,g]=ce(o.Name||""),[b,y]=ce(o.Email||""),[v,x]=ce({}),[w,k]=ce(!1),[_,E]=ce(!1),[S,C]=ce(""),N=localStorage.getItem(`chat_session_${e?.id}`),T=localStorage.getItem(`calBookingData-${N}`),{tools:{calcom:{username:I,meetingType:L}={}}={}}=e;de(()=>{l&&2===a&&I&&L&&D()},[l,a,I,L]),de(()=>{if(T)try{const e=JSON.parse(T);if(e.datetime&&e.selectedTime){const t=new Date(e.datetime);isNaN(t.getTime())||(s(t),C(e.selectedTime),E(!0))}}catch(e){const t=new Date(T);isNaN(t.getTime())||(s(t),E(!0))}},[N]);const M=async(e,t,n)=>{try{const r=await(async e=>{const t=yf({baseUrl:"https://api.botric.ai/api/v1/integrations/cal"}),n=new URLSearchParams({username:e.username,eventTypeSlug:e.eventSlug,start:e.startTime,end:e.endTime});try{return await t.get(`/slots?${n.toString()}`)}catch(e){throw console.error("Error fetching Cal.com slots:",e),e}})({username:t,eventSlug:n,startTime:`${e}T00:00:00.000Z`,endTime:`${e}T23:59:59.999Z`});if(!r||"object"!=typeof r||!("slots"in r))throw new Error("Invalid response format from Cal.com API");const o=r.slots.data[e]||[];return o.map(e=>({time:new Date(e.start).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"}),available:!0}))}catch(e){throw console.error("Failed to fetch Cal.com slots:",e),e}},P=async t=>{const[n,r]=t.time.split(":").map(Number),o=function(e,t,n){const r=If(e,n?.in);return r.setMilliseconds(t),r}(function(e,t,n){const r=If(e,n?.in);return r.setSeconds(t),r}(function(e,t,n){const r=If(e,n?.in);return r.setMinutes(t),r}(function(e,t,n){const r=If(e,n?.in);return r.setHours(t),r}(l,n),r),0),0);try{const n={start:o.toISOString(),eventTypeSlug:L,username:I,attendee:{name:t.name,email:t.email,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,language:"en"},agentId:e?._id,orgId:e?.organizationId,sessionId:N||""};if(!n.eventTypeSlug||!n.username)throw new Error("Missing required fields: eventTypeSlug or username");const r=await(async e=>{const t=yf({baseUrl:"https://api.botric.ai/api/v1/integrations/cal"});try{return(await t.post("/booking",e)).booking.data}catch(e){throw console.error("Error creating Cal.com booking:",e),e}})(n),a={datetime:n.start,selectedTime:t.time,name:t.name,email:t.email};if(localStorage.setItem(`calBookingData-${N}`,JSON.stringify(a)),!r||"object"!=typeof r||!("uid"in r))throw new Error("Invalid booking response from Cal.com API");return{bookingId:r.uid,status:r.status,start:r.start,end:r.end,meetingUrl:r.meetingUrl,title:r.title}}catch(e){throw console.error("Failed to create Cal.com booking:",e),e}},D=async()=>{if(I&&L){f(!0);try{const e=await M(Cm(l,"yyyy-MM-dd"),I,L);p(e),0===e.length&&x({slots:"No available time slots for this date"})}catch(e){x({slots:Ef(e,"slots")})}finally{f(!1)}}else x({slots:"Cal.com configuration is missing"})},A=e=>{const[t,n]=e.split(":"),r=parseInt(t);return`${r%12||12}:${n||"00"} ${r>=12?"PM":"AM"}`};if(_){const n=JSON.parse(T||"{}");return yt.createElement("div",null,yt.createElement("div",{className:"rounded-2xl p-5 mb-1 max-w-[520px] w-full animate-slide-in bg-body-bg border border-body-fg/10 shadow-sm"},yt.createElement("p",{className:"m-0 text-lg leading-relaxed text-body-fg pb-4 border-b border-body-fg/10"},"Perfect! Your booking has been confirmed successfully. We'll send you a confirmation email shortly"),yt.createElement("div",{className:"flex items-center gap-3 py-4 border-b border-body-fg/10"},yt.createElement("div",{className:"w-14 h-14 rounded-full flex items-center justify-center bg-(--chatbot-primary)"},yt.createElement(Ft,{size:32,stroke:"white",strokeWidth:1.5})),yt.createElement("div",null,yt.createElement("p",{className:"text-base font-semibold text-body-fg m-0"},n?.name),yt.createElement("p",{className:"text-sm text-chatbot-primary m-0"},n?.email))),yt.createElement("div",{className:"flex items-center gap-6 pt-4"},yt.createElement("div",{className:"flex items-center gap-2 text-body-fg/70"},yt.createElement(Pt,{size:18,className:"text-chatbot-primary"}),yt.createElement("span",{className:"text-sm"},n?.datetime?Cm(new Date(n.datetime),"EEEE, d MMMM"):"")),yt.createElement("div",{className:"flex items-center gap-2 text-body-fg/70"},yt.createElement($t,{size:18,className:"text-chatbot-primary"}),yt.createElement("span",{className:"text-sm"},A(n?.selectedTime))))),yt.createElement("div",{className:"flex gap-2 items-center text-sm text-body-fg/60 font-normal mt-1 ml-1"},yt.createElement(Ht,{size:16,stroke:"var(--chatbot-primary, #2662D9)",strokeWidth:1.5}),yt.createElement("span",null,e?.agentName?e.agentName:e?.name),yt.createElement("span",{className:"w-1 h-1 rounded-full bg-current opacity-50"}),yt.createElement(mf,null,Wt(t))))}return yt.createElement("div",{className:"relative overflow-hidden rounded-2xl p-1 w-full max-w-[520px] mb-3 animate-slide-in text-body-fg"},yt.createElement("div",{className:"flex items-center justify-between mb-4 pb-3"},yt.createElement("div",{className:"flex items-center gap-2"},yt.createElement(Dt,{size:20,className:"text-chatbot-primary"}),yt.createElement("h3",{className:"m-0 text-base font-semibold leading-tight text-body-fg"},(e=>{switch(e){case 1:return"Select Date";case 2:return"Choose Time";case 3:return"Your Details";case 4:return"Confirm Booking";default:return"Book Appointment"}})(a))),yt.createElement("span",{className:"text-sm text-body-fg/70"},"Step ",a," of 4")),yt.createElement("div",{className:"grid gap-4"},1===a&&yt.createElement("div",{className:"relative"},yt.createElement(Mm,{value:l,onChange:e=>s(e),chatbotData:e}),v.date&&yt.createElement("div",{className:"text-red-500 text-xs mt-1 flex items-center gap-1"},"⚠️ ",v.date)),2===a&&yt.createElement("div",{className:"relative"},h?yt.createElement("div",{className:"flex items-center justify-center py-8 gap-2 text-body-fg/60 text-sm"},yt.createElement("div",{className:"w-4 h-4 border-2 border-transparent border-t-current rounded-full animate-spin"}),yt.createElement("span",null,"Loading available slots...")):yt.createElement("div",{className:"grid grid-cols-3 gap-3 max-h-[280px] overflow-y-auto"},d.map(e=>yt.createElement("button",{key:e.time,onClick:()=>e.available&&u(e.time),disabled:!e.available,className:"py-3 px-4 rounded-full text-sm font-medium cursor-pointer transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-40 border-2 "+(c===e.time?"border-chatbot-primary bg-chatbot-primary text-chatbot-foreground":"border-chatbot-primary/30 bg-transparent text-body-fg hover:bg-chatbot-primary/50")},A(e.time)))),v.time&&yt.createElement("div",{className:"text-red-500 text-xs mt-2 flex items-center gap-1"},v.time),v.slots&&yt.createElement("div",{className:"text-red-500 text-xs mt-2 flex items-center gap-1"},v.slots)),3===a&&yt.createElement(yt.Fragment,null,yt.createElement("div",{className:"relative"},yt.createElement("label",{className:"text-[13px] font-medium mb-1.5 flex items-center gap-1 text-body-fg"},"Full Name"),yt.createElement("input",{placeholder:"Enter your full name",value:m,onChange:e=>g(e.target.value),className:"w-full py-3 px-4 rounded-[10px] text-sm outline-none font-inherit transition-all duration-300 bg-input-bg/95 text-input-fg border-2 "+(v.name?"border-red-500":"border-input-fg/40")}),v.name&&yt.createElement("div",{className:"text-red-500 text-xs mt-1 flex items-center gap-1"},"⚠️ ",v.name)),yt.createElement("div",{className:"relative"},yt.createElement("label",{className:"text-[13px] font-medium mb-1.5 flex items-center gap-1 text-body-fg"},"Email Address"),yt.createElement("input",{type:"email",placeholder:"your@email.com",value:b,onChange:e=>y(e.target.value),className:"w-full py-3 px-4 rounded-[10px] text-sm outline-none font-inherit transition-all duration-300 bg-input-bg/95 text-input-fg border-2 "+(v.email?"border-red-500":"border-input-fg/40")}),v.email&&yt.createElement("div",{className:"text-red-500 text-xs mt-1 flex items-center gap-1"},"⚠️ ",v.email))),4===a&&yt.createElement("div",{className:"relative"},yt.createElement("div",{className:"p-4 rounded-2xl border border-body-fg/10 bg-body-bg shadow-sm"},yt.createElement("div",{className:"flex items-center gap-3 pb-4 border-b border-body-fg/10"},yt.createElement("div",{className:"w-14 h-14 rounded-full flex items-center justify-center",style:{backgroundColor:"var(--chatbot-primary, #2662D9)"}},yt.createElement(Ft,{size:32,stroke:"white",strokeWidth:1.5})),yt.createElement("div",null,yt.createElement("p",{className:"text-base font-semibold text-body-fg m-0"},m),yt.createElement("p",{className:"text-sm text-gray-700 m-0"},b))),yt.createElement("div",{className:"flex items-center gap-6 pt-4"},yt.createElement("div",{className:"flex items-center gap-2 text-body-fg/70"},yt.createElement(Pt,{size:18,className:"text-chatbot-primary"}),yt.createElement("span",{className:"text-sm"},Cm(l,"EEEE, d MMMM"))),yt.createElement("div",{className:"flex items-center gap-2 text-body-fg/70"},yt.createElement($t,{size:18,className:"text-chatbot-primary"}),yt.createElement("span",{className:"text-sm"},A(c))))),v.booking&&yt.createElement("div",{className:"text-red-500 text-xs mt-2 flex items-center gap-1"},v.booking))),yt.createElement("div",{className:"flex gap-2.5 mt-5"},a>1&&yt.createElement("button",{onClick:()=>{x({}),a>1&&i(a-1)},className:"flex-1 py-3 px-5 rounded-[10px] text-sm font-semibold cursor-pointer transition-all duration-300 flex items-center justify-center gap-1.5 font-inherit bg-transparent text-send-btn-bg border-2 border-send-btn-bg/40"},"Back"),yt.createElement("button",{onClick:1===a?()=>{l?I&&L?(x({}),i(2)):x({date:"Cal.com configuration is missing"}):x({date:"Please select a date"})}:2===a?()=>{c?(x({}),i(3)):x({time:"Please select a time slot"})}:3===a?()=>{const e={};m.trim()||(e.name="Name is required"),b.trim()?Yt(b)||(e.email="Please enter a valid email"):e.email="Email is required",Object.keys(e).length>0?x(e):(x({}),i(4))}:async()=>{k(!0);try{await P({date:Cm(l,"yyyy-MM-dd"),time:c,name:m,email:b});C(c),E(!0),n&&n()}catch(e){x({booking:Ef(e,"booking")})}finally{k(!1)}},disabled:2===a&&h||4===a&&w,className:"flex-1 py-3 px-5 rounded-[10px] text-sm font-semibold cursor-pointer transition-all duration-300 flex items-center justify-center gap-1.5 font-inherit relative overflow-hidden disabled:opacity-60 disabled:cursor-not-allowed bg-linear-to-br from-send-btn-bg to-send-btn-bg/85 text-send-btn-fg shadow-[0_2px_8px_var(--send-btn-bg,#2662D9)/40]"},w&&4===a&&yt.createElement("div",{className:"w-4 h-4 border-2 border-transparent border-t-current rounded-full animate-spin"}),1===a&&"Next",2===a&&(h?"Loading...":"Next"),3===a&&"Next",4===a&&(w?"":"Confirm"))),yt.createElement("div",{className:"text-center mt-3"},yt.createElement("button",{onClick:async()=>{await(async e=>{const t=yf({baseUrl:"https://api.botric.ai/api/v1/integrations"});try{return await t.get(`/cancel/${e}`)}catch(e){throw console.error("Error cancelling Cal.com booking:",e),e}})(N||""),r("Booking creation cancelled by user.")},className:"bg-transparent border-none text-[13px] font-semibold cursor-pointer text-chatbot-primary"},"Cancel")))},Dm=({chatbotData:e,formFields:t,onSubmit:n})=>{const[r,o]=ce({}),[a,i]=ce({}),[l,s]=ce(!1),[c,u]=ce(""),d=(e,t)=>{o(n=>({...n,[e]:t})),i(t=>({...t,[e]:""}))};return yt.createElement("div",{className:"w-full min-h-0 flex-1"},yt.createElement("div",{className:"wrap-break-word w-fit max-w-[85%] py-3 px-4 rounded-4xl animate-fade-in whitespace-pre-wrap font-normal font-sans text-base leading-normal bg-bubble-bot-bg text-bubble-bot-fg"},yt.createElement("p",{className:"m-0"},"We'd like to know you better! Please fill out the form below to start chatting.")),yt.createElement("div",{className:"flex gap-2 items-center text-sm text-body-fg/60 font-normal mt-1 ml-1"},yt.createElement(Ht,{size:16,stroke:"var(--chatbot-primary, #2662D9)",strokeWidth:1.5}),yt.createElement("span",null,e?.agentName?e.agentName:e?.name)),yt.createElement("div",{className:"relative overflow-hidden rounded-2xl p-5 w-full max-w-[340px] mb-3 shadow-lg animate-slide-in bg-linear-to-br from-body-bg to-body-bg/95 border border-bubble-bot-bg/30 text-body-fg"},yt.createElement("div",{className:"flex items-center gap-2 mb-4 pb-3 border-b border-body-fg/20"},yt.createElement("div",{className:"flex-1"},yt.createElement("h3",{className:"m-0 text-base font-semibold leading-tight text-body-fg"},"Let's Connect!"))),yt.createElement("div",{className:"grid gap-4"},t.filter(e=>e.enabled).map(e=>{const t=r[e.label]||"",n=!!a[e.label];return yt.createElement("div",{key:e.label,className:"relative"},yt.createElement("label",{className:"text-[13px] font-medium mb-1.5 flex items-center gap-1 text-body-fg"},e.label," ",e.required&&yt.createElement("span",{className:"text-red-500 ml-0.5"},"*")),"textarea"===e.type?yt.createElement("textarea",{placeholder:`Enter ${e.label.toLowerCase()}...`,value:t,onChange:t=>d(e.label,t.target.value.slice(0,200)),disabled:l,className:"w-full py-3 px-4 rounded-[10px] text-sm outline-none resize-none font-inherit min-h-20 max-h-[120px] transition-all duration-300 bg-input-bg/95 text-input-fg border-2 "+(n?"border-red-500":"border-input-fg/40")}):yt.createElement("input",{type:"phone"===e.type?"tel":e.type,placeholder:`Enter ${e.label.toLowerCase()}`,value:t,onChange:t=>d(e.label,t.target.value),disabled:l,className:"w-full py-3 px-4 rounded-[10px] text-sm outline-none font-inherit transition-all duration-300 bg-input-bg/95 text-input-fg border-2 "+(n?"border-red-500":"border-input-fg/40")}),"textarea"===e.type&&yt.createElement("div",{className:"absolute bottom-2 right-3 text-[11px] font-medium rounded px-1.5 py-0.5 bg-body-fg/10 "+(t.length>180?"text-amber-500":"text-body-fg/80")},t.length,"/200"),n&&yt.createElement("div",{className:"text-red-500 text-xs mt-1 flex items-center gap-1 animate-fade-in"},"⚠️ ",a[e.label]))})),c&&yt.createElement("div",{className:"text-red-500 text-xs flex items-center gap-1 animate-fade-in"},c),yt.createElement("div",{className:"flex gap-2.5 mt-5"},yt.createElement("button",{onClick:async()=>{const e={},o=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;if(t.forEach(t=>{const{label:n,required:a,enabled:i,type:l}=t,s=r[n];i&&a&&(!s||"string"==typeof s&&""===s.trim()?e[n]="This field is required":"email"!==l||o.test(s)||(e[n]="Please enter a valid email address")),i&&"email"===l&&s&&!o.test(s)&&(e[n]="Please enter a valid email address")}),Object.keys(e).length>0)i(e);else{s(!0),u("");try{await n(r)}catch(e){console.error("Form submission error:",e),u(Ef(e,"lead"))}finally{s(!1)}}},disabled:l,className:"flex-1 py-3 px-5 rounded-[10px] text-sm font-semibold cursor-pointer transition-all duration-300 flex items-center justify-center gap-1.5 font-inherit relative overflow-hidden disabled:opacity-60 disabled:cursor-not-allowed bg-linear-to-br from-send-btn-bg to-send-btn-bg/85 text-send-btn-fg shadow-[0_2px_8px_var(--send-btn-bg,#2662D9)/40]"},l?yt.createElement(yt.Fragment,null,yt.createElement("div",{className:"w-4 h-4 border-2 border-transparent border-t-current rounded-full animate-spin"}),"Submitting..."):"Submit"))))},Am=({onQuestionClick:e,faqData:t,faqLoading:n=!1})=>n?yt.createElement("div",{className:"w-[300px] bg-body-bg border-r border-black/10 p-6 flex flex-col gap-4 overflow-y-auto h-full flex-shrink-0"},yt.createElement("h3",{className:"text-[1.1rem] font-semibold m-0 mb-4 text-body-fg flex items-center gap-2"},yt.createElement("span",{className:"text-[1.2rem]"},"💡"),"Quick Questions"),yt.createElement("div",{className:"text-body-fg text-[0.9rem] text-center py-8 px-4"},"Loading questions...")):t&&0!==t.length?yt.createElement("div",{className:"w-[300px] bg-body-bg border-r border-black/10 p-6 flex flex-col gap-4 overflow-y-auto h-full flex-shrink-0"},yt.createElement("h3",{className:"text-[1.1rem] font-semibold m-0 mb-4 text-body-fg flex items-center gap-2"},yt.createElement("span",{className:"text-[1.2rem]"},"💡"),"Quick Questions"),t.map((t,n)=>yt.createElement("button",{key:t._id||n,onClick:()=>e(t.question),className:"bg-transparent border border-black/20 rounded-lg p-4 text-left text-[0.9rem] text-body-fg cursor-pointer transition-all duration-200 font-sans hover:bg-chatbot-primary/5 hover:border-chatbot-primary/30 focus:outline-none focus:border-chatbot-primary focus:shadow-[0_0_0_2px_rgba(38,98,217,0.2)]"},t.question))):null,Om=$e(({sessionLoading:e,sessionError:t,sessionErrorMessage:n,onRetrySession:r,showLeadsForm:o,chatbotData:a,handleLeadSubmit:i,messages:l,isLoading:s,isError:c,error:u,followUpQuestions:d,handleFollowUp:p,disableInput:h,onWidgetComplete:f,addSystemMessage:m,userInfo:g={},faqData:b=null,faqLoading:y=!1},v)=>{const x="modal"===a?.design?.viewMode,w=he(null),k=he(null),[_,E]=ce(!1),S=he(!0),C=ge(e=>{w.current=e,"function"==typeof v?v(e):v&&(v.current=e)},[v]),N=ge(e=>{const t=e.currentTarget,n=t.scrollHeight-t.scrollTop-t.clientHeight<=100;E(!n),S.current=n},[]),T=ge(()=>{const e=x?k.current:w.current;e?.scrollTo({top:e.scrollHeight,behavior:"smooth"}),S.current=!0},[x]);de(()=>{const e=x?k.current:w.current;if(!e)return;const t=new ResizeObserver(()=>{S.current&&(e.scrollTop=e.scrollHeight)});return Array.from(e.children).forEach(e=>t.observe(e)),()=>t.disconnect()},[l.length,x]);const I=e=>{const t=new Date(e),n=new Date,r=new Date;r.setDate(n.getDate()-1);const o=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();return o(t,n)?"Today":o(t,r)?"Yesterday":`${t.getDate()} ${t.toLocaleString("en-US",{month:"long"})}`},L="relative flex bg-body-bg scrollbar-thin row-span-4 "+(x?"flex-row overflow-y-hidden":"flex-col overflow-y-auto p-5");if(e)return yt.createElement("div",{ref:v,className:L},yt.createElement("div",{className:"flex justify-center items-center h-full flex-col gap-4"},yt.createElement("div",{className:"w-10 h-10 border-3 border-chatbot-primary/20 border-t-chatbot-primary rounded-full animate-spin-slow"}),yt.createElement("p",{className:"m-0 text-body-fg text-sm font-medium"},"Initializing session...")));if(t)return yt.createElement("div",{ref:v,className:L},yt.createElement("div",{className:"p-5 text-center rounded-lg m-5 border border-red-200 bg-red-50"},yt.createElement("p",{className:"m-0 text-red-700 text-sm"},n||"Failed to initialize chat session. Please try again later."),r&&yt.createElement("button",{onClick:r,className:"mt-3 px-5 py-2.5 text-sm font-semibold rounded-lg cursor-pointer border-none transition-opacity hover:opacity-90 bg-send-btn-bg text-send-btn-fg"},"Try Again")));if(o&&a?.tools?.leadsGenerator?.enabled)return yt.createElement("div",{ref:v,className:L},yt.createElement("div",{className:"w-full h-full "+(x?"p-5":"p-0")},yt.createElement(Dm,{chatbotData:a,formFields:a?.tools?.leadsGenerator?.formFields,onSubmit:i})));const M=yt.createElement(yt.Fragment,null,l.map(({id:e="",text:t="",sender:n=Gt,timestamp:r=""},o)=>{const i=(e=>{const t=l[e];if(!t?.timestamp)return null;if(0===e)return I(t.timestamp);const n=l[e-1];if(!n?.timestamp)return null;const r=new Date(t.timestamp),o=new Date(n.timestamp);return r.getFullYear()!==o.getFullYear()||r.getMonth()!==o.getMonth()||r.getDate()!==o.getDate()?I(t.timestamp):null})(o),c=n===Gt&&o===l.length-1&&s&&""===t.trim(),u=!(n===Gt&&o===l.length-1&&s&&""===t.trim()),d=i?yt.createElement("div",{key:`date-${e}`,className:"flex items-center gap-3 my-4 px-2"},yt.createElement("div",{className:"flex-1 h-px bg-body-fg/15"}),yt.createElement("span",{className:"text-xs font-medium text-body-fg/40 whitespace-nowrap"},i),yt.createElement("div",{className:"flex-1 h-px bg-body-fg/15"})):null;return n===Qt?yt.createElement(yt.Fragment,{key:e},d,yt.createElement("div",{className:"text-center italic text-sm text-gray-500 my-2"},t)):"__SHOW_CAL_WIDGET__"===t?yt.createElement(yt.Fragment,{key:e},d,yt.createElement("div",null,a&&yt.createElement(Pm,{chatbotData:a,timestamp:r,onBookingSuccess:f,addSystemMessage:m||(()=>{}),userInfo:g}))):"__RAISE_TICKET__"===t?yt.createElement(yt.Fragment,{key:e},d,yt.createElement("div",null,a&&yt.createElement(Sf,{chatbotData:a,timestamp:r,onBookingSuccess:f,addSystemMessage:m||(()=>{}),userInfo:g}))):yt.createElement(yt.Fragment,{key:e},d,yt.createElement("div",{className:`flex flex-col ${n===Gt?"items-start":"items-end"} mb-3`},yt.createElement(Kt,{sender:n},n===Gt?yt.createElement(yt.Fragment,null,""!==t&&yt.createElement(hf,{text:"__SUPPORT_REQUESTED__"===t?"Thank you contacting us. Please choose from the following options to assist you further.":t,isStreaming:s&&n===Gt&&o===l.length-1}),c&&yt.createElement(gf,null)):t),n===Gt&&!c&&u&&yt.createElement("div",{className:"flex gap-2 items-center text-sm text-body-fg/60 font-normal mt-0.5 ml-1"},yt.createElement(Ht,{size:16,stroke:"var(--chatbot-primary, #2662D9)",strokeWidth:1.5}),yt.createElement("span",null,a?.agentName?a.agentName:a?.name),yt.createElement("span",{className:"w-1 h-1 rounded-full bg-current opacity-50"}),yt.createElement(mf,null,Wt(r))),n!==Gt&&n!==Qt&&r&&yt.createElement(mf,{className:"text-sm text-body-fg/60 font-normal mt-0.5 mr-1"},Wt(r))))}),c&&u?.message&&!s&&yt.createElement("div",{className:"mx-1 my-2 p-3 rounded-lg bg-red-50 border border-red-200 text-red-700 text-sm text-center"},u.message),d?.length>0&&yt.createElement(ff,{questions:d,onSelect:p}),l.length===a?.settings?.initialMessage.length&&!s&&!c&&yt.createElement(Xt,{questions:a?.settings?.suggestedQuestions,onQuestionClick:p})),P=yt.createElement("button",{onClick:T,className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-10 w-8 h-8 rounded-full bg-body-bg shadow-md flex items-center justify-center border border-body-fg/10 text-body-fg/60 hover:text-body-fg cursor-pointer transition-opacity duration-200 "+(_?"opacity-100":"opacity-0 pointer-events-none"),"aria-label":"Scroll to bottom"},yt.createElement(At,{size:18}));return yt.createElement("div",{className:"relative flex bg-body-bg row-span-4 overflow-hidden "+(x?"flex-row":"flex-col")},x?yt.createElement(yt.Fragment,null,yt.createElement(Am,{onQuestionClick:p,faqData:b,faqLoading:y}),yt.createElement("div",{className:"relative flex-1 flex flex-col min-h-0"},yt.createElement("div",{ref:C,className:"flex-1 flex flex-col overflow-y-auto p-5 scroll-smooth scrollbar-thin",onScroll:N},M),P)):yt.createElement(yt.Fragment,null,yt.createElement("div",{ref:C,className:"flex-1 overflow-y-auto p-5 scrollbar-thin scroll-smooth flex flex-col min-h-0",onScroll:N},M),P))}),zm=({sourcesData:e,sourcesLoading:t,onClose:n})=>yt.createElement("div",{className:"absolute inset-0 bg-black/50 z-9999 flex items-center justify-center"},yt.createElement("div",{className:"bg-white rounded-lg p-0 min-w-[340px] min-h-[220px] relative shadow-[0_2px_16px_rgba(0,0,0,0.15)] max-w-[90vw] w-full flex flex-col overflow-hidden h-full"},yt.createElement("div",{className:"sticky top-0 bg-gray-100 py-5 px-6 pb-4 border-b border-gray-200 z-2 flex items-center justify-between"},yt.createElement("span",{className:"font-bold text-lg tracking-tight"},"Sources"),yt.createElement("button",{className:"bg-transparent border-none text-[22px] cursor-pointer text-gray-700 ml-4 leading-none hover:text-gray-900","aria-label":"Close",onClick:n},"×")),t?yt.createElement("div",{className:"text-center p-5"},"Fetching Sources..."):yt.createElement(yt.Fragment,null,e&&e.length>0?yt.createElement("div",{className:"overflow-y-auto p-5 px-6 bg-gray-50"},e.map((t,n)=>yt.createElement(yt.Fragment,{key:n},yt.createElement("div",{className:"bg-white rounded-lg shadow-[0_1px_4px_rgba(0,0,0,0.04)] p-4 mb-4 border border-gray-100 relative text-xs wrap-break-word"},t.content||""),n!==e.length-1&&yt.createElement("hr",{className:"h-px bg-gray-200 mb-4 border-none"})))):yt.createElement("div",{className:"text-center p-5"},"No sources found.")))),Rm=({faqData:e,faqLoading:t,chatbotData:n})=>{const[r,o]=ce();return t?yt.createElement("div",{className:"flex-1 overflow-y-auto p-5 bg-body-bg"},yt.createElement("div",{className:"flex justify-center items-center h-full flex-col gap-4"},yt.createElement("div",{className:"w-10 h-10 border-3 border-chatbot-primary/20 border-t-chatbot-primary rounded-full animate-spin"}),yt.createElement("p",{className:"m-0 text-body-fg text-sm font-medium"},"Loading FAQs..."))):yt.createElement("div",{className:"flex-1 overflow-y-auto p-5 bg-body-bg"},yt.createElement("div",{className:"mb-6"},yt.createElement("h1",{className:"text-xl font-bold text-body-fg mb-2"},"Frequently Asked questions"),yt.createElement("p",{className:"text-body-fg/60 text-base"},"Find answers to common questions about ",n?.name||"us")),yt.createElement("div",{className:"flex flex-col gap-3"},e&&0!==e.length?e.map((e,t)=>yt.createElement("div",{key:e._id||t,className:"border border-body-fg/10 rounded-xl overflow-hidden bg-body-fg/5 shadow-sm"},yt.createElement("button",{onClick:()=>(e=>{o(r===e?null:e)})(t),className:"w-full flex items-center justify-between p-4 text-left bg-transparent border-none cursor-pointer"},yt.createElement("span",{className:"text-base font-semibold text-body-fg pr-4"},e.question),r===t?yt.createElement(Rt,{size:20,stroke:"var(--body-fg, #374151)",strokeWidth:2,className:"shrink-0"}):yt.createElement(At,{size:20,stroke:"var(--body-fg, #374151)",strokeWidth:2,className:"shrink-0"})),r===t&&e.answer&&yt.createElement("div",{className:"px-4 pb-4"},yt.createElement("p",{className:"text-body-fg/70 text-base leading-snug m-0"},e.answer)))):yt.createElement("div",{className:"text-center py-8 text-body-fg/60"},"No FAQs available at the moment.")))},Fm=({chatbotData:e})=>{const[t,n]=ce({name:"",email:"",message:""}),[r,o]=ce(!1),[a,i]=ce(!1),[l,s]=ce(""),c=e=>{const{name:t,value:r}=e.target;n(e=>({...e,[t]:r})),s("")};return a?yt.createElement("div",{className:"flex-1 overflow-y-auto p-5 bg-body-bg flex flex-col items-center justify-center"},yt.createElement("div",{className:"text-center"},yt.createElement("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4"},yt.createElement("svg",{className:"w-8 h-8 text-green-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},yt.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))),yt.createElement("h2",{className:"text-xl font-bold text-body-fg mb-2"},"Message Sent!"),yt.createElement("p",{className:"text-body-fg/60"},"We'll get back to you as soon as possible."),yt.createElement("button",{onClick:()=>i(!1),className:"mt-4 text-chatbot-primary hover:underline"},"Send another message"))):yt.createElement("div",{className:"flex-1 overflow-y-auto px-5 py-3 bg-body-bg"},yt.createElement("div",{className:"mb-2"},yt.createElement("h1",{className:"text-[22px] font-bold text-body-fg"},"Contact Support"),yt.createElement("p",{className:"text-body-fg/50 text-[15px] leading-relaxed"},"Fill out the form below and we'll get back to you soon.")),yt.createElement("form",{onSubmit:async r=>{if(r.preventDefault(),t.name&&t.email&&t.message&&e){o(!0),s("");try{const r=localStorage.getItem(`chat_session_${e.id}`)||"";await vf({agentId:e._id,orgId:e.organizationId,sessionId:r,name:t.name,email:t.email,message:t.message,type:"support"}),i(!0),n({name:"",email:"",message:""})}catch(e){console.error("Failed to submit support form:",e),s(Ef(e,"ticket"))}finally{o(!1)}}},className:"flex flex-col gap-2"},yt.createElement("div",{className:"flex flex-col gap-2"},yt.createElement("label",{htmlFor:"name",className:"text-[15px] font-bold text-body-fg"},"Name"),yt.createElement("input",{type:"text",id:"name",name:"name",value:t.name,onChange:c,placeholder:"Your name",required:!0,className:"w-full px-4 py-3.5 border-2 border-body-fg/20 rounded-sm bg-body-bg text-body-fg text-[15px] outline-none focus:border-chatbot-primary transition-colors placeholder:text-body-fg/40"})),yt.createElement("div",{className:"flex flex-col gap-2"},yt.createElement("label",{htmlFor:"email",className:"text-[15px] font-bold text-body-fg"},"Email"),yt.createElement("input",{type:"email",id:"email",name:"email",value:t.email,onChange:c,placeholder:"your@email.com",required:!0,className:"w-full px-4 py-3.5 border-2 border-body-fg/20 rounded-sm bg-body-bg text-body-fg text-[15px] outline-none focus:border-chatbot-primary transition-colors placeholder:text-body-fg/40"})),yt.createElement("div",{className:"flex flex-col gap-2"},yt.createElement("label",{htmlFor:"message",className:"text-[15px] font-bold text-body-fg"},"Message"),yt.createElement("textarea",{id:"message",name:"message",value:t.message,onChange:c,placeholder:"How can we help?",required:!0,rows:6,className:"w-full px-4 py-2 border-2 border-body-fg/20 rounded-sm bg-body-bg text-body-fg text-[15px] outline-none focus:border-chatbot-primary transition-colors resize-none placeholder:text-body-fg/40"})),l&&yt.createElement("p",{className:"text-red-500 text-sm"},l),yt.createElement("button",{type:"submit",disabled:r||!t.name||!t.email||!t.message,className:"w-full py-3.5 px-4 bg-(--chatbot-primary) text-white font-semibold text-[16px] rounded-md hover:brightness-95 transition-all disabled:opacity-50 disabled:cursor-not-allowed"},r?"Sending...":"Send Message")))},$m={isOpen:!1,showPopup:!1,isPopupVisible:!1,input:"",disableInput:!1,showSourcesOverlay:!1,chatbotDataFetchIndex:0,sessionId:null,sessionLoading:!0,sessionError:null,showLeadsForm:!1,messages:[],followUpQuestions:[],isLoading:!1,error:null,hasLoadedSessionMessages:!1,userInfo:null},jm=(e,t)=>{switch(t.type){case"SET_IS_OPEN":return{...e,isOpen:t.payload};case"SET_SHOW_POPUP":return{...e,showPopup:t.payload};case"SET_IS_POPUP_VISIBLE":return{...e,isPopupVisible:t.payload};case"SET_INPUT":return{...e,input:t.payload};case"SET_DISABLE_INPUT":return{...e,disableInput:t.payload};case"SET_SHOW_SOURCES_OVERLAY":return{...e,showSourcesOverlay:t.payload};case"SET_CHATBOT_DATA_FETCH_INDEX":return{...e,chatbotDataFetchIndex:t.payload};case"INCREMENT_CHATBOT_DATA_FETCH_INDEX":return{...e,chatbotDataFetchIndex:e.chatbotDataFetchIndex+1};case"SET_SESSION_ID":return{...e,sessionId:t.payload};case"SET_SESSION_LOADING":return{...e,sessionLoading:t.payload};case"SET_SESSION_ERROR":return{...e,sessionError:t.payload};case"SET_SHOW_LEADS_FORM":return{...e,showLeadsForm:t.payload};case"CREATE_SESSION_SUCCESS":return{...e,sessionId:t.payload.sessionId,showLeadsForm:t.payload.showLeadsForm,sessionLoading:!1,sessionError:null};case"SET_MESSAGES":return{...e,messages:t.payload};case"ADD_MESSAGE":return{...e,messages:[...e.messages,t.payload]};case"ADD_MESSAGES":return{...e,messages:[...e.messages,...t.payload]};case"UPDATE_MESSAGE":return{...e,messages:e.messages.map(e=>e.id===t.payload.id?{...e,text:t.payload.text}:e)};case"REMOVE_MESSAGE":return{...e,messages:e.messages.filter(e=>e.id!==t.payload)};case"SET_FOLLOW_UP_QUESTIONS":return{...e,followUpQuestions:t.payload};case"SET_IS_LOADING":return{...e,isLoading:t.payload};case"SET_ERROR":return{...e,error:t.payload};case"SET_HAS_LOADED_SESSION_MESSAGES":return{...e,hasLoadedSessionMessages:t.payload};case"SET_USER_INFO":return{...e,userInfo:t.payload};case"RESET_MESSAGES":return{...e,messages:[],followUpQuestions:[],isLoading:!1,error:null,hasLoadedSessionMessages:!0};case"ADD_SYSTEM_MESSAGE":const n=e.messages.slice(0,-2);return{...e,messages:[...n,{id:`system-${Date.now()}`,text:t.payload,sender:Qt,timestamp:Date.now()}]};case"LOAD_SESSION_MESSAGES_SUCCESS":return{...e,messages:t.payload.messages,userInfo:t.payload.userInfo,showLeadsForm:t.payload.showLeadsForm,isLoading:!1,hasLoadedSessionMessages:!0};case"SEND_MESSAGE_START":return{...e,messages:[...e.messages,t.payload.userMessage,t.payload.botMessage],followUpQuestions:[],isLoading:!0,error:null};default:return e}},Hm=(e,t,n,r)=>{const{messages:o=[]}=r??{},a=ge(()=>{n({type:"RESET_MESSAGES"})},[n]),i=ge(async(t,r)=>{const o=Date.now(),a=`initial-${o}`;n({type:"ADD_MESSAGE",payload:{id:a,text:"",sender:Gt,timestamp:o}}),n({type:"SET_IS_LOADING",payload:!0}),n({type:"SET_ERROR",payload:null}),await new Promise(e=>setTimeout(e,1200));try{const o=await(async(e,t,n)=>{const r=n?`?sessionId=${n}`:"",o=yf({baseUrl:`${e}/chatbot/initial-agent-message/${t}`});try{return await o.get(r,{isSSE:!0})}catch(e){throw console.error("Error in getInitialChat function:",e),e}})(e,t,r),i=o.body?.getReader();if(!i)throw new Error("ReadableStream not supported");const l=new TextDecoder;let s=0;for(;;){const{done:e,value:t}=await i.read();if(e)break;const r=l.decode(t,{stream:!0}).split("\n");for(const e of r)if(e.startsWith("data: ")){const t=e.slice(6);try{const e=JSON.parse(t),{text:r="",error:o=""}=e??{};if(o)throw new Error(o);if("[DONE]"===r)return void n({type:"SET_IS_LOADING",payload:!1});if(0===s)n({type:"UPDATE_MESSAGE",payload:{id:a,text:r}});else{const e={id:`${Date.now()}-${s}`,text:r,sender:Gt,timestamp:Date.now()};n({type:"ADD_MESSAGE",payload:e})}s++}catch(e){throw console.error("Error parsing SSE data:",e),e}}}}catch(e){console.error("Error getting initial chat message:",e);const t=Ef(e,"chat");n({type:"REMOVE_MESSAGE",payload:a}),n({type:"SET_IS_LOADING",payload:!1}),n({type:"SET_ERROR",payload:new Error(t)})}},[e,t,n]),l=async t=>{if(t){n({type:"SET_IS_LOADING",payload:!0});try{const r=await(async(e,t)=>{const n=yf({baseUrl:`${e}/chatbot/session`});try{return await n.get(`/${t}/messages`)}catch(e){throw console.error("Error fetching session messages:",e),e}})(e,t);if(r&&r.success){const e=[];r.messages.forEach(t=>{const n=t.content||t.text||"";let r=Gt;"user"===t.role?r=Zt:"system"===t.role&&(r=Qt);const o=t.timestamp||Date.now(),a=((e,t,n,r)=>{const o=[];if(n===Gt&&(e.includes("__SHOW_CAL_WIDGET__")||e.includes("__RAISE_TICKET__"))){const n=e.split(/(__SHOW_CAL_WIDGET__|__RAISE_TICKET__)/);let a=0;n.forEach(e=>{const n=e.trim();""!==n&&o.push({id:`${t}-part-${a++}`,text:n,sender:Gt,timestamp:r})})}else o.push({id:t,text:e,sender:n,timestamp:r});return o})(n,t.id||Date.now().toString()+Math.random().toString(),r,o);e.push(...a)}),n({type:"LOAD_SESSION_MESSAGES_SUCCESS",payload:{messages:e,userInfo:r.userInfo||{},showLeadsForm:r.showLeadsForm||!1}})}}catch(e){console.error("Failed to load session messages:",e);const t=Ef(e,"session");n({type:"SET_IS_LOADING",payload:!1}),n({type:"SET_ERROR",payload:new Error(t)}),n({type:"SET_HAS_LOADED_SESSION_MESSAGES",payload:!0})}}};de(()=>{const e=localStorage.getItem(`chat_session_${t}`);e&&!r.hasLoadedSessionMessages&&l(e)},[e,t,r.hasLoadedSessionMessages]);const s=ge(e=>{e&&!r.hasLoadedSessionMessages&&l(e)},[r.hasLoadedSessionMessages]),c=ge(async(r,o)=>{if(r.trim()){const a=Date.now().toString(),i=(Date.now()+1).toString(),l=Date.now();n({type:"SEND_MESSAGE_START",payload:{userMessage:{id:a,text:r,sender:Zt,timestamp:l},botMessage:{id:i,text:"",sender:Gt,timestamp:l}}});try{const a=await(async(e,t,n,r)=>{const o=r?`?sessionId=${r}`:"",a=yf({baseUrl:`${e}/chatbot/chat/${n}`}),i=Intl.DateTimeFormat().resolvedOptions().timeZone;try{return await a.post(o,{query:t},{isSSE:!0,headers:{"x-timezone":i}})}catch(e){throw console.error("Error in chat function:",e),e}})(e,r,t,o),l=a.body?.getReader();if(!l)throw new Error("ReadableStream not supported");const s=new TextDecoder;let c="",u=[],d=2;for(;;){const{done:e,value:t}=await l.read();if(e)break;const r=s.decode(t,{stream:!0}).split("\n");for(const e of r)if(e.startsWith("data: ")){const t=e.slice(6);try{const{text:e="",error:r="",followUpQuestions:o=[]}=JSON.parse(t)??{};if(o.length>0){const e=o.map(e=>e.replace(/^\d+\.\s*/,"").trim());n({type:"SET_FOLLOW_UP_QUESTIONS",payload:e}),n({type:"INCREMENT_CHATBOT_DATA_FETCH_INDEX"})}if("[DONE]"===e)return n({type:"UPDATE_MESSAGE",payload:{id:i,text:c}}),n({type:"ADD_MESSAGES",payload:u}),void n({type:"SET_IS_LOADING",payload:!1});if(r)throw new Error(r);"__SHOW_CAL_WIDGET__"===e||"__RAISE_TICKET__"===e?(u.push({id:(Date.now()+d).toString(),text:e,sender:Gt,timestamp:Date.now()}),d++):""!==e&&(c+=e,n({type:"UPDATE_MESSAGE",payload:{id:i,text:c}}))}catch(e){throw console.error("Error parsing SSE data:",e),e}}}n({type:"UPDATE_MESSAGE",payload:{id:i,text:c}}),n({type:"ADD_MESSAGES",payload:u}),n({type:"SET_IS_LOADING",payload:!1})}catch(e){console.error("Error sending message:",e);const t=Ef(e,"chat");n({type:"REMOVE_MESSAGE",payload:i}),n({type:"SET_IS_LOADING",payload:!1}),n({type:"SET_ERROR",payload:new Error(t)})}}},[o,t,n]);return{sendMessage:c,resetMessages:a,addSystemMessage:e=>{n({type:"ADD_SYSTEM_MESSAGE",payload:e})},initialChatMessage:i,loadSessionMessages:s}},Bm=(e,t,n=0)=>{const[r,o]=ce(null),[a,i]=ce(!1),[l,s]=ce(!1),[c,u]=ce(null);return de(()=>{(async()=>{i(!0),s(!1),u(null);try{const n=await(async(e,t)=>{const n=yf({baseUrl:`${e}/chatbot/${t}`});try{return await n.get("")}catch(e){throw console.error("Error in fetching bot details:",e),e}})(e,t);n.success?o(n.chatbot):(s(!0),u("Failed to fetch chatbot data."))}catch(e){s(!0),u(e.message||"Unknown error occurred.")}finally{i(!1)}})().then()},[t,n]),{chatbotData:r,isLoading:a,isError:l,error:c}},qm=(e,t,n)=>{const[r,o]=ce([]),[a,i]=ce(!1),[l,s]=ce(!1),[c,u]=ce(null);return de(()=>{if(!n)return;(async()=>{i(!0),s(!1),u(null);try{const n=await(async(e,t)=>{const n=`/chatbot/sources/${t}`,r=yf({baseUrl:`${e}`});try{return await r.get(n)}catch(e){throw console.error("Error in chat source function:",e),e}})(e,t);n.success?o(n.result):(s(!0),u("Failed to fetch chatbot data."))}catch(e){s(!0),u(e.message||"Unknown error occurred.")}finally{i(!1)}})().then()},[t,n]),{sourcesData:r,isLoading:a,isError:l,error:c}},Um=(e,t,n,r,o,a)=>{const{isOpen:i,messagesLength:l,onInitialMessage:s,hasLoadedSessionMessages:c,loadSessionMessages:u}=o||{},{sessionId:d,sessionLoading:p,sessionError:h,showLeadsForm:f}=r;de(()=>{(async()=>{const e=localStorage.getItem(`chat_session_${t}`);if(e)return n({type:"SET_SESSION_ID",payload:e}),n({type:"SET_SESSION_LOADING",payload:!1}),n({type:"SET_SESSION_ERROR",payload:null}),void(u&&u(e));n({type:"SET_SESSION_ID",payload:null}),n({type:"SET_SESSION_LOADING",payload:!1}),n({type:"SET_SESSION_ERROR",payload:null})})()},[e,t,n,u]),de(()=>{i&&d&&!p&&!h&&0===l&&!f&&s&&c&&s(t,d)},[i,d,p,h,l,f,t,s,c]);return{sessionId:d,sessionLoading:p,sessionError:h,createNewSession:async()=>{n({type:"SET_SESSION_LOADING",payload:!0}),n({type:"SET_SESSION_ERROR",payload:null});try{const r=await(async(e,t,n)=>{const r=yf({baseUrl:`${e}/chatbot/session`});try{return await r.post(`/${t}`,{preview:n})}catch(e){throw console.error("Error in creating session:",e),e}})(e,t,a),{success:o,session:i}=r;if(!o||!i?.sessionId)throw new Error("Failed to create session");localStorage.setItem(`chat_session_${t}`,i.sessionId),n({type:"CREATE_SESSION_SUCCESS",payload:{sessionId:i.sessionId,showLeadsForm:i.showLeadsForm}}),n({type:"SET_HAS_LOADED_SESSION_MESSAGES",payload:!0})}catch(e){console.error("Session creation error:",e),function(e,t){return xf(e)&&wf(e)===t}(e,404)&&(localStorage.removeItem(`chat_session_${t}`),n({type:"SET_SESSION_ID",payload:null}));const r=Ef(e,"session");n({type:"SET_SESSION_LOADING",payload:!1}),n({type:"SET_SESSION_ERROR",payload:new Error(r)})}},showLeadsForm:f,setShowLeadsForm:e=>{n({type:"SET_SHOW_LEADS_FORM",payload:e})}}},Vm=(e,t)=>{const[n,r]=ce(null),[o,a]=ce(!1),[i,l]=ce(!1),[s,c]=ce(null);return de(()=>{(async()=>{if(e&&t){a(!0),l(!1),c(null);try{const n=await(async(e,t)=>{const n=yf({baseUrl:`${e}`});try{return await n.get(`/faqs/${t}`)}catch(e){throw console.error("Error in fetching FAQ data:",e),e}})(e,t);n.success&&n.data?.faqs?r(n.data.faqs):r([])}catch(e){l(!0),c(e.message||"Unknown error occurred."),r([])}finally{a(!1)}}})()},[e,t]),{faqData:n,isLoading:o,isError:i,error:s}},Wm=e=>{const[t,n]=ce(!1),[r,o]=ce(0),[a,i]=ce(!1),[l,s]=ce(!1),c=he(new Set),u=he(),d=he(0),p=(e=>e&&e.enabled?{...e,edgeThreshold:Math.max(0,Math.min(e.edgeThreshold??12,100)),maxTriggers:Math.max(1,Math.min(e.maxTriggers||3,10)),timeThreshold:Math.max(1,Math.min(e.timeThreshold||10,300)),triggerDelay:Math.max(5,Math.min(e.triggerDelay||30,300))}:null)(e),h=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||"ontouchstart"in window||navigator.maxTouchPoints>0,f=p?.enabled&&!h,m=!(!(f&&r<p.maxTriggers&&l)||a||t),g=ge(e=>{c.current.add(e)},[]),b=ge(()=>{c.current.forEach(clearTimeout),c.current.clear(),u.current&&(clearTimeout(u.current),u.current=void 0)},[]);de(()=>{if(!f||!p)return;const e=setTimeout(()=>{s(!0)},1e3*p.timeThreshold);return g(e),()=>clearTimeout(e)},[f,p?.timeThreshold,g]);const y=ge(e=>{if(!m||!p)return;const s=Date.now();s-d.current<200||(u.current&&clearTimeout(u.current),e.clientY<=p.edgeThreshold&&(u.current=setTimeout(()=>{if(!t&&!a&&r<p.maxTriggers&&l){n(!0),o(e=>e+1),i(!0),d.current=s;const e=setTimeout(()=>{i(!1),c.current.delete(e)},1e3*p.triggerDelay);g(e)}},100)))},[m,p,t,a,r,l,g]);de(()=>{if(f)return document.addEventListener("mouseleave",y),()=>{document.removeEventListener("mouseleave",y)}},[f,y]),de(()=>()=>{b()},[b]);const v=ge(()=>{n(!1),o(p?.maxTriggers||10)},[p?.maxTriggers]);return{showExitIntent:t,resetExitIntent:v,canTrigger:m}};const Ym=({children:e,theme:t})=>{const n=he(null),r=he(document.createElement("div")),o=he(null),[a,i]=ce(null);return de(()=>{if(n.current&&!a&&!n.current.shadowRoot){const e="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap";if(!document.querySelector(`link[href="${e}"]`)){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e),document.head.appendChild(t)}const t=n.current.attachShadow({mode:"open"});i(t);const a=document.createElement("style"),l='/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */@layer theme, base, components, utilities;@layer theme{:host{--font-sans:"Poppins",ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(97.1% 0.013 17.38);--color-red-100:oklch(93.6% 0.032 17.717);--color-red-200:oklch(88.5% 0.062 18.334);--color-red-400:oklch(70.4% 0.191 22.216);--color-red-500:oklch(63.7% 0.237 25.331);--color-red-600:oklch(57.7% 0.245 27.325);--color-red-700:oklch(50.5% 0.213 27.518);--color-red-800:oklch(44.4% 0.177 26.899);--color-amber-500:oklch(76.9% 0.188 70.08);--color-green-100:oklch(96.2% 0.044 156.743);--color-green-500:oklch(72.3% 0.219 149.579);--color-blue-600:oklch(54.6% 0.245 262.881);--color-blue-700:oklch(48.8% 0.243 264.376);--color-gray-50:oklch(98.5% 0.002 247.839);--color-gray-100:oklch(96.7% 0.003 264.542);--color-gray-200:oklch(92.8% 0.006 264.531);--color-gray-300:oklch(87.2% 0.01 258.338);--color-gray-400:oklch(70.7% 0.022 261.325);--color-gray-500:oklch(55.1% 0.027 264.364);--color-gray-700:oklch(37.3% 0.034 259.733);--color-gray-800:oklch(27.8% 0.033 256.848);--color-gray-900:oklch(21% 0.034 264.665);--color-black:#000;--color-white:#fff;--spacing:0.25rem;--container-md:28rem;--container-2xl:42rem;--text-xs:0.75rem;--text-xs--line-height:calc(1 / 0.75);--text-sm:0.875rem;--text-sm--line-height:calc(1.25 / 0.875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-0.025em;--tracking-wide:0.025em;--leading-tight:1.25;--leading-snug:1.375;--leading-normal:1.5;--leading-relaxed:1.625;--radius-sm:0.25rem;--radius-md:0.375rem;--radius-lg:0.5rem;--radius-xl:0.75rem;--radius-2xl:1rem;--radius-4xl:2rem;--ease-out:cubic-bezier(0,0,0.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(0.4,0,0.6,1) infinite;--blur-sm:8px;--default-transition-duration:150ms;--default-transition-timing-function:cubic-bezier(0.4,0,0.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-chatbot-primary:var(--chatbot-primary,#2662d9);--color-chatbot-foreground:var(--chatbot-foreground,#fff);--color-header-bg:var(--header-bg,#2662d9);--color-header-fg:var(--header-fg,#fff);--color-body-bg:var(--body-bg,#fff);--color-body-fg:var(--body-fg,#000);--color-footer-bg:var(--footer-bg,#fff);--color-bubble-user-bg:var(--bubble-user-bg,#2662d9);--color-bubble-user-fg:var(--bubble-user-fg,#fff);--color-bubble-bot-bg:var(--bubble-bot-bg,#f0f0f0);--color-bubble-bot-fg:var(--bubble-bot-fg,#000);--color-input-bg:var(--input-bg,#fff);--color-input-fg:var(--input-fg,#000);--color-send-btn-bg:var(--send-btn-bg,#2662d9);--color-send-btn-fg:var(--send-btn-fg,#fff);--color-modal-btn-bg:var(--modal-btn-bg,#2662d9);--color-modal-btn-fg:var(--modal-btn-fg,#fff)}}@layer base{:host *,:host ::backdrop,:host ::file-selector-button,:host :after,:host :before{border:0 solid;box-sizing:border-box;margin:0;padding:0}:host{-webkit-text-size-adjust:100%;font-feature-settings:var(--default-font-feature-settings,normal);-webkit-tap-highlight-color:transparent;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:var(--default-mono-font-feature-settings,normal);font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}:host ::file-selector-button,button,input,optgroup,select,textarea{font-feature-settings:inherit;background-color:transparent;border-radius:0;color:inherit;font:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}:host ::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not (-webkit-appearance:-apple-pay-button)) or (contain-intrinsic-size:1px){::placeholder{color:currentcolor;@supports (color:color-mix(in lab,red,red)){color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}:host ::file-selector-button,button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.-top-1{top:calc(var(--spacing) * -1)}.top-0{top:calc(var(--spacing) * 0)}.top-1\\/2{top:calc(1 / 2 * 100%)}.top-2{top:calc(var(--spacing) * 2)}.top-3{top:calc(var(--spacing) * 3)}.top-4{top:calc(var(--spacing) * 4)}.top-full{top:100%}.-right-1{right:calc(var(--spacing) * -1)}.right-0{right:calc(var(--spacing) * 0)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.right-4{right:calc(var(--spacing) * 4)}.right-6{right:calc(var(--spacing) * 6)}.right-8{right:calc(var(--spacing) * 8)}.-bottom-1{bottom:calc(var(--spacing) * -1)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-2{bottom:calc(var(--spacing) * 2)}.bottom-3{bottom:calc(var(--spacing) * 3)}.bottom-4{bottom:calc(var(--spacing) * 4)}.bottom-6{bottom:calc(var(--spacing) * 6)}.bottom-8{bottom:calc(var(--spacing) * 8)}.bottom-20{bottom:calc(var(--spacing) * 20)}.-left-1{left:calc(var(--spacing) * -1)}.left-0{left:calc(var(--spacing) * 0)}.left-1\\/2{left:calc(1 / 2 * 100%)}.left-2{left:calc(var(--spacing) * 2)}.left-4{left:calc(var(--spacing) * 4)}.-z-10{z-index:calc(10 * -1)}.z-2{z-index:2}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-9999{z-index:9999}.z-2147483645{z-index:2147483645}.z-2147483646{z-index:2147483646}.z-2147483647{z-index:2147483647}.z-\\[2147483646\\]{z-index:2147483646}.row-span-4{grid-row:span 4/span 4}.row-start-1{grid-row-start:1}.row-end-1{grid-row-end:1}.container{width:100%;@media (width >= 40rem){max-width:40rem}@media (width >= 48rem){max-width:48rem}@media (width >= 64rem){max-width:64rem}@media (width >= 80rem){max-width:80rem}@media (width >= 96rem){max-width:96rem}}.m-0{margin:calc(var(--spacing) * 0)}.m-5{margin:calc(var(--spacing) * 5)}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mx-4{margin-inline:calc(var(--spacing) * 4)}.mx-\\[3px\\]{margin-inline:3px}.mx-auto{margin-inline:auto}.my-2{margin-block:calc(var(--spacing) * 2)}.my-4{margin-block:calc(var(--spacing) * 4)}.my-6{margin-block:calc(var(--spacing) * 6)}.-mt-2{margin-top:calc(var(--spacing) * -2)}.-mt-10{margin-top:calc(var(--spacing) * -10)}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\\.5{margin-bottom:calc(var(--spacing) * 2.5)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.ml-0\\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-4{margin-left:calc(var(--spacing) * 4)}.box-border{box-sizing:border-box}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.list-item{display:list-item}.table{display:table}.table-cell{display:table-cell}.table-row{display:table-row}.aspect-square{aspect-ratio:1/1}.size-4{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.size-full{height:100%;width:100%}.h-1{height:calc(var(--spacing) * 1)}.h-2{height:calc(var(--spacing) * 2)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-\\[46px\\]{height:46px}.h-\\[80vh\\]{height:80vh}.h-\\[min\\(704px\\,calc\\(100\\%-104px\\)\\)\\]{height:min(704px,calc(100% - 104px))}.h-fit{height:fit-content}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-15{max-height:calc(var(--spacing) * 15)}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-52{max-height:calc(var(--spacing) * 52)}.max-h-\\[120px\\]{max-height:120px}.max-h-\\[280px\\]{max-height:280px}.max-h-\\[800px\\]{max-height:800px}.max-h-fit{max-height:fit-content}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-5{min-height:calc(var(--spacing) * 5)}.min-h-20{min-height:calc(var(--spacing) * 20)}.min-h-28{min-height:calc(var(--spacing) * 28)}.min-h-\\[200px\\]{min-height:200px}.min-h-\\[220px\\]{min-height:220px}.min-h-full{min-height:100%}.w-1{width:calc(var(--spacing) * 1)}.w-2{width:calc(var(--spacing) * 2)}.w-4{width:calc(var(--spacing) * 4)}.w-4\\/5{width:calc(4 / 5 * 100%)}.w-5{width:calc(var(--spacing) * 5)}.w-8{width:calc(var(--spacing) * 8)}.w-10{width:calc(var(--spacing) * 10)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-40{width:calc(var(--spacing) * 40)}.w-\\[60\\%\\]{width:60%}.w-\\[80vw\\]{width:80vw}.w-\\[90vw\\]{width:90vw}.w-\\[250px\\]{width:250px}.w-\\[300px\\]{width:300px}.w-\\[400px\\]{width:400px}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\\[85\\%\\]{max-width:85%}.max-w-\\[90vw\\]{max-width:90vw}.max-w-\\[300px\\]{max-width:300px}.max-w-\\[320px\\]{max-width:320px}.max-w-\\[340px\\]{max-width:340px}.max-w-\\[350px\\]{max-width:350px}.max-w-\\[440px\\]{max-width:440px}.max-w-\\[520px\\]{max-width:520px}.max-w-\\[1100px\\]{max-width:1100px}.max-w-\\[1200px\\]{max-width:1200px}.max-w-full{max-width:100%}.max-w-md{max-width:var(--container-md)}.min-w-\\[120px\\]{min-width:120px}.min-w-\\[340px\\]{min-width:340px}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.border-collapse{border-collapse:collapse}.origin-bottom-right{transform-origin:100% 100%}.origin-center{transform-origin:center}.-translate-x-1\\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1)}.-translate-x-1\\/2,.-translate-y-1\\/2{translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1)}.rotate-45{rotate:45deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.appearance-none{appearance:none}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.grid-rows-\\[auto_1fr_auto\\]{grid-template-rows:auto 1fr auto}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-around{justify-content:space-around}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing) * 0)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.space-y-4{:where(&>:not(:last-child)){--tw-space-y-reverse:0;margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)));margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse))}}.space-x-2{:where(&>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)));margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse))}}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.divide-y{:where(&>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse))}}.justify-self-center{justify-self:center}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-y-hidden{overflow-y:hidden}.scroll-smooth{scroll-behavior:smooth}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-4xl{border-radius:var(--radius-4xl)}.rounded-\\[10px\\]{border-radius:10px}.rounded-\\[12px\\]{border-radius:12px}.rounded-\\[14px\\]{border-radius:14px}.rounded-\\[inherit\\]{border-radius:inherit}.rounded-full{border-radius:calc(infinity * 1px)}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-3{border-style:var(--tw-border-style);border-width:3px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-none{--tw-border-style:none;border-style:none}.border-black\\/10{border-color:color-mix(in srgb,#000 10%,transparent);@supports (color:color-mix(in lab,red,red)){border-color:color-mix(in oklab,var(--color-black) 10%,transparent)}}.border-black\\/20{border-color:color-mix(in srgb,#000 20%,transparent);@supports (color:color-mix(in lab,red,red)){border-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.border-body-fg\\/10,.border-body-fg\\/15,.border-body-fg\\/20{border-color:var(--color-body-fg);@supports (color:color-mix(in lab,red,red)){border-color:color-mix(in oklab,var(--color-body-fg) 20%,transparent)}}.border-bubble-bot-bg\\/30{border-color:var(--color-bubble-bot-bg);@supports (color:color-mix(in lab,red,red)){border-color:color-mix(in oklab,var(--color-bubble-bot-bg) 30%,transparent)}}.border-chatbot-primary,.border-chatbot-primary\\/20,.border-chatbot-primary\\/30{border-color:var(--color-chatbot-primary);@supports (color:color-mix(in lab,red,red)){border-color:color-mix(in oklab,var(--color-chatbot-primary) 30%,transparent)}}.border-current{border-color:currentcolor}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-input-fg\\/40{border-color:var(--color-input-fg);@supports (color:color-mix(in lab,red,red)){border-color:color-mix(in oklab,var(--color-input-fg) 40%,transparent)}}.border-red-200{border-color:var(--color-red-200)}.border-red-500{border-color:var(--color-red-500)}.border-send-btn-bg\\/40{border-color:var(--color-send-btn-bg);@supports (color:color-mix(in lab,red,red)){border-color:color-mix(in oklab,var(--color-send-btn-bg) 40%,transparent)}}.border-transparent{border-color:transparent}.border-t-chatbot-primary{border-top-color:var(--color-chatbot-primary)}.border-t-current{border-top-color:currentcolor}.bg-\\(--chatbot-primary\\){background-color:var(--chatbot-primary)}.bg-\\[var\\(--sdm-tbg\\)\\]{background-color:var(--sdm-tbg)}.bg-black\\/10{background-color:color-mix(in srgb,#000 10%,transparent);@supports (color:color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-black) 10%,transparent)}}.bg-black\\/50{background-color:color-mix(in srgb,#000 50%,transparent);@supports (color:color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-blue-600{background-color:var(--color-blue-600)}.bg-body-bg{background-color:var(--color-body-bg)}.bg-body-fg\\/10,.bg-body-fg\\/15,.bg-body-fg\\/5{background-color:var(--color-body-fg);@supports (color:color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-body-fg) 15%,transparent)}}.bg-bubble-bot-bg{background-color:var(--color-bubble-bot-bg)}.bg-bubble-user-bg{background-color:var(--color-bubble-user-bg)}.bg-chatbot-primary,.bg-chatbot-primary\\/20,.bg-chatbot-primary\\/5{background-color:var(--color-chatbot-primary);@supports (color:color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-chatbot-primary) 20%,transparent)}}.bg-current{background-color:currentcolor}.bg-footer-bg{background-color:var(--color-footer-bg)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-300{background-color:var(--color-gray-300)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-500{background-color:var(--color-green-500)}.bg-header-bg{background-color:var(--color-header-bg)}.bg-input-bg,.bg-input-bg\\/95{background-color:var(--color-input-bg);@supports (color:color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-input-bg) 95%,transparent)}}.bg-modal-btn-bg{background-color:var(--color-modal-btn-bg)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-500{background-color:var(--color-red-500)}.bg-red-600{background-color:var(--color-red-600)}.bg-send-btn-bg{background-color:var(--color-send-btn-bg)}.bg-transparent{background-color:transparent}.bg-white{background-color:var(--color-white)}.bg-linear-to-br{--tw-gradient-position:to bottom right;@supports (background-image:linear-gradient(in lab,red,red)){--tw-gradient-position:to bottom right in oklab}background-image:linear-gradient(var(--tw-gradient-stops))}.from-body-bg{--tw-gradient-from:var(--color-body-bg);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-send-btn-bg{--tw-gradient-from:var(--color-send-btn-bg);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-body-bg\\/95{--tw-gradient-to:var(--color-body-bg);@supports (color:color-mix(in lab,red,red)){--tw-gradient-to:color-mix(in oklab,var(--color-body-bg) 95%,transparent)}--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-send-btn-bg\\/85{--tw-gradient-to:var(--color-send-btn-bg);@supports (color:color-mix(in lab,red,red)){--tw-gradient-to:color-mix(in oklab,var(--color-send-btn-bg) 85%,transparent)}--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from) var(--tw-gradient-from-position),var(--tw-gradient-to) var(--tw-gradient-to-position))}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\!{padding-inline:calc(var(--spacing) * 2)!important}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-4\\!{padding-inline:calc(var(--spacing) * 4)!important}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-0\\.5\\!{padding-block:calc(var(--spacing) * .5)!important}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-3\\!{padding-block:calc(var(--spacing) * 3)!important}.py-3\\.5{padding-block:calc(var(--spacing) * 3.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.pt-0{padding-top:calc(var(--spacing) * 0)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pr-5{padding-right:calc(var(--spacing) * 5)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pl-4{padding-left:calc(var(--spacing) * 4)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[0\\.9rem\\]{font-size:.9rem}.text-\\[0\\.85rem\\]{font-size:.85rem}.text-\\[1\\.1rem\\]{font-size:1.1rem}.text-\\[1\\.2rem\\]{font-size:1.2rem}.text-\\[11px\\]{font-size:11px}.text-\\[13px\\]{font-size:13px}.text-\\[15px\\]{font-size:15px}.text-\\[16px\\]{font-size:16px}.text-\\[22px\\]{font-size:22px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.wrap-anywhere{overflow-wrap:anywhere}.wrap-break-word{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\\[\\#196b8c\\]{color:#196b8c}.text-\\[var\\(--sdm-c\\,inherit\\)\\]{color:var(--sdm-c,inherit)}.text-amber-500{color:var(--color-amber-500)}.text-black{color:var(--color-black)}.text-body-bg{color:var(--color-body-bg)}.text-body-fg,.text-body-fg\\/40,.text-body-fg\\/50,.text-body-fg\\/60,.text-body-fg\\/70,.text-body-fg\\/80{color:var(--color-body-fg);@supports (color:color-mix(in lab,red,red)){color:color-mix(in oklab,var(--color-body-fg) 80%,transparent)}}.text-bubble-bot-fg{color:var(--color-bubble-bot-fg)}.text-bubble-user-fg{color:var(--color-bubble-user-fg)}.text-chatbot-foreground{color:var(--color-chatbot-foreground)}.text-chatbot-primary{color:var(--color-chatbot-primary)}.text-gray-500{color:var(--color-gray-500)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-green-500{color:var(--color-green-500)}.text-header-fg{color:var(--color-header-fg)}.text-input-fg{color:var(--color-input-fg)}.text-modal-btn-fg{color:var(--color-modal-btn-fg)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-send-btn-bg{color:var(--color-send-btn-bg)}.text-send-btn-fg{color:var(--color-send-btn-fg)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-50{opacity:50%}.opacity-60{opacity:60%}.opacity-100{opacity:100%}.shadow-\\[0_0_0_4px_rgba\\(239\\,68\\,68\\,0\\.2\\)\\]{--tw-shadow:0 0 0 4px var(--tw-shadow-color,rgba(239,68,68,.2))}.shadow-\\[0_0_0_4px_rgba\\(239\\,68\\,68\\,0\\.2\\)\\],.shadow-\\[0_1px_4px_rgba\\(0\\,0\\,0\\,0\\.04\\)\\]{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_1px_4px_rgba\\(0\\,0\\,0\\,0\\.04\\)\\]{--tw-shadow:0 1px 4px var(--tw-shadow-color,rgba(0,0,0,.04))}.shadow-\\[0_2px_8px_var\\(--send-btn-bg\\,\\#2662D9\\)\\/40\\]{--tw-shadow:0 2px 8px var(--tw-shadow-color,var(--send-btn-bg,#2662d9)/40)}.shadow-\\[0_2px_12px_rgba\\(0\\,0\\,0\\,0\\.08\\)\\],.shadow-\\[0_2px_8px_var\\(--send-btn-bg\\,\\#2662D9\\)\\/40\\]{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_2px_12px_rgba\\(0\\,0\\,0\\,0\\.08\\)\\]{--tw-shadow:0 2px 12px var(--tw-shadow-color,rgba(0,0,0,.08))}.shadow-\\[0_2px_16px_rgba\\(0\\,0\\,0\\,0\\.15\\)\\]{--tw-shadow:0 2px 16px var(--tw-shadow-color,rgba(0,0,0,.15))}.shadow-\\[0_2px_16px_rgba\\(0\\,0\\,0\\,0\\.15\\)\\],.shadow-\\[0_4px_8px_rgba\\(0\\,0\\,0\\,0\\.2\\)\\]{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_4px_8px_rgba\\(0\\,0\\,0\\,0\\.2\\)\\]{--tw-shadow:0 4px 8px var(--tw-shadow-color,rgba(0,0,0,.2))}.shadow-\\[0_8px_24px_rgba\\(0\\,0\\,0\\,0\\.12\\)\\]{--tw-shadow:0 8px 24px var(--tw-shadow-color,rgba(0,0,0,.12))}.shadow-\\[0_25px_50px_-12px_rgba\\(0\\,0\\,0\\,0\\.25\\)\\],.shadow-\\[0_8px_24px_rgba\\(0\\,0\\,0\\,0\\.12\\)\\]{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_25px_50px_-12px_rgba\\(0\\,0\\,0\\,0\\.25\\)\\]{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,rgba(0,0,0,.25))}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,rgba(0,0,0,.1)),0 4px 6px -4px var(--tw-shadow-color,rgba(0,0,0,.1))}.shadow-lg,.shadow-md{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,rgba(0,0,0,.1)),0 2px 4px -2px var(--tw-shadow-color,rgba(0,0,0,.1))}.shadow-none{--tw-shadow:0 0 #0000}.shadow-none,.shadow-sm{box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,rgba(0,0,0,.1)),0 1px 2px -1px var(--tw-shadow-color,rgba(0,0,0,.1))}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[rgba\\(0\\,0\\,0\\,0\\.3\\)_0_10px_60px\\]{--tw-shadow-color:rgba(0,0,0,.3);@supports (color:color-mix(in lab,red,red)){--tw-shadow-color:color-mix(in oklab,rgba(0,0,0,.3) 0 10px 60px var(--tw-shadow-alpha),transparent)}}.shadow-\\[rgba\\(0\\,0\\,0\\,0\\.16\\)_0_5px_40px\\]{--tw-shadow-color:rgba(0,0,0,.16);@supports (color:color-mix(in lab,red,red)){--tw-shadow-color:color-mix(in oklab,rgba(0,0,0,.16) 0 5px 40px var(--tw-shadow-alpha),transparent)}}.ring-red-400{--tw-ring-color:var(--color-red-400)}.brightness-200{--tw-brightness:brightness(200%)}.brightness-200,.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-\\[height\\]{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:height;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-all{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-colors{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-opacity{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.transition-transform{transition-duration:var(--tw-duration,var(--default-transition-duration));transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))}.duration-150{--tw-duration:150ms;transition-duration:.15s}.duration-200{--tw-duration:200ms;transition-duration:.2s}.duration-300{--tw-duration:300ms;transition-duration:.3s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.\\[counter-increment\\:line_0\\]{counter-increment:line 0}.\\[counter-reset\\:line\\]{counter-reset:line}.group-hover\\:block{&:is(:where(.group):hover *){@media (hover:hover){display:block}}}.group-hover\\:opacity-100{&:is(:where(.group):hover *){@media (hover:hover){opacity:100%}}}.placeholder\\:text-body-fg\\/40{&::placeholder{color:var(--color-body-fg);@supports (color:color-mix(in lab,red,red)){color:color-mix(in oklab,var(--color-body-fg) 40%,transparent)}}}.before\\:mr-4{&:before{content:var(--tw-content);margin-right:calc(var(--spacing) * 4)}}.before\\:inline-block{&:before{content:var(--tw-content);display:inline-block}}.before\\:w-6{&:before{content:var(--tw-content);width:calc(var(--spacing) * 6)}}.before\\:text-right{&:before{content:var(--tw-content);text-align:right}}.before\\:font-mono{&:before{content:var(--tw-content);font-family:var(--font-mono)}}.before\\:text-\\[13px\\]{&:before{content:var(--tw-content);font-size:13px}}.before\\:content-\\[counter\\(line\\)\\]{&:before{--tw-content:counter(line);content:var(--tw-content)}}.before\\:select-none{&:before{content:var(--tw-content);-webkit-user-select:none;user-select:none}}.before\\:\\[counter-increment\\:line\\]{&:before{content:var(--tw-content);counter-increment:line}}.hover\\:-translate-y-px{&:hover{@media (hover:hover){--tw-translate-y:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}}}.hover\\:translate-y-\\[-1px\\]{&:hover{@media (hover:hover){--tw-translate-y:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}}}.hover\\:scale-105{&:hover{@media (hover:hover){--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}}}.hover\\:border-body-fg\\/30{&:hover{@media (hover:hover){border-color:var(--color-body-fg);@supports (color:color-mix(in lab,red,red)){border-color:color-mix(in oklab,var(--color-body-fg) 30%,transparent)}}}}.hover\\:border-chatbot-primary\\/30{&:hover{@media (hover:hover){border-color:var(--color-chatbot-primary);@supports (color:color-mix(in lab,red,red)){border-color:color-mix(in oklab,var(--color-chatbot-primary) 30%,transparent)}}}}.hover\\:bg-black\\/10{&:hover{@media (hover:hover){background-color:color-mix(in srgb,#000 10%,transparent);@supports (color:color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-black) 10%,transparent)}}}}.hover\\:bg-blue-700{&:hover{@media (hover:hover){background-color:var(--color-blue-700)}}}.hover\\:bg-chatbot-primary{&:hover{@media (hover:hover){background-color:var(--color-chatbot-primary)}}}.hover\\:bg-chatbot-primary\\/5{&:hover{@media (hover:hover){background-color:var(--color-chatbot-primary);@supports (color:color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-chatbot-primary) 5%,transparent)}}}}.hover\\:bg-chatbot-primary\\/10{&:hover{@media (hover:hover){background-color:var(--color-chatbot-primary);@supports (color:color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-chatbot-primary) 10%,transparent)}}}}.hover\\:bg-chatbot-primary\\/50{&:hover{@media (hover:hover){background-color:var(--color-chatbot-primary);@supports (color:color-mix(in lab,red,red)){background-color:color-mix(in oklab,var(--color-chatbot-primary) 50%,transparent)}}}}.hover\\:bg-gray-50{&:hover{@media (hover:hover){background-color:var(--color-gray-50)}}}.hover\\:bg-gray-100{&:hover{@media (hover:hover){background-color:var(--color-gray-100)}}}.hover\\:bg-gray-400{&:hover{@media (hover:hover){background-color:var(--color-gray-400)}}}.hover\\:bg-red-700{&:hover{@media (hover:hover){background-color:var(--color-red-700)}}}.hover\\:text-body-fg{&:hover{@media (hover:hover){color:var(--color-body-fg)}}}.hover\\:text-chatbot-primary{&:hover{@media (hover:hover){color:var(--color-chatbot-primary)}}}.hover\\:text-gray-900{&:hover{@media (hover:hover){color:var(--color-gray-900)}}}.hover\\:text-white{&:hover{@media (hover:hover){color:var(--color-white)}}}.hover\\:underline{&:hover{@media (hover:hover){text-decoration-line:underline}}}.hover\\:opacity-70{&:hover{@media (hover:hover){opacity:70%}}}.hover\\:opacity-80{&:hover{@media (hover:hover){opacity:80%}}}.hover\\:opacity-90{&:hover{@media (hover:hover){opacity:90%}}}.hover\\:opacity-100{&:hover{@media (hover:hover){opacity:100%}}}.hover\\:shadow-\\[0_4px_12px_rgba\\(0\\,0\\,0\\,0\\.1\\)\\]{&:hover{@media (hover:hover){--tw-shadow:0 4px 12px var(--tw-shadow-color,rgba(0,0,0,.1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}}.hover\\:shadow-lg{&:hover{@media (hover:hover){--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,rgba(0,0,0,.1)),0 4px 6px -4px var(--tw-shadow-color,rgba(0,0,0,.1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}}.hover\\:shadow-xl{&:hover{@media (hover:hover){--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,rgba(0,0,0,.1)),0 8px 10px -6px var(--tw-shadow-color,rgba(0,0,0,.1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}}.hover\\:brightness-90{&:hover{@media (hover:hover){--tw-brightness:brightness(90%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}}.hover\\:brightness-95{&:hover{@media (hover:hover){--tw-brightness:brightness(95%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}}.hover\\:not-disabled\\:-translate-y-px{&:hover{@media (hover:hover){&:not(:disabled){--tw-translate-y:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}}}}.hover\\:not-disabled\\:shadow-\\[0_4px_12px_rgba\\(0\\,0\\,0\\,0\\.15\\)\\]{&:hover{@media (hover:hover){&:not(:disabled){--tw-shadow:0 4px 12px var(--tw-shadow-color,rgba(0,0,0,.15));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}}}.hover\\:not-disabled\\:brightness-110{&:hover{@media (hover:hover){&:not(:disabled){--tw-brightness:brightness(110%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}}}.focus\\:border-chatbot-primary{&:focus{border-color:var(--color-chatbot-primary)}}.focus\\:border-gray-400{&:focus{border-color:var(--color-gray-400)}}.focus\\:bg-transparent{&:focus{background-color:transparent}}.focus\\:shadow-\\[0_0_0_2px_rgba\\(38\\,98\\,217\\,0\\.2\\)\\]{&:focus{--tw-shadow:0 0 0 2px var(--tw-shadow-color,rgba(38,98,217,.2));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\\:shadow-\\[0_0_0_3px_rgba\\(38\\,98\\,217\\,0\\.15\\)\\]{&:focus{--tw-shadow:0 0 0 3px var(--tw-shadow-color,rgba(38,98,217,.15));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\\:outline-none{&:focus{--tw-outline-style:none;outline-style:none}}.active\\:translate-y-0{&:active{--tw-translate-y:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}}.active\\:shadow-sm{&:active{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,rgba(0,0,0,.1)),0 1px 2px -1px var(--tw-shadow-color,rgba(0,0,0,.1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.active\\:not-disabled\\:translate-y-0{&:active{&:not(:disabled){--tw-translate-y:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}}}.disabled\\:cursor-not-allowed{&:disabled{cursor:not-allowed}}.disabled\\:opacity-40{&:disabled{opacity:40%}}.disabled\\:opacity-50{&:disabled{opacity:50%}}.disabled\\:opacity-60{&:disabled{opacity:60%}}.disabled\\:shadow-none{&:disabled{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.\\[\\&_p\\]\\:mb-2,.dark\\:bg-\\[var\\(--shiki-dark-bg\\,var\\(--sdm-tbg\\)\\)\\],.dark\\:text-\\[var\\(--shiki-dark\\,var\\(--sdm-c\\,inherit\\)\\)\\],.max-\\[480px\\]\\:bottom-4,.max-\\[480px\\]\\:justify-center,.max-\\[480px\\]\\:max-w-\\[calc\\(100\\%-32px\\)\\],.max-\\[480px\\]\\:px-3,.max-\\[480px\\]\\:py-2,.max-\\[480px\\]\\:right-4,.max-\\[480px\\]\\:text-\\[13px\\],.max-\\[500px\\]\\:bottom-0,.max-\\[500px\\]\\:h-full,.max-\\[500px\\]\\:right-0,.max-\\[500px\\]\\:rounded-none,.max-\\[500px\\]\\:w-full,.md\\:h-12,.md\\:w-12,.sm\\:h-10,.sm\\:p-10,.sm\\:w-10,.supports-\\[backdrop-filter\\]\\:backdrop-blur,.supports-\\[backdrop-filter\\]\\:backdrop-blur-sm{& p{margin-bottom:calc(var(--spacing) * 2)}}.\\[\\&_p\\]\\:leading-relaxed{& p{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}}.\\[\\&_p\\:last-child\\]\\:mb-0{& p:last-child{margin-bottom:calc(var(--spacing) * 0)}}.\\[\\&_svg\\]\\:h-auto{& svg{height:auto}}.\\[\\&_svg\\]\\:w-auto{& svg{width:auto}}.\\[\\&_thead\\]\\:sticky{& thead{position:sticky}}.\\[\\&_thead\\]\\:top-0{& thead{top:calc(var(--spacing) * 0)}}.\\[\\&_thead\\]\\:z-10{& thead{z-index:10}}.\\[\\&\\>\\*\\:first-child\\]\\:mt-0{&>:first-child{margin-top:calc(var(--spacing) * 0)}}.\\[\\&\\>\\*\\:last-child\\]\\:mb-0{&>:last-child{margin-bottom:calc(var(--spacing) * 0)}}.\\[\\&\\>\\*\\:last-child\\]\\:after\\:inline{&>:last-child{&:after{content:var(--tw-content);display:inline}}}.\\[\\&\\>\\*\\:last-child\\]\\:after\\:align-baseline{&>:last-child{&:after{content:var(--tw-content);vertical-align:baseline}}}.\\[\\&\\>\\*\\:last-child\\]\\:after\\:content-\\[var\\(--streamdown-caret\\)\\]{&>:last-child{&:after{--tw-content:var(--streamdown-caret);content:var(--tw-content)}}}.\\[\\&\\>p\\]\\:inline{&>p{display:inline}}.\\[li_\\&\\]\\:pl-6{li &{padding-left:calc(var(--spacing) * 6)}}}:host{--chatbot-primary:#2662d9;--chatbot-foreground:#fff;--header-bg:#2662d9;--header-fg:#fff;--body-bg:#fff;--body-fg:#000;--footer-bg:#fff;--footer-fg:#000;--bubble-user-bg:#2662d9;--bubble-user-fg:#fff;--bubble-bot-bg:#f0f0f0;--bubble-bot-fg:#000;--input-bg:#fff;--input-fg:#000;--send-btn-bg:#2662d9;--send-btn-fg:#fff;--modal-btn-bg:#2662d9;--modal-btn-fg:#fff;font-family:Poppins,ui-sans-serif,system-ui,sans-serif;letter-spacing:.02em}@layer base{:host strong{font-weight:600}:host *,:host :after,:host :before{--tw-border-style:solid;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-duration:initial;--tw-ease:initial;--tw-space-y-reverse:0}}@layer components{.scrollbar-thin{scrollbar-color:var(--chatbot-primary-50,#2662d97f) transparent;scrollbar-width:thin}.scrollbar-thin::-webkit-scrollbar{opacity:0;transition:opacity .3s ease;width:3px}.scrollbar-thin:hover::-webkit-scrollbar{opacity:1}.scrollbar-thin::-webkit-scrollbar-button{display:none}.scrollbar-thin::-webkit-scrollbar-track{background:transparent;border-radius:20px}.scrollbar-thin::-webkit-scrollbar-thumb{border:2px solid transparent;border-radius:20px}.scrollbar-thin::-webkit-scrollbar-thumb,.scrollbar-thin::-webkit-scrollbar-thumb:hover{background-color:var(--chatbot-primary-50,#2662d97f)}}@layer utilities{.animate-spin-slow{animation:spin 1s linear infinite}@keyframes bounce-dot{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.animate-bounce-dot,.animate-bounce-dot-1{animation:bounce-dot 1.4s ease-in-out infinite both}.animate-bounce-dot-1{animation-delay:-.32s}.animate-bounce-dot-2{animation:bounce-dot 1.4s ease-in-out infinite both;animation-delay:-.16s}.animate-bounce-dot-3{animation:bounce-dot 1.4s ease-in-out infinite both}@keyframes shimmer{0%{background-position:200%}to{background-position:0}}.animate-shimmer{animation:shimmer 2s infinite;background:linear-gradient(90deg,var(--bubble-bot-fg,#2f2f2f) 30%,rgba(47,47,47,.2) 50%,var(--bubble-bot-fg,#2f2f2f) 70%);-webkit-background-clip:text;background-clip:text;background-size:200% auto;color:transparent}@keyframes slideIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes slideOut{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(10px)}}@keyframes modalSlideIn{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@keyframes modalSlideOut{0%{opacity:1;transform:translate(-50%,-50%) scale(1)}to{opacity:0;transform:translate(-50%,-50%) scale(.9)}}.animate-slide-in{animation:slideIn .3s ease forwards}.animate-slide-out{animation:slideOut .3s ease forwards}.animate-modal-slide-in{animation:modalSlideIn .3s ease forwards}.animate-modal-slide-out{animation:modalSlideOut .3s ease forwards}}@property --tw-translate-x{syntax:"*";inherits:true;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:true;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:true;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:true}@property --tw-rotate-y{syntax:"*";inherits:true}@property --tw-rotate-z{syntax:"*";inherits:true}@property --tw-skew-x{syntax:"*";inherits:true}@property --tw-skew-y{syntax:"*";inherits:true}@property --tw-space-y-reverse{syntax:"*";inherits:true;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:true;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:true;initial-value:0}@property --tw-border-style{syntax:"*";inherits:true;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:true}@property --tw-gradient-from{syntax:"<color>";inherits:true;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:true;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:true;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:true}@property --tw-gradient-via-stops{syntax:"*";inherits:true}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:true;initial-value:0}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:true;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:true;initial-value:100%}@property --tw-leading{syntax:"*";inherits:true}@property --tw-font-weight{syntax:"*";inherits:true}@property --tw-tracking{syntax:"*";inherits:true}@property --tw-shadow{syntax:"*";inherits:true;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:true}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:true;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:true;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:true}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:true;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:true}@property --tw-ring-shadow{syntax:"*";inherits:true;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:true}@property --tw-inset-ring-shadow{syntax:"*";inherits:true;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:true}@property --tw-ring-offset-width{syntax:"<length>";inherits:true;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:true;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:true;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:true}@property --tw-brightness{syntax:"*";inherits:true}@property --tw-contrast{syntax:"*";inherits:true}@property --tw-grayscale{syntax:"*";inherits:true}@property --tw-hue-rotate{syntax:"*";inherits:true}@property --tw-invert{syntax:"*";inherits:true}@property --tw-opacity{syntax:"*";inherits:true}@property --tw-saturate{syntax:"*";inherits:true}@property --tw-sepia{syntax:"*";inherits:true}@property --tw-drop-shadow{syntax:"*";inherits:true}@property --tw-drop-shadow-color{syntax:"*";inherits:true}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:true;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:true}@property --tw-backdrop-blur{syntax:"*";inherits:true}@property --tw-backdrop-brightness{syntax:"*";inherits:true}@property --tw-backdrop-contrast{syntax:"*";inherits:true}@property --tw-backdrop-grayscale{syntax:"*";inherits:true}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:true}@property --tw-backdrop-invert{syntax:"*";inherits:true}@property --tw-backdrop-opacity{syntax:"*";inherits:true}@property --tw-backdrop-saturate{syntax:"*";inherits:true}@property --tw-backdrop-sepia{syntax:"*";inherits:true}@property --tw-duration{syntax:"*";inherits:true}@property --tw-ease{syntax:"*";inherits:true}@property --tw-content{syntax:"*";initial-value:"";inherits:true}@property --tw-scale-x{syntax:"*";inherits:true;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:true;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:true;initial-value:1}@keyframes spin{to{transform:rotate(1turn)}}@keyframes pulse{50%{opacity:.5}}@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){:host *,:host ::backdrop,:host :after,:host :before{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:"";--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}'.replace(/,\s*:root(?=\s*[,{])/g,"").replace(/:root\s*,/g,"").replace(/:root\s*\{/g,":host{").replace(/,\s*html(?=\s*[,{])/g,"").replace(/(?:^|[},])html\s*\{/g,e=>e.replace("html",":host"));a.textContent=l,t.appendChild(a);const s=document.createElement("style");s.textContent="\n@keyframes sd-fadeIn {\n  from { opacity: 0; }\n  to { opacity: 1; }\n}\n@keyframes sd-blurIn {\n  from { opacity: 0; filter: blur(4px); }\n  to { opacity: 1; filter: blur(0); }\n}\n@keyframes sd-slideUp {\n  from { opacity: 0; transform: translateY(4px); }\n  to { opacity: 1; transform: translateY(0); }\n}\n[data-sd-animate] {\n  animation: var(--sd-animation, sd-fadeIn) var(--sd-duration, 150ms)\n    var(--sd-easing, ease) both;\n}\n",t.appendChild(s);const c=document.createElement("style");c.setAttribute("id","theme-variables"),t.appendChild(c),o.current=c,t.appendChild(r.current)}},[a]),de(()=>{if(o.current&&t){const e=(e=>{if(!e?.colors)return"";const{colors:t}=e,n=[];t.primary&&n.push(`--chatbot-primary: ${t.primary}`),t.foreground&&n.push(`--chatbot-foreground: ${t.foreground}`);const r=t.header?.background||t.primary;r&&n.push(`--header-bg: ${r}`),t.header?.foreground&&n.push(`--header-fg: ${t.header.foreground}`),t.body?.background&&n.push(`--body-bg: ${t.body.background}`),t.body?.foreground&&n.push(`--body-fg: ${t.body.foreground}`),t.footer?.background&&n.push(`--footer-bg: ${t.footer.background}`),t.footer?.foreground&&n.push(`--footer-fg: ${t.footer.foreground}`);const o=t.chatBubble?.user?.background||t.primary;o&&n.push(`--bubble-user-bg: ${o}`),t.chatBubble?.user?.foreground&&n.push(`--bubble-user-fg: ${t.chatBubble.user.foreground}`),t.chatBubble?.bot?.background&&n.push(`--bubble-bot-bg: ${t.chatBubble.bot.background}`),t.chatBubble?.bot?.foreground&&n.push(`--bubble-bot-fg: ${t.chatBubble.bot.foreground}`),t.inputBox?.background&&n.push(`--input-bg: ${t.inputBox.background}`),t.inputBox?.foreground&&n.push(`--input-fg: ${t.inputBox.foreground}`);const a=t.sendButton?.background||t.primary;a&&n.push(`--send-btn-bg: ${a}`),t.sendButton?.foreground&&n.push(`--send-btn-fg: ${t.sendButton.foreground}`);const i=t.modalButton?.background||t.primary;return i&&n.push(`--modal-btn-bg: ${i}`),t.modalButton?.foreground&&n.push(`--modal-btn-fg: ${t.modalButton.foreground}`),n.join(";\n  ")})(t);o.current.textContent=`:host {\n  ${e};\n}`}},[t]),yt.createElement("div",{ref:n,id:"botric-chatbot"},a?Je(e,r.current):null)},Zm=async e=>{const t=yf({baseUrl:"https://api.botric.ai/api/v1"});try{return await t.post("/leads",e)}catch(e){throw console.error("Error in creating lead:",e),e}},Gm=({variant:e,branding:t,children:n})=>{const r=(e=>"flat"===e?"py-6 px-4":"p-4")(e),o=((e,t)=>"flat"===e?t?"border-b border-black/10":"border-0":"border border-black/10")(e,t);return yt.createElement("div",{className:`flex items-center bg-input-bg rounded w-full h-full relative ${r} ${o}`},n)};function Qm({variant:e,handleSend:t,isLoading:n,input:r}){return yt.createElement("button",{"data-tooltip-id":"send-tooltip",onClick:t,disabled:n||""===r,className:"bg-transparent border-none flex items-center justify-center cursor-pointer hover:brightness-90 disabled:cursor-not-allowed disabled:opacity-50 p-1"},yt.createElement("svg",{width:"19",height:"16",viewBox:"0 0 19 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},yt.createElement("path",{d:"M0 16V0L19 8L0 16ZM2 13L13.85 8L2 3V6.5L8 8L2 9.5V13Z",fill:"var(--send-btn-bg, #2662D9)"})))}function Km({variant:e,input:t,chatbotData:n,setInput:r,isLoading:o,handleSend:a}){const[i,l]=ce(!1),s=he(null),c=he(null),u=ge(()=>{s.current&&(s.current.stop(),s.current=null),c.current&&clearTimeout(c.current),l(!1)},[]),d=ge(()=>{const e=function(){const e=window;return e.SpeechRecognition||e.webkitSpeechRecognition||null}();if(!e)return void alert("Speech recognition is not supported in your browser.");const t=new e;t.continuous=!0,t.interimResults=!0,t.lang="en-US",t.onresult=e=>{let t="";for(let n=e.resultIndex;n<e.results.length;n++){const r=e.results[n][0].transcript;r&&(t+=r)}t.trim()&&(r(e=>e.endsWith(" ")||!e?e+t:e+" "+t),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{u(),a()},2e3))},t.onerror=()=>{u()},t.onend=()=>{l(!1)},s.current=t,t.start(),l(!0)},[r,u,a]),p=ge(()=>{i?u():d()},[i,d,u]);return de(()=>()=>{s.current&&s.current.abort(),c.current&&clearTimeout(c.current)},[]),yt.createElement(Gm,{variant:e,branding:n?.settings?.branding},yt.createElement("input",{type:"text",value:t,onChange:e=>r(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||o||(e.preventDefault(),a())},placeholder:i?"Listening...":n?.settings?.placeholderText||"Ask me anything...",className:"w-full resize-none m-0 border-none bg-transparent text-base text-input-fg leading-tight outline-none box-border rounded grow min-h-5 max-h-15 overflow-y-auto whitespace-pre-wrap h-full focus:outline-none"}),yt.createElement("div",{className:"flex items-center gap-1"},yt.createElement(Et,{content:i?"Stop Listening":"Voice Input",placement:"bottom"},yt.createElement("button",{type:"button",onClick:p,className:"p-1.5 rounded-full transition-all duration-300 "+(i?"bg-red-500 shadow-[0_0_0_4px_rgba(239,68,68,0.2)] animate-pulse":"hover:bg-gray-100"),"aria-label":i?"Stop voice input":"Voice input"},yt.createElement("svg",{width:"16",height:"16",viewBox:"0 0 14 19",fill:"none",className:"transition-colors "+(i?"brightness-200":"")},yt.createElement("path",{d:"M7 12C6.16667 12 5.45833 11.7083 4.875 11.125C4.29167 10.5417 4 9.83333 4 9V3C4 2.16667 4.29167 1.45833 4.875 0.875C5.45833 0.291667 6.16667 0 7 0C7.83333 0 8.54167 0.291667 9.125 0.875C9.70833 1.45833 10 2.16667 10 3V9C10 9.83333 9.70833 10.5417 9.125 11.125C8.54167 11.7083 7.83333 12 7 12Z",fill:i?"#FFFFFF":"var(--send-btn-bg, #2662D9)"}),yt.createElement("path",{d:"M6 19V15.925C4.26667 15.6917 2.83333 14.9167 1.7 13.6C0.566667 12.2833 0 10.75 0 9H2C2 10.3833 2.4875 11.5625 3.4625 12.5375C4.4375 13.5125 5.61667 14 7 14C8.38333 14 9.5625 13.5125 10.5375 12.5375C11.5125 11.5625 12 10.3833 12 9H14C14 10.75 13.4333 12.2833 12.3 13.6C11.1667 14.9167 9.73333 15.6917 8 15.925V19H6Z",fill:i?"#FFFFFF":"var(--send-btn-bg, #2662D9)"})))),yt.createElement(Et,{content:"Send Message",placement:"bottom"},yt.createElement(Qm,{handleSend:a,input:t,isLoading:o,variant:e}))))}function Xm({mode:e}){const{logo:t,url:n,alt:r}=(e=>({logo:"dark"===e?"https://widget.botric.ai/assets/BotricDark.png":"https://widget.botric.ai/assets/BotricLight.png",url:"https://botric.ai",alt:"Botric"}))(e);return w("div",{className:"flex items-center justify-center gap-1.5"},w("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center"},w("img",{src:t,alt:r,className:"h-4 w-auto"})))}function Jm({activeTab:e,onTabChange:t}){const n=[{id:"chat",label:"Chat",icon:e=>yt.createElement("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:e?"var(--chatbot-primary, #2662D9)":"var(--nav-inactive, #6B7280)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},yt.createElement("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),yt.createElement("line",{x1:"9",y1:"10",x2:"15",y2:"10"}))},{id:"faq",label:"FAQ",icon:e=>yt.createElement("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:e?"var(--chatbot-primary, #2662D9)":"var(--nav-inactive, #6B7280)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},yt.createElement("circle",{cx:"12",cy:"12",r:"10"}),yt.createElement("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),yt.createElement("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"}))},{id:"support",label:"Support",icon:e=>yt.createElement("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:e?"var(--chatbot-primary, #2662D9)":"var(--nav-inactive, #6B7280)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},yt.createElement("path",{d:"M3 18v-6a9 9 0 0 1 18 0v6"}),yt.createElement("path",{d:"M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z"}))}];return yt.createElement("nav",{className:"flex items-center justify-around border-t border-black/10 bg-footer-bg py-2"},n.map(n=>{const r=e===n.id;return yt.createElement("button",{key:n.id,onClick:()=>t(n.id),className:"flex items-center gap-1.5 px-4 py-2 rounded-lg transition-colors cursor-pointer",style:{color:r?"var(--chatbot-primary, #2662D9)":"var(--nav-inactive, #6B7280)",fontWeight:r?500:400}},n.icon(r),yt.createElement("span",{className:"text-sm font-medium"},n.label))}))}function eg({variant:e,input:t,chatbotData:n,setInput:r,isLoading:o,handleSend:a,disableInput:i,onShowSources:l,showSources:s,activeTab:c="chat",onTabChange:u}){const[d,p]=ce("chat"),h=c||d,f=u||p;return yt.createElement("footer",{className:"flex flex-col w-full box-border bg-footer-bg"},s&&yt.createElement("div",{className:"flex flex-col items-center w-full px-3 pt-2"},yt.createElement("button",{onClick:l,disabled:o,className:"flex-1 py-2 px-2 text-base font-semibold mb-2 w-full border border-black/10 bg-white text-black cursor-pointer flex items-center justify-center gap-1.5 font-inherit relative overflow-hidden disabled:opacity-60 disabled:cursor-not-allowed rounded-lg"},"Show Sources")),!i&&yt.createElement("div",{className:"px-3 py-2 border-t border-gray-200"},yt.createElement(Km,{variant:e,input:t,chatbotData:n,setInput:r,isLoading:o,handleSend:a})),"floating"===n?.design?.viewMode&&yt.createElement(Jm,{activeTab:h,onTabChange:f}),n?.settings?.branding&&yt.createElement("div",{className:"py-2 border-t border-gray-100"},yt.createElement(Xm,{mode:n?.design?.theme?.mode})))}const tg=({children:e,isModal:t=!1,className:n="",...r})=>yt.createElement("button",kt({className:`cursor-pointer border-none transition-all duration-200 ${t?"\n    bg-modal-btn-bg text-modal-btn-fg\n    py-3 px-6 rounded-lg\n    inline-flex items-center gap-2\n    font-sans text-base font-medium\n    shadow-md\n    hover:translate-y-[-1px] hover:shadow-lg\n    active:translate-y-0 active:shadow-sm\n  ":"\n    bg-chatbot-primary text-white\n    w-16 h-16 aspect-square\n    rounded-full grid place-content-center\n    overflow-hidden p-0\n    shadow-lg\n    hover:scale-105 hover:shadow-xl\n    md:w-12 md:h-12\n    sm:w-10 sm:h-10\n  "} ${n}`},r),e);function ng({handlePopupClose:e,isPopupVisible:t}){return w("div",{className:"absolute bottom-20 right-0 bg-body-bg p-4 rounded-[14px] shadow-[0_2px_12px_rgba(0,0,0,0.08)] w-[250px] font-sans text-[15px] leading-normal text-body-fg z-2147483645 block "+(t?"animate-slide-in":"animate-slide-out")},w("div",{onClick:e,className:"text-body-fg absolute top-3 right-3 cursor-pointer opacity-60 transition-opacity duration-200 hover:opacity-100"},w("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},w("path",{d:"M12.5 3.5L3.5 12.5M3.5 3.5L12.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))),w("p",{className:"m-0 pr-5"},"Got questions? Let's chat!"))}function rg({handleOpen:e,handlePopupClose:t,isPopupVisible:n,widgetImage:r,showPopup:o,isModal:a,modalText:i}){return w("div",{className:a?"inline-block":"grid place-content-center"},w(tg,{onClick:e(!0),isModal:a},a?w(_,null,i):w("img",{src:r||"https://widget.botric.ai/assets/bot.gif",alt:"Start Chat",className:"w-full h-full object-cover"})),o&&!a&&w(ng,{handlePopupClose:t,isPopupVisible:n}))}function og({isVisible:e,onClose:t,message:n,action:r,onFormSubmit:o,gif:a}){const i=he(null),l=he(null),[s,c]=ce({}),[u,d]=ce({}),[p,h]=ce(!1);de(()=>{if(e){l.current=document.activeElement,i.current&&i.current.focus();const e=e=>{if("Escape"===e.key&&t(),"Tab"===e.key){const t=i.current?.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(t&&t.length>0){const n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):e.shiftKey||document.activeElement!==r||(e.preventDefault(),n.focus())}}};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e),l.current&&l.current.focus()}}},[e,t]);const f=(e,t)=>{c(n=>({...n,[e]:t})),d(t=>({...t,[e]:""}))},m=!!a;return w("div",{onClick:e=>{e.target===e.currentTarget&&t()},role:"dialog","aria-modal":"true","aria-labelledby":"exit-intent-title","aria-describedby":"exit-intent-subtitle",className:"fixed top-0 left-0 w-screen h-screen bg-black/50 z-2147483647 flex items-center justify-center "+(e?"animate-fade-in":"animate-fade-out")},w("div",{ref:i,tabIndex:-1,className:`relative bg-body-bg rounded-2xl shadow-[0_25px_50px_-12px_rgba(0,0,0,0.25)] font-sans text-body-fg flex overflow-hidden ${m?"w-[80vw] max-w-[1100px] h-[80vh]":"w-[80vw] max-w-[440px]"} ${e?"animate-fade-in":"animate-fade-out"}`},m&&w("div",{className:"block w-[60%] min-h-full bg-gray-100 shrink-0"},w("img",{src:a,alt:"",className:"w-full h-full object-cover"})),w("div",{className:"flex flex-col justify-center flex-1 p-8 "+(m?"sm:p-10":"p-8")},w("button",{onClick:t,"aria-label":"Close popup",title:"Close popup (Esc)",className:"text-body-fg absolute top-4 right-4 cursor-pointer bg-transparent border-none p-1.5 rounded-full opacity-50 transition-all duration-200 hover:opacity-100 hover:bg-black/10"},w("svg",{width:"18",height:"18",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},w("path",{d:"M12.5 3.5L3.5 12.5M3.5 3.5L12.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))),w("h2",{id:"exit-intent-title",className:"m-0 mb-3 text-[22px] font-bold leading-tight tracking-tight"},n.title),w("p",{id:"exit-intent-subtitle",className:"m-0 mb-8 text-[15px] text-body-fg/70 leading-relaxed"},n.subTitle),"form"===r.type&&Array.isArray(r.form?.fields)&&r.form.fields.length>0&&w("div",{className:"flex flex-col gap-5"},r.form.fields.filter(e=>!1!==e.enabled).map(e=>w("div",{key:e.label,className:"flex flex-col gap-1.5"},w("label",{htmlFor:`exit-intent-${e.label}`,className:"text-[13px] font-semibold text-body-fg/80 uppercase tracking-wide"},e.label," ",e.required&&w("span",{className:"text-red-400"},"*")),"textarea"===e.type?w("textarea",{id:`exit-intent-${e.label}`,value:s[e.label]||"",onChange:t=>f(e.label,t.target.value),placeholder:`Enter your ${e.label.toLowerCase()}`,required:e.required,className:"p-3 border border-body-fg/15 bg-body-fg/5 rounded-lg text-sm text-body-fg resize-y min-h-20 font-inherit transition-all duration-200 placeholder:text-body-fg/40 focus:outline-none focus:border-chatbot-primary focus:shadow-[0_0_0_3px_rgba(38,98,217,0.15)] focus:bg-transparent"}):w("input",{id:`exit-intent-${e.label}`,type:"phone"===e.type?"tel":e.type,value:s[e.label]||"",onChange:t=>f(e.label,t.target.value),placeholder:`Enter your ${e.label.toLowerCase()}`,required:e.required,className:"p-3 border border-body-fg/15 bg-body-fg/5 rounded-lg text-sm text-body-fg transition-all duration-200 placeholder:text-body-fg/40 focus:outline-none focus:border-chatbot-primary focus:shadow-[0_0_0_3px_rgba(38,98,217,0.15)] focus:bg-transparent"}),u[e.label]&&w("span",{className:"text-red-400 text-xs"},u[e.label]))),w("button",{onClick:async()=>{if(!Array.isArray(r.form?.fields)||!o)return;const e={},n=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;if(r.form.fields.forEach(t=>{const{label:r,required:o,enabled:a,type:i}=t,l=s[r];!1!==a&&o&&(!l||"string"==typeof l&&""===l.trim()?e[r]="This field is required":"email"!==i||n.test(l)||(e[r]="Please enter a valid email address"))}),Object.keys(e).length>0)d(e);else{h(!0);try{await o(s),t()}catch(e){console.error("Form submission failed:",e)}finally{h(!1)}}},disabled:p,className:"mt-2 py-3.5 px-6 bg-chatbot-primary text-white border-none rounded-lg font-semibold text-sm cursor-pointer transition-all duration-200 hover:not-disabled:brightness-110 hover:not-disabled:-translate-y-px hover:not-disabled:shadow-[0_4px_12px_rgba(0,0,0,0.15)] active:not-disabled:translate-y-0 disabled:opacity-50 disabled:cursor-not-allowed"},p?"Submitting...":"Submit")),"buttons"===r.type&&w("div",{className:"flex flex-col gap-3"},r.buttons.map((e,n)=>w("button",{key:e.id,onClick:()=>(e=>{window.open(e,"_blank","noopener,noreferrer"),t()})(e.link),"aria-label":`${e.label} - Opens in new tab`,autoFocus:0===n,className:"flex items-center justify-center py-3.5 px-6 bg-transparent border border-body-fg/15 text-body-fg rounded-lg font-semibold text-sm cursor-pointer transition-all duration-200 hover:-translate-y-px hover:shadow-[0_4px_12px_rgba(0,0,0,0.1)] hover:border-body-fg/30"},e.label))))))}const ag="https://api.botric.ai/api/v1",ig=({id:e,openByDefault:t=!1,botricView:n="default",showSources:r=!1,isPreview:o=!1})=>{const{state:a,dispatch:i}=((e=!1)=>{const[t,n]=ue(jm,{...$m,isOpen:e});return{state:t,dispatch:n}})(t),l=he(null),s=he(null),{chatbotData:c}=Bm(ag,e,a.chatbotDataFetchIndex),{sendMessage:u,resetMessages:d,addSystemMessage:p,initialChatMessage:h,loadSessionMessages:f}=Hm(ag,e??"",i,a),m={isOpen:a.isOpen,messagesLength:a.messages.length,onInitialMessage:h,hasLoadedSessionMessages:a.hasLoadedSessionMessages,loadSessionMessages:f},{sessionId:g,sessionLoading:b,sessionError:y,createNewSession:v,showLeadsForm:x,setShowLeadsForm:k}=Um(ag,e,i,a,m,o),{sourcesData:E,isLoading:S}=qm(ag,g||"",a.showSourcesOverlay),{faqData:C,isLoading:N}=Vm(ag,c?._id??""),[T,I]=ce("chat"),[L,M]=ce(!1),P=()=>{M(e=>!e)},{showExitIntent:D,resetExitIntent:A}=Wm(c?.tools?.exitIntent);de(()=>{let e=!1;if(x)e=!0;else{e=a.messages.some(e=>{if("__SHOW_CAL_WIDGET__"===e.text){return!localStorage.getItem(`calBookingData-${g}`)}if("__RAISE_TICKET__"===e.text){return!localStorage.getItem(`ticketData-${g}`)}return!1})}i({type:"SET_DISABLE_INPUT",payload:e})},[a.messages,g,x,i]);const O=()=>{i({type:"SET_SHOW_SOURCES_OVERLAY",payload:!0})},z=()=>{i({type:"SET_DISABLE_INPUT",payload:!1})},R=()=>{a.input.trim()&&g&&!a.disableInput&&(u(a.input,g).then(),i({type:"SET_INPUT",payload:""}))},F=(e=!0)=>()=>{e?(g||v(),i({type:"SET_IS_OPEN",payload:!0})):i({type:"SET_IS_OPEN",payload:!1})},$=async e=>{try{c&&await Zm({agentId:c._id,orgId:c.organizationId,formData:e,sessionId:g||""}),i({type:"SET_USER_INFO",payload:e}),i({type:"SET_DISABLE_INPUT",payload:!1}),k(!1)}catch(e){throw console.error("Failed to submit lead:",e),e}},j=()=>{i({type:"SET_IS_POPUP_VISIBLE",payload:!1}),setTimeout(()=>{i({type:"SET_SHOW_POPUP",payload:!1}),sessionStorage.setItem("popupClosed","true")},300)};return de(()=>{if(!a.isOpen&&!sessionStorage.getItem("popupClosed")){const e=setTimeout(()=>{i({type:"SET_SHOW_POPUP",payload:!0}),i({type:"SET_IS_POPUP_VISIBLE",payload:!0})},1e3);return()=>clearTimeout(e)}i({type:"SET_SHOW_POPUP",payload:!1}),i({type:"SET_IS_POPUP_VISIBLE",payload:!1})},[a.isOpen,i]),de(()=>{!t||g||b||v()},[t,g,b,v]),pe(()=>{s?.current&&(s.current.scrollTop=s.current?.scrollHeight)},[a.messages,a.error,a.isOpen,p]),c?.disabled||!c?null:w(Ym,{theme:c?.design?.theme},w(_,null,a.isOpen&&"modal"===c?.design?.viewMode&&w("div",{className:"fixed inset-0 bg-black/50 z-2147483645",onClick:F(!1)}),"modal"===c?.design?.viewMode?w(_,null,a.isOpen&&w("div",{className:"fixed inset-0 z-2147483646 flex items-center justify-center"},w(wt,{isOpen:a.isOpen,botricView:n,mode:c?.design?.viewMode},a.showSourcesOverlay?w(zm,{sourcesData:E,sourcesLoading:S,onClose:()=>i({type:"SET_SHOW_SOURCES_OVERLAY",payload:!1})}):w(_,null,w(Vt,{chatbotData:c,handleOpen:F,createNewSession:v,resetMessages:d,botricView:n,isExpanded:L,onToggleExpanded:P}),w(Om,{ref:s,sessionLoading:b,sessionError:!!y,sessionErrorMessage:y?.message,onRetrySession:v,showLeadsForm:x,chatbotData:c,handleLeadSubmit:$,messages:a.messages,isLoading:a.isLoading,isError:!!a.error,error:a.error,followUpQuestions:a.followUpQuestions,handleFollowUp:e=>{g&&!a.disableInput&&u(e,g).then()},disableInput:a.disableInput,onWidgetComplete:z,addSystemMessage:p,userInfo:a.userInfo||void 0,faqData:C,faqLoading:N}),w(eg,{variant:c?.design?.theme?.variants?.inputBox,input:a.input,isLoading:a.isLoading,chatbotData:c,handleSend:R,setInput:e=>{const t="function"==typeof e?e(a.input):e;i({type:"SET_INPUT",payload:t})},disableInput:a.disableInput,onShowSources:O,showSources:r})))),"default"===n&&!a.isOpen&&w(rg,{showPopup:a.showPopup,handleOpen:F,isPopupVisible:a.isPopupVisible,handlePopupClose:j,widgetImage:c?.settings?.widgetIcon||"",isModal:"modal"===c?.design?.viewMode,modalText:c?.settings?.modalButtonText})):w(_,null,a.isOpen&&L&&w("div",{className:"fixed inset-0 bg-black/50 z-2147483645",onClick:P}),w("div",{className:"fixed bottom-8 right-8 z-2147483646 text-left",ref:l},a.isOpen&&w(wt,{isOpen:a.isOpen,botricView:n,mode:c?.design?.viewMode,isExpanded:L},a.showSourcesOverlay?w(zm,{sourcesData:E,sourcesLoading:S,onClose:()=>i({type:"SET_SHOW_SOURCES_OVERLAY",payload:!1})}):w(_,null,w(Vt,{chatbotData:c,handleOpen:F,createNewSession:v,resetMessages:d,botricView:n,isExpanded:L,onToggleExpanded:P}),"chat"===T?w(Om,{ref:s,sessionLoading:b,sessionError:!!y,sessionErrorMessage:y?.message,onRetrySession:v,showLeadsForm:x,chatbotData:c,handleLeadSubmit:$,messages:a.messages,isLoading:a.isLoading,isError:!!a.error,error:a.error,followUpQuestions:a.followUpQuestions,handleFollowUp:e=>{g&&!a.disableInput&&u(e,g).then()},disableInput:a.disableInput,onWidgetComplete:z,addSystemMessage:p,userInfo:a.userInfo||void 0,faqData:C,faqLoading:N}):"faq"===T?w(Rm,{faqData:C,faqLoading:N,chatbotData:c}):w(Fm,{chatbotData:c}),w(eg,{variant:c?.design?.theme?.variants?.inputBox,input:a.input,isLoading:a.isLoading,chatbotData:c,handleSend:R,setInput:e=>{const t="function"==typeof e?e(a.input):e;i({type:"SET_INPUT",payload:t})},disableInput:a.disableInput||"chat"!==T,onShowSources:O,showSources:r,activeTab:T,onTabChange:I}))),"default"===n&&!a.isOpen&&w(rg,{showPopup:a.showPopup,handleOpen:F,isPopupVisible:a.isPopupVisible,handlePopupClose:j,widgetImage:c?.settings?.widgetIcon||"",isModal:!1}))),D&&c?.tools?.exitIntent?.enabled&&w(og,{isVisible:D,onClose:A,message:c.tools.exitIntent.message,action:c.tools.exitIntent.action,gif:c.tools.exitIntent.gif,onFormSubmit:async e=>{try{c&&await Zm({agentId:c._id,orgId:c.organizationId,formData:e,sessionId:g||""}),i({type:"SET_USER_INFO",payload:e})}catch(e){throw console.error("Failed to submit exit intent form:",e),e}}})))};const lg="1.4.0";!function(e){const t=(e,t)=>{xt.createRoot(t).render(yt.createElement(ig,e))},n=(e,t=1e4,n,r)=>{const o=document.getElementById(e);if(o)return void n(o);let a=null,i=null;const l=()=>{a&&(a.disconnect(),a=null),i&&(clearTimeout(i),i=null)};i=setTimeout(()=>{l(),r()},t),a=new MutationObserver(t=>{for(const r of t)"childList"===r.type&&r.addedNodes.forEach(t=>{if(t.nodeType===Node.ELEMENT_NODE){const r=t;if(r.id===e)return l(),void n(r);const o=r.querySelector(`#${e}`);if(o)return l(),void n(o)}})}),a.observe(document.body,{childList:!0,subtree:!0})};e.Botric={version:lg,init:(e={id:"",botricView:""})=>{if(!document.getElementById("botric-chatbot-container")){const n=document.createElement("div");n.id="botric-chatbot-container",document.body.appendChild(n),t(e,n)}},render:e=>{if(!e.id)throw new Error("Chatbot ID is required");if(e.containerId)n(e.containerId,1e4,n=>{t(e,n)},()=>{});else if(document.getElementById("botric-chatbot-container"))t(e,document.getElementById("botric-chatbot-container"));else{const n=document.createElement("div");n.id="botric-chatbot-container",document.body.appendChild(n),t(e,n)}}};const r=()=>{const r=function(){const e=Array.from(document.getElementsByTagName("script"));for(const t of e)if(t.src&&(t.src.includes("index.umd.js")||t.src.includes("widget.botric.ai")||t.src.includes("dev-widget.botric.ai")||t.src.includes("idfi"))){const e=t.getAttribute("data-bot-id");if(!e)continue;return{botId:e,botricView:t.getAttribute("data-bot-view")||"default",containerId:t.getAttribute("data-container-id"),timeout:parseInt(t.getAttribute("data-timeout")||"10000",10)}}return null}();if(!r)return;const{botId:o,botricView:a,containerId:i,timeout:l}=r;o&&(i?n(i,l,e=>{t({id:o,botricView:a,containerId:i},e)},()=>{}):e.Botric.init({id:o,botricView:a}))};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",r):r()}(window);var sg=Object.freeze({__proto__:null,HighlightedCodeBlockBody:({code:e,language:t,raw:n,className:r,startLine:o,lineNumbers:a,...i})=>{let{shikiTheme:l}=be(af),s=(()=>{var e;let t=xp();return null!=(e=null==t?void 0:t.code)?e:null})(),[c,u]=ce(n);return de(()=>{if(!s)return void u(n);let r=s.highlight({code:e,language:t,themes:l},e=>{u(e)});r&&u(r)},[e,t,l,s,n]),ul(Qd,{className:r,language:t,lineNumbers:a,result:c,startLine:o,...i})}}),cg=Object.freeze({__proto__:null,Mermaid:uf})});
//# sourceMappingURL=index.umd.js.map
