robodialog 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/widget.js CHANGED
@@ -1,37 +1,37 @@
1
- var Ep=Object.defineProperty;var Ap=(be,Fe,N)=>Fe in be?Ep(be,Fe,{enumerable:!0,configurable:!0,writable:!0,value:N}):be[Fe]=N;var ne=(be,Fe,N)=>Ap(be,typeof Fe!="symbol"?Fe+"":Fe,N);(function(){"use strict";var mr;var be={env:{}},Fe,N,Js,St,Zs,Gs,Ks,Qs,wr,kr,Tr,ei,en={},ti=[],Ol=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,tn=Array.isArray;function Ke(n,e){for(var t in e)n[t]=e[t];return n}function Sr(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function Qe(n,e,t){var r,s,i,o={};for(i in e)i=="key"?r=e[i]:i=="ref"?s=e[i]:o[i]=e[i];if(arguments.length>2&&(o.children=arguments.length>3?Fe.call(arguments,2):t),typeof n=="function"&&n.defaultProps!=null)for(i in n.defaultProps)o[i]===void 0&&(o[i]=n.defaultProps[i]);return nn(n,o,r,s,null)}function nn(n,e,t,r,s){var i={type:n,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++Js,__i:-1,__u:0};return s==null&&N.vnode!=null&&N.vnode(i),i}function ni(){return{current:null}}function Te(n){return n.children}function We(n,e){this.props=n,this.context=e}function zt(n,e){if(e==null)return n.__?zt(n.__,n.__i+1):null;for(var t;e<n.__k.length;e++)if((t=n.__k[e])!=null&&t.__e!=null)return t.__e;return typeof n.type=="function"?zt(n):null}function ri(n){var e,t;if((n=n.__)!=null&&n.__c!=null){for(n.__e=n.__c.base=null,e=0;e<n.__k.length;e++)if((t=n.__k[e])!=null&&t.__e!=null){n.__e=n.__c.base=t.__e;break}return ri(n)}}function Cr(n){(!n.__d&&(n.__d=!0)&&St.push(n)&&!xn.__r++||Zs!=N.debounceRendering)&&((Zs=N.debounceRendering)||Gs)(xn)}function xn(){for(var n,e,t,r,s,i,o,a=1;St.length;)St.length>a&&St.sort(Ks),n=St.shift(),a=St.length,n.__d&&(t=void 0,r=void 0,s=(r=(e=n).__v).__e,i=[],o=[],e.__P&&((t=Ke({},r)).__v=r.__v+1,N.vnode&&N.vnode(t),Er(e.__P,t,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,i,s??zt(r),!!(32&r.__u),o),t.__v=r.__v,t.__.__k[t.__i]=t,li(i,t,o),r.__e=r.__=null,t.__e!=s&&ri(t)));xn.__r=0}function si(n,e,t,r,s,i,o,a,l,c,u){var d,g,h,f,m,b,v,x=r&&r.__k||ti,w=e.length;for(l=Pl(t,e,x,l,w),d=0;d<w;d++)(h=t.__k[d])!=null&&(g=h.__i==-1?en:x[h.__i]||en,h.__i=d,b=Er(n,h,g,s,i,o,a,l,c,u),f=h.__e,h.ref&&g.ref!=h.ref&&(g.ref&&Rr(g.ref,null,h),u.push(h.ref,h.__c||f,h)),m==null&&f!=null&&(m=f),(v=!!(4&h.__u))||g.__k===h.__k?l=ii(h,l,n,v):typeof h.type=="function"&&b!==void 0?l=b:f&&(l=f.nextSibling),h.__u&=-7);return t.__e=m,l}function Pl(n,e,t,r,s){var i,o,a,l,c,u=t.length,d=u,g=0;for(n.__k=new Array(s),i=0;i<s;i++)(o=e[i])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=n.__k[i]=nn(null,o,null,null,null):tn(o)?o=n.__k[i]=nn(Te,{children:o},null,null,null):o.constructor==null&&o.__b>0?o=n.__k[i]=nn(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):n.__k[i]=o,l=i+g,o.__=n,o.__b=n.__b+1,(c=o.__i=Dl(o,t,l,d))!=-1&&(d--,(a=t[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(s>u?g--:s<u&&g++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?g--:c==l+1?g++:(c>l?g--:g++,o.__u|=4))):n.__k[i]=null;if(d)for(i=0;i<u;i++)(a=t[i])!=null&&!(2&a.__u)&&(a.__e==r&&(r=zt(a)),ui(a,a));return r}function ii(n,e,t,r){var s,i;if(typeof n.type=="function"){for(s=n.__k,i=0;s&&i<s.length;i++)s[i]&&(s[i].__=n,e=ii(s[i],e,t,r));return e}n.__e!=e&&(r&&(e&&n.type&&!e.parentNode&&(e=zt(n)),t.insertBefore(n.__e,e||null)),e=n.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function ut(n,e){return e=e||[],n==null||typeof n=="boolean"||(tn(n)?n.some(function(t){ut(t,e)}):e.push(n)),e}function Dl(n,e,t,r){var s,i,o,a=n.key,l=n.type,c=e[t],u=c!=null&&(2&c.__u)==0;if(c===null&&a==null||u&&a==c.key&&l==c.type)return t;if(r>(u?1:0)){for(s=t-1,i=t+1;s>=0||i<e.length;)if((c=e[o=s>=0?s--:i++])!=null&&!(2&c.__u)&&a==c.key&&l==c.type)return o}return-1}function oi(n,e,t){e[0]=="-"?n.setProperty(e,t??""):n[e]=t==null?"":typeof t!="number"||Ol.test(e)?t:t+"px"}function wn(n,e,t,r,s){var i,o;e:if(e=="style")if(typeof t=="string")n.style.cssText=t;else{if(typeof r=="string"&&(n.style.cssText=r=""),r)for(e in r)t&&e in t||oi(n.style,e,"");if(t)for(e in t)r&&t[e]==r[e]||oi(n.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")i=e!=(e=e.replace(Qs,"$1")),o=e.toLowerCase(),e=o in n||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),n.l||(n.l={}),n.l[e+i]=t,t?r?t.u=r.u:(t.u=wr,n.addEventListener(e,i?Tr:kr,i)):n.removeEventListener(e,i?Tr:kr,i);else{if(s=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in n)try{n[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?n.removeAttribute(e):n.setAttribute(e,e=="popover"&&t==1?"":t))}}function ai(n){return function(e){if(this.l){var t=this.l[e.type+n];if(e.t==null)e.t=wr++;else if(e.t<t.u)return;return t(N.event?N.event(e):e)}}}function Er(n,e,t,r,s,i,o,a,l,c){var u,d,g,h,f,m,b,v,x,w,k,_,S,P,T,A,D,E=e.type;if(e.constructor!=null)return null;128&t.__u&&(l=!!(32&t.__u),i=[a=e.__e=t.__e]),(u=N.__b)&&u(e);e:if(typeof E=="function")try{if(v=e.props,x="prototype"in E&&E.prototype.render,w=(u=E.contextType)&&r[u.__c],k=u?w?w.props.value:u.__:r,t.__c?b=(d=e.__c=t.__c).__=d.__E:(x?e.__c=d=new E(v,k):(e.__c=d=new We(v,k),d.constructor=E,d.render=$l),w&&w.sub(d),d.state||(d.state={}),d.__n=r,g=d.__d=!0,d.__h=[],d._sb=[]),x&&d.__s==null&&(d.__s=d.state),x&&E.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Ke({},d.__s)),Ke(d.__s,E.getDerivedStateFromProps(v,d.__s))),h=d.props,f=d.state,d.__v=e,g)x&&E.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),x&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(x&&E.getDerivedStateFromProps==null&&v!==h&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(v,k),e.__v==t.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(v,d.__s,k)===!1){for(e.__v!=t.__v&&(d.props=v,d.state=d.__s,d.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(j){j&&(j.__=e)}),_=0;_<d._sb.length;_++)d.__h.push(d._sb[_]);d._sb=[],d.__h.length&&o.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(v,d.__s,k),x&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(h,f,m)})}if(d.context=k,d.props=v,d.__P=n,d.__e=!1,S=N.__r,P=0,x){for(d.state=d.__s,d.__d=!1,S&&S(e),u=d.render(d.props,d.state,d.context),T=0;T<d._sb.length;T++)d.__h.push(d._sb[T]);d._sb=[]}else do d.__d=!1,S&&S(e),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++P<25);d.state=d.__s,d.getChildContext!=null&&(r=Ke(Ke({},r),d.getChildContext())),x&&!g&&d.getSnapshotBeforeUpdate!=null&&(m=d.getSnapshotBeforeUpdate(h,f)),A=u,u!=null&&u.type===Te&&u.key==null&&(A=ci(u.props.children)),a=si(n,tn(A)?A:[A],e,t,r,s,i,o,a,l,c),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),b&&(d.__E=d.__=null)}catch(j){if(e.__v=null,l||i!=null)if(j.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,e.__e=a}else{for(D=i.length;D--;)Sr(i[D]);Ar(e)}else e.__e=t.__e,e.__k=t.__k,j.then||Ar(e);N.__e(j,e,t)}else i==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=Il(t.__e,e,t,r,s,i,o,l,c);return(u=N.diffed)&&u(e),128&e.__u?void 0:a}function Ar(n){n&&n.__c&&(n.__c.__e=!0),n&&n.__k&&n.__k.forEach(Ar)}function li(n,e,t){for(var r=0;r<t.length;r++)Rr(t[r],t[++r],t[++r]);N.__c&&N.__c(e,n),n.some(function(s){try{n=s.__h,s.__h=[],n.some(function(i){i.call(s)})}catch(i){N.__e(i,s.__v)}})}function ci(n){return typeof n!="object"||n==null||n.__b&&n.__b>0?n:tn(n)?n.map(ci):Ke({},n)}function Il(n,e,t,r,s,i,o,a,l){var c,u,d,g,h,f,m,b=t.props||en,v=e.props,x=e.type;if(x=="svg"?s="http://www.w3.org/2000/svg":x=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((h=i[c])&&"setAttribute"in h==!!x&&(x?h.localName==x:h.nodeType==3)){n=h,i[c]=null;break}}if(n==null){if(x==null)return document.createTextNode(v);n=document.createElementNS(s,x,v.is&&v),a&&(N.__m&&N.__m(e,i),a=!1),i=null}if(x==null)b===v||a&&n.data==v||(n.data=v);else{if(i=i&&Fe.call(n.childNodes),!a&&i!=null)for(b={},c=0;c<n.attributes.length;c++)b[(h=n.attributes[c]).name]=h.value;for(c in b)if(h=b[c],c!="children"){if(c=="dangerouslySetInnerHTML")d=h;else if(!(c in v)){if(c=="value"&&"defaultValue"in v||c=="checked"&&"defaultChecked"in v)continue;wn(n,c,null,h,s)}}for(c in v)h=v[c],c=="children"?g=h:c=="dangerouslySetInnerHTML"?u=h:c=="value"?f=h:c=="checked"?m=h:a&&typeof h!="function"||b[c]===h||wn(n,c,h,b[c],s);if(u)a||d&&(u.__html==d.__html||u.__html==n.innerHTML)||(n.innerHTML=u.__html),e.__k=[];else if(d&&(n.innerHTML=""),si(e.type=="template"?n.content:n,tn(g)?g:[g],e,t,r,x=="foreignObject"?"http://www.w3.org/1999/xhtml":s,i,o,i?i[0]:t.__k&&zt(t,0),a,l),i!=null)for(c=i.length;c--;)Sr(i[c]);a||(c="value",x=="progress"&&f==null?n.removeAttribute("value"):f!=null&&(f!==n[c]||x=="progress"&&!f||x=="option"&&f!=b[c])&&wn(n,c,f,b[c],s),c="checked",m!=null&&m!=n[c]&&wn(n,c,m,b[c],s))}return n}function Rr(n,e,t){try{if(typeof n=="function"){var r=typeof n.__u=="function";r&&n.__u(),r&&e==null||(n.__u=n(e))}else n.current=e}catch(s){N.__e(s,t)}}function ui(n,e,t){var r,s;if(N.unmount&&N.unmount(n),(r=n.ref)&&(r.current&&r.current!=n.__e||Rr(r,null,e)),(r=n.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){N.__e(i,e)}r.base=r.__P=null}if(r=n.__k)for(s=0;s<r.length;s++)r[s]&&ui(r[s],e,t||typeof n.type!="function");t||Sr(n.__e),n.__c=n.__=n.__e=void 0}function $l(n,e,t){return this.constructor(n,t)}function Ct(n,e,t){var r,s,i,o;e==document&&(e=document.documentElement),N.__&&N.__(n,e),s=(r=typeof t=="function")?null:t&&t.__k||e.__k,i=[],o=[],Er(e,n=(!r&&t||e).__k=Qe(Te,null,[n]),s||en,en,e.namespaceURI,!r&&t?[t]:s?null:e.firstChild?Fe.call(e.childNodes):null,i,!r&&t?t:s?s.__e:e.firstChild,r,o),li(i,n,o)}function di(n,e){Ct(n,e,di)}function Nl(n,e,t){var r,s,i,o,a=Ke({},n.props);for(i in n.type&&n.type.defaultProps&&(o=n.type.defaultProps),e)i=="key"?r=e[i]:i=="ref"?s=e[i]:a[i]=e[i]===void 0&&o!=null?o[i]:e[i];return arguments.length>2&&(a.children=arguments.length>3?Fe.call(arguments,2):t),nn(n.type,a,r||n.key,s||n.ref,null)}function hi(n){function e(t){var r,s;return this.getChildContext||(r=new Set,(s={})[e.__c]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(i){this.props.value!=i.value&&r.forEach(function(o){o.__e=!0,Cr(o)})},this.sub=function(i){r.add(i);var o=i.componentWillUnmount;i.componentWillUnmount=function(){r&&r.delete(i),o&&o.call(i)}}),t.children}return e.__c="__cC"+ei++,e.__=n,e.Provider=e.__l=(e.Consumer=function(t,r){return t.children(r)}).contextType=e,e}Fe=ti.slice,N={__e:function(n,e,t,r){for(var s,i,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((i=s.constructor)&&i.getDerivedStateFromError!=null&&(s.setState(i.getDerivedStateFromError(n)),o=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(n,r||{}),o=s.__d),o)return s.__E=s}catch(a){n=a}throw n}},Js=0,We.prototype.setState=function(n,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ke({},this.state),typeof n=="function"&&(n=n(Ke({},t),this.props)),n&&Ke(t,n),n!=null&&this.__v&&(e&&this._sb.push(e),Cr(this))},We.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),Cr(this))},We.prototype.render=Te,St=[],Gs=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ks=function(n,e){return n.__v.__b-e.__v.__b},xn.__r=0,Qs=/(PointerCapture)$|Capture$/i,wr=0,kr=ai(!1),Tr=ai(!0),ei=0;var Ml=0;function p(n,e,t,r,s,i){e||(e={});var o,a,l=e;if("ref"in l)for(a in l={},e)a=="ref"?o=e[a]:l[a]=e[a];var c={type:n,props:l,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ml,__i:-1,__u:0,__source:s,__self:i};if(typeof n=="function"&&(o=n.defaultProps))for(a in o)l[a]===void 0&&(l[a]=o[a]);return N.vnode&&N.vnode(c),c}var dt,re,Or,fi,qt=0,pi=[],ue=N,gi=ue.__b,mi=ue.__r,bi=ue.diffed,_i=ue.__c,vi=ue.unmount,yi=ue.__;function Et(n,e){ue.__h&&ue.__h(re,n,qt||e),qt=0;var t=re.__H||(re.__H={__:[],__h:[]});return n>=t.__.length&&t.__.push({}),t.__[n]}function M(n){return qt=1,kn(wi,n)}function kn(n,e,t){var r=Et(dt++,2);if(r.t=n,!r.__c&&(r.__=[t?t(e):wi(void 0,e),function(a){var l=r.__N?r.__N[0]:r.__[0],c=r.t(l,a);l!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=re,!re.__f)){var s=function(a,l,c){if(!r.__c.__H)return!0;var u=r.__c.__H.__.filter(function(g){return!!g.__c});if(u.every(function(g){return!g.__N}))return!i||i.call(this,a,l,c);var d=r.__c.props!==a;return u.forEach(function(g){if(g.__N){var h=g.__[0];g.__=g.__N,g.__N=void 0,h!==g.__[0]&&(d=!0)}}),i&&i.call(this,a,l,c)||d};re.__f=!0;var i=re.shouldComponentUpdate,o=re.componentWillUpdate;re.componentWillUpdate=function(a,l,c){if(this.__e){var u=i;i=void 0,s(a,l,c),i=u}o&&o.call(this,a,l,c)},re.shouldComponentUpdate=s}return r.__N||r.__}function _e(n,e){var t=Et(dt++,3);!ue.__s&&Mr(t.__H,e)&&(t.__=n,t.u=e,re.__H.__h.push(t))}function Bt(n,e){var t=Et(dt++,4);!ue.__s&&Mr(t.__H,e)&&(t.__=n,t.u=e,re.__h.push(t))}function et(n){return qt=5,vt(function(){return{current:n}},[])}function Pr(n,e,t){qt=6,Bt(function(){if(typeof n=="function"){var r=n(e());return function(){n(null),r&&typeof r=="function"&&r()}}if(n)return n.current=e(),function(){return n.current=null}},t==null?t:t.concat(n))}function vt(n,e){var t=Et(dt++,7);return Mr(t.__H,e)&&(t.__=n(),t.__H=e,t.__h=n),t.__}function Ht(n,e){return qt=8,vt(function(){return n},e)}function Dr(n){var e=re.context[n.__c],t=Et(dt++,9);return t.c=n,e?(t.__==null&&(t.__=!0,e.sub(re)),e.props.value):n.__}function Ir(n,e){ue.useDebugValue&&ue.useDebugValue(e?e(n):n)}function Fl(n){var e=Et(dt++,10),t=M();return e.__=n,re.componentDidCatch||(re.componentDidCatch=function(r,s){e.__&&e.__(r,s),t[1](r)}),[t[0],function(){t[1](void 0)}]}function $r(){var n=Et(dt++,11);if(!n.__){for(var e=re.__v;e!==null&&!e.__m&&e.__!==null;)e=e.__;var t=e.__m||(e.__m=[0,0]);n.__="P"+t[0]+"-"+t[1]++}return n.__}function Ll(){for(var n;n=pi.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(Tn),n.__H.__h.forEach(Nr),n.__H.__h=[]}catch(e){n.__H.__h=[],ue.__e(e,n.__v)}}ue.__b=function(n){re=null,gi&&gi(n)},ue.__=function(n,e){n&&e.__k&&e.__k.__m&&(n.__m=e.__k.__m),yi&&yi(n,e)},ue.__r=function(n){mi&&mi(n),dt=0;var e=(re=n.__c).__H;e&&(Or===re?(e.__h=[],re.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(Tn),e.__h.forEach(Nr),e.__h=[],dt=0)),Or=re},ue.diffed=function(n){bi&&bi(n);var e=n.__c;e&&e.__H&&(e.__H.__h.length&&(pi.push(e)!==1&&fi===ue.requestAnimationFrame||((fi=ue.requestAnimationFrame)||jl)(Ll)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),Or=re=null},ue.__c=function(n,e){e.some(function(t){try{t.__h.forEach(Tn),t.__h=t.__h.filter(function(r){return!r.__||Nr(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],ue.__e(r,t.__v)}}),_i&&_i(n,e)},ue.unmount=function(n){vi&&vi(n);var e,t=n.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{Tn(r)}catch(s){e=s}}),t.__H=void 0,e&&ue.__e(e,t.__v))};var xi=typeof requestAnimationFrame=="function";function jl(n){var e,t=function(){clearTimeout(r),xi&&cancelAnimationFrame(e),setTimeout(n)},r=setTimeout(t,35);xi&&(e=requestAnimationFrame(t))}function Tn(n){var e=re,t=n.__c;typeof t=="function"&&(n.__c=void 0,t()),re=e}function Nr(n){var e=re;n.__c=n.__(),re=e}function Mr(n,e){return!n||n.length!==e.length||e.some(function(t,r){return t!==n[r]})}function wi(n,e){return typeof e=="function"?e(n):e}const ki=()=>{const n=Date.now();return`${Math.random().toString(36).substring(2,7)}_${n}`},Ul=(n,e,t={})=>n.replace(/\{([^}]+)\}/g,(r,s)=>{if(s.startsWith("res.")){const i=s.slice(4).split(/\.|\[(\d+)\]/).filter(Boolean);let o=t;for(const a of i)if(o&&o[a]!==void 0)o=o[a];else return"";return String(o??"")}return String(e[s]??"")});function ie(n,e){const t="https://media.robodialog.com/t/";if(!n.startsWith(t))return n;const r=n.slice(t.length);return`${t}w_${e},h_${e}/${r}`}const Sn=(n,e)=>{const t=JSON.stringify(e);localStorage.setItem(n,t)},Fr=n=>{if(typeof window>"u")return null;const e=localStorage.getItem(n);return e?JSON.parse(e):null};function Ti(n,e){return function(){return n.apply(e,arguments)}}const{toString:zl}=Object.prototype,{getPrototypeOf:Lr}=Object,{iterator:Cn,toStringTag:Si}=Symbol,En=(n=>e=>{const t=zl.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ve=n=>(n=n.toLowerCase(),e=>En(e)===n),An=n=>e=>typeof e===n,{isArray:Wt}=Array,Vt=An("undefined");function rn(n){return n!==null&&!Vt(n)&&n.constructor!==null&&!Vt(n.constructor)&&Pe(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const Ci=Ve("ArrayBuffer");function ql(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&Ci(n.buffer),e}const Bl=An("string"),Pe=An("function"),Ei=An("number"),sn=n=>n!==null&&typeof n=="object",Hl=n=>n===!0||n===!1,Rn=n=>{if(En(n)!=="object")return!1;const e=Lr(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Si in n)&&!(Cn in n)},Wl=n=>{if(!sn(n)||rn(n))return!1;try{return Object.keys(n).length===0&&Object.getPrototypeOf(n)===Object.prototype}catch{return!1}},Vl=Ve("Date"),Yl=Ve("File"),Xl=Ve("Blob"),Jl=Ve("FileList"),Zl=n=>sn(n)&&Pe(n.pipe),Gl=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Pe(n.append)&&((e=En(n))==="formdata"||e==="object"&&Pe(n.toString)&&n.toString()==="[object FormData]"))},Kl=Ve("URLSearchParams"),[Ql,ec,tc,nc]=["ReadableStream","Request","Response","Headers"].map(Ve),rc=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function on(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,s;if(typeof n!="object"&&(n=[n]),Wt(n))for(r=0,s=n.length;r<s;r++)e.call(null,n[r],r,n);else{if(rn(n))return;const i=t?Object.getOwnPropertyNames(n):Object.keys(n),o=i.length;let a;for(r=0;r<o;r++)a=i[r],e.call(null,n[a],a,n)}}function Ai(n,e){if(rn(n))return null;e=e.toLowerCase();const t=Object.keys(n);let r=t.length,s;for(;r-- >0;)if(s=t[r],e===s.toLowerCase())return s;return null}const At=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ri=n=>!Vt(n)&&n!==At;function jr(){const{caseless:n,skipUndefined:e}=Ri(this)&&this||{},t={},r=(s,i)=>{const o=n&&Ai(t,i)||i;Rn(t[o])&&Rn(s)?t[o]=jr(t[o],s):Rn(s)?t[o]=jr({},s):Wt(s)?t[o]=s.slice():(!e||!Vt(s))&&(t[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&on(arguments[s],r);return t}const sc=(n,e,t,{allOwnKeys:r}={})=>(on(e,(s,i)=>{t&&Pe(s)?n[i]=Ti(s,t):n[i]=s},{allOwnKeys:r}),n),ic=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),oc=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},ac=(n,e,t,r)=>{let s,i,o;const a={};if(e=e||{},n==null)return e;do{for(s=Object.getOwnPropertyNames(n),i=s.length;i-- >0;)o=s[i],(!r||r(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&Lr(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},lc=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return r!==-1&&r===t},cc=n=>{if(!n)return null;if(Wt(n))return n;let e=n.length;if(!Ei(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},uc=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&Lr(Uint8Array)),dc=(n,e)=>{const r=(n&&n[Cn]).call(n);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(n,i[0],i[1])}},hc=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},fc=Ve("HTMLFormElement"),pc=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,s){return r.toUpperCase()+s}),Oi=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),gc=Ve("RegExp"),Pi=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};on(t,(s,i)=>{let o;(o=e(s,i,n))!==!1&&(r[i]=o||s)}),Object.defineProperties(n,r)},mc=n=>{Pi(n,(e,t)=>{if(Pe(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(Pe(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},bc=(n,e)=>{const t={},r=s=>{s.forEach(i=>{t[i]=!0})};return Wt(n)?r(n):r(String(n).split(e)),t},_c=()=>{},vc=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e;function yc(n){return!!(n&&Pe(n.append)&&n[Si]==="FormData"&&n[Cn])}const xc=n=>{const e=new Array(10),t=(r,s)=>{if(sn(r)){if(e.indexOf(r)>=0)return;if(rn(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Wt(r)?[]:{};return on(r,(o,a)=>{const l=t(o,s+1);!Vt(l)&&(i[a]=l)}),e[s]=void 0,i}}return r};return t(n,0)},wc=Ve("AsyncFunction"),kc=n=>n&&(sn(n)||Pe(n))&&Pe(n.then)&&Pe(n.catch),Di=((n,e)=>n?setImmediate:e?((t,r)=>(At.addEventListener("message",({source:s,data:i})=>{s===At&&i===t&&r.length&&r.shift()()},!1),s=>{r.push(s),At.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Pe(At.postMessage)),Tc=typeof queueMicrotask<"u"?queueMicrotask.bind(At):typeof be<"u"&&be.nextTick||Di,y={isArray:Wt,isArrayBuffer:Ci,isBuffer:rn,isFormData:Gl,isArrayBufferView:ql,isString:Bl,isNumber:Ei,isBoolean:Hl,isObject:sn,isPlainObject:Rn,isEmptyObject:Wl,isReadableStream:Ql,isRequest:ec,isResponse:tc,isHeaders:nc,isUndefined:Vt,isDate:Vl,isFile:Yl,isBlob:Xl,isRegExp:gc,isFunction:Pe,isStream:Zl,isURLSearchParams:Kl,isTypedArray:uc,isFileList:Jl,forEach:on,merge:jr,extend:sc,trim:rc,stripBOM:ic,inherits:oc,toFlatObject:ac,kindOf:En,kindOfTest:Ve,endsWith:lc,toArray:cc,forEachEntry:dc,matchAll:hc,isHTMLForm:fc,hasOwnProperty:Oi,hasOwnProp:Oi,reduceDescriptors:Pi,freezeMethods:mc,toObjectSet:bc,toCamelCase:pc,noop:_c,toFiniteNumber:vc,findKey:Ai,global:At,isContextDefined:Ri,isSpecCompliantForm:yc,toJSONObject:xc,isAsyncFn:wc,isThenable:kc,setImmediate:Di,asap:Tc,isIterable:n=>n!=null&&Pe(n[Cn])};function L(n,e,t,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}y.inherits(L,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:y.toJSONObject(this.config),code:this.code,status:this.status}}});const Ii=L.prototype,$i={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{$i[n]={value:n}}),Object.defineProperties(L,$i),Object.defineProperty(Ii,"isAxiosError",{value:!0}),L.from=(n,e,t,r,s,i)=>{const o=Object.create(Ii);y.toFlatObject(n,o,function(u){return u!==Error.prototype},c=>c!=="isAxiosError");const a=n&&n.message?n.message:"Error",l=e==null&&n?n.code:e;return L.call(o,a,l,t,r,s),n&&o.cause==null&&Object.defineProperty(o,"cause",{value:n,configurable:!0}),o.name=n&&n.name||"Error",i&&Object.assign(o,i),o};const Sc=null;function Ur(n){return y.isPlainObject(n)||y.isArray(n)}function Ni(n){return y.endsWith(n,"[]")?n.slice(0,-2):n}function Mi(n,e,t){return n?n.concat(e).map(function(s,i){return s=Ni(s),!t&&i?"["+s+"]":s}).join(t?".":""):e}function Cc(n){return y.isArray(n)&&!n.some(Ur)}const Ec=y.toFlatObject(y,{},null,function(e){return/^is[A-Z]/.test(e)});function On(n,e,t){if(!y.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=y.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,b){return!y.isUndefined(b[m])});const r=t.metaTokens,s=t.visitor||u,i=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&y.isSpecCompliantForm(e);if(!y.isFunction(s))throw new TypeError("visitor must be a function");function c(f){if(f===null)return"";if(y.isDate(f))return f.toISOString();if(y.isBoolean(f))return f.toString();if(!l&&y.isBlob(f))throw new L("Blob is not supported. Use a Buffer instead.");return y.isArrayBuffer(f)||y.isTypedArray(f)?l&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,m,b){let v=f;if(f&&!b&&typeof f=="object"){if(y.endsWith(m,"{}"))m=r?m:m.slice(0,-2),f=JSON.stringify(f);else if(y.isArray(f)&&Cc(f)||(y.isFileList(f)||y.endsWith(m,"[]"))&&(v=y.toArray(f)))return m=Ni(m),v.forEach(function(w,k){!(y.isUndefined(w)||w===null)&&e.append(o===!0?Mi([m],k,i):o===null?m:m+"[]",c(w))}),!1}return Ur(f)?!0:(e.append(Mi(b,m,i),c(f)),!1)}const d=[],g=Object.assign(Ec,{defaultVisitor:u,convertValue:c,isVisitable:Ur});function h(f,m){if(!y.isUndefined(f)){if(d.indexOf(f)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(f),y.forEach(f,function(v,x){(!(y.isUndefined(v)||v===null)&&s.call(e,v,y.isString(x)?x.trim():x,m,g))===!0&&h(v,m?m.concat(x):[x])}),d.pop()}}if(!y.isObject(n))throw new TypeError("data must be an object");return h(n),e}function Fi(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function zr(n,e){this._pairs=[],n&&On(n,this,e)}const Li=zr.prototype;Li.append=function(e,t){this._pairs.push([e,t])},Li.toString=function(e){const t=e?function(r){return e.call(this,r,Fi)}:Fi;return this._pairs.map(function(s){return t(s[0])+"="+t(s[1])},"").join("&")};function Ac(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ji(n,e,t){if(!e)return n;const r=t&&t.encode||Ac;y.isFunction(t)&&(t={serialize:t});const s=t&&t.serialize;let i;if(s?i=s(e,t):i=y.isURLSearchParams(e)?e.toString():new zr(e,t).toString(r),i){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+i}return n}class Ui{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){y.forEach(this.handlers,function(r){r!==null&&e(r)})}}const zi={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Rc={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:zr,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},qr=typeof window<"u"&&typeof document<"u",Br=typeof navigator=="object"&&navigator||void 0,Oc=qr&&(!Br||["ReactNative","NativeScript","NS"].indexOf(Br.product)<0),Pc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Dc=qr&&window.location.href||"http://localhost",xe={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:qr,hasStandardBrowserEnv:Oc,hasStandardBrowserWebWorkerEnv:Pc,navigator:Br,origin:Dc},Symbol.toStringTag,{value:"Module"})),...Rc};function Ic(n,e){return On(n,new xe.classes.URLSearchParams,{visitor:function(t,r,s,i){return xe.isNode&&y.isBuffer(t)?(this.append(r,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function $c(n){return y.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Nc(n){const e={},t=Object.keys(n);let r;const s=t.length;let i;for(r=0;r<s;r++)i=t[r],e[i]=n[i];return e}function qi(n){function e(t,r,s,i){let o=t[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=i>=t.length;return o=!o&&y.isArray(s)?s.length:o,l?(y.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!a):((!s[o]||!y.isObject(s[o]))&&(s[o]=[]),e(t,r,s[o],i)&&y.isArray(s[o])&&(s[o]=Nc(s[o])),!a)}if(y.isFormData(n)&&y.isFunction(n.entries)){const t={};return y.forEachEntry(n,(r,s)=>{e($c(r),s,t,0)}),t}return null}function Mc(n,e,t){if(y.isString(n))try{return(e||JSON.parse)(n),y.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const an={transitional:zi,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",s=r.indexOf("application/json")>-1,i=y.isObject(e);if(i&&y.isHTMLForm(e)&&(e=new FormData(e)),y.isFormData(e))return s?JSON.stringify(qi(e)):e;if(y.isArrayBuffer(e)||y.isBuffer(e)||y.isStream(e)||y.isFile(e)||y.isBlob(e)||y.isReadableStream(e))return e;if(y.isArrayBufferView(e))return e.buffer;if(y.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Ic(e,this.formSerializer).toString();if((a=y.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return On(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return i||s?(t.setContentType("application/json",!1),Mc(e)):e}],transformResponse:[function(e){const t=this.transitional||an.transitional,r=t&&t.forcedJSONParsing,s=this.responseType==="json";if(y.isResponse(e)||y.isReadableStream(e))return e;if(e&&y.isString(e)&&(r&&!this.responseType||s)){const o=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?L.from(a,L.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:xe.classes.FormData,Blob:xe.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};y.forEach(["delete","get","head","post","put","patch"],n=>{an.headers[n]={}});const Fc=y.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Lc=n=>{const e={};let t,r,s;return n&&n.split(`
2
- `).forEach(function(o){s=o.indexOf(":"),t=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!t||e[t]&&Fc[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},Bi=Symbol("internals");function ln(n){return n&&String(n).trim().toLowerCase()}function Pn(n){return n===!1||n==null?n:y.isArray(n)?n.map(Pn):String(n)}function jc(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}const Uc=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function Hr(n,e,t,r,s){if(y.isFunction(r))return r.call(this,e,t);if(s&&(e=t),!!y.isString(e)){if(y.isString(r))return e.indexOf(r)!==-1;if(y.isRegExp(r))return r.test(e)}}function zc(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function qc(n,e){const t=y.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{value:function(s,i,o){return this[r].call(this,e,s,i,o)},configurable:!0})})}let De=class{constructor(e){e&&this.set(e)}set(e,t,r){const s=this;function i(a,l,c){const u=ln(l);if(!u)throw new Error("header name must be a non-empty string");const d=y.findKey(s,u);(!d||s[d]===void 0||c===!0||c===void 0&&s[d]!==!1)&&(s[d||l]=Pn(a))}const o=(a,l)=>y.forEach(a,(c,u)=>i(c,u,l));if(y.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(y.isString(e)&&(e=e.trim())&&!Uc(e))o(Lc(e),t);else if(y.isObject(e)&&y.isIterable(e)){let a={},l,c;for(const u of e){if(!y.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[c=u[0]]=(l=a[c])?y.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}o(a,t)}else e!=null&&i(t,e,r);return this}get(e,t){if(e=ln(e),e){const r=y.findKey(this,e);if(r){const s=this[r];if(!t)return s;if(t===!0)return jc(s);if(y.isFunction(t))return t.call(this,s,r);if(y.isRegExp(t))return t.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ln(e),e){const r=y.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||Hr(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let s=!1;function i(o){if(o=ln(o),o){const a=y.findKey(r,o);a&&(!t||Hr(r,r[a],a,t))&&(delete r[a],s=!0)}}return y.isArray(e)?e.forEach(i):i(e),s}clear(e){const t=Object.keys(this);let r=t.length,s=!1;for(;r--;){const i=t[r];(!e||Hr(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const t=this,r={};return y.forEach(this,(s,i)=>{const o=y.findKey(r,i);if(o){t[o]=Pn(s),delete t[i];return}const a=e?zc(i):String(i).trim();a!==i&&delete t[i],t[a]=Pn(s),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return y.forEach(this,(r,s)=>{r!=null&&r!==!1&&(t[s]=e&&y.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
3
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[Bi]=this[Bi]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=ln(o);r[a]||(qc(s,o),r[a]=!0)}return y.isArray(e)?e.forEach(i):i(e),this}};De.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),y.reduceDescriptors(De.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}}),y.freezeMethods(De);function Wr(n,e){const t=this||an,r=e||t,s=De.from(r.headers);let i=r.data;return y.forEach(n,function(a){i=a.call(t,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function Hi(n){return!!(n&&n.__CANCEL__)}function Yt(n,e,t){L.call(this,n??"canceled",L.ERR_CANCELED,e,t),this.name="CanceledError"}y.inherits(Yt,L,{__CANCEL__:!0});function Wi(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new L("Request failed with status code "+t.status,[L.ERR_BAD_REQUEST,L.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Bc(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function Hc(n,e){n=n||10;const t=new Array(n),r=new Array(n);let s=0,i=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=r[i];o||(o=c),t[s]=l,r[s]=c;let d=i,g=0;for(;d!==s;)g+=t[d++],d=d%n;if(s=(s+1)%n,s===i&&(i=(i+1)%n),c-o<e)return;const h=u&&c-u;return h?Math.round(g*1e3/h):void 0}}function Wc(n,e){let t=0,r=1e3/e,s,i;const o=(c,u=Date.now())=>{t=u,s=null,i&&(clearTimeout(i),i=null),n(...c)};return[(...c)=>{const u=Date.now(),d=u-t;d>=r?o(c,u):(s=c,i||(i=setTimeout(()=>{i=null,o(s)},r-d)))},()=>s&&o(s)]}const Dn=(n,e,t=3)=>{let r=0;const s=Hc(50,250);return Wc(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=o-r,c=s(l),u=o<=a;r=o;const d={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-o)/c:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(d)},t)},Vi=(n,e)=>{const t=n!=null;return[r=>e[0]({lengthComputable:t,total:n,loaded:r}),e[1]]},Yi=n=>(...e)=>y.asap(()=>n(...e)),Vc=xe.hasStandardBrowserEnv?((n,e)=>t=>(t=new URL(t,xe.origin),n.protocol===t.protocol&&n.host===t.host&&(e||n.port===t.port)))(new URL(xe.origin),xe.navigator&&/(msie|trident)/i.test(xe.navigator.userAgent)):()=>!0,Yc=xe.hasStandardBrowserEnv?{write(n,e,t,r,s,i,o){if(typeof document>"u")return;const a=[`${n}=${encodeURIComponent(e)}`];y.isNumber(t)&&a.push(`expires=${new Date(t).toUTCString()}`),y.isString(r)&&a.push(`path=${r}`),y.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),y.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(n){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+n+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(n){this.write(n,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Xc(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function Jc(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function Xi(n,e,t){let r=!Xc(e);return n&&(r||t==!1)?Jc(n,e):e}const Ji=n=>n instanceof De?{...n}:n;function Rt(n,e){e=e||{};const t={};function r(c,u,d,g){return y.isPlainObject(c)&&y.isPlainObject(u)?y.merge.call({caseless:g},c,u):y.isPlainObject(u)?y.merge({},u):y.isArray(u)?u.slice():u}function s(c,u,d,g){if(y.isUndefined(u)){if(!y.isUndefined(c))return r(void 0,c,d,g)}else return r(c,u,d,g)}function i(c,u){if(!y.isUndefined(u))return r(void 0,u)}function o(c,u){if(y.isUndefined(u)){if(!y.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function a(c,u,d){if(d in e)return r(c,u);if(d in n)return r(void 0,c)}const l={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,u,d)=>s(Ji(c),Ji(u),d,!0)};return y.forEach(Object.keys({...n,...e}),function(u){const d=l[u]||s,g=d(n[u],e[u],u);y.isUndefined(g)&&d!==a||(t[u]=g)}),t}const Zi=n=>{const e=Rt({},n);let{data:t,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=e;if(e.headers=o=De.from(o),e.url=ji(Xi(e.baseURL,e.url,e.allowAbsoluteUrls),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),y.isFormData(t)){if(xe.hasStandardBrowserEnv||xe.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(y.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,d])=>{c.includes(u.toLowerCase())&&o.set(u,d)})}}if(xe.hasStandardBrowserEnv&&(r&&y.isFunction(r)&&(r=r(e)),r||r!==!1&&Vc(e.url))){const l=s&&i&&Yc.read(i);l&&o.set(s,l)}return e},Zc=typeof XMLHttpRequest<"u"&&function(n){return new Promise(function(t,r){const s=Zi(n);let i=s.data;const o=De.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=s,u,d,g,h,f;function m(){h&&h(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(s.method.toUpperCase(),s.url,!0),b.timeout=s.timeout;function v(){if(!b)return;const w=De.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),_={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:w,config:n,request:b};Wi(function(P){t(P),m()},function(P){r(P),m()},_),b=null}"onloadend"in b?b.onloadend=v:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(v)},b.onabort=function(){b&&(r(new L("Request aborted",L.ECONNABORTED,n,b)),b=null)},b.onerror=function(k){const _=k&&k.message?k.message:"Network Error",S=new L(_,L.ERR_NETWORK,n,b);S.event=k||null,r(S),b=null},b.ontimeout=function(){let k=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const _=s.transitional||zi;s.timeoutErrorMessage&&(k=s.timeoutErrorMessage),r(new L(k,_.clarifyTimeoutError?L.ETIMEDOUT:L.ECONNABORTED,n,b)),b=null},i===void 0&&o.setContentType(null),"setRequestHeader"in b&&y.forEach(o.toJSON(),function(k,_){b.setRequestHeader(_,k)}),y.isUndefined(s.withCredentials)||(b.withCredentials=!!s.withCredentials),a&&a!=="json"&&(b.responseType=s.responseType),c&&([g,f]=Dn(c,!0),b.addEventListener("progress",g)),l&&b.upload&&([d,h]=Dn(l),b.upload.addEventListener("progress",d),b.upload.addEventListener("loadend",h)),(s.cancelToken||s.signal)&&(u=w=>{b&&(r(!w||w.type?new Yt(null,n,b):w),b.abort(),b=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const x=Bc(s.url);if(x&&xe.protocols.indexOf(x)===-1){r(new L("Unsupported protocol "+x+":",L.ERR_BAD_REQUEST,n));return}b.send(i||null)})},Gc=(n,e)=>{const{length:t}=n=n?n.filter(Boolean):[];if(e||t){let r=new AbortController,s;const i=function(c){if(!s){s=!0,a();const u=c instanceof Error?c:this.reason;r.abort(u instanceof L?u:new Yt(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,i(new L(`timeout ${e} of ms exceeded`,L.ETIMEDOUT))},e);const a=()=>{n&&(o&&clearTimeout(o),o=null,n.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),n=null)};n.forEach(c=>c.addEventListener("abort",i));const{signal:l}=r;return l.unsubscribe=()=>y.asap(a),l}},Kc=function*(n,e){let t=n.byteLength;if(t<e){yield n;return}let r=0,s;for(;r<t;)s=r+e,yield n.slice(r,s),r=s},Qc=async function*(n,e){for await(const t of eu(n))yield*Kc(t,e)},eu=async function*(n){if(n[Symbol.asyncIterator]){yield*n;return}const e=n.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}},Gi=(n,e,t,r)=>{const s=Qc(n,e);let i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await s.next();if(c){a(),l.close();return}let d=u.byteLength;if(t){let g=i+=d;t(g)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},Ki=64*1024,{isFunction:In}=y,tu=(({Request:n,Response:e})=>({Request:n,Response:e}))(y.global),{ReadableStream:Qi,TextEncoder:eo}=y.global,to=(n,...e)=>{try{return!!n(...e)}catch{return!1}},nu=n=>{n=y.merge.call({skipUndefined:!0},tu,n);const{fetch:e,Request:t,Response:r}=n,s=e?In(e):typeof fetch=="function",i=In(t),o=In(r);if(!s)return!1;const a=s&&In(Qi),l=s&&(typeof eo=="function"?(f=>m=>f.encode(m))(new eo):async f=>new Uint8Array(await new t(f).arrayBuffer())),c=i&&a&&to(()=>{let f=!1;const m=new t(xe.origin,{body:new Qi,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!m}),u=o&&a&&to(()=>y.isReadableStream(new r("").body)),d={stream:u&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!d[f]&&(d[f]=(m,b)=>{let v=m&&m[f];if(v)return v.call(m);throw new L(`Response type '${f}' is not supported`,L.ERR_NOT_SUPPORT,b)})});const g=async f=>{if(f==null)return 0;if(y.isBlob(f))return f.size;if(y.isSpecCompliantForm(f))return(await new t(xe.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(y.isArrayBufferView(f)||y.isArrayBuffer(f))return f.byteLength;if(y.isURLSearchParams(f)&&(f=f+""),y.isString(f))return(await l(f)).byteLength},h=async(f,m)=>{const b=y.toFiniteNumber(f.getContentLength());return b??g(m)};return async f=>{let{url:m,method:b,data:v,signal:x,cancelToken:w,timeout:k,onDownloadProgress:_,onUploadProgress:S,responseType:P,headers:T,withCredentials:A="same-origin",fetchOptions:D}=Zi(f),E=e||fetch;P=P?(P+"").toLowerCase():"text";let j=Gc([x,w&&w.toAbortSignal()],k),Z=null;const se=j&&j.unsubscribe&&(()=>{j.unsubscribe()});let Oe;try{if(S&&c&&b!=="get"&&b!=="head"&&(Oe=await h(T,v))!==0){let R=new t(m,{method:"POST",body:v,duplex:"half"}),$;if(y.isFormData(v)&&($=R.headers.get("content-type"))&&T.setContentType($),R.body){const[F,I]=Vi(Oe,Dn(Yi(S)));v=Gi(R.body,Ki,F,I)}}y.isString(A)||(A=A?"include":"omit");const G=i&&"credentials"in t.prototype,ye={...D,signal:j,method:b.toUpperCase(),headers:T.normalize().toJSON(),body:v,duplex:"half",credentials:G?A:void 0};Z=i&&new t(m,ye);let he=await(i?E(Z,D):E(m,ye));const Be=u&&(P==="stream"||P==="response");if(u&&(_||Be&&se)){const R={};["status","statusText","headers"].forEach(q=>{R[q]=he[q]});const $=y.toFiniteNumber(he.headers.get("content-length")),[F,I]=_&&Vi($,Dn(Yi(_),!0))||[];he=new r(Gi(he.body,Ki,F,()=>{I&&I(),se&&se()}),R)}P=P||"text";let C=await d[y.findKey(d,P)||"text"](he,f);return!Be&&se&&se(),await new Promise((R,$)=>{Wi(R,$,{data:C,headers:De.from(he.headers),status:he.status,statusText:he.statusText,config:f,request:Z})})}catch(G){throw se&&se(),G&&G.name==="TypeError"&&/Load failed|fetch/i.test(G.message)?Object.assign(new L("Network Error",L.ERR_NETWORK,f,Z),{cause:G.cause||G}):L.from(G,G&&G.code,f,Z)}}},ru=new Map,no=n=>{let e=n&&n.env||{};const{fetch:t,Request:r,Response:s}=e,i=[r,s,t];let o=i.length,a=o,l,c,u=ru;for(;a--;)l=i[a],c=u.get(l),c===void 0&&u.set(l,c=a?new Map:nu(e)),u=c;return c};no();const Vr={http:Sc,xhr:Zc,fetch:{get:no}};y.forEach(Vr,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const ro=n=>`- ${n}`,su=n=>y.isFunction(n)||n===null||n===!1;function iu(n,e){n=y.isArray(n)?n:[n];const{length:t}=n;let r,s;const i={};for(let o=0;o<t;o++){r=n[o];let a;if(s=r,!su(r)&&(s=Vr[(a=String(r)).toLowerCase()],s===void 0))throw new L(`Unknown adapter '${a}'`);if(s&&(y.isFunction(s)||(s=s.get(e))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=t?o.length>1?`since :
4
- `+o.map(ro).join(`
5
- `):" "+ro(o[0]):"as no adapter specified";throw new L("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const so={getAdapter:iu,adapters:Vr};function Yr(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new Yt(null,n)}function io(n){return Yr(n),n.headers=De.from(n.headers),n.data=Wr.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),so.getAdapter(n.adapter||an.adapter,n)(n).then(function(r){return Yr(n),r.data=Wr.call(n,n.transformResponse,r),r.headers=De.from(r.headers),r},function(r){return Hi(r)||(Yr(n),r&&r.response&&(r.response.data=Wr.call(n,n.transformResponse,r.response),r.response.headers=De.from(r.response.headers))),Promise.reject(r)})}const oo="1.13.2",$n={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{$n[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const ao={};$n.transitional=function(e,t,r){function s(i,o){return"[Axios v"+oo+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(e===!1)throw new L(s(o," has been removed"+(t?" in "+t:"")),L.ERR_DEPRECATED);return t&&!ao[o]&&(ao[o]=!0,console.warn(s(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,o,a):!0}},$n.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function ou(n,e,t){if(typeof n!="object")throw new L("options must be an object",L.ERR_BAD_OPTION_VALUE);const r=Object.keys(n);let s=r.length;for(;s-- >0;){const i=r[s],o=e[i];if(o){const a=n[i],l=a===void 0||o(a,i,n);if(l!==!0)throw new L("option "+i+" must be "+l,L.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new L("Unknown option "+i,L.ERR_BAD_OPTION)}}const Nn={assertOptions:ou,validators:$n},tt=Nn.validators;let Ot=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ui,response:new Ui}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
6
- `+i):r.stack=i}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Rt(this.defaults,t);const{transitional:r,paramsSerializer:s,headers:i}=t;r!==void 0&&Nn.assertOptions(r,{silentJSONParsing:tt.transitional(tt.boolean),forcedJSONParsing:tt.transitional(tt.boolean),clarifyTimeoutError:tt.transitional(tt.boolean)},!1),s!=null&&(y.isFunction(s)?t.paramsSerializer={serialize:s}:Nn.assertOptions(s,{encode:tt.function,serialize:tt.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Nn.assertOptions(t,{baseUrl:tt.spelling("baseURL"),withXsrfToken:tt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&y.merge(i.common,i[t.method]);i&&y.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),t.headers=De.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(t)===!1||(l=l&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let u,d=0,g;if(!l){const f=[io.bind(this),void 0];for(f.unshift(...a),f.push(...c),g=f.length,u=Promise.resolve(t);d<g;)u=u.then(f[d++],f[d++]);return u}g=a.length;let h=t;for(;d<g;){const f=a[d++],m=a[d++];try{h=f(h)}catch(b){m.call(this,b);break}}try{u=io.call(this,h)}catch(f){return Promise.reject(f)}for(d=0,g=c.length;d<g;)u=u.then(c[d++],c[d++]);return u}getUri(e){e=Rt(this.defaults,e);const t=Xi(e.baseURL,e.url,e.allowAbsoluteUrls);return ji(t,e.params,e.paramsSerializer)}};y.forEach(["delete","get","head","options"],function(e){Ot.prototype[e]=function(t,r){return this.request(Rt(r||{},{method:e,url:t,data:(r||{}).data}))}}),y.forEach(["post","put","patch"],function(e){function t(r){return function(i,o,a){return this.request(Rt(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Ot.prototype[e]=t(),Ot.prototype[e+"Form"]=t(!0)});let au=class Rl{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},e(function(i,o,a){r.reason||(r.reason=new Yt(i,o,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Rl(function(s){e=s}),cancel:e}}};function lu(n){return function(t){return n.apply(null,t)}}function cu(n){return y.isObject(n)&&n.isAxiosError===!0}const Xr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Xr).forEach(([n,e])=>{Xr[e]=n});function lo(n){const e=new Ot(n),t=Ti(Ot.prototype.request,e);return y.extend(t,Ot.prototype,e,{allOwnKeys:!0}),y.extend(t,e,null,{allOwnKeys:!0}),t.create=function(s){return lo(Rt(n,s))},t}const pe=lo(an);pe.Axios=Ot,pe.CanceledError=Yt,pe.CancelToken=au,pe.isCancel=Hi,pe.VERSION=oo,pe.toFormData=On,pe.AxiosError=L,pe.Cancel=pe.CanceledError,pe.all=function(e){return Promise.all(e)},pe.spread=lu,pe.isAxiosError=cu,pe.mergeConfig=Rt,pe.AxiosHeaders=De,pe.formToJSON=n=>qi(y.isHTMLForm(n)?new FormData(n):n),pe.getAdapter=so.getAdapter,pe.HttpStatusCode=Xr,pe.default=pe;const{Axios:Np,AxiosError:Mp,CanceledError:Fp,isCancel:Lp,CancelToken:jp,VERSION:Up,all:zp,Cancel:qp,isAxiosError:Bp,spread:Hp,toFormData:Wp,AxiosHeaders:Vp,HttpStatusCode:Yp,formToJSON:Xp,getAdapter:Jp,mergeConfig:Zp}=pe,uu="https://api.robodialog.com",du="wss://realtime.robodialog.com/connection/websocket",co=uu+"/api/v1",Ie=pe.create({baseURL:co,headers:{"Content-Type":"application/json"}});function uo(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function hu(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}),t}function Pt(n){this._maxSize=n,this.clear()}Pt.prototype.clear=function(){this._size=0,this._values=Object.create(null)},Pt.prototype.get=function(n){return this._values[n]},Pt.prototype.set=function(n,e){return this._size>=this._maxSize&&this.clear(),n in this._values||this._size++,this._values[n]=e};var fu=/[^.^\]^[]+|(?=\[\]|\.\.)/g,ho=/^\d+$/,pu=/^\d/,gu=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,mu=/^\s*(['"]?)(.*?)(\1)\s*$/,Jr=512,fo=new Pt(Jr),po=new Pt(Jr),go=new Pt(Jr),Dt={Cache:Pt,split:Gr,normalizePath:Zr,setter:function(n){var e=Zr(n);return po.get(n)||po.set(n,function(r,s){for(var i=0,o=e.length,a=r;i<o-1;){var l=e[i];if(l==="__proto__"||l==="constructor"||l==="prototype")return r;a=a[e[i++]]}a[e[i]]=s})},getter:function(n,e){var t=Zr(n);return go.get(n)||go.set(n,function(s){for(var i=0,o=t.length;i<o;)if(s!=null||!e)s=s[t[i++]];else return;return s})},join:function(n){return n.reduce(function(e,t){return e+(Kr(t)||ho.test(t)?"["+t+"]":(e?".":"")+t)},"")},forEach:function(n,e,t){bu(Array.isArray(n)?n:Gr(n),e,t)}};function Zr(n){return fo.get(n)||fo.set(n,Gr(n).map(function(e){return e.replace(mu,"$2")}))}function Gr(n){return n.match(fu)||[""]}function bu(n,e,t){var r=n.length,s,i,o,a;for(i=0;i<r;i++)s=n[i],s&&(yu(s)&&(s='"'+s+'"'),a=Kr(s),o=!a&&/^\d+$/.test(s),e.call(t,s,a,o,i,n))}function Kr(n){return typeof n=="string"&&n&&["'",'"'].indexOf(n.charAt(0))!==-1}function _u(n){return n.match(pu)&&!n.match(ho)}function vu(n){return gu.test(n)}function yu(n){return!Kr(n)&&(_u(n)||vu(n))}const xu=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,Mn=n=>n.match(xu)||[],Fn=n=>n[0].toUpperCase()+n.slice(1),Qr=(n,e)=>Mn(n).join(e).toLowerCase(),mo=n=>Mn(n).reduce((e,t)=>`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,"");var es={words:Mn,upperFirst:Fn,camelCase:mo,pascalCase:n=>Fn(mo(n)),snakeCase:n=>Qr(n,"_"),kebabCase:n=>Qr(n,"-"),sentenceCase:n=>Fn(Qr(n," ")),titleCase:n=>Mn(n).map(Fn).join(" ")},ts={exports:{}};ts.exports=function(n){return bo(wu(n),n)},ts.exports.array=bo;function bo(n,e){var t=n.length,r=new Array(t),s={},i=t,o=ku(e),a=Tu(n);for(e.forEach(function(c){if(!a.has(c[0])||!a.has(c[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});i--;)s[i]||l(n[i],i,new Set);return r;function l(c,u,d){if(d.has(c)){var g;try{g=", node was:"+JSON.stringify(c)}catch{g=""}throw new Error("Cyclic dependency"+g)}if(!a.has(c))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(c));if(!s[u]){s[u]=!0;var h=o.get(c)||new Set;if(h=Array.from(h),u=h.length){d.add(c);do{var f=h[--u];l(f,a.get(f),d)}while(u);d.delete(c)}r[--t]=c}}}function wu(n){for(var e=new Set,t=0,r=n.length;t<r;t++){var s=n[t];e.add(s[0]),e.add(s[1])}return Array.from(e)}function ku(n){for(var e=new Map,t=0,r=n.length;t<r;t++){var s=n[t];e.has(s[0])||e.set(s[0],new Set),e.has(s[1])||e.set(s[1],new Set),e.get(s[0]).add(s[1])}return e}function Tu(n){for(var e=new Map,t=0,r=n.length;t<r;t++)e.set(n[t],t);return e}var Su=ts.exports;const Cu=uo(Su),Eu=Object.prototype.toString,Au=Error.prototype.toString,Ru=RegExp.prototype.toString,Ou=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Pu=/^Symbol\((.*)\)(.*)$/;function Du(n){return n!=+n?"NaN":n===0&&1/n<0?"-0":""+n}function _o(n,e=!1){if(n==null||n===!0||n===!1)return""+n;const t=typeof n;if(t==="number")return Du(n);if(t==="string")return e?`"${n}"`:n;if(t==="function")return"[Function "+(n.name||"anonymous")+"]";if(t==="symbol")return Ou.call(n).replace(Pu,"Symbol($1)");const r=Eu.call(n).slice(8,-1);return r==="Date"?isNaN(n.getTime())?""+n:n.toISOString(n):r==="Error"||n instanceof Error?"["+Au.call(n)+"]":r==="RegExp"?Ru.call(n):null}function ht(n,e){let t=_o(n,e);return t!==null?t:JSON.stringify(n,function(r,s){let i=_o(this[r],e);return i!==null?i:s},2)}function vo(n){return n==null?[]:[].concat(n)}let yo,xo,wo,Iu=/\$\{\s*(\w+)\s*\}/g;yo=Symbol.toStringTag;class ko{constructor(e,t,r,s){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[yo]="Error",this.name="ValidationError",this.value=t,this.path=r,this.type=s,this.errors=[],this.inner=[],vo(e).forEach(i=>{if(ve.isError(i)){this.errors.push(...i.errors);const o=i.inner.length?i.inner:[i];this.inner.push(...o)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}xo=Symbol.hasInstance,wo=Symbol.toStringTag;class ve extends Error{static formatError(e,t){const r=t.label||t.path||"this";return t=Object.assign({},t,{path:r,originalPath:t.path}),typeof e=="string"?e.replace(Iu,(s,i)=>ht(t[i])):typeof e=="function"?e(t):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,t,r,s,i){const o=new ko(e,t,r,s);if(i)return o;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[wo]="Error",this.name=o.name,this.message=o.message,this.type=o.type,this.value=o.value,this.path=o.path,this.errors=o.errors,this.inner=o.inner,Error.captureStackTrace&&Error.captureStackTrace(this,ve)}static[xo](e){return ko[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let nt={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:n,type:e,value:t,originalValue:r})=>{const s=r!=null&&r!==t?` (cast from the value \`${ht(r,!0)}\`).`:".";return e!=="mixed"?`${n} must be a \`${e}\` type, but the final value was: \`${ht(t,!0)}\``+s:`${n} must match the configured type. The validated value was: \`${ht(t,!0)}\``+s}},$e={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},yt={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},ns={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},rs={isValue:"${path} field must be ${value}"},Ln={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},jn={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"};Object.assign(Object.create(null),{mixed:nt,string:$e,number:yt,date:ns,object:Ln,array:jn,boolean:rs,tuple:{notType:n=>{const{path:e,value:t,spec:r}=n,s=r.types.length;if(Array.isArray(t)){if(t.length<s)return`${e} tuple value has too few items, expected a length of ${s} but got ${t.length} for value: \`${ht(t,!0)}\``;if(t.length>s)return`${e} tuple value has too many items, expected a length of ${s} but got ${t.length} for value: \`${ht(t,!0)}\``}return ve.formatError(nt.notType,n)}}});const Un=n=>n&&n.__isYupSchema__;class zn{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:s,otherwise:i}=t,o=typeof r=="function"?r:(...a)=>a.every(l=>l===r);return new zn(e,(a,l)=>{var c;let u=o(...a)?s:i;return(c=u==null?void 0:u(l))!=null?c:l})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let r=this.refs.map(i=>i.getValue(t==null?void 0:t.value,t==null?void 0:t.parent,t==null?void 0:t.context)),s=this.fn(r,e,t);if(s===void 0||s===e)return e;if(!Un(s))throw new TypeError("conditions must return a schema object");return s.resolve(t)}}const qn={context:"$",value:"."};class It{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===qn.context,this.isValue=this.key[0]===qn.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?qn.context:this.isValue?qn.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Dt.getter(this.path,!0),this.map=t.map}getValue(e,t,r){let s=this.isContext?r:this.isValue?e:t;return this.getter&&(s=this.getter(s||{})),this.map&&(s=this.map(s)),s}cast(e,t){return this.getValue(e,t==null?void 0:t.parent,t==null?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}It.prototype.__isYupRef=!0;const Ye=n=>n==null;function Xt(n){function e({value:t,path:r="",options:s,originalValue:i,schema:o},a,l){const{name:c,test:u,params:d,message:g,skipAbsent:h}=n;let{parent:f,context:m,abortEarly:b=o.spec.abortEarly,disableStackTrace:v=o.spec.disableStackTrace}=s;const x={value:t,parent:f,context:m};function w(E={}){const j=To(Object.assign({value:t,originalValue:i,label:o.spec.label,path:E.path||r,spec:o.spec,disableStackTrace:E.disableStackTrace||v},d,E.params),x),Z=new ve(ve.formatError(E.message||g,j),t,j.path,E.type||c,j.disableStackTrace);return Z.params=j,Z}const k=b?a:l;let _={path:r,parent:f,type:c,from:s.from,createError:w,resolve(E){return So(E,x)},options:s,originalValue:i,schema:o};const S=E=>{ve.isError(E)?k(E):E?l(null):k(w())},P=E=>{ve.isError(E)?k(E):a(E)};if(h&&Ye(t))return S(!0);let A;try{var D;if(A=u.call(_,t,_),typeof((D=A)==null?void 0:D.then)=="function"){if(s.sync)throw new Error(`Validation test of type: "${_.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(A).then(S,P)}}catch(E){P(E);return}S(A)}return e.OPTIONS=n,e}function To(n,e){if(!n)return n;for(const t of Object.keys(n))n[t]=So(n[t],e);return n}function So(n,e){return It.isRef(n)?n.getValue(e.value,e.parent,e.context):n}function $u(n,e,t,r=t){let s,i,o;return e?(Dt.forEach(e,(a,l,c)=>{let u=l?a.slice(1,a.length-1):a;n=n.resolve({context:r,parent:s,value:t});let d=n.type==="tuple",g=c?parseInt(u,10):0;if(n.innerType||d){if(d&&!c)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(t&&g>=t.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${e}. because there is no value at that index. `);s=t,t=t&&t[g],n=d?n.spec.types[g]:n.innerType}if(!c){if(!n.fields||!n.fields[u])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${o} which is a type: "${n.type}")`);s=t,t=t&&t[u],n=n.fields[u]}i=u,o=l?"["+a+"]":"."+a}),{schema:n,parent:s,parentPath:i}):{parent:s,parentPath:e,schema:n}}class Bn extends Set{describe(){const e=[];for(const t of this.values())e.push(It.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const r of this.values())t.push(e(r));return t}clone(){return new Bn(this.values())}merge(e,t){const r=this.clone();return e.forEach(s=>r.add(s)),t.forEach(s=>r.delete(s)),r}}function Jt(n,e=new Map){if(Un(n)||!n||typeof n!="object")return n;if(e.has(n))return e.get(n);let t;if(n instanceof Date)t=new Date(n.getTime()),e.set(n,t);else if(n instanceof RegExp)t=new RegExp(n),e.set(n,t);else if(Array.isArray(n)){t=new Array(n.length),e.set(n,t);for(let r=0;r<n.length;r++)t[r]=Jt(n[r],e)}else if(n instanceof Map){t=new Map,e.set(n,t);for(const[r,s]of n.entries())t.set(r,Jt(s,e))}else if(n instanceof Set){t=new Set,e.set(n,t);for(const r of n)t.add(Jt(r,e))}else if(n instanceof Object){t={},e.set(n,t);for(const[r,s]of Object.entries(n))t[r]=Jt(s,e)}else throw Error(`Unable to clone ${n}`);return t}function Nu(n){if(!(n!=null&&n.length))return;const e=[];let t="",r=!1,s=!1;for(let i=0;i<n.length;i++){const o=n[i];if(o==="["&&!s){t&&(e.push(...t.split(".").filter(Boolean)),t=""),r=!0;continue}if(o==="]"&&!s){t&&(/^\d+$/.test(t)?e.push(t):e.push(t.replace(/^"|"$/g,"")),t=""),r=!1;continue}if(o==='"'){s=!s;continue}if(o==="."&&!r&&!s){t&&(e.push(t),t="");continue}t+=o}return t&&e.push(...t.split(".").filter(Boolean)),e}function Mu(n,e){const t=e?`${e}.${n.path}`:n.path;return n.errors.map(r=>({message:r,path:Nu(t)}))}function Co(n,e){var t;if(!((t=n.inner)!=null&&t.length)&&n.errors.length)return Mu(n,e);const r=e?`${e}.${n.path}`:n.path;return n.inner.flatMap(s=>Co(s,r))}class Le{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new Bn,this._blacklist=new Bn,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(nt.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(t=>{t.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=Jt(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(e.length===0)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=t,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,r=e.clone();const s=Object.assign({},t.spec,r.spec);return r.spec=s,r.internalTests=Object.assign({},t.internalTests,r.internalTests),r._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),r.tests=t.tests,r.exclusiveTests=t.exclusiveTests,r.withMutation(i=>{e.tests.forEach(o=>{i.test(o.OPTIONS)})}),r.transforms=[...t.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let r=t.conditions;t=t.clone(),t.conditions=[],t=r.reduce((s,i)=>i.resolve(s,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,r,s,i;return Object.assign({},e,{from:e.from||[],strict:(t=e.strict)!=null?t:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(s=e.recursive)!=null?s:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,t={}){let r=this.resolve(Object.assign({},t,{value:e})),s=t.assert==="ignore-optionality",i=r._cast(e,t);if(t.assert!==!1&&!r.isType(i)){if(s&&Ye(i))return i;let o=ht(e),a=ht(i);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
1
+ var Cp=Object.defineProperty;var Ep=(me,Me,N)=>Me in me?Cp(me,Me,{enumerable:!0,configurable:!0,writable:!0,value:N}):me[Me]=N;var ne=(me,Me,N)=>Ep(me,typeof Me!="symbol"?Me+"":Me,N);(function(){"use strict";var gr;var me={env:{}},Me,N,Xs,Tt,Js,Zs,Gs,Ks,xr,wr,kr,Qs,Qt={},ei=[],Rl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,en=Array.isArray;function Ge(n,e){for(var t in e)n[t]=e[t];return n}function Tr(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function Ke(n,e,t){var r,s,i,o={};for(i in e)i=="key"?r=e[i]:i=="ref"?s=e[i]:o[i]=e[i];if(arguments.length>2&&(o.children=arguments.length>3?Me.call(arguments,2):t),typeof n=="function"&&n.defaultProps!=null)for(i in n.defaultProps)o[i]===void 0&&(o[i]=n.defaultProps[i]);return tn(n,o,r,s,null)}function tn(n,e,t,r,s){var i={type:n,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++Xs,__i:-1,__u:0};return s==null&&N.vnode!=null&&N.vnode(i),i}function ti(){return{current:null}}function ke(n){return n.children}function He(n,e){this.props=n,this.context=e}function Ut(n,e){if(e==null)return n.__?Ut(n.__,n.__i+1):null;for(var t;e<n.__k.length;e++)if((t=n.__k[e])!=null&&t.__e!=null)return t.__e;return typeof n.type=="function"?Ut(n):null}function ni(n){var e,t;if((n=n.__)!=null&&n.__c!=null){for(n.__e=n.__c.base=null,e=0;e<n.__k.length;e++)if((t=n.__k[e])!=null&&t.__e!=null){n.__e=n.__c.base=t.__e;break}return ni(n)}}function Sr(n){(!n.__d&&(n.__d=!0)&&Tt.push(n)&&!yn.__r++||Js!=N.debounceRendering)&&((Js=N.debounceRendering)||Zs)(yn)}function yn(){for(var n,e,t,r,s,i,o,a=1;Tt.length;)Tt.length>a&&Tt.sort(Gs),n=Tt.shift(),a=Tt.length,n.__d&&(t=void 0,r=void 0,s=(r=(e=n).__v).__e,i=[],o=[],e.__P&&((t=Ge({},r)).__v=r.__v+1,N.vnode&&N.vnode(t),Cr(e.__P,t,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,i,s??Ut(r),!!(32&r.__u),o),t.__v=r.__v,t.__.__k[t.__i]=t,ai(i,t,o),r.__e=r.__=null,t.__e!=s&&ni(t)));yn.__r=0}function ri(n,e,t,r,s,i,o,a,l,c,u){var d,g,h,f,m,b,v,x=r&&r.__k||ei,w=e.length;for(l=Ol(t,e,x,l,w),d=0;d<w;d++)(h=t.__k[d])!=null&&(g=h.__i==-1?Qt:x[h.__i]||Qt,h.__i=d,b=Cr(n,h,g,s,i,o,a,l,c,u),f=h.__e,h.ref&&g.ref!=h.ref&&(g.ref&&Ar(g.ref,null,h),u.push(h.ref,h.__c||f,h)),m==null&&f!=null&&(m=f),(v=!!(4&h.__u))||g.__k===h.__k?l=si(h,l,n,v):typeof h.type=="function"&&b!==void 0?l=b:f&&(l=f.nextSibling),h.__u&=-7);return t.__e=m,l}function Ol(n,e,t,r,s){var i,o,a,l,c,u=t.length,d=u,g=0;for(n.__k=new Array(s),i=0;i<s;i++)(o=e[i])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=n.__k[i]=tn(null,o,null,null,null):en(o)?o=n.__k[i]=tn(ke,{children:o},null,null,null):o.constructor==null&&o.__b>0?o=n.__k[i]=tn(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):n.__k[i]=o,l=i+g,o.__=n,o.__b=n.__b+1,(c=o.__i=Pl(o,t,l,d))!=-1&&(d--,(a=t[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(s>u?g--:s<u&&g++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?g--:c==l+1?g++:(c>l?g--:g++,o.__u|=4))):n.__k[i]=null;if(d)for(i=0;i<u;i++)(a=t[i])!=null&&!(2&a.__u)&&(a.__e==r&&(r=Ut(a)),ci(a,a));return r}function si(n,e,t,r){var s,i;if(typeof n.type=="function"){for(s=n.__k,i=0;s&&i<s.length;i++)s[i]&&(s[i].__=n,e=si(s[i],e,t,r));return e}n.__e!=e&&(r&&(e&&n.type&&!e.parentNode&&(e=Ut(n)),t.insertBefore(n.__e,e||null)),e=n.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function ct(n,e){return e=e||[],n==null||typeof n=="boolean"||(en(n)?n.some(function(t){ct(t,e)}):e.push(n)),e}function Pl(n,e,t,r){var s,i,o,a=n.key,l=n.type,c=e[t],u=c!=null&&(2&c.__u)==0;if(c===null&&a==null||u&&a==c.key&&l==c.type)return t;if(r>(u?1:0)){for(s=t-1,i=t+1;s>=0||i<e.length;)if((c=e[o=s>=0?s--:i++])!=null&&!(2&c.__u)&&a==c.key&&l==c.type)return o}return-1}function ii(n,e,t){e[0]=="-"?n.setProperty(e,t??""):n[e]=t==null?"":typeof t!="number"||Rl.test(e)?t:t+"px"}function xn(n,e,t,r,s){var i,o;e:if(e=="style")if(typeof t=="string")n.style.cssText=t;else{if(typeof r=="string"&&(n.style.cssText=r=""),r)for(e in r)t&&e in t||ii(n.style,e,"");if(t)for(e in t)r&&t[e]==r[e]||ii(n.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")i=e!=(e=e.replace(Ks,"$1")),o=e.toLowerCase(),e=o in n||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),n.l||(n.l={}),n.l[e+i]=t,t?r?t.u=r.u:(t.u=xr,n.addEventListener(e,i?kr:wr,i)):n.removeEventListener(e,i?kr:wr,i);else{if(s=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in n)try{n[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?n.removeAttribute(e):n.setAttribute(e,e=="popover"&&t==1?"":t))}}function oi(n){return function(e){if(this.l){var t=this.l[e.type+n];if(e.t==null)e.t=xr++;else if(e.t<t.u)return;return t(N.event?N.event(e):e)}}}function Cr(n,e,t,r,s,i,o,a,l,c){var u,d,g,h,f,m,b,v,x,w,k,_,S,P,T,A,D,E=e.type;if(e.constructor!=null)return null;128&t.__u&&(l=!!(32&t.__u),i=[a=e.__e=t.__e]),(u=N.__b)&&u(e);e:if(typeof E=="function")try{if(v=e.props,x="prototype"in E&&E.prototype.render,w=(u=E.contextType)&&r[u.__c],k=u?w?w.props.value:u.__:r,t.__c?b=(d=e.__c=t.__c).__=d.__E:(x?e.__c=d=new E(v,k):(e.__c=d=new He(v,k),d.constructor=E,d.render=Il),w&&w.sub(d),d.state||(d.state={}),d.__n=r,g=d.__d=!0,d.__h=[],d._sb=[]),x&&d.__s==null&&(d.__s=d.state),x&&E.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Ge({},d.__s)),Ge(d.__s,E.getDerivedStateFromProps(v,d.__s))),h=d.props,f=d.state,d.__v=e,g)x&&E.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),x&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(x&&E.getDerivedStateFromProps==null&&v!==h&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(v,k),e.__v==t.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(v,d.__s,k)===!1){for(e.__v!=t.__v&&(d.props=v,d.state=d.__s,d.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(j){j&&(j.__=e)}),_=0;_<d._sb.length;_++)d.__h.push(d._sb[_]);d._sb=[],d.__h.length&&o.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(v,d.__s,k),x&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(h,f,m)})}if(d.context=k,d.props=v,d.__P=n,d.__e=!1,S=N.__r,P=0,x){for(d.state=d.__s,d.__d=!1,S&&S(e),u=d.render(d.props,d.state,d.context),T=0;T<d._sb.length;T++)d.__h.push(d._sb[T]);d._sb=[]}else do d.__d=!1,S&&S(e),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++P<25);d.state=d.__s,d.getChildContext!=null&&(r=Ge(Ge({},r),d.getChildContext())),x&&!g&&d.getSnapshotBeforeUpdate!=null&&(m=d.getSnapshotBeforeUpdate(h,f)),A=u,u!=null&&u.type===ke&&u.key==null&&(A=li(u.props.children)),a=ri(n,en(A)?A:[A],e,t,r,s,i,o,a,l,c),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),b&&(d.__E=d.__=null)}catch(j){if(e.__v=null,l||i!=null)if(j.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,e.__e=a}else{for(D=i.length;D--;)Tr(i[D]);Er(e)}else e.__e=t.__e,e.__k=t.__k,j.then||Er(e);N.__e(j,e,t)}else i==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=Dl(t.__e,e,t,r,s,i,o,l,c);return(u=N.diffed)&&u(e),128&e.__u?void 0:a}function Er(n){n&&n.__c&&(n.__c.__e=!0),n&&n.__k&&n.__k.forEach(Er)}function ai(n,e,t){for(var r=0;r<t.length;r++)Ar(t[r],t[++r],t[++r]);N.__c&&N.__c(e,n),n.some(function(s){try{n=s.__h,s.__h=[],n.some(function(i){i.call(s)})}catch(i){N.__e(i,s.__v)}})}function li(n){return typeof n!="object"||n==null||n.__b&&n.__b>0?n:en(n)?n.map(li):Ge({},n)}function Dl(n,e,t,r,s,i,o,a,l){var c,u,d,g,h,f,m,b=t.props||Qt,v=e.props,x=e.type;if(x=="svg"?s="http://www.w3.org/2000/svg":x=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((h=i[c])&&"setAttribute"in h==!!x&&(x?h.localName==x:h.nodeType==3)){n=h,i[c]=null;break}}if(n==null){if(x==null)return document.createTextNode(v);n=document.createElementNS(s,x,v.is&&v),a&&(N.__m&&N.__m(e,i),a=!1),i=null}if(x==null)b===v||a&&n.data==v||(n.data=v);else{if(i=i&&Me.call(n.childNodes),!a&&i!=null)for(b={},c=0;c<n.attributes.length;c++)b[(h=n.attributes[c]).name]=h.value;for(c in b)if(h=b[c],c!="children"){if(c=="dangerouslySetInnerHTML")d=h;else if(!(c in v)){if(c=="value"&&"defaultValue"in v||c=="checked"&&"defaultChecked"in v)continue;xn(n,c,null,h,s)}}for(c in v)h=v[c],c=="children"?g=h:c=="dangerouslySetInnerHTML"?u=h:c=="value"?f=h:c=="checked"?m=h:a&&typeof h!="function"||b[c]===h||xn(n,c,h,b[c],s);if(u)a||d&&(u.__html==d.__html||u.__html==n.innerHTML)||(n.innerHTML=u.__html),e.__k=[];else if(d&&(n.innerHTML=""),ri(e.type=="template"?n.content:n,en(g)?g:[g],e,t,r,x=="foreignObject"?"http://www.w3.org/1999/xhtml":s,i,o,i?i[0]:t.__k&&Ut(t,0),a,l),i!=null)for(c=i.length;c--;)Tr(i[c]);a||(c="value",x=="progress"&&f==null?n.removeAttribute("value"):f!=null&&(f!==n[c]||x=="progress"&&!f||x=="option"&&f!=b[c])&&xn(n,c,f,b[c],s),c="checked",m!=null&&m!=n[c]&&xn(n,c,m,b[c],s))}return n}function Ar(n,e,t){try{if(typeof n=="function"){var r=typeof n.__u=="function";r&&n.__u(),r&&e==null||(n.__u=n(e))}else n.current=e}catch(s){N.__e(s,t)}}function ci(n,e,t){var r,s;if(N.unmount&&N.unmount(n),(r=n.ref)&&(r.current&&r.current!=n.__e||Ar(r,null,e)),(r=n.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){N.__e(i,e)}r.base=r.__P=null}if(r=n.__k)for(s=0;s<r.length;s++)r[s]&&ci(r[s],e,t||typeof n.type!="function");t||Tr(n.__e),n.__c=n.__=n.__e=void 0}function Il(n,e,t){return this.constructor(n,t)}function St(n,e,t){var r,s,i,o;e==document&&(e=document.documentElement),N.__&&N.__(n,e),s=(r=typeof t=="function")?null:t&&t.__k||e.__k,i=[],o=[],Cr(e,n=(!r&&t||e).__k=Ke(ke,null,[n]),s||Qt,Qt,e.namespaceURI,!r&&t?[t]:s?null:e.firstChild?Me.call(e.childNodes):null,i,!r&&t?t:s?s.__e:e.firstChild,r,o),ai(i,n,o)}function ui(n,e){St(n,e,ui)}function $l(n,e,t){var r,s,i,o,a=Ge({},n.props);for(i in n.type&&n.type.defaultProps&&(o=n.type.defaultProps),e)i=="key"?r=e[i]:i=="ref"?s=e[i]:a[i]=e[i]===void 0&&o!=null?o[i]:e[i];return arguments.length>2&&(a.children=arguments.length>3?Me.call(arguments,2):t),tn(n.type,a,r||n.key,s||n.ref,null)}function di(n){function e(t){var r,s;return this.getChildContext||(r=new Set,(s={})[e.__c]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(i){this.props.value!=i.value&&r.forEach(function(o){o.__e=!0,Sr(o)})},this.sub=function(i){r.add(i);var o=i.componentWillUnmount;i.componentWillUnmount=function(){r&&r.delete(i),o&&o.call(i)}}),t.children}return e.__c="__cC"+Qs++,e.__=n,e.Provider=e.__l=(e.Consumer=function(t,r){return t.children(r)}).contextType=e,e}Me=ei.slice,N={__e:function(n,e,t,r){for(var s,i,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((i=s.constructor)&&i.getDerivedStateFromError!=null&&(s.setState(i.getDerivedStateFromError(n)),o=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(n,r||{}),o=s.__d),o)return s.__E=s}catch(a){n=a}throw n}},Xs=0,He.prototype.setState=function(n,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ge({},this.state),typeof n=="function"&&(n=n(Ge({},t),this.props)),n&&Ge(t,n),n!=null&&this.__v&&(e&&this._sb.push(e),Sr(this))},He.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),Sr(this))},He.prototype.render=ke,Tt=[],Zs=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Gs=function(n,e){return n.__v.__b-e.__v.__b},yn.__r=0,Ks=/(PointerCapture)$|Capture$/i,xr=0,wr=oi(!1),kr=oi(!0),Qs=0;var Nl=0;function p(n,e,t,r,s,i){e||(e={});var o,a,l=e;if("ref"in l)for(a in l={},e)a=="ref"?o=e[a]:l[a]=e[a];var c={type:n,props:l,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Nl,__i:-1,__u:0,__source:s,__self:i};if(typeof n=="function"&&(o=n.defaultProps))for(a in o)l[a]===void 0&&(l[a]=o[a]);return N.vnode&&N.vnode(c),c}var ut,re,Rr,hi,zt=0,fi=[],ce=N,pi=ce.__b,gi=ce.__r,mi=ce.diffed,bi=ce.__c,_i=ce.unmount,vi=ce.__;function Ct(n,e){ce.__h&&ce.__h(re,n,zt||e),zt=0;var t=re.__H||(re.__H={__:[],__h:[]});return n>=t.__.length&&t.__.push({}),t.__[n]}function M(n){return zt=1,wn(xi,n)}function wn(n,e,t){var r=Ct(ut++,2);if(r.t=n,!r.__c&&(r.__=[t?t(e):xi(void 0,e),function(a){var l=r.__N?r.__N[0]:r.__[0],c=r.t(l,a);l!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=re,!re.__f)){var s=function(a,l,c){if(!r.__c.__H)return!0;var u=r.__c.__H.__.filter(function(g){return!!g.__c});if(u.every(function(g){return!g.__N}))return!i||i.call(this,a,l,c);var d=r.__c.props!==a;return u.forEach(function(g){if(g.__N){var h=g.__[0];g.__=g.__N,g.__N=void 0,h!==g.__[0]&&(d=!0)}}),i&&i.call(this,a,l,c)||d};re.__f=!0;var i=re.shouldComponentUpdate,o=re.componentWillUpdate;re.componentWillUpdate=function(a,l,c){if(this.__e){var u=i;i=void 0,s(a,l,c),i=u}o&&o.call(this,a,l,c)},re.shouldComponentUpdate=s}return r.__N||r.__}function be(n,e){var t=Ct(ut++,3);!ce.__s&&Nr(t.__H,e)&&(t.__=n,t.u=e,re.__H.__h.push(t))}function qt(n,e){var t=Ct(ut++,4);!ce.__s&&Nr(t.__H,e)&&(t.__=n,t.u=e,re.__h.push(t))}function Qe(n){return zt=5,_t(function(){return{current:n}},[])}function Or(n,e,t){zt=6,qt(function(){if(typeof n=="function"){var r=n(e());return function(){n(null),r&&typeof r=="function"&&r()}}if(n)return n.current=e(),function(){return n.current=null}},t==null?t:t.concat(n))}function _t(n,e){var t=Ct(ut++,7);return Nr(t.__H,e)&&(t.__=n(),t.__H=e,t.__h=n),t.__}function Bt(n,e){return zt=8,_t(function(){return n},e)}function Pr(n){var e=re.context[n.__c],t=Ct(ut++,9);return t.c=n,e?(t.__==null&&(t.__=!0,e.sub(re)),e.props.value):n.__}function Dr(n,e){ce.useDebugValue&&ce.useDebugValue(e?e(n):n)}function Ml(n){var e=Ct(ut++,10),t=M();return e.__=n,re.componentDidCatch||(re.componentDidCatch=function(r,s){e.__&&e.__(r,s),t[1](r)}),[t[0],function(){t[1](void 0)}]}function Ir(){var n=Ct(ut++,11);if(!n.__){for(var e=re.__v;e!==null&&!e.__m&&e.__!==null;)e=e.__;var t=e.__m||(e.__m=[0,0]);n.__="P"+t[0]+"-"+t[1]++}return n.__}function Fl(){for(var n;n=fi.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(kn),n.__H.__h.forEach($r),n.__H.__h=[]}catch(e){n.__H.__h=[],ce.__e(e,n.__v)}}ce.__b=function(n){re=null,pi&&pi(n)},ce.__=function(n,e){n&&e.__k&&e.__k.__m&&(n.__m=e.__k.__m),vi&&vi(n,e)},ce.__r=function(n){gi&&gi(n),ut=0;var e=(re=n.__c).__H;e&&(Rr===re?(e.__h=[],re.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(kn),e.__h.forEach($r),e.__h=[],ut=0)),Rr=re},ce.diffed=function(n){mi&&mi(n);var e=n.__c;e&&e.__H&&(e.__H.__h.length&&(fi.push(e)!==1&&hi===ce.requestAnimationFrame||((hi=ce.requestAnimationFrame)||Ll)(Fl)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),Rr=re=null},ce.__c=function(n,e){e.some(function(t){try{t.__h.forEach(kn),t.__h=t.__h.filter(function(r){return!r.__||$r(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],ce.__e(r,t.__v)}}),bi&&bi(n,e)},ce.unmount=function(n){_i&&_i(n);var e,t=n.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{kn(r)}catch(s){e=s}}),t.__H=void 0,e&&ce.__e(e,t.__v))};var yi=typeof requestAnimationFrame=="function";function Ll(n){var e,t=function(){clearTimeout(r),yi&&cancelAnimationFrame(e),setTimeout(n)},r=setTimeout(t,35);yi&&(e=requestAnimationFrame(t))}function kn(n){var e=re,t=n.__c;typeof t=="function"&&(n.__c=void 0,t()),re=e}function $r(n){var e=re;n.__c=n.__(),re=e}function Nr(n,e){return!n||n.length!==e.length||e.some(function(t,r){return t!==n[r]})}function xi(n,e){return typeof e=="function"?e(n):e}const wi=()=>{const n=Date.now();return`${Math.random().toString(36).substring(2,7)}_${n}`},jl=(n,e,t={})=>n.replace(/\{([^}]+)\}/g,(r,s)=>{if(s.startsWith("res.")){const i=s.slice(4).split(/\.|\[(\d+)\]/).filter(Boolean);let o=t;for(const a of i)if(o&&o[a]!==void 0)o=o[a];else return"";return String(o??"")}return String(e[s]??"")}),Tn=(n,e)=>{const t=JSON.stringify(e);localStorage.setItem(n,t)},Mr=n=>{if(typeof window>"u")return null;const e=localStorage.getItem(n);return e?JSON.parse(e):null};function ki(n,e){return function(){return n.apply(e,arguments)}}const{toString:Ul}=Object.prototype,{getPrototypeOf:Fr}=Object,{iterator:Sn,toStringTag:Ti}=Symbol,Cn=(n=>e=>{const t=Ul.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),We=n=>(n=n.toLowerCase(),e=>Cn(e)===n),En=n=>e=>typeof e===n,{isArray:Ht}=Array,Wt=En("undefined");function nn(n){return n!==null&&!Wt(n)&&n.constructor!==null&&!Wt(n.constructor)&&Oe(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const Si=We("ArrayBuffer");function zl(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&Si(n.buffer),e}const ql=En("string"),Oe=En("function"),Ci=En("number"),rn=n=>n!==null&&typeof n=="object",Bl=n=>n===!0||n===!1,An=n=>{if(Cn(n)!=="object")return!1;const e=Fr(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Ti in n)&&!(Sn in n)},Hl=n=>{if(!rn(n)||nn(n))return!1;try{return Object.keys(n).length===0&&Object.getPrototypeOf(n)===Object.prototype}catch{return!1}},Wl=We("Date"),Vl=We("File"),Yl=We("Blob"),Xl=We("FileList"),Jl=n=>rn(n)&&Oe(n.pipe),Zl=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Oe(n.append)&&((e=Cn(n))==="formdata"||e==="object"&&Oe(n.toString)&&n.toString()==="[object FormData]"))},Gl=We("URLSearchParams"),[Kl,Ql,ec,tc]=["ReadableStream","Request","Response","Headers"].map(We),nc=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function sn(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,s;if(typeof n!="object"&&(n=[n]),Ht(n))for(r=0,s=n.length;r<s;r++)e.call(null,n[r],r,n);else{if(nn(n))return;const i=t?Object.getOwnPropertyNames(n):Object.keys(n),o=i.length;let a;for(r=0;r<o;r++)a=i[r],e.call(null,n[a],a,n)}}function Ei(n,e){if(nn(n))return null;e=e.toLowerCase();const t=Object.keys(n);let r=t.length,s;for(;r-- >0;)if(s=t[r],e===s.toLowerCase())return s;return null}const Et=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ai=n=>!Wt(n)&&n!==Et;function Lr(){const{caseless:n,skipUndefined:e}=Ai(this)&&this||{},t={},r=(s,i)=>{const o=n&&Ei(t,i)||i;An(t[o])&&An(s)?t[o]=Lr(t[o],s):An(s)?t[o]=Lr({},s):Ht(s)?t[o]=s.slice():(!e||!Wt(s))&&(t[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&sn(arguments[s],r);return t}const rc=(n,e,t,{allOwnKeys:r}={})=>(sn(e,(s,i)=>{t&&Oe(s)?n[i]=ki(s,t):n[i]=s},{allOwnKeys:r}),n),sc=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),ic=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},oc=(n,e,t,r)=>{let s,i,o;const a={};if(e=e||{},n==null)return e;do{for(s=Object.getOwnPropertyNames(n),i=s.length;i-- >0;)o=s[i],(!r||r(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&Fr(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},ac=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return r!==-1&&r===t},lc=n=>{if(!n)return null;if(Ht(n))return n;let e=n.length;if(!Ci(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},cc=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&Fr(Uint8Array)),uc=(n,e)=>{const r=(n&&n[Sn]).call(n);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(n,i[0],i[1])}},dc=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},hc=We("HTMLFormElement"),fc=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,s){return r.toUpperCase()+s}),Ri=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),pc=We("RegExp"),Oi=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};sn(t,(s,i)=>{let o;(o=e(s,i,n))!==!1&&(r[i]=o||s)}),Object.defineProperties(n,r)},gc=n=>{Oi(n,(e,t)=>{if(Oe(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(Oe(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},mc=(n,e)=>{const t={},r=s=>{s.forEach(i=>{t[i]=!0})};return Ht(n)?r(n):r(String(n).split(e)),t},bc=()=>{},_c=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e;function vc(n){return!!(n&&Oe(n.append)&&n[Ti]==="FormData"&&n[Sn])}const yc=n=>{const e=new Array(10),t=(r,s)=>{if(rn(r)){if(e.indexOf(r)>=0)return;if(nn(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Ht(r)?[]:{};return sn(r,(o,a)=>{const l=t(o,s+1);!Wt(l)&&(i[a]=l)}),e[s]=void 0,i}}return r};return t(n,0)},xc=We("AsyncFunction"),wc=n=>n&&(rn(n)||Oe(n))&&Oe(n.then)&&Oe(n.catch),Pi=((n,e)=>n?setImmediate:e?((t,r)=>(Et.addEventListener("message",({source:s,data:i})=>{s===Et&&i===t&&r.length&&r.shift()()},!1),s=>{r.push(s),Et.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Oe(Et.postMessage)),kc=typeof queueMicrotask<"u"?queueMicrotask.bind(Et):typeof me<"u"&&me.nextTick||Pi,y={isArray:Ht,isArrayBuffer:Si,isBuffer:nn,isFormData:Zl,isArrayBufferView:zl,isString:ql,isNumber:Ci,isBoolean:Bl,isObject:rn,isPlainObject:An,isEmptyObject:Hl,isReadableStream:Kl,isRequest:Ql,isResponse:ec,isHeaders:tc,isUndefined:Wt,isDate:Wl,isFile:Vl,isBlob:Yl,isRegExp:pc,isFunction:Oe,isStream:Jl,isURLSearchParams:Gl,isTypedArray:cc,isFileList:Xl,forEach:sn,merge:Lr,extend:rc,trim:nc,stripBOM:sc,inherits:ic,toFlatObject:oc,kindOf:Cn,kindOfTest:We,endsWith:ac,toArray:lc,forEachEntry:uc,matchAll:dc,isHTMLForm:hc,hasOwnProperty:Ri,hasOwnProp:Ri,reduceDescriptors:Oi,freezeMethods:gc,toObjectSet:mc,toCamelCase:fc,noop:bc,toFiniteNumber:_c,findKey:Ei,global:Et,isContextDefined:Ai,isSpecCompliantForm:vc,toJSONObject:yc,isAsyncFn:xc,isThenable:wc,setImmediate:Pi,asap:kc,isIterable:n=>n!=null&&Oe(n[Sn])};function L(n,e,t,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}y.inherits(L,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:y.toJSONObject(this.config),code:this.code,status:this.status}}});const Di=L.prototype,Ii={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{Ii[n]={value:n}}),Object.defineProperties(L,Ii),Object.defineProperty(Di,"isAxiosError",{value:!0}),L.from=(n,e,t,r,s,i)=>{const o=Object.create(Di);y.toFlatObject(n,o,function(u){return u!==Error.prototype},c=>c!=="isAxiosError");const a=n&&n.message?n.message:"Error",l=e==null&&n?n.code:e;return L.call(o,a,l,t,r,s),n&&o.cause==null&&Object.defineProperty(o,"cause",{value:n,configurable:!0}),o.name=n&&n.name||"Error",i&&Object.assign(o,i),o};const Tc=null;function jr(n){return y.isPlainObject(n)||y.isArray(n)}function $i(n){return y.endsWith(n,"[]")?n.slice(0,-2):n}function Ni(n,e,t){return n?n.concat(e).map(function(s,i){return s=$i(s),!t&&i?"["+s+"]":s}).join(t?".":""):e}function Sc(n){return y.isArray(n)&&!n.some(jr)}const Cc=y.toFlatObject(y,{},null,function(e){return/^is[A-Z]/.test(e)});function Rn(n,e,t){if(!y.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=y.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,b){return!y.isUndefined(b[m])});const r=t.metaTokens,s=t.visitor||u,i=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&y.isSpecCompliantForm(e);if(!y.isFunction(s))throw new TypeError("visitor must be a function");function c(f){if(f===null)return"";if(y.isDate(f))return f.toISOString();if(y.isBoolean(f))return f.toString();if(!l&&y.isBlob(f))throw new L("Blob is not supported. Use a Buffer instead.");return y.isArrayBuffer(f)||y.isTypedArray(f)?l&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,m,b){let v=f;if(f&&!b&&typeof f=="object"){if(y.endsWith(m,"{}"))m=r?m:m.slice(0,-2),f=JSON.stringify(f);else if(y.isArray(f)&&Sc(f)||(y.isFileList(f)||y.endsWith(m,"[]"))&&(v=y.toArray(f)))return m=$i(m),v.forEach(function(w,k){!(y.isUndefined(w)||w===null)&&e.append(o===!0?Ni([m],k,i):o===null?m:m+"[]",c(w))}),!1}return jr(f)?!0:(e.append(Ni(b,m,i),c(f)),!1)}const d=[],g=Object.assign(Cc,{defaultVisitor:u,convertValue:c,isVisitable:jr});function h(f,m){if(!y.isUndefined(f)){if(d.indexOf(f)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(f),y.forEach(f,function(v,x){(!(y.isUndefined(v)||v===null)&&s.call(e,v,y.isString(x)?x.trim():x,m,g))===!0&&h(v,m?m.concat(x):[x])}),d.pop()}}if(!y.isObject(n))throw new TypeError("data must be an object");return h(n),e}function Mi(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Ur(n,e){this._pairs=[],n&&Rn(n,this,e)}const Fi=Ur.prototype;Fi.append=function(e,t){this._pairs.push([e,t])},Fi.toString=function(e){const t=e?function(r){return e.call(this,r,Mi)}:Mi;return this._pairs.map(function(s){return t(s[0])+"="+t(s[1])},"").join("&")};function Ec(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Li(n,e,t){if(!e)return n;const r=t&&t.encode||Ec;y.isFunction(t)&&(t={serialize:t});const s=t&&t.serialize;let i;if(s?i=s(e,t):i=y.isURLSearchParams(e)?e.toString():new Ur(e,t).toString(r),i){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+i}return n}class ji{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){y.forEach(this.handlers,function(r){r!==null&&e(r)})}}const Ui={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ac={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ur,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},zr=typeof window<"u"&&typeof document<"u",qr=typeof navigator=="object"&&navigator||void 0,Rc=zr&&(!qr||["ReactNative","NativeScript","NS"].indexOf(qr.product)<0),Oc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Pc=zr&&window.location.href||"http://localhost",ye={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:zr,hasStandardBrowserEnv:Rc,hasStandardBrowserWebWorkerEnv:Oc,navigator:qr,origin:Pc},Symbol.toStringTag,{value:"Module"})),...Ac};function Dc(n,e){return Rn(n,new ye.classes.URLSearchParams,{visitor:function(t,r,s,i){return ye.isNode&&y.isBuffer(t)?(this.append(r,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function Ic(n){return y.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function $c(n){const e={},t=Object.keys(n);let r;const s=t.length;let i;for(r=0;r<s;r++)i=t[r],e[i]=n[i];return e}function zi(n){function e(t,r,s,i){let o=t[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=i>=t.length;return o=!o&&y.isArray(s)?s.length:o,l?(y.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!a):((!s[o]||!y.isObject(s[o]))&&(s[o]=[]),e(t,r,s[o],i)&&y.isArray(s[o])&&(s[o]=$c(s[o])),!a)}if(y.isFormData(n)&&y.isFunction(n.entries)){const t={};return y.forEachEntry(n,(r,s)=>{e(Ic(r),s,t,0)}),t}return null}function Nc(n,e,t){if(y.isString(n))try{return(e||JSON.parse)(n),y.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const on={transitional:Ui,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",s=r.indexOf("application/json")>-1,i=y.isObject(e);if(i&&y.isHTMLForm(e)&&(e=new FormData(e)),y.isFormData(e))return s?JSON.stringify(zi(e)):e;if(y.isArrayBuffer(e)||y.isBuffer(e)||y.isStream(e)||y.isFile(e)||y.isBlob(e)||y.isReadableStream(e))return e;if(y.isArrayBufferView(e))return e.buffer;if(y.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Dc(e,this.formSerializer).toString();if((a=y.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Rn(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return i||s?(t.setContentType("application/json",!1),Nc(e)):e}],transformResponse:[function(e){const t=this.transitional||on.transitional,r=t&&t.forcedJSONParsing,s=this.responseType==="json";if(y.isResponse(e)||y.isReadableStream(e))return e;if(e&&y.isString(e)&&(r&&!this.responseType||s)){const o=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?L.from(a,L.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ye.classes.FormData,Blob:ye.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};y.forEach(["delete","get","head","post","put","patch"],n=>{on.headers[n]={}});const Mc=y.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Fc=n=>{const e={};let t,r,s;return n&&n.split(`
2
+ `).forEach(function(o){s=o.indexOf(":"),t=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!t||e[t]&&Mc[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},qi=Symbol("internals");function an(n){return n&&String(n).trim().toLowerCase()}function On(n){return n===!1||n==null?n:y.isArray(n)?n.map(On):String(n)}function Lc(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}const jc=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function Br(n,e,t,r,s){if(y.isFunction(r))return r.call(this,e,t);if(s&&(e=t),!!y.isString(e)){if(y.isString(r))return e.indexOf(r)!==-1;if(y.isRegExp(r))return r.test(e)}}function Uc(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function zc(n,e){const t=y.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{value:function(s,i,o){return this[r].call(this,e,s,i,o)},configurable:!0})})}let Pe=class{constructor(e){e&&this.set(e)}set(e,t,r){const s=this;function i(a,l,c){const u=an(l);if(!u)throw new Error("header name must be a non-empty string");const d=y.findKey(s,u);(!d||s[d]===void 0||c===!0||c===void 0&&s[d]!==!1)&&(s[d||l]=On(a))}const o=(a,l)=>y.forEach(a,(c,u)=>i(c,u,l));if(y.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(y.isString(e)&&(e=e.trim())&&!jc(e))o(Fc(e),t);else if(y.isObject(e)&&y.isIterable(e)){let a={},l,c;for(const u of e){if(!y.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[c=u[0]]=(l=a[c])?y.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}o(a,t)}else e!=null&&i(t,e,r);return this}get(e,t){if(e=an(e),e){const r=y.findKey(this,e);if(r){const s=this[r];if(!t)return s;if(t===!0)return Lc(s);if(y.isFunction(t))return t.call(this,s,r);if(y.isRegExp(t))return t.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=an(e),e){const r=y.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||Br(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let s=!1;function i(o){if(o=an(o),o){const a=y.findKey(r,o);a&&(!t||Br(r,r[a],a,t))&&(delete r[a],s=!0)}}return y.isArray(e)?e.forEach(i):i(e),s}clear(e){const t=Object.keys(this);let r=t.length,s=!1;for(;r--;){const i=t[r];(!e||Br(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const t=this,r={};return y.forEach(this,(s,i)=>{const o=y.findKey(r,i);if(o){t[o]=On(s),delete t[i];return}const a=e?Uc(i):String(i).trim();a!==i&&delete t[i],t[a]=On(s),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return y.forEach(this,(r,s)=>{r!=null&&r!==!1&&(t[s]=e&&y.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[qi]=this[qi]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=an(o);r[a]||(zc(s,o),r[a]=!0)}return y.isArray(e)?e.forEach(i):i(e),this}};Pe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),y.reduceDescriptors(Pe.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}}),y.freezeMethods(Pe);function Hr(n,e){const t=this||on,r=e||t,s=Pe.from(r.headers);let i=r.data;return y.forEach(n,function(a){i=a.call(t,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function Bi(n){return!!(n&&n.__CANCEL__)}function Vt(n,e,t){L.call(this,n??"canceled",L.ERR_CANCELED,e,t),this.name="CanceledError"}y.inherits(Vt,L,{__CANCEL__:!0});function Hi(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new L("Request failed with status code "+t.status,[L.ERR_BAD_REQUEST,L.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function qc(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function Bc(n,e){n=n||10;const t=new Array(n),r=new Array(n);let s=0,i=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=r[i];o||(o=c),t[s]=l,r[s]=c;let d=i,g=0;for(;d!==s;)g+=t[d++],d=d%n;if(s=(s+1)%n,s===i&&(i=(i+1)%n),c-o<e)return;const h=u&&c-u;return h?Math.round(g*1e3/h):void 0}}function Hc(n,e){let t=0,r=1e3/e,s,i;const o=(c,u=Date.now())=>{t=u,s=null,i&&(clearTimeout(i),i=null),n(...c)};return[(...c)=>{const u=Date.now(),d=u-t;d>=r?o(c,u):(s=c,i||(i=setTimeout(()=>{i=null,o(s)},r-d)))},()=>s&&o(s)]}const Pn=(n,e,t=3)=>{let r=0;const s=Bc(50,250);return Hc(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=o-r,c=s(l),u=o<=a;r=o;const d={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-o)/c:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(d)},t)},Wi=(n,e)=>{const t=n!=null;return[r=>e[0]({lengthComputable:t,total:n,loaded:r}),e[1]]},Vi=n=>(...e)=>y.asap(()=>n(...e)),Wc=ye.hasStandardBrowserEnv?((n,e)=>t=>(t=new URL(t,ye.origin),n.protocol===t.protocol&&n.host===t.host&&(e||n.port===t.port)))(new URL(ye.origin),ye.navigator&&/(msie|trident)/i.test(ye.navigator.userAgent)):()=>!0,Vc=ye.hasStandardBrowserEnv?{write(n,e,t,r,s,i,o){if(typeof document>"u")return;const a=[`${n}=${encodeURIComponent(e)}`];y.isNumber(t)&&a.push(`expires=${new Date(t).toUTCString()}`),y.isString(r)&&a.push(`path=${r}`),y.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),y.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(n){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+n+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(n){this.write(n,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Yc(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function Xc(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function Yi(n,e,t){let r=!Yc(e);return n&&(r||t==!1)?Xc(n,e):e}const Xi=n=>n instanceof Pe?{...n}:n;function At(n,e){e=e||{};const t={};function r(c,u,d,g){return y.isPlainObject(c)&&y.isPlainObject(u)?y.merge.call({caseless:g},c,u):y.isPlainObject(u)?y.merge({},u):y.isArray(u)?u.slice():u}function s(c,u,d,g){if(y.isUndefined(u)){if(!y.isUndefined(c))return r(void 0,c,d,g)}else return r(c,u,d,g)}function i(c,u){if(!y.isUndefined(u))return r(void 0,u)}function o(c,u){if(y.isUndefined(u)){if(!y.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function a(c,u,d){if(d in e)return r(c,u);if(d in n)return r(void 0,c)}const l={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,u,d)=>s(Xi(c),Xi(u),d,!0)};return y.forEach(Object.keys({...n,...e}),function(u){const d=l[u]||s,g=d(n[u],e[u],u);y.isUndefined(g)&&d!==a||(t[u]=g)}),t}const Ji=n=>{const e=At({},n);let{data:t,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=e;if(e.headers=o=Pe.from(o),e.url=Li(Yi(e.baseURL,e.url,e.allowAbsoluteUrls),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),y.isFormData(t)){if(ye.hasStandardBrowserEnv||ye.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(y.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,d])=>{c.includes(u.toLowerCase())&&o.set(u,d)})}}if(ye.hasStandardBrowserEnv&&(r&&y.isFunction(r)&&(r=r(e)),r||r!==!1&&Wc(e.url))){const l=s&&i&&Vc.read(i);l&&o.set(s,l)}return e},Jc=typeof XMLHttpRequest<"u"&&function(n){return new Promise(function(t,r){const s=Ji(n);let i=s.data;const o=Pe.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=s,u,d,g,h,f;function m(){h&&h(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(s.method.toUpperCase(),s.url,!0),b.timeout=s.timeout;function v(){if(!b)return;const w=Pe.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),_={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:w,config:n,request:b};Hi(function(P){t(P),m()},function(P){r(P),m()},_),b=null}"onloadend"in b?b.onloadend=v:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(v)},b.onabort=function(){b&&(r(new L("Request aborted",L.ECONNABORTED,n,b)),b=null)},b.onerror=function(k){const _=k&&k.message?k.message:"Network Error",S=new L(_,L.ERR_NETWORK,n,b);S.event=k||null,r(S),b=null},b.ontimeout=function(){let k=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const _=s.transitional||Ui;s.timeoutErrorMessage&&(k=s.timeoutErrorMessage),r(new L(k,_.clarifyTimeoutError?L.ETIMEDOUT:L.ECONNABORTED,n,b)),b=null},i===void 0&&o.setContentType(null),"setRequestHeader"in b&&y.forEach(o.toJSON(),function(k,_){b.setRequestHeader(_,k)}),y.isUndefined(s.withCredentials)||(b.withCredentials=!!s.withCredentials),a&&a!=="json"&&(b.responseType=s.responseType),c&&([g,f]=Pn(c,!0),b.addEventListener("progress",g)),l&&b.upload&&([d,h]=Pn(l),b.upload.addEventListener("progress",d),b.upload.addEventListener("loadend",h)),(s.cancelToken||s.signal)&&(u=w=>{b&&(r(!w||w.type?new Vt(null,n,b):w),b.abort(),b=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const x=qc(s.url);if(x&&ye.protocols.indexOf(x)===-1){r(new L("Unsupported protocol "+x+":",L.ERR_BAD_REQUEST,n));return}b.send(i||null)})},Zc=(n,e)=>{const{length:t}=n=n?n.filter(Boolean):[];if(e||t){let r=new AbortController,s;const i=function(c){if(!s){s=!0,a();const u=c instanceof Error?c:this.reason;r.abort(u instanceof L?u:new Vt(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,i(new L(`timeout ${e} of ms exceeded`,L.ETIMEDOUT))},e);const a=()=>{n&&(o&&clearTimeout(o),o=null,n.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),n=null)};n.forEach(c=>c.addEventListener("abort",i));const{signal:l}=r;return l.unsubscribe=()=>y.asap(a),l}},Gc=function*(n,e){let t=n.byteLength;if(t<e){yield n;return}let r=0,s;for(;r<t;)s=r+e,yield n.slice(r,s),r=s},Kc=async function*(n,e){for await(const t of Qc(n))yield*Gc(t,e)},Qc=async function*(n){if(n[Symbol.asyncIterator]){yield*n;return}const e=n.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}},Zi=(n,e,t,r)=>{const s=Kc(n,e);let i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await s.next();if(c){a(),l.close();return}let d=u.byteLength;if(t){let g=i+=d;t(g)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},Gi=64*1024,{isFunction:Dn}=y,eu=(({Request:n,Response:e})=>({Request:n,Response:e}))(y.global),{ReadableStream:Ki,TextEncoder:Qi}=y.global,eo=(n,...e)=>{try{return!!n(...e)}catch{return!1}},tu=n=>{n=y.merge.call({skipUndefined:!0},eu,n);const{fetch:e,Request:t,Response:r}=n,s=e?Dn(e):typeof fetch=="function",i=Dn(t),o=Dn(r);if(!s)return!1;const a=s&&Dn(Ki),l=s&&(typeof Qi=="function"?(f=>m=>f.encode(m))(new Qi):async f=>new Uint8Array(await new t(f).arrayBuffer())),c=i&&a&&eo(()=>{let f=!1;const m=new t(ye.origin,{body:new Ki,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!m}),u=o&&a&&eo(()=>y.isReadableStream(new r("").body)),d={stream:u&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!d[f]&&(d[f]=(m,b)=>{let v=m&&m[f];if(v)return v.call(m);throw new L(`Response type '${f}' is not supported`,L.ERR_NOT_SUPPORT,b)})});const g=async f=>{if(f==null)return 0;if(y.isBlob(f))return f.size;if(y.isSpecCompliantForm(f))return(await new t(ye.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(y.isArrayBufferView(f)||y.isArrayBuffer(f))return f.byteLength;if(y.isURLSearchParams(f)&&(f=f+""),y.isString(f))return(await l(f)).byteLength},h=async(f,m)=>{const b=y.toFiniteNumber(f.getContentLength());return b??g(m)};return async f=>{let{url:m,method:b,data:v,signal:x,cancelToken:w,timeout:k,onDownloadProgress:_,onUploadProgress:S,responseType:P,headers:T,withCredentials:A="same-origin",fetchOptions:D}=Ji(f),E=e||fetch;P=P?(P+"").toLowerCase():"text";let j=Zc([x,w&&w.toAbortSignal()],k),Z=null;const se=j&&j.unsubscribe&&(()=>{j.unsubscribe()});let Re;try{if(S&&c&&b!=="get"&&b!=="head"&&(Re=await h(T,v))!==0){let R=new t(m,{method:"POST",body:v,duplex:"half"}),$;if(y.isFormData(v)&&($=R.headers.get("content-type"))&&T.setContentType($),R.body){const[F,I]=Wi(Re,Pn(Vi(S)));v=Zi(R.body,Gi,F,I)}}y.isString(A)||(A=A?"include":"omit");const G=i&&"credentials"in t.prototype,ve={...D,signal:j,method:b.toUpperCase(),headers:T.normalize().toJSON(),body:v,duplex:"half",credentials:G?A:void 0};Z=i&&new t(m,ve);let de=await(i?E(Z,D):E(m,ve));const qe=u&&(P==="stream"||P==="response");if(u&&(_||qe&&se)){const R={};["status","statusText","headers"].forEach(q=>{R[q]=de[q]});const $=y.toFiniteNumber(de.headers.get("content-length")),[F,I]=_&&Wi($,Pn(Vi(_),!0))||[];de=new r(Zi(de.body,Gi,F,()=>{I&&I(),se&&se()}),R)}P=P||"text";let C=await d[y.findKey(d,P)||"text"](de,f);return!qe&&se&&se(),await new Promise((R,$)=>{Hi(R,$,{data:C,headers:Pe.from(de.headers),status:de.status,statusText:de.statusText,config:f,request:Z})})}catch(G){throw se&&se(),G&&G.name==="TypeError"&&/Load failed|fetch/i.test(G.message)?Object.assign(new L("Network Error",L.ERR_NETWORK,f,Z),{cause:G.cause||G}):L.from(G,G&&G.code,f,Z)}}},nu=new Map,to=n=>{let e=n&&n.env||{};const{fetch:t,Request:r,Response:s}=e,i=[r,s,t];let o=i.length,a=o,l,c,u=nu;for(;a--;)l=i[a],c=u.get(l),c===void 0&&u.set(l,c=a?new Map:tu(e)),u=c;return c};to();const Wr={http:Tc,xhr:Jc,fetch:{get:to}};y.forEach(Wr,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const no=n=>`- ${n}`,ru=n=>y.isFunction(n)||n===null||n===!1;function su(n,e){n=y.isArray(n)?n:[n];const{length:t}=n;let r,s;const i={};for(let o=0;o<t;o++){r=n[o];let a;if(s=r,!ru(r)&&(s=Wr[(a=String(r)).toLowerCase()],s===void 0))throw new L(`Unknown adapter '${a}'`);if(s&&(y.isFunction(s)||(s=s.get(e))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=t?o.length>1?`since :
4
+ `+o.map(no).join(`
5
+ `):" "+no(o[0]):"as no adapter specified";throw new L("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const ro={getAdapter:su,adapters:Wr};function Vr(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new Vt(null,n)}function so(n){return Vr(n),n.headers=Pe.from(n.headers),n.data=Hr.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),ro.getAdapter(n.adapter||on.adapter,n)(n).then(function(r){return Vr(n),r.data=Hr.call(n,n.transformResponse,r),r.headers=Pe.from(r.headers),r},function(r){return Bi(r)||(Vr(n),r&&r.response&&(r.response.data=Hr.call(n,n.transformResponse,r.response),r.response.headers=Pe.from(r.response.headers))),Promise.reject(r)})}const io="1.13.2",In={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{In[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const oo={};In.transitional=function(e,t,r){function s(i,o){return"[Axios v"+io+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(e===!1)throw new L(s(o," has been removed"+(t?" in "+t:"")),L.ERR_DEPRECATED);return t&&!oo[o]&&(oo[o]=!0,console.warn(s(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,o,a):!0}},In.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function iu(n,e,t){if(typeof n!="object")throw new L("options must be an object",L.ERR_BAD_OPTION_VALUE);const r=Object.keys(n);let s=r.length;for(;s-- >0;){const i=r[s],o=e[i];if(o){const a=n[i],l=a===void 0||o(a,i,n);if(l!==!0)throw new L("option "+i+" must be "+l,L.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new L("Unknown option "+i,L.ERR_BAD_OPTION)}}const $n={assertOptions:iu,validators:In},et=$n.validators;let Rt=class{constructor(e){this.defaults=e||{},this.interceptors={request:new ji,response:new ji}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
6
+ `+i):r.stack=i}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=At(this.defaults,t);const{transitional:r,paramsSerializer:s,headers:i}=t;r!==void 0&&$n.assertOptions(r,{silentJSONParsing:et.transitional(et.boolean),forcedJSONParsing:et.transitional(et.boolean),clarifyTimeoutError:et.transitional(et.boolean)},!1),s!=null&&(y.isFunction(s)?t.paramsSerializer={serialize:s}:$n.assertOptions(s,{encode:et.function,serialize:et.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),$n.assertOptions(t,{baseUrl:et.spelling("baseURL"),withXsrfToken:et.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&y.merge(i.common,i[t.method]);i&&y.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),t.headers=Pe.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(t)===!1||(l=l&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let u,d=0,g;if(!l){const f=[so.bind(this),void 0];for(f.unshift(...a),f.push(...c),g=f.length,u=Promise.resolve(t);d<g;)u=u.then(f[d++],f[d++]);return u}g=a.length;let h=t;for(;d<g;){const f=a[d++],m=a[d++];try{h=f(h)}catch(b){m.call(this,b);break}}try{u=so.call(this,h)}catch(f){return Promise.reject(f)}for(d=0,g=c.length;d<g;)u=u.then(c[d++],c[d++]);return u}getUri(e){e=At(this.defaults,e);const t=Yi(e.baseURL,e.url,e.allowAbsoluteUrls);return Li(t,e.params,e.paramsSerializer)}};y.forEach(["delete","get","head","options"],function(e){Rt.prototype[e]=function(t,r){return this.request(At(r||{},{method:e,url:t,data:(r||{}).data}))}}),y.forEach(["post","put","patch"],function(e){function t(r){return function(i,o,a){return this.request(At(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Rt.prototype[e]=t(),Rt.prototype[e+"Form"]=t(!0)});let ou=class Al{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},e(function(i,o,a){r.reason||(r.reason=new Vt(i,o,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Al(function(s){e=s}),cancel:e}}};function au(n){return function(t){return n.apply(null,t)}}function lu(n){return y.isObject(n)&&n.isAxiosError===!0}const Yr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Yr).forEach(([n,e])=>{Yr[e]=n});function ao(n){const e=new Rt(n),t=ki(Rt.prototype.request,e);return y.extend(t,Rt.prototype,e,{allOwnKeys:!0}),y.extend(t,e,null,{allOwnKeys:!0}),t.create=function(s){return ao(At(n,s))},t}const fe=ao(on);fe.Axios=Rt,fe.CanceledError=Vt,fe.CancelToken=ou,fe.isCancel=Bi,fe.VERSION=io,fe.toFormData=Rn,fe.AxiosError=L,fe.Cancel=fe.CanceledError,fe.all=function(e){return Promise.all(e)},fe.spread=au,fe.isAxiosError=lu,fe.mergeConfig=At,fe.AxiosHeaders=Pe,fe.formToJSON=n=>zi(y.isHTMLForm(n)?new FormData(n):n),fe.getAdapter=ro.getAdapter,fe.HttpStatusCode=Yr,fe.default=fe;const{Axios:$p,AxiosError:Np,CanceledError:Mp,isCancel:Fp,CancelToken:Lp,VERSION:jp,all:Up,Cancel:zp,isAxiosError:qp,spread:Bp,toFormData:Hp,AxiosHeaders:Wp,HttpStatusCode:Vp,formToJSON:Yp,getAdapter:Xp,mergeConfig:Jp}=fe,cu="https://api.robodialog.com",uu="wss://realtime.robodialog.com/connection/websocket",lo=cu+"/api/v1",De=fe.create({baseURL:lo,headers:{"Content-Type":"application/json"}});function co(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function du(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}),t}function Ot(n){this._maxSize=n,this.clear()}Ot.prototype.clear=function(){this._size=0,this._values=Object.create(null)},Ot.prototype.get=function(n){return this._values[n]},Ot.prototype.set=function(n,e){return this._size>=this._maxSize&&this.clear(),n in this._values||this._size++,this._values[n]=e};var hu=/[^.^\]^[]+|(?=\[\]|\.\.)/g,uo=/^\d+$/,fu=/^\d/,pu=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,gu=/^\s*(['"]?)(.*?)(\1)\s*$/,Xr=512,ho=new Ot(Xr),fo=new Ot(Xr),po=new Ot(Xr),Pt={Cache:Ot,split:Zr,normalizePath:Jr,setter:function(n){var e=Jr(n);return fo.get(n)||fo.set(n,function(r,s){for(var i=0,o=e.length,a=r;i<o-1;){var l=e[i];if(l==="__proto__"||l==="constructor"||l==="prototype")return r;a=a[e[i++]]}a[e[i]]=s})},getter:function(n,e){var t=Jr(n);return po.get(n)||po.set(n,function(s){for(var i=0,o=t.length;i<o;)if(s!=null||!e)s=s[t[i++]];else return;return s})},join:function(n){return n.reduce(function(e,t){return e+(Gr(t)||uo.test(t)?"["+t+"]":(e?".":"")+t)},"")},forEach:function(n,e,t){mu(Array.isArray(n)?n:Zr(n),e,t)}};function Jr(n){return ho.get(n)||ho.set(n,Zr(n).map(function(e){return e.replace(gu,"$2")}))}function Zr(n){return n.match(hu)||[""]}function mu(n,e,t){var r=n.length,s,i,o,a;for(i=0;i<r;i++)s=n[i],s&&(vu(s)&&(s='"'+s+'"'),a=Gr(s),o=!a&&/^\d+$/.test(s),e.call(t,s,a,o,i,n))}function Gr(n){return typeof n=="string"&&n&&["'",'"'].indexOf(n.charAt(0))!==-1}function bu(n){return n.match(fu)&&!n.match(uo)}function _u(n){return pu.test(n)}function vu(n){return!Gr(n)&&(bu(n)||_u(n))}const yu=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,Nn=n=>n.match(yu)||[],Mn=n=>n[0].toUpperCase()+n.slice(1),Kr=(n,e)=>Nn(n).join(e).toLowerCase(),go=n=>Nn(n).reduce((e,t)=>`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,"");var Qr={words:Nn,upperFirst:Mn,camelCase:go,pascalCase:n=>Mn(go(n)),snakeCase:n=>Kr(n,"_"),kebabCase:n=>Kr(n,"-"),sentenceCase:n=>Mn(Kr(n," ")),titleCase:n=>Nn(n).map(Mn).join(" ")},es={exports:{}};es.exports=function(n){return mo(xu(n),n)},es.exports.array=mo;function mo(n,e){var t=n.length,r=new Array(t),s={},i=t,o=wu(e),a=ku(n);for(e.forEach(function(c){if(!a.has(c[0])||!a.has(c[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});i--;)s[i]||l(n[i],i,new Set);return r;function l(c,u,d){if(d.has(c)){var g;try{g=", node was:"+JSON.stringify(c)}catch{g=""}throw new Error("Cyclic dependency"+g)}if(!a.has(c))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(c));if(!s[u]){s[u]=!0;var h=o.get(c)||new Set;if(h=Array.from(h),u=h.length){d.add(c);do{var f=h[--u];l(f,a.get(f),d)}while(u);d.delete(c)}r[--t]=c}}}function xu(n){for(var e=new Set,t=0,r=n.length;t<r;t++){var s=n[t];e.add(s[0]),e.add(s[1])}return Array.from(e)}function wu(n){for(var e=new Map,t=0,r=n.length;t<r;t++){var s=n[t];e.has(s[0])||e.set(s[0],new Set),e.has(s[1])||e.set(s[1],new Set),e.get(s[0]).add(s[1])}return e}function ku(n){for(var e=new Map,t=0,r=n.length;t<r;t++)e.set(n[t],t);return e}var Tu=es.exports;const Su=co(Tu),Cu=Object.prototype.toString,Eu=Error.prototype.toString,Au=RegExp.prototype.toString,Ru=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Ou=/^Symbol\((.*)\)(.*)$/;function Pu(n){return n!=+n?"NaN":n===0&&1/n<0?"-0":""+n}function bo(n,e=!1){if(n==null||n===!0||n===!1)return""+n;const t=typeof n;if(t==="number")return Pu(n);if(t==="string")return e?`"${n}"`:n;if(t==="function")return"[Function "+(n.name||"anonymous")+"]";if(t==="symbol")return Ru.call(n).replace(Ou,"Symbol($1)");const r=Cu.call(n).slice(8,-1);return r==="Date"?isNaN(n.getTime())?""+n:n.toISOString(n):r==="Error"||n instanceof Error?"["+Eu.call(n)+"]":r==="RegExp"?Au.call(n):null}function dt(n,e){let t=bo(n,e);return t!==null?t:JSON.stringify(n,function(r,s){let i=bo(this[r],e);return i!==null?i:s},2)}function _o(n){return n==null?[]:[].concat(n)}let vo,yo,xo,Du=/\$\{\s*(\w+)\s*\}/g;vo=Symbol.toStringTag;class wo{constructor(e,t,r,s){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[vo]="Error",this.name="ValidationError",this.value=t,this.path=r,this.type=s,this.errors=[],this.inner=[],_o(e).forEach(i=>{if(_e.isError(i)){this.errors.push(...i.errors);const o=i.inner.length?i.inner:[i];this.inner.push(...o)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}yo=Symbol.hasInstance,xo=Symbol.toStringTag;class _e extends Error{static formatError(e,t){const r=t.label||t.path||"this";return t=Object.assign({},t,{path:r,originalPath:t.path}),typeof e=="string"?e.replace(Du,(s,i)=>dt(t[i])):typeof e=="function"?e(t):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,t,r,s,i){const o=new wo(e,t,r,s);if(i)return o;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[xo]="Error",this.name=o.name,this.message=o.message,this.type=o.type,this.value=o.value,this.path=o.path,this.errors=o.errors,this.inner=o.inner,Error.captureStackTrace&&Error.captureStackTrace(this,_e)}static[yo](e){return wo[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let tt={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:n,type:e,value:t,originalValue:r})=>{const s=r!=null&&r!==t?` (cast from the value \`${dt(r,!0)}\`).`:".";return e!=="mixed"?`${n} must be a \`${e}\` type, but the final value was: \`${dt(t,!0)}\``+s:`${n} must match the configured type. The validated value was: \`${dt(t,!0)}\``+s}},Ie={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},vt={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},ts={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},ns={isValue:"${path} field must be ${value}"},Fn={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Ln={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"};Object.assign(Object.create(null),{mixed:tt,string:Ie,number:vt,date:ts,object:Fn,array:Ln,boolean:ns,tuple:{notType:n=>{const{path:e,value:t,spec:r}=n,s=r.types.length;if(Array.isArray(t)){if(t.length<s)return`${e} tuple value has too few items, expected a length of ${s} but got ${t.length} for value: \`${dt(t,!0)}\``;if(t.length>s)return`${e} tuple value has too many items, expected a length of ${s} but got ${t.length} for value: \`${dt(t,!0)}\``}return _e.formatError(tt.notType,n)}}});const jn=n=>n&&n.__isYupSchema__;class Un{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:s,otherwise:i}=t,o=typeof r=="function"?r:(...a)=>a.every(l=>l===r);return new Un(e,(a,l)=>{var c;let u=o(...a)?s:i;return(c=u==null?void 0:u(l))!=null?c:l})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let r=this.refs.map(i=>i.getValue(t==null?void 0:t.value,t==null?void 0:t.parent,t==null?void 0:t.context)),s=this.fn(r,e,t);if(s===void 0||s===e)return e;if(!jn(s))throw new TypeError("conditions must return a schema object");return s.resolve(t)}}const zn={context:"$",value:"."};class Dt{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===zn.context,this.isValue=this.key[0]===zn.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?zn.context:this.isValue?zn.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Pt.getter(this.path,!0),this.map=t.map}getValue(e,t,r){let s=this.isContext?r:this.isValue?e:t;return this.getter&&(s=this.getter(s||{})),this.map&&(s=this.map(s)),s}cast(e,t){return this.getValue(e,t==null?void 0:t.parent,t==null?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Dt.prototype.__isYupRef=!0;const Ve=n=>n==null;function Yt(n){function e({value:t,path:r="",options:s,originalValue:i,schema:o},a,l){const{name:c,test:u,params:d,message:g,skipAbsent:h}=n;let{parent:f,context:m,abortEarly:b=o.spec.abortEarly,disableStackTrace:v=o.spec.disableStackTrace}=s;const x={value:t,parent:f,context:m};function w(E={}){const j=ko(Object.assign({value:t,originalValue:i,label:o.spec.label,path:E.path||r,spec:o.spec,disableStackTrace:E.disableStackTrace||v},d,E.params),x),Z=new _e(_e.formatError(E.message||g,j),t,j.path,E.type||c,j.disableStackTrace);return Z.params=j,Z}const k=b?a:l;let _={path:r,parent:f,type:c,from:s.from,createError:w,resolve(E){return To(E,x)},options:s,originalValue:i,schema:o};const S=E=>{_e.isError(E)?k(E):E?l(null):k(w())},P=E=>{_e.isError(E)?k(E):a(E)};if(h&&Ve(t))return S(!0);let A;try{var D;if(A=u.call(_,t,_),typeof((D=A)==null?void 0:D.then)=="function"){if(s.sync)throw new Error(`Validation test of type: "${_.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(A).then(S,P)}}catch(E){P(E);return}S(A)}return e.OPTIONS=n,e}function ko(n,e){if(!n)return n;for(const t of Object.keys(n))n[t]=To(n[t],e);return n}function To(n,e){return Dt.isRef(n)?n.getValue(e.value,e.parent,e.context):n}function Iu(n,e,t,r=t){let s,i,o;return e?(Pt.forEach(e,(a,l,c)=>{let u=l?a.slice(1,a.length-1):a;n=n.resolve({context:r,parent:s,value:t});let d=n.type==="tuple",g=c?parseInt(u,10):0;if(n.innerType||d){if(d&&!c)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(t&&g>=t.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${e}. because there is no value at that index. `);s=t,t=t&&t[g],n=d?n.spec.types[g]:n.innerType}if(!c){if(!n.fields||!n.fields[u])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${o} which is a type: "${n.type}")`);s=t,t=t&&t[u],n=n.fields[u]}i=u,o=l?"["+a+"]":"."+a}),{schema:n,parent:s,parentPath:i}):{parent:s,parentPath:e,schema:n}}class qn extends Set{describe(){const e=[];for(const t of this.values())e.push(Dt.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const r of this.values())t.push(e(r));return t}clone(){return new qn(this.values())}merge(e,t){const r=this.clone();return e.forEach(s=>r.add(s)),t.forEach(s=>r.delete(s)),r}}function Xt(n,e=new Map){if(jn(n)||!n||typeof n!="object")return n;if(e.has(n))return e.get(n);let t;if(n instanceof Date)t=new Date(n.getTime()),e.set(n,t);else if(n instanceof RegExp)t=new RegExp(n),e.set(n,t);else if(Array.isArray(n)){t=new Array(n.length),e.set(n,t);for(let r=0;r<n.length;r++)t[r]=Xt(n[r],e)}else if(n instanceof Map){t=new Map,e.set(n,t);for(const[r,s]of n.entries())t.set(r,Xt(s,e))}else if(n instanceof Set){t=new Set,e.set(n,t);for(const r of n)t.add(Xt(r,e))}else if(n instanceof Object){t={},e.set(n,t);for(const[r,s]of Object.entries(n))t[r]=Xt(s,e)}else throw Error(`Unable to clone ${n}`);return t}function $u(n){if(!(n!=null&&n.length))return;const e=[];let t="",r=!1,s=!1;for(let i=0;i<n.length;i++){const o=n[i];if(o==="["&&!s){t&&(e.push(...t.split(".").filter(Boolean)),t=""),r=!0;continue}if(o==="]"&&!s){t&&(/^\d+$/.test(t)?e.push(t):e.push(t.replace(/^"|"$/g,"")),t=""),r=!1;continue}if(o==='"'){s=!s;continue}if(o==="."&&!r&&!s){t&&(e.push(t),t="");continue}t+=o}return t&&e.push(...t.split(".").filter(Boolean)),e}function Nu(n,e){const t=e?`${e}.${n.path}`:n.path;return n.errors.map(r=>({message:r,path:$u(t)}))}function So(n,e){var t;if(!((t=n.inner)!=null&&t.length)&&n.errors.length)return Nu(n,e);const r=e?`${e}.${n.path}`:n.path;return n.inner.flatMap(s=>So(s,r))}class Fe{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new qn,this._blacklist=new qn,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(tt.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(t=>{t.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=Xt(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(e.length===0)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=t,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,r=e.clone();const s=Object.assign({},t.spec,r.spec);return r.spec=s,r.internalTests=Object.assign({},t.internalTests,r.internalTests),r._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),r.tests=t.tests,r.exclusiveTests=t.exclusiveTests,r.withMutation(i=>{e.tests.forEach(o=>{i.test(o.OPTIONS)})}),r.transforms=[...t.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let r=t.conditions;t=t.clone(),t.conditions=[],t=r.reduce((s,i)=>i.resolve(s,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,r,s,i;return Object.assign({},e,{from:e.from||[],strict:(t=e.strict)!=null?t:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(s=e.recursive)!=null?s:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,t={}){let r=this.resolve(Object.assign({},t,{value:e})),s=t.assert==="ignore-optionality",i=r._cast(e,t);if(t.assert!==!1&&!r.isType(i)){if(s&&Ve(i))return i;let o=dt(e),a=dt(i);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
7
7
 
8
8
  attempted value: ${o}
9
- `+(a!==o?`result of cast: ${a}`:""))}return i}_cast(e,t){let r=e===void 0?e:this.transforms.reduce((s,i)=>i.call(this,s,e,this,t),e);return r===void 0&&(r=this.getDefault(t)),r}_validate(e,t={},r,s){let{path:i,originalValue:o=e,strict:a=this.spec.strict}=t,l=e;a||(l=this._cast(l,Object.assign({assert:!1},t)));let c=[];for(let u of Object.values(this.internalTests))u&&c.push(u);this.runTests({path:i,value:l,originalValue:o,options:t,tests:c},r,u=>{if(u.length)return s(u,l);this.runTests({path:i,value:l,originalValue:o,options:t,tests:this.tests},r,s)})}runTests(e,t,r){let s=!1,{tests:i,value:o,originalValue:a,path:l,options:c}=e,u=m=>{s||(s=!0,t(m,o))},d=m=>{s||(s=!0,r(m,o))},g=i.length,h=[];if(!g)return d([]);let f={value:o,originalValue:a,path:l,options:c,schema:this};for(let m=0;m<i.length;m++){const b=i[m];b(f,u,function(x){x&&(Array.isArray(x)?h.push(...x):h.push(x)),--g<=0&&d(h)})}}asNestedTest({key:e,index:t,parent:r,parentPath:s,originalParent:i,options:o}){const a=e??t;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof a=="number";let c=r[a];const u=Object.assign({},o,{strict:!0,parent:r,value:c,originalValue:i[a],key:void 0,[l?"index":"key"]:a,path:l||a.includes(".")?`${s||""}[${l?a:`"${a}"`}]`:(s?`${s}.`:"")+e});return(d,g,h)=>this.resolve(u)._validate(c,u,g,h)}validate(e,t){var r;let s=this.resolve(Object.assign({},t,{value:e})),i=(r=t==null?void 0:t.disableStackTrace)!=null?r:s.spec.disableStackTrace;return new Promise((o,a)=>s._validate(e,t,(l,c)=>{ve.isError(l)&&(l.value=c),a(l)},(l,c)=>{l.length?a(new ve(l,c,void 0,void 0,i)):o(c)}))}validateSync(e,t){var r;let s=this.resolve(Object.assign({},t,{value:e})),i,o=(r=t==null?void 0:t.disableStackTrace)!=null?r:s.spec.disableStackTrace;return s._validate(e,Object.assign({},t,{sync:!0}),(a,l)=>{throw ve.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new ve(a,e,void 0,void 0,o);i=l}),i}isValid(e,t){return this.validate(e,t).then(()=>!0,r=>{if(ve.isError(r))return!1;throw r})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(r){if(ve.isError(r))return!1;throw r}}_getDefault(e){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this,e):Jt(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const r=this.clone({nullable:e});return r.internalTests.nullable=Xt({message:t,name:"nullable",test(s){return s===null?this.schema.spec.nullable:!0}}),r}optionality(e,t){const r=this.clone({optional:e});return r.internalTests.optionality=Xt({message:t,name:"optionality",test(s){return s===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=nt.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=nt.notNull){return this.nullability(!1,e)}required(e=nt.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(e.length===1?typeof e[0]=="function"?t={test:e[0]}:t=e[0]:e.length===2?t={name:e[0],test:e[1]}:t={name:e[0],message:e[1],test:e[2]},t.message===void 0&&(t.message=nt.default),typeof t.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),s=Xt(t),i=t.exclusive||t.name&&r.exclusiveTests[t.name]===!0;if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(r.exclusiveTests[t.name]=!!t.exclusive),r.tests=r.tests.filter(o=>!(o.OPTIONS.name===t.name&&(i||o.OPTIONS.test===s.OPTIONS.test))),r.tests.push(s),r}when(e,t){!Array.isArray(e)&&typeof e!="string"&&(t=e,e=".");let r=this.clone(),s=vo(e).map(i=>new It(i));return s.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof t=="function"?new zn(s,t):zn.fromOptions(s,t)),r}typeError(e){let t=this.clone();return t.internalTests.typeError=Xt({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=nt.oneOf){let r=this.clone();return e.forEach(s=>{r._whitelist.add(s),r._blacklist.delete(s)}),r.internalTests.whiteList=Xt({message:t,name:"oneOf",skipAbsent:!0,test(s){let i=this.schema._whitelist,o=i.resolveAll(this.resolve);return o.includes(s)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:o}})}}),r}notOneOf(e,t=nt.notOneOf){let r=this.clone();return e.forEach(s=>{r._blacklist.add(s),r._whitelist.delete(s)}),r.internalTests.blacklist=Xt({message:t,name:"notOneOf",test(s){let i=this.schema._blacklist,o=i.resolveAll(this.resolve);return o.includes(s)?this.createError({params:{values:Array.from(i).join(", "),resolved:o}}):!0}}),r}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:r,meta:s,optional:i,nullable:o}=t.spec;return{meta:s,label:r,optional:i,nullable:o,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.filter((l,c,u)=>u.findIndex(d=>d.OPTIONS.name===l.OPTIONS.name)===c).map(l=>{const c=l.OPTIONS.params&&e?To(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:c}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(s){if(s instanceof ve)return{issues:Co(s)};throw s}}}}}Le.prototype.__isYupSchema__=!0;for(const n of["validate","validateSync"])Le.prototype[`${n}At`]=function(e,t,r={}){const{parent:s,parentPath:i,schema:o}=$u(this,e,t,r.context);return o[n](s&&s[i],Object.assign({},r,{parent:s,path:e}))};for(const n of["equals","is"])Le.prototype[n]=Le.prototype.oneOf;for(const n of["not","nope"])Le.prototype[n]=Le.prototype.notOneOf;function ss(){return new Eo}class Eo extends Le{constructor(){super({type:"boolean",check(e){return e instanceof Boolean&&(e=e.valueOf()),typeof e=="boolean"}}),this.withMutation(()=>{this.transform((e,t)=>{if(this.spec.coerce&&!this.isType(e)){if(/^(true|1)$/i.test(String(e)))return!0;if(/^(false|0)$/i.test(String(e)))return!1}return e})})}isTrue(e=rs.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"true"},test(t){return Ye(t)||t===!0}})}isFalse(e=rs.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"false"},test(t){return Ye(t)||t===!1}})}default(e){return super.default(e)}defined(e){return super.defined(e)}optional(){return super.optional()}required(e){return super.required(e)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(e){return super.nonNullable(e)}strip(e){return super.strip(e)}}ss.prototype=Eo.prototype;const Fu=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Lu(n){const e=is(n);if(!e)return Date.parse?Date.parse(n):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let t=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(t=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(t=0-t)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+t,e.second,e.millisecond)}function is(n){var e,t;const r=Fu.exec(n);return r?{year:ft(r[1]),month:ft(r[2],1)-1,day:ft(r[3],1),hour:ft(r[4]),minute:ft(r[5]),second:ft(r[6]),millisecond:r[7]?ft(r[7].substring(0,3)):0,precision:(e=(t=r[7])==null?void 0:t.length)!=null?e:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:ft(r[10]),minuteOffset:ft(r[11])}:null}function ft(n,e=0){return Number(n)||e}let ju=/^[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])?)*$/,Uu=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,zu=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,qu="^\\d{4}-\\d{2}-\\d{2}",Bu="\\d{2}:\\d{2}:\\d{2}",Hu="(([+-]\\d{2}(:?\\d{2})?)|Z)",Wu=new RegExp(`${qu}T${Bu}(\\.\\d+)?${Hu}$`),Vu=n=>Ye(n)||n===n.trim(),Yu={}.toString();function Y(){return new Ao}class Ao extends Le{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const r=e!=null&&e.toString?e.toString():e;return r===Yu?e:r})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||nt.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(t=>t.OPTIONS.name!=="required"),e))}length(e,t=$e.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,t=$e.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,t=$e.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,t){let r=!1,s,i;return t&&(typeof t=="object"?{excludeEmptyString:r=!1,message:s,name:i}=t:s=t),this.test({name:i||"matches",message:s||$e.matches,params:{regex:e},skipAbsent:!0,test:o=>o===""&&r||o.search(e)!==-1})}email(e=$e.email){return this.matches(ju,{name:"email",message:e,excludeEmptyString:!0})}url(e=$e.url){return this.matches(Uu,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=$e.uuid){return this.matches(zu,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t="",r,s;return e&&(typeof e=="object"?{message:t="",allowOffset:r=!1,precision:s=void 0}=e:t=e),this.matches(Wu,{name:"datetime",message:t||$e.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:t||$e.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const o=is(i);return o?!!o.z:!1}}).test({name:"datetime_precision",message:t||$e.datetime_precision,params:{precision:s},skipAbsent:!0,test:i=>{if(!i||s==null)return!0;const o=is(i);return o?o.precision===s:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=$e.trim){return this.transform(t=>t!=null?t.trim():t).test({message:e,name:"trim",test:Vu})}lowercase(e=$e.lowercase){return this.transform(t=>Ye(t)?t:t.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Ye(t)||t===t.toLowerCase()})}uppercase(e=$e.uppercase){return this.transform(t=>Ye(t)?t:t.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Ye(t)||t===t.toUpperCase()})}}Y.prototype=Ao.prototype;let Xu=n=>n!=+n;function cn(){return new Ro}class Ro extends Le{constructor(){super({type:"number",check(e){return e instanceof Number&&(e=e.valueOf()),typeof e=="number"&&!Xu(e)}}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce)return e;let r=e;if(typeof r=="string"){if(r=r.replace(/\s/g,""),r==="")return NaN;r=+r}return this.isType(r)||r===null?r:parseFloat(r)})})}min(e,t=yt.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r>=this.resolve(e)}})}max(e,t=yt.max){return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(r){return r<=this.resolve(e)}})}lessThan(e,t=yt.lessThan){return this.test({message:t,name:"max",exclusive:!0,params:{less:e},skipAbsent:!0,test(r){return r<this.resolve(e)}})}moreThan(e,t=yt.moreThan){return this.test({message:t,name:"min",exclusive:!0,params:{more:e},skipAbsent:!0,test(r){return r>this.resolve(e)}})}positive(e=yt.positive){return this.moreThan(0,e)}negative(e=yt.negative){return this.lessThan(0,e)}integer(e=yt.integer){return this.test({name:"integer",message:e,skipAbsent:!0,test:t=>Number.isInteger(t)})}truncate(){return this.transform(e=>Ye(e)?e:e|0)}round(e){var t;let r=["ceil","floor","round","trunc"];if(e=((t=e)==null?void 0:t.toLowerCase())||"round",e==="trunc")return this.truncate();if(r.indexOf(e.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+r.join(", "));return this.transform(s=>Ye(s)?s:Math[e](s))}}cn.prototype=Ro.prototype;let Ju=new Date(""),Zu=n=>Object.prototype.toString.call(n)==="[object Date]";class os extends Le{constructor(){super({type:"date",check(e){return Zu(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,t)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=Lu(e),isNaN(e)?os.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let r;if(It.isRef(e))r=e;else{let s=this.cast(e);if(!this._typeCheck(s))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);r=s}return r}min(e,t=ns.min){let r=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s>=this.resolve(r)}})}max(e,t=ns.max){let r=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(s){return s<=this.resolve(r)}})}}os.INVALID_DATE=Ju;function Gu(n,e=[]){let t=[],r=new Set,s=new Set(e.map(([o,a])=>`${o}-${a}`));function i(o,a){let l=Dt.split(o)[0];r.add(l),s.has(`${a}-${l}`)||t.push([a,l])}for(const o of Object.keys(n)){let a=n[o];r.add(o),It.isRef(a)&&a.isSibling?i(a.path,o):Un(a)&&"deps"in a&&a.deps.forEach(l=>i(l,o))}return Cu.array(Array.from(r),t).reverse()}function Oo(n,e){let t=1/0;return n.some((r,s)=>{var i;if((i=e.path)!=null&&i.includes(r))return t=s,!0}),t}function Po(n){return(e,t)=>Oo(n,e)-Oo(n,t)}const Do=(n,e,t)=>{if(typeof n!="string")return n;let r=n;try{r=JSON.parse(n)}catch{}return t.isType(r)?r:n};function Hn(n){if("fields"in n){const e={};for(const[t,r]of Object.entries(n.fields))e[t]=Hn(r);return n.setFields(e)}if(n.type==="array"){const e=n.optional();return e.innerType&&(e.innerType=Hn(e.innerType)),e}return n.type==="tuple"?n.optional().clone({types:n.spec.types.map(Hn)}):"optional"in n?n.optional():n}const Ku=(n,e)=>{const t=[...Dt.normalizePath(e)];if(t.length===1)return t[0]in n;let r=t.pop(),s=Dt.getter(Dt.join(t),!0)(n);return!!(s&&r in s)};let Io=n=>Object.prototype.toString.call(n)==="[object Object]";function $o(n,e){let t=Object.keys(n.fields);return Object.keys(e).filter(r=>t.indexOf(r)===-1)}const Qu=Po([]);function V(n){return new No(n)}class No extends Le{constructor(e){super({type:"object",check(t){return Io(t)||typeof t=="function"}}),this.fields=Object.create(null),this._sortErrors=Qu,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var r;let s=super._cast(e,t);if(s===void 0)return this.getDefault(t);if(!this._typeCheck(s))return s;let i=this.fields,o=(r=t.stripUnknown)!=null?r:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(s).filter(d=>!this._nodes.includes(d))),l={},c=Object.assign({},t,{parent:l,__validating:t.__validating||!1}),u=!1;for(const d of a){let g=i[d],h=d in s,f=s[d];if(g){let m;c.path=(t.path?`${t.path}.`:"")+d,g=g.resolve({value:f,context:t.context,parent:l});let b=g instanceof Le?g.spec:void 0,v=b==null?void 0:b.strict;if(b!=null&&b.strip){u=u||d in s;continue}m=!t.__validating||!v?g.cast(f,c):f,m!==void 0&&(l[d]=m)}else h&&!o&&(l[d]=f);(h!==d in l||l[d]!==f)&&(u=!0)}return u?l:s}_validate(e,t={},r,s){let{from:i=[],originalValue:o=e,recursive:a=this.spec.recursive}=t;t.from=[{schema:this,value:o},...i],t.__validating=!0,t.originalValue=o,super._validate(e,t,r,(l,c)=>{if(!a||!Io(c)){s(l,c);return}o=o||c;let u=[];for(let d of this._nodes){let g=this.fields[d];!g||It.isRef(g)||u.push(g.asNestedTest({options:t,key:d,parent:c,parentPath:t.path,originalParent:o}))}this.runTests({tests:u,value:c,originalValue:o,options:t},r,d=>{s(d.sort(this._sortErrors).concat(l),c)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),r=t.fields;for(let[s,i]of Object.entries(this.fields)){const o=r[s];r[s]=o===void 0?i:o}return t.withMutation(s=>s.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(r=>{var s;const i=this.fields[r];let o=e;(s=o)!=null&&s.value&&(o=Object.assign({},o,{parent:o.value,value:o.value[r]})),t[r]=i&&"getDefault"in i?i.getDefault(o):void 0}),t}setFields(e,t){let r=this.clone();return r.fields=e,r._nodes=Gu(e,t),r._sortErrors=Po(Object.keys(e)),t&&(r._excludedEdges=t),r}shape(e,t=[]){return this.clone().withMutation(r=>{let s=r._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),s=[...r._excludedEdges,...t]),r.setFields(Object.assign(r.fields,e),s)})}partial(){const e={};for(const[t,r]of Object.entries(this.fields))e[t]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return Hn(this)}pick(e){const t={};for(const r of e)this.fields[r]&&(t[r]=this.fields[r]);return this.setFields(t,this._excludedEdges.filter(([r,s])=>e.includes(r)&&e.includes(s)))}omit(e){const t=[];for(const r of Object.keys(this.fields))e.includes(r)||t.push(r);return this.pick(t)}from(e,t,r){let s=Dt.getter(e,!0);return this.transform(i=>{if(!i)return i;let o=i;return Ku(i,e)&&(o=Object.assign({},i),r||delete o[e],o[t]=s(i)),o})}json(){return this.transform(Do)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Ln.exact,test(t){if(t==null)return!0;const r=$o(this.schema,t);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=Ln.noUnknown){typeof e!="boolean"&&(t=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:t,test(s){if(s==null)return!0;const i=$o(this.schema,s);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,t=Ln.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const r={};for(const s of Object.keys(t))r[e(s)]=t[s];return r})}camelCase(){return this.transformKeys(es.camelCase)}snakeCase(){return this.transformKeys(es.snakeCase)}constantCase(){return this.transformKeys(e=>es.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[i,o]of Object.entries(t.fields)){var s;let a=e;(s=a)!=null&&s.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[i]})),r.fields[i]=o.describe(a)}return r}}V.prototype=No.prototype;function Wn(n){return new Mo(n)}class Mo extends Le{constructor(e){super({type:"array",spec:{types:e},check(t){return Array.isArray(t)}}),this.innerType=void 0,this.innerType=e}_cast(e,t){const r=super._cast(e,t);if(!this._typeCheck(r)||!this.innerType)return r;let s=!1;const i=r.map((o,a)=>{const l=this.innerType.cast(o,Object.assign({},t,{path:`${t.path||""}[${a}]`,parent:r,originalValue:o,value:o,index:a}));return l!==o&&(s=!0),l});return s?i:r}_validate(e,t={},r,s){var i;let o=this.innerType,a=(i=t.recursive)!=null?i:this.spec.recursive;t.originalValue!=null&&t.originalValue,super._validate(e,t,r,(l,c)=>{var u;if(!a||!o||!this._typeCheck(c)){s(l,c);return}let d=new Array(c.length);for(let h=0;h<c.length;h++){var g;d[h]=o.asNestedTest({options:t,index:h,parent:c,parentPath:t.path,originalParent:(g=t.originalValue)!=null?g:e})}this.runTests({value:c,tests:d,originalValue:(u=t.originalValue)!=null?u:e,options:t},r,h=>s(h.concat(l),c))})}clone(e){const t=super.clone(e);return t.innerType=this.innerType,t}json(){return this.transform(Do)}concat(e){let t=super.concat(e);return t.innerType=this.innerType,e.innerType&&(t.innerType=t.innerType?t.innerType.concat(e.innerType):e.innerType),t}of(e){let t=this.clone();if(!Un(e))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+ht(e));return t.innerType=e,t.spec=Object.assign({},t.spec,{types:e}),t}length(e,t=jn.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,t){return t=t||jn.min,this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,t){return t=t||jn.max,this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}ensure(){return this.default(()=>[]).transform((e,t)=>this._typeCheck(e)?e:t==null?[]:[].concat(t))}compact(e){let t=e?(r,s,i)=>!e(r,s,i):r=>!!r;return this.transform(r=>r!=null?r.filter(t):r)}describe(e){const t=(e?this.resolve(e):this).clone(),r=super.describe(e);if(t.innerType){var s;let i=e;(s=i)!=null&&s.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[0]})),r.innerType=t.innerType.describe(i)}return r}}Wn.prototype=Mo.prototype;const ge=(n,e=[])=>t=>{const r=t?Object.keys(t).filter(s=>!n.includes(s)&&!e.includes(s)):[];if(r.length>0)throw new ve(`Unknown properties: ${r.join(", ")}`,t,"custom-validation");return!0},ed=V().shape({params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",n=>ge(["id"],[])(n))}),td=V().shape({body:V().shape({userId:Y().trim().min(1,"User Id must be at least 1 character").max(1e3,"User Id cannot exceed 1000 characters").required("User Id is required"),visitor:ss().required("Visitor is required"),chatbotId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Chatbot Id").required("Chatbot Id is required")}).test("custom-validation","Custom validation failed",ge(["userId","visitor","chatbotId"]))}),Fo={readById:async n=>{await ed.validate({params:n.params},{abortEarly:!1});const{data:e}=await Ie.get(`/live/readById/${n.params.id}`);return e},generateToken:async n=>{await td.validate({body:n.body},{abortEarly:!1});const{data:e}=await Ie.post("/live/generateToken",n.body);return e}},nd=V().shape({params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"],[]))}),rd=V().shape({query:V().shape({skip:Y().trim().min(1,"Skip must be at least 1 character").max(1e4,"Skip cannot exceed 10000 characters").optional()}).test("custom-validation","Custom validation failed",ge([],["skip"]))}),sd=V().shape({body:V().shape({currentNode:Y().trim().min(1,"Current Node must be at least 1 character").max(1e3,"Current Node cannot exceed 1000 characters").required("Current Node is required")}).test("custom-validation","Custom validation failed",ge(["currentNode"])),params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"],[]))}),id=V().shape({body:V().shape({assignType:Y().oneOf(["role","teamMember","everyone"]).required("Assign Type is required"),assignTo:Y().when("assignType",{is:"role",then:n=>n.min(1,"Role must be at least 1 character").max(500,"Role cannot exceed 500 characters").required("Role is required")}).when("assignType",{is:"teamMember",then:n=>n.trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Member Id").required("Member Id is required")}).when("assignType",{is:"everyone",then:n=>n.nullable()})}).test("custom-validation","Custom validation failed",ge(["assignType","assignTo"])),params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"],[]))}),od=V().shape({body:V().shape({chatflow:V().shape({key:Y().max(1e3,"Key cannot exceed 1000 characters").optional(),index:cn().max(1e3,"Index cannot exceed 1000").optional()}).nullable().optional(),nodeId:Y().trim().min(1,"Node ID must be at least 1 character").max(1e3,"Node ID cannot exceed 1000 characters").optional()}).test("custom-validation","Custom validation failed",ge([],["chatflow","nodeId"]))}),$t={userRead:async(n,e)=>{await nd.validate({params:n.params},{abortEarly:!1});const{data:t}=await Ie.get(`/conversation/user/read/${n.params.id}`,{headers:{Authorization:`Bearer ${e}`}});return t},userReadAll:async(n,e)=>{await rd.validate({query:e==null?void 0:e.query},{abortEarly:!1});const{data:t}=await Ie.get("/conversation/user/readAll",{params:e==null?void 0:e.query,headers:{Authorization:`Bearer ${n}`}});return t},userUpdateCurrentNode:async(n,e)=>{await sd.validate({params:n.params,body:n.body},{abortEarly:!1});const{data:t}=await Ie.post(`/conversation/user/update/currentNode/${n.params.id}`,n.body,{headers:{Authorization:`Bearer ${e}`}});return t},userAssignToAgent:async(n,e)=>{await id.validate({params:n.params,body:n.body},{abortEarly:!1});const{data:t}=await Ie.post(`/conversation/user/update/assign/${n.params.id}`,n.body,{headers:{Authorization:`Bearer ${e}`}});return t},userCreate:async(n,e)=>{await od.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/conversation/user/create",n.body,{headers:{Authorization:`Bearer ${e}`}});return t}},ad=({className:n,style:e={}})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",viewBox:"0 0 256 256",className:n,style:e,children:p("path",{fill:"currentColor",d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"})}),un=({className:n,width:e=16,height:t=16})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"})}),Zt=({className:n})=>p("svg",{width:"100%",height:"100%",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg",className:n,children:p("path",{fill:"currentColor",d:"M13 0C10.4288 0 7.91543 0.762437 5.77759 2.1909C3.63975 3.61935 1.97351 5.64968 0.989572 8.02512C0.0056327 10.4006 -0.251811 13.0144 0.249797 15.5362C0.751405 18.0579 1.98953 20.3743 3.80762 22.1924C5.6257 24.0105 7.94208 25.2486 10.4638 25.7502C12.9856 26.2518 15.5995 25.9944 17.9749 25.0104C20.3503 24.0265 22.3807 22.3603 23.8091 20.2224C25.2376 18.0846 26 15.5712 26 13C25.9964 9.5533 24.6256 6.24882 22.1884 3.81163C19.7512 1.37445 16.4467 0.00363977 13 0Z"})}),Lo=({className:n})=>p("svg",{width:"11",height:"6",viewBox:"0 0 11 6",xmlns:"http://www.w3.org/2000/svg",className:n,children:p("path",{fill:"currentColor",d:"M10.7884 1.18378L6.00738 5.79649C5.94076 5.861 5.86159 5.91218 5.77442 5.9471C5.68725 5.98202 5.59379 6 5.4994 6C5.40501 6 5.31156 5.98202 5.22438 5.9471C5.13721 5.91218 5.05805 5.861 4.99142 5.79649L0.210413 1.18378C0.0756879 1.0538 0 0.877507 0 0.693683C0 0.50986 0.0756879 0.333566 0.210413 0.203583C0.345138 0.0736001 0.527865 0.000576714 0.718395 0.000576712C0.908925 0.00057671 1.09165 0.0736001 1.22638 0.203583L5.5 4.32677L9.77362 0.203007C9.90835 0.0730239 10.0911 0 10.2816 0C10.4721 0 10.6549 0.0730239 10.7896 0.203007C10.9243 0.332989 11 0.509284 11 0.693107C11 0.87693 10.9243 1.05322 10.7896 1.18321Z"})}),ld=({className:n})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M234.29,114.85l-45,38.83L203,211.75a16.4,16.4,0,0,1-24.5,17.82L128,198.49,77.47,229.57A16.4,16.4,0,0,1,53,211.75l13.76-58.07-45-38.83A16.46,16.46,0,0,1,31.08,86l59-4.76,22.76-55.08a16.36,16.36,0,0,1,30.27,0l22.75,55.08,59,4.76a16.46,16.46,0,0,1,9.37,28.86Z"})}),jo=({className:n,width:e=32,height:t=32})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"})}),cd=({className:n,width:e=32})=>p("svg",{width:e,height:e*2,viewBox:"0 0 9 14",xmlns:"http://www.w3.org/2000/svg",className:n,children:[p("circle",{cx:"6.99929",cy:"1.27273",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"1.27273",cy:"1.27273",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"6.99929",cy:"7.00002",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"1.27273",cy:"7.00002",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"6.99929",cy:"12.7273",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"1.27273",cy:"12.7273",r:"1.27273",fill:"currentColor"})]}),ud=({className:n})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M231.87,114l-168-95.89A16,16,0,0,0,40.92,37.34L71.55,128,40.92,218.67A16,16,0,0,0,56,240a16.15,16.15,0,0,0,7.93-2.1l167.92-96.05a16,16,0,0,0,.05-27.89ZM56,224a.56.56,0,0,0,0-.12L85.74,136H144a8,8,0,0,0,0-16H85.74L56.06,32.16A.46.46,0,0,0,56,32l168,95.83Z"})}),dd=({className:n})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M209.66,122.34a8,8,0,0,1,0,11.32l-82.05,82a56,56,0,0,1-79.2-79.21L147.67,35.73a40,40,0,1,1,56.61,56.55L105,193A24,24,0,1,1,71,159L154.3,74.38A8,8,0,1,1,165.7,85.6L82.39,170.31a8,8,0,1,0,11.27,11.36L192.93,81A24,24,0,1,0,159,47L59.76,147.68a40,40,0,1,0,56.53,56.62l82.06-82A8,8,0,0,1,209.66,122.34Z"})}),hd="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAAAxCAYAAAB+gjFbAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAALhSURBVHgB7ZlNbtpAFMf/MxC1qySIdNFVnRtwg5ATlJygdNdFCuYEgRPEVN2HnqD0BNAbJCeId13kA6SuKjUzfW8MgQbHGJi09ig/aWQbxpJ/fvPlNwLrcnxVhZAVSHFAVxUqu5OyKaEpWl1AYYjizyGC/THWQKxU27/chdpuQggfdkRSonu4U1/w+dVwlbvSybGU3j6h6j7+L0OIX+8RvA7TVF4u9/HKhyyQ2L+M1DJ0gG65taxWslzz5jQD0XqMkKJ4mBTFeDnTDHe+0lkV2SZRUMbeoncGyL4Y40G/GMD/4cX9uShnmqIZ2vPCRHC0MCb8Ledf1zPcx5IgQX328MdZn+PQ8hvginlFqCMEe/3p5SxyaquNPIsxWp7ON89IjqMm5DvkH49WMvXpRSQXRc0NpLgPUiQn5AHcoQKfFvVguWNz4sEllKzxQULKKlxDmM8wbpY6TxN2WoyTpP72Bi7yYeTxgOLBRV7CyGXoO80uEg7zLJdXnuXyii05ymWIQyr75qh0Cxrf6ffkZCrX0bpL9xzd3wucwxICzVuNTeEH/FSO/4L3R7xa8KBUtBKSMkQkECIoLcrzolcXBtgUelFF2OHxCAUlFuHSRyr0WqnzOOw0S5tLuN/SgyUs9Tldi8s+rYVEDZawNaBQEledYFOinSNr6Q6LUwGlBBuj9R+M8ziFwhnscW53nhO01dS4WT2CHDG7aUUzEtufxIVo0/RyOUlfJMPRalz3KGJ286UaF3ywNRU8xDMP3LzlHdJvNKn3qYyh7sYoblXoBXiUpXpLD1FdcfszHVqZacfOJJ41eLUTlEIH15aix2J85p6cQGd66pjcLGqMS3LhfNQYd+SEas1HjXFDTujO/L7clPzLGbFyO+6vfMsliDFPtUJ5asZRH9vrJVXKnxznXaSok1i4rGp+5CKpNrqlYdpbsi1nhPSQhoY+Sa2cFStS5qqDrKCpLxUkJ4ii7Fi3tFGy6A+7st8LQyzi5QAAAABJRU5ErkJggg==",as=n=>{const e=new Date(n);if(Number.isNaN(e.getTime()))return"Invalid date";const r=new Date().getTime()-e.getTime();if(r<0)return"just now";const s=Math.floor(r/1e3),i=Math.floor(s/60),o=Math.floor(i/60),a=Math.floor(o/24),l=Math.floor(a/30),c=Math.floor(l/12);let d=[{limit:60*1e3,label:"just now"},{limit:60*60*1e3,label:`${i} minute${i!==1?"s":""}`},{limit:24*60*60*1e3,label:`${o} hour${o!==1?"s":""}`},{limit:30*24*60*60*1e3,label:`${a} day${a!==1?"s":""}`}].find(g=>r<g.limit);return d?d.label:l>0?`${l} month${l!==1?"s":""} ago`:`${c} year${c!==1?"s":""} ago`},fd=V().shape({name:Y().min(1,"Name must be at least 1 character").max(1e3,"Name cannot exceed 1000 characters").required("Name is required"),url:Y().min(1,"URL must be at least 1 character").max(1e3,"URL cannot exceed 1000 characters").required("URL is required")}).test("custom-validation","Custom validation failed",ge(["name","url"])),pd=V().shape({text:Y().min(1,"Text must be at least 1 character").max(1e3,"Text cannot exceed 1000 characters").optional(),file:fd.when("text",{is:n=>!n,then:n=>n.required(),otherwise:n=>n.strip()})}).test("text-or-file","Either 'text' or 'file' must be provided",function(n){const{text:e,file:t}=n;return!e&&!t?this.createError({path:"data",message:"Either 'text' or 'file' must be provided"}):!0}).test("custom-validation","Custom validation failed",ge([],["text","file"])),gd=V().shape({params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"]))}),md=V().shape({body:V().shape({conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Conversation Id").required("Conversation Id is required"),skip:cn().min(0,"Skip must be at least 0").max(1e4,"Skip cannot exceed 10000").optional()}).test("custom-validation","Custom validation failed",ge(["conversationId"],["skip"]))}),Uo=V().shape({body:V().shape({owner:Y().oneOf(["ai","user"]).required("Owner must be 'ai' or 'user'"),conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Conversation Id").required("Conversation Id is required"),type:Y().oneOf(["AI Text","Human Text","External API","External API Text","AI Response"]).required("Type is required"),data:pd.required("Message data is required"),currentChatflow:V().shape({key:Y().max(1e3,"Key cannot exceed 1000 characters").optional(),index:cn().max(1e3,"Index cannot exceed 1000").optional()}).nullable().optional()}).test("custom-validation","Custom validation failed",ge(["owner","conversationId","type","data"],["currentChatflow"]))}),bd=V().shape({body:V().shape({queries:Wn().of(Y().min(1,"Query must be at least 1 character").max(1e3,"Query cannot exceed 1000 characters")).max(200,"Queries cannot exceed 200 items").optional(),conversationHistory:Wn().of(V().shape({user:Y().min(1,"User message must be at least 1 character").max(1e3,"User message cannot exceed 1000 characters").optional(),ai:Y().min(1,"AI message must be at least 1 character").max(1e3,"AI message cannot exceed 1000 characters").optional()}).test("custom-validation","Custom validation failed",ge([],["user","ai"]))).min(1,"Conversation history must have at least 1 entry").max(3,"Conversation history cannot exceed 3 entries").required("Conversation history is required")}).test("custom-validation","Custom validation failed",ge(["queries","conversationHistory"]))}),_d=V().shape({body:V().shape({conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Conversation Id").required("Conversation Id is required"),conversationHistory:Wn().of(V().shape({user:Y().min(1,"User message must be at least 1 character").max(1e3,"User message cannot exceed 1000 characters").optional(),ai:Y().min(1,"AI message must be at least 1 character").max(2500,"AI message cannot exceed 2500 characters").optional()}).test("custom-validation","Custom validation failed",ge([],["user","ai"]))).min(1,"Conversation history must have at least 1 entry").max(8,"Conversation history cannot exceed 8 entries").required("Conversation history is required"),enableStreaming:ss().optional()}).test("custom-validation","Custom validation failed",ge(["conversationId","conversationHistory"],["enableStreaming"]))}),ls={userReadAll:async(n,e)=>{await md.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/message/user/readAll",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userUpdateSeen:async(n,e)=>{await gd.validate({params:n.params},{abortEarly:!1});const{data:t}=await Ie.post(`/message/user/update/seen/${n.params.id}`,{},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userCreate:async(n,e)=>{await Uo.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/message/user/create",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userAIContextMessage:async(n,e)=>{await _d.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/message/user/ai/message",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userAICheckQueries:async(n,e)=>{await bd.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/message/user/ai/checkQueries",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t}},vd={userUploadAsset:async(n,e)=>{const t=new FormData;t.append("file",n);const{data:r}=await Ie.post("/asset/userUpload",t,{headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e}`}});return r}};V().shape({rating:Y().trim().min(1).max(1),skip:Y().trim().min(1).max(1e3),limit:Y().trim().min(1).max(1e3)}).test("custom-validation","Custom validation failed",ge([],["rating","skip","limit"]));const yd=V().shape({body:V().shape({conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Conversation Id is required"),chatbotId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Chatbot Id is required"),comment:Y().trim().max(500).min(3).required("Comment is required"),rating:cn().max(5).min(1).required("Rating is required")}).test("custom-validation","Custom validation failed",ge(["conversationId","chatbotId","comment","rating"]))}),xd={userCreate:async(n,e)=>{await yd.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/review/user/create",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t}};class wd{constructor(){this.buffer="",this.eventType=null,this.eventData=""}async parseStream(e,t,r){const s=e.body.getReader(),i=new TextDecoder;try{for(;;){const{done:o,value:a}=await s.read();if(o)break;this.buffer+=i.decode(a,{stream:!0}),this.processBuffer(t)}this.buffer.trim()&&this.processBuffer(t),t({type:"done",data:{}})}catch(o){console.error("SSE parsing failed:",o),r(o instanceof Error?o:new Error("Stream parsing failed"))}}processBuffer(e){const t=this.buffer.split(`
10
- `);this.buffer=t.pop()||"";for(const r of t)if(r.startsWith("event: "))this.eventType=r.replace("event: ","");else if(r.startsWith("data: "))this.eventData+=r.replace("data: ","");else if(r.trim()===""){if(this.eventType&&this.eventData)try{e({type:this.eventType,data:JSON.parse(this.eventData)})}catch{console.error("Failed to parse SSE data:",this.eventData)}this.eventType=null,this.eventData=""}}}const kd="token123",rt="3",Td=[{_id:"1",owner:"user",ownerId:rt,conversationId:"21",chatbotId:"7",conversationOwnerId:rt,chatbotOwnerId:"9",seen:!1,data:{text:"So, I was curious about RoboDialog"},type:"Human Text",createdAt:"2026-01-02T10:34:14.396Z",updatedAt:"2026-01-02T10:34:14.396Z"},{_id:"2",owner:"ai",ownerId:null,conversationId:"21",chatbotId:"7",conversationOwnerId:rt,chatbotOwnerId:"9",seen:!1,data:{text:`## 🤖 RoboDialog
9
+ `+(a!==o?`result of cast: ${a}`:""))}return i}_cast(e,t){let r=e===void 0?e:this.transforms.reduce((s,i)=>i.call(this,s,e,this,t),e);return r===void 0&&(r=this.getDefault(t)),r}_validate(e,t={},r,s){let{path:i,originalValue:o=e,strict:a=this.spec.strict}=t,l=e;a||(l=this._cast(l,Object.assign({assert:!1},t)));let c=[];for(let u of Object.values(this.internalTests))u&&c.push(u);this.runTests({path:i,value:l,originalValue:o,options:t,tests:c},r,u=>{if(u.length)return s(u,l);this.runTests({path:i,value:l,originalValue:o,options:t,tests:this.tests},r,s)})}runTests(e,t,r){let s=!1,{tests:i,value:o,originalValue:a,path:l,options:c}=e,u=m=>{s||(s=!0,t(m,o))},d=m=>{s||(s=!0,r(m,o))},g=i.length,h=[];if(!g)return d([]);let f={value:o,originalValue:a,path:l,options:c,schema:this};for(let m=0;m<i.length;m++){const b=i[m];b(f,u,function(x){x&&(Array.isArray(x)?h.push(...x):h.push(x)),--g<=0&&d(h)})}}asNestedTest({key:e,index:t,parent:r,parentPath:s,originalParent:i,options:o}){const a=e??t;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof a=="number";let c=r[a];const u=Object.assign({},o,{strict:!0,parent:r,value:c,originalValue:i[a],key:void 0,[l?"index":"key"]:a,path:l||a.includes(".")?`${s||""}[${l?a:`"${a}"`}]`:(s?`${s}.`:"")+e});return(d,g,h)=>this.resolve(u)._validate(c,u,g,h)}validate(e,t){var r;let s=this.resolve(Object.assign({},t,{value:e})),i=(r=t==null?void 0:t.disableStackTrace)!=null?r:s.spec.disableStackTrace;return new Promise((o,a)=>s._validate(e,t,(l,c)=>{_e.isError(l)&&(l.value=c),a(l)},(l,c)=>{l.length?a(new _e(l,c,void 0,void 0,i)):o(c)}))}validateSync(e,t){var r;let s=this.resolve(Object.assign({},t,{value:e})),i,o=(r=t==null?void 0:t.disableStackTrace)!=null?r:s.spec.disableStackTrace;return s._validate(e,Object.assign({},t,{sync:!0}),(a,l)=>{throw _e.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new _e(a,e,void 0,void 0,o);i=l}),i}isValid(e,t){return this.validate(e,t).then(()=>!0,r=>{if(_e.isError(r))return!1;throw r})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(r){if(_e.isError(r))return!1;throw r}}_getDefault(e){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this,e):Xt(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const r=this.clone({nullable:e});return r.internalTests.nullable=Yt({message:t,name:"nullable",test(s){return s===null?this.schema.spec.nullable:!0}}),r}optionality(e,t){const r=this.clone({optional:e});return r.internalTests.optionality=Yt({message:t,name:"optionality",test(s){return s===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=tt.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=tt.notNull){return this.nullability(!1,e)}required(e=tt.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(e.length===1?typeof e[0]=="function"?t={test:e[0]}:t=e[0]:e.length===2?t={name:e[0],test:e[1]}:t={name:e[0],message:e[1],test:e[2]},t.message===void 0&&(t.message=tt.default),typeof t.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),s=Yt(t),i=t.exclusive||t.name&&r.exclusiveTests[t.name]===!0;if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(r.exclusiveTests[t.name]=!!t.exclusive),r.tests=r.tests.filter(o=>!(o.OPTIONS.name===t.name&&(i||o.OPTIONS.test===s.OPTIONS.test))),r.tests.push(s),r}when(e,t){!Array.isArray(e)&&typeof e!="string"&&(t=e,e=".");let r=this.clone(),s=_o(e).map(i=>new Dt(i));return s.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof t=="function"?new Un(s,t):Un.fromOptions(s,t)),r}typeError(e){let t=this.clone();return t.internalTests.typeError=Yt({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=tt.oneOf){let r=this.clone();return e.forEach(s=>{r._whitelist.add(s),r._blacklist.delete(s)}),r.internalTests.whiteList=Yt({message:t,name:"oneOf",skipAbsent:!0,test(s){let i=this.schema._whitelist,o=i.resolveAll(this.resolve);return o.includes(s)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:o}})}}),r}notOneOf(e,t=tt.notOneOf){let r=this.clone();return e.forEach(s=>{r._blacklist.add(s),r._whitelist.delete(s)}),r.internalTests.blacklist=Yt({message:t,name:"notOneOf",test(s){let i=this.schema._blacklist,o=i.resolveAll(this.resolve);return o.includes(s)?this.createError({params:{values:Array.from(i).join(", "),resolved:o}}):!0}}),r}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:r,meta:s,optional:i,nullable:o}=t.spec;return{meta:s,label:r,optional:i,nullable:o,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.filter((l,c,u)=>u.findIndex(d=>d.OPTIONS.name===l.OPTIONS.name)===c).map(l=>{const c=l.OPTIONS.params&&e?ko(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:c}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(s){if(s instanceof _e)return{issues:So(s)};throw s}}}}}Fe.prototype.__isYupSchema__=!0;for(const n of["validate","validateSync"])Fe.prototype[`${n}At`]=function(e,t,r={}){const{parent:s,parentPath:i,schema:o}=Iu(this,e,t,r.context);return o[n](s&&s[i],Object.assign({},r,{parent:s,path:e}))};for(const n of["equals","is"])Fe.prototype[n]=Fe.prototype.oneOf;for(const n of["not","nope"])Fe.prototype[n]=Fe.prototype.notOneOf;function rs(){return new Co}class Co extends Fe{constructor(){super({type:"boolean",check(e){return e instanceof Boolean&&(e=e.valueOf()),typeof e=="boolean"}}),this.withMutation(()=>{this.transform((e,t)=>{if(this.spec.coerce&&!this.isType(e)){if(/^(true|1)$/i.test(String(e)))return!0;if(/^(false|0)$/i.test(String(e)))return!1}return e})})}isTrue(e=ns.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"true"},test(t){return Ve(t)||t===!0}})}isFalse(e=ns.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"false"},test(t){return Ve(t)||t===!1}})}default(e){return super.default(e)}defined(e){return super.defined(e)}optional(){return super.optional()}required(e){return super.required(e)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(e){return super.nonNullable(e)}strip(e){return super.strip(e)}}rs.prototype=Co.prototype;const Mu=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Fu(n){const e=ss(n);if(!e)return Date.parse?Date.parse(n):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let t=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(t=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(t=0-t)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+t,e.second,e.millisecond)}function ss(n){var e,t;const r=Mu.exec(n);return r?{year:ht(r[1]),month:ht(r[2],1)-1,day:ht(r[3],1),hour:ht(r[4]),minute:ht(r[5]),second:ht(r[6]),millisecond:r[7]?ht(r[7].substring(0,3)):0,precision:(e=(t=r[7])==null?void 0:t.length)!=null?e:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:ht(r[10]),minuteOffset:ht(r[11])}:null}function ht(n,e=0){return Number(n)||e}let Lu=/^[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])?)*$/,ju=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Uu=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,zu="^\\d{4}-\\d{2}-\\d{2}",qu="\\d{2}:\\d{2}:\\d{2}",Bu="(([+-]\\d{2}(:?\\d{2})?)|Z)",Hu=new RegExp(`${zu}T${qu}(\\.\\d+)?${Bu}$`),Wu=n=>Ve(n)||n===n.trim(),Vu={}.toString();function Y(){return new Eo}class Eo extends Fe{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const r=e!=null&&e.toString?e.toString():e;return r===Vu?e:r})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||tt.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(t=>t.OPTIONS.name!=="required"),e))}length(e,t=Ie.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,t=Ie.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,t=Ie.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,t){let r=!1,s,i;return t&&(typeof t=="object"?{excludeEmptyString:r=!1,message:s,name:i}=t:s=t),this.test({name:i||"matches",message:s||Ie.matches,params:{regex:e},skipAbsent:!0,test:o=>o===""&&r||o.search(e)!==-1})}email(e=Ie.email){return this.matches(Lu,{name:"email",message:e,excludeEmptyString:!0})}url(e=Ie.url){return this.matches(ju,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=Ie.uuid){return this.matches(Uu,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t="",r,s;return e&&(typeof e=="object"?{message:t="",allowOffset:r=!1,precision:s=void 0}=e:t=e),this.matches(Hu,{name:"datetime",message:t||Ie.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:t||Ie.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const o=ss(i);return o?!!o.z:!1}}).test({name:"datetime_precision",message:t||Ie.datetime_precision,params:{precision:s},skipAbsent:!0,test:i=>{if(!i||s==null)return!0;const o=ss(i);return o?o.precision===s:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=Ie.trim){return this.transform(t=>t!=null?t.trim():t).test({message:e,name:"trim",test:Wu})}lowercase(e=Ie.lowercase){return this.transform(t=>Ve(t)?t:t.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Ve(t)||t===t.toLowerCase()})}uppercase(e=Ie.uppercase){return this.transform(t=>Ve(t)?t:t.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Ve(t)||t===t.toUpperCase()})}}Y.prototype=Eo.prototype;let Yu=n=>n!=+n;function ln(){return new Ao}class Ao extends Fe{constructor(){super({type:"number",check(e){return e instanceof Number&&(e=e.valueOf()),typeof e=="number"&&!Yu(e)}}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce)return e;let r=e;if(typeof r=="string"){if(r=r.replace(/\s/g,""),r==="")return NaN;r=+r}return this.isType(r)||r===null?r:parseFloat(r)})})}min(e,t=vt.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r>=this.resolve(e)}})}max(e,t=vt.max){return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(r){return r<=this.resolve(e)}})}lessThan(e,t=vt.lessThan){return this.test({message:t,name:"max",exclusive:!0,params:{less:e},skipAbsent:!0,test(r){return r<this.resolve(e)}})}moreThan(e,t=vt.moreThan){return this.test({message:t,name:"min",exclusive:!0,params:{more:e},skipAbsent:!0,test(r){return r>this.resolve(e)}})}positive(e=vt.positive){return this.moreThan(0,e)}negative(e=vt.negative){return this.lessThan(0,e)}integer(e=vt.integer){return this.test({name:"integer",message:e,skipAbsent:!0,test:t=>Number.isInteger(t)})}truncate(){return this.transform(e=>Ve(e)?e:e|0)}round(e){var t;let r=["ceil","floor","round","trunc"];if(e=((t=e)==null?void 0:t.toLowerCase())||"round",e==="trunc")return this.truncate();if(r.indexOf(e.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+r.join(", "));return this.transform(s=>Ve(s)?s:Math[e](s))}}ln.prototype=Ao.prototype;let Xu=new Date(""),Ju=n=>Object.prototype.toString.call(n)==="[object Date]";class is extends Fe{constructor(){super({type:"date",check(e){return Ju(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,t)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=Fu(e),isNaN(e)?is.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let r;if(Dt.isRef(e))r=e;else{let s=this.cast(e);if(!this._typeCheck(s))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);r=s}return r}min(e,t=ts.min){let r=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s>=this.resolve(r)}})}max(e,t=ts.max){let r=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(s){return s<=this.resolve(r)}})}}is.INVALID_DATE=Xu;function Zu(n,e=[]){let t=[],r=new Set,s=new Set(e.map(([o,a])=>`${o}-${a}`));function i(o,a){let l=Pt.split(o)[0];r.add(l),s.has(`${a}-${l}`)||t.push([a,l])}for(const o of Object.keys(n)){let a=n[o];r.add(o),Dt.isRef(a)&&a.isSibling?i(a.path,o):jn(a)&&"deps"in a&&a.deps.forEach(l=>i(l,o))}return Su.array(Array.from(r),t).reverse()}function Ro(n,e){let t=1/0;return n.some((r,s)=>{var i;if((i=e.path)!=null&&i.includes(r))return t=s,!0}),t}function Oo(n){return(e,t)=>Ro(n,e)-Ro(n,t)}const Po=(n,e,t)=>{if(typeof n!="string")return n;let r=n;try{r=JSON.parse(n)}catch{}return t.isType(r)?r:n};function Bn(n){if("fields"in n){const e={};for(const[t,r]of Object.entries(n.fields))e[t]=Bn(r);return n.setFields(e)}if(n.type==="array"){const e=n.optional();return e.innerType&&(e.innerType=Bn(e.innerType)),e}return n.type==="tuple"?n.optional().clone({types:n.spec.types.map(Bn)}):"optional"in n?n.optional():n}const Gu=(n,e)=>{const t=[...Pt.normalizePath(e)];if(t.length===1)return t[0]in n;let r=t.pop(),s=Pt.getter(Pt.join(t),!0)(n);return!!(s&&r in s)};let Do=n=>Object.prototype.toString.call(n)==="[object Object]";function Io(n,e){let t=Object.keys(n.fields);return Object.keys(e).filter(r=>t.indexOf(r)===-1)}const Ku=Oo([]);function V(n){return new $o(n)}class $o extends Fe{constructor(e){super({type:"object",check(t){return Do(t)||typeof t=="function"}}),this.fields=Object.create(null),this._sortErrors=Ku,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var r;let s=super._cast(e,t);if(s===void 0)return this.getDefault(t);if(!this._typeCheck(s))return s;let i=this.fields,o=(r=t.stripUnknown)!=null?r:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(s).filter(d=>!this._nodes.includes(d))),l={},c=Object.assign({},t,{parent:l,__validating:t.__validating||!1}),u=!1;for(const d of a){let g=i[d],h=d in s,f=s[d];if(g){let m;c.path=(t.path?`${t.path}.`:"")+d,g=g.resolve({value:f,context:t.context,parent:l});let b=g instanceof Fe?g.spec:void 0,v=b==null?void 0:b.strict;if(b!=null&&b.strip){u=u||d in s;continue}m=!t.__validating||!v?g.cast(f,c):f,m!==void 0&&(l[d]=m)}else h&&!o&&(l[d]=f);(h!==d in l||l[d]!==f)&&(u=!0)}return u?l:s}_validate(e,t={},r,s){let{from:i=[],originalValue:o=e,recursive:a=this.spec.recursive}=t;t.from=[{schema:this,value:o},...i],t.__validating=!0,t.originalValue=o,super._validate(e,t,r,(l,c)=>{if(!a||!Do(c)){s(l,c);return}o=o||c;let u=[];for(let d of this._nodes){let g=this.fields[d];!g||Dt.isRef(g)||u.push(g.asNestedTest({options:t,key:d,parent:c,parentPath:t.path,originalParent:o}))}this.runTests({tests:u,value:c,originalValue:o,options:t},r,d=>{s(d.sort(this._sortErrors).concat(l),c)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),r=t.fields;for(let[s,i]of Object.entries(this.fields)){const o=r[s];r[s]=o===void 0?i:o}return t.withMutation(s=>s.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(r=>{var s;const i=this.fields[r];let o=e;(s=o)!=null&&s.value&&(o=Object.assign({},o,{parent:o.value,value:o.value[r]})),t[r]=i&&"getDefault"in i?i.getDefault(o):void 0}),t}setFields(e,t){let r=this.clone();return r.fields=e,r._nodes=Zu(e,t),r._sortErrors=Oo(Object.keys(e)),t&&(r._excludedEdges=t),r}shape(e,t=[]){return this.clone().withMutation(r=>{let s=r._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),s=[...r._excludedEdges,...t]),r.setFields(Object.assign(r.fields,e),s)})}partial(){const e={};for(const[t,r]of Object.entries(this.fields))e[t]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return Bn(this)}pick(e){const t={};for(const r of e)this.fields[r]&&(t[r]=this.fields[r]);return this.setFields(t,this._excludedEdges.filter(([r,s])=>e.includes(r)&&e.includes(s)))}omit(e){const t=[];for(const r of Object.keys(this.fields))e.includes(r)||t.push(r);return this.pick(t)}from(e,t,r){let s=Pt.getter(e,!0);return this.transform(i=>{if(!i)return i;let o=i;return Gu(i,e)&&(o=Object.assign({},i),r||delete o[e],o[t]=s(i)),o})}json(){return this.transform(Po)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Fn.exact,test(t){if(t==null)return!0;const r=Io(this.schema,t);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=Fn.noUnknown){typeof e!="boolean"&&(t=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:t,test(s){if(s==null)return!0;const i=Io(this.schema,s);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,t=Fn.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const r={};for(const s of Object.keys(t))r[e(s)]=t[s];return r})}camelCase(){return this.transformKeys(Qr.camelCase)}snakeCase(){return this.transformKeys(Qr.snakeCase)}constantCase(){return this.transformKeys(e=>Qr.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[i,o]of Object.entries(t.fields)){var s;let a=e;(s=a)!=null&&s.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[i]})),r.fields[i]=o.describe(a)}return r}}V.prototype=$o.prototype;function Hn(n){return new No(n)}class No extends Fe{constructor(e){super({type:"array",spec:{types:e},check(t){return Array.isArray(t)}}),this.innerType=void 0,this.innerType=e}_cast(e,t){const r=super._cast(e,t);if(!this._typeCheck(r)||!this.innerType)return r;let s=!1;const i=r.map((o,a)=>{const l=this.innerType.cast(o,Object.assign({},t,{path:`${t.path||""}[${a}]`,parent:r,originalValue:o,value:o,index:a}));return l!==o&&(s=!0),l});return s?i:r}_validate(e,t={},r,s){var i;let o=this.innerType,a=(i=t.recursive)!=null?i:this.spec.recursive;t.originalValue!=null&&t.originalValue,super._validate(e,t,r,(l,c)=>{var u;if(!a||!o||!this._typeCheck(c)){s(l,c);return}let d=new Array(c.length);for(let h=0;h<c.length;h++){var g;d[h]=o.asNestedTest({options:t,index:h,parent:c,parentPath:t.path,originalParent:(g=t.originalValue)!=null?g:e})}this.runTests({value:c,tests:d,originalValue:(u=t.originalValue)!=null?u:e,options:t},r,h=>s(h.concat(l),c))})}clone(e){const t=super.clone(e);return t.innerType=this.innerType,t}json(){return this.transform(Po)}concat(e){let t=super.concat(e);return t.innerType=this.innerType,e.innerType&&(t.innerType=t.innerType?t.innerType.concat(e.innerType):e.innerType),t}of(e){let t=this.clone();if(!jn(e))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+dt(e));return t.innerType=e,t.spec=Object.assign({},t.spec,{types:e}),t}length(e,t=Ln.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,t){return t=t||Ln.min,this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,t){return t=t||Ln.max,this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}ensure(){return this.default(()=>[]).transform((e,t)=>this._typeCheck(e)?e:t==null?[]:[].concat(t))}compact(e){let t=e?(r,s,i)=>!e(r,s,i):r=>!!r;return this.transform(r=>r!=null?r.filter(t):r)}describe(e){const t=(e?this.resolve(e):this).clone(),r=super.describe(e);if(t.innerType){var s;let i=e;(s=i)!=null&&s.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[0]})),r.innerType=t.innerType.describe(i)}return r}}Hn.prototype=No.prototype;const pe=(n,e=[])=>t=>{const r=t?Object.keys(t).filter(s=>!n.includes(s)&&!e.includes(s)):[];if(r.length>0)throw new _e(`Unknown properties: ${r.join(", ")}`,t,"custom-validation");return!0},Qu=V().shape({params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",n=>pe(["id"],[])(n))}),ed=V().shape({body:V().shape({userId:Y().trim().min(1,"User Id must be at least 1 character").max(1e3,"User Id cannot exceed 1000 characters").required("User Id is required"),visitor:rs().required("Visitor is required"),chatbotId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Chatbot Id").required("Chatbot Id is required")}).test("custom-validation","Custom validation failed",pe(["userId","visitor","chatbotId"]))}),Mo={readById:async n=>{await Qu.validate({params:n.params},{abortEarly:!1});const{data:e}=await De.get(`/live/readById/${n.params.id}`);return e},generateToken:async n=>{await ed.validate({body:n.body},{abortEarly:!1});const{data:e}=await De.post("/live/generateToken",n.body);return e}},td=V().shape({params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",pe(["id"],[]))}),nd=V().shape({query:V().shape({skip:Y().trim().min(1,"Skip must be at least 1 character").max(1e4,"Skip cannot exceed 10000 characters").optional()}).test("custom-validation","Custom validation failed",pe([],["skip"]))}),rd=V().shape({body:V().shape({currentNode:Y().trim().min(1,"Current Node must be at least 1 character").max(1e3,"Current Node cannot exceed 1000 characters").required("Current Node is required")}).test("custom-validation","Custom validation failed",pe(["currentNode"])),params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",pe(["id"],[]))}),sd=V().shape({body:V().shape({assignType:Y().oneOf(["role","teamMember","everyone"]).required("Assign Type is required"),assignTo:Y().when("assignType",{is:"role",then:n=>n.min(1,"Role must be at least 1 character").max(500,"Role cannot exceed 500 characters").required("Role is required")}).when("assignType",{is:"teamMember",then:n=>n.trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Member Id").required("Member Id is required")}).when("assignType",{is:"everyone",then:n=>n.nullable()})}).test("custom-validation","Custom validation failed",pe(["assignType","assignTo"])),params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",pe(["id"],[]))}),id=V().shape({body:V().shape({chatflow:V().shape({key:Y().max(1e3,"Key cannot exceed 1000 characters").optional(),index:ln().max(1e3,"Index cannot exceed 1000").optional()}).nullable().optional(),nodeId:Y().trim().min(1,"Node ID must be at least 1 character").max(1e3,"Node ID cannot exceed 1000 characters").optional()}).test("custom-validation","Custom validation failed",pe([],["chatflow","nodeId"]))}),It={userRead:async(n,e)=>{await td.validate({params:n.params},{abortEarly:!1});const{data:t}=await De.get(`/conversation/user/read/${n.params.id}`,{headers:{Authorization:`Bearer ${e}`}});return t},userReadAll:async(n,e)=>{await nd.validate({query:e==null?void 0:e.query},{abortEarly:!1});const{data:t}=await De.get("/conversation/user/readAll",{params:e==null?void 0:e.query,headers:{Authorization:`Bearer ${n}`}});return t},userUpdateCurrentNode:async(n,e)=>{await rd.validate({params:n.params,body:n.body},{abortEarly:!1});const{data:t}=await De.post(`/conversation/user/update/currentNode/${n.params.id}`,n.body,{headers:{Authorization:`Bearer ${e}`}});return t},userAssignToAgent:async(n,e)=>{await sd.validate({params:n.params,body:n.body},{abortEarly:!1});const{data:t}=await De.post(`/conversation/user/update/assign/${n.params.id}`,n.body,{headers:{Authorization:`Bearer ${e}`}});return t},userCreate:async(n,e)=>{await id.validate({body:n.body},{abortEarly:!1});const{data:t}=await De.post("/conversation/user/create",n.body,{headers:{Authorization:`Bearer ${e}`}});return t}},od=({className:n,style:e={}})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",viewBox:"0 0 256 256",className:n,style:e,children:p("path",{fill:"currentColor",d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"})}),cn=({className:n,width:e=16,height:t=16})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"})}),Jt=({className:n})=>p("svg",{width:"100%",height:"100%",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg",className:n,children:p("path",{fill:"currentColor",d:"M13 0C10.4288 0 7.91543 0.762437 5.77759 2.1909C3.63975 3.61935 1.97351 5.64968 0.989572 8.02512C0.0056327 10.4006 -0.251811 13.0144 0.249797 15.5362C0.751405 18.0579 1.98953 20.3743 3.80762 22.1924C5.6257 24.0105 7.94208 25.2486 10.4638 25.7502C12.9856 26.2518 15.5995 25.9944 17.9749 25.0104C20.3503 24.0265 22.3807 22.3603 23.8091 20.2224C25.2376 18.0846 26 15.5712 26 13C25.9964 9.5533 24.6256 6.24882 22.1884 3.81163C19.7512 1.37445 16.4467 0.00363977 13 0Z"})}),Fo=({className:n})=>p("svg",{width:"11",height:"6",viewBox:"0 0 11 6",xmlns:"http://www.w3.org/2000/svg",className:n,children:p("path",{fill:"currentColor",d:"M10.7884 1.18378L6.00738 5.79649C5.94076 5.861 5.86159 5.91218 5.77442 5.9471C5.68725 5.98202 5.59379 6 5.4994 6C5.40501 6 5.31156 5.98202 5.22438 5.9471C5.13721 5.91218 5.05805 5.861 4.99142 5.79649L0.210413 1.18378C0.0756879 1.0538 0 0.877507 0 0.693683C0 0.50986 0.0756879 0.333566 0.210413 0.203583C0.345138 0.0736001 0.527865 0.000576714 0.718395 0.000576712C0.908925 0.00057671 1.09165 0.0736001 1.22638 0.203583L5.5 4.32677L9.77362 0.203007C9.90835 0.0730239 10.0911 0 10.2816 0C10.4721 0 10.6549 0.0730239 10.7896 0.203007C10.9243 0.332989 11 0.509284 11 0.693107C11 0.87693 10.9243 1.05322 10.7896 1.18321Z"})}),ad=({className:n})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M234.29,114.85l-45,38.83L203,211.75a16.4,16.4,0,0,1-24.5,17.82L128,198.49,77.47,229.57A16.4,16.4,0,0,1,53,211.75l13.76-58.07-45-38.83A16.46,16.46,0,0,1,31.08,86l59-4.76,22.76-55.08a16.36,16.36,0,0,1,30.27,0l22.75,55.08,59,4.76a16.46,16.46,0,0,1,9.37,28.86Z"})}),Lo=({className:n,width:e=32,height:t=32})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"})}),ld=({className:n,width:e=32})=>p("svg",{width:e,height:e*2,viewBox:"0 0 9 14",xmlns:"http://www.w3.org/2000/svg",className:n,children:[p("circle",{cx:"6.99929",cy:"1.27273",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"1.27273",cy:"1.27273",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"6.99929",cy:"7.00002",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"1.27273",cy:"7.00002",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"6.99929",cy:"12.7273",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"1.27273",cy:"12.7273",r:"1.27273",fill:"currentColor"})]}),cd=({className:n})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M231.87,114l-168-95.89A16,16,0,0,0,40.92,37.34L71.55,128,40.92,218.67A16,16,0,0,0,56,240a16.15,16.15,0,0,0,7.93-2.1l167.92-96.05a16,16,0,0,0,.05-27.89ZM56,224a.56.56,0,0,0,0-.12L85.74,136H144a8,8,0,0,0,0-16H85.74L56.06,32.16A.46.46,0,0,0,56,32l168,95.83Z"})}),ud=({className:n})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M209.66,122.34a8,8,0,0,1,0,11.32l-82.05,82a56,56,0,0,1-79.2-79.21L147.67,35.73a40,40,0,1,1,56.61,56.55L105,193A24,24,0,1,1,71,159L154.3,74.38A8,8,0,1,1,165.7,85.6L82.39,170.31a8,8,0,1,0,11.27,11.36L192.93,81A24,24,0,1,0,159,47L59.76,147.68a40,40,0,1,0,56.53,56.62l82.06-82A8,8,0,0,1,209.66,122.34Z"})}),dd="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAAAxCAYAAAB+gjFbAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAALhSURBVHgB7ZlNbtpAFMf/MxC1qySIdNFVnRtwg5ATlJygdNdFCuYEgRPEVN2HnqD0BNAbJCeId13kA6SuKjUzfW8MgQbHGJi09ig/aWQbxpJ/fvPlNwLrcnxVhZAVSHFAVxUqu5OyKaEpWl1AYYjizyGC/THWQKxU27/chdpuQggfdkRSonu4U1/w+dVwlbvSybGU3j6h6j7+L0OIX+8RvA7TVF4u9/HKhyyQ2L+M1DJ0gG65taxWslzz5jQD0XqMkKJ4mBTFeDnTDHe+0lkV2SZRUMbeoncGyL4Y40G/GMD/4cX9uShnmqIZ2vPCRHC0MCb8Ledf1zPcx5IgQX328MdZn+PQ8hvginlFqCMEe/3p5SxyaquNPIsxWp7ON89IjqMm5DvkH49WMvXpRSQXRc0NpLgPUiQn5AHcoQKfFvVguWNz4sEllKzxQULKKlxDmM8wbpY6TxN2WoyTpP72Bi7yYeTxgOLBRV7CyGXoO80uEg7zLJdXnuXyii05ymWIQyr75qh0Cxrf6ffkZCrX0bpL9xzd3wucwxICzVuNTeEH/FSO/4L3R7xa8KBUtBKSMkQkECIoLcrzolcXBtgUelFF2OHxCAUlFuHSRyr0WqnzOOw0S5tLuN/SgyUs9Tldi8s+rYVEDZawNaBQEledYFOinSNr6Q6LUwGlBBuj9R+M8ziFwhnscW53nhO01dS4WT2CHDG7aUUzEtufxIVo0/RyOUlfJMPRalz3KGJ286UaF3ywNRU8xDMP3LzlHdJvNKn3qYyh7sYoblXoBXiUpXpLD1FdcfszHVqZacfOJJ41eLUTlEIH15aix2J85p6cQGd66pjcLGqMS3LhfNQYd+SEas1HjXFDTujO/L7clPzLGbFyO+6vfMsliDFPtUJ5asZRH9vrJVXKnxznXaSok1i4rGp+5CKpNrqlYdpbsi1nhPSQhoY+Sa2cFStS5qqDrKCpLxUkJ4ii7Fi3tFGy6A+7st8LQyzi5QAAAABJRU5ErkJggg==",os=n=>{const e=new Date(n);if(Number.isNaN(e.getTime()))return"Invalid date";const r=new Date().getTime()-e.getTime();if(r<0)return"just now";const s=Math.floor(r/1e3),i=Math.floor(s/60),o=Math.floor(i/60),a=Math.floor(o/24),l=Math.floor(a/30),c=Math.floor(l/12);let d=[{limit:60*1e3,label:"just now"},{limit:60*60*1e3,label:`${i} minute${i!==1?"s":""}`},{limit:24*60*60*1e3,label:`${o} hour${o!==1?"s":""}`},{limit:30*24*60*60*1e3,label:`${a} day${a!==1?"s":""}`}].find(g=>r<g.limit);return d?d.label:l>0?`${l} month${l!==1?"s":""} ago`:`${c} year${c!==1?"s":""} ago`},hd=V().shape({name:Y().min(1,"Name must be at least 1 character").max(1e3,"Name cannot exceed 1000 characters").required("Name is required"),url:Y().min(1,"URL must be at least 1 character").max(1e3,"URL cannot exceed 1000 characters").required("URL is required")}).test("custom-validation","Custom validation failed",pe(["name","url"])),fd=V().shape({text:Y().min(1,"Text must be at least 1 character").max(1e3,"Text cannot exceed 1000 characters").optional(),file:hd.when("text",{is:n=>!n,then:n=>n.required(),otherwise:n=>n.strip()})}).test("text-or-file","Either 'text' or 'file' must be provided",function(n){const{text:e,file:t}=n;return!e&&!t?this.createError({path:"data",message:"Either 'text' or 'file' must be provided"}):!0}).test("custom-validation","Custom validation failed",pe([],["text","file"])),pd=V().shape({params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",pe(["id"]))}),gd=V().shape({body:V().shape({conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Conversation Id").required("Conversation Id is required"),skip:ln().min(0,"Skip must be at least 0").max(1e4,"Skip cannot exceed 10000").optional()}).test("custom-validation","Custom validation failed",pe(["conversationId"],["skip"]))}),jo=V().shape({body:V().shape({owner:Y().oneOf(["ai","user"]).required("Owner must be 'ai' or 'user'"),conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Conversation Id").required("Conversation Id is required"),type:Y().oneOf(["AI Text","Human Text","External API","External API Text","AI Response"]).required("Type is required"),data:fd.required("Message data is required"),currentChatflow:V().shape({key:Y().max(1e3,"Key cannot exceed 1000 characters").optional(),index:ln().max(1e3,"Index cannot exceed 1000").optional()}).nullable().optional()}).test("custom-validation","Custom validation failed",pe(["owner","conversationId","type","data"],["currentChatflow"]))}),md=V().shape({body:V().shape({queries:Hn().of(Y().min(1,"Query must be at least 1 character").max(1e3,"Query cannot exceed 1000 characters")).max(200,"Queries cannot exceed 200 items").optional(),conversationHistory:Hn().of(V().shape({user:Y().min(1,"User message must be at least 1 character").max(1e3,"User message cannot exceed 1000 characters").optional(),ai:Y().min(1,"AI message must be at least 1 character").max(1e3,"AI message cannot exceed 1000 characters").optional()}).test("custom-validation","Custom validation failed",pe([],["user","ai"]))).min(1,"Conversation history must have at least 1 entry").max(3,"Conversation history cannot exceed 3 entries").required("Conversation history is required")}).test("custom-validation","Custom validation failed",pe(["queries","conversationHistory"]))}),bd=V().shape({body:V().shape({conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Conversation Id").required("Conversation Id is required"),conversationHistory:Hn().of(V().shape({user:Y().min(1,"User message must be at least 1 character").max(1e3,"User message cannot exceed 1000 characters").optional(),ai:Y().min(1,"AI message must be at least 1 character").max(2500,"AI message cannot exceed 2500 characters").optional()}).test("custom-validation","Custom validation failed",pe([],["user","ai"]))).min(1,"Conversation history must have at least 1 entry").max(8,"Conversation history cannot exceed 8 entries").required("Conversation history is required"),enableStreaming:rs().optional()}).test("custom-validation","Custom validation failed",pe(["conversationId","conversationHistory"],["enableStreaming"]))}),as={userReadAll:async(n,e)=>{await gd.validate({body:n.body},{abortEarly:!1});const{data:t}=await De.post("/message/user/readAll",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userUpdateSeen:async(n,e)=>{await pd.validate({params:n.params},{abortEarly:!1});const{data:t}=await De.post(`/message/user/update/seen/${n.params.id}`,{},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userCreate:async(n,e)=>{await jo.validate({body:n.body},{abortEarly:!1});const{data:t}=await De.post("/message/user/create",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userAIContextMessage:async(n,e)=>{await bd.validate({body:n.body},{abortEarly:!1});const{data:t}=await De.post("/message/user/ai/message",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userAICheckQueries:async(n,e)=>{await md.validate({body:n.body},{abortEarly:!1});const{data:t}=await De.post("/message/user/ai/checkQueries",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t}},_d={userUploadAsset:async(n,e)=>{const t=new FormData;t.append("file",n);const{data:r}=await De.post("/asset/userUpload",t,{headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e}`}});return r}};V().shape({rating:Y().trim().min(1).max(1),skip:Y().trim().min(1).max(1e3),limit:Y().trim().min(1).max(1e3)}).test("custom-validation","Custom validation failed",pe([],["rating","skip","limit"]));const vd=V().shape({body:V().shape({conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Conversation Id is required"),chatbotId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Chatbot Id is required"),comment:Y().trim().max(500).min(3).required("Comment is required"),rating:ln().max(5).min(1).required("Rating is required")}).test("custom-validation","Custom validation failed",pe(["conversationId","chatbotId","comment","rating"]))}),yd={userCreate:async(n,e)=>{await vd.validate({body:n.body},{abortEarly:!1});const{data:t}=await De.post("/review/user/create",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t}};class xd{constructor(){this.buffer="",this.eventType=null,this.eventData=""}async parseStream(e,t,r){const s=e.body.getReader(),i=new TextDecoder;try{for(;;){const{done:o,value:a}=await s.read();if(o)break;this.buffer+=i.decode(a,{stream:!0}),this.processBuffer(t)}this.buffer.trim()&&this.processBuffer(t),t({type:"done",data:{}})}catch(o){console.error("SSE parsing failed:",o),r(o instanceof Error?o:new Error("Stream parsing failed"))}}processBuffer(e){const t=this.buffer.split(`
10
+ `);this.buffer=t.pop()||"";for(const r of t)if(r.startsWith("event: "))this.eventType=r.replace("event: ","");else if(r.startsWith("data: "))this.eventData+=r.replace("data: ","");else if(r.trim()===""){if(this.eventType&&this.eventData)try{e({type:this.eventType,data:JSON.parse(this.eventData)})}catch{console.error("Failed to parse SSE data:",this.eventData)}this.eventType=null,this.eventData=""}}}const wd="token123",nt="3",kd=[{_id:"1",owner:"user",ownerId:nt,conversationId:"21",chatbotId:"7",conversationOwnerId:nt,chatbotOwnerId:"9",seen:!1,data:{text:"So, I was curious about RoboDialog"},type:"Human Text",createdAt:"2026-01-02T10:34:14.396Z",updatedAt:"2026-01-02T10:34:14.396Z"},{_id:"2",owner:"ai",ownerId:null,conversationId:"21",chatbotId:"7",conversationOwnerId:nt,chatbotOwnerId:"9",seen:!1,data:{text:`## 🤖 RoboDialog
11
11
  **RoboDialog** is a friendly AI expert that helps businesses save time and money on customer support.
12
12
 
13
13
  It offers an intelligent chat interface, an advanced chatflow builder, human support integration, and flexible subscription plans.
14
14
 
15
- Is there anything specific you'd like to know more about?`},type:"AI Response",createdAt:"2026-01-02T10:34:38.885Z",updatedAt:"2026-01-02T10:34:38.885Z"},{_id:"3",owner:"user",ownerId:rt,conversationId:"21",chatbotId:"7",conversationOwnerId:rt,chatbotOwnerId:"9",seen:!1,data:{text:"That was really helpful, is free plan completely free of charge, right?"},type:"Human Text",createdAt:"2026-01-02T10:57:13.302Z",updatedAt:"2026-01-02T10:57:13.302Z"}],Sd=[{_id:"21",userId:rt,visitor:!0,chatbotId:"7",chatbotOwnerId:"9",currentNode:"1",currentChatflow:{key:"end",index:0},assignedTo:null,assignTo:null,assignType:null,latestMessage:"3",createdAt:"2026-01-02T11:50:23.062Z",updatedAt:"2026-01-02T11:51:12.290Z"}],Cd={_id:"21",userId:rt,visitor:!0,chatbotId:"7",chatbotOwnerId:"9",currentNode:"1",currentChatflow:{key:"end",index:0},assignedTo:null,assignTo:null,assignType:null,latestMessage:"3",createdAt:"2026-01-02T11:50:23.062Z",updatedAt:"2026-01-02T11:51:12.290Z"},xt=()=>typeof window<"u"&&window.console&&window.location.hostname!=="localhost"?console:{log:()=>{},error:()=>{}},Se={TEXT:"text",EXTERNAL_API:"externalAPI",HOVERING_MESSAGE:"hoveringMessage",END:"end"},zo=[Se.TEXT,Se.EXTERNAL_API,Se.HOVERING_MESSAGE,Se.END],Vn=(n,e,t)=>{if(!n||!n.key)return!0;const r=zo.indexOf(n.key),s=zo.indexOf(e);return s>r?!0:s===r&&typeof t<"u"&&typeof n.index<"u"?t>n.index:!1},Ed=async(n,e,t,r,s)=>{if(!(!e.token||n.owner!=="agent"||n.seen))try{await ls.userUpdateSeen({params:{id:n._id}},e.token);const o=(a=>a.map(l=>l._id===n._id?{...l,seen:!0}:l))(t.messagesRef.current||[]);t.setMessages(o),t.messagesRef.current=o}catch(i){Nt(i,s,"Failed to mark message as seen")}},Ad=async(n,e,t,r,s,i)=>{if(!(!n.token||!e.currentConversation))try{const o=await $t.userAssignToAgent({params:{id:e.currentConversation._id},body:{assignType:s,assignTo:i||""}},n.token);if(!o.data)throw new Error("Assignment failed");const{conversation:a,onlineAgents:l}=o.data,c=e.conversations.map(u=>u._id===a._id?a:u);e.setConversations(c),e.setCurrentConversation(a),t.setOnlineAgents(l)}catch(o){Nt(o,r,"Failed to assign to agent")}},Rd=async(n,e,t,r,s)=>{if(!(!e.token||!t.currentConversation||!e.chatbot))try{await xd.userCreate({body:{...n,conversationId:t.currentConversation._id,chatbotId:e.chatbot._id}},e.token),s("Thank you for your feedback","success")}catch(i){Nt(i,s,"Failed to submit review")}},qo=async n=>{const{data:e,coreState:t,conversationState:r,uiState:s,type:i,showToast:o,currentChatflow:a,owner:l,latestCurrentConversation:c}=n,u=c||r.currentConversation,{isDefaultExternalAPI:d}=t;if(d){const h={_id:ki(),conversationId:"21",data:e,type:i,currentChatflow:a,owner:l,ownerId:rt,chatbotId:"7",conversationOwnerId:rt,chatbotOwnerId:"9",seen:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},f=[...r.messagesRef.current||[],h];return r.messagesRef.current=f,r.setMessages(f),null}if(!t.token||!u)return null;const g={owner:l,conversationId:u._id,data:e,type:i,currentChatflow:a};try{await Uo.validate({body:g},{abortEarly:!1});const h=await ls.userCreate({body:g},t.token);if(!h.data)throw new Error("Message creation failed");const f=h.data,m=[...r.messagesRef.current||[],f];if(r.messagesRef.current=m,r.setMessages(m),a){const b=r.conversations.map(v=>v._id===u._id?{...v,currentChatflow:a}:v);r.setConversations(b)}return{messages:r.messagesRef.current,conversations:r.conversations.map(b=>b._id===u._id&&a?{...b,currentChatflow:a}:b)}}catch(h){if(h instanceof ve){const f=h.inner.map(m=>m.message).join(", ");o(f,"error")}else Nt(h,o,"Failed to send message");return null}},st=async n=>{const{coreState:e,conversationState:t,uiState:r,showToast:s,...i}=n;r.setAiLoading(!0);try{await qo({...i,coreState:e,conversationState:t,uiState:r,type:"AI Text",owner:"ai",showToast:s})}finally{r.setAiLoading(!1)}},cs=async n=>{const{showToast:e,conversationState:t,coreState:r,uiState:s,latestCurrentConversation:i}=n;s.setUserLoading(!0);try{return await qo({...n,conversationState:t,coreState:r,uiState:s,showToast:e,type:"Human Text",latestCurrentConversation:i})}finally{s.setUserLoading(!1)}},Bo=async n=>{var d,g,h,f;const{externalAPI:e,userData:t,currentChatflow:r,currentNode:s,conversationState:i,coreState:o,showToast:a,uiState:l}=n,{userData:c,isDefaultExternalAPI:u}=o;try{l.setAiLoading(!0);let m=e.url;if((d=e.params)!=null&&d.length){const T=new URLSearchParams;e.params.forEach(A=>{const D=String(t[A.value]??A.value??"");T.append(A.key,D)}),m+=`?${T.toString()}`}const b=e.method.toUpperCase();let v;b!=="GET"&&((g=e.body)!=null&&g.length)&&(v={},e.body.forEach(T=>{v[T.key]=t[T.value]??T.value??""}));const x={Accept:"application/json"};v&&(x["Content-Type"]="application/json"),e.bearerToken&&(x.Authorization=`Bearer ${(c==null?void 0:c.bearer)||((h=window.robodialog)==null?void 0:h.bearerToken)||""}`);const w=await fetch(m,{method:b,headers:x,body:v?JSON.stringify(v):void 0}),k=w.status;let _=null;try{_=await w.json()}catch{_=null}const S=(f=e.response)==null?void 0:f.find(T=>T.statusCode===k);if(S){if(S.type==="path"&&S.id)return u?(await st({data:{text:"The AI will continue with specified path"},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),await st({data:{text:`External API Response ( Testing ):
15
+ Is there anything specific you'd like to know more about?`},type:"AI Response",createdAt:"2026-01-02T10:34:38.885Z",updatedAt:"2026-01-02T10:34:38.885Z"},{_id:"3",owner:"user",ownerId:nt,conversationId:"21",chatbotId:"7",conversationOwnerId:nt,chatbotOwnerId:"9",seen:!1,data:{text:"That was really helpful, is free plan completely free of charge, right?"},type:"Human Text",createdAt:"2026-01-02T10:57:13.302Z",updatedAt:"2026-01-02T10:57:13.302Z"}],Td=[{_id:"21",userId:nt,visitor:!0,chatbotId:"7",chatbotOwnerId:"9",currentNode:"1",currentChatflow:{key:"end",index:0},assignedTo:null,assignTo:null,assignType:null,latestMessage:"3",createdAt:"2026-01-02T11:50:23.062Z",updatedAt:"2026-01-02T11:51:12.290Z"}],Sd={_id:"21",userId:nt,visitor:!0,chatbotId:"7",chatbotOwnerId:"9",currentNode:"1",currentChatflow:{key:"end",index:0},assignedTo:null,assignTo:null,assignType:null,latestMessage:"3",createdAt:"2026-01-02T11:50:23.062Z",updatedAt:"2026-01-02T11:51:12.290Z"},yt=()=>typeof window<"u"&&window.console&&window.location.hostname!=="localhost"?console:{log:()=>{},error:()=>{}},Te={TEXT:"text",EXTERNAL_API:"externalAPI",HOVERING_MESSAGE:"hoveringMessage",END:"end"},Uo=[Te.TEXT,Te.EXTERNAL_API,Te.HOVERING_MESSAGE,Te.END],Wn=(n,e,t)=>{if(!n||!n.key)return!0;const r=Uo.indexOf(n.key),s=Uo.indexOf(e);return s>r?!0:s===r&&typeof t<"u"&&typeof n.index<"u"?t>n.index:!1},Cd=async(n,e,t,r,s)=>{if(!(!e.token||n.owner!=="agent"||n.seen))try{await as.userUpdateSeen({params:{id:n._id}},e.token);const o=(a=>a.map(l=>l._id===n._id?{...l,seen:!0}:l))(t.messagesRef.current||[]);t.setMessages(o),t.messagesRef.current=o}catch(i){$t(i,s,"Failed to mark message as seen")}},Ed=async(n,e,t,r,s,i)=>{if(!(!n.token||!e.currentConversation))try{const o=await It.userAssignToAgent({params:{id:e.currentConversation._id},body:{assignType:s,assignTo:i||""}},n.token);if(!o.data)throw new Error("Assignment failed");const{conversation:a,onlineAgents:l}=o.data,c=e.conversations.map(u=>u._id===a._id?a:u);e.setConversations(c),e.setCurrentConversation(a),t.setOnlineAgents(l)}catch(o){$t(o,r,"Failed to assign to agent")}},Ad=async(n,e,t,r,s)=>{if(!(!e.token||!t.currentConversation||!e.chatbot))try{await yd.userCreate({body:{...n,conversationId:t.currentConversation._id,chatbotId:e.chatbot._id}},e.token),s("Thank you for your feedback","success")}catch(i){$t(i,s,"Failed to submit review")}},zo=async n=>{const{data:e,coreState:t,conversationState:r,uiState:s,type:i,showToast:o,currentChatflow:a,owner:l,latestCurrentConversation:c}=n,u=c||r.currentConversation,{isDefaultExternalAPI:d}=t;if(d){const h={_id:wi(),conversationId:"21",data:e,type:i,currentChatflow:a,owner:l,ownerId:nt,chatbotId:"7",conversationOwnerId:nt,chatbotOwnerId:"9",seen:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},f=[...r.messagesRef.current||[],h];return r.messagesRef.current=f,r.setMessages(f),null}if(!t.token||!u)return null;const g={owner:l,conversationId:u._id,data:e,type:i,currentChatflow:a};try{await jo.validate({body:g},{abortEarly:!1});const h=await as.userCreate({body:g},t.token);if(!h.data)throw new Error("Message creation failed");const f=h.data,m=[...r.messagesRef.current||[],f];if(r.messagesRef.current=m,r.setMessages(m),a){const b=r.conversations.map(v=>v._id===u._id?{...v,currentChatflow:a}:v);r.setConversations(b)}return{messages:r.messagesRef.current,conversations:r.conversations.map(b=>b._id===u._id&&a?{...b,currentChatflow:a}:b)}}catch(h){if(h instanceof _e){const f=h.inner.map(m=>m.message).join(", ");o(f,"error")}else $t(h,o,"Failed to send message");return null}},rt=async n=>{const{coreState:e,conversationState:t,uiState:r,showToast:s,...i}=n;r.setAiLoading(!0);try{await zo({...i,coreState:e,conversationState:t,uiState:r,type:"AI Text",owner:"ai",showToast:s})}finally{r.setAiLoading(!1)}},ls=async n=>{const{showToast:e,conversationState:t,coreState:r,uiState:s,latestCurrentConversation:i}=n;s.setUserLoading(!0);try{return await zo({...n,conversationState:t,coreState:r,uiState:s,showToast:e,type:"Human Text",latestCurrentConversation:i})}finally{s.setUserLoading(!1)}},qo=async n=>{var d,g,h,f;const{externalAPI:e,userData:t,currentChatflow:r,currentNode:s,conversationState:i,coreState:o,showToast:a,uiState:l}=n,{userData:c,isDefaultExternalAPI:u}=o;try{l.setAiLoading(!0);let m=e.url;if((d=e.params)!=null&&d.length){const T=new URLSearchParams;e.params.forEach(A=>{const D=String(t[A.value]??A.value??"");T.append(A.key,D)}),m+=`?${T.toString()}`}const b=e.method.toUpperCase();let v;b!=="GET"&&((g=e.body)!=null&&g.length)&&(v={},e.body.forEach(T=>{v[T.key]=t[T.value]??T.value??""}));const x={Accept:"application/json"};v&&(x["Content-Type"]="application/json"),e.bearerToken&&(x.Authorization=`Bearer ${(c==null?void 0:c.bearer)||((h=window.robodialog)==null?void 0:h.bearerToken)||""}`);const w=await fetch(m,{method:b,headers:x,body:v?JSON.stringify(v):void 0}),k=w.status;let _=null;try{_=await w.json()}catch{_=null}const S=(f=e.response)==null?void 0:f.find(T=>T.statusCode===k);if(S){if(S.type==="path"&&S.id)return u?(await rt({data:{text:"The AI will continue with specified path"},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),await rt({data:{text:`External API Response ( Testing ):
16
16
  \`\`\`json
17
17
  ${JSON.stringify(_,null,2)}
18
- \`\`\``},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),!0):await Yn({source:s.id,sourceHandle:S.id,conversationState:i,coreState:o,showToast:a,uiState:l});if(S.message){const T=Ul(S.message,t,_);return await st({data:{text:T},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),u&&await st({data:{text:`External API Response ( Testing ):
18
+ \`\`\``},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),!0):await Vn({source:s.id,sourceHandle:S.id,conversationState:i,coreState:o,showToast:a,uiState:l});if(S.message){const T=jl(S.message,t,_);return await rt({data:{text:T},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),u&&await rt({data:{text:`External API Response ( Testing ):
19
19
  \`\`\`json
20
20
  ${JSON.stringify(_,null,2)}
21
- \`\`\``},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),!1}}const P=w.ok?"Successfully Submitted":"Sorry, we encountered an error while processing your request. Please try again later.";return await st({data:{text:P},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),u&&await st({data:{text:`External API Response ( Testing ):
21
+ \`\`\``},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),!1}}const P=w.ok?"Successfully Submitted":"Sorry, we encountered an error while processing your request. Please try again later.";return await rt({data:{text:P},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),u&&await rt({data:{text:`External API Response ( Testing ):
22
22
  \`\`\`json
23
23
  ${JSON.stringify(_,null,2)}
24
- \`\`\``},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),!1}catch(m){return xt().error("External API call failed:",m),await st({data:{text:"Sorry, we encountered an error while processing your request. Please try again later."},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),u&&await st({data:{text:`External API Response ( Testing ):
24
+ \`\`\``},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),!1}catch(m){return yt().error("External API call failed:",m),await rt({data:{text:"Sorry, we encountered an error while processing your request. Please try again later."},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),u&&await rt({data:{text:`External API Response ( Testing ):
25
25
  \`\`\`json
26
26
  ${JSON.stringify(m,null,2)}
27
- \`\`\``},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),!1}finally{l.setAiLoading(!1)}},Ho=async n=>{const{externalAPI:e,currentChatflow:t,currentNode:r,coreState:s,conversationState:i,uiState:o,showToast:a}=n;return new Promise(l=>{var c;if(((c=e.dataFromUser)==null?void 0:c.length)>0){const u=async g=>{o.setDataFromUser(null);let h="";for(const m in g){const b=e.dataFromUser.find(v=>v.key===m);h+=`${b==null?void 0:b.name}: ${g[m]}
27
+ \`\`\``},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),!1}finally{l.setAiLoading(!1)}},Bo=async n=>{const{externalAPI:e,currentChatflow:t,currentNode:r,coreState:s,conversationState:i,uiState:o,showToast:a}=n;return new Promise(l=>{var c;if(((c=e.dataFromUser)==null?void 0:c.length)>0){const u=async g=>{o.setDataFromUser(null);let h="";for(const m in g){const b=e.dataFromUser.find(v=>v.key===m);h+=`${b==null?void 0:b.name}: ${g[m]}
28
28
 
29
- `}await cs({data:{text:h},currentChatflow:t,coreState:s,conversationState:i,uiState:o,showToast:a,type:"Human Text",owner:"user"});const f=await Bo({userData:g,externalAPI:e,currentChatflow:t,currentNode:r,coreState:s,conversationState:i,uiState:o,showToast:a});l(f)},d=()=>{l(!1)};o.setDataFromUser({data:e.dataFromUser,onSubmit:u,onCancel:d})}else(async()=>{const d=await Bo({externalAPI:e,currentChatflow:t,currentNode:r,coreState:s,conversationState:i,uiState:o,showToast:a,userData:{}});l(d)})()})},Wo=async(n,e,t,r,s,i)=>{if(!n.token||!(e.currentConversation||i))return;const{chatbot:o}=n,{currentConversation:a,setMessages:l,messagesRef:c}=e,{setAiLoading:u}=t,d=i||a,g=Od(s,d._id);u(!0);const h={_id:`streaming_${Date.now()}`,conversationId:d._id,owner:"ai",ownerId:void 0,data:{text:["Analyzing user query","Gathering relevant context","Understanding your question","Processing your request","Running initial analysis"][Math.floor(Math.random()*5)],thinking:[],path:void 0},type:"AI Response",createdAt:"9999-01-01",updatedAt:"9999-01-01",chatbotId:o._id,conversationOwnerId:"",chatbotOwnerId:"",seen:!1};l(f=>{const m=[...f,h];return c.current=m,m});try{const f=await fetch(`${co}/message/user/ai/message`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.token}`},body:JSON.stringify({conversationId:d._id,conversationHistory:g,enableStreaming:!0})});if(!f.ok)throw f.status===400&&(await f.json()).message==="AI Message Limit Reached"?new Error("AI Message Limit Reached"):new Error(`HTTP error! status: ${f.status}`);const m=new wd;let b="",v=null,x=!1,w=!0;await m.parseStream(f,k=>{var _,S;switch(k.type){case"token":x=!0;const P=((_=k.data)==null?void 0:_.data)||"";w?b=P:b+=P,l(A=>{const D=A.map(E=>E._id===h._id?{...E,data:{...E.data,...w&&{thinking:[...E.data.thinking||[],E.data.text??""]},text:b}}:E);return c.current=D,D}),w=!1;break;case"tool":w=!0;break;case"complete":const T=((S=k.data)==null?void 0:S.data)||"{}";try{const A=typeof T=="string"?JSON.parse(T):T;v=A.path||null,A.message&&!x&&(b=A.message)}catch{xt().error("Failed to parse complete event data:",T)}break;case"done":if(l(A=>{const D=A.map(E=>E._id===h._id?{_id:`ai_${Date.now()}`,conversationId:d._id,owner:"ai",ownerId:void 0,data:{text:v?"":b,path:v??void 0},type:"AI Response",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),chatbotId:o._id,conversationOwnerId:"",chatbotOwnerId:"",seen:!0}:E);return c.current=D,D}),v){const A=o.chatflow.nodes.find(D=>D.type==="AIControlNode");A&&Yn({source:A.id,sourceHandle:v,conversationState:e,coreState:n,showToast:r,uiState:t,latestConversation:d})}break;case"error":xt().error("Streaming error:",k.data),r("Failed to get AI response","error"),l(A=>A.filter(D=>D._id!==h._id));break}},k=>{xt().error("Stream parsing error:",k),r("Failed to get AI response","error"),l(_=>_.filter(S=>S._id!==h._id))})}catch(f){if(xt().error("Error in sendAIMessageStream:",f),f.message==="AI Message Limit Reached"){const m=o.chatflow.nodes.find(b=>b.type==="AIControlNode");m&&await Yn({source:m.id,sourceHandle:m.data.outOfCredits.id,conversationState:e,coreState:n,showToast:r,uiState:t,latestConversation:d})}else Nt(f,r,"Failed to get AI response");l(m=>m.filter(b=>b._id!==h._id))}finally{u(!1)}},Yn=async n=>{const{source:e,sourceHandle:t,conversationState:r,coreState:s,showToast:i,uiState:o,latestConversation:a}=n,{chatbot:l,token:c}=s,{currentConversation:u}=r,{setAiLoading:d}=o,g=a||u;if(!l||!g||!c)return!1;const h=l.chatflow.edges.find(m=>m.source===e&&m.sourceHandle===t);if(!h)return!1;const f=l.chatflow.nodes.find(m=>m.id===h.target);if(!f)return!1;try{const m=await $t.userUpdateCurrentNode({params:{id:g._id},body:{currentNode:f.id}},c);if(!m.data)throw new Error("Node update failed");d(!1);const b=r.conversations.map(v=>v._id===g._id?m.data:v);return r.setConversations(b),await Xn({coreState:s,conversationState:r,uiState:o,showToast:i,updatedConversation:m.data}),!0}catch(m){return Nt(m,i,"Failed to change node"),!1}},Xn=async({coreState:n,conversationState:e,uiState:t,showToast:r,updatedConversation:s=null})=>{var m,b,v,x,w,k,_,S,P,T,A,D;const{chatbot:i,isDefaultExternalAPI:o,defaultExternalAPI:a}=n,{setCanMessage:l,setHumanControl:c,setHoveringMessageInner:u,setRatingFromUser:d}=t;if(o){await Ho({externalAPI:a,currentChatflow:{key:Se.EXTERNAL_API,index:0},currentNode:{},coreState:n,conversationState:e,uiState:t,showToast:r});return}const g=s||e.currentConversation;if(!i||!g)return;l(!1),c(!1),u(null);const h=i.chatflow.nodes.find(E=>E.id===g.currentNode);if(!h){r("Invalid conversation node","error");return}await Pd(h,g,n,e,t,r),!await Dd(h,g,n,e,t,r)&&((((b=(m=h.data)==null?void 0:m.hoveringMessageInner)==null?void 0:b.length)??0)>0&&Vn(g.currentChatflow,Se.HOVERING_MESSAGE)&&u({data:h.data.hoveringMessageInner,onClick:async E=>{if(u(null),E.type==="path")await Yn({source:h.id,sourceHandle:E.id,conversationState:e,coreState:n,showToast:r,uiState:t});else{l(!1);const j=await cs({data:{text:E.query},currentChatflow:{key:Se.HOVERING_MESSAGE,index:0},coreState:n,conversationState:e,uiState:t,showToast:r,type:"Human Text",owner:"user"});!t.humanControl&&!g.assignedTo&&await Wo(n,e,t,r,(j==null?void 0:j.messages)||[],g),l(!0)}}}),h.type==="EndConversation"?(l(!1),c(!1),(x=(v=h.data)==null?void 0:v.askForReview)!=null&&x.value&&Vn(g.currentChatflow,Se.END)&&d({onSubmit:async E=>{await Rd(E,n,e,t,r),await st({data:{text:"Thanks for your feedback"},coreState:n,conversationState:e,uiState:t,showToast:r,currentChatflow:{key:Se.END,index:0},type:"AI Text"}),d(null)}})):((k=(w=h.data)==null?void 0:w.control)==null?void 0:k.type)==="ai"?(c(!1),l(!0)):(await Ad(n,e,t,r,(S=(_=h.data)==null?void 0:_.control)==null?void 0:S.assignType,((T=(P=h.data)==null?void 0:P.control)==null?void 0:T.user)||((D=(A=h.data)==null?void 0:A.control)==null?void 0:D.role)),c(!0),l(!1)))};function Od(n,e){return n.filter(t=>t.conversationId===e).sort((t,r)=>new Date(r.updatedAt||"").getTime()-new Date(t.updatedAt||"").getTime()).slice(0,7).filter(t=>t.owner!=="agent").reverse().map(t=>({[`${t.owner}`]:t.data.text}))}async function Pd(n,e,t,r,s,i){const o=n.data;if(o!=null&&o.text)for(const[a,l]of o.text.entries())Vn(e.currentChatflow,Se.TEXT,a)&&await st({data:{text:l.value},currentChatflow:{key:Se.TEXT,index:a},coreState:t,conversationState:r,uiState:s,showToast:i,type:"AI Text"})}async function Dd(n,e,t,r,s,i){const o=n.data;if(o.externalAPI){for(const[a,l]of o.externalAPI.entries())if(Vn(e.currentChatflow,Se.EXTERNAL_API,a)&&await Ho({externalAPI:l.externalAPI,currentChatflow:{key:Se.EXTERNAL_API,index:a},currentNode:n,coreState:t,conversationState:r,uiState:s,showToast:i}))return!0}return!1}function Nt(n,e,t){e(t,"error"),xt().error(t,n)}async function us(n){var b;const{conversationState:e,coreState:t,uiState:r,userMessage:s,setUserMessage:i,file:o,setFile:a,latestCurrentConversation:l,showToast:c}=n,u=l||e.currentConversation;if(!u){c("No conversation found","error");return}if(!(s!=null&&s.trim()))return;const d=s.trim();i(""),r.setCanMessage(!1),r.setUserLoading(!0);const g=o;a(null);let h={text:d};if(g)try{const v=await vd.userUploadAsset(g,t.token);if(!v.data)throw new Error("File upload failed");h.file={name:g.name,url:v.data.url}}catch(v){Nt(v,c,"Failed to upload file"),r.setUserLoading(!1),r.setCanMessage(!0);return}const f=((b=u==null?void 0:u.currentChatflow)==null?void 0:b.key)!==Se.END?{key:Se.END,index:0}:null;f&&r.setHoveringMessageInner(null);const m=await cs({data:h,currentChatflow:f,coreState:t,conversationState:e,uiState:r,showToast:c,type:"Human Text",owner:"user",latestCurrentConversation:u});!r.humanControl&&!(u!=null&&u.assignedTo)&&await Wo(t,e,r,c,(m==null?void 0:m.messages)||[],u),r.setCanMessage(!0)}function ds(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Mt=ds();function Vo(n){Mt=n}var dn={exec:()=>null};function J(n,e=""){let t=typeof n=="string"?n:n.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(Ce.caret,"$1"),t=t.replace(s,o),r},getRegex:()=>new RegExp(t,e)};return r}var Id=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ce={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,listReplaceTabs:/^\t+/,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,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i")},$d=/^(?:[ \t]*(?:\n|$))+/,Nd=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Md=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Fd=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hs=/(?:[*+-]|\d{1,9}[.)])/,Yo=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Xo=J(Yo).replace(/bull/g,hs).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(),Ld=J(Yo).replace(/bull/g,hs).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(),fs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,jd=/^[^\n]+/,ps=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ud=J(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ps).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),zd=J(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,hs).getRegex(),Jn="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",gs=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,qd=J("^ {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[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",gs).replace("tag",Jn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Jo=J(fs).replace("hr",hn).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Jn).getRegex(),Bd=J(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Jo).getRegex(),ms={blockquote:Bd,code:Nd,def:Ud,fences:Md,heading:Fd,hr:hn,html:qd,lheading:Xo,list:zd,newline:$d,paragraph:Jo,table:dn,text:jd},Zo=J("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",hn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Jn).getRegex(),Hd={...ms,lheading:Ld,table:Zo,paragraph:J(fs).replace("hr",hn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Zo).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Jn).getRegex()},Wd={...ms,html:J(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",gs).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:dn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:J(fs).replace("hr",hn).replace("heading",` *#{1,6} *[^
30
- ]`).replace("lheading",Xo).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Vd=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Yd=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Go=/^( {2,}|\\)\n(?!\s*$)/,Xd=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Zn=/[\p{P}\p{S}]/u,bs=/[\s\p{P}\p{S}]/u,Ko=/[^\s\p{P}\p{S}]/u,Jd=J(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,bs).getRegex(),Qo=/(?!~)[\p{P}\p{S}]/u,Zd=/(?!~)[\s\p{P}\p{S}]/u,Gd=/(?:[^\s\p{P}\p{S}]|~)/u,Kd=J(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Id?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ea=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Qd=J(ea,"u").replace(/punct/g,Zn).getRegex(),eh=J(ea,"u").replace(/punct/g,Qo).getRegex(),ta="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",th=J(ta,"gu").replace(/notPunctSpace/g,Ko).replace(/punctSpace/g,bs).replace(/punct/g,Zn).getRegex(),nh=J(ta,"gu").replace(/notPunctSpace/g,Gd).replace(/punctSpace/g,Zd).replace(/punct/g,Qo).getRegex(),rh=J("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ko).replace(/punctSpace/g,bs).replace(/punct/g,Zn).getRegex(),sh=J(/\\(punct)/,"gu").replace(/punct/g,Zn).getRegex(),ih=J(/^<(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(),oh=J(gs).replace("(?:-->|$)","-->").getRegex(),ah=J("^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",oh).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Gn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,lh=J(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Gn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),na=J(/^!?\[(label)\]\[(ref)\]/).replace("label",Gn).replace("ref",ps).getRegex(),ra=J(/^!?\[(ref)\](?:\[\])?/).replace("ref",ps).getRegex(),ch=J("reflink|nolink(?!\\()","g").replace("reflink",na).replace("nolink",ra).getRegex(),sa=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,_s={_backpedal:dn,anyPunctuation:sh,autolink:ih,blockSkip:Kd,br:Go,code:Yd,del:dn,emStrongLDelim:Qd,emStrongRDelimAst:th,emStrongRDelimUnd:rh,escape:Vd,link:lh,nolink:ra,punctuation:Jd,reflink:na,reflinkSearch:ch,tag:ah,text:Xd,url:dn},uh={..._s,link:J(/^!?\[(label)\]\((.*?)\)/).replace("label",Gn).getRegex(),reflink:J(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Gn).getRegex()},vs={..._s,emStrongRDelimAst:nh,emStrongLDelim:eh,url:J(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",sa).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:J(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",sa).getRegex()},dh={...vs,br:J(Go).replace("{2,}","*").getRegex(),text:J(vs.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Kn={normal:ms,gfm:Hd,pedantic:Wd},fn={normal:_s,gfm:vs,breaks:dh,pedantic:uh},hh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ia=n=>hh[n];function pt(n,e){if(e){if(Ce.escapeTest.test(n))return n.replace(Ce.escapeReplace,ia)}else if(Ce.escapeTestNoEncode.test(n))return n.replace(Ce.escapeReplaceNoEncode,ia);return n}function oa(n){try{n=encodeURI(n).replace(Ce.percentDecode,"%")}catch{return null}return n}function aa(n,e){var i;let t=n.replace(Ce.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),r=t.split(Ce.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(Ce.slashPipe,"|");return r}function pn(n,e,t){let r=n.length;if(r===0)return"";let s=0;for(;s<r&&n.charAt(r-s-1)===e;)s++;return n.slice(0,r-s)}function fh(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===e[0])t++;else if(n[r]===e[1]&&(t--,t<0))return r;return t>0?-2:-1}function la(n,e,t,r,s){let i=e.href,o=e.title||null,a=n[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function ph(n,e,t){let r=n.match(t.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
29
+ `}await ls({data:{text:h},currentChatflow:t,coreState:s,conversationState:i,uiState:o,showToast:a,type:"Human Text",owner:"user"});const f=await qo({userData:g,externalAPI:e,currentChatflow:t,currentNode:r,coreState:s,conversationState:i,uiState:o,showToast:a});l(f)},d=()=>{l(!1)};o.setDataFromUser({data:e.dataFromUser,onSubmit:u,onCancel:d})}else(async()=>{const d=await qo({externalAPI:e,currentChatflow:t,currentNode:r,coreState:s,conversationState:i,uiState:o,showToast:a,userData:{}});l(d)})()})},Ho=async(n,e,t,r,s,i)=>{if(!n.token||!(e.currentConversation||i))return;const{chatbot:o}=n,{currentConversation:a,setMessages:l,messagesRef:c}=e,{setAiLoading:u}=t,d=i||a,g=Rd(s,d._id);u(!0);const h={_id:`streaming_${Date.now()}`,conversationId:d._id,owner:"ai",ownerId:void 0,data:{text:["Analyzing user query","Gathering relevant context","Understanding your question","Processing your request","Running initial analysis"][Math.floor(Math.random()*5)],thinking:[],path:void 0},type:"AI Response",createdAt:"9999-01-01",updatedAt:"9999-01-01",chatbotId:o._id,conversationOwnerId:"",chatbotOwnerId:"",seen:!1};l(f=>{const m=[...f,h];return c.current=m,m});try{const f=await fetch(`${lo}/message/user/ai/message`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.token}`},body:JSON.stringify({conversationId:d._id,conversationHistory:g,enableStreaming:!0})});if(!f.ok)throw f.status===400&&(await f.json()).message==="AI Message Limit Reached"?new Error("AI Message Limit Reached"):new Error(`HTTP error! status: ${f.status}`);const m=new xd;let b="",v=null,x=!1,w=!0;await m.parseStream(f,k=>{var _,S;switch(k.type){case"token":x=!0;const P=((_=k.data)==null?void 0:_.data)||"";w?b=P:b+=P,l(A=>{const D=A.map(E=>E._id===h._id?{...E,data:{...E.data,...w&&{thinking:[...E.data.thinking||[],E.data.text??""]},text:b}}:E);return c.current=D,D}),w=!1;break;case"tool":w=!0;break;case"complete":const T=((S=k.data)==null?void 0:S.data)||"{}";try{const A=typeof T=="string"?JSON.parse(T):T;v=A.path||null,A.message&&!x&&(b=A.message)}catch{yt().error("Failed to parse complete event data:",T)}break;case"done":if(l(A=>{const D=A.map(E=>E._id===h._id?{_id:`ai_${Date.now()}`,conversationId:d._id,owner:"ai",ownerId:void 0,data:{text:v?"":b,path:v??void 0},type:"AI Response",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),chatbotId:o._id,conversationOwnerId:"",chatbotOwnerId:"",seen:!0}:E);return c.current=D,D}),v){const A=o.chatflow.nodes.find(D=>D.type==="AIControlNode");A&&Vn({source:A.id,sourceHandle:v,conversationState:e,coreState:n,showToast:r,uiState:t,latestConversation:d})}break;case"error":yt().error("Streaming error:",k.data),r("Failed to get AI response","error"),l(A=>A.filter(D=>D._id!==h._id));break}},k=>{yt().error("Stream parsing error:",k),r("Failed to get AI response","error"),l(_=>_.filter(S=>S._id!==h._id))})}catch(f){if(yt().error("Error in sendAIMessageStream:",f),f.message==="AI Message Limit Reached"){const m=o.chatflow.nodes.find(b=>b.type==="AIControlNode");m&&await Vn({source:m.id,sourceHandle:m.data.outOfCredits.id,conversationState:e,coreState:n,showToast:r,uiState:t,latestConversation:d})}else $t(f,r,"Failed to get AI response");l(m=>m.filter(b=>b._id!==h._id))}finally{u(!1)}},Vn=async n=>{const{source:e,sourceHandle:t,conversationState:r,coreState:s,showToast:i,uiState:o,latestConversation:a}=n,{chatbot:l,token:c}=s,{currentConversation:u}=r,{setAiLoading:d}=o,g=a||u;if(!l||!g||!c)return!1;const h=l.chatflow.edges.find(m=>m.source===e&&m.sourceHandle===t);if(!h)return!1;const f=l.chatflow.nodes.find(m=>m.id===h.target);if(!f)return!1;try{const m=await It.userUpdateCurrentNode({params:{id:g._id},body:{currentNode:f.id}},c);if(!m.data)throw new Error("Node update failed");d(!1);const b=r.conversations.map(v=>v._id===g._id?m.data:v);return r.setConversations(b),await Yn({coreState:s,conversationState:r,uiState:o,showToast:i,updatedConversation:m.data}),!0}catch(m){return $t(m,i,"Failed to change node"),!1}},Yn=async({coreState:n,conversationState:e,uiState:t,showToast:r,updatedConversation:s=null})=>{var m,b,v,x,w,k,_,S,P,T,A,D;const{chatbot:i,isDefaultExternalAPI:o,defaultExternalAPI:a}=n,{setCanMessage:l,setHumanControl:c,setHoveringMessageInner:u,setRatingFromUser:d}=t;if(o){await Bo({externalAPI:a,currentChatflow:{key:Te.EXTERNAL_API,index:0},currentNode:{},coreState:n,conversationState:e,uiState:t,showToast:r});return}const g=s||e.currentConversation;if(!i||!g)return;l(!1),c(!1),u(null);const h=i.chatflow.nodes.find(E=>E.id===g.currentNode);if(!h){r("Invalid conversation node","error");return}await Od(h,g,n,e,t,r),!await Pd(h,g,n,e,t,r)&&((((b=(m=h.data)==null?void 0:m.hoveringMessageInner)==null?void 0:b.length)??0)>0&&Wn(g.currentChatflow,Te.HOVERING_MESSAGE)&&u({data:h.data.hoveringMessageInner,onClick:async E=>{if(u(null),E.type==="path")await Vn({source:h.id,sourceHandle:E.id,conversationState:e,coreState:n,showToast:r,uiState:t});else{l(!1);const j=await ls({data:{text:E.query},currentChatflow:{key:Te.HOVERING_MESSAGE,index:0},coreState:n,conversationState:e,uiState:t,showToast:r,type:"Human Text",owner:"user"});!t.humanControl&&!g.assignedTo&&await Ho(n,e,t,r,(j==null?void 0:j.messages)||[],g),l(!0)}}}),h.type==="EndConversation"?(l(!1),c(!1),(x=(v=h.data)==null?void 0:v.askForReview)!=null&&x.value&&Wn(g.currentChatflow,Te.END)&&d({onSubmit:async E=>{await Ad(E,n,e,t,r),await rt({data:{text:"Thanks for your feedback"},coreState:n,conversationState:e,uiState:t,showToast:r,currentChatflow:{key:Te.END,index:0},type:"AI Text"}),d(null)}})):((k=(w=h.data)==null?void 0:w.control)==null?void 0:k.type)==="ai"?(c(!1),l(!0)):(await Ed(n,e,t,r,(S=(_=h.data)==null?void 0:_.control)==null?void 0:S.assignType,((T=(P=h.data)==null?void 0:P.control)==null?void 0:T.user)||((D=(A=h.data)==null?void 0:A.control)==null?void 0:D.role)),c(!0),l(!1)))};function Rd(n,e){return n.filter(t=>t.conversationId===e).sort((t,r)=>new Date(r.updatedAt||"").getTime()-new Date(t.updatedAt||"").getTime()).slice(0,7).filter(t=>t.owner!=="agent").reverse().map(t=>({[`${t.owner}`]:t.data.text}))}async function Od(n,e,t,r,s,i){const o=n.data;if(o!=null&&o.text)for(const[a,l]of o.text.entries())Wn(e.currentChatflow,Te.TEXT,a)&&await rt({data:{text:l.value},currentChatflow:{key:Te.TEXT,index:a},coreState:t,conversationState:r,uiState:s,showToast:i,type:"AI Text"})}async function Pd(n,e,t,r,s,i){const o=n.data;if(o.externalAPI){for(const[a,l]of o.externalAPI.entries())if(Wn(e.currentChatflow,Te.EXTERNAL_API,a)&&await Bo({externalAPI:l.externalAPI,currentChatflow:{key:Te.EXTERNAL_API,index:a},currentNode:n,coreState:t,conversationState:r,uiState:s,showToast:i}))return!0}return!1}function $t(n,e,t){e(t,"error"),yt().error(t,n)}async function cs(n){var b;const{conversationState:e,coreState:t,uiState:r,userMessage:s,setUserMessage:i,file:o,setFile:a,latestCurrentConversation:l,showToast:c}=n,u=l||e.currentConversation;if(!u){c("No conversation found","error");return}if(!(s!=null&&s.trim()))return;const d=s.trim();i(""),r.setCanMessage(!1),r.setUserLoading(!0);const g=o;a(null);let h={text:d};if(g)try{const v=await _d.userUploadAsset(g,t.token);if(!v.data)throw new Error("File upload failed");h.file={name:g.name,url:v.data.url}}catch(v){$t(v,c,"Failed to upload file"),r.setUserLoading(!1),r.setCanMessage(!0);return}const f=((b=u==null?void 0:u.currentChatflow)==null?void 0:b.key)!==Te.END?{key:Te.END,index:0}:null;f&&r.setHoveringMessageInner(null);const m=await ls({data:h,currentChatflow:f,coreState:t,conversationState:e,uiState:r,showToast:c,type:"Human Text",owner:"user",latestCurrentConversation:u});!r.humanControl&&!(u!=null&&u.assignedTo)&&await Ho(t,e,r,c,(m==null?void 0:m.messages)||[],u),r.setCanMessage(!0)}function us(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Nt=us();function Wo(n){Nt=n}var un={exec:()=>null};function J(n,e=""){let t=typeof n=="string"?n:n.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(Se.caret,"$1"),t=t.replace(s,o),r},getRegex:()=>new RegExp(t,e)};return r}var Dd=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Se={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,listReplaceTabs:/^\t+/,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,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i")},Id=/^(?:[ \t]*(?:\n|$))+/,$d=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Nd=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,dn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Md=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ds=/(?:[*+-]|\d{1,9}[.)])/,Vo=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Yo=J(Vo).replace(/bull/g,ds).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(),Fd=J(Vo).replace(/bull/g,ds).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(),hs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ld=/^[^\n]+/,fs=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,jd=J(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",fs).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ud=J(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ds).getRegex(),Xn="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",ps=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,zd=J("^ {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[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ps).replace("tag",Xn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Xo=J(hs).replace("hr",dn).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Xn).getRegex(),qd=J(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Xo).getRegex(),gs={blockquote:qd,code:$d,def:jd,fences:Nd,heading:Md,hr:dn,html:zd,lheading:Yo,list:Ud,newline:Id,paragraph:Xo,table:un,text:Ld},Jo=J("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",dn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Xn).getRegex(),Bd={...gs,lheading:Fd,table:Jo,paragraph:J(hs).replace("hr",dn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Jo).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Xn).getRegex()},Hd={...gs,html:J(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ps).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:un,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:J(hs).replace("hr",dn).replace("heading",` *#{1,6} *[^
30
+ ]`).replace("lheading",Yo).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Wd=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Vd=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Zo=/^( {2,}|\\)\n(?!\s*$)/,Yd=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Jn=/[\p{P}\p{S}]/u,ms=/[\s\p{P}\p{S}]/u,Go=/[^\s\p{P}\p{S}]/u,Xd=J(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ms).getRegex(),Ko=/(?!~)[\p{P}\p{S}]/u,Jd=/(?!~)[\s\p{P}\p{S}]/u,Zd=/(?:[^\s\p{P}\p{S}]|~)/u,Gd=J(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Dd?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Qo=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Kd=J(Qo,"u").replace(/punct/g,Jn).getRegex(),Qd=J(Qo,"u").replace(/punct/g,Ko).getRegex(),ea="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",eh=J(ea,"gu").replace(/notPunctSpace/g,Go).replace(/punctSpace/g,ms).replace(/punct/g,Jn).getRegex(),th=J(ea,"gu").replace(/notPunctSpace/g,Zd).replace(/punctSpace/g,Jd).replace(/punct/g,Ko).getRegex(),nh=J("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Go).replace(/punctSpace/g,ms).replace(/punct/g,Jn).getRegex(),rh=J(/\\(punct)/,"gu").replace(/punct/g,Jn).getRegex(),sh=J(/^<(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(),ih=J(ps).replace("(?:-->|$)","-->").getRegex(),oh=J("^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",ih).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Zn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,ah=J(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Zn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ta=J(/^!?\[(label)\]\[(ref)\]/).replace("label",Zn).replace("ref",fs).getRegex(),na=J(/^!?\[(ref)\](?:\[\])?/).replace("ref",fs).getRegex(),lh=J("reflink|nolink(?!\\()","g").replace("reflink",ta).replace("nolink",na).getRegex(),ra=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,bs={_backpedal:un,anyPunctuation:rh,autolink:sh,blockSkip:Gd,br:Zo,code:Vd,del:un,emStrongLDelim:Kd,emStrongRDelimAst:eh,emStrongRDelimUnd:nh,escape:Wd,link:ah,nolink:na,punctuation:Xd,reflink:ta,reflinkSearch:lh,tag:oh,text:Yd,url:un},ch={...bs,link:J(/^!?\[(label)\]\((.*?)\)/).replace("label",Zn).getRegex(),reflink:J(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Zn).getRegex()},_s={...bs,emStrongRDelimAst:th,emStrongLDelim:Qd,url:J(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ra).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:J(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ra).getRegex()},uh={..._s,br:J(Zo).replace("{2,}","*").getRegex(),text:J(_s.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Gn={normal:gs,gfm:Bd,pedantic:Hd},hn={normal:bs,gfm:_s,breaks:uh,pedantic:ch},dh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},sa=n=>dh[n];function ft(n,e){if(e){if(Se.escapeTest.test(n))return n.replace(Se.escapeReplace,sa)}else if(Se.escapeTestNoEncode.test(n))return n.replace(Se.escapeReplaceNoEncode,sa);return n}function ia(n){try{n=encodeURI(n).replace(Se.percentDecode,"%")}catch{return null}return n}function oa(n,e){var i;let t=n.replace(Se.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),r=t.split(Se.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(Se.slashPipe,"|");return r}function fn(n,e,t){let r=n.length;if(r===0)return"";let s=0;for(;s<r&&n.charAt(r-s-1)===e;)s++;return n.slice(0,r-s)}function hh(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===e[0])t++;else if(n[r]===e[1]&&(t--,t<0))return r;return t>0?-2:-1}function aa(n,e,t,r,s){let i=e.href,o=e.title||null,a=n[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function fh(n,e,t){let r=n.match(t.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
31
31
  `).map(i=>{let o=i.match(t.other.beginningSpace);if(o===null)return i;let[a]=o;return a.length>=s.length?i.slice(s.length):i}).join(`
32
- `)}var Qn=class{constructor(n){ne(this,"options");ne(this,"rules");ne(this,"lexer");this.options=n||Mt}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:pn(t,`
33
- `)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=ph(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let r=pn(t,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(t=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:pn(e[0],`
34
- `)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=pn(e[0],`
32
+ `)}var Kn=class{constructor(n){ne(this,"options");ne(this,"rules");ne(this,"lexer");this.options=n||Nt}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:fn(t,`
33
+ `)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=fh(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let r=fn(t,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(t=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:fn(e[0],`
34
+ `)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=fn(e[0],`
35
35
  `).split(`
36
36
  `),r="",s="",i=[];for(;t.length>0;){let o=!1,a=[],l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))a.push(t[l]),o=!0;else if(!o)a.push(t[l]);else break;t=t.slice(l);let c=a.join(`
37
37
  `),u=c.replace(this.rules.other.blockquoteSetextReplace,`
@@ -49,10 +49,10 @@ ${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
49
49
  `,1)[0],P;if(f=S,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),P=f):P=f.replace(this.rules.other.tabCharGlobal," "),w.test(f)||k.test(f)||_.test(f)||v.test(f)||x.test(f))break;if(P.search(this.rules.other.nonSpaceChar)>=b||!f.trim())g+=`
50
50
  `+P.slice(b);else{if(m||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(h)||k.test(h)||x.test(h))break;g+=`
51
51
  `+f}!m&&!f.trim()&&(m=!0),d+=S+`
52
- `,n=n.substring(S.length+1),h=P.slice(b)}}o.loose||(l?o.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(l=!0)),o.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(g),loose:!1,text:g,tokens:[]}),o.raw+=d}let c=o.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let u of o.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),((t=u.tokens[0])==null?void 0:t.type)==="text"||((r=u.tokens[0])==null?void 0:r.type)==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}}let d=this.rules.other.listTaskCheckbox.exec(u.raw);if(d){let g={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};u.checked=g.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=g.raw+u.tokens[0].raw,u.tokens[0].text=g.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(g)):u.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):u.tokens.unshift(g)}}if(!o.loose){let d=u.tokens.filter(h=>h.type==="space"),g=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));o.loose=g}}if(o.loose)for(let u of o.items){u.loose=!0;for(let d of u.tokens)d.type==="text"&&(d.type="paragraph")}return o}}html(n){let e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:r,title:s}}}table(n){var o;let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=aa(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
53
- `):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<t.length;a++)i.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:i.align[a]});for(let a of s)i.rows.push(aa(a,i.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[c]})));return i}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
54
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=pn(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=fh(e[2],"()");if(i===-2)return;if(i>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?r=r.slice(1):r=r.slice(1,-1)),la(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let r=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[r.toLowerCase()];if(!s){let i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return la(t,s,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!(!r||r[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!t||this.rules.inline.punctuation.exec(t))){let s=[...r[0]].length-1,i,o,a=s,l=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*n.length+s);(r=c.exec(e))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...r[0]][0].length,d=n.slice(0,s+r.index+u+o);if(Math.min(s,o)%2){let h=d.slice(1,-1);return{type:"em",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}let g=d.slice(2,-2);return{type:"strong",raw:d,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(t),s=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return r&&s&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n){let e=this.rules.inline.del.exec(n);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,r;return e[2]==="@"?(t=e[1],r="mailto:"+t):(t=e[1],r=t),{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(n){var t;let e;if(e=this.rules.inline.url.exec(n)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let i;do i=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(i!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},Xe=class Ys{constructor(e){ne(this,"tokens");ne(this,"options");ne(this,"state");ne(this,"inlineQueue");ne(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Mt,this.options.tokenizer=this.options.tokenizer||new Qn,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:Ce,block:Kn.normal,inline:fn.normal};this.options.pedantic?(t.block=Kn.pedantic,t.inline=fn.pedantic):this.options.gfm&&(t.block=Kn.gfm,this.options.breaks?t.inline=fn.breaks:t.inline=fn.gfm),this.tokenizer.rules=t}static get rules(){return{block:Kn,inline:fn}}static lex(e,t){return new Ys(t).lex(e)}static lexInline(e,t){return new Ys(t).inlineTokens(e)}lex(e){e=e.replace(Ce.carriageReturn,`
55
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){var s,i,o;for(this.options.pedantic&&(e=e.replace(Ce.tabCharGlobal," ").replace(Ce.spaceLine,""));e;){let a;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(c=>(a=c.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let c=t.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
52
+ `,n=n.substring(S.length+1),h=P.slice(b)}}o.loose||(l?o.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(l=!0)),o.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(g),loose:!1,text:g,tokens:[]}),o.raw+=d}let c=o.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let u of o.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),((t=u.tokens[0])==null?void 0:t.type)==="text"||((r=u.tokens[0])==null?void 0:r.type)==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}}let d=this.rules.other.listTaskCheckbox.exec(u.raw);if(d){let g={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};u.checked=g.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=g.raw+u.tokens[0].raw,u.tokens[0].text=g.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(g)):u.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):u.tokens.unshift(g)}}if(!o.loose){let d=u.tokens.filter(h=>h.type==="space"),g=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));o.loose=g}}if(o.loose)for(let u of o.items){u.loose=!0;for(let d of u.tokens)d.type==="text"&&(d.type="paragraph")}return o}}html(n){let e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:r,title:s}}}table(n){var o;let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=oa(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
53
+ `):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<t.length;a++)i.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:i.align[a]});for(let a of s)i.rows.push(oa(a,i.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[c]})));return i}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
54
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=fn(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=hh(e[2],"()");if(i===-2)return;if(i>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?r=r.slice(1):r=r.slice(1,-1)),aa(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let r=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[r.toLowerCase()];if(!s){let i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return aa(t,s,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!(!r||r[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!t||this.rules.inline.punctuation.exec(t))){let s=[...r[0]].length-1,i,o,a=s,l=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*n.length+s);(r=c.exec(e))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...r[0]][0].length,d=n.slice(0,s+r.index+u+o);if(Math.min(s,o)%2){let h=d.slice(1,-1);return{type:"em",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}let g=d.slice(2,-2);return{type:"strong",raw:d,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(t),s=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return r&&s&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n){let e=this.rules.inline.del.exec(n);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,r;return e[2]==="@"?(t=e[1],r="mailto:"+t):(t=e[1],r=t),{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(n){var t;let e;if(e=this.rules.inline.url.exec(n)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let i;do i=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(i!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},Ye=class Vs{constructor(e){ne(this,"tokens");ne(this,"options");ne(this,"state");ne(this,"inlineQueue");ne(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Nt,this.options.tokenizer=this.options.tokenizer||new Kn,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:Se,block:Gn.normal,inline:hn.normal};this.options.pedantic?(t.block=Gn.pedantic,t.inline=hn.pedantic):this.options.gfm&&(t.block=Gn.gfm,this.options.breaks?t.inline=hn.breaks:t.inline=hn.gfm),this.tokenizer.rules=t}static get rules(){return{block:Gn,inline:hn}}static lex(e,t){return new Vs(t).lex(e)}static lexInline(e,t){return new Vs(t).inlineTokens(e)}lex(e){e=e.replace(Se.carriageReturn,`
55
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){var s,i,o;for(this.options.pedantic&&(e=e.replace(Se.tabCharGlobal," ").replace(Se.spaceLine,""));e;){let a;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(c=>(a=c.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let c=t.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
56
56
  `:t.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let c=t.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
57
57
  `)?"":`
58
58
  `)+a.raw,c.text+=`
@@ -65,9 +65,9 @@ ${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
65
65
  `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(a),r=l.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let c=t.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
66
66
  `)?"":`
67
67
  `)+a.raw,c.text+=`
68
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var l,c,u,d,g;let r=e,s=null;if(this.tokens.links){let h=Object.keys(this.tokens.links);if(h.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)h.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((c=(l=this.options.hooks)==null?void 0:l.emStrongMask)==null?void 0:c.call({lexer:this},r))??r;let o=!1,a="";for(;e;){o||(a=""),o=!1;let h;if((d=(u=this.options.extensions)==null?void 0:u.inline)!=null&&d.some(m=>(h=m.call({lexer:this},e,t))?(e=e.substring(h.raw.length),t.push(h),!0):!1))continue;if(h=this.tokenizer.escape(e)){e=e.substring(h.raw.length),t.push(h);continue}if(h=this.tokenizer.tag(e)){e=e.substring(h.raw.length),t.push(h);continue}if(h=this.tokenizer.link(e)){e=e.substring(h.raw.length),t.push(h);continue}if(h=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(h.raw.length);let m=t.at(-1);h.type==="text"&&(m==null?void 0:m.type)==="text"?(m.raw+=h.raw,m.text+=h.text):t.push(h);continue}if(h=this.tokenizer.emStrong(e,r,a)){e=e.substring(h.raw.length),t.push(h);continue}if(h=this.tokenizer.codespan(e)){e=e.substring(h.raw.length),t.push(h);continue}if(h=this.tokenizer.br(e)){e=e.substring(h.raw.length),t.push(h);continue}if(h=this.tokenizer.del(e)){e=e.substring(h.raw.length),t.push(h);continue}if(h=this.tokenizer.autolink(e)){e=e.substring(h.raw.length),t.push(h);continue}if(!this.state.inLink&&(h=this.tokenizer.url(e))){e=e.substring(h.raw.length),t.push(h);continue}let f=e;if((g=this.options.extensions)!=null&&g.startInline){let m=1/0,b=e.slice(1),v;this.options.extensions.startInline.forEach(x=>{v=x.call({lexer:this},b),typeof v=="number"&&v>=0&&(m=Math.min(m,v))}),m<1/0&&m>=0&&(f=e.substring(0,m+1))}if(h=this.tokenizer.inlineText(f)){e=e.substring(h.raw.length),h.raw.slice(-1)!=="_"&&(a=h.raw.slice(-1)),o=!0;let m=t.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=h.raw,m.text+=h.text):t.push(h);continue}if(e){let m="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return t}},er=class{constructor(e){ne(this,"options");ne(this,"parser");this.options=e||Mt}space(e){return""}code({text:e,lang:t,escaped:r}){var o;let s=(o=(t||"").match(Ce.notSpaceStart))==null?void 0:o[0],i=e.replace(Ce.endingNewline,"")+`
69
- `;return s?'<pre><code class="language-'+pt(s)+'">'+(r?i:pt(i,!0))+`</code></pre>
70
- `:"<pre><code>"+(r?i:pt(i,!0))+`</code></pre>
68
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var l,c,u,d,g;let r=e,s=null;if(this.tokens.links){let h=Object.keys(this.tokens.links);if(h.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)h.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((c=(l=this.options.hooks)==null?void 0:l.emStrongMask)==null?void 0:c.call({lexer:this},r))??r;let o=!1,a="";for(;e;){o||(a=""),o=!1;let h;if((d=(u=this.options.extensions)==null?void 0:u.inline)!=null&&d.some(m=>(h=m.call({lexer:this},e,t))?(e=e.substring(h.raw.length),t.push(h),!0):!1))continue;if(h=this.tokenizer.escape(e)){e=e.substring(h.raw.length),t.push(h);continue}if(h=this.tokenizer.tag(e)){e=e.substring(h.raw.length),t.push(h);continue}if(h=this.tokenizer.link(e)){e=e.substring(h.raw.length),t.push(h);continue}if(h=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(h.raw.length);let m=t.at(-1);h.type==="text"&&(m==null?void 0:m.type)==="text"?(m.raw+=h.raw,m.text+=h.text):t.push(h);continue}if(h=this.tokenizer.emStrong(e,r,a)){e=e.substring(h.raw.length),t.push(h);continue}if(h=this.tokenizer.codespan(e)){e=e.substring(h.raw.length),t.push(h);continue}if(h=this.tokenizer.br(e)){e=e.substring(h.raw.length),t.push(h);continue}if(h=this.tokenizer.del(e)){e=e.substring(h.raw.length),t.push(h);continue}if(h=this.tokenizer.autolink(e)){e=e.substring(h.raw.length),t.push(h);continue}if(!this.state.inLink&&(h=this.tokenizer.url(e))){e=e.substring(h.raw.length),t.push(h);continue}let f=e;if((g=this.options.extensions)!=null&&g.startInline){let m=1/0,b=e.slice(1),v;this.options.extensions.startInline.forEach(x=>{v=x.call({lexer:this},b),typeof v=="number"&&v>=0&&(m=Math.min(m,v))}),m<1/0&&m>=0&&(f=e.substring(0,m+1))}if(h=this.tokenizer.inlineText(f)){e=e.substring(h.raw.length),h.raw.slice(-1)!=="_"&&(a=h.raw.slice(-1)),o=!0;let m=t.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=h.raw,m.text+=h.text):t.push(h);continue}if(e){let m="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return t}},Qn=class{constructor(e){ne(this,"options");ne(this,"parser");this.options=e||Nt}space(e){return""}code({text:e,lang:t,escaped:r}){var o;let s=(o=(t||"").match(Se.notSpaceStart))==null?void 0:o[0],i=e.replace(Se.endingNewline,"")+`
69
+ `;return s?'<pre><code class="language-'+ft(s)+'">'+(r?i:ft(i,!0))+`</code></pre>
70
+ `:"<pre><code>"+(r?i:ft(i,!0))+`</code></pre>
71
71
  `}blockquote({tokens:e}){return`<blockquote>
72
72
  ${this.parser.parse(e)}</blockquote>
73
73
  `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
@@ -83,35 +83,35 @@ ${this.parser.parse(e)}</blockquote>
83
83
  `}tablerow({text:e}){return`<tr>
84
84
  ${e}</tr>
85
85
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
86
- `}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>${pt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let s=this.parser.parseInline(r),i=oa(e);if(i===null)return s;e=i;let o='<a href="'+e+'"';return t&&(o+=' title="'+pt(t)+'"'),o+=">"+s+"</a>",o}image({href:e,title:t,text:r,tokens:s}){s&&(r=this.parser.parseInline(s,this.parser.textRenderer));let i=oa(e);if(i===null)return pt(r);e=i;let o=`<img src="${e}" alt="${r}"`;return t&&(o+=` title="${pt(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:pt(e.text)}},ys=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}},Je=class Xs{constructor(e){ne(this,"options");ne(this,"renderer");ne(this,"textRenderer");this.options=e||Mt,this.options.renderer=this.options.renderer||new er,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ys}static parse(e,t){return new Xs(t).parse(e)}static parseInline(e,t){return new Xs(t).parseInline(e)}parse(e){var r,s;let t="";for(let i=0;i<e.length;i++){let o=e[i];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[o.type]){let l=o,c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){t+=c||"";continue}}let a=o;switch(a.type){case"space":{t+=this.renderer.space(a);break}case"hr":{t+=this.renderer.hr(a);break}case"heading":{t+=this.renderer.heading(a);break}case"code":{t+=this.renderer.code(a);break}case"table":{t+=this.renderer.table(a);break}case"blockquote":{t+=this.renderer.blockquote(a);break}case"list":{t+=this.renderer.list(a);break}case"checkbox":{t+=this.renderer.checkbox(a);break}case"html":{t+=this.renderer.html(a);break}case"def":{t+=this.renderer.def(a);break}case"paragraph":{t+=this.renderer.paragraph(a);break}case"text":{t+=this.renderer.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return t}parseInline(e,t=this.renderer){var s,i;let r="";for(let o=0;o<e.length;o++){let a=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[a.type]){let c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=c||"";continue}}let l=a;switch(l.type){case"escape":{r+=t.text(l);break}case"html":{r+=t.html(l);break}case"link":{r+=t.link(l);break}case"image":{r+=t.image(l);break}case"checkbox":{r+=t.checkbox(l);break}case"strong":{r+=t.strong(l);break}case"em":{r+=t.em(l);break}case"codespan":{r+=t.codespan(l);break}case"br":{r+=t.br(l);break}case"del":{r+=t.del(l);break}case"text":{r+=t.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},gn=(mr=class{constructor(n){ne(this,"options");ne(this,"block");this.options=n||Mt}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?Xe.lex:Xe.lexInline}provideParser(){return this.block?Je.parse:Je.parseInline}},ne(mr,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ne(mr,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),mr),gh=class{constructor(...e){ne(this,"defaults",ds());ne(this,"options",this.setOptions);ne(this,"parse",this.parseMarkdown(!0));ne(this,"parseInline",this.parseMarkdown(!1));ne(this,"Parser",Je);ne(this,"Renderer",er);ne(this,"TextRenderer",ys);ne(this,"Lexer",Xe);ne(this,"Tokenizer",Qn);ne(this,"Hooks",gn);this.use(...e)}walkTokens(e,t){var s,i;let r=[];for(let o of e)switch(r=r.concat(t.call(this,o)),o.type){case"table":{let a=o;for(let l of a.header)r=r.concat(this.walkTokens(l.tokens,t));for(let l of a.rows)for(let c of l)r=r.concat(this.walkTokens(c.tokens,t));break}case"list":{let a=o;r=r.concat(this.walkTokens(a.items,t));break}default:{let a=o;(i=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&i[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{let c=a[l].flat(1/0);r=r.concat(this.walkTokens(c,t))}):a.tokens&&(r=r.concat(this.walkTokens(a.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let o=t.renderers[i.name];o?t.renderers[i.name]=function(...a){let l=i.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[i.level];o?o.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),r.renderer){let i=this.defaults.renderer||new er(this.defaults);for(let o in r.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=r.renderer[a],c=i[a];i[a]=(...u)=>{let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d||""}}s.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new Qn(this.defaults);for(let o in r.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=r.tokenizer[a],c=i[a];i[a]=(...u)=>{let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}s.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new gn;for(let o in r.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=r.hooks[a],c=i[a];gn.passThroughHooks.has(o)?i[a]=u=>{if(this.defaults.async&&gn.passThroughHooksRespectAsync.has(o))return(async()=>{let g=await l.call(i,u);return c.call(i,g)})();let d=l.call(i,u);return c.call(i,d)}:i[a]=(...u)=>{if(this.defaults.async)return(async()=>{let g=await l.apply(i,u);return g===!1&&(g=await c.apply(i,u)),g})();let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}s.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,o=r.walkTokens;s.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),i&&(l=l.concat(i.call(this,a))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Xe.lex(e,t??this.defaults)}parser(e,t){return Je.parse(e,t??this.defaults)}parseMarkdown(e){return(t,r)=>{let s={...r},i={...this.defaults,...s},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return o(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"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(t):t,l=await(i.hooks?await i.hooks.provideLexer():e?Xe.lex:Xe.lexInline)(a,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():e?Je.parse:Je.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(o);try{i.hooks&&(t=i.hooks.preprocess(t));let a=(i.hooks?i.hooks.provideLexer():e?Xe.lex:Xe.lexInline)(t,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():e?Je.parse:Je.parseInline)(a,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(a){return o(a)}}}onError(e,t){return r=>{if(r.message+=`
87
- Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+pt(r.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}},Ft=new gh;function K(n,e){return Ft.parse(n,e)}K.options=K.setOptions=function(n){return Ft.setOptions(n),K.defaults=Ft.defaults,Vo(K.defaults),K},K.getDefaults=ds,K.defaults=Mt,K.use=function(...n){return Ft.use(...n),K.defaults=Ft.defaults,Vo(K.defaults),K},K.walkTokens=function(n,e){return Ft.walkTokens(n,e)},K.parseInline=Ft.parseInline,K.Parser=Je,K.parser=Je.parse,K.Renderer=er,K.TextRenderer=ys,K.Lexer=Xe,K.lexer=Xe.lex,K.Tokenizer=Qn,K.Hooks=gn,K.parse=K,K.options,K.setOptions,K.use,K.walkTokens,K.parseInline,Je.parse,Xe.lex;const mh=({chatbot:n,conversations:e,messages:t,totalConversationsCount:r,conversationsLoading:s,loadMoreConversations:i,handleChangeConversation:o})=>{const a=[...t].sort((u,d)=>new Date(d.createdAt).getTime()-new Date(u.createdAt).getTime()),l=new Map;a.forEach(u=>{l.has(u.conversationId)||l.set(u.conversationId,u)});const c=Array.from(l.values()).map(u=>({conversation:e.find(d=>d._id===u.conversationId),latestMessage:u}));return p("div",{className:"conversationMainItemContainer",children:[c.map((u,d)=>p(_h,{chatbot:n,data:u,handleChangeConversation:o},d)),r>e.length&&p("button",{className:"newConversationBtn",onClick:i,children:s?p("div",{className:"newConversationLoading",children:p(un,{className:"base-text-color"})}):"Load More Conversations"})]})},bh=(n="")=>n.split(`
88
- `)[0].replace(/#{1,6}\s+/g,"").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").trim(),_h=({chatbot:n,data:e,handleChangeConversation:t})=>{if(!e.conversation||e.conversation===void 0)return;const{conversation:r,latestMessage:s}=e,i=()=>{if(r.assignedTo){const a=n.teamMembers.members.find(l=>l.user._id===r.assignedTo);return a!=null&&a.user.profilePicture?p("img",{src:ie(a.user.profilePicture,200),alt:"User"},ie(a.user.profilePicture,200)):p(Zt,{className:"input-background-color"})}return p("img",{src:ie(n.appearance.images.popupChat,200),alt:"Bot"},ie(n.appearance.images.popupChat,200))},o=bh(s==null?void 0:s.data.text);return p("div",{className:"conversationMainItem",onClick:()=>t(r),children:[p("div",{children:p(i,{})}),p("div",{className:"textHolder",children:[p("p",{children:o||"Send a message"}),p("p",{children:as((s==null?void 0:s.createdAt)||(r==null?void 0:r.createdAt))})]}),p("div",{children:[p(Lo,{className:"base-color"}),s.owner==="agent"&&!s.seen&&p("div",{className:"unreadMessage"})]})]})},xs=({chatbot:n,className:e=""})=>p("div",{className:`agents ${e}`,children:n.teamMembers.members.filter(t=>t.joined).slice(0,3).map((t,r)=>p("div",{children:t.user.profilePicture?p("img",{src:ie(t.user.profilePicture,200),alt:"Agent"},ie(t.user.profilePicture,200)):p(Zt,{className:"input-text-color"})},r))}),vh=({chatbot:n,latestCurrentConversation:e})=>{var i;const t=(i=n.teamMembers.members.find(o=>o.user._id===(e==null?void 0:e.assignedTo)))==null?void 0:i.user,r=()=>e!=null&&e.assignedTo?t!=null&&t.profilePicture?p("div",{className:"headerImageWrapper",children:p("img",{src:ie(t.profilePicture,200),width:"100%",alt:"Profile",style:{borderRadius:"50%"}},ie(t.profilePicture,200))}):p("div",{className:"headerImageWrapper",children:p(Zt,{className:"background-text-color"})}):p(xs,{chatbot:n}),s=()=>p("div",{className:"headerImageWrapper",children:p("img",{src:ie(n.appearance.images.popupChat,200),width:"100%",alt:"Chat"},ie(n.appearance.images.popupChat,200))});return p(Te,{children:e!=null&&e.assignedTo?r():s()})},yh=({email:n,chatbot:e,dataFromUser:t})=>{const[r,s]=M(()=>{const o={};if(n){const a=t.data.find(l=>l.type==="email");a&&(o[a.key]=n)}return o}),i=(o,a)=>{switch(o.type){case"text":return p("div",{children:[p("h3",{children:o.name}),p("input",{type:"text",required:o.required,placeholder:o.data.placeholder,value:r[o.key]||"",onInput:l=>s({...r,[o.key]:l.currentTarget.value})})]},`${a}-${o.key}`);case"dropdown":return p("div",{children:[p("h4",{children:o.name}),p("select",{required:o.required,name:o.name,onChange:l=>s({...r,[o.key]:l.target.value}),children:[p("option",{value:"",children:"Select"}),o.data.map(l=>p("option",{value:l.value,children:l.label},l.value))]})]},`${a}-${o.key}`);case"date":return p("div",{children:[p("h4",{children:o.name}),p("input",{required:o.required,type:"date",onChange:l=>s({...r,[o.key]:l.target.value})})]},`${a}-${o.key}`);case"time":return p("div",{children:[p("h4",{children:o.name}),p("input",{required:o.required,type:"time",onChange:l=>s({...r,[o.key]:l.target.value})})]},`${a}-${o.key}`);case"textarea":return p("div",{children:[p("h4",{children:o.name}),p("textarea",{required:o.required,placeholder:o.data.placeholder,rows:4,value:r[o.key]||"",onInput:l=>s({...r,[o.key]:l.currentTarget.value})})]},`${a}-${o.key}`);case"email":return p("div",{children:[p("h4",{children:o.name}),p("input",{required:o.required,placeholder:o.data.placeholder,type:"email",value:r[o.key]||"",onInput:l=>s({...r,[o.key]:l.currentTarget.value})}),p("span",{className:"hint",children:o.error})]},`${a}-${o.key}`);default:return null}};return p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(e.appearance.images.chat,200),alt:"Bot"},ie(e.appearance.images.chat,200))}),p("div",{className:"messageDiv",children:p("form",{className:"messageP",onSubmit:o=>{o.preventDefault(),t.onSubmit(r)},children:[t.data.map((o,a)=>i(o,a)),p("div",{className:"livelinkSubmitDiv",children:p("button",{type:"submit",children:"Submit"})})]})})]})},xh=({chatbot:n,ratingFromUser:e})=>{const[t,r]=M({comment:"",rating:4});return p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(n.appearance.images.chat,200),alt:"Bot"},ie(n.appearance.images.chat,200))}),p("div",{className:"messageDiv",children:p("form",{className:"messageP",onSubmit:s=>{s.preventDefault(),t.rating!==0&&e.onSubmit(t)},children:[p("h3",{style:{fontWeight:"400"},children:"Please Leave a review"}),p("div",{children:[p("h4",{children:"Comment"}),p("textarea",{required:!0,minLength:3,maxLength:500,rows:4,onChange:s=>r({...t,comment:s.target.value})})]}),p("div",{style:{display:"flex"},children:[1,2,3,4,5].map(s=>p("div",{style:{cursor:"pointer"},onClick:()=>r({...t,rating:s}),children:p(ld,{className:t.rating>=s?"base-color":"input-text-color"})},s))}),p("div",{className:"livelinkSubmitDiv",children:p("button",{type:"submit",children:"Submit"})})]})})]})},wh=({chatbot:n,onlineAgents:e,currentConversation:t})=>{var s,i,o,a,l;const r=n.chatflow.nodes.find(c=>c.id===t.currentNode);return p("div",{className:"onlineAgents",children:[p("div",{children:p("span",{children:(i=(s=r==null?void 0:r.data)==null?void 0:s.expectedTime)!=null&&i.value?(o=r==null?void 0:r.data)==null?void 0:o.expectedTime.text:"Connecting to an Agent"})}),((l=(a=r==null?void 0:r.data)==null?void 0:a.expectedTime)==null?void 0:l.showOnlineAgents)&&e>0&&p("div",{children:[p(xs,{chatbot:n}),p("p",{children:["Online Agents: ",p("b",{children:e})]})]})]})},kh=({chatbot:n})=>p("div",{className:"mainMessageContainer mySelfTextDiv",children:p("div",{className:"messageDiv mySelfTextDiv",children:p("div",{className:"otherUserTextLoading",children:[p("div",{className:"loading1"}),p("div",{className:"loading2"}),p("div",{className:"loading3"})]})})}),Th=({chatbot:n})=>p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(n.appearance.images.chat,200),alt:"Bot"},ie(n.appearance.images.chat,200))}),p("div",{className:"messageDiv",children:p("div",{className:"otherUserTextLoading",children:[p("div",{className:"loading1"}),p("div",{className:"loading2"}),p("div",{className:"loading3"})]})})]}),Sh=({chatbot:n,message:e,AIControlNode:t})=>{var g,h;const r=e.owner==="agent",s=r?n.teamMembers.members.find(f=>f.user._id===e.ownerId):null,o=(((g=e.data.sources)==null?void 0:g.filter((f,m,b)=>b.indexOf(f)===m))||[]).filter(f=>f.startsWith("https://")).slice(0,3),a=(h=e.data.file)==null?void 0:h.name,l=a&&/\.(jpg|png|jpeg|gif|bmp)$/i.test(a),c=a&&/\.(mp4|avi|mov|mkv|wmv|flv|webm|mpeg)$/i.test(a),[u,d]=M("");return _e(()=>{const f=K.parse(e.data.text||"");typeof f=="string"?d(f):f.then(d)},[e.data.text]),p("div",{className:`mainMessageContainer ${e.owner==="user"?"mySelfTextDiv":""}`,children:[e.owner!=="user"&&(r?p("div",{className:"logoWithMessageDiv",children:s!=null&&s.user.profilePicture?p("img",{src:ie(s.user.profilePicture,200),alt:"Agent"},ie(s.user.profilePicture,200)):p(Zt,{className:"input-background-color"})}):p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(n.appearance.images.popupChat,200),alt:"Bot"},ie(n.appearance.images.popupChat,200))})),p("div",{className:`messageDiv ${e.owner==="user"?"mySelfTextDiv":""}`,children:[p("div",{className:"NameAndDate",children:e.owner!=="user"?p(Te,{children:[(s==null?void 0:s.user.name)||"AI"," -"," ",as(e.createdAt)]}):as(e.createdAt)}),l&&e.data.file&&p("a",{target:"_blank",rel:"noopener noreferrer",href:e.data.file.url,style:{borderRadius:"5px"},children:p("img",{src:e.data.file.url,style:{height:"80px"},alt:"Image"},e.data.file.url)}),c&&e.data.file&&p("a",{target:"_blank",rel:"noopener noreferrer",href:e.data.file.url,style:{borderRadius:"5px"},children:p("video",{src:e.data.file.url,style:{height:"80px"},controls:!0,children:"Video"})}),u&&p("div",{className:"messageP markdownText",dangerouslySetInnerHTML:{__html:u}}),p("div",{className:"sources",children:[e.data.file&&!l&&!c&&p("a",{target:"_blank",href:e.data.file.url,children:e.data.file.name}),(t==null?void 0:t.data.replySource.value)&&o.length>0&&o.map((f,m)=>p("a",{target:"_blank",href:f,children:f},`${f}-${m}`))]})]})]})},Ch=({chatbot:n})=>p("div",{className:"messagesLoading",children:p("div",{children:p(un,{className:"base-color"})})}),Eh=({hoveringMessageInner:n,chatbot:e})=>p("div",{className:"hoveringMessageInner",children:n.data.map((t,r)=>p("div",{onClick:()=>n.onClick(t),children:t.message},r))}),Ah=({file:n,setFile:e,chatbot:t})=>p("div",{className:"hoveringMessageInner",children:p("div",{onClick:()=>e(null),children:[p(jo,{className:"base-text-color",width:"16",height:"16"}),n.name]})}),Rh=({showHoveringMessage:n,hoveringMessages:e,chatbot:t,setShowHoveringMessage:r,coreState:s,conversationState:i,uiState:o,node:a,setChatOpen:l})=>{var j;const[c,u]=M(!1),{token:d,isChatbotDefault:g}=s,{newMessage:h,setNewMessage:f,setCurrentConversation:m,conversations:b,setConversations:v}=i,{callChatFlowRef:x,chatOpen:w}=o,[k,_]=M(Fr("robodialog-chatbot-closed")),S=(a==null?void 0:a.data.popupMessage.value)&&h,P=!g&&!S&&!k&&n,T=()=>{_(!0),Sn("robodialog-chatbot-closed",!0),f(null),r(!1)},A=(h==null?void 0:h.owner)==="agent"?(j=t.teamMembers.members.find(Z=>Z.user._id===h.ownerId))==null?void 0:j.user:null,D=()=>{r(!1),f(null);const Z=b.find(se=>(h==null?void 0:h.conversationId)===se._id);Z&&(x.current=!0,m(Z),l(!0))},E=A!=null&&A.profilePicture?p("div",{className:"headerImageWrapper",children:p("img",{src:ie(A.profilePicture,200),width:"100%",alt:"Profile",style:{borderRadius:"50%"}},ie(A.profilePicture,200))}):p("div",{className:"headerImageWrapper",children:p(Zt,{className:"background-text-color"})});return!(n&&((e==null?void 0:e.length)??0)>0||S)||w?null:p("div",{className:"chatHoveringMessages",children:[(S||P)&&!k&&p("div",{onClick:T,className:"chatHoveringMessage closeMessages",children:c?p("div",{className:"loadingIcon",children:p("div",{style:{width:"16px",height:"16px"},children:p(un,{className:"background-text-color"})})}):p(jo,{className:"background-text-color",width:"16px",height:"16px"})}),S&&p("div",{className:"chatHoveringMessage",onClick:D,children:[p("div",{className:"chatHoveringMessageUser",children:[E,h.owner==="agent"?A==null?void 0:A.name:"AI"]}),p("div",{style:{maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis"},children:h.data.text})]}),P&&(e==null?void 0:e.map((Z,se)=>p(Oh,{hoveringMessage:Z,chatbot:t,loading:c,setLoading:u,coreState:s,conversationState:i,uiState:o,setShowHoveringMessage:r,token:d,node:a,setChatOpen:l,conversations:b,setConversations:v,setCurrentConversation:m,callChatFlowRef:x},se)))]})},Oh=({hoveringMessage:n,chatbot:e,loading:t,setLoading:r,setShowHoveringMessage:s,token:i,setChatOpen:o,setConversations:a,conversations:l,setCurrentConversation:c,callChatFlowRef:u,coreState:d,conversationState:g,uiState:h})=>{var b;const f=async()=>{if(t)return;o(!0),r(!0);let v={};if(n.type==="query")v.chatflow={key:"end",index:0};else{const x=e.chatflow.edges.find(w=>w.sourceHandle===n.id);if(!x){r(!1);return}v.nodeId=x.target}try{const x=await $t.userCreate({body:v},i);if(!x.data)throw new Error("Conversation creation failed");const w=x.data;if(a([...l,w]),n.type==="query"){const k=e.chatflow.nodes.find(_=>_.id===w.currentNode);k&&(h.humanControl=k.data.control.type==="human"),c(w),await us({coreState:d,conversationState:g,uiState:h,userMessage:n.query,setUserMessage:()=>{},file:null,setFile:()=>{},showToast:()=>{},latestCurrentConversation:w})}else u.current=!0,c(w);s(!1)}catch(x){console.error("Chat hovering message error:",x)}finally{r(!1)}},m=n.showUser?(b=e.teamMembers.members.find(v=>{var x;return v.user._id===((x=n==null?void 0:n.user)==null?void 0:x._id)}))==null?void 0:b.user:null;return p("div",{className:"chatHoveringMessage",onClick:f,children:[n.showUser&&m&&p("div",{className:"chatHoveringMessageUser",children:[p("div",{children:m.profilePicture?p("img",{src:ie(m.profilePicture,200)},ie(m.profilePicture,200)):p(Zt,{className:"input-background-color"})}),n.title]}),p("div",{children:n.message})]})};var tr={exports:{}},ca={};function ua(n,e){for(var t in e)n[t]=e[t];return n}function ws(n,e){for(var t in n)if(t!=="__source"&&!(t in e))return!0;for(var r in e)if(r!=="__source"&&n[r]!==e[r])return!0;return!1}function ks(n,e){var t=e(),r=M({t:{__:t,u:e}}),s=r[0].t,i=r[1];return Bt(function(){s.__=t,s.u=e,Ts(s)&&i({t:s})},[n,t,e]),_e(function(){return Ts(s)&&i({t:s}),n(function(){Ts(s)&&i({t:s})})},[n]),t}function Ts(n){var e,t,r=n.u,s=n.__;try{var i=r();return!((e=s)===(t=i)&&(e!==0||1/e==1/t)||e!=e&&t!=t)}catch{return!0}}function Ss(n){n()}function Cs(n){return n}function Es(){return[!1,Ss]}var As=Bt;function nr(n,e){this.props=n,this.context=e}function da(n,e){function t(s){var i=this.props.ref,o=i==s.ref;return!o&&i&&(i.call?i(null):i.current=null),e?!e(this.props,s)||!o:ws(this.props,s)}function r(s){return this.shouldComponentUpdate=t,Qe(n,s)}return r.displayName="Memo("+(n.displayName||n.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r.type=n,r}(nr.prototype=new We).isPureReactComponent=!0,nr.prototype.shouldComponentUpdate=function(n,e){return ws(this.props,n)||ws(this.state,e)};var ha=N.__b;N.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),ha&&ha(n)};var Ph=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function fa(n){function e(t){var r=ua({},t);return delete r.ref,n(r,t.ref||null)}return e.$$typeof=Ph,e.render=n,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(n.displayName||n.name)+")",e}var pa=function(n,e){return n==null?null:ut(ut(n).map(e))},ga={map:pa,forEach:pa,count:function(n){return n?ut(n).length:0},only:function(n){var e=ut(n);if(e.length!==1)throw"Children.only";return e[0]},toArray:ut},Dh=N.__e;N.__e=function(n,e,t,r){if(n.then){for(var s,i=e;i=i.__;)if((s=i.__c)&&s.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k),s.__c(n,e)}Dh(n,e,t,r)};var ma=N.unmount;function ba(n,e,t){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),n.__c.__H=null),(n=ua({},n)).__c!=null&&(n.__c.__P===t&&(n.__c.__P=e),n.__c.__e=!0,n.__c=null),n.__k=n.__k&&n.__k.map(function(r){return ba(r,e,t)})),n}function _a(n,e,t){return n&&t&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(r){return _a(r,e,t)}),n.__c&&n.__c.__P===e&&(n.__e&&t.appendChild(n.__e),n.__c.__e=!0,n.__c.__P=t)),n}function mn(){this.__u=0,this.o=null,this.__b=null}function va(n){var e=n.__.__c;return e&&e.__a&&e.__a(n)}function ya(n){var e,t,r,s=null;function i(o){if(e||(e=n()).then(function(a){a&&(s=a.default||a),r=!0},function(a){t=a,r=!0}),t)throw t;if(!r)throw e;return s?Qe(s,o):null}return i.displayName="Lazy",i.__f=!0,i}function Gt(){this.i=null,this.l=null}N.unmount=function(n){var e=n.__c;e&&e.__R&&e.__R(),e&&32&n.__u&&(n.type=null),ma&&ma(n)},(mn.prototype=new We).__c=function(n,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var s=va(r.__v),i=!1,o=function(){i||(i=!0,t.__R=null,s?s(a):a())};t.__R=o;var a=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=_a(l,l.__c.__P,l.__c.__O)}var c;for(r.setState({__a:r.__b=null});c=r.o.pop();)c.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(o,o)},mn.prototype.componentWillUnmount=function(){this.o=[]},mn.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=ba(this.__b,t,r.__O=r.__P)}this.__b=null}var s=e.__a&&Qe(Te,null,n.fallback);return s&&(s.__u&=-33),[Qe(Te,null,e.__a?null:n.children),s]};var xa=function(n,e,t){if(++t[1]===t[0]&&n.l.delete(e),n.props.revealOrder&&(n.props.revealOrder[0]!=="t"||!n.l.size))for(t=n.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;n.i=t=t[2]}};function Ih(n){return this.getChildContext=function(){return n.context},n.children}function $h(n){var e=this,t=n.h;if(e.componentWillUnmount=function(){Ct(null,e.v),e.v=null,e.h=null},e.h&&e.h!==t&&e.componentWillUnmount(),!e.v){for(var r=e.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;e.h=t,e.v={nodeType:1,parentNode:t,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},insertBefore:function(s,i){this.childNodes.push(s),e.h.insertBefore(s,i)},removeChild:function(s){this.childNodes.splice(this.childNodes.indexOf(s)>>>1,1),e.h.removeChild(s)}}}Ct(Qe(Ih,{context:e.context},n.__v),e.v)}function wa(n,e){var t=Qe($h,{__v:n,h:e});return t.containerInfo=e,t}(Gt.prototype=new We).__a=function(n){var e=this,t=va(e.__v),r=e.l.get(n);return r[0]++,function(s){var i=function(){e.props.revealOrder?(r.push(s),xa(e,n,r)):s()};t?t(i):i()}},Gt.prototype.render=function(n){this.i=null,this.l=new Map;var e=ut(n.children);n.revealOrder&&n.revealOrder[0]==="b"&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return n.children},Gt.prototype.componentDidUpdate=Gt.prototype.componentDidMount=function(){var n=this;this.l.forEach(function(e,t){xa(n,t,e)})};var ka=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Nh=/^(?: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]/,Mh=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Fh=/[A-Z0-9]/g,Lh=typeof document<"u",jh=function(n){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(n)};function Ta(n,e,t){return e.__k==null&&(e.textContent=""),Ct(n,e),typeof t=="function"&&t(),n?n.__c:null}function Sa(n,e,t){return di(n,e),typeof t=="function"&&t(),n?n.__c:null}We.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(n){Object.defineProperty(We.prototype,n,{configurable:!0,get:function(){return this["UNSAFE_"+n]},set:function(e){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:e})}})});var Ca=N.event;function Uh(){}function zh(){return this.cancelBubble}function qh(){return this.defaultPrevented}N.event=function(n){return Ca&&(n=Ca(n)),n.persist=Uh,n.isPropagationStopped=zh,n.isDefaultPrevented=qh,n.nativeEvent=n};var Rs,Bh={enumerable:!1,configurable:!0,get:function(){return this.class}},Ea=N.vnode;N.vnode=function(n){typeof n.type=="string"&&function(e){var t=e.props,r=e.type,s={},i=r.indexOf("-")===-1;for(var o in t){var a=t[o];if(!(o==="value"&&"defaultValue"in t&&a==null||Lh&&o==="children"&&r==="noscript"||o==="class"||o==="className")){var l=o.toLowerCase();o==="defaultValue"&&"value"in t&&t.value==null?o="value":o==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?o="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||jh(t.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":Mh.test(o)&&(o=l):l=o="oninput":i&&Nh.test(o)?o=o.replace(Fh,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&s[o=l]&&(o="oninputCapture"),s[o]=a}}r=="select"&&s.multiple&&Array.isArray(s.value)&&(s.value=ut(t.children).forEach(function(c){c.props.selected=s.value.indexOf(c.props.value)!=-1})),r=="select"&&s.defaultValue!=null&&(s.value=ut(t.children).forEach(function(c){c.props.selected=s.multiple?s.defaultValue.indexOf(c.props.value)!=-1:s.defaultValue==c.props.value})),t.class&&!t.className?(s.class=t.class,Object.defineProperty(s,"className",Bh)):(t.className&&!t.class||t.class&&t.className)&&(s.class=s.className=t.className),e.props=s}(n),n.$$typeof=ka,Ea&&Ea(n)};var Aa=N.__r;N.__r=function(n){Aa&&Aa(n),Rs=n.__c};var Ra=N.diffed;N.diffed=function(n){Ra&&Ra(n);var e=n.props,t=n.__e;t!=null&&n.type==="textarea"&&"value"in e&&e.value!==t.value&&(t.value=e.value==null?"":e.value),Rs=null};var Oa={ReactCurrentDispatcher:{current:{readContext:function(n){return Rs.__n[n.__c].props.value},useCallback:Ht,useContext:Dr,useDebugValue:Ir,useDeferredValue:Cs,useEffect:_e,useId:$r,useImperativeHandle:Pr,useInsertionEffect:As,useLayoutEffect:Bt,useMemo:vt,useReducer:kn,useRef:et,useState:M,useSyncExternalStore:ks,useTransition:Es}}},Hh="18.3.1";function Pa(n){return Qe.bind(null,n)}function bn(n){return!!n&&n.$$typeof===ka}function Da(n){return bn(n)&&n.type===Te}function Ia(n){return!!n&&!!n.displayName&&(typeof n.displayName=="string"||n.displayName instanceof String)&&n.displayName.startsWith("Memo(")}function $a(n){return bn(n)?Nl.apply(null,arguments):n}function Na(n){return!!n.__k&&(Ct(null,n),!0)}function Ma(n){return n&&(n.base||n.nodeType===1&&n)||null}var Fa=function(n,e){return n(e)},La=function(n,e){return n(e)},ja=Te,Ua=bn,Wh={useState:M,useId:$r,useReducer:kn,useEffect:_e,useLayoutEffect:Bt,useInsertionEffect:As,useTransition:Es,useDeferredValue:Cs,useSyncExternalStore:ks,startTransition:Ss,useRef:et,useImperativeHandle:Pr,useMemo:vt,useCallback:Ht,useContext:Dr,useDebugValue:Ir,version:"18.3.1",Children:ga,render:Ta,hydrate:Sa,unmountComponentAtNode:Na,createPortal:wa,createElement:Qe,createContext:hi,createFactory:Pa,cloneElement:$a,createRef:ni,Fragment:Te,isValidElement:bn,isElement:Ua,isFragment:Da,isMemo:Ia,findDOMNode:Ma,Component:We,PureComponent:nr,memo:da,forwardRef:fa,flushSync:La,unstable_batchedUpdates:Fa,StrictMode:ja,Suspense:mn,SuspenseList:Gt,lazy:ya,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Oa};const rr=hu(Object.freeze(Object.defineProperty({__proto__:null,Children:ga,Component:We,Fragment:Te,PureComponent:nr,StrictMode:ja,Suspense:mn,SuspenseList:Gt,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Oa,cloneElement:$a,createContext:hi,createElement:Qe,createFactory:Pa,createPortal:wa,createRef:ni,default:Wh,findDOMNode:Ma,flushSync:La,forwardRef:fa,hydrate:Sa,isElement:Ua,isFragment:Da,isMemo:Ia,isValidElement:bn,lazy:ya,memo:da,render:Ta,startTransition:Ss,unmountComponentAtNode:Na,unstable_batchedUpdates:Fa,useCallback:Ht,useContext:Dr,useDebugValue:Ir,useDeferredValue:Cs,useEffect:_e,useErrorBoundary:Fl,useId:$r,useImperativeHandle:Pr,useInsertionEffect:As,useLayoutEffect:Bt,useMemo:vt,useReducer:kn,useRef:et,useState:M,useSyncExternalStore:ks,useTransition:Es,version:Hh},Symbol.toStringTag,{value:"Module"})));var Os={exports:{}},sr={exports:{}},Q={};/** @license React v16.13.1
86
+ `}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>${ft(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let s=this.parser.parseInline(r),i=ia(e);if(i===null)return s;e=i;let o='<a href="'+e+'"';return t&&(o+=' title="'+ft(t)+'"'),o+=">"+s+"</a>",o}image({href:e,title:t,text:r,tokens:s}){s&&(r=this.parser.parseInline(s,this.parser.textRenderer));let i=ia(e);if(i===null)return ft(r);e=i;let o=`<img src="${e}" alt="${r}"`;return t&&(o+=` title="${ft(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ft(e.text)}},vs=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}},Xe=class Ys{constructor(e){ne(this,"options");ne(this,"renderer");ne(this,"textRenderer");this.options=e||Nt,this.options.renderer=this.options.renderer||new Qn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new vs}static parse(e,t){return new Ys(t).parse(e)}static parseInline(e,t){return new Ys(t).parseInline(e)}parse(e){var r,s;let t="";for(let i=0;i<e.length;i++){let o=e[i];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[o.type]){let l=o,c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){t+=c||"";continue}}let a=o;switch(a.type){case"space":{t+=this.renderer.space(a);break}case"hr":{t+=this.renderer.hr(a);break}case"heading":{t+=this.renderer.heading(a);break}case"code":{t+=this.renderer.code(a);break}case"table":{t+=this.renderer.table(a);break}case"blockquote":{t+=this.renderer.blockquote(a);break}case"list":{t+=this.renderer.list(a);break}case"checkbox":{t+=this.renderer.checkbox(a);break}case"html":{t+=this.renderer.html(a);break}case"def":{t+=this.renderer.def(a);break}case"paragraph":{t+=this.renderer.paragraph(a);break}case"text":{t+=this.renderer.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return t}parseInline(e,t=this.renderer){var s,i;let r="";for(let o=0;o<e.length;o++){let a=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[a.type]){let c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=c||"";continue}}let l=a;switch(l.type){case"escape":{r+=t.text(l);break}case"html":{r+=t.html(l);break}case"link":{r+=t.link(l);break}case"image":{r+=t.image(l);break}case"checkbox":{r+=t.checkbox(l);break}case"strong":{r+=t.strong(l);break}case"em":{r+=t.em(l);break}case"codespan":{r+=t.codespan(l);break}case"br":{r+=t.br(l);break}case"del":{r+=t.del(l);break}case"text":{r+=t.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},pn=(gr=class{constructor(n){ne(this,"options");ne(this,"block");this.options=n||Nt}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?Ye.lex:Ye.lexInline}provideParser(){return this.block?Xe.parse:Xe.parseInline}},ne(gr,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ne(gr,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),gr),ph=class{constructor(...e){ne(this,"defaults",us());ne(this,"options",this.setOptions);ne(this,"parse",this.parseMarkdown(!0));ne(this,"parseInline",this.parseMarkdown(!1));ne(this,"Parser",Xe);ne(this,"Renderer",Qn);ne(this,"TextRenderer",vs);ne(this,"Lexer",Ye);ne(this,"Tokenizer",Kn);ne(this,"Hooks",pn);this.use(...e)}walkTokens(e,t){var s,i;let r=[];for(let o of e)switch(r=r.concat(t.call(this,o)),o.type){case"table":{let a=o;for(let l of a.header)r=r.concat(this.walkTokens(l.tokens,t));for(let l of a.rows)for(let c of l)r=r.concat(this.walkTokens(c.tokens,t));break}case"list":{let a=o;r=r.concat(this.walkTokens(a.items,t));break}default:{let a=o;(i=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&i[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{let c=a[l].flat(1/0);r=r.concat(this.walkTokens(c,t))}):a.tokens&&(r=r.concat(this.walkTokens(a.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let o=t.renderers[i.name];o?t.renderers[i.name]=function(...a){let l=i.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[i.level];o?o.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),r.renderer){let i=this.defaults.renderer||new Qn(this.defaults);for(let o in r.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=r.renderer[a],c=i[a];i[a]=(...u)=>{let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d||""}}s.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new Kn(this.defaults);for(let o in r.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=r.tokenizer[a],c=i[a];i[a]=(...u)=>{let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}s.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new pn;for(let o in r.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=r.hooks[a],c=i[a];pn.passThroughHooks.has(o)?i[a]=u=>{if(this.defaults.async&&pn.passThroughHooksRespectAsync.has(o))return(async()=>{let g=await l.call(i,u);return c.call(i,g)})();let d=l.call(i,u);return c.call(i,d)}:i[a]=(...u)=>{if(this.defaults.async)return(async()=>{let g=await l.apply(i,u);return g===!1&&(g=await c.apply(i,u)),g})();let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}s.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,o=r.walkTokens;s.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),i&&(l=l.concat(i.call(this,a))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ye.lex(e,t??this.defaults)}parser(e,t){return Xe.parse(e,t??this.defaults)}parseMarkdown(e){return(t,r)=>{let s={...r},i={...this.defaults,...s},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return o(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"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(t):t,l=await(i.hooks?await i.hooks.provideLexer():e?Ye.lex:Ye.lexInline)(a,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():e?Xe.parse:Xe.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(o);try{i.hooks&&(t=i.hooks.preprocess(t));let a=(i.hooks?i.hooks.provideLexer():e?Ye.lex:Ye.lexInline)(t,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():e?Xe.parse:Xe.parseInline)(a,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(a){return o(a)}}}onError(e,t){return r=>{if(r.message+=`
87
+ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+ft(r.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}},Mt=new ph;function K(n,e){return Mt.parse(n,e)}K.options=K.setOptions=function(n){return Mt.setOptions(n),K.defaults=Mt.defaults,Wo(K.defaults),K},K.getDefaults=us,K.defaults=Nt,K.use=function(...n){return Mt.use(...n),K.defaults=Mt.defaults,Wo(K.defaults),K},K.walkTokens=function(n,e){return Mt.walkTokens(n,e)},K.parseInline=Mt.parseInline,K.Parser=Xe,K.parser=Xe.parse,K.Renderer=Qn,K.TextRenderer=vs,K.Lexer=Ye,K.lexer=Ye.lex,K.Tokenizer=Kn,K.Hooks=pn,K.parse=K,K.options,K.setOptions,K.use,K.walkTokens,K.parseInline,Xe.parse,Ye.lex;const gh=({chatbot:n,conversations:e,messages:t,totalConversationsCount:r,conversationsLoading:s,loadMoreConversations:i,handleChangeConversation:o})=>{const a=[...t].sort((u,d)=>new Date(d.createdAt).getTime()-new Date(u.createdAt).getTime()),l=new Map;a.forEach(u=>{l.has(u.conversationId)||l.set(u.conversationId,u)});const c=Array.from(l.values()).map(u=>({conversation:e.find(d=>d._id===u.conversationId),latestMessage:u}));return p("div",{className:"conversationMainItemContainer",children:[c.map((u,d)=>p(bh,{chatbot:n,data:u,handleChangeConversation:o},d)),r>e.length&&p("button",{className:"newConversationBtn",onClick:i,children:s?p("div",{className:"newConversationLoading",children:p(cn,{className:"base-text-color"})}):"Load More Conversations"})]})},mh=(n="")=>n.split(`
88
+ `)[0].replace(/#{1,6}\s+/g,"").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").trim(),bh=({chatbot:n,data:e,handleChangeConversation:t})=>{if(!e.conversation||e.conversation===void 0)return;const{conversation:r,latestMessage:s}=e,i=()=>{if(r.assignedTo){const a=n.teamMembers.members.find(l=>l.user._id===r.assignedTo);return a!=null&&a.user.profilePicture?p("img",{src:a.user.profilePicture,alt:"User"},a.user.profilePicture):p(Jt,{className:"input-background-color"})}return p("img",{src:n.appearance.images.popupChat,alt:"Bot"},n.appearance.images.popupChat)},o=mh(s==null?void 0:s.data.text);return p("div",{className:"conversationMainItem",onClick:()=>t(r),children:[p("div",{children:p(i,{})}),p("div",{className:"textHolder",children:[p("p",{children:o||"Send a message"}),p("p",{children:os((s==null?void 0:s.createdAt)||(r==null?void 0:r.createdAt))})]}),p("div",{children:[p(Fo,{className:"base-color"}),s.owner==="agent"&&!s.seen&&p("div",{className:"unreadMessage"})]})]})},ys=({chatbot:n,className:e=""})=>p("div",{className:`agents ${e}`,children:n.teamMembers.members.filter(t=>t.joined).slice(0,3).map((t,r)=>p("div",{children:t.user.profilePicture?p("img",{src:t.user.profilePicture,alt:"Agent"},t.user.profilePicture):p(Jt,{className:"input-text-color"})},r))}),_h=({chatbot:n,latestCurrentConversation:e})=>{var i;const t=(i=n.teamMembers.members.find(o=>o.user._id===(e==null?void 0:e.assignedTo)))==null?void 0:i.user,r=()=>e!=null&&e.assignedTo?t!=null&&t.profilePicture?p("div",{className:"headerImageWrapper",children:p("img",{src:t.profilePicture,width:"100%",alt:"Profile",style:{borderRadius:"50%"}},t.profilePicture)}):p("div",{className:"headerImageWrapper",children:p(Jt,{className:"background-text-color"})}):p(ys,{chatbot:n}),s=()=>p("div",{className:"headerImageWrapper",children:p("img",{src:n.appearance.images.popupChat,width:"100%",alt:"Chat"},n.appearance.images.popupChat)});return p(ke,{children:e!=null&&e.assignedTo?r():s()})},vh=({email:n,chatbot:e,dataFromUser:t})=>{const[r,s]=M(()=>{const o={};if(n){const a=t.data.find(l=>l.type==="email");a&&(o[a.key]=n)}return o}),i=(o,a)=>{switch(o.type){case"text":return p("div",{children:[p("h3",{children:o.name}),p("input",{type:"text",required:o.required,placeholder:o.data.placeholder,value:r[o.key]||"",onInput:l=>s({...r,[o.key]:l.currentTarget.value})})]},`${a}-${o.key}`);case"dropdown":return p("div",{children:[p("h4",{children:o.name}),p("select",{required:o.required,name:o.name,onChange:l=>s({...r,[o.key]:l.target.value}),children:[p("option",{value:"",children:"Select"}),o.data.map(l=>p("option",{value:l.value,children:l.label},l.value))]})]},`${a}-${o.key}`);case"date":return p("div",{children:[p("h4",{children:o.name}),p("input",{required:o.required,type:"date",onChange:l=>s({...r,[o.key]:l.target.value})})]},`${a}-${o.key}`);case"time":return p("div",{children:[p("h4",{children:o.name}),p("input",{required:o.required,type:"time",onChange:l=>s({...r,[o.key]:l.target.value})})]},`${a}-${o.key}`);case"textarea":return p("div",{children:[p("h4",{children:o.name}),p("textarea",{required:o.required,placeholder:o.data.placeholder,rows:4,value:r[o.key]||"",onInput:l=>s({...r,[o.key]:l.currentTarget.value})})]},`${a}-${o.key}`);case"email":return p("div",{children:[p("h4",{children:o.name}),p("input",{required:o.required,placeholder:o.data.placeholder,type:"email",value:r[o.key]||"",onInput:l=>s({...r,[o.key]:l.currentTarget.value})}),p("span",{className:"hint",children:o.error})]},`${a}-${o.key}`);default:return null}};return p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:e.appearance.images.chat,alt:"Bot"},e.appearance.images.chat)}),p("div",{className:"messageDiv",children:p("form",{className:"messageP",onSubmit:o=>{o.preventDefault(),t.onSubmit(r)},children:[t.data.map((o,a)=>i(o,a)),p("div",{className:"livelinkSubmitDiv",children:p("button",{type:"submit",children:"Submit"})})]})})]})},yh=({chatbot:n,ratingFromUser:e})=>{const[t,r]=M({comment:"",rating:4});return p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:n.appearance.images.chat,alt:"Bot"},n.appearance.images.chat)}),p("div",{className:"messageDiv",children:p("form",{className:"messageP",onSubmit:s=>{s.preventDefault(),t.rating!==0&&e.onSubmit(t)},children:[p("h3",{style:{fontWeight:"400"},children:"Please Leave a review"}),p("div",{children:[p("h4",{children:"Comment"}),p("textarea",{required:!0,minLength:3,maxLength:500,rows:4,onChange:s=>r({...t,comment:s.target.value})})]}),p("div",{style:{display:"flex"},children:[1,2,3,4,5].map(s=>p("div",{style:{cursor:"pointer"},onClick:()=>r({...t,rating:s}),children:p(ad,{className:t.rating>=s?"base-color":"input-text-color"})},s))}),p("div",{className:"livelinkSubmitDiv",children:p("button",{type:"submit",children:"Submit"})})]})})]})},xh=({chatbot:n,onlineAgents:e,currentConversation:t})=>{var s,i,o,a,l;const r=n.chatflow.nodes.find(c=>c.id===t.currentNode);return p("div",{className:"onlineAgents",children:[p("div",{children:p("span",{children:(i=(s=r==null?void 0:r.data)==null?void 0:s.expectedTime)!=null&&i.value?(o=r==null?void 0:r.data)==null?void 0:o.expectedTime.text:"Connecting to an Agent"})}),((l=(a=r==null?void 0:r.data)==null?void 0:a.expectedTime)==null?void 0:l.showOnlineAgents)&&e>0&&p("div",{children:[p(ys,{chatbot:n}),p("p",{children:["Online Agents: ",p("b",{children:e})]})]})]})},wh=({chatbot:n})=>p("div",{className:"mainMessageContainer mySelfTextDiv",children:p("div",{className:"messageDiv mySelfTextDiv",children:p("div",{className:"otherUserTextLoading",children:[p("div",{className:"loading1"}),p("div",{className:"loading2"}),p("div",{className:"loading3"})]})})}),kh=({chatbot:n})=>p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:n.appearance.images.chat,alt:"Bot"},n.appearance.images.chat)}),p("div",{className:"messageDiv",children:p("div",{className:"otherUserTextLoading",children:[p("div",{className:"loading1"}),p("div",{className:"loading2"}),p("div",{className:"loading3"})]})})]}),Th=({chatbot:n,message:e,AIControlNode:t})=>{var g,h;const r=e.owner==="agent",s=r?n.teamMembers.members.find(f=>f.user._id===e.ownerId):null,o=(((g=e.data.sources)==null?void 0:g.filter((f,m,b)=>b.indexOf(f)===m))||[]).filter(f=>f.startsWith("https://")).slice(0,3),a=(h=e.data.file)==null?void 0:h.name,l=a&&/\.(jpg|png|jpeg|gif|bmp)$/i.test(a),c=a&&/\.(mp4|avi|mov|mkv|wmv|flv|webm|mpeg)$/i.test(a),[u,d]=M("");return be(()=>{const f=K.parse(e.data.text||"");typeof f=="string"?d(f):f.then(d)},[e.data.text]),p("div",{className:`mainMessageContainer ${e.owner==="user"?"mySelfTextDiv":""}`,children:[e.owner!=="user"&&(r?p("div",{className:"logoWithMessageDiv",children:s!=null&&s.user.profilePicture?p("img",{src:s.user.profilePicture,alt:"Agent"},s.user.profilePicture):p(Jt,{className:"input-background-color"})}):p("div",{className:"logoWithMessageDiv",children:p("img",{src:n.appearance.images.popupChat,alt:"Bot"},n.appearance.images.popupChat)})),p("div",{className:`messageDiv ${e.owner==="user"?"mySelfTextDiv":""}`,children:[p("div",{className:"NameAndDate",children:e.owner!=="user"?p(ke,{children:[(s==null?void 0:s.user.name)||"AI"," -"," ",os(e.createdAt)]}):os(e.createdAt)}),l&&e.data.file&&p("a",{target:"_blank",rel:"noopener noreferrer",href:e.data.file.url,style:{borderRadius:"5px"},children:p("img",{src:e.data.file.url,style:{height:"80px"},alt:"Image"},e.data.file.url)}),c&&e.data.file&&p("a",{target:"_blank",rel:"noopener noreferrer",href:e.data.file.url,style:{borderRadius:"5px"},children:p("video",{src:e.data.file.url,style:{height:"80px"},controls:!0,children:"Video"})}),u&&p("div",{className:"messageP markdownText",dangerouslySetInnerHTML:{__html:u}}),p("div",{className:"sources",children:[e.data.file&&!l&&!c&&p("a",{target:"_blank",href:e.data.file.url,children:e.data.file.name}),(t==null?void 0:t.data.replySource.value)&&o.length>0&&o.map((f,m)=>p("a",{target:"_blank",href:f,children:f},`${f}-${m}`))]})]})]})},Sh=({chatbot:n})=>p("div",{className:"messagesLoading",children:p("div",{children:p(cn,{className:"base-color"})})}),Ch=({hoveringMessageInner:n,chatbot:e})=>p("div",{className:"hoveringMessageInner",children:n.data.map((t,r)=>p("div",{onClick:()=>n.onClick(t),children:t.message},r))}),Eh=({file:n,setFile:e,chatbot:t})=>p("div",{className:"hoveringMessageInner",children:p("div",{onClick:()=>e(null),children:[p(Lo,{className:"base-text-color",width:"16",height:"16"}),n.name]})}),Ah=({showHoveringMessage:n,hoveringMessages:e,chatbot:t,setShowHoveringMessage:r,coreState:s,conversationState:i,uiState:o,node:a,setChatOpen:l})=>{var j;const[c,u]=M(!1),{token:d,isChatbotDefault:g}=s,{newMessage:h,setNewMessage:f,setCurrentConversation:m,conversations:b,setConversations:v}=i,{callChatFlowRef:x,chatOpen:w}=o,[k,_]=M(Mr("robodialog-chatbot-closed")),S=(a==null?void 0:a.data.popupMessage.value)&&h,P=!g&&!S&&!k&&n,T=()=>{_(!0),Tn("robodialog-chatbot-closed",!0),f(null),r(!1)},A=(h==null?void 0:h.owner)==="agent"?(j=t.teamMembers.members.find(Z=>Z.user._id===h.ownerId))==null?void 0:j.user:null,D=()=>{r(!1),f(null);const Z=b.find(se=>(h==null?void 0:h.conversationId)===se._id);Z&&(x.current=!0,m(Z),l(!0))},E=A!=null&&A.profilePicture?p("div",{className:"headerImageWrapper",children:p("img",{src:A.profilePicture,width:"100%",alt:"Profile",style:{borderRadius:"50%"}},A.profilePicture)}):p("div",{className:"headerImageWrapper",children:p(Jt,{className:"background-text-color"})});return!(n&&((e==null?void 0:e.length)??0)>0||S)||w?null:p("div",{className:"chatHoveringMessages",children:[(S||P)&&!k&&p("div",{onClick:T,className:"chatHoveringMessage closeMessages",children:c?p("div",{className:"loadingIcon",children:p("div",{style:{width:"16px",height:"16px"},children:p(cn,{className:"background-text-color"})})}):p(Lo,{className:"background-text-color",width:"16px",height:"16px"})}),S&&p("div",{className:"chatHoveringMessage",onClick:D,children:[p("div",{className:"chatHoveringMessageUser",children:[E,h.owner==="agent"?A==null?void 0:A.name:"AI"]}),p("div",{style:{maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis"},children:h.data.text})]}),P&&(e==null?void 0:e.map((Z,se)=>p(Rh,{hoveringMessage:Z,chatbot:t,loading:c,setLoading:u,coreState:s,conversationState:i,uiState:o,setShowHoveringMessage:r,token:d,node:a,setChatOpen:l,conversations:b,setConversations:v,setCurrentConversation:m,callChatFlowRef:x},se)))]})},Rh=({hoveringMessage:n,chatbot:e,loading:t,setLoading:r,setShowHoveringMessage:s,token:i,setChatOpen:o,setConversations:a,conversations:l,setCurrentConversation:c,callChatFlowRef:u,coreState:d,conversationState:g,uiState:h})=>{var b;const f=async()=>{if(t)return;o(!0),r(!0);let v={};if(n.type==="query")v.chatflow={key:"end",index:0};else{const x=e.chatflow.edges.find(w=>w.sourceHandle===n.id);if(!x){r(!1);return}v.nodeId=x.target}try{const x=await It.userCreate({body:v},i);if(!x.data)throw new Error("Conversation creation failed");const w=x.data;if(a([...l,w]),n.type==="query"){const k=e.chatflow.nodes.find(_=>_.id===w.currentNode);k&&(h.humanControl=k.data.control.type==="human"),c(w),await cs({coreState:d,conversationState:g,uiState:h,userMessage:n.query,setUserMessage:()=>{},file:null,setFile:()=>{},showToast:()=>{},latestCurrentConversation:w})}else u.current=!0,c(w);s(!1)}catch(x){console.error("Chat hovering message error:",x)}finally{r(!1)}},m=n.showUser?(b=e.teamMembers.members.find(v=>{var x;return v.user._id===((x=n==null?void 0:n.user)==null?void 0:x._id)}))==null?void 0:b.user:null;return p("div",{className:"chatHoveringMessage",onClick:f,children:[n.showUser&&m&&p("div",{className:"chatHoveringMessageUser",children:[p("div",{children:m.profilePicture?p("img",{src:m.profilePicture},m.profilePicture):p(Jt,{className:"input-background-color"})}),n.title]}),p("div",{children:n.message})]})};var er={exports:{}},la={};function ca(n,e){for(var t in e)n[t]=e[t];return n}function xs(n,e){for(var t in n)if(t!=="__source"&&!(t in e))return!0;for(var r in e)if(r!=="__source"&&n[r]!==e[r])return!0;return!1}function ws(n,e){var t=e(),r=M({t:{__:t,u:e}}),s=r[0].t,i=r[1];return qt(function(){s.__=t,s.u=e,ks(s)&&i({t:s})},[n,t,e]),be(function(){return ks(s)&&i({t:s}),n(function(){ks(s)&&i({t:s})})},[n]),t}function ks(n){var e,t,r=n.u,s=n.__;try{var i=r();return!((e=s)===(t=i)&&(e!==0||1/e==1/t)||e!=e&&t!=t)}catch{return!0}}function Ts(n){n()}function Ss(n){return n}function Cs(){return[!1,Ts]}var Es=qt;function tr(n,e){this.props=n,this.context=e}function ua(n,e){function t(s){var i=this.props.ref,o=i==s.ref;return!o&&i&&(i.call?i(null):i.current=null),e?!e(this.props,s)||!o:xs(this.props,s)}function r(s){return this.shouldComponentUpdate=t,Ke(n,s)}return r.displayName="Memo("+(n.displayName||n.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r.type=n,r}(tr.prototype=new He).isPureReactComponent=!0,tr.prototype.shouldComponentUpdate=function(n,e){return xs(this.props,n)||xs(this.state,e)};var da=N.__b;N.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),da&&da(n)};var Oh=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function ha(n){function e(t){var r=ca({},t);return delete r.ref,n(r,t.ref||null)}return e.$$typeof=Oh,e.render=n,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(n.displayName||n.name)+")",e}var fa=function(n,e){return n==null?null:ct(ct(n).map(e))},pa={map:fa,forEach:fa,count:function(n){return n?ct(n).length:0},only:function(n){var e=ct(n);if(e.length!==1)throw"Children.only";return e[0]},toArray:ct},Ph=N.__e;N.__e=function(n,e,t,r){if(n.then){for(var s,i=e;i=i.__;)if((s=i.__c)&&s.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k),s.__c(n,e)}Ph(n,e,t,r)};var ga=N.unmount;function ma(n,e,t){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),n.__c.__H=null),(n=ca({},n)).__c!=null&&(n.__c.__P===t&&(n.__c.__P=e),n.__c.__e=!0,n.__c=null),n.__k=n.__k&&n.__k.map(function(r){return ma(r,e,t)})),n}function ba(n,e,t){return n&&t&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(r){return ba(r,e,t)}),n.__c&&n.__c.__P===e&&(n.__e&&t.appendChild(n.__e),n.__c.__e=!0,n.__c.__P=t)),n}function gn(){this.__u=0,this.o=null,this.__b=null}function _a(n){var e=n.__.__c;return e&&e.__a&&e.__a(n)}function va(n){var e,t,r,s=null;function i(o){if(e||(e=n()).then(function(a){a&&(s=a.default||a),r=!0},function(a){t=a,r=!0}),t)throw t;if(!r)throw e;return s?Ke(s,o):null}return i.displayName="Lazy",i.__f=!0,i}function Zt(){this.i=null,this.l=null}N.unmount=function(n){var e=n.__c;e&&e.__R&&e.__R(),e&&32&n.__u&&(n.type=null),ga&&ga(n)},(gn.prototype=new He).__c=function(n,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var s=_a(r.__v),i=!1,o=function(){i||(i=!0,t.__R=null,s?s(a):a())};t.__R=o;var a=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=ba(l,l.__c.__P,l.__c.__O)}var c;for(r.setState({__a:r.__b=null});c=r.o.pop();)c.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(o,o)},gn.prototype.componentWillUnmount=function(){this.o=[]},gn.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=ma(this.__b,t,r.__O=r.__P)}this.__b=null}var s=e.__a&&Ke(ke,null,n.fallback);return s&&(s.__u&=-33),[Ke(ke,null,e.__a?null:n.children),s]};var ya=function(n,e,t){if(++t[1]===t[0]&&n.l.delete(e),n.props.revealOrder&&(n.props.revealOrder[0]!=="t"||!n.l.size))for(t=n.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;n.i=t=t[2]}};function Dh(n){return this.getChildContext=function(){return n.context},n.children}function Ih(n){var e=this,t=n.h;if(e.componentWillUnmount=function(){St(null,e.v),e.v=null,e.h=null},e.h&&e.h!==t&&e.componentWillUnmount(),!e.v){for(var r=e.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;e.h=t,e.v={nodeType:1,parentNode:t,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},insertBefore:function(s,i){this.childNodes.push(s),e.h.insertBefore(s,i)},removeChild:function(s){this.childNodes.splice(this.childNodes.indexOf(s)>>>1,1),e.h.removeChild(s)}}}St(Ke(Dh,{context:e.context},n.__v),e.v)}function xa(n,e){var t=Ke(Ih,{__v:n,h:e});return t.containerInfo=e,t}(Zt.prototype=new He).__a=function(n){var e=this,t=_a(e.__v),r=e.l.get(n);return r[0]++,function(s){var i=function(){e.props.revealOrder?(r.push(s),ya(e,n,r)):s()};t?t(i):i()}},Zt.prototype.render=function(n){this.i=null,this.l=new Map;var e=ct(n.children);n.revealOrder&&n.revealOrder[0]==="b"&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return n.children},Zt.prototype.componentDidUpdate=Zt.prototype.componentDidMount=function(){var n=this;this.l.forEach(function(e,t){ya(n,t,e)})};var wa=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,$h=/^(?: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]/,Nh=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Mh=/[A-Z0-9]/g,Fh=typeof document<"u",Lh=function(n){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(n)};function ka(n,e,t){return e.__k==null&&(e.textContent=""),St(n,e),typeof t=="function"&&t(),n?n.__c:null}function Ta(n,e,t){return ui(n,e),typeof t=="function"&&t(),n?n.__c:null}He.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(n){Object.defineProperty(He.prototype,n,{configurable:!0,get:function(){return this["UNSAFE_"+n]},set:function(e){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:e})}})});var Sa=N.event;function jh(){}function Uh(){return this.cancelBubble}function zh(){return this.defaultPrevented}N.event=function(n){return Sa&&(n=Sa(n)),n.persist=jh,n.isPropagationStopped=Uh,n.isDefaultPrevented=zh,n.nativeEvent=n};var As,qh={enumerable:!1,configurable:!0,get:function(){return this.class}},Ca=N.vnode;N.vnode=function(n){typeof n.type=="string"&&function(e){var t=e.props,r=e.type,s={},i=r.indexOf("-")===-1;for(var o in t){var a=t[o];if(!(o==="value"&&"defaultValue"in t&&a==null||Fh&&o==="children"&&r==="noscript"||o==="class"||o==="className")){var l=o.toLowerCase();o==="defaultValue"&&"value"in t&&t.value==null?o="value":o==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?o="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||Lh(t.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":Nh.test(o)&&(o=l):l=o="oninput":i&&$h.test(o)?o=o.replace(Mh,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&s[o=l]&&(o="oninputCapture"),s[o]=a}}r=="select"&&s.multiple&&Array.isArray(s.value)&&(s.value=ct(t.children).forEach(function(c){c.props.selected=s.value.indexOf(c.props.value)!=-1})),r=="select"&&s.defaultValue!=null&&(s.value=ct(t.children).forEach(function(c){c.props.selected=s.multiple?s.defaultValue.indexOf(c.props.value)!=-1:s.defaultValue==c.props.value})),t.class&&!t.className?(s.class=t.class,Object.defineProperty(s,"className",qh)):(t.className&&!t.class||t.class&&t.className)&&(s.class=s.className=t.className),e.props=s}(n),n.$$typeof=wa,Ca&&Ca(n)};var Ea=N.__r;N.__r=function(n){Ea&&Ea(n),As=n.__c};var Aa=N.diffed;N.diffed=function(n){Aa&&Aa(n);var e=n.props,t=n.__e;t!=null&&n.type==="textarea"&&"value"in e&&e.value!==t.value&&(t.value=e.value==null?"":e.value),As=null};var Ra={ReactCurrentDispatcher:{current:{readContext:function(n){return As.__n[n.__c].props.value},useCallback:Bt,useContext:Pr,useDebugValue:Dr,useDeferredValue:Ss,useEffect:be,useId:Ir,useImperativeHandle:Or,useInsertionEffect:Es,useLayoutEffect:qt,useMemo:_t,useReducer:wn,useRef:Qe,useState:M,useSyncExternalStore:ws,useTransition:Cs}}},Bh="18.3.1";function Oa(n){return Ke.bind(null,n)}function mn(n){return!!n&&n.$$typeof===wa}function Pa(n){return mn(n)&&n.type===ke}function Da(n){return!!n&&!!n.displayName&&(typeof n.displayName=="string"||n.displayName instanceof String)&&n.displayName.startsWith("Memo(")}function Ia(n){return mn(n)?$l.apply(null,arguments):n}function $a(n){return!!n.__k&&(St(null,n),!0)}function Na(n){return n&&(n.base||n.nodeType===1&&n)||null}var Ma=function(n,e){return n(e)},Fa=function(n,e){return n(e)},La=ke,ja=mn,Hh={useState:M,useId:Ir,useReducer:wn,useEffect:be,useLayoutEffect:qt,useInsertionEffect:Es,useTransition:Cs,useDeferredValue:Ss,useSyncExternalStore:ws,startTransition:Ts,useRef:Qe,useImperativeHandle:Or,useMemo:_t,useCallback:Bt,useContext:Pr,useDebugValue:Dr,version:"18.3.1",Children:pa,render:ka,hydrate:Ta,unmountComponentAtNode:$a,createPortal:xa,createElement:Ke,createContext:di,createFactory:Oa,cloneElement:Ia,createRef:ti,Fragment:ke,isValidElement:mn,isElement:ja,isFragment:Pa,isMemo:Da,findDOMNode:Na,Component:He,PureComponent:tr,memo:ua,forwardRef:ha,flushSync:Fa,unstable_batchedUpdates:Ma,StrictMode:La,Suspense:gn,SuspenseList:Zt,lazy:va,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Ra};const nr=du(Object.freeze(Object.defineProperty({__proto__:null,Children:pa,Component:He,Fragment:ke,PureComponent:tr,StrictMode:La,Suspense:gn,SuspenseList:Zt,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Ra,cloneElement:Ia,createContext:di,createElement:Ke,createFactory:Oa,createPortal:xa,createRef:ti,default:Hh,findDOMNode:Na,flushSync:Fa,forwardRef:ha,hydrate:Ta,isElement:ja,isFragment:Pa,isMemo:Da,isValidElement:mn,lazy:va,memo:ua,render:ka,startTransition:Ts,unmountComponentAtNode:$a,unstable_batchedUpdates:Ma,useCallback:Bt,useContext:Pr,useDebugValue:Dr,useDeferredValue:Ss,useEffect:be,useErrorBoundary:Ml,useId:Ir,useImperativeHandle:Or,useInsertionEffect:Es,useLayoutEffect:qt,useMemo:_t,useReducer:wn,useRef:Qe,useState:M,useSyncExternalStore:ws,useTransition:Cs,version:Bh},Symbol.toStringTag,{value:"Module"})));var Rs={exports:{}},rr={exports:{}},Q={};/** @license React v16.13.1
89
89
  * react-is.production.min.js
90
90
  *
91
91
  * Copyright (c) Facebook, Inc. and its affiliates.
92
92
  *
93
93
  * This source code is licensed under the MIT license found in the
94
94
  * LICENSE file in the root directory of this source tree.
95
- */var za;function Vh(){if(za)return Q;za=1;var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,i=n?Symbol.for("react.profiler"):60114,o=n?Symbol.for("react.provider"):60109,a=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,u=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,g=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,f=n?Symbol.for("react.lazy"):60116,m=n?Symbol.for("react.block"):60121,b=n?Symbol.for("react.fundamental"):60117,v=n?Symbol.for("react.responder"):60118,x=n?Symbol.for("react.scope"):60119;function w(_){if(typeof _=="object"&&_!==null){var S=_.$$typeof;switch(S){case e:switch(_=_.type,_){case l:case c:case r:case i:case s:case d:return _;default:switch(_=_&&_.$$typeof,_){case a:case u:case f:case h:case o:return _;default:return S}}case t:return S}}}function k(_){return w(_)===c}return Q.AsyncMode=l,Q.ConcurrentMode=c,Q.ContextConsumer=a,Q.ContextProvider=o,Q.Element=e,Q.ForwardRef=u,Q.Fragment=r,Q.Lazy=f,Q.Memo=h,Q.Portal=t,Q.Profiler=i,Q.StrictMode=s,Q.Suspense=d,Q.isAsyncMode=function(_){return k(_)||w(_)===l},Q.isConcurrentMode=k,Q.isContextConsumer=function(_){return w(_)===a},Q.isContextProvider=function(_){return w(_)===o},Q.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===e},Q.isForwardRef=function(_){return w(_)===u},Q.isFragment=function(_){return w(_)===r},Q.isLazy=function(_){return w(_)===f},Q.isMemo=function(_){return w(_)===h},Q.isPortal=function(_){return w(_)===t},Q.isProfiler=function(_){return w(_)===i},Q.isStrictMode=function(_){return w(_)===s},Q.isSuspense=function(_){return w(_)===d},Q.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===r||_===c||_===i||_===s||_===d||_===g||typeof _=="object"&&_!==null&&(_.$$typeof===f||_.$$typeof===h||_.$$typeof===o||_.$$typeof===a||_.$$typeof===u||_.$$typeof===b||_.$$typeof===v||_.$$typeof===x||_.$$typeof===m)},Q.typeOf=w,Q}var ee={};/** @license React v16.13.1
95
+ */var Ua;function Wh(){if(Ua)return Q;Ua=1;var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,i=n?Symbol.for("react.profiler"):60114,o=n?Symbol.for("react.provider"):60109,a=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,u=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,g=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,f=n?Symbol.for("react.lazy"):60116,m=n?Symbol.for("react.block"):60121,b=n?Symbol.for("react.fundamental"):60117,v=n?Symbol.for("react.responder"):60118,x=n?Symbol.for("react.scope"):60119;function w(_){if(typeof _=="object"&&_!==null){var S=_.$$typeof;switch(S){case e:switch(_=_.type,_){case l:case c:case r:case i:case s:case d:return _;default:switch(_=_&&_.$$typeof,_){case a:case u:case f:case h:case o:return _;default:return S}}case t:return S}}}function k(_){return w(_)===c}return Q.AsyncMode=l,Q.ConcurrentMode=c,Q.ContextConsumer=a,Q.ContextProvider=o,Q.Element=e,Q.ForwardRef=u,Q.Fragment=r,Q.Lazy=f,Q.Memo=h,Q.Portal=t,Q.Profiler=i,Q.StrictMode=s,Q.Suspense=d,Q.isAsyncMode=function(_){return k(_)||w(_)===l},Q.isConcurrentMode=k,Q.isContextConsumer=function(_){return w(_)===a},Q.isContextProvider=function(_){return w(_)===o},Q.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===e},Q.isForwardRef=function(_){return w(_)===u},Q.isFragment=function(_){return w(_)===r},Q.isLazy=function(_){return w(_)===f},Q.isMemo=function(_){return w(_)===h},Q.isPortal=function(_){return w(_)===t},Q.isProfiler=function(_){return w(_)===i},Q.isStrictMode=function(_){return w(_)===s},Q.isSuspense=function(_){return w(_)===d},Q.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===r||_===c||_===i||_===s||_===d||_===g||typeof _=="object"&&_!==null&&(_.$$typeof===f||_.$$typeof===h||_.$$typeof===o||_.$$typeof===a||_.$$typeof===u||_.$$typeof===b||_.$$typeof===v||_.$$typeof===x||_.$$typeof===m)},Q.typeOf=w,Q}var ee={};/** @license React v16.13.1
96
96
  * react-is.development.js
97
97
  *
98
98
  * Copyright (c) Facebook, Inc. and its affiliates.
99
99
  *
100
100
  * This source code is licensed under the MIT license found in the
101
101
  * LICENSE file in the root directory of this source tree.
102
- */var qa;function Yh(){return qa||(qa=1,be.env.NODE_ENV!=="production"&&function(){var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,i=n?Symbol.for("react.profiler"):60114,o=n?Symbol.for("react.provider"):60109,a=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,u=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,g=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,f=n?Symbol.for("react.lazy"):60116,m=n?Symbol.for("react.block"):60121,b=n?Symbol.for("react.fundamental"):60117,v=n?Symbol.for("react.responder"):60118,x=n?Symbol.for("react.scope"):60119;function w(O){return typeof O=="string"||typeof O=="function"||O===r||O===c||O===i||O===s||O===d||O===g||typeof O=="object"&&O!==null&&(O.$$typeof===f||O.$$typeof===h||O.$$typeof===o||O.$$typeof===a||O.$$typeof===u||O.$$typeof===b||O.$$typeof===v||O.$$typeof===x||O.$$typeof===m)}function k(O){if(typeof O=="object"&&O!==null){var Ne=O.$$typeof;switch(Ne){case e:var mt=O.type;switch(mt){case l:case c:case r:case i:case s:case d:return mt;default:var jt=mt&&mt.$$typeof;switch(jt){case a:case u:case f:case h:case o:return jt;default:return Ne}}case t:return Ne}}}var _=l,S=c,P=a,T=o,A=e,D=u,E=r,j=f,Z=h,se=t,Oe=i,G=s,ye=d,he=!1;function Be(O){return he||(he=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),C(O)||k(O)===l}function C(O){return k(O)===c}function R(O){return k(O)===a}function $(O){return k(O)===o}function F(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function I(O){return k(O)===u}function q(O){return k(O)===r}function U(O){return k(O)===f}function z(O){return k(O)===h}function H(O){return k(O)===t}function X(O){return k(O)===i}function W(O){return k(O)===s}function le(O){return k(O)===d}ee.AsyncMode=_,ee.ConcurrentMode=S,ee.ContextConsumer=P,ee.ContextProvider=T,ee.Element=A,ee.ForwardRef=D,ee.Fragment=E,ee.Lazy=j,ee.Memo=Z,ee.Portal=se,ee.Profiler=Oe,ee.StrictMode=G,ee.Suspense=ye,ee.isAsyncMode=Be,ee.isConcurrentMode=C,ee.isContextConsumer=R,ee.isContextProvider=$,ee.isElement=F,ee.isForwardRef=I,ee.isFragment=q,ee.isLazy=U,ee.isMemo=z,ee.isPortal=H,ee.isProfiler=X,ee.isStrictMode=W,ee.isSuspense=le,ee.isValidElementType=w,ee.typeOf=k}()),ee}var Ba;function Ha(){return Ba||(Ba=1,be.env.NODE_ENV==="production"?sr.exports=Vh():sr.exports=Yh()),sr.exports}/*
102
+ */var za;function Vh(){return za||(za=1,me.env.NODE_ENV!=="production"&&function(){var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,i=n?Symbol.for("react.profiler"):60114,o=n?Symbol.for("react.provider"):60109,a=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,u=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,g=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,f=n?Symbol.for("react.lazy"):60116,m=n?Symbol.for("react.block"):60121,b=n?Symbol.for("react.fundamental"):60117,v=n?Symbol.for("react.responder"):60118,x=n?Symbol.for("react.scope"):60119;function w(O){return typeof O=="string"||typeof O=="function"||O===r||O===c||O===i||O===s||O===d||O===g||typeof O=="object"&&O!==null&&(O.$$typeof===f||O.$$typeof===h||O.$$typeof===o||O.$$typeof===a||O.$$typeof===u||O.$$typeof===b||O.$$typeof===v||O.$$typeof===x||O.$$typeof===m)}function k(O){if(typeof O=="object"&&O!==null){var $e=O.$$typeof;switch($e){case e:var gt=O.type;switch(gt){case l:case c:case r:case i:case s:case d:return gt;default:var Lt=gt&&gt.$$typeof;switch(Lt){case a:case u:case f:case h:case o:return Lt;default:return $e}}case t:return $e}}}var _=l,S=c,P=a,T=o,A=e,D=u,E=r,j=f,Z=h,se=t,Re=i,G=s,ve=d,de=!1;function qe(O){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),C(O)||k(O)===l}function C(O){return k(O)===c}function R(O){return k(O)===a}function $(O){return k(O)===o}function F(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function I(O){return k(O)===u}function q(O){return k(O)===r}function U(O){return k(O)===f}function z(O){return k(O)===h}function H(O){return k(O)===t}function X(O){return k(O)===i}function W(O){return k(O)===s}function ae(O){return k(O)===d}ee.AsyncMode=_,ee.ConcurrentMode=S,ee.ContextConsumer=P,ee.ContextProvider=T,ee.Element=A,ee.ForwardRef=D,ee.Fragment=E,ee.Lazy=j,ee.Memo=Z,ee.Portal=se,ee.Profiler=Re,ee.StrictMode=G,ee.Suspense=ve,ee.isAsyncMode=qe,ee.isConcurrentMode=C,ee.isContextConsumer=R,ee.isContextProvider=$,ee.isElement=F,ee.isForwardRef=I,ee.isFragment=q,ee.isLazy=U,ee.isMemo=z,ee.isPortal=H,ee.isProfiler=X,ee.isStrictMode=W,ee.isSuspense=ae,ee.isValidElementType=w,ee.typeOf=k}()),ee}var qa;function Ba(){return qa||(qa=1,me.env.NODE_ENV==="production"?rr.exports=Wh():rr.exports=Vh()),rr.exports}/*
103
103
  object-assign
104
104
  (c) Sindre Sorhus
105
105
  @license MIT
106
- */var Ps,Wa;function Xh(){if(Wa)return Ps;Wa=1;var n=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function s(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var o={},a=0;a<10;a++)o["_"+String.fromCharCode(a)]=a;var l=Object.getOwnPropertyNames(o).map(function(u){return o[u]});if(l.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(u){c[u]=u}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ps=s()?Object.assign:function(i,o){for(var a,l=r(i),c,u=1;u<arguments.length;u++){a=Object(arguments[u]);for(var d in a)e.call(a,d)&&(l[d]=a[d]);if(n){c=n(a);for(var g=0;g<c.length;g++)t.call(a,c[g])&&(l[c[g]]=a[c[g]])}}return l},Ps}var Ds,Va;function Is(){if(Va)return Ds;Va=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ds=n,Ds}var $s,Ya;function Xa(){return Ya||(Ya=1,$s=Function.call.bind(Object.prototype.hasOwnProperty)),$s}var Ns,Ja;function Jh(){if(Ja)return Ns;Ja=1;var n=function(){};if(be.env.NODE_ENV!=="production"){var e=Is(),t={},r=Xa();n=function(i){var o="Warning: "+i;typeof console<"u"&&console.error(o);try{throw new Error(o)}catch{}}}function s(i,o,a,l,c){if(be.env.NODE_ENV!=="production"){for(var u in i)if(r(i,u)){var d;try{if(typeof i[u]!="function"){var g=Error((l||"React class")+": "+a+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}d=i[u](o,u,l,a,null,e)}catch(f){d=f}if(d&&!(d instanceof Error)&&n((l||"React class")+": type specification of "+a+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in t)){t[d.message]=!0;var h=c?c():"";n("Failed "+a+" type: "+d.message+(h??""))}}}}return s.resetWarningCache=function(){be.env.NODE_ENV!=="production"&&(t={})},Ns=s,Ns}var Ms,Za;function Zh(){if(Za)return Ms;Za=1;var n=Ha(),e=Xh(),t=Is(),r=Xa(),s=Jh(),i=function(){};be.env.NODE_ENV!=="production"&&(i=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function o(){return null}return Ms=function(a,l){var c=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function d(C){var R=C&&(c&&C[c]||C[u]);if(typeof R=="function")return R}var g="<<anonymous>>",h={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:x(),arrayOf:w,element:k(),elementType:_(),instanceOf:S,node:D(),objectOf:T,oneOf:P,oneOfType:A,shape:j,exact:Z};function f(C,R){return C===R?C!==0||1/C===1/R:C!==C&&R!==R}function m(C,R){this.message=C,this.data=R&&typeof R=="object"?R:{},this.stack=""}m.prototype=Error.prototype;function b(C){if(be.env.NODE_ENV!=="production")var R={},$=0;function F(q,U,z,H,X,W,le){if(H=H||g,W=W||z,le!==t){if(l){var O=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw O.name="Invariant Violation",O}else if(be.env.NODE_ENV!=="production"&&typeof console<"u"){var Ne=H+":"+z;!R[Ne]&&$<3&&(i("You are manually calling a React.PropTypes validation function for the `"+W+"` prop on `"+H+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),R[Ne]=!0,$++)}}return U[z]==null?q?U[z]===null?new m("The "+X+" `"+W+"` is marked as required "+("in `"+H+"`, but its value is `null`.")):new m("The "+X+" `"+W+"` is marked as required in "+("`"+H+"`, but its value is `undefined`.")):null:C(U,z,H,X,W)}var I=F.bind(null,!1);return I.isRequired=F.bind(null,!0),I}function v(C){function R($,F,I,q,U,z){var H=$[F],X=G(H);if(X!==C){var W=ye(H);return new m("Invalid "+q+" `"+U+"` of type "+("`"+W+"` supplied to `"+I+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return b(R)}function x(){return b(o)}function w(C){function R($,F,I,q,U){if(typeof C!="function")return new m("Property `"+U+"` of component `"+I+"` has invalid PropType notation inside arrayOf.");var z=$[F];if(!Array.isArray(z)){var H=G(z);return new m("Invalid "+q+" `"+U+"` of type "+("`"+H+"` supplied to `"+I+"`, expected an array."))}for(var X=0;X<z.length;X++){var W=C(z,X,I,q,U+"["+X+"]",t);if(W instanceof Error)return W}return null}return b(R)}function k(){function C(R,$,F,I,q){var U=R[$];if(!a(U)){var z=G(U);return new m("Invalid "+I+" `"+q+"` of type "+("`"+z+"` supplied to `"+F+"`, expected a single ReactElement."))}return null}return b(C)}function _(){function C(R,$,F,I,q){var U=R[$];if(!n.isValidElementType(U)){var z=G(U);return new m("Invalid "+I+" `"+q+"` of type "+("`"+z+"` supplied to `"+F+"`, expected a single ReactElement type."))}return null}return b(C)}function S(C){function R($,F,I,q,U){if(!($[F]instanceof C)){var z=C.name||g,H=Be($[F]);return new m("Invalid "+q+" `"+U+"` of type "+("`"+H+"` supplied to `"+I+"`, expected ")+("instance of `"+z+"`."))}return null}return b(R)}function P(C){if(!Array.isArray(C))return be.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),o;function R($,F,I,q,U){for(var z=$[F],H=0;H<C.length;H++)if(f(z,C[H]))return null;var X=JSON.stringify(C,function(le,O){var Ne=ye(O);return Ne==="symbol"?String(O):O});return new m("Invalid "+q+" `"+U+"` of value `"+String(z)+"` "+("supplied to `"+I+"`, expected one of "+X+"."))}return b(R)}function T(C){function R($,F,I,q,U){if(typeof C!="function")return new m("Property `"+U+"` of component `"+I+"` has invalid PropType notation inside objectOf.");var z=$[F],H=G(z);if(H!=="object")return new m("Invalid "+q+" `"+U+"` of type "+("`"+H+"` supplied to `"+I+"`, expected an object."));for(var X in z)if(r(z,X)){var W=C(z,X,I,q,U+"."+X,t);if(W instanceof Error)return W}return null}return b(R)}function A(C){if(!Array.isArray(C))return be.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),o;for(var R=0;R<C.length;R++){var $=C[R];if(typeof $!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+he($)+" at index "+R+"."),o}function F(I,q,U,z,H){for(var X=[],W=0;W<C.length;W++){var le=C[W],O=le(I,q,U,z,H,t);if(O==null)return null;O.data&&r(O.data,"expectedType")&&X.push(O.data.expectedType)}var Ne=X.length>0?", expected one of type ["+X.join(", ")+"]":"";return new m("Invalid "+z+" `"+H+"` supplied to "+("`"+U+"`"+Ne+"."))}return b(F)}function D(){function C(R,$,F,I,q){return se(R[$])?null:new m("Invalid "+I+" `"+q+"` supplied to "+("`"+F+"`, expected a ReactNode."))}return b(C)}function E(C,R,$,F,I){return new m((C||"React class")+": "+R+" type `"+$+"."+F+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+I+"`.")}function j(C){function R($,F,I,q,U){var z=$[F],H=G(z);if(H!=="object")return new m("Invalid "+q+" `"+U+"` of type `"+H+"` "+("supplied to `"+I+"`, expected `object`."));for(var X in C){var W=C[X];if(typeof W!="function")return E(I,q,U,X,ye(W));var le=W(z,X,I,q,U+"."+X,t);if(le)return le}return null}return b(R)}function Z(C){function R($,F,I,q,U){var z=$[F],H=G(z);if(H!=="object")return new m("Invalid "+q+" `"+U+"` of type `"+H+"` "+("supplied to `"+I+"`, expected `object`."));var X=e({},$[F],C);for(var W in X){var le=C[W];if(r(C,W)&&typeof le!="function")return E(I,q,U,W,ye(le));if(!le)return new m("Invalid "+q+" `"+U+"` key `"+W+"` supplied to `"+I+"`.\nBad object: "+JSON.stringify($[F],null," ")+`
107
- Valid keys: `+JSON.stringify(Object.keys(C),null," "));var O=le(z,W,I,q,U+"."+W,t);if(O)return O}return null}return b(R)}function se(C){switch(typeof C){case"number":case"string":case"undefined":return!0;case"boolean":return!C;case"object":if(Array.isArray(C))return C.every(se);if(C===null||a(C))return!0;var R=d(C);if(R){var $=R.call(C),F;if(R!==C.entries){for(;!(F=$.next()).done;)if(!se(F.value))return!1}else for(;!(F=$.next()).done;){var I=F.value;if(I&&!se(I[1]))return!1}}else return!1;return!0;default:return!1}}function Oe(C,R){return C==="symbol"?!0:R?R["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&R instanceof Symbol:!1}function G(C){var R=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":Oe(R,C)?"symbol":R}function ye(C){if(typeof C>"u"||C===null)return""+C;var R=G(C);if(R==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return R}function he(C){var R=ye(C);switch(R){case"array":case"object":return"an "+R;case"boolean":case"date":case"regexp":return"a "+R;default:return R}}function Be(C){return!C.constructor||!C.constructor.name?g:C.constructor.name}return h.checkPropTypes=s,h.resetWarningCache=s.resetWarningCache,h.PropTypes=h,h},Ms}var Fs,Ga;function Gh(){if(Ga)return Fs;Ga=1;var n=Is();function e(){}function t(){}return t.resetWarningCache=e,Fs=function(){function r(o,a,l,c,u,d){if(d!==n){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}r.isRequired=r;function s(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:s,element:r,elementType:r,instanceOf:s,node:r,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:t,resetWarningCache:e};return i.PropTypes=i,i},Fs}if(be.env.NODE_ENV!=="production"){var Kh=Ha(),Qh=!0;Os.exports=Zh()(Kh.isElement,Qh)}else Os.exports=Gh()();var Ka=Os.exports,Ls={exports:{}};function Qa(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var s=n.length;for(e=0;e<s;e++)n[e]&&(t=Qa(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function el(){for(var n,e,t=0,r="",s=arguments.length;t<s;t++)(n=arguments[t])&&(e=Qa(n))&&(r&&(r+=" "),r+=e);return r}Ls.exports=el,Ls.exports.clsx=el;var ef=Ls.exports,de={},it={};Object.defineProperty(it,"__esModule",{value:!0}),it.dontSetMe=of,it.findInArray=tf,it.int=sf,it.isFunction=nf,it.isNum=rf;function tf(n,e){for(let t=0,r=n.length;t<r;t++)if(e.apply(e,[n[t],t,n]))return n[t]}function nf(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Function]"}function rf(n){return typeof n=="number"&&!isNaN(n)}function sf(n){return parseInt(n,10)}function of(n,e,t){if(n[e])return new Error(`Invalid prop ${e} passed to ${t} - do not set this, set it on the child.`)}var Lt={};Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.browserPrefixToKey=nl,Lt.browserPrefixToStyle=af,Lt.default=void 0,Lt.getPrefix=tl;const js=["Moz","Webkit","O","ms"];function tl(){var t,r;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const e=(r=(t=window.document)==null?void 0:t.documentElement)==null?void 0:r.style;if(!e||n in e)return"";for(let s=0;s<js.length;s++)if(nl(n,js[s])in e)return js[s];return""}function nl(n,e){return e?`${e}${lf(n)}`:n}function af(n,e){return e?`-${e.toLowerCase()}-${n}`:n}function lf(n){let e="",t=!0;for(let r=0;r<n.length;r++)t?(e+=n[r].toUpperCase(),t=!1):n[r]==="-"?t=!0:e+=n[r];return e}Lt.default=tl(),Object.defineProperty(de,"__esModule",{value:!0}),de.addClassName=al,de.addEvent=uf,de.addUserSelectStyles=xf,de.createCSSTransform=bf,de.createSVGTransform=_f,de.getTouch=vf,de.getTouchIdentifier=yf,de.getTranslation=Us,de.innerHeight=pf,de.innerWidth=gf,de.matchesSelector=il,de.matchesSelectorAndParentsTo=cf,de.offsetXYFromParent=mf,de.outerHeight=hf,de.outerWidth=ff,de.removeClassName=ll,de.removeEvent=df,de.scheduleRemoveUserSelectStyles=wf;var je=it,rl=sl(Lt);function sl(n,e){if(typeof WeakMap=="function")var t=new WeakMap,r=new WeakMap;return(sl=function(s,i){if(!i&&s&&s.__esModule)return s;var o,a,l={__proto__:null,default:s};if(s===null||typeof s!="object"&&typeof s!="function")return l;if(o=i?r:t){if(o.has(s))return o.get(s);o.set(s,l)}for(const c in s)c!=="default"&&{}.hasOwnProperty.call(s,c)&&((a=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(s,c))&&(a.get||a.set)?o(l,c,a):l[c]=s[c]);return l})(n,e)}let ir="";function il(n,e){return ir||(ir=(0,je.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(t){return(0,je.isFunction)(n[t])})),(0,je.isFunction)(n[ir])?n[ir](e):!1}function cf(n,e,t){let r=n;do{if(il(r,e))return!0;if(r===t)return!1;r=r.parentNode}while(r);return!1}function uf(n,e,t,r){if(!n)return;const s={capture:!0,...r};n.addEventListener?n.addEventListener(e,t,s):n.attachEvent?n.attachEvent("on"+e,t):n["on"+e]=t}function df(n,e,t,r){if(!n)return;const s={capture:!0,...r};n.removeEventListener?n.removeEventListener(e,t,s):n.detachEvent?n.detachEvent("on"+e,t):n["on"+e]=null}function hf(n){let e=n.clientHeight;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e+=(0,je.int)(t.borderTopWidth),e+=(0,je.int)(t.borderBottomWidth),e}function ff(n){let e=n.clientWidth;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e+=(0,je.int)(t.borderLeftWidth),e+=(0,je.int)(t.borderRightWidth),e}function pf(n){let e=n.clientHeight;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e-=(0,je.int)(t.paddingTop),e-=(0,je.int)(t.paddingBottom),e}function gf(n){let e=n.clientWidth;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e-=(0,je.int)(t.paddingLeft),e-=(0,je.int)(t.paddingRight),e}function mf(n,e,t){const s=e===e.ownerDocument.body?{left:0,top:0}:e.getBoundingClientRect(),i=(n.clientX+e.scrollLeft-s.left)/t,o=(n.clientY+e.scrollTop-s.top)/t;return{x:i,y:o}}function bf(n,e){const t=Us(n,e,"px");return{[(0,rl.browserPrefixToKey)("transform",rl.default)]:t}}function _f(n,e){return Us(n,e,"")}function Us(n,e,t){let{x:r,y:s}=n,i=`translate(${r}${t},${s}${t})`;if(e){const o=`${typeof e.x=="string"?e.x:e.x+t}`,a=`${typeof e.y=="string"?e.y:e.y+t}`;i=`translate(${o}, ${a})`+i}return i}function vf(n,e){return n.targetTouches&&(0,je.findInArray)(n.targetTouches,t=>e===t.identifier)||n.changedTouches&&(0,je.findInArray)(n.changedTouches,t=>e===t.identifier)}function yf(n){if(n.targetTouches&&n.targetTouches[0])return n.targetTouches[0].identifier;if(n.changedTouches&&n.changedTouches[0])return n.changedTouches[0].identifier}function xf(n){if(!n)return;let e=n.getElementById("react-draggable-style-el");e||(e=n.createElement("style"),e.type="text/css",e.id="react-draggable-style-el",e.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
106
+ */var Os,Ha;function Yh(){if(Ha)return Os;Ha=1;var n=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function s(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var o={},a=0;a<10;a++)o["_"+String.fromCharCode(a)]=a;var l=Object.getOwnPropertyNames(o).map(function(u){return o[u]});if(l.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(u){c[u]=u}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Os=s()?Object.assign:function(i,o){for(var a,l=r(i),c,u=1;u<arguments.length;u++){a=Object(arguments[u]);for(var d in a)e.call(a,d)&&(l[d]=a[d]);if(n){c=n(a);for(var g=0;g<c.length;g++)t.call(a,c[g])&&(l[c[g]]=a[c[g]])}}return l},Os}var Ps,Wa;function Ds(){if(Wa)return Ps;Wa=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ps=n,Ps}var Is,Va;function Ya(){return Va||(Va=1,Is=Function.call.bind(Object.prototype.hasOwnProperty)),Is}var $s,Xa;function Xh(){if(Xa)return $s;Xa=1;var n=function(){};if(me.env.NODE_ENV!=="production"){var e=Ds(),t={},r=Ya();n=function(i){var o="Warning: "+i;typeof console<"u"&&console.error(o);try{throw new Error(o)}catch{}}}function s(i,o,a,l,c){if(me.env.NODE_ENV!=="production"){for(var u in i)if(r(i,u)){var d;try{if(typeof i[u]!="function"){var g=Error((l||"React class")+": "+a+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}d=i[u](o,u,l,a,null,e)}catch(f){d=f}if(d&&!(d instanceof Error)&&n((l||"React class")+": type specification of "+a+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in t)){t[d.message]=!0;var h=c?c():"";n("Failed "+a+" type: "+d.message+(h??""))}}}}return s.resetWarningCache=function(){me.env.NODE_ENV!=="production"&&(t={})},$s=s,$s}var Ns,Ja;function Jh(){if(Ja)return Ns;Ja=1;var n=Ba(),e=Yh(),t=Ds(),r=Ya(),s=Xh(),i=function(){};me.env.NODE_ENV!=="production"&&(i=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function o(){return null}return Ns=function(a,l){var c=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function d(C){var R=C&&(c&&C[c]||C[u]);if(typeof R=="function")return R}var g="<<anonymous>>",h={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:x(),arrayOf:w,element:k(),elementType:_(),instanceOf:S,node:D(),objectOf:T,oneOf:P,oneOfType:A,shape:j,exact:Z};function f(C,R){return C===R?C!==0||1/C===1/R:C!==C&&R!==R}function m(C,R){this.message=C,this.data=R&&typeof R=="object"?R:{},this.stack=""}m.prototype=Error.prototype;function b(C){if(me.env.NODE_ENV!=="production")var R={},$=0;function F(q,U,z,H,X,W,ae){if(H=H||g,W=W||z,ae!==t){if(l){var O=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw O.name="Invariant Violation",O}else if(me.env.NODE_ENV!=="production"&&typeof console<"u"){var $e=H+":"+z;!R[$e]&&$<3&&(i("You are manually calling a React.PropTypes validation function for the `"+W+"` prop on `"+H+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),R[$e]=!0,$++)}}return U[z]==null?q?U[z]===null?new m("The "+X+" `"+W+"` is marked as required "+("in `"+H+"`, but its value is `null`.")):new m("The "+X+" `"+W+"` is marked as required in "+("`"+H+"`, but its value is `undefined`.")):null:C(U,z,H,X,W)}var I=F.bind(null,!1);return I.isRequired=F.bind(null,!0),I}function v(C){function R($,F,I,q,U,z){var H=$[F],X=G(H);if(X!==C){var W=ve(H);return new m("Invalid "+q+" `"+U+"` of type "+("`"+W+"` supplied to `"+I+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return b(R)}function x(){return b(o)}function w(C){function R($,F,I,q,U){if(typeof C!="function")return new m("Property `"+U+"` of component `"+I+"` has invalid PropType notation inside arrayOf.");var z=$[F];if(!Array.isArray(z)){var H=G(z);return new m("Invalid "+q+" `"+U+"` of type "+("`"+H+"` supplied to `"+I+"`, expected an array."))}for(var X=0;X<z.length;X++){var W=C(z,X,I,q,U+"["+X+"]",t);if(W instanceof Error)return W}return null}return b(R)}function k(){function C(R,$,F,I,q){var U=R[$];if(!a(U)){var z=G(U);return new m("Invalid "+I+" `"+q+"` of type "+("`"+z+"` supplied to `"+F+"`, expected a single ReactElement."))}return null}return b(C)}function _(){function C(R,$,F,I,q){var U=R[$];if(!n.isValidElementType(U)){var z=G(U);return new m("Invalid "+I+" `"+q+"` of type "+("`"+z+"` supplied to `"+F+"`, expected a single ReactElement type."))}return null}return b(C)}function S(C){function R($,F,I,q,U){if(!($[F]instanceof C)){var z=C.name||g,H=qe($[F]);return new m("Invalid "+q+" `"+U+"` of type "+("`"+H+"` supplied to `"+I+"`, expected ")+("instance of `"+z+"`."))}return null}return b(R)}function P(C){if(!Array.isArray(C))return me.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),o;function R($,F,I,q,U){for(var z=$[F],H=0;H<C.length;H++)if(f(z,C[H]))return null;var X=JSON.stringify(C,function(ae,O){var $e=ve(O);return $e==="symbol"?String(O):O});return new m("Invalid "+q+" `"+U+"` of value `"+String(z)+"` "+("supplied to `"+I+"`, expected one of "+X+"."))}return b(R)}function T(C){function R($,F,I,q,U){if(typeof C!="function")return new m("Property `"+U+"` of component `"+I+"` has invalid PropType notation inside objectOf.");var z=$[F],H=G(z);if(H!=="object")return new m("Invalid "+q+" `"+U+"` of type "+("`"+H+"` supplied to `"+I+"`, expected an object."));for(var X in z)if(r(z,X)){var W=C(z,X,I,q,U+"."+X,t);if(W instanceof Error)return W}return null}return b(R)}function A(C){if(!Array.isArray(C))return me.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),o;for(var R=0;R<C.length;R++){var $=C[R];if(typeof $!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+de($)+" at index "+R+"."),o}function F(I,q,U,z,H){for(var X=[],W=0;W<C.length;W++){var ae=C[W],O=ae(I,q,U,z,H,t);if(O==null)return null;O.data&&r(O.data,"expectedType")&&X.push(O.data.expectedType)}var $e=X.length>0?", expected one of type ["+X.join(", ")+"]":"";return new m("Invalid "+z+" `"+H+"` supplied to "+("`"+U+"`"+$e+"."))}return b(F)}function D(){function C(R,$,F,I,q){return se(R[$])?null:new m("Invalid "+I+" `"+q+"` supplied to "+("`"+F+"`, expected a ReactNode."))}return b(C)}function E(C,R,$,F,I){return new m((C||"React class")+": "+R+" type `"+$+"."+F+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+I+"`.")}function j(C){function R($,F,I,q,U){var z=$[F],H=G(z);if(H!=="object")return new m("Invalid "+q+" `"+U+"` of type `"+H+"` "+("supplied to `"+I+"`, expected `object`."));for(var X in C){var W=C[X];if(typeof W!="function")return E(I,q,U,X,ve(W));var ae=W(z,X,I,q,U+"."+X,t);if(ae)return ae}return null}return b(R)}function Z(C){function R($,F,I,q,U){var z=$[F],H=G(z);if(H!=="object")return new m("Invalid "+q+" `"+U+"` of type `"+H+"` "+("supplied to `"+I+"`, expected `object`."));var X=e({},$[F],C);for(var W in X){var ae=C[W];if(r(C,W)&&typeof ae!="function")return E(I,q,U,W,ve(ae));if(!ae)return new m("Invalid "+q+" `"+U+"` key `"+W+"` supplied to `"+I+"`.\nBad object: "+JSON.stringify($[F],null," ")+`
107
+ Valid keys: `+JSON.stringify(Object.keys(C),null," "));var O=ae(z,W,I,q,U+"."+W,t);if(O)return O}return null}return b(R)}function se(C){switch(typeof C){case"number":case"string":case"undefined":return!0;case"boolean":return!C;case"object":if(Array.isArray(C))return C.every(se);if(C===null||a(C))return!0;var R=d(C);if(R){var $=R.call(C),F;if(R!==C.entries){for(;!(F=$.next()).done;)if(!se(F.value))return!1}else for(;!(F=$.next()).done;){var I=F.value;if(I&&!se(I[1]))return!1}}else return!1;return!0;default:return!1}}function Re(C,R){return C==="symbol"?!0:R?R["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&R instanceof Symbol:!1}function G(C){var R=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":Re(R,C)?"symbol":R}function ve(C){if(typeof C>"u"||C===null)return""+C;var R=G(C);if(R==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return R}function de(C){var R=ve(C);switch(R){case"array":case"object":return"an "+R;case"boolean":case"date":case"regexp":return"a "+R;default:return R}}function qe(C){return!C.constructor||!C.constructor.name?g:C.constructor.name}return h.checkPropTypes=s,h.resetWarningCache=s.resetWarningCache,h.PropTypes=h,h},Ns}var Ms,Za;function Zh(){if(Za)return Ms;Za=1;var n=Ds();function e(){}function t(){}return t.resetWarningCache=e,Ms=function(){function r(o,a,l,c,u,d){if(d!==n){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}r.isRequired=r;function s(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:s,element:r,elementType:r,instanceOf:s,node:r,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:t,resetWarningCache:e};return i.PropTypes=i,i},Ms}if(me.env.NODE_ENV!=="production"){var Gh=Ba(),Kh=!0;Rs.exports=Jh()(Gh.isElement,Kh)}else Rs.exports=Zh()();var Ga=Rs.exports,Fs={exports:{}};function Ka(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var s=n.length;for(e=0;e<s;e++)n[e]&&(t=Ka(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function Qa(){for(var n,e,t=0,r="",s=arguments.length;t<s;t++)(n=arguments[t])&&(e=Ka(n))&&(r&&(r+=" "),r+=e);return r}Fs.exports=Qa,Fs.exports.clsx=Qa;var Qh=Fs.exports,ue={},st={};Object.defineProperty(st,"__esModule",{value:!0}),st.dontSetMe=sf,st.findInArray=ef,st.int=rf,st.isFunction=tf,st.isNum=nf;function ef(n,e){for(let t=0,r=n.length;t<r;t++)if(e.apply(e,[n[t],t,n]))return n[t]}function tf(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Function]"}function nf(n){return typeof n=="number"&&!isNaN(n)}function rf(n){return parseInt(n,10)}function sf(n,e,t){if(n[e])return new Error(`Invalid prop ${e} passed to ${t} - do not set this, set it on the child.`)}var Ft={};Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.browserPrefixToKey=tl,Ft.browserPrefixToStyle=of,Ft.default=void 0,Ft.getPrefix=el;const Ls=["Moz","Webkit","O","ms"];function el(){var t,r;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const e=(r=(t=window.document)==null?void 0:t.documentElement)==null?void 0:r.style;if(!e||n in e)return"";for(let s=0;s<Ls.length;s++)if(tl(n,Ls[s])in e)return Ls[s];return""}function tl(n,e){return e?`${e}${af(n)}`:n}function of(n,e){return e?`-${e.toLowerCase()}-${n}`:n}function af(n){let e="",t=!0;for(let r=0;r<n.length;r++)t?(e+=n[r].toUpperCase(),t=!1):n[r]==="-"?t=!0:e+=n[r];return e}Ft.default=el(),Object.defineProperty(ue,"__esModule",{value:!0}),ue.addClassName=ol,ue.addEvent=cf,ue.addUserSelectStyles=yf,ue.createCSSTransform=mf,ue.createSVGTransform=bf,ue.getTouch=_f,ue.getTouchIdentifier=vf,ue.getTranslation=js,ue.innerHeight=ff,ue.innerWidth=pf,ue.matchesSelector=sl,ue.matchesSelectorAndParentsTo=lf,ue.offsetXYFromParent=gf,ue.outerHeight=df,ue.outerWidth=hf,ue.removeClassName=al,ue.removeEvent=uf,ue.scheduleRemoveUserSelectStyles=xf;var Le=st,nl=rl(Ft);function rl(n,e){if(typeof WeakMap=="function")var t=new WeakMap,r=new WeakMap;return(rl=function(s,i){if(!i&&s&&s.__esModule)return s;var o,a,l={__proto__:null,default:s};if(s===null||typeof s!="object"&&typeof s!="function")return l;if(o=i?r:t){if(o.has(s))return o.get(s);o.set(s,l)}for(const c in s)c!=="default"&&{}.hasOwnProperty.call(s,c)&&((a=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(s,c))&&(a.get||a.set)?o(l,c,a):l[c]=s[c]);return l})(n,e)}let sr="";function sl(n,e){return sr||(sr=(0,Le.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(t){return(0,Le.isFunction)(n[t])})),(0,Le.isFunction)(n[sr])?n[sr](e):!1}function lf(n,e,t){let r=n;do{if(sl(r,e))return!0;if(r===t)return!1;r=r.parentNode}while(r);return!1}function cf(n,e,t,r){if(!n)return;const s={capture:!0,...r};n.addEventListener?n.addEventListener(e,t,s):n.attachEvent?n.attachEvent("on"+e,t):n["on"+e]=t}function uf(n,e,t,r){if(!n)return;const s={capture:!0,...r};n.removeEventListener?n.removeEventListener(e,t,s):n.detachEvent?n.detachEvent("on"+e,t):n["on"+e]=null}function df(n){let e=n.clientHeight;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e+=(0,Le.int)(t.borderTopWidth),e+=(0,Le.int)(t.borderBottomWidth),e}function hf(n){let e=n.clientWidth;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e+=(0,Le.int)(t.borderLeftWidth),e+=(0,Le.int)(t.borderRightWidth),e}function ff(n){let e=n.clientHeight;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e-=(0,Le.int)(t.paddingTop),e-=(0,Le.int)(t.paddingBottom),e}function pf(n){let e=n.clientWidth;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e-=(0,Le.int)(t.paddingLeft),e-=(0,Le.int)(t.paddingRight),e}function gf(n,e,t){const s=e===e.ownerDocument.body?{left:0,top:0}:e.getBoundingClientRect(),i=(n.clientX+e.scrollLeft-s.left)/t,o=(n.clientY+e.scrollTop-s.top)/t;return{x:i,y:o}}function mf(n,e){const t=js(n,e,"px");return{[(0,nl.browserPrefixToKey)("transform",nl.default)]:t}}function bf(n,e){return js(n,e,"")}function js(n,e,t){let{x:r,y:s}=n,i=`translate(${r}${t},${s}${t})`;if(e){const o=`${typeof e.x=="string"?e.x:e.x+t}`,a=`${typeof e.y=="string"?e.y:e.y+t}`;i=`translate(${o}, ${a})`+i}return i}function _f(n,e){return n.targetTouches&&(0,Le.findInArray)(n.targetTouches,t=>e===t.identifier)||n.changedTouches&&(0,Le.findInArray)(n.changedTouches,t=>e===t.identifier)}function vf(n){if(n.targetTouches&&n.targetTouches[0])return n.targetTouches[0].identifier;if(n.changedTouches&&n.changedTouches[0])return n.changedTouches[0].identifier}function yf(n){if(!n)return;let e=n.getElementById("react-draggable-style-el");e||(e=n.createElement("style"),e.type="text/css",e.id="react-draggable-style-el",e.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
108
108
  `,e.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
109
- `,n.getElementsByTagName("head")[0].appendChild(e)),n.body&&al(n.body,"react-draggable-transparent-selection")}function wf(n){window.requestAnimationFrame?window.requestAnimationFrame(()=>{ol(n)}):ol(n)}function ol(n){if(n)try{if(n.body&&ll(n.body,"react-draggable-transparent-selection"),n.selection)n.selection.empty();else{const e=(n.defaultView||window).getSelection();e&&e.type!=="Caret"&&e.removeAllRanges()}}catch{}}function al(n,e){n.classList?n.classList.add(e):n.className.match(new RegExp(`(?:^|\\s)${e}(?!\\S)`))||(n.className+=` ${e}`)}function ll(n,e){n.classList?n.classList.remove(e):n.className=n.className.replace(new RegExp(`(?:^|\\s)${e}(?!\\S)`,"g"),"")}var ot={};Object.defineProperty(ot,"__esModule",{value:!0}),ot.canDragX=Sf,ot.canDragY=Cf,ot.createCoreData=Af,ot.createDraggableData=Rf,ot.getBoundPosition=kf,ot.getControlPosition=Ef,ot.snapToGrid=Tf;var Ue=it,Kt=de;function kf(n,e,t){if(!n.props.bounds)return[e,t];let{bounds:r}=n.props;r=typeof r=="string"?r:Of(r);const s=zs(n);if(typeof r=="string"){const{ownerDocument:i}=s,o=i.defaultView;let a;if(r==="parent"?a=s.parentNode:a=s.getRootNode().querySelector(r),!(a instanceof o.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const l=a,c=o.getComputedStyle(s),u=o.getComputedStyle(l);r={left:-s.offsetLeft+(0,Ue.int)(u.paddingLeft)+(0,Ue.int)(c.marginLeft),top:-s.offsetTop+(0,Ue.int)(u.paddingTop)+(0,Ue.int)(c.marginTop),right:(0,Kt.innerWidth)(l)-(0,Kt.outerWidth)(s)-s.offsetLeft+(0,Ue.int)(u.paddingRight)-(0,Ue.int)(c.marginRight),bottom:(0,Kt.innerHeight)(l)-(0,Kt.outerHeight)(s)-s.offsetTop+(0,Ue.int)(u.paddingBottom)-(0,Ue.int)(c.marginBottom)}}return(0,Ue.isNum)(r.right)&&(e=Math.min(e,r.right)),(0,Ue.isNum)(r.bottom)&&(t=Math.min(t,r.bottom)),(0,Ue.isNum)(r.left)&&(e=Math.max(e,r.left)),(0,Ue.isNum)(r.top)&&(t=Math.max(t,r.top)),[e,t]}function Tf(n,e,t){const r=Math.round(e/n[0])*n[0],s=Math.round(t/n[1])*n[1];return[r,s]}function Sf(n){return n.props.axis==="both"||n.props.axis==="x"}function Cf(n){return n.props.axis==="both"||n.props.axis==="y"}function Ef(n,e,t){const r=typeof e=="number"?(0,Kt.getTouch)(n,e):null;if(typeof e=="number"&&!r)return null;const s=zs(t),i=t.props.offsetParent||s.offsetParent||s.ownerDocument.body;return(0,Kt.offsetXYFromParent)(r||n,i,t.props.scale)}function Af(n,e,t){const r=!(0,Ue.isNum)(n.lastX),s=zs(n);return r?{node:s,deltaX:0,deltaY:0,lastX:e,lastY:t,x:e,y:t}:{node:s,deltaX:e-n.lastX,deltaY:t-n.lastY,lastX:n.lastX,lastY:n.lastY,x:e,y:t}}function Rf(n,e){const t=n.props.scale;return{node:e.node,x:n.state.x+e.deltaX/t,y:n.state.y+e.deltaY/t,deltaX:e.deltaX/t,deltaY:e.deltaY/t,lastX:n.state.x,lastY:n.state.y}}function Of(n){return{left:n.left,top:n.top,right:n.right,bottom:n.bottom}}function zs(n){const e=n.findDOMNode();if(!e)throw new Error("<DraggableCore>: Unmounted during event!");return e}var or={},ar={};Object.defineProperty(ar,"__esModule",{value:!0}),ar.default=Pf;function Pf(){}Object.defineProperty(or,"__esModule",{value:!0}),or.default=void 0;var qs=cl(rr),Ee=Hs(Ka),Df=Hs(rr),we=de,wt=ot,Bs=it,_n=Hs(ar);function Hs(n){return n&&n.__esModule?n:{default:n}}function cl(n,e){if(typeof WeakMap=="function")var t=new WeakMap,r=new WeakMap;return(cl=function(s,i){if(!i&&s&&s.__esModule)return s;var o,a,l={__proto__:null,default:s};if(s===null||typeof s!="object"&&typeof s!="function")return l;if(o=i?r:t){if(o.has(s))return o.get(s);o.set(s,l)}for(const c in s)c!=="default"&&{}.hasOwnProperty.call(s,c)&&((a=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(s,c))&&(a.get||a.set)?o(l,c,a):l[c]=s[c]);return l})(n,e)}function Ae(n,e,t){return(e=If(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function If(n){var e=$f(n,"string");return typeof e=="symbol"?e:e+""}function $f(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}const Ze={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let kt=Ze.mouse,lr=class extends qs.Component{constructor(){super(...arguments),Ae(this,"dragging",!1),Ae(this,"lastX",NaN),Ae(this,"lastY",NaN),Ae(this,"touchIdentifier",null),Ae(this,"mounted",!1),Ae(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button=="number"&&e.button!==0)return!1;const t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=t;if(this.props.disabled||!(e.target instanceof r.defaultView.Node)||this.props.handle&&!(0,we.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,we.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;e.type==="touchstart"&&!this.props.allowMobileScroll&&e.preventDefault();const s=(0,we.getTouchIdentifier)(e);this.touchIdentifier=s;const i=(0,wt.getControlPosition)(e,s,this);if(i==null)return;const{x:o,y:a}=i,l=(0,wt.createCoreData)(this,o,a);(0,_n.default)("DraggableCore: handleDragStart: %j",l),(0,_n.default)("calling",this.props.onStart),!(this.props.onStart(e,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,we.addUserSelectStyles)(r),this.dragging=!0,this.lastX=o,this.lastY=a,(0,we.addEvent)(r,kt.move,this.handleDrag),(0,we.addEvent)(r,kt.stop,this.handleDragStop))}),Ae(this,"handleDrag",e=>{const t=(0,wt.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:r,y:s}=t;if(Array.isArray(this.props.grid)){let a=r-this.lastX,l=s-this.lastY;if([a,l]=(0,wt.snapToGrid)(this.props.grid,a,l),!a&&!l)return;r=this.lastX+a,s=this.lastY+l}const i=(0,wt.createCoreData)(this,r,s);if((0,_n.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=r,this.lastY=s}),Ae(this,"handleDragStop",e=>{if(!this.dragging)return;const t=(0,wt.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:r,y:s}=t;if(Array.isArray(this.props.grid)){let l=r-this.lastX||0,c=s-this.lastY||0;[l,c]=(0,wt.snapToGrid)(this.props.grid,l,c),r=this.lastX+l,s=this.lastY+c}const i=(0,wt.createCoreData)(this,r,s);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;const a=this.findDOMNode();a&&this.props.enableUserSelectHack&&(0,we.scheduleRemoveUserSelectStyles)(a.ownerDocument),(0,_n.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&((0,_n.default)("DraggableCore: Removing handlers"),(0,we.removeEvent)(a.ownerDocument,kt.move,this.handleDrag),(0,we.removeEvent)(a.ownerDocument,kt.stop,this.handleDragStop))}),Ae(this,"onMouseDown",e=>(kt=Ze.mouse,this.handleDragStart(e))),Ae(this,"onMouseUp",e=>(kt=Ze.mouse,this.handleDragStop(e))),Ae(this,"onTouchStart",e=>(kt=Ze.touch,this.handleDragStart(e))),Ae(this,"onTouchEnd",e=>(kt=Ze.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,we.addEvent)(e,Ze.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;(0,we.removeEvent)(t,Ze.mouse.move,this.handleDrag),(0,we.removeEvent)(t,Ze.touch.move,this.handleDrag),(0,we.removeEvent)(t,Ze.mouse.stop,this.handleDragStop),(0,we.removeEvent)(t,Ze.touch.stop,this.handleDragStop),(0,we.removeEvent)(e,Ze.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,we.scheduleRemoveUserSelectStyles)(t)}}findDOMNode(){var e,t,r;return(e=this.props)!=null&&e.nodeRef?(r=(t=this.props)==null?void 0:t.nodeRef)==null?void 0:r.current:Df.default.findDOMNode(this)}render(){return qs.cloneElement(qs.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};or.default=lr,Ae(lr,"displayName","DraggableCore"),Ae(lr,"propTypes",{allowAnyClick:Ee.default.bool,allowMobileScroll:Ee.default.bool,children:Ee.default.node.isRequired,disabled:Ee.default.bool,enableUserSelectHack:Ee.default.bool,offsetParent:function(n,e){if(n[e]&&n[e].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Ee.default.arrayOf(Ee.default.number),handle:Ee.default.string,cancel:Ee.default.string,nodeRef:Ee.default.object,onStart:Ee.default.func,onDrag:Ee.default.func,onStop:Ee.default.func,onMouseDown:Ee.default.func,scale:Ee.default.number,className:Bs.dontSetMe,style:Bs.dontSetMe,transform:Bs.dontSetMe}),Ae(lr,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),function(n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),n.default=void 0;var e=d(rr),t=u(Ka),r=u(rr),s=ef,i=de,o=ot,a=it,l=u(or),c=u(ar);function u(v){return v&&v.__esModule?v:{default:v}}function d(v,x){if(typeof WeakMap=="function")var w=new WeakMap,k=new WeakMap;return(d=function(_,S){if(!S&&_&&_.__esModule)return _;var P,T,A={__proto__:null,default:_};if(_===null||typeof _!="object"&&typeof _!="function")return A;if(P=S?k:w){if(P.has(_))return P.get(_);P.set(_,A)}for(const D in _)D!=="default"&&{}.hasOwnProperty.call(_,D)&&((T=(P=Object.defineProperty)&&Object.getOwnPropertyDescriptor(_,D))&&(T.get||T.set)?P(A,D,T):A[D]=_[D]);return A})(v,x)}function g(){return g=Object.assign?Object.assign.bind():function(v){for(var x=1;x<arguments.length;x++){var w=arguments[x];for(var k in w)({}).hasOwnProperty.call(w,k)&&(v[k]=w[k])}return v},g.apply(null,arguments)}function h(v,x,w){return(x=f(x))in v?Object.defineProperty(v,x,{value:w,enumerable:!0,configurable:!0,writable:!0}):v[x]=w,v}function f(v){var x=m(v,"string");return typeof x=="symbol"?x:x+""}function m(v,x){if(typeof v!="object"||!v)return v;var w=v[Symbol.toPrimitive];if(w!==void 0){var k=w.call(v,x);if(typeof k!="object")return k;throw new TypeError("@@toPrimitive must return a primitive value.")}return(x==="string"?String:Number)(v)}class b extends e.Component{static getDerivedStateFromProps(x,w){let{position:k}=x,{prevPropsPosition:_}=w;return k&&(!_||k.x!==_.x||k.y!==_.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:k,prevPropsPosition:_}),{x:k.x,y:k.y,prevPropsPosition:{...k}}):null}constructor(x){super(x),h(this,"onDragStart",(w,k)=>{if((0,c.default)("Draggable: onDragStart: %j",k),this.props.onStart(w,(0,o.createDraggableData)(this,k))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),h(this,"onDrag",(w,k)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",k);const _=(0,o.createDraggableData)(this,k),S={x:_.x,y:_.y,slackX:0,slackY:0};if(this.props.bounds){const{x:T,y:A}=S;S.x+=this.state.slackX,S.y+=this.state.slackY;const[D,E]=(0,o.getBoundPosition)(this,S.x,S.y);S.x=D,S.y=E,S.slackX=this.state.slackX+(T-S.x),S.slackY=this.state.slackY+(A-S.y),_.x=S.x,_.y=S.y,_.deltaX=S.x-this.state.x,_.deltaY=S.y-this.state.y}if(this.props.onDrag(w,_)===!1)return!1;this.setState(S)}),h(this,"onDragStop",(w,k)=>{if(!this.state.dragging||this.props.onStop(w,(0,o.createDraggableData)(this,k))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",k);const S={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:T,y:A}=this.props.position;S.x=T,S.y=A}this.setState(S)}),this.state={dragging:!1,dragged:!1,x:x.position?x.position.x:x.defaultPosition.x,y:x.position?x.position.y:x.defaultPosition.y,prevPropsPosition:{...x.position},slackX:0,slackY:0,isElementSVG:!1},x.position&&!(x.onDrag||x.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){var x,w;return((w=(x=this.props)==null?void 0:x.nodeRef)==null?void 0:w.current)??r.default.findDOMNode(this)}render(){const{axis:x,bounds:w,children:k,defaultPosition:_,defaultClassName:S,defaultClassNameDragging:P,defaultClassNameDragged:T,position:A,positionOffset:D,scale:E,...j}=this.props;let Z={},se=null;const G=!!!A||this.state.dragging,ye=A||_,he={x:(0,o.canDragX)(this)&&G?this.state.x:ye.x,y:(0,o.canDragY)(this)&&G?this.state.y:ye.y};this.state.isElementSVG?se=(0,i.createSVGTransform)(he,D):Z=(0,i.createCSSTransform)(he,D);const Be=(0,s.clsx)(k.props.className||"",S,{[P]:this.state.dragging,[T]:this.state.dragged});return e.createElement(l.default,g({},j,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(k),{className:Be,style:{...k.props.style,...Z},transform:se}))}}n.default=b,h(b,"displayName","Draggable"),h(b,"propTypes",{...l.default.propTypes,axis:t.default.oneOf(["both","x","y","none"]),bounds:t.default.oneOfType([t.default.shape({left:t.default.number,right:t.default.number,top:t.default.number,bottom:t.default.number}),t.default.string,t.default.oneOf([!1])]),defaultClassName:t.default.string,defaultClassNameDragging:t.default.string,defaultClassNameDragged:t.default.string,defaultPosition:t.default.shape({x:t.default.number,y:t.default.number}),positionOffset:t.default.shape({x:t.default.oneOfType([t.default.number,t.default.string]),y:t.default.oneOfType([t.default.number,t.default.string])}),position:t.default.shape({x:t.default.number,y:t.default.number}),className:a.dontSetMe,style:a.dontSetMe,transform:a.dontSetMe}),h(b,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})}(ca);const{default:ul,DraggableCore:Nf}=ca;tr.exports=ul,tr.exports.default=ul,tr.exports.DraggableCore=Nf;var Mf=tr.exports;const Ff=uo(Mf),Lf=({chatbot:n,message:e})=>{const t=et(null),[r,s]=M(""),{thinking:i=[],text:o=""}=e.data;return _e(()=>{const a=K.parse(o||"");typeof a=="string"?s(a):a.then(s)},[o]),p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(n.appearance.images.popupChat,200),alt:"Bot"})}),p("div",{className:"messageDiv ",children:p("div",{className:"messageP markdownText ai-generating",children:[i.length>0&&p("div",{className:"thinkingContainer",ref:t,children:i.map((a,l)=>p("div",{className:"thinkingChunk",children:["• ",a]},l))}),r&&p("div",{dangerouslySetInnerHTML:{__html:r}})]})})]})},jf=({message:n,type:e,onDismiss:t})=>{const[r,s]=M(!0);return _e(()=>{const i=setTimeout(()=>{s(!1),t()},4e3);return()=>clearTimeout(i)},[t]),r?p("div",{className:`robodialog-toast robodialog-toast-${e}`,children:[p("span",{className:"robodialog-toast-message",children:n}),p("button",{className:"robodialog-toast-close",onClick:()=>{s(!1),t()},children:"×"})]}):null},Uf=()=>{const[n,e]=M([]),t=Ht((i,o="info")=>{const a=`${Date.now()}-${Math.random().toString(36).substring(2,9)}`;e(l=>[...l,{id:a,message:i,type:o}]),setTimeout(()=>{r(a)},4e3)},[]),r=Ht(i=>{e(o=>o.filter(a=>a.id!==i))},[]);return{showToast:t,ToastContainer:()=>n.length===0?null:p(Te,{children:n.map(i=>p(jf,{message:i.message,type:i.type,onDismiss:()=>r(i.id)},i.id))}),dismissToast:r}},zf=({handleChangeConversation:n,coreState:e,conversationState:t,uiState:r,showToast:s})=>{var _r;const i=et(null),[o,a]=M(null),[l,c]=M(!1),[u,d]=M(!1),[g,h]=M("auto"),[f,m]=M(""),{chatbot:b,token:v,fileSizeLimit:x,userData:w,isChatbotDefault:k,isDefaultExternalAPI:_}=e,{messageCallOneTime:S,messages:P,currentConversation:T,messagesRef:A,setMessages:D}=t,{ratingFromUser:E,canMessage:j,setCanMessage:Z,humanControl:se,aiLoading:Oe,hoveringMessageInner:G,userLoading:ye,dataFromUser:he,setHoveringMessageInner:Be,onlineAgents:C,setOnlineAgents:R,callChatFlowRef:$,callChatFlow:F,setCallChatFlow:I,setHumanControl:q,setAiLoading:U,setUserLoading:z,setDataFromUser:H,setRatingFromUser:X}=r,W=b.chatflow.nodes.find(B=>B.type==="AIControlNode"),le=(P&&T?P.filter(B=>B.conversationId===T._id):[]).sort((B,fe)=>new Date(fe.createdAt||"").getTime()-new Date(B.createdAt||"").getTime()),O=B=>{var at;const fe=B.target,Me=(at=fe.files)==null?void 0:at[0];if(Me&&!/^image\//.test(Me.type)){a(null),s("Only image files are allowed","error");return}if(Me){if(Me.size>x*1024*1024){d(!0),setTimeout(()=>d(!1),3e3),fe.value="";return}a(Me),fe.value=""}},Ne=Ht(B=>{const fe=B.currentTarget;m(fe.value),requestAnimationFrame(()=>{fe.style.height="auto",fe.style.height=`${fe.scrollHeight}px`,h(`${fe.scrollHeight}px`)})},[m]),mt=B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),f.trim()&&us({coreState:e,conversationState:t,uiState:r,userMessage:f,setUserMessage:m,file:o,setFile:a,showToast:s,latestCurrentConversation:T}))};async function jt(){var Me,at,bt;if(!T||(Me=S.current)!=null&&Me.call)return;const B=((at=S.current)==null?void 0:at.messagesCount[T._id])||-1,fe=((bt=S.current)==null?void 0:bt.messagesLength[T._id])||0;if(!(B<=fe&&B!==-1))try{c(!0),S.current.call=!0;const yn=fe===1?0:fe,He=await ls.userReadAll({body:{conversationId:T._id,skip:yn}},v);if(!He.data)throw new Error("Failed to load messages");D(oe=>{const ce=new Set(oe.map(ct=>ct._id)),lt=He.data.messages.filter(ct=>!ce.has(ct._id)),_t=[...oe,...lt];return A.current=_t,_t}),S.current.messagesCount[T._id]=He.data.count}catch{s("Failed to load messages","error")}finally{S.current.call=!1,c(!1)}}function br(){n(null),Z(!1),m(""),q(!1),U(!1),Be(null),z(!1),H(null),R(0),X(null),a(null)}return _e(()=>{$.current&&T&&!k&&(Xn({coreState:e,conversationState:t,uiState:r,showToast:s}),$.current=!1)},[T]),_e(()=>{if(!T||k)return;if(_){Xn({coreState:e,conversationState:t,uiState:r,showToast:s});return}F&&(jt(),Xn({coreState:e,conversationState:t,uiState:r,showToast:s}),I(!1));const B=i.current;if(!B||B.scrollEventAdded)return;let fe;const Me=at=>{const bt=at.target;bt.scrollTop*-1+bt.clientHeight===bt.scrollHeight&&jt()};return fe=requestAnimationFrame(()=>{B.addEventListener("scroll",Me),B.scrollEventAdded=!0}),()=>{cancelAnimationFrame(fe),B.removeEventListener("scroll",Me)}},[F,T==null?void 0:T._id]),_e(()=>{if(!(le!=null&&le.length))return;S.current.messagesLength[(T==null?void 0:T._id)||""]=le.length;const B=le[0];B.owner==="agent"&&!B.seen&&Ed(B,e,t,r,s)},[le.length]),T?p("div",{className:"conversationDetails",children:[p("div",{className:"conversationDetailsHeader",children:[p("div",{onClick:br,style:{pointerEvents:Oe||_?"none":"",opacity:Oe||_?"0.5":"1"},children:p(Lo,{className:"background-text-color"})}),p("div",{style:{display:"flex",gap:"5px",alignItems:"center",color:b.appearance.color.backgroundText},children:[p(vh,{chatbot:b,humanControl:se,latestCurrentConversation:T}),"Controlled By ",T!=null&&T.assignedTo?"Human":"AI"]}),p("div",{style:{width:"21px"}})]}),p("div",{className:"livelinkMsgs",ref:i,children:[G&&j&&!(T!=null&&T.assignedTo)&&!o&&p(Eh,{hoveringMessageInner:G,chatbot:b}),Oe&&!((_r=le[0])!=null&&_r._id.startsWith("streaming_"))&&p(Th,{chatbot:b}),ye&&p(kh,{chatbot:b}),he&&!(T!=null&&T.assignedTo)&&p(yh,{email:(w==null?void 0:w.email)||"",chatbot:b,dataFromUser:he}),E&&!(T!=null&&T.assignedTo)&&p(xh,{chatbot:b,ratingFromUser:E}),(T==null?void 0:T.assignType)&&!(T!=null&&T.assignedTo)&&p(wh,{currentConversation:T,chatbot:b,onlineAgents:C}),le.map((B,fe)=>{if(B._id.startsWith("streaming_"))return p(Lf,{chatbot:b,message:B},B._id);if(!B.data.path)return p(Sh,{AIControlNode:W,chatbot:b,message:B},B._id||fe)}),l&&p(Ch,{chatbot:b})]}),p("div",{children:[o&&p(Ah,{file:o,setFile:a,chatbot:b}),p("div",{className:"massageInputDivMain",style:{opacity:j||T!=null&&T.assignedTo?"1":"0.7",pointerEvents:j||T!=null&&T.assignedTo?"all":"none"},children:p("form",{onSubmit:B=>{B.preventDefault(),f.trim()&&us({coreState:e,conversationState:t,uiState:r,userMessage:f,setUserMessage:m,file:o,setFile:a,latestCurrentConversation:T,showToast:s})},children:[p("textarea",{style:{height:g},placeholder:u?"File Size Limit Reached":b.appearance.text.messagePlaceholder,maxLength:500,onChange:Ne,onKeyDown:mt,value:f,rows:1,disabled:u}),p("input",{type:"file",onChange:O,style:{display:"none"},id:"fileUpload",accept:"image/*"}),(T==null?void 0:T.assignedTo)&&p("label",{className:"inputArrowMassageImg attachment",htmlFor:"fileUpload",children:p(dd,{className:"input-text-color"})}),p("button",{className:"inputArrowMassageImg",type:"submit",disabled:!f.trim(),children:p(ud,{className:"input-text-color"})})]})})]})]}):null},qf=({handleChangeConversation:n,coreState:e,conversationState:t,uiState:r,showToast:s})=>{const{chatbot:i,token:o}=e,{setConversations:a,setCurrentConversation:l,conversations:c,messages:u,totalConversationsCount:d,setTotalConversationsCount:g,setMessages:h}=t,{setCallChatFlow:f}=r,[m,b]=M(!1),[v,x]=M(!1),[w,k]=M(!1);return p("div",{className:"conversationMain",children:[p("button",{className:"newConversationBtn",onClick:async()=>{var P,T,A,D;if(!(v||m))try{x(!0);const E=await $t.userCreate({body:{}},o);if(!E.data)throw new Error("Conversation creation failed");const j=E.data;l(j),a(Z=>[...Z,j]),f(!0)}catch(E){((T=(P=E.response)==null?void 0:P.data)==null?void 0:T.error)==="Limit Reached"&&b(!0),s(((D=(A=E.response)==null?void 0:A.data)==null?void 0:D.message)||"Failed to create conversation","error")}finally{x(!1)}},children:v?p("div",{className:"newConversationLoading",children:p(un,{className:"base-text-color",width:13,height:13})}):m?"Limit Reached":"+ Conversation"}),p(mh,{conversations:c,chatbot:i,handleChangeConversation:n,messages:u,totalConversationsCount:d,conversationsLoading:w,loadMoreConversations:async()=>{if(!w)try{k(!0);const P=await $t.userReadAll(o,{query:{skip:c.length.toString()}});if(!P.data)throw new Error("Failed to load conversations");h(T=>{const A=[...T,...P.data.messages];return t.messagesRef.current=A,A}),a(T=>[...T,...P.data.conversations]),g(P.data.count)}catch{s("Failed to load conversations","error")}finally{k(!1)}}})]})},Bf=({chatOpen:n,coreState:e,conversationState:t,uiState:r,isMobileVersion:s,fullScreen:i})=>{const{showToast:o,ToastContainer:a}=Uf(),{chatbot:l,token:c,isChatbotDefault:u}=e,{setCallChatFlow:d}=r,{setMessages:g,messagesRef:h,setConversations:f,setTotalConversationsCount:m,setCurrentConversation:b}=t,[v,x]=M(!u),w=_=>{b(_),_!==null&&!u&&d(!0)},k=async()=>{try{x(!0);const _=await $t.userReadAll(c);if(!_.data)throw new Error("Failed to load conversations");const S=_.data.messages||[];h.current=S,g(S),f(_.data.conversations||[]),m(_.data.count||0)}catch{o("Failed to initialize conversations","error")}finally{x(!1)}};return _e(()=>{u||k()},[c]),p("div",{className:`chatbotConversationContainer ${n?"open":""} ${i?"fullscreen":""}`,style:i?void 0:{maxHeight:`calc(95vh - 70px - ${l.appearance.others.position[s?"mobile":"desktop"].verticalSpace}px)`,maxWidth:`calc(95vw - ${l.appearance.others.position[s?"mobile":"desktop"].horizontalSpace}px)`},children:[p(a,{}),p("div",{className:"top-header",children:[p("h2",{children:l.appearance.text.heading}),p("h4",{children:l.appearance.text.description}),l.appearance.others.showAgents&&p(xs,{className:"mainAgents",chatbot:l})]}),p("div",{className:"liveLinkRightDiv",children:v?p("div",{className:"loadingDiv",children:p(un,{className:"background-text-color"})}):p(Te,{children:[p(zf,{handleChangeConversation:w,coreState:e,conversationState:t,uiState:r,showToast:o}),p(qf,{handleChangeConversation:w,coreState:e,conversationState:t,uiState:r,showToast:o})]})}),!l.appearance.others.removePoweredBy&&p("div",{className:"livelinkPoweredDiv2",children:[p("span",{children:"Powered By "}),p("img",{src:hd,alt:"Logo"}),p("a",{href:"https://robodialog.com",target:"_blank",children:"Robodialog"})]})]})},Hf=({coreState:n,conversationState:e,uiState:t,fullScreen:r})=>{var A;const[s,i]=M(!1),[o,a]=M(!0),l=Fr("robodialog-chatbot-opened"),[c,u]=M(null),{userData:d,chatbot:g}=n,{newMessage:h,setNewMessage:f}=e,{setInteracted:m,chatOpen:b,setChatOpen:v}=t,x=g.chatflow.nodes.find(D=>d!=null&&d.isUser?D.type==="StartNode"&&D.data.channel.users:D.type==="StartNode"&&D.data.channel.visitors),w=((A=x==null?void 0:x.data)==null?void 0:A.hoveringMessage)||null,k=()=>{v(!b)};typeof window<"u"&&(window.robodialog={...window.robodialog||{},openChat:k});const _=g.appearance.others.position,S=_[s?"mobile":"desktop"].position==="bottomleft",P={alignItems:s?_.mobile.position==="bottomleft"?"flex-start":"flex-end":_.desktop.position==="bottomleft"?"flex-start":"flex-end",bottom:s?`${_.mobile.verticalSpace}px`:`${_.desktop.verticalSpace}px`,[S?"left":"right"]:s?`${_.mobile.horizontalSpace}px`:`${_.desktop.horizontalSpace}px`};_e(()=>{const D=()=>{i(window.innerWidth<_.mobileStartsFrom)};return D(),window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[_.mobileStartsFrom]),_e(()=>{b&&(m(!0),a(!1),Sn("robodialog-chatbot-opened",!0))},[b]),_e(()=>{var D,E,j,Z;if(h&&((E=(D=x==null?void 0:x.data)==null?void 0:D.popupMessage)!=null&&E.value)){const se=(Z=(j=x==null?void 0:x.data)==null?void 0:j.popupMessage)==null?void 0:Z.duration;c&&clearTimeout(c);const Oe=window.setTimeout(()=>{f(null)},se*1e3);u(Oe)}return()=>{c&&clearTimeout(c)}},[h]),_e(()=>{var E;const D=(E=x==null?void 0:x.data)==null?void 0:E.automaticallyOpenConversation;!(D!=null&&D.value)||r||(D.type==="allTheTime"||D.type==="oncePerVisit"&&!l)&&(v(!0),a(!1),Sn("robodialog-chatbot-opened",!0))},[]),_e(()=>{r&&v(!0)},[r,v]);const T=p("div",{className:`chatbotMain ${r?"fullscreen":""}`,style:r?void 0:P,children:[p(Bf,{chatOpen:b,coreState:n,conversationState:e,uiState:t,isMobileVersion:s,fullScreen:r}),!r&&p(Te,{children:[p(Rh,{chatbot:g,showHoveringMessage:o,hoveringMessages:w,setShowHoveringMessage:a,coreState:n,conversationState:e,uiState:t,node:x,setChatOpen:v}),p("div",{className:"chatbotChat",style:{flexDirection:S?"row-reverse":"row"},children:[p("div",{className:"chatbotDrag handle",children:p(cd,{className:"background-text-color",width:10})}),p("div",{className:"chatbotChatInside",onClick:k,children:[p("img",{src:ie(g.appearance.images.chat,200),alt:"Chat",style:{display:b?"none":"block"}}),p(ad,{className:"background-text-color",style:{display:b?"block":"none"}})]})]})]})]});return r?T:p(Ff,{axis:"both",handle:".handle",defaultPosition:{x:0,y:0},position:b?{x:0,y:0}:void 0,scale:1,bounds:".robodialog-chatbot-app",children:T})};function ke(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(n,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;function Wf(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ws={exports:{}},Qt=typeof Reflect=="object"?Reflect:null,dl=Qt&&typeof Qt.apply=="function"?Qt.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},cr;Qt&&typeof Qt.ownKeys=="function"?cr=Qt.ownKeys:Object.getOwnPropertySymbols?cr=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:cr=function(e){return Object.getOwnPropertyNames(e)};function Vf(n){console&&console.warn&&console.warn(n)}var hl=Number.isNaN||function(e){return e!==e};function te(){te.init.call(this)}Ws.exports=te,Ws.exports.once=Zf,te.EventEmitter=te,te.prototype._events=void 0,te.prototype._eventsCount=0,te.prototype._maxListeners=void 0;var fl=10;function ur(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(te,"defaultMaxListeners",{enumerable:!0,get:function(){return fl},set:function(n){if(typeof n!="number"||n<0||hl(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");fl=n}}),te.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},te.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||hl(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function pl(n){return n._maxListeners===void 0?te.defaultMaxListeners:n._maxListeners}te.prototype.getMaxListeners=function(){return pl(this)},te.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var s=e==="error",i=this._events;if(i!==void 0)s=s&&i.error===void 0;else if(!s)return!1;if(s){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=i[e];if(l===void 0)return!1;if(typeof l=="function")dl(l,this,t);else for(var c=l.length,u=vl(l,c),r=0;r<c;++r)dl(u[r],this,t);return!0};function gl(n,e,t,r){var s,i,o;if(ur(t),i=n._events,i===void 0?(i=n._events=Object.create(null),n._eventsCount=0):(i.newListener!==void 0&&(n.emit("newListener",e,t.listener?t.listener:t),i=n._events),o=i[e]),o===void 0)o=i[e]=t,++n._eventsCount;else if(typeof o=="function"?o=i[e]=r?[t,o]:[o,t]:r?o.unshift(t):o.push(t),s=pl(n),s>0&&o.length>s&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=o.length,Vf(a)}return n}te.prototype.addListener=function(e,t){return gl(this,e,t,!1)},te.prototype.on=te.prototype.addListener,te.prototype.prependListener=function(e,t){return gl(this,e,t,!0)};function Yf(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ml(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},s=Yf.bind(r);return s.listener=t,r.wrapFn=s,s}te.prototype.once=function(e,t){return ur(t),this.on(e,ml(this,e,t)),this},te.prototype.prependOnceListener=function(e,t){return ur(t),this.prependListener(e,ml(this,e,t)),this},te.prototype.removeListener=function(e,t){var r,s,i,o,a;if(ur(t),s=this._events,s===void 0)return this;if(r=s[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;i===0?r.shift():Xf(r,i),r.length===1&&(s[e]=r[0]),s.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this},te.prototype.off=te.prototype.removeListener,te.prototype.removeAllListeners=function(e){var t,r,s;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var i=Object.keys(r),o;for(s=0;s<i.length;++s)o=i[s],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=r[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(s=t.length-1;s>=0;s--)this.removeListener(e,t[s]);return this};function bl(n,e,t){var r=n._events;if(r===void 0)return[];var s=r[e];return s===void 0?[]:typeof s=="function"?t?[s.listener||s]:[s]:t?Jf(s):vl(s,s.length)}te.prototype.listeners=function(e){return bl(this,e,!0)},te.prototype.rawListeners=function(e){return bl(this,e,!1)},te.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):_l.call(n,e)},te.prototype.listenerCount=_l;function _l(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}te.prototype.eventNames=function(){return this._eventsCount>0?cr(this._events):[]};function vl(n,e){for(var t=new Array(e),r=0;r<e;++r)t[r]=n[r];return t}function Xf(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function Jf(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}function Zf(n,e){return new Promise(function(t,r){function s(o){n.removeListener(e,i),r(o)}function i(){typeof n.removeListener=="function"&&n.removeListener("error",s),t([].slice.call(arguments))}yl(n,e,i,{once:!0}),e!=="error"&&Gf(n,s,{once:!0})})}function Gf(n,e,t){typeof n.on=="function"&&yl(n,"error",e,t)}function yl(n,e,t,r){if(typeof n.on=="function")r.once?n.once(e,t):n.on(e,t);else if(typeof n.addEventListener=="function")n.addEventListener(e,function s(i){r.once&&n.removeEventListener(e,s),t(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}var Kf=Ws.exports,xl=Wf(Kf),ae;(function(n){n[n.timeout=1]="timeout",n[n.transportClosed=2]="transportClosed",n[n.clientDisconnected=3]="clientDisconnected",n[n.clientClosed=4]="clientClosed",n[n.clientConnectToken=5]="clientConnectToken",n[n.clientRefreshToken=6]="clientRefreshToken",n[n.subscriptionUnsubscribed=7]="subscriptionUnsubscribed",n[n.subscriptionSubscribeToken=8]="subscriptionSubscribeToken",n[n.subscriptionRefreshToken=9]="subscriptionRefreshToken",n[n.transportWriteError=10]="transportWriteError",n[n.connectionClosed=11]="connectionClosed",n[n.badConfiguration=12]="badConfiguration"})(ae||(ae={}));var Tt;(function(n){n[n.connectCalled=0]="connectCalled",n[n.transportClosed=1]="transportClosed",n[n.noPing=2]="noPing",n[n.subscribeTimeout=3]="subscribeTimeout",n[n.unsubscribeError=4]="unsubscribeError"})(Tt||(Tt={}));var vn;(function(n){n[n.disconnectCalled=0]="disconnectCalled",n[n.unauthorized=1]="unauthorized",n[n.badProtocol=2]="badProtocol",n[n.messageSizeLimit=3]="messageSizeLimit"})(vn||(vn={}));var dr;(function(n){n[n.subscribeCalled=0]="subscribeCalled",n[n.transportClosed=1]="transportClosed"})(dr||(dr={}));var hr;(function(n){n[n.unsubscribeCalled=0]="unsubscribeCalled",n[n.unauthorized=1]="unauthorized",n[n.clientClosed=2]="clientClosed"})(hr||(hr={}));var Vs;(function(n){n[n.channelCompaction=1]="channelCompaction"})(Vs||(Vs={}));var me;(function(n){n.Disconnected="disconnected",n.Connecting="connecting",n.Connected="connected"})(me||(me={}));var Re;(function(n){n.Unsubscribed="unsubscribed",n.Subscribing="subscribing",n.Subscribed="subscribed"})(Re||(Re={}));function Qf(n,e){return n.lastIndexOf(e,0)===0}function wl(n){return n==null?!1:typeof n=="function"}function ep(n,e){if(globalThis.console){const t=globalThis.console[n];wl(t)&&t.apply(globalThis.console,e)}}function tp(n,e){return Math.floor(Math.random()*(e-n+1)+n)}function fr(n,e,t){n>31&&(n=31);const r=tp(0,Math.min(t,e*Math.pow(2,n)));return Math.min(t,e+r)}function np(n){return"error"in n&&n.error!==null}function pr(n){return Math.min(n*1e3,2147483647)}class rp extends xl{constructor(e,t,r){super(),this._resubscribeTimeout=null,this._refreshTimeout=null,this.channel=t,this.state=Re.Unsubscribed,this._centrifuge=e,this._token="",this._getToken=null,this._data=null,this._getData=null,this._recover=!1,this._offset=null,this._epoch=null,this._id=0,this._recoverable=!1,this._positioned=!1,this._joinLeave=!1,this._minResubscribeDelay=500,this._maxResubscribeDelay=2e4,this._resubscribeTimeout=null,this._resubscribeAttempts=0,this._promises={},this._promiseId=0,this._inflight=!1,this._refreshTimeout=null,this._delta="",this._delta_negotiated=!1,this._tagsFilter=null,this._prevValue=null,this._unsubPromise=Promise.resolve(),this._setOptions(r),this._centrifuge._debugEnabled?(this.on("state",s=>{this._debug("subscription state",t,s.oldState,"->",s.newState)}),this.on("error",s=>{this._debug("subscription error",t,s)})):this.on("error",function(){Function.prototype()})}ready(e){return this.state===Re.Unsubscribed?Promise.reject({code:ae.subscriptionUnsubscribed,message:this.state}):this.state===Re.Subscribed?Promise.resolve():new Promise((t,r)=>{const s={resolve:t,reject:r};e&&(s.timeout=setTimeout(function(){r({code:ae.timeout,message:"timeout"})},e)),this._promises[this._nextPromiseId()]=s})}subscribe(){this._isSubscribed()||(this._resubscribeAttempts=0,this._setSubscribing(dr.subscribeCalled,"subscribe called"))}unsubscribe(){this._unsubPromise=this._setUnsubscribed(hr.unsubscribeCalled,"unsubscribe called",!0)}publish(e){return ke(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.publish(this.channel,e)})}presence(){return ke(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.presence(this.channel)})}presenceStats(){return ke(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.presenceStats(this.channel)})}history(e){return ke(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.history(this.channel,e)})}setTagsFilter(e){if(e&&this._delta)throw new Error("cannot use delta and tagsFilter together");this._tagsFilter=e}setData(e){this._data=e}_methodCall(){return this._isSubscribed()?Promise.resolve():this._isUnsubscribed()?Promise.reject({code:ae.subscriptionUnsubscribed,message:this.state}):new Promise((e,t)=>{const r=this._centrifuge._config.timeout,s=setTimeout(()=>{t({code:ae.timeout,message:"timeout"})},r);this._promises[this._nextPromiseId()]={timeout:s,resolve:e,reject:t}})}_nextPromiseId(){return++this._promiseId}_needRecover(){return this._recover===!0}_isUnsubscribed(){return this.state===Re.Unsubscribed}_isSubscribing(){return this.state===Re.Subscribing}_isSubscribed(){return this.state===Re.Subscribed}_setState(e){if(this.state!==e){const t=this.state;return this.state=e,this.emit("state",{newState:e,oldState:t,channel:this.channel}),!0}return!1}_usesToken(){return this._token!==""||this._getToken!==null}_clearSubscribingState(){this._resubscribeAttempts=0,this._clearResubscribeTimeout()}_clearSubscribedState(){this._clearRefreshTimeout()}_setSubscribed(e){if(!this._isSubscribing())return;this._clearSubscribingState(),e.id&&(this._id=e.id),e.recoverable&&(this._recover=!0,this._offset=e.offset||0,this._epoch=e.epoch||""),e.delta?this._delta_negotiated=!0:this._delta_negotiated=!1,this._setState(Re.Subscribed);const t=this._centrifuge._getSubscribeContext(this.channel,e);this.emit("subscribed",t),this._resolvePromises();const r=e.publications;if(r&&r.length>0)for(const s in r)r.hasOwnProperty(s)&&this._handlePublication(r[s]);e.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),pr(e.ttl)))}_setSubscribing(e,t){return ke(this,void 0,void 0,function*(){this._isSubscribing()||(this._isSubscribed()&&this._clearSubscribedState(),this._setState(Re.Subscribing)&&this.emit("subscribing",{channel:this.channel,code:e,reason:t}),this._centrifuge._transport&&this._centrifuge._transport.emulation()&&(yield this._unsubPromise),this._isSubscribing()&&this._subscribe())})}_subscribe(){return this._debug("subscribing on",this.channel),this._isTransportOpen()?this._inflight?null:(this._inflight=!0,this._canSubscribeWithoutGettingToken()?this._subscribeWithoutToken():(this._getSubscriptionToken().then(e=>this._handleTokenResponse(e)).catch(e=>this._handleTokenError(e)),null)):(this._debug("delay subscribe on",this.channel,"till connected"),null)}_isTransportOpen(){return this._centrifuge._transportIsOpen}_canSubscribeWithoutGettingToken(){return!this._usesToken()||!!this._token}_subscribeWithoutToken(){return this._getData?(this._getDataAndSubscribe(this._token),null):this._sendSubscribe(this._token)}_getDataAndSubscribe(e){if(!this._getData){this._inflight=!1;return}this._getData({channel:this.channel}).then(t=>{if(!this._isSubscribing()){this._inflight=!1;return}this._data=t,this._sendSubscribe(e)}).catch(t=>this._handleGetDataError(t))}_handleGetDataError(e){if(!this._isSubscribing()){this._inflight=!1;return}if(e instanceof gt){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeData",channel:this.channel,error:{code:ae.badConfiguration,message:(e==null?void 0:e.toString())||""}}),this._inflight=!1,this._scheduleResubscribe()}_handleTokenResponse(e){if(!this._isSubscribing()){this._inflight=!1;return}if(!e){this._inflight=!1,this._failUnauthorized();return}this._token=e,this._getData?this._getDataAndSubscribe(e):this._sendSubscribe(e)}_handleTokenError(e){if(!this._isSubscribing()){this._inflight=!1;return}if(e instanceof gt){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeToken",channel:this.channel,error:{code:ae.subscriptionSubscribeToken,message:(e==null?void 0:e.toString())||""}}),this._inflight=!1,this._scheduleResubscribe()}_sendSubscribe(e){if(!this._isTransportOpen())return this._inflight=!1,null;const t=this._buildSubscribeCommand(e);return this._centrifuge._call(t).then(r=>{this._inflight=!1;const s=r.reply.subscribe;this._handleSubscribeResponse(s),r.next&&r.next()},r=>{this._inflight=!1,this._handleSubscribeError(r.error),r.next&&r.next()}),t}_buildSubscribeCommand(e){const t={channel:this.channel};if(e&&(t.token=e),this._data&&(t.data=this._data),this._positioned&&(t.positioned=!0),this._recoverable&&(t.recoverable=!0),this._joinLeave&&(t.join_leave=!0),t.flag=Vs.channelCompaction,this._needRecover()){t.recover=!0;const r=this._getOffset();r&&(t.offset=r);const s=this._getEpoch();s&&(t.epoch=s)}return this._delta&&(t.delta=this._delta),this._tagsFilter&&(t.tf=this._tagsFilter),{subscribe:t}}_debug(...e){this._centrifuge._debug(...e)}_handleSubscribeError(e){if(this._isSubscribing()){if(e.code===ae.timeout){this._centrifuge._disconnect(Tt.subscribeTimeout,"subscribe timeout",!0);return}this._subscribeError(e)}}_handleSubscribeResponse(e){this._isSubscribing()&&this._setSubscribed(e)}_setUnsubscribed(e,t,r){if(this._isUnsubscribed())return Promise.resolve();let s=Promise.resolve();return this._isSubscribed()?(r&&(s=this._centrifuge._unsubscribe(this)),this._clearSubscribedState()):this._isSubscribing()&&(this._inflight&&r&&(s=this._centrifuge._unsubscribe(this)),this._clearSubscribingState()),this._inflight=!1,this._setState(Re.Unsubscribed)&&this.emit("unsubscribed",{channel:this.channel,code:e,reason:t}),this._rejectPromises({code:ae.subscriptionUnsubscribed,message:this.state}),s}_handlePublication(e){if(this._delta&&this._delta_negotiated){const{newData:r,newPrevValue:s}=this._centrifuge._codec.applyDeltaIfNeeded(e,this._prevValue);e.data=r,this._prevValue=s}const t=this._centrifuge._getPublicationContext(this.channel,e);this.emit("publication",t),e.offset&&(this._offset=e.offset)}_handleJoin(e){const t=this._centrifuge._getJoinLeaveContext(e.info);this.emit("join",{channel:this.channel,info:t})}_handleLeave(e){const t=this._centrifuge._getJoinLeaveContext(e.info);this.emit("leave",{channel:this.channel,info:t})}_resolvePromises(){for(const e in this._promises)this._promises.hasOwnProperty(e)&&(this._promises[e].timeout&&clearTimeout(this._promises[e].timeout),this._promises[e].resolve(),delete this._promises[e])}_rejectPromises(e){for(const t in this._promises)this._promises.hasOwnProperty(t)&&(this._promises[t].timeout&&clearTimeout(this._promises[t].timeout),this._promises[t].reject(e),delete this._promises[t])}_scheduleResubscribe(){if(!this._isSubscribing()){this._debug("not in subscribing state, skip resubscribe scheduling",this.channel);return}const e=this,t=this._getResubscribeDelay();this._resubscribeTimeout=setTimeout(function(){e._isSubscribing()&&e._subscribe()},t),this._debug("resubscribe scheduled after "+t,this.channel)}_subscribeError(e){if(this._isSubscribing())if(e.code<100||e.code===109||e.temporary===!0){e.code===109&&(this._token="");const t={channel:this.channel,type:"subscribe",error:e};this._centrifuge.state===me.Connected&&this.emit("error",t),this._scheduleResubscribe()}else this._setUnsubscribed(e.code,e.message,!1)}_getResubscribeDelay(){const e=fr(this._resubscribeAttempts,this._minResubscribeDelay,this._maxResubscribeDelay);return this._resubscribeAttempts++,e}_setOptions(e){if(e){if(e.since&&(this._offset=e.since.offset||0,this._epoch=e.since.epoch||"",this._recover=!0),e.data&&(this._data=e.data),e.getData&&(this._getData=e.getData),e.minResubscribeDelay!==void 0&&(this._minResubscribeDelay=e.minResubscribeDelay),e.maxResubscribeDelay!==void 0&&(this._maxResubscribeDelay=e.maxResubscribeDelay),e.token&&(this._token=e.token),e.getToken&&(this._getToken=e.getToken),e.positioned===!0&&(this._positioned=!0),e.recoverable===!0&&(this._recoverable=!0),e.joinLeave===!0&&(this._joinLeave=!0),e.delta){if(e.delta!=="fossil")throw new Error("unsupported delta format");this._delta=e.delta}if(e.tagsFilter&&(this._tagsFilter=e.tagsFilter),this._tagsFilter&&this._delta)throw new Error("cannot use delta and tagsFilter together")}}_getOffset(){const e=this._offset;return e!==null?e:0}_getEpoch(){const e=this._epoch;return e!==null?e:""}_clearRefreshTimeout(){this._refreshTimeout!==null&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearResubscribeTimeout(){this._resubscribeTimeout!==null&&(clearTimeout(this._resubscribeTimeout),this._resubscribeTimeout=null)}_getSubscriptionToken(){this._debug("get subscription token for channel",this.channel);const e={channel:this.channel},t=this._getToken;return t===null?(this.emit("error",{type:"configuration",channel:this.channel,error:{code:ae.badConfiguration,message:"provide a function to get channel subscription token"}}),Promise.reject(new gt(""))):t(e)}_refresh(){this._clearRefreshTimeout();const e=this;this._getSubscriptionToken().then(function(t){if(!e._isSubscribed())return;if(!t){e._failUnauthorized();return}e._token=t;const s={sub_refresh:{channel:e.channel,token:t}};e._centrifuge._call(s).then(i=>{const o=i.reply.sub_refresh;e._refreshResponse(o),i.next&&i.next()},i=>{e._refreshError(i.error),i.next&&i.next()})}).catch(function(t){if(t instanceof gt){e._failUnauthorized();return}e.emit("error",{type:"refreshToken",channel:e.channel,error:{code:ae.subscriptionRefreshToken,message:t!==void 0?t.toString():""}}),e._refreshTimeout=setTimeout(()=>e._refresh(),e._getRefreshRetryDelay())})}_refreshResponse(e){this._isSubscribed()&&(this._debug("subscription token refreshed, channel",this.channel),this._clearRefreshTimeout(),e.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),pr(e.ttl))))}_refreshError(e){this._isSubscribed()&&(e.code<100||e.temporary===!0?(this.emit("error",{type:"refresh",channel:this.channel,error:e}),this._refreshTimeout=setTimeout(()=>this._refresh(),this._getRefreshRetryDelay())):this._setUnsubscribed(e.code,e.message,!0))}_getRefreshRetryDelay(){return fr(0,1e4,2e4)}_failUnauthorized(){this._setUnsubscribed(hr.unauthorized,"unauthorized",!0)}}class sp{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null}name(){return"sockjs"}subName(){return"sockjs-"+this._transport.transport}emulation(){return!1}supported(){return this.options.sockjs!==null}initialize(e,t){this._transport=new this.options.sockjs(this.endpoint,null,this.options.sockjsOptions),this._transport.onopen=()=>{t.onOpen()},this._transport.onerror=r=>{t.onError(r)},this._transport.onclose=r=>{t.onClose(r)},this._transport.onmessage=r=>{t.onMessage(r.data)}}close(){this._transport.close()}send(e){this._transport.send(e)}}class kl{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null}name(){return"websocket"}subName(){return"websocket"}emulation(){return!1}supported(){return this.options.websocket!==void 0&&this.options.websocket!==null}initialize(e,t){let r="";e==="protobuf"&&(r="centrifuge-protobuf"),r!==""?this._transport=new this.options.websocket(this.endpoint,r):this._transport=new this.options.websocket(this.endpoint),e==="protobuf"&&(this._transport.binaryType="arraybuffer"),this._transport.onopen=()=>{t.onOpen()},this._transport.onerror=s=>{t.onError(s)},this._transport.onclose=s=>{t.onClose(s)},this._transport.onmessage=s=>{t.onMessage(s.data)}}close(){this._transport.close()}send(e){this._transport.send(e)}}class ip{constructor(e,t){this.endpoint=e,this.options=t,this._abortController=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"http_stream"}subName(){return"http_stream"}emulation(){return!0}_handleErrors(e){if(!e.ok)throw new Error(e.status);return e}_fetchEventTarget(e,t,r){const s=new EventTarget,i=e.options.fetch;return i(t,r).then(e._handleErrors).then(o=>{s.dispatchEvent(new Event("open"));let a="",l=0,c=new Uint8Array;const u=o.body.getReader();return new e.options.readableStream({start(d){function g(){return u.read().then(({done:h,value:f})=>{if(h){s.dispatchEvent(new Event("close")),d.close();return}try{if(e._protocol==="json")for(a+=e._utf8decoder.decode(f);l<a.length;)if(a[l]===`
110
- `){const m=a.substring(0,l);s.dispatchEvent(new MessageEvent("message",{data:m})),a=a.substring(l+1),l=0}else++l;else{const m=new Uint8Array(c.length+f.length);for(m.set(c),m.set(f,c.length),c=m;;){const b=e.options.decoder.decodeReply(c);if(b.ok){const v=c.slice(0,b.pos);s.dispatchEvent(new MessageEvent("message",{data:v})),c=c.slice(b.pos);continue}break}}}catch(m){s.dispatchEvent(new Event("error",{detail:m})),s.dispatchEvent(new Event("close")),d.close();return}g()}).catch(function(h){s.dispatchEvent(new Event("error",{detail:h})),s.dispatchEvent(new Event("close")),d.close()})}return g()}})}).catch(o=>{s.dispatchEvent(new Event("error",{detail:o})),s.dispatchEvent(new Event("close"))}),s}supported(){return this.options.fetch!==null&&this.options.readableStream!==null&&typeof TextDecoder<"u"&&typeof AbortController<"u"&&typeof EventTarget<"u"&&typeof Event<"u"&&typeof MessageEvent<"u"&&typeof Error<"u"}initialize(e,t,r){this._protocol=e,this._abortController=new AbortController;let s,i;e==="json"?(s={Accept:"application/json","Content-Type":"application/json"},i=r):(s={Accept:"application/octet-stream","Content-Type":"application/octet-stream"},i=r);const o={method:"POST",headers:s,body:i,mode:"cors",credentials:"same-origin",signal:this._abortController.signal},a=this._fetchEventTarget(this,this.endpoint,o);a.addEventListener("open",()=>{t.onOpen()}),a.addEventListener("error",l=>{this._abortController.abort(),t.onError(l)}),a.addEventListener("close",()=>{this._abortController.abort(),t.onClose({code:4,reason:"connection closed"})}),a.addEventListener("message",l=>{t.onMessage(l.data)})}close(){this._abortController.abort()}send(e,t,r){let s,i;const o={session:t,node:r,data:e};this._protocol==="json"?(s={"Content-Type":"application/json"},i=JSON.stringify(o)):(s={"Content-Type":"application/octet-stream"},i=this.options.encoder.encodeEmulationRequest(o));const a=this.options.fetch,l={method:"POST",headers:s,body:i,mode:"cors",credentials:"same-origin"};a(this.options.emulationEndpoint,l)}}class op{constructor(e,t){this.endpoint=e,this.options=t,this._protocol="json",this._transport=null,this._onClose=null}name(){return"sse"}subName(){return"sse"}emulation(){return!0}supported(){return this.options.eventsource!==null&&this.options.fetch!==null}initialize(e,t,r){let s;globalThis&&globalThis.document&&globalThis.document.baseURI?s=new URL(this.endpoint,globalThis.document.baseURI):s=new URL(this.endpoint),s.searchParams.append("cf_connect",r);const i={},o=new this.options.eventsource(s.toString(),i);this._transport=o;const a=this;o.onopen=function(){t.onOpen()},o.onerror=function(l){o.close(),t.onError(l),t.onClose({code:4,reason:"connection closed"})},o.onmessage=function(l){t.onMessage(l.data)},a._onClose=function(){t.onClose({code:4,reason:"connection closed"})}}close(){this._transport.close(),this._onClose!==null&&this._onClose()}send(e,t,r){const s={session:t,node:r,data:e},i={"Content-Type":"application/json"},o=JSON.stringify(s),a=this.options.fetch,l={method:"POST",headers:i,body:o,mode:"cors",credentials:"same-origin"};a(this.options.emulationEndpoint,l)}}class ap{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null,this._stream=null,this._writer=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"webtransport"}subName(){return"webtransport"}emulation(){return!1}supported(){return this.options.webtransport!==void 0&&this.options.webtransport!==null}initialize(e,t){return ke(this,void 0,void 0,function*(){let r;globalThis&&globalThis.document&&globalThis.document.baseURI?r=new URL(this.endpoint,globalThis.document.baseURI):r=new URL(this.endpoint),e==="protobuf"&&r.searchParams.append("cf_protocol","protobuf"),this._protocol=e;const s=new EventTarget;this._transport=new this.options.webtransport(r.toString()),this._transport.closed.then(()=>{t.onClose({code:4,reason:"connection closed"})}).catch(()=>{t.onClose({code:4,reason:"connection closed"})});try{yield this._transport.ready}catch{this.close();return}let i;try{i=yield this._transport.createBidirectionalStream()}catch{this.close();return}this._stream=i,this._writer=this._stream.writable.getWriter(),s.addEventListener("close",()=>{t.onClose({code:4,reason:"connection closed"})}),s.addEventListener("message",o=>{t.onMessage(o.data)}),this._startReading(s),t.onOpen()})}_startReading(e){return ke(this,void 0,void 0,function*(){const t=this._stream.readable.getReader();let r="",s=0,i=new Uint8Array;try{for(;;){const{done:o,value:a}=yield t.read();if(a.length>0)if(this._protocol==="json")for(r+=this._utf8decoder.decode(a);s<r.length;)if(r[s]===`
111
- `){const l=r.substring(0,s);e.dispatchEvent(new MessageEvent("message",{data:l})),r=r.substring(s+1),s=0}else++s;else{const l=new Uint8Array(i.length+a.length);for(l.set(i),l.set(a,i.length),i=l;;){const c=this.options.decoder.decodeReply(i);if(c.ok){const u=i.slice(0,c.pos);e.dispatchEvent(new MessageEvent("message",{data:u})),i=i.slice(c.pos);continue}break}}if(o)break}}catch{e.dispatchEvent(new Event("close"))}})}close(){return ke(this,void 0,void 0,function*(){try{this._writer&&(yield this._writer.close()),this._transport.close()}catch{}})}send(e){return ke(this,void 0,void 0,function*(){let t;this._protocol==="json"?t=new TextEncoder().encode(e+`
112
- `):t=e;try{yield this._writer.write(t)}catch{this.close()}})}}const lp=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,36,-1,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,-1,-1,-1,63,-1];class cp{constructor(e){this.a=e,this.pos=0}haveBytes(){return this.pos<this.a.length}getByte(){const e=this.a[this.pos];if(this.pos++,this.pos>this.a.length)throw new RangeError("out of bounds");return e}getChar(){return String.fromCharCode(this.getByte())}getInt(){let e=0,t;for(;this.haveBytes()&&(t=lp[127&this.getByte()])>=0;)e=(e<<6)+t;return this.pos--,e>>>0}}class up{constructor(){this.a=[]}toByteArray(e){return Array.isArray(e)?this.a:new Uint8Array(this.a)}putArray(e,t,r){for(let s=t;s<r;s++)this.a.push(e[s])}}function dp(n){let e=0,t=0,r=0,s=0,i=0,o=n.length;for(;o>=16;)e=e+n[i+0]|0,t=t+n[i+1]|0,r=r+n[i+2]|0,s=s+n[i+3]|0,e=e+n[i+4]|0,t=t+n[i+5]|0,r=r+n[i+6]|0,s=s+n[i+7]|0,e=e+n[i+8]|0,t=t+n[i+9]|0,r=r+n[i+10]|0,s=s+n[i+11]|0,e=e+n[i+12]|0,t=t+n[i+13]|0,r=r+n[i+14]|0,s=s+n[i+15]|0,i+=16,o-=16;for(;o>=4;)e=e+n[i+0]|0,t=t+n[i+1]|0,r=r+n[i+2]|0,s=s+n[i+3]|0,i+=4,o-=4;switch(s=((s+(r<<8)|0)+(t<<16)|0)+(e<<24)|0,o){case 3:s=s+(n[i+2]<<8)|0;case 2:s=s+(n[i+1]<<16)|0;case 1:s=s+(n[i+0]<<24)|0}return s>>>0}function hp(n,e){let t=0;const r=new cp(e),s=n.length,i=e.length,o=r.getInt();if(r.getChar()!==`
113
- `)throw new Error("size integer not terminated by '\\n'");const a=new up;for(;r.haveBytes();){const l=r.getInt();let c;switch(r.getChar()){case"@":if(c=r.getInt(),r.haveBytes()&&r.getChar()!==",")throw new Error("copy command not terminated by ','");if(t+=l,t>o)throw new Error("copy exceeds output file size");if(c+l>s)throw new Error("copy extends past end of input");a.putArray(n,c,c+l);break;case":":if(t+=l,t>o)throw new Error("insert command gives an output larger than predicted");if(l>i)throw new Error("insert count exceeds size of delta");a.putArray(r.a,r.pos,r.pos+l),r.pos+=l;break;case";":{const u=a.toByteArray(n);if(l!==dp(u))throw new Error("bad checksum");if(t!==o)throw new Error("generated size does not match predicted size");return u}default:throw new Error("unknown delta operator")}}throw new Error("unterminated delta")}class Tl{name(){return"json"}encodeCommands(e){return e.map(t=>JSON.stringify(t)).join(`
109
+ `,n.getElementsByTagName("head")[0].appendChild(e)),n.body&&ol(n.body,"react-draggable-transparent-selection")}function xf(n){window.requestAnimationFrame?window.requestAnimationFrame(()=>{il(n)}):il(n)}function il(n){if(n)try{if(n.body&&al(n.body,"react-draggable-transparent-selection"),n.selection)n.selection.empty();else{const e=(n.defaultView||window).getSelection();e&&e.type!=="Caret"&&e.removeAllRanges()}}catch{}}function ol(n,e){n.classList?n.classList.add(e):n.className.match(new RegExp(`(?:^|\\s)${e}(?!\\S)`))||(n.className+=` ${e}`)}function al(n,e){n.classList?n.classList.remove(e):n.className=n.className.replace(new RegExp(`(?:^|\\s)${e}(?!\\S)`,"g"),"")}var it={};Object.defineProperty(it,"__esModule",{value:!0}),it.canDragX=Tf,it.canDragY=Sf,it.createCoreData=Ef,it.createDraggableData=Af,it.getBoundPosition=wf,it.getControlPosition=Cf,it.snapToGrid=kf;var je=st,Gt=ue;function wf(n,e,t){if(!n.props.bounds)return[e,t];let{bounds:r}=n.props;r=typeof r=="string"?r:Rf(r);const s=Us(n);if(typeof r=="string"){const{ownerDocument:i}=s,o=i.defaultView;let a;if(r==="parent"?a=s.parentNode:a=s.getRootNode().querySelector(r),!(a instanceof o.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const l=a,c=o.getComputedStyle(s),u=o.getComputedStyle(l);r={left:-s.offsetLeft+(0,je.int)(u.paddingLeft)+(0,je.int)(c.marginLeft),top:-s.offsetTop+(0,je.int)(u.paddingTop)+(0,je.int)(c.marginTop),right:(0,Gt.innerWidth)(l)-(0,Gt.outerWidth)(s)-s.offsetLeft+(0,je.int)(u.paddingRight)-(0,je.int)(c.marginRight),bottom:(0,Gt.innerHeight)(l)-(0,Gt.outerHeight)(s)-s.offsetTop+(0,je.int)(u.paddingBottom)-(0,je.int)(c.marginBottom)}}return(0,je.isNum)(r.right)&&(e=Math.min(e,r.right)),(0,je.isNum)(r.bottom)&&(t=Math.min(t,r.bottom)),(0,je.isNum)(r.left)&&(e=Math.max(e,r.left)),(0,je.isNum)(r.top)&&(t=Math.max(t,r.top)),[e,t]}function kf(n,e,t){const r=Math.round(e/n[0])*n[0],s=Math.round(t/n[1])*n[1];return[r,s]}function Tf(n){return n.props.axis==="both"||n.props.axis==="x"}function Sf(n){return n.props.axis==="both"||n.props.axis==="y"}function Cf(n,e,t){const r=typeof e=="number"?(0,Gt.getTouch)(n,e):null;if(typeof e=="number"&&!r)return null;const s=Us(t),i=t.props.offsetParent||s.offsetParent||s.ownerDocument.body;return(0,Gt.offsetXYFromParent)(r||n,i,t.props.scale)}function Ef(n,e,t){const r=!(0,je.isNum)(n.lastX),s=Us(n);return r?{node:s,deltaX:0,deltaY:0,lastX:e,lastY:t,x:e,y:t}:{node:s,deltaX:e-n.lastX,deltaY:t-n.lastY,lastX:n.lastX,lastY:n.lastY,x:e,y:t}}function Af(n,e){const t=n.props.scale;return{node:e.node,x:n.state.x+e.deltaX/t,y:n.state.y+e.deltaY/t,deltaX:e.deltaX/t,deltaY:e.deltaY/t,lastX:n.state.x,lastY:n.state.y}}function Rf(n){return{left:n.left,top:n.top,right:n.right,bottom:n.bottom}}function Us(n){const e=n.findDOMNode();if(!e)throw new Error("<DraggableCore>: Unmounted during event!");return e}var ir={},or={};Object.defineProperty(or,"__esModule",{value:!0}),or.default=Of;function Of(){}Object.defineProperty(ir,"__esModule",{value:!0}),ir.default=void 0;var zs=ll(nr),Ce=Bs(Ga),Pf=Bs(nr),xe=ue,xt=it,qs=st,bn=Bs(or);function Bs(n){return n&&n.__esModule?n:{default:n}}function ll(n,e){if(typeof WeakMap=="function")var t=new WeakMap,r=new WeakMap;return(ll=function(s,i){if(!i&&s&&s.__esModule)return s;var o,a,l={__proto__:null,default:s};if(s===null||typeof s!="object"&&typeof s!="function")return l;if(o=i?r:t){if(o.has(s))return o.get(s);o.set(s,l)}for(const c in s)c!=="default"&&{}.hasOwnProperty.call(s,c)&&((a=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(s,c))&&(a.get||a.set)?o(l,c,a):l[c]=s[c]);return l})(n,e)}function Ee(n,e,t){return(e=Df(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Df(n){var e=If(n,"string");return typeof e=="symbol"?e:e+""}function If(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}const Je={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let wt=Je.mouse,ar=class extends zs.Component{constructor(){super(...arguments),Ee(this,"dragging",!1),Ee(this,"lastX",NaN),Ee(this,"lastY",NaN),Ee(this,"touchIdentifier",null),Ee(this,"mounted",!1),Ee(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button=="number"&&e.button!==0)return!1;const t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=t;if(this.props.disabled||!(e.target instanceof r.defaultView.Node)||this.props.handle&&!(0,xe.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,xe.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;e.type==="touchstart"&&!this.props.allowMobileScroll&&e.preventDefault();const s=(0,xe.getTouchIdentifier)(e);this.touchIdentifier=s;const i=(0,xt.getControlPosition)(e,s,this);if(i==null)return;const{x:o,y:a}=i,l=(0,xt.createCoreData)(this,o,a);(0,bn.default)("DraggableCore: handleDragStart: %j",l),(0,bn.default)("calling",this.props.onStart),!(this.props.onStart(e,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,xe.addUserSelectStyles)(r),this.dragging=!0,this.lastX=o,this.lastY=a,(0,xe.addEvent)(r,wt.move,this.handleDrag),(0,xe.addEvent)(r,wt.stop,this.handleDragStop))}),Ee(this,"handleDrag",e=>{const t=(0,xt.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:r,y:s}=t;if(Array.isArray(this.props.grid)){let a=r-this.lastX,l=s-this.lastY;if([a,l]=(0,xt.snapToGrid)(this.props.grid,a,l),!a&&!l)return;r=this.lastX+a,s=this.lastY+l}const i=(0,xt.createCoreData)(this,r,s);if((0,bn.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=r,this.lastY=s}),Ee(this,"handleDragStop",e=>{if(!this.dragging)return;const t=(0,xt.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:r,y:s}=t;if(Array.isArray(this.props.grid)){let l=r-this.lastX||0,c=s-this.lastY||0;[l,c]=(0,xt.snapToGrid)(this.props.grid,l,c),r=this.lastX+l,s=this.lastY+c}const i=(0,xt.createCoreData)(this,r,s);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;const a=this.findDOMNode();a&&this.props.enableUserSelectHack&&(0,xe.scheduleRemoveUserSelectStyles)(a.ownerDocument),(0,bn.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&((0,bn.default)("DraggableCore: Removing handlers"),(0,xe.removeEvent)(a.ownerDocument,wt.move,this.handleDrag),(0,xe.removeEvent)(a.ownerDocument,wt.stop,this.handleDragStop))}),Ee(this,"onMouseDown",e=>(wt=Je.mouse,this.handleDragStart(e))),Ee(this,"onMouseUp",e=>(wt=Je.mouse,this.handleDragStop(e))),Ee(this,"onTouchStart",e=>(wt=Je.touch,this.handleDragStart(e))),Ee(this,"onTouchEnd",e=>(wt=Je.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,xe.addEvent)(e,Je.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;(0,xe.removeEvent)(t,Je.mouse.move,this.handleDrag),(0,xe.removeEvent)(t,Je.touch.move,this.handleDrag),(0,xe.removeEvent)(t,Je.mouse.stop,this.handleDragStop),(0,xe.removeEvent)(t,Je.touch.stop,this.handleDragStop),(0,xe.removeEvent)(e,Je.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,xe.scheduleRemoveUserSelectStyles)(t)}}findDOMNode(){var e,t,r;return(e=this.props)!=null&&e.nodeRef?(r=(t=this.props)==null?void 0:t.nodeRef)==null?void 0:r.current:Pf.default.findDOMNode(this)}render(){return zs.cloneElement(zs.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};ir.default=ar,Ee(ar,"displayName","DraggableCore"),Ee(ar,"propTypes",{allowAnyClick:Ce.default.bool,allowMobileScroll:Ce.default.bool,children:Ce.default.node.isRequired,disabled:Ce.default.bool,enableUserSelectHack:Ce.default.bool,offsetParent:function(n,e){if(n[e]&&n[e].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Ce.default.arrayOf(Ce.default.number),handle:Ce.default.string,cancel:Ce.default.string,nodeRef:Ce.default.object,onStart:Ce.default.func,onDrag:Ce.default.func,onStop:Ce.default.func,onMouseDown:Ce.default.func,scale:Ce.default.number,className:qs.dontSetMe,style:qs.dontSetMe,transform:qs.dontSetMe}),Ee(ar,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),function(n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),n.default=void 0;var e=d(nr),t=u(Ga),r=u(nr),s=Qh,i=ue,o=it,a=st,l=u(ir),c=u(or);function u(v){return v&&v.__esModule?v:{default:v}}function d(v,x){if(typeof WeakMap=="function")var w=new WeakMap,k=new WeakMap;return(d=function(_,S){if(!S&&_&&_.__esModule)return _;var P,T,A={__proto__:null,default:_};if(_===null||typeof _!="object"&&typeof _!="function")return A;if(P=S?k:w){if(P.has(_))return P.get(_);P.set(_,A)}for(const D in _)D!=="default"&&{}.hasOwnProperty.call(_,D)&&((T=(P=Object.defineProperty)&&Object.getOwnPropertyDescriptor(_,D))&&(T.get||T.set)?P(A,D,T):A[D]=_[D]);return A})(v,x)}function g(){return g=Object.assign?Object.assign.bind():function(v){for(var x=1;x<arguments.length;x++){var w=arguments[x];for(var k in w)({}).hasOwnProperty.call(w,k)&&(v[k]=w[k])}return v},g.apply(null,arguments)}function h(v,x,w){return(x=f(x))in v?Object.defineProperty(v,x,{value:w,enumerable:!0,configurable:!0,writable:!0}):v[x]=w,v}function f(v){var x=m(v,"string");return typeof x=="symbol"?x:x+""}function m(v,x){if(typeof v!="object"||!v)return v;var w=v[Symbol.toPrimitive];if(w!==void 0){var k=w.call(v,x);if(typeof k!="object")return k;throw new TypeError("@@toPrimitive must return a primitive value.")}return(x==="string"?String:Number)(v)}class b extends e.Component{static getDerivedStateFromProps(x,w){let{position:k}=x,{prevPropsPosition:_}=w;return k&&(!_||k.x!==_.x||k.y!==_.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:k,prevPropsPosition:_}),{x:k.x,y:k.y,prevPropsPosition:{...k}}):null}constructor(x){super(x),h(this,"onDragStart",(w,k)=>{if((0,c.default)("Draggable: onDragStart: %j",k),this.props.onStart(w,(0,o.createDraggableData)(this,k))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),h(this,"onDrag",(w,k)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",k);const _=(0,o.createDraggableData)(this,k),S={x:_.x,y:_.y,slackX:0,slackY:0};if(this.props.bounds){const{x:T,y:A}=S;S.x+=this.state.slackX,S.y+=this.state.slackY;const[D,E]=(0,o.getBoundPosition)(this,S.x,S.y);S.x=D,S.y=E,S.slackX=this.state.slackX+(T-S.x),S.slackY=this.state.slackY+(A-S.y),_.x=S.x,_.y=S.y,_.deltaX=S.x-this.state.x,_.deltaY=S.y-this.state.y}if(this.props.onDrag(w,_)===!1)return!1;this.setState(S)}),h(this,"onDragStop",(w,k)=>{if(!this.state.dragging||this.props.onStop(w,(0,o.createDraggableData)(this,k))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",k);const S={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:T,y:A}=this.props.position;S.x=T,S.y=A}this.setState(S)}),this.state={dragging:!1,dragged:!1,x:x.position?x.position.x:x.defaultPosition.x,y:x.position?x.position.y:x.defaultPosition.y,prevPropsPosition:{...x.position},slackX:0,slackY:0,isElementSVG:!1},x.position&&!(x.onDrag||x.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){var x,w;return((w=(x=this.props)==null?void 0:x.nodeRef)==null?void 0:w.current)??r.default.findDOMNode(this)}render(){const{axis:x,bounds:w,children:k,defaultPosition:_,defaultClassName:S,defaultClassNameDragging:P,defaultClassNameDragged:T,position:A,positionOffset:D,scale:E,...j}=this.props;let Z={},se=null;const G=!!!A||this.state.dragging,ve=A||_,de={x:(0,o.canDragX)(this)&&G?this.state.x:ve.x,y:(0,o.canDragY)(this)&&G?this.state.y:ve.y};this.state.isElementSVG?se=(0,i.createSVGTransform)(de,D):Z=(0,i.createCSSTransform)(de,D);const qe=(0,s.clsx)(k.props.className||"",S,{[P]:this.state.dragging,[T]:this.state.dragged});return e.createElement(l.default,g({},j,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(k),{className:qe,style:{...k.props.style,...Z},transform:se}))}}n.default=b,h(b,"displayName","Draggable"),h(b,"propTypes",{...l.default.propTypes,axis:t.default.oneOf(["both","x","y","none"]),bounds:t.default.oneOfType([t.default.shape({left:t.default.number,right:t.default.number,top:t.default.number,bottom:t.default.number}),t.default.string,t.default.oneOf([!1])]),defaultClassName:t.default.string,defaultClassNameDragging:t.default.string,defaultClassNameDragged:t.default.string,defaultPosition:t.default.shape({x:t.default.number,y:t.default.number}),positionOffset:t.default.shape({x:t.default.oneOfType([t.default.number,t.default.string]),y:t.default.oneOfType([t.default.number,t.default.string])}),position:t.default.shape({x:t.default.number,y:t.default.number}),className:a.dontSetMe,style:a.dontSetMe,transform:a.dontSetMe}),h(b,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})}(la);const{default:cl,DraggableCore:$f}=la;er.exports=cl,er.exports.default=cl,er.exports.DraggableCore=$f;var Nf=er.exports;const Mf=co(Nf),Ff=({chatbot:n,message:e})=>{const t=Qe(null),[r,s]=M(""),{thinking:i=[],text:o=""}=e.data;return be(()=>{const a=K.parse(o||"");typeof a=="string"?s(a):a.then(s)},[o]),p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:n.appearance.images.popupChat,alt:"Bot"})}),p("div",{className:"messageDiv ",children:p("div",{className:"messageP markdownText ai-generating",children:[i.length>0&&p("div",{className:"thinkingContainer",ref:t,children:i.map((a,l)=>p("div",{className:"thinkingChunk",children:["• ",a]},l))}),r&&p("div",{dangerouslySetInnerHTML:{__html:r}})]})})]})},Lf=({message:n,type:e,onDismiss:t})=>{const[r,s]=M(!0);return be(()=>{const i=setTimeout(()=>{s(!1),t()},4e3);return()=>clearTimeout(i)},[t]),r?p("div",{className:`robodialog-toast robodialog-toast-${e}`,children:[p("span",{className:"robodialog-toast-message",children:n}),p("button",{className:"robodialog-toast-close",onClick:()=>{s(!1),t()},children:"×"})]}):null},jf=()=>{const[n,e]=M([]),t=Bt((i,o="info")=>{const a=`${Date.now()}-${Math.random().toString(36).substring(2,9)}`;e(l=>[...l,{id:a,message:i,type:o}]),setTimeout(()=>{r(a)},4e3)},[]),r=Bt(i=>{e(o=>o.filter(a=>a.id!==i))},[]);return{showToast:t,ToastContainer:()=>n.length===0?null:p(ke,{children:n.map(i=>p(Lf,{message:i.message,type:i.type,onDismiss:()=>r(i.id)},i.id))}),dismissToast:r}},Uf=({handleChangeConversation:n,coreState:e,conversationState:t,uiState:r,showToast:s})=>{var br;const i=Qe(null),[o,a]=M(null),[l,c]=M(!1),[u,d]=M(!1),[g,h]=M("auto"),[f,m]=M(""),{chatbot:b,token:v,fileSizeLimit:x,userData:w,isChatbotDefault:k,isDefaultExternalAPI:_}=e,{messageCallOneTime:S,messages:P,currentConversation:T,messagesRef:A,setMessages:D}=t,{ratingFromUser:E,canMessage:j,setCanMessage:Z,humanControl:se,aiLoading:Re,hoveringMessageInner:G,userLoading:ve,dataFromUser:de,setHoveringMessageInner:qe,onlineAgents:C,setOnlineAgents:R,callChatFlowRef:$,callChatFlow:F,setCallChatFlow:I,setHumanControl:q,setAiLoading:U,setUserLoading:z,setDataFromUser:H,setRatingFromUser:X}=r,W=b.chatflow.nodes.find(B=>B.type==="AIControlNode"),ae=(P&&T?P.filter(B=>B.conversationId===T._id):[]).sort((B,he)=>new Date(he.createdAt||"").getTime()-new Date(B.createdAt||"").getTime()),O=B=>{var ot;const he=B.target,Ne=(ot=he.files)==null?void 0:ot[0];if(Ne&&!/^image\//.test(Ne.type)){a(null),s("Only image files are allowed","error");return}if(Ne){if(Ne.size>x*1024*1024){d(!0),setTimeout(()=>d(!1),3e3),he.value="";return}a(Ne),he.value=""}},$e=Bt(B=>{const he=B.currentTarget;m(he.value),requestAnimationFrame(()=>{he.style.height="auto",he.style.height=`${he.scrollHeight}px`,h(`${he.scrollHeight}px`)})},[m]),gt=B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),f.trim()&&cs({coreState:e,conversationState:t,uiState:r,userMessage:f,setUserMessage:m,file:o,setFile:a,showToast:s,latestCurrentConversation:T}))};async function Lt(){var Ne,ot,mt;if(!T||(Ne=S.current)!=null&&Ne.call)return;const B=((ot=S.current)==null?void 0:ot.messagesCount[T._id])||-1,he=((mt=S.current)==null?void 0:mt.messagesLength[T._id])||0;if(!(B<=he&&B!==-1))try{c(!0),S.current.call=!0;const vn=he===1?0:he,Be=await as.userReadAll({body:{conversationId:T._id,skip:vn}},v);if(!Be.data)throw new Error("Failed to load messages");D(ie=>{const le=new Set(ie.map(lt=>lt._id)),at=Be.data.messages.filter(lt=>!le.has(lt._id)),bt=[...ie,...at];return A.current=bt,bt}),S.current.messagesCount[T._id]=Be.data.count}catch{s("Failed to load messages","error")}finally{S.current.call=!1,c(!1)}}function mr(){n(null),Z(!1),m(""),q(!1),U(!1),qe(null),z(!1),H(null),R(0),X(null),a(null)}return be(()=>{$.current&&T&&!k&&(Yn({coreState:e,conversationState:t,uiState:r,showToast:s}),$.current=!1)},[T]),be(()=>{if(!T||k)return;if(_){Yn({coreState:e,conversationState:t,uiState:r,showToast:s});return}F&&(Lt(),Yn({coreState:e,conversationState:t,uiState:r,showToast:s}),I(!1));const B=i.current;if(!B||B.scrollEventAdded)return;let he;const Ne=ot=>{const mt=ot.target;mt.scrollTop*-1+mt.clientHeight===mt.scrollHeight&&Lt()};return he=requestAnimationFrame(()=>{B.addEventListener("scroll",Ne),B.scrollEventAdded=!0}),()=>{cancelAnimationFrame(he),B.removeEventListener("scroll",Ne)}},[F,T==null?void 0:T._id]),be(()=>{if(!(ae!=null&&ae.length))return;S.current.messagesLength[(T==null?void 0:T._id)||""]=ae.length;const B=ae[0];B.owner==="agent"&&!B.seen&&Cd(B,e,t,r,s)},[ae.length]),T?p("div",{className:"conversationDetails",children:[p("div",{className:"conversationDetailsHeader",children:[p("div",{onClick:mr,style:{pointerEvents:Re||_?"none":"",opacity:Re||_?"0.5":"1"},children:p(Fo,{className:"background-text-color"})}),p("div",{style:{display:"flex",gap:"5px",alignItems:"center",color:b.appearance.color.backgroundText},children:[p(_h,{chatbot:b,humanControl:se,latestCurrentConversation:T}),"Controlled By ",T!=null&&T.assignedTo?"Human":"AI"]}),p("div",{style:{width:"21px"}})]}),p("div",{className:"livelinkMsgs",ref:i,children:[G&&j&&!(T!=null&&T.assignedTo)&&!o&&p(Ch,{hoveringMessageInner:G,chatbot:b}),Re&&!((br=ae[0])!=null&&br._id.startsWith("streaming_"))&&p(kh,{chatbot:b}),ve&&p(wh,{chatbot:b}),de&&!(T!=null&&T.assignedTo)&&p(vh,{email:(w==null?void 0:w.email)||"",chatbot:b,dataFromUser:de}),E&&!(T!=null&&T.assignedTo)&&p(yh,{chatbot:b,ratingFromUser:E}),(T==null?void 0:T.assignType)&&!(T!=null&&T.assignedTo)&&p(xh,{currentConversation:T,chatbot:b,onlineAgents:C}),ae.map((B,he)=>{if(B._id.startsWith("streaming_"))return p(Ff,{chatbot:b,message:B},B._id);if(!B.data.path)return p(Th,{AIControlNode:W,chatbot:b,message:B},B._id||he)}),l&&p(Sh,{chatbot:b})]}),p("div",{children:[o&&p(Eh,{file:o,setFile:a,chatbot:b}),p("div",{className:"massageInputDivMain",style:{opacity:j||T!=null&&T.assignedTo?"1":"0.7",pointerEvents:j||T!=null&&T.assignedTo?"all":"none"},children:p("form",{onSubmit:B=>{B.preventDefault(),f.trim()&&cs({coreState:e,conversationState:t,uiState:r,userMessage:f,setUserMessage:m,file:o,setFile:a,latestCurrentConversation:T,showToast:s})},children:[p("textarea",{style:{height:g},placeholder:u?"File Size Limit Reached":b.appearance.text.messagePlaceholder,maxLength:500,onChange:$e,onKeyDown:gt,value:f,rows:1,disabled:u}),p("input",{type:"file",onChange:O,style:{display:"none"},id:"fileUpload",accept:"image/*"}),(T==null?void 0:T.assignedTo)&&p("label",{className:"inputArrowMassageImg attachment",htmlFor:"fileUpload",children:p(ud,{className:"input-text-color"})}),p("button",{className:"inputArrowMassageImg",type:"submit",disabled:!f.trim(),children:p(cd,{className:"input-text-color"})})]})})]})]}):null},zf=({handleChangeConversation:n,coreState:e,conversationState:t,uiState:r,showToast:s})=>{const{chatbot:i,token:o}=e,{setConversations:a,setCurrentConversation:l,conversations:c,messages:u,totalConversationsCount:d,setTotalConversationsCount:g,setMessages:h}=t,{setCallChatFlow:f}=r,[m,b]=M(!1),[v,x]=M(!1),[w,k]=M(!1);return p("div",{className:"conversationMain",children:[p("button",{className:"newConversationBtn",onClick:async()=>{var P,T,A,D;if(!(v||m))try{x(!0);const E=await It.userCreate({body:{}},o);if(!E.data)throw new Error("Conversation creation failed");const j=E.data;l(j),a(Z=>[...Z,j]),f(!0)}catch(E){((T=(P=E.response)==null?void 0:P.data)==null?void 0:T.error)==="Limit Reached"&&b(!0),s(((D=(A=E.response)==null?void 0:A.data)==null?void 0:D.message)||"Failed to create conversation","error")}finally{x(!1)}},children:v?p("div",{className:"newConversationLoading",children:p(cn,{className:"base-text-color",width:13,height:13})}):m?"Limit Reached":"+ Conversation"}),p(gh,{conversations:c,chatbot:i,handleChangeConversation:n,messages:u,totalConversationsCount:d,conversationsLoading:w,loadMoreConversations:async()=>{if(!w)try{k(!0);const P=await It.userReadAll(o,{query:{skip:c.length.toString()}});if(!P.data)throw new Error("Failed to load conversations");h(T=>{const A=[...T,...P.data.messages];return t.messagesRef.current=A,A}),a(T=>[...T,...P.data.conversations]),g(P.data.count)}catch{s("Failed to load conversations","error")}finally{k(!1)}}})]})},qf=({chatOpen:n,coreState:e,conversationState:t,uiState:r,isMobileVersion:s,fullScreen:i})=>{const{showToast:o,ToastContainer:a}=jf(),{chatbot:l,token:c,isChatbotDefault:u}=e,{setCallChatFlow:d}=r,{setMessages:g,messagesRef:h,setConversations:f,setTotalConversationsCount:m,setCurrentConversation:b}=t,[v,x]=M(!u),w=_=>{b(_),_!==null&&!u&&d(!0)},k=async()=>{try{x(!0);const _=await It.userReadAll(c);if(!_.data)throw new Error("Failed to load conversations");const S=_.data.messages||[];h.current=S,g(S),f(_.data.conversations||[]),m(_.data.count||0)}catch{o("Failed to initialize conversations","error")}finally{x(!1)}};return be(()=>{u||k()},[c]),p("div",{className:`chatbotConversationContainer ${n?"open":""} ${i?"fullscreen":""}`,style:i?void 0:{maxHeight:`calc(95vh - 70px - ${l.appearance.others.position[s?"mobile":"desktop"].verticalSpace}px)`,maxWidth:`calc(95vw - ${l.appearance.others.position[s?"mobile":"desktop"].horizontalSpace}px)`},children:[p(a,{}),p("div",{className:"top-header",children:[p("h2",{children:l.appearance.text.heading}),p("h4",{children:l.appearance.text.description}),l.appearance.others.showAgents&&p(ys,{className:"mainAgents",chatbot:l})]}),p("div",{className:"liveLinkRightDiv",children:v?p("div",{className:"loadingDiv",children:p(cn,{className:"background-text-color"})}):p(ke,{children:[p(Uf,{handleChangeConversation:w,coreState:e,conversationState:t,uiState:r,showToast:o}),p(zf,{handleChangeConversation:w,coreState:e,conversationState:t,uiState:r,showToast:o})]})}),!l.appearance.others.removePoweredBy&&p("div",{className:"livelinkPoweredDiv2",children:[p("span",{children:"Powered By "}),p("img",{src:dd,alt:"Logo"}),p("a",{href:"https://robodialog.com",target:"_blank",children:"Robodialog"})]})]})},Bf=({coreState:n,conversationState:e,uiState:t,fullScreen:r})=>{var A;const[s,i]=M(!1),[o,a]=M(!0),l=Mr("robodialog-chatbot-opened"),[c,u]=M(null),{userData:d,chatbot:g}=n,{newMessage:h,setNewMessage:f}=e,{setInteracted:m,chatOpen:b,setChatOpen:v}=t,x=g.chatflow.nodes.find(D=>d!=null&&d.isUser?D.type==="StartNode"&&D.data.channel.users:D.type==="StartNode"&&D.data.channel.visitors),w=((A=x==null?void 0:x.data)==null?void 0:A.hoveringMessage)||null,k=()=>{v(!b)};typeof window<"u"&&(window.robodialog={...window.robodialog||{},openChat:k});const _=g.appearance.others.position,S=_[s?"mobile":"desktop"].position==="bottomleft",P={alignItems:s?_.mobile.position==="bottomleft"?"flex-start":"flex-end":_.desktop.position==="bottomleft"?"flex-start":"flex-end",bottom:s?`${_.mobile.verticalSpace}px`:`${_.desktop.verticalSpace}px`,[S?"left":"right"]:s?`${_.mobile.horizontalSpace}px`:`${_.desktop.horizontalSpace}px`};be(()=>{const D=()=>{i(window.innerWidth<_.mobileStartsFrom)};return D(),window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[_.mobileStartsFrom]),be(()=>{b&&(m(!0),a(!1),Tn("robodialog-chatbot-opened",!0))},[b]),be(()=>{var D,E,j,Z;if(h&&((E=(D=x==null?void 0:x.data)==null?void 0:D.popupMessage)!=null&&E.value)){const se=(Z=(j=x==null?void 0:x.data)==null?void 0:j.popupMessage)==null?void 0:Z.duration;c&&clearTimeout(c);const Re=window.setTimeout(()=>{f(null)},se*1e3);u(Re)}return()=>{c&&clearTimeout(c)}},[h]),be(()=>{var E;const D=(E=x==null?void 0:x.data)==null?void 0:E.automaticallyOpenConversation;!(D!=null&&D.value)||r||(D.type==="allTheTime"||D.type==="oncePerVisit"&&!l)&&(v(!0),a(!1),Tn("robodialog-chatbot-opened",!0))},[]),be(()=>{r&&v(!0)},[r,v]);const T=p("div",{className:`chatbotMain ${r?"fullscreen":""}`,style:r?void 0:P,children:[p(qf,{chatOpen:b,coreState:n,conversationState:e,uiState:t,isMobileVersion:s,fullScreen:r}),!r&&p(ke,{children:[p(Ah,{chatbot:g,showHoveringMessage:o,hoveringMessages:w,setShowHoveringMessage:a,coreState:n,conversationState:e,uiState:t,node:x,setChatOpen:v}),p("div",{className:"chatbotChat",style:{flexDirection:S?"row-reverse":"row"},children:[p("div",{className:"chatbotDrag handle",children:p(ld,{className:"background-text-color",width:10})}),p("div",{className:"chatbotChatInside",onClick:k,children:[p("img",{src:g.appearance.images.chat,alt:"Chat",style:{display:b?"none":"block"}}),p(od,{className:"background-text-color",style:{display:b?"block":"none"}})]})]})]})]});return r?T:p(Mf,{axis:"both",handle:".handle",defaultPosition:{x:0,y:0},position:b?{x:0,y:0}:void 0,scale:1,bounds:".robodialog-chatbot-app",children:T})};function we(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(n,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;function Hf(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Hs={exports:{}},Kt=typeof Reflect=="object"?Reflect:null,ul=Kt&&typeof Kt.apply=="function"?Kt.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},lr;Kt&&typeof Kt.ownKeys=="function"?lr=Kt.ownKeys:Object.getOwnPropertySymbols?lr=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:lr=function(e){return Object.getOwnPropertyNames(e)};function Wf(n){console&&console.warn&&console.warn(n)}var dl=Number.isNaN||function(e){return e!==e};function te(){te.init.call(this)}Hs.exports=te,Hs.exports.once=Jf,te.EventEmitter=te,te.prototype._events=void 0,te.prototype._eventsCount=0,te.prototype._maxListeners=void 0;var hl=10;function cr(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(te,"defaultMaxListeners",{enumerable:!0,get:function(){return hl},set:function(n){if(typeof n!="number"||n<0||dl(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");hl=n}}),te.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},te.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||dl(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function fl(n){return n._maxListeners===void 0?te.defaultMaxListeners:n._maxListeners}te.prototype.getMaxListeners=function(){return fl(this)},te.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var s=e==="error",i=this._events;if(i!==void 0)s=s&&i.error===void 0;else if(!s)return!1;if(s){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=i[e];if(l===void 0)return!1;if(typeof l=="function")ul(l,this,t);else for(var c=l.length,u=_l(l,c),r=0;r<c;++r)ul(u[r],this,t);return!0};function pl(n,e,t,r){var s,i,o;if(cr(t),i=n._events,i===void 0?(i=n._events=Object.create(null),n._eventsCount=0):(i.newListener!==void 0&&(n.emit("newListener",e,t.listener?t.listener:t),i=n._events),o=i[e]),o===void 0)o=i[e]=t,++n._eventsCount;else if(typeof o=="function"?o=i[e]=r?[t,o]:[o,t]:r?o.unshift(t):o.push(t),s=fl(n),s>0&&o.length>s&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=o.length,Wf(a)}return n}te.prototype.addListener=function(e,t){return pl(this,e,t,!1)},te.prototype.on=te.prototype.addListener,te.prototype.prependListener=function(e,t){return pl(this,e,t,!0)};function Vf(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function gl(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},s=Vf.bind(r);return s.listener=t,r.wrapFn=s,s}te.prototype.once=function(e,t){return cr(t),this.on(e,gl(this,e,t)),this},te.prototype.prependOnceListener=function(e,t){return cr(t),this.prependListener(e,gl(this,e,t)),this},te.prototype.removeListener=function(e,t){var r,s,i,o,a;if(cr(t),s=this._events,s===void 0)return this;if(r=s[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;i===0?r.shift():Yf(r,i),r.length===1&&(s[e]=r[0]),s.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this},te.prototype.off=te.prototype.removeListener,te.prototype.removeAllListeners=function(e){var t,r,s;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var i=Object.keys(r),o;for(s=0;s<i.length;++s)o=i[s],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=r[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(s=t.length-1;s>=0;s--)this.removeListener(e,t[s]);return this};function ml(n,e,t){var r=n._events;if(r===void 0)return[];var s=r[e];return s===void 0?[]:typeof s=="function"?t?[s.listener||s]:[s]:t?Xf(s):_l(s,s.length)}te.prototype.listeners=function(e){return ml(this,e,!0)},te.prototype.rawListeners=function(e){return ml(this,e,!1)},te.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):bl.call(n,e)},te.prototype.listenerCount=bl;function bl(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}te.prototype.eventNames=function(){return this._eventsCount>0?lr(this._events):[]};function _l(n,e){for(var t=new Array(e),r=0;r<e;++r)t[r]=n[r];return t}function Yf(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function Xf(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}function Jf(n,e){return new Promise(function(t,r){function s(o){n.removeListener(e,i),r(o)}function i(){typeof n.removeListener=="function"&&n.removeListener("error",s),t([].slice.call(arguments))}vl(n,e,i,{once:!0}),e!=="error"&&Zf(n,s,{once:!0})})}function Zf(n,e,t){typeof n.on=="function"&&vl(n,"error",e,t)}function vl(n,e,t,r){if(typeof n.on=="function")r.once?n.once(e,t):n.on(e,t);else if(typeof n.addEventListener=="function")n.addEventListener(e,function s(i){r.once&&n.removeEventListener(e,s),t(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}var Gf=Hs.exports,yl=Hf(Gf),oe;(function(n){n[n.timeout=1]="timeout",n[n.transportClosed=2]="transportClosed",n[n.clientDisconnected=3]="clientDisconnected",n[n.clientClosed=4]="clientClosed",n[n.clientConnectToken=5]="clientConnectToken",n[n.clientRefreshToken=6]="clientRefreshToken",n[n.subscriptionUnsubscribed=7]="subscriptionUnsubscribed",n[n.subscriptionSubscribeToken=8]="subscriptionSubscribeToken",n[n.subscriptionRefreshToken=9]="subscriptionRefreshToken",n[n.transportWriteError=10]="transportWriteError",n[n.connectionClosed=11]="connectionClosed",n[n.badConfiguration=12]="badConfiguration"})(oe||(oe={}));var kt;(function(n){n[n.connectCalled=0]="connectCalled",n[n.transportClosed=1]="transportClosed",n[n.noPing=2]="noPing",n[n.subscribeTimeout=3]="subscribeTimeout",n[n.unsubscribeError=4]="unsubscribeError"})(kt||(kt={}));var _n;(function(n){n[n.disconnectCalled=0]="disconnectCalled",n[n.unauthorized=1]="unauthorized",n[n.badProtocol=2]="badProtocol",n[n.messageSizeLimit=3]="messageSizeLimit"})(_n||(_n={}));var ur;(function(n){n[n.subscribeCalled=0]="subscribeCalled",n[n.transportClosed=1]="transportClosed"})(ur||(ur={}));var dr;(function(n){n[n.unsubscribeCalled=0]="unsubscribeCalled",n[n.unauthorized=1]="unauthorized",n[n.clientClosed=2]="clientClosed"})(dr||(dr={}));var Ws;(function(n){n[n.channelCompaction=1]="channelCompaction"})(Ws||(Ws={}));var ge;(function(n){n.Disconnected="disconnected",n.Connecting="connecting",n.Connected="connected"})(ge||(ge={}));var Ae;(function(n){n.Unsubscribed="unsubscribed",n.Subscribing="subscribing",n.Subscribed="subscribed"})(Ae||(Ae={}));function Kf(n,e){return n.lastIndexOf(e,0)===0}function xl(n){return n==null?!1:typeof n=="function"}function Qf(n,e){if(globalThis.console){const t=globalThis.console[n];xl(t)&&t.apply(globalThis.console,e)}}function ep(n,e){return Math.floor(Math.random()*(e-n+1)+n)}function hr(n,e,t){n>31&&(n=31);const r=ep(0,Math.min(t,e*Math.pow(2,n)));return Math.min(t,e+r)}function tp(n){return"error"in n&&n.error!==null}function fr(n){return Math.min(n*1e3,2147483647)}class np extends yl{constructor(e,t,r){super(),this._resubscribeTimeout=null,this._refreshTimeout=null,this.channel=t,this.state=Ae.Unsubscribed,this._centrifuge=e,this._token="",this._getToken=null,this._data=null,this._getData=null,this._recover=!1,this._offset=null,this._epoch=null,this._id=0,this._recoverable=!1,this._positioned=!1,this._joinLeave=!1,this._minResubscribeDelay=500,this._maxResubscribeDelay=2e4,this._resubscribeTimeout=null,this._resubscribeAttempts=0,this._promises={},this._promiseId=0,this._inflight=!1,this._refreshTimeout=null,this._delta="",this._delta_negotiated=!1,this._tagsFilter=null,this._prevValue=null,this._unsubPromise=Promise.resolve(),this._setOptions(r),this._centrifuge._debugEnabled?(this.on("state",s=>{this._debug("subscription state",t,s.oldState,"->",s.newState)}),this.on("error",s=>{this._debug("subscription error",t,s)})):this.on("error",function(){Function.prototype()})}ready(e){return this.state===Ae.Unsubscribed?Promise.reject({code:oe.subscriptionUnsubscribed,message:this.state}):this.state===Ae.Subscribed?Promise.resolve():new Promise((t,r)=>{const s={resolve:t,reject:r};e&&(s.timeout=setTimeout(function(){r({code:oe.timeout,message:"timeout"})},e)),this._promises[this._nextPromiseId()]=s})}subscribe(){this._isSubscribed()||(this._resubscribeAttempts=0,this._setSubscribing(ur.subscribeCalled,"subscribe called"))}unsubscribe(){this._unsubPromise=this._setUnsubscribed(dr.unsubscribeCalled,"unsubscribe called",!0)}publish(e){return we(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.publish(this.channel,e)})}presence(){return we(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.presence(this.channel)})}presenceStats(){return we(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.presenceStats(this.channel)})}history(e){return we(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.history(this.channel,e)})}setTagsFilter(e){if(e&&this._delta)throw new Error("cannot use delta and tagsFilter together");this._tagsFilter=e}setData(e){this._data=e}_methodCall(){return this._isSubscribed()?Promise.resolve():this._isUnsubscribed()?Promise.reject({code:oe.subscriptionUnsubscribed,message:this.state}):new Promise((e,t)=>{const r=this._centrifuge._config.timeout,s=setTimeout(()=>{t({code:oe.timeout,message:"timeout"})},r);this._promises[this._nextPromiseId()]={timeout:s,resolve:e,reject:t}})}_nextPromiseId(){return++this._promiseId}_needRecover(){return this._recover===!0}_isUnsubscribed(){return this.state===Ae.Unsubscribed}_isSubscribing(){return this.state===Ae.Subscribing}_isSubscribed(){return this.state===Ae.Subscribed}_setState(e){if(this.state!==e){const t=this.state;return this.state=e,this.emit("state",{newState:e,oldState:t,channel:this.channel}),!0}return!1}_usesToken(){return this._token!==""||this._getToken!==null}_clearSubscribingState(){this._resubscribeAttempts=0,this._clearResubscribeTimeout()}_clearSubscribedState(){this._clearRefreshTimeout()}_setSubscribed(e){if(!this._isSubscribing())return;this._clearSubscribingState(),e.id&&(this._id=e.id),e.recoverable&&(this._recover=!0,this._offset=e.offset||0,this._epoch=e.epoch||""),e.delta?this._delta_negotiated=!0:this._delta_negotiated=!1,this._setState(Ae.Subscribed);const t=this._centrifuge._getSubscribeContext(this.channel,e);this.emit("subscribed",t),this._resolvePromises();const r=e.publications;if(r&&r.length>0)for(const s in r)r.hasOwnProperty(s)&&this._handlePublication(r[s]);e.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),fr(e.ttl)))}_setSubscribing(e,t){return we(this,void 0,void 0,function*(){this._isSubscribing()||(this._isSubscribed()&&this._clearSubscribedState(),this._setState(Ae.Subscribing)&&this.emit("subscribing",{channel:this.channel,code:e,reason:t}),this._centrifuge._transport&&this._centrifuge._transport.emulation()&&(yield this._unsubPromise),this._isSubscribing()&&this._subscribe())})}_subscribe(){return this._debug("subscribing on",this.channel),this._isTransportOpen()?this._inflight?null:(this._inflight=!0,this._canSubscribeWithoutGettingToken()?this._subscribeWithoutToken():(this._getSubscriptionToken().then(e=>this._handleTokenResponse(e)).catch(e=>this._handleTokenError(e)),null)):(this._debug("delay subscribe on",this.channel,"till connected"),null)}_isTransportOpen(){return this._centrifuge._transportIsOpen}_canSubscribeWithoutGettingToken(){return!this._usesToken()||!!this._token}_subscribeWithoutToken(){return this._getData?(this._getDataAndSubscribe(this._token),null):this._sendSubscribe(this._token)}_getDataAndSubscribe(e){if(!this._getData){this._inflight=!1;return}this._getData({channel:this.channel}).then(t=>{if(!this._isSubscribing()){this._inflight=!1;return}this._data=t,this._sendSubscribe(e)}).catch(t=>this._handleGetDataError(t))}_handleGetDataError(e){if(!this._isSubscribing()){this._inflight=!1;return}if(e instanceof pt){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeData",channel:this.channel,error:{code:oe.badConfiguration,message:(e==null?void 0:e.toString())||""}}),this._inflight=!1,this._scheduleResubscribe()}_handleTokenResponse(e){if(!this._isSubscribing()){this._inflight=!1;return}if(!e){this._inflight=!1,this._failUnauthorized();return}this._token=e,this._getData?this._getDataAndSubscribe(e):this._sendSubscribe(e)}_handleTokenError(e){if(!this._isSubscribing()){this._inflight=!1;return}if(e instanceof pt){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeToken",channel:this.channel,error:{code:oe.subscriptionSubscribeToken,message:(e==null?void 0:e.toString())||""}}),this._inflight=!1,this._scheduleResubscribe()}_sendSubscribe(e){if(!this._isTransportOpen())return this._inflight=!1,null;const t=this._buildSubscribeCommand(e);return this._centrifuge._call(t).then(r=>{this._inflight=!1;const s=r.reply.subscribe;this._handleSubscribeResponse(s),r.next&&r.next()},r=>{this._inflight=!1,this._handleSubscribeError(r.error),r.next&&r.next()}),t}_buildSubscribeCommand(e){const t={channel:this.channel};if(e&&(t.token=e),this._data&&(t.data=this._data),this._positioned&&(t.positioned=!0),this._recoverable&&(t.recoverable=!0),this._joinLeave&&(t.join_leave=!0),t.flag=Ws.channelCompaction,this._needRecover()){t.recover=!0;const r=this._getOffset();r&&(t.offset=r);const s=this._getEpoch();s&&(t.epoch=s)}return this._delta&&(t.delta=this._delta),this._tagsFilter&&(t.tf=this._tagsFilter),{subscribe:t}}_debug(...e){this._centrifuge._debug(...e)}_handleSubscribeError(e){if(this._isSubscribing()){if(e.code===oe.timeout){this._centrifuge._disconnect(kt.subscribeTimeout,"subscribe timeout",!0);return}this._subscribeError(e)}}_handleSubscribeResponse(e){this._isSubscribing()&&this._setSubscribed(e)}_setUnsubscribed(e,t,r){if(this._isUnsubscribed())return Promise.resolve();let s=Promise.resolve();return this._isSubscribed()?(r&&(s=this._centrifuge._unsubscribe(this)),this._clearSubscribedState()):this._isSubscribing()&&(this._inflight&&r&&(s=this._centrifuge._unsubscribe(this)),this._clearSubscribingState()),this._inflight=!1,this._setState(Ae.Unsubscribed)&&this.emit("unsubscribed",{channel:this.channel,code:e,reason:t}),this._rejectPromises({code:oe.subscriptionUnsubscribed,message:this.state}),s}_handlePublication(e){if(this._delta&&this._delta_negotiated){const{newData:r,newPrevValue:s}=this._centrifuge._codec.applyDeltaIfNeeded(e,this._prevValue);e.data=r,this._prevValue=s}const t=this._centrifuge._getPublicationContext(this.channel,e);this.emit("publication",t),e.offset&&(this._offset=e.offset)}_handleJoin(e){const t=this._centrifuge._getJoinLeaveContext(e.info);this.emit("join",{channel:this.channel,info:t})}_handleLeave(e){const t=this._centrifuge._getJoinLeaveContext(e.info);this.emit("leave",{channel:this.channel,info:t})}_resolvePromises(){for(const e in this._promises)this._promises.hasOwnProperty(e)&&(this._promises[e].timeout&&clearTimeout(this._promises[e].timeout),this._promises[e].resolve(),delete this._promises[e])}_rejectPromises(e){for(const t in this._promises)this._promises.hasOwnProperty(t)&&(this._promises[t].timeout&&clearTimeout(this._promises[t].timeout),this._promises[t].reject(e),delete this._promises[t])}_scheduleResubscribe(){if(!this._isSubscribing()){this._debug("not in subscribing state, skip resubscribe scheduling",this.channel);return}const e=this,t=this._getResubscribeDelay();this._resubscribeTimeout=setTimeout(function(){e._isSubscribing()&&e._subscribe()},t),this._debug("resubscribe scheduled after "+t,this.channel)}_subscribeError(e){if(this._isSubscribing())if(e.code<100||e.code===109||e.temporary===!0){e.code===109&&(this._token="");const t={channel:this.channel,type:"subscribe",error:e};this._centrifuge.state===ge.Connected&&this.emit("error",t),this._scheduleResubscribe()}else this._setUnsubscribed(e.code,e.message,!1)}_getResubscribeDelay(){const e=hr(this._resubscribeAttempts,this._minResubscribeDelay,this._maxResubscribeDelay);return this._resubscribeAttempts++,e}_setOptions(e){if(e){if(e.since&&(this._offset=e.since.offset||0,this._epoch=e.since.epoch||"",this._recover=!0),e.data&&(this._data=e.data),e.getData&&(this._getData=e.getData),e.minResubscribeDelay!==void 0&&(this._minResubscribeDelay=e.minResubscribeDelay),e.maxResubscribeDelay!==void 0&&(this._maxResubscribeDelay=e.maxResubscribeDelay),e.token&&(this._token=e.token),e.getToken&&(this._getToken=e.getToken),e.positioned===!0&&(this._positioned=!0),e.recoverable===!0&&(this._recoverable=!0),e.joinLeave===!0&&(this._joinLeave=!0),e.delta){if(e.delta!=="fossil")throw new Error("unsupported delta format");this._delta=e.delta}if(e.tagsFilter&&(this._tagsFilter=e.tagsFilter),this._tagsFilter&&this._delta)throw new Error("cannot use delta and tagsFilter together")}}_getOffset(){const e=this._offset;return e!==null?e:0}_getEpoch(){const e=this._epoch;return e!==null?e:""}_clearRefreshTimeout(){this._refreshTimeout!==null&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearResubscribeTimeout(){this._resubscribeTimeout!==null&&(clearTimeout(this._resubscribeTimeout),this._resubscribeTimeout=null)}_getSubscriptionToken(){this._debug("get subscription token for channel",this.channel);const e={channel:this.channel},t=this._getToken;return t===null?(this.emit("error",{type:"configuration",channel:this.channel,error:{code:oe.badConfiguration,message:"provide a function to get channel subscription token"}}),Promise.reject(new pt(""))):t(e)}_refresh(){this._clearRefreshTimeout();const e=this;this._getSubscriptionToken().then(function(t){if(!e._isSubscribed())return;if(!t){e._failUnauthorized();return}e._token=t;const s={sub_refresh:{channel:e.channel,token:t}};e._centrifuge._call(s).then(i=>{const o=i.reply.sub_refresh;e._refreshResponse(o),i.next&&i.next()},i=>{e._refreshError(i.error),i.next&&i.next()})}).catch(function(t){if(t instanceof pt){e._failUnauthorized();return}e.emit("error",{type:"refreshToken",channel:e.channel,error:{code:oe.subscriptionRefreshToken,message:t!==void 0?t.toString():""}}),e._refreshTimeout=setTimeout(()=>e._refresh(),e._getRefreshRetryDelay())})}_refreshResponse(e){this._isSubscribed()&&(this._debug("subscription token refreshed, channel",this.channel),this._clearRefreshTimeout(),e.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),fr(e.ttl))))}_refreshError(e){this._isSubscribed()&&(e.code<100||e.temporary===!0?(this.emit("error",{type:"refresh",channel:this.channel,error:e}),this._refreshTimeout=setTimeout(()=>this._refresh(),this._getRefreshRetryDelay())):this._setUnsubscribed(e.code,e.message,!0))}_getRefreshRetryDelay(){return hr(0,1e4,2e4)}_failUnauthorized(){this._setUnsubscribed(dr.unauthorized,"unauthorized",!0)}}class rp{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null}name(){return"sockjs"}subName(){return"sockjs-"+this._transport.transport}emulation(){return!1}supported(){return this.options.sockjs!==null}initialize(e,t){this._transport=new this.options.sockjs(this.endpoint,null,this.options.sockjsOptions),this._transport.onopen=()=>{t.onOpen()},this._transport.onerror=r=>{t.onError(r)},this._transport.onclose=r=>{t.onClose(r)},this._transport.onmessage=r=>{t.onMessage(r.data)}}close(){this._transport.close()}send(e){this._transport.send(e)}}class wl{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null}name(){return"websocket"}subName(){return"websocket"}emulation(){return!1}supported(){return this.options.websocket!==void 0&&this.options.websocket!==null}initialize(e,t){let r="";e==="protobuf"&&(r="centrifuge-protobuf"),r!==""?this._transport=new this.options.websocket(this.endpoint,r):this._transport=new this.options.websocket(this.endpoint),e==="protobuf"&&(this._transport.binaryType="arraybuffer"),this._transport.onopen=()=>{t.onOpen()},this._transport.onerror=s=>{t.onError(s)},this._transport.onclose=s=>{t.onClose(s)},this._transport.onmessage=s=>{t.onMessage(s.data)}}close(){this._transport.close()}send(e){this._transport.send(e)}}class sp{constructor(e,t){this.endpoint=e,this.options=t,this._abortController=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"http_stream"}subName(){return"http_stream"}emulation(){return!0}_handleErrors(e){if(!e.ok)throw new Error(e.status);return e}_fetchEventTarget(e,t,r){const s=new EventTarget,i=e.options.fetch;return i(t,r).then(e._handleErrors).then(o=>{s.dispatchEvent(new Event("open"));let a="",l=0,c=new Uint8Array;const u=o.body.getReader();return new e.options.readableStream({start(d){function g(){return u.read().then(({done:h,value:f})=>{if(h){s.dispatchEvent(new Event("close")),d.close();return}try{if(e._protocol==="json")for(a+=e._utf8decoder.decode(f);l<a.length;)if(a[l]===`
110
+ `){const m=a.substring(0,l);s.dispatchEvent(new MessageEvent("message",{data:m})),a=a.substring(l+1),l=0}else++l;else{const m=new Uint8Array(c.length+f.length);for(m.set(c),m.set(f,c.length),c=m;;){const b=e.options.decoder.decodeReply(c);if(b.ok){const v=c.slice(0,b.pos);s.dispatchEvent(new MessageEvent("message",{data:v})),c=c.slice(b.pos);continue}break}}}catch(m){s.dispatchEvent(new Event("error",{detail:m})),s.dispatchEvent(new Event("close")),d.close();return}g()}).catch(function(h){s.dispatchEvent(new Event("error",{detail:h})),s.dispatchEvent(new Event("close")),d.close()})}return g()}})}).catch(o=>{s.dispatchEvent(new Event("error",{detail:o})),s.dispatchEvent(new Event("close"))}),s}supported(){return this.options.fetch!==null&&this.options.readableStream!==null&&typeof TextDecoder<"u"&&typeof AbortController<"u"&&typeof EventTarget<"u"&&typeof Event<"u"&&typeof MessageEvent<"u"&&typeof Error<"u"}initialize(e,t,r){this._protocol=e,this._abortController=new AbortController;let s,i;e==="json"?(s={Accept:"application/json","Content-Type":"application/json"},i=r):(s={Accept:"application/octet-stream","Content-Type":"application/octet-stream"},i=r);const o={method:"POST",headers:s,body:i,mode:"cors",credentials:"same-origin",signal:this._abortController.signal},a=this._fetchEventTarget(this,this.endpoint,o);a.addEventListener("open",()=>{t.onOpen()}),a.addEventListener("error",l=>{this._abortController.abort(),t.onError(l)}),a.addEventListener("close",()=>{this._abortController.abort(),t.onClose({code:4,reason:"connection closed"})}),a.addEventListener("message",l=>{t.onMessage(l.data)})}close(){this._abortController.abort()}send(e,t,r){let s,i;const o={session:t,node:r,data:e};this._protocol==="json"?(s={"Content-Type":"application/json"},i=JSON.stringify(o)):(s={"Content-Type":"application/octet-stream"},i=this.options.encoder.encodeEmulationRequest(o));const a=this.options.fetch,l={method:"POST",headers:s,body:i,mode:"cors",credentials:"same-origin"};a(this.options.emulationEndpoint,l)}}class ip{constructor(e,t){this.endpoint=e,this.options=t,this._protocol="json",this._transport=null,this._onClose=null}name(){return"sse"}subName(){return"sse"}emulation(){return!0}supported(){return this.options.eventsource!==null&&this.options.fetch!==null}initialize(e,t,r){let s;globalThis&&globalThis.document&&globalThis.document.baseURI?s=new URL(this.endpoint,globalThis.document.baseURI):s=new URL(this.endpoint),s.searchParams.append("cf_connect",r);const i={},o=new this.options.eventsource(s.toString(),i);this._transport=o;const a=this;o.onopen=function(){t.onOpen()},o.onerror=function(l){o.close(),t.onError(l),t.onClose({code:4,reason:"connection closed"})},o.onmessage=function(l){t.onMessage(l.data)},a._onClose=function(){t.onClose({code:4,reason:"connection closed"})}}close(){this._transport.close(),this._onClose!==null&&this._onClose()}send(e,t,r){const s={session:t,node:r,data:e},i={"Content-Type":"application/json"},o=JSON.stringify(s),a=this.options.fetch,l={method:"POST",headers:i,body:o,mode:"cors",credentials:"same-origin"};a(this.options.emulationEndpoint,l)}}class op{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null,this._stream=null,this._writer=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"webtransport"}subName(){return"webtransport"}emulation(){return!1}supported(){return this.options.webtransport!==void 0&&this.options.webtransport!==null}initialize(e,t){return we(this,void 0,void 0,function*(){let r;globalThis&&globalThis.document&&globalThis.document.baseURI?r=new URL(this.endpoint,globalThis.document.baseURI):r=new URL(this.endpoint),e==="protobuf"&&r.searchParams.append("cf_protocol","protobuf"),this._protocol=e;const s=new EventTarget;this._transport=new this.options.webtransport(r.toString()),this._transport.closed.then(()=>{t.onClose({code:4,reason:"connection closed"})}).catch(()=>{t.onClose({code:4,reason:"connection closed"})});try{yield this._transport.ready}catch{this.close();return}let i;try{i=yield this._transport.createBidirectionalStream()}catch{this.close();return}this._stream=i,this._writer=this._stream.writable.getWriter(),s.addEventListener("close",()=>{t.onClose({code:4,reason:"connection closed"})}),s.addEventListener("message",o=>{t.onMessage(o.data)}),this._startReading(s),t.onOpen()})}_startReading(e){return we(this,void 0,void 0,function*(){const t=this._stream.readable.getReader();let r="",s=0,i=new Uint8Array;try{for(;;){const{done:o,value:a}=yield t.read();if(a.length>0)if(this._protocol==="json")for(r+=this._utf8decoder.decode(a);s<r.length;)if(r[s]===`
111
+ `){const l=r.substring(0,s);e.dispatchEvent(new MessageEvent("message",{data:l})),r=r.substring(s+1),s=0}else++s;else{const l=new Uint8Array(i.length+a.length);for(l.set(i),l.set(a,i.length),i=l;;){const c=this.options.decoder.decodeReply(i);if(c.ok){const u=i.slice(0,c.pos);e.dispatchEvent(new MessageEvent("message",{data:u})),i=i.slice(c.pos);continue}break}}if(o)break}}catch{e.dispatchEvent(new Event("close"))}})}close(){return we(this,void 0,void 0,function*(){try{this._writer&&(yield this._writer.close()),this._transport.close()}catch{}})}send(e){return we(this,void 0,void 0,function*(){let t;this._protocol==="json"?t=new TextEncoder().encode(e+`
112
+ `):t=e;try{yield this._writer.write(t)}catch{this.close()}})}}const ap=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,36,-1,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,-1,-1,-1,63,-1];class lp{constructor(e){this.a=e,this.pos=0}haveBytes(){return this.pos<this.a.length}getByte(){const e=this.a[this.pos];if(this.pos++,this.pos>this.a.length)throw new RangeError("out of bounds");return e}getChar(){return String.fromCharCode(this.getByte())}getInt(){let e=0,t;for(;this.haveBytes()&&(t=ap[127&this.getByte()])>=0;)e=(e<<6)+t;return this.pos--,e>>>0}}class cp{constructor(){this.a=[]}toByteArray(e){return Array.isArray(e)?this.a:new Uint8Array(this.a)}putArray(e,t,r){for(let s=t;s<r;s++)this.a.push(e[s])}}function up(n){let e=0,t=0,r=0,s=0,i=0,o=n.length;for(;o>=16;)e=e+n[i+0]|0,t=t+n[i+1]|0,r=r+n[i+2]|0,s=s+n[i+3]|0,e=e+n[i+4]|0,t=t+n[i+5]|0,r=r+n[i+6]|0,s=s+n[i+7]|0,e=e+n[i+8]|0,t=t+n[i+9]|0,r=r+n[i+10]|0,s=s+n[i+11]|0,e=e+n[i+12]|0,t=t+n[i+13]|0,r=r+n[i+14]|0,s=s+n[i+15]|0,i+=16,o-=16;for(;o>=4;)e=e+n[i+0]|0,t=t+n[i+1]|0,r=r+n[i+2]|0,s=s+n[i+3]|0,i+=4,o-=4;switch(s=((s+(r<<8)|0)+(t<<16)|0)+(e<<24)|0,o){case 3:s=s+(n[i+2]<<8)|0;case 2:s=s+(n[i+1]<<16)|0;case 1:s=s+(n[i+0]<<24)|0}return s>>>0}function dp(n,e){let t=0;const r=new lp(e),s=n.length,i=e.length,o=r.getInt();if(r.getChar()!==`
113
+ `)throw new Error("size integer not terminated by '\\n'");const a=new cp;for(;r.haveBytes();){const l=r.getInt();let c;switch(r.getChar()){case"@":if(c=r.getInt(),r.haveBytes()&&r.getChar()!==",")throw new Error("copy command not terminated by ','");if(t+=l,t>o)throw new Error("copy exceeds output file size");if(c+l>s)throw new Error("copy extends past end of input");a.putArray(n,c,c+l);break;case":":if(t+=l,t>o)throw new Error("insert command gives an output larger than predicted");if(l>i)throw new Error("insert count exceeds size of delta");a.putArray(r.a,r.pos,r.pos+l),r.pos+=l;break;case";":{const u=a.toByteArray(n);if(l!==up(u))throw new Error("bad checksum");if(t!==o)throw new Error("generated size does not match predicted size");return u}default:throw new Error("unknown delta operator")}}throw new Error("unterminated delta")}class kl{name(){return"json"}encodeCommands(e){return e.map(t=>JSON.stringify(t)).join(`
114
114
  `)}decodeReplies(e){return e.trim().split(`
115
- `).map(t=>JSON.parse(t))}applyDeltaIfNeeded(e,t){let r,s;if(e.delta){const i=hp(t,new TextEncoder().encode(e.data));r=JSON.parse(new TextDecoder().decode(i)),s=i}else r=JSON.parse(e.data),s=new TextEncoder().encode(e.data);return{newData:r,newPrevValue:s}}}const fp={headers:{},token:"",getToken:null,data:null,getData:null,debug:!1,name:"js",version:"",fetch:null,readableStream:null,websocket:null,eventsource:null,sockjs:null,sockjsOptions:{},emulationEndpoint:"/emulation",minReconnectDelay:500,maxReconnectDelay:2e4,timeout:5e3,maxServerPingDelay:1e4,networkEventTarget:null};class gt extends Error{constructor(e){super(e),this.name=this.constructor.name}}class gr extends xl{constructor(e,t){super(),this._reconnectTimeout=null,this._refreshTimeout=null,this._serverPingTimeout=null,this.state=me.Disconnected,this._transportIsOpen=!1,this._endpoint=e,this._emulation=!1,this._transports=[],this._currentTransportIndex=0,this._triedAllTransports=!1,this._transportWasOpen=!1,this._transport=null,this._transportId=0,this._deviceWentOffline=!1,this._transportClosed=!0,this._codec=new Tl,this._reconnecting=!1,this._reconnectTimeout=null,this._reconnectAttempts=0,this._client=null,this._session="",this._node="",this._subs={},this._serverSubs={},this._commandId=0,this._commands=[],this._batching=!1,this._refreshRequired=!1,this._refreshTimeout=null,this._callbacks={},this._token="",this._data=null,this._dispatchPromise=Promise.resolve(),this._serverPing=0,this._serverPingTimeout=null,this._sendPong=!1,this._promises={},this._promiseId=0,this._debugEnabled=!1,this._networkEventsSet=!1,this._config=Object.assign(Object.assign({},fp),t),this._configure(),this._debugEnabled?(this.on("state",r=>{this._debug("client state",r.oldState,"->",r.newState)}),this.on("error",r=>{this._debug("client error",r)})):this.on("error",function(){Function.prototype()})}newSubscription(e,t){if(this.getSubscription(e)!==null)throw new Error("Subscription to the channel "+e+" already exists");const r=new rp(this,e,t);return this._subs[e]=r,r}getSubscription(e){return this._getSub(e)}removeSubscription(e){e&&(e.state!==Re.Unsubscribed&&e.unsubscribe(),this._removeSubscription(e))}subscriptions(){return this._subs}ready(e){return ke(this,void 0,void 0,function*(){switch(this.state){case me.Disconnected:throw{code:ae.clientDisconnected,message:"client disconnected"};case me.Connected:return;default:return new Promise((t,r)=>{const s={resolve:t,reject:r};e&&(s.timeout=setTimeout(()=>{r({code:ae.timeout,message:"timeout"})},e)),this._promises[this._nextPromiseId()]=s})}})}connect(){if(this._isConnected()){this._debug("connect called when already connected");return}if(this._isConnecting()){this._debug("connect called when already connecting");return}this._debug("connect called"),this._reconnectAttempts=0,this._startConnecting()}disconnect(){this._disconnect(vn.disconnectCalled,"disconnect called",!1)}setToken(e){this._token=e}setData(e){this._data=e}setHeaders(e){this._config.headers=e}send(e){return ke(this,void 0,void 0,function*(){const t={send:{data:e}};if(yield this._methodCall(),!this._transportSendCommands([t]))throw this._createErrorObject(ae.transportWriteError,"transport write error")})}rpc(e,t){return ke(this,void 0,void 0,function*(){const r={rpc:{method:e,data:t}};return yield this._methodCall(),{data:(yield this._callPromise(r,i=>i.rpc)).data}})}publish(e,t){return ke(this,void 0,void 0,function*(){const r={publish:{channel:e,data:t}};return yield this._methodCall(),yield this._callPromise(r,()=>({})),{}})}history(e,t){return ke(this,void 0,void 0,function*(){const r={history:this._getHistoryRequest(e,t)};yield this._methodCall();const s=yield this._callPromise(r,o=>o.history),i=[];if(s.publications)for(let o=0;o<s.publications.length;o++)i.push(this._getPublicationContext(e,s.publications[o]));return{publications:i,epoch:s.epoch||"",offset:s.offset||0}})}presence(e){return ke(this,void 0,void 0,function*(){const t={presence:{channel:e}};yield this._methodCall();const s=(yield this._callPromise(t,i=>i.presence)).presence;for(const i in s)if(Object.prototype.hasOwnProperty.call(s,i)){const o=s[i],a=o.conn_info,l=o.chan_info;a&&(o.connInfo=a),l&&(o.chanInfo=l)}return{clients:s}})}presenceStats(e){return ke(this,void 0,void 0,function*(){const t={presence_stats:{channel:e}};yield this._methodCall();const r=yield this._callPromise(t,s=>s.presence_stats);return{numUsers:r.num_users,numClients:r.num_clients}})}startBatching(){this._batching=!0}stopBatching(){const e=this;Promise.resolve().then(function(){Promise.resolve().then(function(){e._batching=!1,e._flush()})})}_debug(...e){this._debugEnabled&&ep("debug",e)}_codecName(){return this._codec.name()}_formatOverride(){}_configure(){if(!("Promise"in globalThis))throw new Error("Promise polyfill required");if(!this._endpoint)throw new Error("endpoint configuration required");if(this._config.token!==null&&(this._token=this._config.token),this._config.data!==null&&(this._data=this._config.data),this._codec=new Tl,this._formatOverride(),(this._config.debug===!0||typeof localStorage<"u"&&typeof localStorage.getItem=="function"&&localStorage.getItem("centrifuge.debug"))&&(this._debugEnabled=!0),this._debug("config",this._config),typeof this._endpoint!="string")if(Array.isArray(this._endpoint)){this._transports=this._endpoint,this._emulation=!0;for(const e in this._transports)if(this._transports.hasOwnProperty(e)){const t=this._transports[e];if(!t.endpoint||!t.transport)throw new Error("malformed transport configuration");const r=t.transport;if(["websocket","http_stream","sse","sockjs","webtransport"].indexOf(r)<0)throw new Error("unsupported transport name: "+r)}}else throw new Error("unsupported url configuration type: only string or array of objects are supported")}_setState(e){if(this.state!==e){this._reconnecting=!1;const t=this.state;return this.state=e,this.emit("state",{newState:e,oldState:t}),!0}return!1}_isDisconnected(){return this.state===me.Disconnected}_isConnecting(){return this.state===me.Connecting}_isConnected(){return this.state===me.Connected}_nextCommandId(){return++this._commandId}_setNetworkEvents(){if(this._networkEventsSet)return;let e=null;this._config.networkEventTarget!==null?e=this._config.networkEventTarget:typeof globalThis.addEventListener<"u"&&(e=globalThis),e&&(e.addEventListener("offline",()=>{this._debug("offline event triggered"),(this.state===me.Connected||this.state===me.Connecting)&&(this._disconnect(Tt.transportClosed,"transport closed",!0),this._deviceWentOffline=!0)}),e.addEventListener("online",()=>{this._debug("online event triggered"),this.state===me.Connecting&&(this._deviceWentOffline&&!this._transportClosed&&(this._deviceWentOffline=!1,this._transportClosed=!0),this._clearReconnectTimeout(),this._startReconnecting())}),this._networkEventsSet=!0)}_getReconnectDelay(){const e=fr(this._reconnectAttempts,this._config.minReconnectDelay,this._config.maxReconnectDelay);return this._reconnectAttempts+=1,e}_clearOutgoingRequests(){for(const e in this._callbacks)if(this._callbacks.hasOwnProperty(e)){const t=this._callbacks[e];clearTimeout(t.timeout);const r=t.errback;if(!r)continue;r({error:this._createErrorObject(ae.connectionClosed,"connection closed")})}this._callbacks={}}_clearConnectedState(){this._client=null,this._clearServerPingTimeout(),this._clearRefreshTimeout();for(const e in this._subs){if(!this._subs.hasOwnProperty(e))continue;const t=this._subs[e];t.state===Re.Subscribed&&t._setSubscribing(dr.transportClosed,"transport closed")}for(const e in this._serverSubs)this._serverSubs.hasOwnProperty(e)&&this.emit("subscribing",{channel:e})}_handleWriteError(e){for(const t of e){const r=t.id;if(!(r in this._callbacks))continue;const s=this._callbacks[r];clearTimeout(this._callbacks[r].timeout),delete this._callbacks[r];const i=s.errback;i({error:this._createErrorObject(ae.transportWriteError,"transport write error")})}}_transportSendCommands(e){if(!e.length)return!0;if(!this._transport)return!1;try{this._transport.send(this._codec.encodeCommands(e),this._session,this._node)}catch(t){return this._debug("error writing commands",t),this._handleWriteError(e),!1}return!0}_initializeTransport(){let e;this._config.websocket!==null?e=this._config.websocket:typeof globalThis.WebSocket!="function"&&typeof globalThis.WebSocket!="object"||(e=globalThis.WebSocket);let t=null;this._config.sockjs!==null?t=this._config.sockjs:typeof globalThis.SockJS<"u"&&(t=globalThis.SockJS);let r=null;this._config.eventsource!==null?r=this._config.eventsource:typeof globalThis.EventSource<"u"&&(r=globalThis.EventSource);let s=null;this._config.fetch!==null?s=this._config.fetch:typeof globalThis.fetch<"u"&&(s=globalThis.fetch);let i=null;if(this._config.readableStream!==null?i=this._config.readableStream:typeof globalThis.ReadableStream<"u"&&(i=globalThis.ReadableStream),this._emulation){this._currentTransportIndex>=this._transports.length&&(this._triedAllTransports=!0,this._currentTransportIndex=0);let h=0;for(;;){if(h>=this._transports.length)throw new Error("no supported transport found");const f=this._transports[this._currentTransportIndex],m=f.transport,b=f.endpoint;if(m==="websocket"){if(this._debug("trying websocket transport"),this._transport=new kl(b,{websocket:e}),!this._transport.supported()){this._debug("websocket transport not available"),this._currentTransportIndex++,h++;continue}}else if(m==="webtransport"){if(this._debug("trying webtransport transport"),this._transport=new ap(b,{webtransport:globalThis.WebTransport,decoder:this._codec,encoder:this._codec}),!this._transport.supported()){this._debug("webtransport transport not available"),this._currentTransportIndex++,h++;continue}}else if(m==="http_stream"){if(this._debug("trying http_stream transport"),this._transport=new ip(b,{fetch:s,readableStream:i,emulationEndpoint:this._config.emulationEndpoint,decoder:this._codec,encoder:this._codec}),!this._transport.supported()){this._debug("http_stream transport not available"),this._currentTransportIndex++,h++;continue}}else if(m==="sse"){if(this._debug("trying sse transport"),this._transport=new op(b,{eventsource:r,fetch:s,emulationEndpoint:this._config.emulationEndpoint}),!this._transport.supported()){this._debug("sse transport not available"),this._currentTransportIndex++,h++;continue}}else if(m==="sockjs"){if(this._debug("trying sockjs"),this._transport=new sp(b,{sockjs:t,sockjsOptions:this._config.sockjsOptions}),!this._transport.supported()){this._debug("sockjs transport not available"),this._currentTransportIndex++,h++;continue}}else throw new Error("unknown transport "+m);break}}else{if(Qf(this._endpoint,"http"))throw new Error("Provide explicit transport endpoints configuration in case of using HTTP (i.e. using array of TransportEndpoint instead of a single string), or use ws(s):// scheme in an endpoint if you aimed using WebSocket transport");if(this._debug("client will use websocket"),this._transport=new kl(this._endpoint,{websocket:e}),!this._transport.supported())throw new Error("WebSocket constructor not found, make sure it is available globally or passed as a dependency in Centrifuge options")}const o=this,a=this._transport,l=this._nextTransportId();o._debug("id of transport",l);let c=!1;const u=[];if(this._transport.emulation()){const h=o._sendConnect(!0);u.push(h)}this._setNetworkEvents();const d=this._codec.encodeCommands(u);this._transportClosed=!1;let g;g=setTimeout(function(){a.close()},this._config.timeout),this._transport.initialize(this._codecName(),{onOpen:function(){if(g&&(clearTimeout(g),g=null),o._transportId!=l){o._debug("open callback from non-actual transport"),a.close();return}c=!0,o._debug(a.subName(),"transport open"),!a.emulation()&&(o._transportIsOpen=!0,o._transportWasOpen=!0,o.startBatching(),o._sendConnect(!1),o._sendSubscribeCommands(),o.stopBatching(),o.emit("__centrifuge_debug:connect_frame_sent",{}))},onError:function(h){if(o._transportId!=l){o._debug("error callback from non-actual transport");return}o._debug("transport level error",h)},onClose:function(h){if(g&&(clearTimeout(g),g=null),o._transportId!=l){o._debug("close callback from non-actual transport");return}o._debug(a.subName(),"transport closed"),o._transportClosed=!0,o._transportIsOpen=!1;let f="connection closed",m=!0,b=0;if(h&&"code"in h&&h.code&&(b=h.code),h&&h.reason)try{const v=JSON.parse(h.reason);f=v.reason,m=v.reconnect}catch{f=h.reason,(b>=3500&&b<4e3||b>=4500&&b<5e3)&&(m=!1)}b<3e3?(b===1009?(b=vn.messageSizeLimit,f="message size limit exceeded",m=!1):(b=Tt.transportClosed,f="transport closed"),o._emulation&&!o._transportWasOpen&&(o._currentTransportIndex++,o._currentTransportIndex>=o._transports.length&&(o._triedAllTransports=!0,o._currentTransportIndex=0))):o._transportWasOpen=!0,o._isConnecting()&&!c&&o.emit("error",{type:"transport",error:{code:ae.transportClosed,message:"transport closed"},transport:a.name()}),o._reconnecting=!1,o._disconnect(b,f,m)},onMessage:function(h){o._dataReceived(h)}},d),o.emit("__centrifuge_debug:transport_initialized",{})}_sendConnect(e){const t=this._constructConnectCommand(),r=this;return this._call(t,e).then(s=>{const i=s.reply.connect;r._connectResponse(i),s.next&&s.next()},s=>{r._connectError(s.error),s.next&&s.next()}),t}_startReconnecting(){if(this._debug("start reconnecting"),!this._isConnecting()){this._debug("stop reconnecting: client not in connecting state");return}if(this._reconnecting){this._debug("reconnect already in progress, return from reconnect routine");return}if(this._transportClosed===!1){this._debug("waiting for transport close");return}this._reconnecting=!0;const e=this._token==="";if(!(this._refreshRequired||e&&this._config.getToken!==null)){this._config.getData?this._config.getData().then(s=>{this._isConnecting()&&(this._data=s,this._initializeTransport())}).catch(s=>this._handleGetDataError(s)):this._initializeTransport();return}const r=this;this._getToken().then(function(s){if(r._isConnecting()){if(s==null||s==null){r._failUnauthorized();return}r._token=s,r._debug("connection token refreshed"),r._config.getData?r._config.getData().then(function(i){r._isConnecting()&&(r._data=i,r._initializeTransport())}).catch(i=>r._handleGetDataError(i)):r._initializeTransport()}}).catch(function(s){if(!r._isConnecting())return;if(s instanceof gt){r._failUnauthorized();return}r.emit("error",{type:"connectToken",error:{code:ae.clientConnectToken,message:s!==void 0?s.toString():""}});const i=r._getReconnectDelay();r._debug("error on getting connection token, reconnect after "+i+" milliseconds",s),r._reconnecting=!1,r._reconnectTimeout=setTimeout(()=>{r._startReconnecting()},i)})}_handleGetDataError(e){if(e instanceof gt){this._failUnauthorized();return}this.emit("error",{type:"connectData",error:{code:ae.badConfiguration,message:(e==null?void 0:e.toString())||""}});const t=this._getReconnectDelay();this._debug("error on getting connect data, reconnect after "+t+" milliseconds",e),this._reconnecting=!1,this._reconnectTimeout=setTimeout(()=>{this._startReconnecting()},t)}_connectError(e){this.state===me.Connecting&&(e.code===109&&(this._refreshRequired=!0),e.code<100||e.temporary===!0||e.code===109?(this.emit("error",{type:"connect",error:e}),this._debug("closing transport due to connect error"),this._disconnect(e.code,e.message,!0)):this._disconnect(e.code,e.message,!1))}_scheduleReconnect(){if(!this._isConnecting())return;let e=!1;this._emulation&&!this._transportWasOpen&&!this._triedAllTransports&&(e=!0);let t=this._getReconnectDelay();e&&(t=0),this._debug("reconnect after "+t+" milliseconds"),this._clearReconnectTimeout(),this._reconnectTimeout=setTimeout(()=>{this._startReconnecting()},t)}_constructConnectCommand(){const e={};this._token&&(e.token=this._token),this._data&&(e.data=this._data),this._config.name&&(e.name=this._config.name),this._config.version&&(e.version=this._config.version),Object.keys(this._config.headers).length>0&&(e.headers=this._config.headers);const t={};let r=!1;for(const s in this._serverSubs)if(this._serverSubs.hasOwnProperty(s)&&this._serverSubs[s].recoverable){r=!0;const i={recover:!0};this._serverSubs[s].offset&&(i.offset=this._serverSubs[s].offset),this._serverSubs[s].epoch&&(i.epoch=this._serverSubs[s].epoch),t[s]=i}return r&&(e.subs=t),{connect:e}}_getHistoryRequest(e,t){const r={channel:e};return t!==void 0&&(t.since&&(r.since={offset:t.since.offset},t.since.epoch&&(r.since.epoch=t.since.epoch)),t.limit!==void 0&&(r.limit=t.limit),t.reverse===!0&&(r.reverse=!0)),r}_methodCall(){return this._isConnected()?Promise.resolve():new Promise((e,t)=>{const r=setTimeout(function(){t({code:ae.timeout,message:"timeout"})},this._config.timeout);this._promises[this._nextPromiseId()]={timeout:r,resolve:e,reject:t}})}_callPromise(e,t){return new Promise((r,s)=>{this._call(e,!1).then(i=>{var o;const a=t(i.reply);r(a),(o=i.next)===null||o===void 0||o.call(i)},i=>{var o;s(i.error),(o=i.next)===null||o===void 0||o.call(i)})})}_dataReceived(e){this._serverPing>0&&this._waitServerPing();const t=this._codec.decodeReplies(e);this._dispatchPromise=this._dispatchPromise.then(()=>{let r;this._dispatchPromise=new Promise(s=>{r=s}),this._dispatchSynchronized(t,r)})}_dispatchSynchronized(e,t){let r=Promise.resolve();for(const s in e)e.hasOwnProperty(s)&&(r=r.then(()=>this._dispatchReply(e[s])));r=r.then(()=>{t()})}_dispatchReply(e){let t;const r=new Promise(i=>{t=i});if(e==null)return this._debug("dispatch: got undefined or null reply"),t(),r;const s=e.id;return s&&s>0?this._handleReply(e,t):e.push?this._handlePush(e.push,t):this._handleServerPing(t),r}_call(e,t){return new Promise((r,s)=>{e.id=this._nextCommandId(),this._registerCall(e.id,r,s),t||this._addCommand(e)})}_startConnecting(){this._debug("start connecting"),this._setState(me.Connecting)&&this.emit("connecting",{code:Tt.connectCalled,reason:"connect called"}),this._client=null,this._startReconnecting()}_disconnect(e,t,r){if(this._isDisconnected())return;this._transportIsOpen=!1;const s=this.state;this._reconnecting=!1;const i={code:e,reason:t};let o=!1;if(r?o=this._setState(me.Connecting):(o=this._setState(me.Disconnected),this._rejectPromises({code:ae.clientDisconnected,message:"disconnected"})),this._clearOutgoingRequests(),s===me.Connecting&&this._clearReconnectTimeout(),s===me.Connected&&this._clearConnectedState(),o&&(this._isConnecting()?this.emit("connecting",i):this.emit("disconnected",i)),this._transport){this._debug("closing existing transport");const a=this._transport;this._transport=null,a.close(),this._transportClosed=!0,this._nextTransportId()}else this._debug("no transport to close");this._scheduleReconnect()}_failUnauthorized(){this._disconnect(vn.unauthorized,"unauthorized",!1)}_getToken(){return this._debug("get connection token"),this._config.getToken?this._config.getToken({}):(this.emit("error",{type:"configuration",error:{code:ae.badConfiguration,message:"token expired but no getToken function set in the configuration"}}),Promise.reject(new gt("")))}_refresh(){const e=this._client,t=this;this._getToken().then(function(r){if(e!==t._client)return;if(!r){t._failUnauthorized();return}if(t._token=r,t._debug("connection token refreshed"),!t._isConnected())return;const s={refresh:{token:t._token}};t._call(s,!1).then(i=>{const o=i.reply.refresh;t._refreshResponse(o),i.next&&i.next()},i=>{t._refreshError(i.error),i.next&&i.next()})}).catch(function(r){if(t._isConnected()){if(r instanceof gt){t._failUnauthorized();return}t.emit("error",{type:"refreshToken",error:{code:ae.clientRefreshToken,message:r!==void 0?r.toString():""}}),t._refreshTimeout=setTimeout(()=>t._refresh(),t._getRefreshRetryDelay())}})}_refreshError(e){e.code<100||e.temporary===!0?(this.emit("error",{type:"refresh",error:e}),this._refreshTimeout=setTimeout(()=>this._refresh(),this._getRefreshRetryDelay())):this._disconnect(e.code,e.message,!1)}_getRefreshRetryDelay(){return fr(0,5e3,1e4)}_refreshResponse(e){this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null),e.expires&&(this._client=e.client,this._refreshTimeout=setTimeout(()=>this._refresh(),pr(e.ttl)))}_removeSubscription(e){e!==null&&delete this._subs[e.channel]}_unsubscribe(e){if(!this._transportIsOpen)return Promise.resolve();const r={unsubscribe:{channel:e.channel}},s=this;return new Promise((o,a)=>{this._call(r,!1).then(l=>{o(),l.next&&l.next()},l=>{o(),l.next&&l.next(),s._disconnect(Tt.unsubscribeError,"unsubscribe error",!0)})})}_getSub(e,t){if(t&&t>0){for(const s in this._subs)if(this._subs.hasOwnProperty(s)){const i=this._subs[s];if(i._id===t)return i}return null}const r=this._subs[e];return r||null}_isServerSub(e){return this._serverSubs[e]!==void 0}_sendSubscribeCommands(){const e=[];for(const t in this._subs){if(!this._subs.hasOwnProperty(t))continue;const r=this._subs[t];if(r._inflight!==!0&&r.state===Re.Subscribing){const s=r._subscribe();s&&e.push(s)}}return e}_connectResponse(e){if(this._transportIsOpen=!0,this._transportWasOpen=!0,this._reconnectAttempts=0,this._refreshRequired=!1,this._isConnected())return;this._client=e.client,this._setState(me.Connected),this._refreshTimeout&&clearTimeout(this._refreshTimeout),e.expires&&(this._refreshTimeout=setTimeout(()=>this._refresh(),pr(e.ttl))),this._session=e.session,this._node=e.node,this.startBatching(),this._sendSubscribeCommands(),this.stopBatching();const t={client:e.client,transport:this._transport.subName()};e.data&&(t.data=e.data),this.emit("connected",t),this._resolvePromises(),this._processServerSubs(e.subs||{}),e.ping&&e.ping>0?(this._serverPing=e.ping*1e3,this._sendPong=e.pong===!0,this._waitServerPing()):this._serverPing=0}_processServerSubs(e){for(const t in e){if(!e.hasOwnProperty(t))continue;const r=e[t];this._serverSubs[t]={offset:r.offset,epoch:r.epoch,recoverable:r.recoverable||!1};const s=this._getSubscribeContext(t,r);this.emit("subscribed",s)}for(const t in e){if(!e.hasOwnProperty(t))continue;const r=e[t];if(r.recovered){const s=r.publications;if(s&&s.length>0)for(const i in s)s.hasOwnProperty(i)&&this._handlePublication(t,s[i])}}for(const t in this._serverSubs)this._serverSubs.hasOwnProperty(t)&&(e[t]||(this.emit("unsubscribed",{channel:t}),delete this._serverSubs[t]))}_clearRefreshTimeout(){this._refreshTimeout!==null&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearReconnectTimeout(){this._reconnectTimeout!==null&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null)}_clearServerPingTimeout(){this._serverPingTimeout!==null&&(clearTimeout(this._serverPingTimeout),this._serverPingTimeout=null)}_waitServerPing(){this._config.maxServerPingDelay!==0&&this._isConnected()&&(this._clearServerPingTimeout(),this._serverPingTimeout=setTimeout(()=>{this._isConnected()&&this._disconnect(Tt.noPing,"no ping",!0)},this._serverPing+this._config.maxServerPingDelay))}_getSubscribeContext(e,t){const r={channel:e,positioned:!1,recoverable:!1,wasRecovering:!1,recovered:!1,hasRecoveredPublications:!1};t.recovered&&(r.recovered=!0),t.positioned&&(r.positioned=!0),t.recoverable&&(r.recoverable=!0),t.was_recovering&&(r.wasRecovering=!0);let s="";"epoch"in t&&(s=t.epoch);let i=0;return"offset"in t&&(i=t.offset),(r.positioned||r.recoverable)&&(r.streamPosition={offset:i,epoch:s}),Array.isArray(t.publications)&&t.publications.length>0&&(r.hasRecoveredPublications=!0),t.data&&(r.data=t.data),r}_handleReply(e,t){const r=e.id;if(!(r in this._callbacks)){t();return}const s=this._callbacks[r];if(clearTimeout(this._callbacks[r].timeout),delete this._callbacks[r],np(e)){const i=s.errback;if(!i){t();return}const o={code:e.error.code,message:e.error.message||"",temporary:e.error.temporary||!1};i({error:o,next:t})}else{const i=s.callback;if(!i)return;i({reply:e,next:t})}}_handleJoin(e,t,r){const s=this._getSub(e,r);if(!s&&e){if(this._isServerSub(e)){const i={channel:e,info:this._getJoinLeaveContext(t.info)};this.emit("join",i)}return}s._handleJoin(t)}_handleLeave(e,t,r){const s=this._getSub(e,r);if(!s&&e){if(this._isServerSub(e)){const i={channel:e,info:this._getJoinLeaveContext(t.info)};this.emit("leave",i)}return}s._handleLeave(t)}_handleUnsubscribe(e,t){const r=this._getSub(e,0);if(!r&&e){this._isServerSub(e)&&(delete this._serverSubs[e],this.emit("unsubscribed",{channel:e}));return}t.code<2500?r._setUnsubscribed(t.code,t.reason,!1):r._setSubscribing(t.code,t.reason)}_handleSubscribe(e,t){this._serverSubs[e]={offset:t.offset,epoch:t.epoch,recoverable:t.recoverable||!1},this.emit("subscribed",this._getSubscribeContext(e,t))}_handleDisconnect(e){const t=e.code;let r=!0;(t>=3500&&t<4e3||t>=4500&&t<5e3)&&(r=!1),this._disconnect(t,e.reason,r)}_getPublicationContext(e,t){const r={channel:e,data:t.data};return t.offset&&(r.offset=t.offset),t.info&&(r.info=this._getJoinLeaveContext(t.info)),t.tags&&(r.tags=t.tags),r}_getJoinLeaveContext(e){const t={client:e.client,user:e.user},r=e.conn_info;r&&(t.connInfo=r);const s=e.chan_info;return s&&(t.chanInfo=s),t}_handlePublication(e,t,r){const s=this._getSub(e,r);if(!s&&e){if(this._isServerSub(e)){const i=this._getPublicationContext(e,t);this.emit("publication",i),t.offset!==void 0&&(this._serverSubs[e].offset=t.offset)}return}s._handlePublication(t)}_handleMessage(e){this.emit("message",{data:e.data})}_handleServerPing(e){if(this._sendPong){const t={};this._transportSendCommands([t])}e()}_handlePush(e,t){const r=e.channel,s=e.id;e.pub?this._handlePublication(r,e.pub,s):e.message?this._handleMessage(e.message):e.join?this._handleJoin(r,e.join,s):e.leave?this._handleLeave(r,e.leave,s):e.unsubscribe?this._handleUnsubscribe(r,e.unsubscribe):e.subscribe?this._handleSubscribe(r,e.subscribe):e.disconnect&&this._handleDisconnect(e.disconnect),t()}_flush(){const e=this._commands.slice(0);this._commands=[],this._transportSendCommands(e)}_createErrorObject(e,t,r){const s={code:e,message:t};return r&&(s.temporary=!0),s}_registerCall(e,t,r){this._callbacks[e]={callback:t,errback:r,timeout:null},this._callbacks[e].timeout=setTimeout(()=>{delete this._callbacks[e],wl(r)&&r({error:this._createErrorObject(ae.timeout,"timeout")})},this._config.timeout)}_addCommand(e){this._batching?this._commands.push(e):this._transportSendCommands([e])}_nextPromiseId(){return++this._promiseId}_nextTransportId(){return++this._transportId}_resolvePromises(){for(const e in this._promises)this._promises.hasOwnProperty(e)&&(this._promises[e].timeout&&clearTimeout(this._promises[e].timeout),this._promises[e].resolve(),delete this._promises[e])}_rejectPromises(e){for(const t in this._promises)this._promises.hasOwnProperty(t)&&(this._promises[t].timeout&&clearTimeout(this._promises[t].timeout),this._promises[t].reject(e),delete this._promises[t])}}gr.SubscriptionState=Re,gr.State=me,gr.UnauthorizedError=gt;const pp=({chatbotId:n,userData:e,fullScreen:t})=>{var at,bt;const r=(at=window==null?void 0:window.robodialog)==null?void 0:at.default,s=(bt=window==null?void 0:window.robodialog)==null?void 0:bt.externalAPI,i=!!r,o=!!s,a=et(null),[l,c]=M(i?r:null),[u,d]=M(i?kd:null),[g,h]=M(i?rt:null),[f,m]=M(null),[b,v]=M(0),x=vt(()=>({chatbot:l,setChatbot:c,token:u,setToken:d,userId:g,setUserId:h,fileSizeLimit:b,setFileSizeLimit:v,userData:e||{},chatbotDefault:r,isChatbotDefault:i,defaultExternalAPI:s,isDefaultExternalAPI:o}),[l,u,g,b,e,i,s,o]),[w,k]=M(i?Td:[]),[_,S]=M(i?Sd:[]),[P,T]=M(o?Cd:null),[A,D]=M(0),[E,j]=M(null),Z=et([]),se=et({call:!1,messagesCount:{},messagesLength:{}}),Oe=vt(()=>({messages:w,setMessages:k,conversations:_,setConversations:S,currentConversation:P,setCurrentConversation:T,totalConversationsCount:A,setTotalConversationsCount:D,newMessage:E,setNewMessage:j,messagesRef:Z,messageCallOneTime:se}),[w,_,P,A,E]),[G,ye]=M(!!o),[he,Be]=M(!1),[C,R]=M(!1),[$,F]=M(!1),[I,q]=M(!1),[U,z]=M(!1),[H,X]=M(!1),[W,le]=M(0),[O,Ne]=M(null),[mt,jt]=M(null),[br,_r]=M(null),B=et(!1),fe=et(!1),Me=vt(()=>({chatOpen:G,setChatOpen:ye,callChatFlow:he,setCallChatFlow:Be,interacted:C,setInteracted:R,canMessage:$,setCanMessage:F,humanControl:I,setHumanControl:q,aiLoading:U,setAiLoading:z,userLoading:H,setUserLoading:X,onlineAgents:W,setOnlineAgents:le,ratingFromUser:O,setRatingFromUser:Ne,dataFromUser:mt,setDataFromUser:jt,hoveringMessageInner:br,setHoveringMessageInner:_r,callChatFlowRef:B,agentConversationEnded:fe}),[G,he,C,$,I,U,H,W,O,mt,br]);return _e(()=>i||!n?void 0:((async()=>{var He,oe;try{let ce=Fr("robodialog-livechat-id");e!=null&&e.userId&&(ce=e.userId),ce||(ce=ki(),Sn("robodialog-livechat-id",ce)),h(ce);const lt=await Fo.readById({params:{id:n}});if(!((He=lt.data)!=null&&He.chatbot))throw new Error("Chatbot not found");const _t=lt.data.chatbot;c(_t),v(lt.data.fileSizeLimit);const ct=await Fo.generateToken({body:{userId:ce,chatbotId:_t._id,visitor:!(e!=null&&e.userId)}});if(!((oe=ct.data)!=null&&oe.token))throw new Error("Token generation failed");const{token:kp,socketToken:Tp}=ct.data;if(d(kp),o)return;const vr=new gr(du,{token:Tp}),El=vr.newSubscription(`personal:${ce}`),Sp=vr.newSubscription(`chatbot_widget:${_t._id}`);El.on("publication",Cp=>{const{event:Al,data:Ge}=Cp.data;Al==="conversation"&&(S(ze=>{const yr=ze.findIndex(Ut=>Ut._id===Ge._id);if(yr!==-1){const Ut=[...ze];return Ut[yr]=Ge,Ut}return[...ze,Ge]}),T(ze=>!ze||ze._id!==Ge._id?ze:(!!ze.assignedTo&&!Ge.assignedTo&&ze.assignType&&(B.current=!0),Ge))),Al==="message"&&(k(ze=>{if(ze.some(xr=>xr._id===Ge._id))return ze.map(xr=>xr._id===Ge._id?Ge:xr);const Ut=[...ze,Ge];return Z.current=Ut,Ut}),G||j(Ge))}),El.subscribe(),Sp.subscribe(),vr.connect(),m(vr)}catch(ce){xt().error("Widget initialization failed:",ce)}})(),()=>{f==null||f.disconnect()}),[n]),_e(()=>{if(!(l!=null&&l.appearance)||!a.current)return;const He=a.current.getRootNode().host;if(He&&He instanceof HTMLElement){const oe=He,ce=l.appearance.color,lt=l.appearance.others;oe.style.setProperty("--background-color",ce.background||"#ffffff"),oe.style.setProperty("--background-text-color",ce.backgroundText||"#111827"),oe.style.setProperty("--input-background-color",ce.inputBackground||"#ffffff"),oe.style.setProperty("--input-text-color",ce.inputText||"#111827"),oe.style.setProperty("--base-color",ce.base||"#006fee"),oe.style.setProperty("--base-text-color",ce.baseText||"#ffffff");const _t=ct=>typeof ct=="number"?`${ct}px`:ct;oe.style.setProperty("--popup-container-radius",_t(lt.popupContainerRadius)||"20px"),oe.style.setProperty("--chatbot-radius",_t(lt.chatbotRadius)||"12px"),oe.style.setProperty("--shadow-sm","0 0px 2px 0 rgba(0, 0, 0, 0.05)"),oe.style.setProperty("--shadow-md","0 0px 10px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"),oe.style.setProperty("--shadow-lg","0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"),oe.style.setProperty("--shadow-xl","0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)"),oe.style.setProperty("--transition-smooth","cubic-bezier(0.4, 0, 0.2, 1)"),oe.style.setProperty("--transition-bounce","cubic-bezier(0.68, -0.55, 0.05, 2)")}},[l]),_e(()=>{if(i||o)return;(async()=>{if(!u||!P||_.length===0)return;const He=w.filter(oe=>oe.conversationId===P._id&&!_.some(ce=>ce._id===oe.conversationId));for(const oe of He)try{const ce=await $t.userRead({params:{id:oe.conversationId}},u);ce.data&&S(lt=>[...lt,ce.data])}catch(ce){xt().error(`Failed to fetch conversation ${oe.conversationId}:`,ce)}})()},[w,_,P,u]),!l||!u?p("div",{ref:a,className:"robodialog-chatbot-app"}):p("div",{ref:a,className:`robodialog-chatbot-app${t?" robodialog-chatbot-app-fullscreen":""}`,children:p(Hf,{coreState:x,conversationState:Oe,uiState:Me,fullScreen:t})})},gp='.robodialog-chatbot-app{width:calc(100vw - 20px);height:calc(100vh - 10px);pointer-events:none;position:fixed;top:0;left:0;z-index:1;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:var(--background-text-color);font-size:14px;line-height:1.5}.robodialog-chatbot-app *{scroll-behavior:smooth;box-sizing:border-box;margin:0;padding:0}.robodialog-chatbot-app *:focus-visible{outline:none}.robodialog-chatbot-app img{max-width:100%;height:auto;display:block}.robodialog-chatbot-app video{max-width:100%;border-radius:calc(var(--popup-container-radius) * .66);box-shadow:var(--shadow-sm)}.robodialog-chatbot-app .messageDiv a[href*=jpg],.robodialog-chatbot-app .messageDiv a[href*=png],.robodialog-chatbot-app .messageDiv a[href*=jpeg],.robodialog-chatbot-app .messageDiv a[href*=gif],.robodialog-chatbot-app .messageDiv a[href*=mp4],.robodialog-chatbot-app .messageDiv a[href*=webm]{display:inline-block;margin-top:8px;border-radius:var(--popup-container-radius);overflow:hidden;box-shadow:var(--shadow-md);transition:all .3s var(--transition-smooth);position:relative;width:max-content}.robodialog-chatbot-app .messageDiv a[href*=jpg]:hover,.robodialog-chatbot-app .messageDiv a[href*=png]:hover,.robodialog-chatbot-app .messageDiv a[href*=jpeg]:hover,.robodialog-chatbot-app .messageDiv a[href*=gif]:hover,.robodialog-chatbot-app .messageDiv a[href*=mp4]:hover,.robodialog-chatbot-app .messageDiv a[href*=webm]:hover{transform:scale(1.05);box-shadow:var(--shadow-xl)}.robodialog-chatbot-app .messageDiv a img,.robodialog-chatbot-app .messageDiv a video{display:block;max-height:200px;width:auto;transition:all .3s var(--transition-smooth)}.robodialog-chatbot-app .messageDiv .sources a[href$=".pdf"],.robodialog-chatbot-app .messageDiv .sources a[href$=".doc"],.robodialog-chatbot-app .messageDiv .sources a[href$=".docx"],.robodialog-chatbot-app .messageDiv .sources a[href$=".xlsx"],.robodialog-chatbot-app .messageDiv .sources a[href$=".txt"]{position:relative;padding-left:28px}.robodialog-chatbot-app .messageDiv .sources a[href$=".pdf"]:before,.robodialog-chatbot-app .messageDiv .sources a[href$=".doc"]:before,.robodialog-chatbot-app .messageDiv .sources a[href$=".docx"]:before,.robodialog-chatbot-app .messageDiv .sources a[href$=".xlsx"]:before,.robodialog-chatbot-app .messageDiv .sources a[href$=".txt"]:before{content:"📄";position:absolute;left:8px;top:50%;transform:translateY(-50%);font-size:14px}.robodialog-chatbot-app button:disabled{opacity:.5;cursor:not-allowed;pointer-events:none}@media screen and (max-width: 480px){.robodialog-chatbot-app .chatbotConversationContainer h2{font-size:20px}.robodialog-chatbot-app .chatbotConversationContainer h4{font-size:12px}.robodialog-chatbot-app .messageDiv .messageP{padding:10px 14px;font-size:13px}}.robodialog-chatbot-app{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}.robodialog-chatbot-app ::-webkit-scrollbar{width:8px;height:8px}.robodialog-chatbot-app ::-webkit-scrollbar-track{background:transparent}.robodialog-chatbot-app ::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--background-text-color),transparent 75%);border-radius:10px;border:2px solid transparent;background-clip:padding-box}.robodialog-chatbot-app ::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--background-text-color),transparent 60%);border-radius:10px;border:2px solid transparent;background-clip:padding-box}.robodialog-chatbot-app *{scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--background-text-color),transparent 75%) transparent}.robodialog-chatbot-app.robodialog-chatbot-app-fullscreen{width:100%;height:100%;position:relative;pointer-events:auto}',mp='.chatbotMain{position:fixed;display:flex;flex-direction:column;align-items:flex-end;z-index:999999;pointer-events:none;gap:10px}.chatbotMain>*{pointer-events:all}.chatbotChat{position:relative;display:flex;align-items:center;gap:8px}@keyframes robodialog-buttonEntry{0%{opacity:0;transform:scale(0) rotate(-180deg)}50%{transform:scale(1.15) rotate(10deg)}to{opacity:1;transform:scale(1) rotate(0)}}.chatbotChatInside{width:60px;height:60px;animation:robodialog-buttonEntry .5s var(--transition-bounce);position:relative;z-index:2;transition:transform .3s var(--transition-smooth);border-radius:var(--chatbot-radius);background:var(--background-color);box-shadow:var(--shadow-md);cursor:pointer;display:flex;align-items:center;justify-content:center;overflow:hidden}.chatbotChatInside:hover{transform:translateY(-5px) rotate(5deg) scale(1.05)}.chatbotChatInside:active{transform:translateY(-3px) rotate(5deg) scale(.95)}.chatbotChatInside img{width:100%;height:100%;object-fit:cover}.chatbotChatInside svg{width:28px;height:28px;transition:transform .3s var(--transition-smooth)}.chatbotConversationContainer.open~.chatbotChat .chatbotChatInside svg{transform:rotate(90deg)}.chatbotDrag{width:24px;height:40px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--background-color),transparent 30%);border-radius:calc(var(--popup-container-radius) / 2.5);cursor:grab;opacity:0;transition:all .2s var(--transition-smooth);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);box-shadow:var(--shadow-sm)}.chatbotMain:hover .chatbotDrag{opacity:1}.chatbotDrag:active{cursor:grabbing;background:var(--background-color)}.chatbotDrag svg{opacity:.6}.notification-badge{position:absolute;top:-4px;right:-4px;width:20px;height:20px;background:var(--base-color);border-radius:50%;border:3px solid var(--base-text-color);display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:var(--base-text-color);animation:robodialog-badgePop .4s var(--transition-bounce);box-shadow:0 2px 8px color-mix(in srgb,var(--base-color),transparent 60%)}@keyframes robodialog-badgePop{0%{opacity:0;transform:scale(0)}50%{transform:scale(1.2)}to{opacity:1;transform:scale(1)}}@media screen and (max-width: 768px){chatbotChatInside{width:56px;height:56px}.chatbotChatInside svg{width:24px;height:24px}}.chatbotConversationContainer{background:var(--background-color);border-radius:var(--popup-container-radius);box-shadow:var(--shadow-xl);overflow:hidden;display:flex;flex-direction:column;width:420px;max-width:95vw;height:0;max-height:0;opacity:0;transform:translateY(20px) scale(.95) rotate(-2deg);pointer-events:none;transition:opacity .3s var(--transition-smooth),transform .3s var(--transition-bounce)}.chatbotConversationContainer.open{height:700px;max-height:calc(95vh - 70px);opacity:1;transform:translateY(0) scale(1);pointer-events:all}.chatbotConversationContainer>.top-header{background:linear-gradient(135deg,var(--base-color) 0%,color-mix(in srgb,var(--base-color),var(--background-text-color) 10%) 100%);color:var(--base-text-color);padding:24px 20px;box-shadow:0 4px 12px color-mix(in srgb,var(--base-color),transparent 85%);position:relative;overflow:hidden}.chatbotConversationContainer .top-header:before{content:"";position:absolute;top:-50%;right:-20%;width:300px;height:300px;background:radial-gradient(circle,color-mix(in srgb,var(--base-text-color),transparent 90%) 0%,transparent 70%);border-radius:50%;pointer-events:none}.chatbotConversationContainer .top-header{text-align:center}.chatbotConversationContainer h2{font-size:24px;font-weight:700;margin-bottom:6px;letter-spacing:-.02em;position:relative;z-index:1}.chatbotConversationContainer h4{font-size:13px;font-weight:400;opacity:.9;line-height:1.4;position:relative;z-index:1}.liveLinkRightDiv{flex:1;display:flex;flex-direction:column;background:color-mix(in srgb,var(--background-text-color) 2%,var(--background-color));overflow:hidden}.liveLinkRightDiv .loadingDiv>svg,.newConversationLoading svg{animation:robodialog-spin 1s cubic-bezier(.4,0,.6,1.3) infinite}.liveLinkRightDiv .loadingDiv{margin:auto}.loadingIcon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px}@keyframes robodialog-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.conversationMain{display:flex;flex-direction:column;height:100%;width:100%;padding:16px;gap:12px}.robodialog-chatbot-app.robodialog-chatbot-app-fullscreen .conversationMain{max-width:600px;margin-left:auto;margin-right:auto}.conversationMain .newConversationBtn{padding:12px 24px;border:none;border-radius:calc(var(--popup-container-radius) * .5);font-size:14px;font-weight:600;cursor:pointer;position:relative;transition:all .2s var(--transition-smooth);box-shadow:var(--shadow-sm);background:var(--base-color);color:var(--base-text-color);overflow:hidden;min-height:40px}.conversationMain .newConversationBtn:hover{transform:translateY(-2px);box-shadow:var(--shadow-md);background:color-mix(in srgb,var(--base-color),var(--background-text-color) 10%)}.conversationMain .newConversationBtn:active{transform:translateY(0);box-shadow:var(--shadow-sm)}.conversationMain .newConversationBtn:before{content:"";position:absolute;top:50%;left:50%;width:0;height:0;border-radius:50%;background:color-mix(in srgb,var(--base-text-color),transparent 80%);transform:translate(-50%,-50%);transition:width .3s,height .3s}.conversationMain .newConversationBtn:hover:before{width:400px;height:400px}.conversationDetails{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column;background:var(--background-color);z-index:10;animation:robodialog-slideInRight .3s var(--transition-smooth)}@keyframes robodialog-slideInRight{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}.conversationDetails .conversationDetailsHeader{display:flex;align-items:center;justify-content:space-between;padding:12px;background:var(--background-color);border-bottom:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);font-size:13px;font-weight:500;box-shadow:var(--shadow-sm);position:relative;z-index:2}.conversationDetails .conversationDetailsHeader>div:nth-child(1){display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:calc(var(--popup-container-radius) * .66);cursor:pointer;transition:all .2s var(--transition-smooth);background:color-mix(in srgb,var(--background-text-color) 2%,var(--background-color))}.conversationDetails .conversationDetailsHeader>div:nth-child(1):hover{background:color-mix(in srgb,var(--background-text-color) 5%,var(--background-color));transform:scale(.95)}.conversationDetails .conversationDetailsHeader>div:nth-child(1) svg{width:14px;height:14px;transform:rotate(90deg);transition:transform .2s var(--transition-smooth)}.conversationDetails .headerImageWrapper{width:28px;height:28px;border-radius:50%;overflow:hidden;border:2px solid var(--background-color);box-shadow:var(--shadow-sm)}.conversationDetails .headerImageWrapper img{width:100%;height:100%;object-fit:cover}.conversationDetails .livelinkMsgs{flex:1;display:flex;flex-direction:column-reverse;padding:16px 12px;overflow-y:auto;background:color-mix(in srgb,var(--background-text-color) 2%,var(--background-color));gap:8px}.robodialog-chatbot-app.robodialog-chatbot-app-fullscreen .conversationDetails .livelinkMsgs{max-width:600px;margin-left:auto;margin-right:auto;background-color:transparent}@media screen and (max-width: 600px){.robodialog-chatbot-app.robodialog-chatbot-app-fullscreen .conversationDetails .livelinkMsgs{max-width:100%}}.conversationDetails .livelinkMsgs::-webkit-scrollbar{width:6px}.conversationDetails .livelinkMsgs::-webkit-scrollbar-track{background:transparent}.conversationDetails .livelinkMsgs::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--background-text-color),transparent 75%);border-radius:10px;transition:background .2s}.conversationDetails .livelinkMsgs::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--background-text-color),transparent 60%)}.conversationDetails>div:nth-last-child(1){position:relative;padding:10px;background:var(--background-color);border-top:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);box-shadow:0 -4px 12px #00000008}.robodialog-chatbot-app.robodialog-chatbot-app-fullscreen .conversationDetails>div:nth-last-child(1){max-width:576px;margin-left:auto;margin-right:auto;width:100%;border-top:0px}.liveLinkRightDiv textarea{width:100%;padding:8px 50px 8px 12px;background:inherit;color:inherit;font-size:14px;font-family:inherit;line-height:1.5;resize:none;outline:none;transition:all .2s var(--transition-smooth);min-height:44px;max-height:120px}.livelinkPoweredDiv2{display:flex;align-items:center;justify-content:center;padding:12px 0 8px;font-size:12px;color:color-mix(in srgb,var(--background-text-color),transparent 60%);gap:6px;background:var(--background-color);border-top:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%)}.livelinkPoweredDiv2 img{height:16px}.livelinkPoweredDiv2 a{text-decoration:none;color:#006fee;font-weight:600;transition:color .2s}.livelinkPoweredDiv2 a:hover{color:color-mix(in srgb,#006fee,var(--background-text-color) 10%)}.chatbotMain.fullscreen{position:relative;width:100%;height:100%}.chatbotConversationContainer.fullscreen{width:100%;height:100%;max-width:100%;max-height:100%;border-radius:0;transform:none!important;opacity:1!important;pointer-events:all!important}@media screen and (max-width: 480px){.chatbotConversationContainer.fullscreen{border-radius:0}}',bp='.conversationMainItemContainer{display:flex;flex-direction:column;gap:8px;width:100%;overflow-y:auto;padding-right:4px}.conversationMainItemContainer::-webkit-scrollbar{width:6px}.conversationMainItemContainer::-webkit-scrollbar-track{background:transparent}.conversationMainItemContainer::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--background-text-color),transparent 75%);border-radius:10px}.conversationMainItemContainer .conversationMainItem{display:flex;align-items:center;gap:12px;padding:12px 14px;background:var(--background-color);border-radius:calc(var(--popup-container-radius) / 1.5);border:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);cursor:pointer;transition:all .2s var(--transition-smooth);position:relative}.conversationMainItemContainer .conversationMainItem:before{content:"";position:absolute;left:0;top:0;bottom:0;width:0;background:linear-gradient(90deg,color-mix(in srgb,var(--base-color),var(--background-color) 90%) 0%,transparent 100%);border-radius:calc(var(--popup-container-radius) / 1.5);transition:width .3s var(--transition-smooth)}.conversationMainItemContainer .conversationMainItem:hover{border-color:var(--base-color);transform:translate(4px);box-shadow:var(--shadow-md)}.conversationMainItemContainer .conversationMainItem:hover:before{width:100%}.conversationMainItemContainer .conversationMainItem>div:nth-child(1){width:40px;height:40px;border-radius:50%;overflow:hidden;flex-shrink:0;box-shadow:var(--shadow-sm);border:2px solid var(--background-color);position:relative;z-index:1}.conversationMainItemContainer .conversationMainItem>div:nth-child(1) img{width:100%;height:100%;object-fit:cover}.conversationMainItemContainer .textHolder{flex:1;overflow:hidden;position:relative;z-index:1}.conversationMainItemContainer .textHolder>p:nth-child(1){font-size:14px;font-weight:500;color:var(--background-text-color);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:2px}.conversationMainItemContainer .textHolder>p:nth-child(2){font-size:11px;color:color-mix(in srgb,var(--background-text-color),transparent 40%);font-weight:400}.conversationMainItem .unreadMessage{position:absolute;bottom:-2px;right:-2px;width:12px;height:12px;border-radius:50%;background:var(--base-color);border:2px solid var(--background-color);animation:robodialog-pulse 2s infinite}@keyframes robodialog-pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.7;transform:scale(1.1)}}.conversationMainItemContainer .conversationMainItem>div:nth-last-child(1){width:24px;height:24px;display:flex;align-items:center;justify-content:center;position:relative;z-index:1;opacity:.4;transform:rotate(-90deg);transition:all .2s var(--transition-smooth)}.conversationMainItemContainer .conversationMainItem:hover>div:nth-last-child(1){opacity:1;transform:translate(4px) rotate(-90deg)}.mainMessageContainer{display:flex;align-items:flex-end;gap:10px;width:100%;animation:robodialog-messageSlideUp .4s var(--transition-smooth)}@keyframes robodialog-messageSlideUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.mainMessageContainer.mySelfTextDiv{flex-direction:row-reverse}.logoWithMessageDiv{display:flex;align-items:center;justify-content:center;width:32px;height:32px;min-width:32px;border-radius:50%;overflow:hidden;box-shadow:var(--shadow-sm);border:2px solid var(--background-color);animation:robodialog-avatarPop .3s var(--transition-bounce)}@keyframes robodialog-avatarPop{0%{opacity:0;transform:scale(.5)}50%{transform:scale(1.1)}to{opacity:1;transform:scale(1)}}.logoWithMessageDiv img{width:100%;height:100%;object-fit:cover}.messageDiv{display:flex;flex-direction:column;max-width:75%;gap:4px}.messageDiv.mySelfTextDiv{align-items:flex-end}.NameAndDate{font-size:11px;font-weight:500;color:color-mix(in srgb,var(--background-text-color),transparent 40%);padding:0 4px;letter-spacing:.01em}.messageDiv .messageP{padding:12px 16px;word-break:break-word;line-height:1.6;box-shadow:var(--shadow-sm);transition:all .2s var(--transition-smooth);position:relative;width:max-content;max-width:100%}.mainMessageContainer:not(.mySelfTextDiv) .messageP{background:var(--background-color);color:var(--background-text-color);border:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);border-radius:calc(var(--popup-container-radius) / 1.5) calc(var(--popup-container-radius) / 1.5) calc(var(--popup-container-radius) / 1.5) 4px}.mainMessageContainer.mySelfTextDiv .messageP{background:linear-gradient(135deg,var(--base-color) 0%,color-mix(in srgb,var(--base-color),var(--background-text-color) 10%) 100%);color:var(--base-text-color);border-radius:calc(var(--popup-container-radius) / 1.5) calc(var(--popup-container-radius) / 1.5) 4px calc(var(--popup-container-radius) / 1.5);border:none}.mainMessageContainer.mySelfTextDiv .messageP>*{color:var(--base-text-color)}.messageDiv .markdownText p{font-size:14px;margin-bottom:8px;line-height:1.6}.messageDiv .markdownText>p:last-child{margin-bottom:0}.messageDiv .markdownText ul,.messageDiv .markdownText ol{margin-left:20px;margin-bottom:8px}.messageDiv .markdownText ul{list-style-type:disc}.messageDiv .markdownText ol{list-style-type:decimal}.messageDiv .markdownText li{margin-bottom:4px}.messageDiv .markdownText a{color:inherit;text-decoration:underline;font-weight:500;opacity:.9;transition:opacity .2s}.messageDiv .markdownText a:hover{opacity:1}.messageDiv .markdownText h1,.messageDiv .markdownText h2,.messageDiv .markdownText h3{font-weight:600;margin-bottom:8px;line-height:1.3}.messageDiv .markdownText h1{font-size:20px}.messageDiv .markdownText h2{font-size:18px}.messageDiv .markdownText h3{font-size:16px}.messageDiv .markdownText strong{font-weight:600}.messageDiv .markdownText code{background:#0000000d;padding:2px 6px;border-radius:4px;font-family:Courier New,monospace;font-size:13px}.mainMessageContainer .sources{display:flex;flex-wrap:wrap;gap:6px}.mainMessageContainer .sources a{margin-top:8px;display:inline-flex;align-items:center;padding:6px 12px;background:color-mix(in srgb,var(--background-text-color) 5%,var(--background-color));color:var(--base-color);border-radius:calc(var(--popup-container-radius) * .66);font-size:11px;font-weight:600;text-decoration:none;transition:all .2s var(--transition-smooth);border:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%)}.mainMessageContainer .sources a:hover{background:color-mix(in srgb,var(--base-color),var(--background-color) 90%);border-color:var(--base-color);transform:translateY(-2px);box-shadow:var(--shadow-sm)}.messagesLoading{display:flex;justify-content:center;padding:20px}.messagesLoading>div{width:24px;height:24px;color:var(--base-color)}.otherUserTextLoading{display:inline-flex;align-items:center;gap:6px;padding:16px 20px;background:var(--background-color);border:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);border-radius:calc(var(--popup-container-radius) / 1.5);box-shadow:var(--shadow-sm)}.otherUserTextLoading .loading1,.otherUserTextLoading .loading2,.otherUserTextLoading .loading3{width:8px;height:8px;border-radius:50%;background:var(--base-color);animation:robodialog-bounce 1.4s infinite ease-in-out}.otherUserTextLoading .loading2{animation-delay:.2s}.otherUserTextLoading .loading3{animation-delay:.4s}@keyframes robodialog-bounce{0%,80%,to{opacity:.3;transform:scale(.8)}40%{opacity:1;transform:scale(1)}}.messageDiv form h3,.messageDiv form h4{font-weight:600;color:var(--background-text-color);margin-bottom:8px;font-size:14px}.messageDiv form input,.messageDiv form select,.messageDiv form textarea{width:100%;padding:10px 12px;border:1.5px solid color-mix(in srgb,var(--background-text-color),transparent 85%);border-radius:calc(var(--popup-container-radius) / 1.5);background:var(--input-background-color);color:var(--input-text-color);font-size:14px;font-family:inherit;outline:none;transition:all .2s var(--transition-smooth)}.messageDiv form input:focus,.messageDiv form select:focus,.messageDiv form textarea:focus{border-color:var(--base-color);box-shadow:0 0 0 3px color-mix(in srgb,var(--base-color),var(--background-color) 90%)}.messageDiv form textarea{resize:vertical;min-height:80px}.messageDiv form button{padding:10px 20px;border:none;border-radius:calc(var(--popup-container-radius) / 1.5);font-size:14px;font-weight:600;cursor:pointer;transition:all .2s var(--transition-smooth);background:var(--base-color);color:var(--base-text-color);margin-right:8px}.messageDiv form button:hover{background:color-mix(in srgb,var(--base-color),var(--background-text-color) 10%);transform:translateY(-2px);box-shadow:var(--shadow-md)}.messageDiv form button:active{transform:translateY(0)}.livelinkSubmitDiv{display:flex;gap:8px;margin-top:10px;padding-top:16px;border-top:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%)}.messageDiv form>div:has(svg){display:flex;gap:3px;padding:2px 0}.messageDiv form>div:has(svg)>div{cursor:pointer;transition:transform .2s var(--transition-bounce)}.messageDiv form>div:has(svg)>div:hover{transform:scale(1.2)}.hint{display:block;font-size:11px;color:color-mix(in srgb,var(--background-text-color),transparent 40%);margin-top:4px}.massageInputDivMain{position:relative;display:flex;align-items:center;background:var(--input-background-color);border:1.5px solid color-mix(in srgb,var(--background-text-color),transparent 85%);border-radius:calc(var(--popup-container-radius) / 1.5);overflow:hidden;transition:all .2s var(--transition-smooth);width:100%}.massageInputDivMain>form{width:100%}.massageInputDivMain:focus-within{border-color:var(--base-color);box-shadow:0 0 0 3px color-mix(in srgb,var(--base-color),var(--background-color) 90%)}.massageInputDivMain textarea{border:none!important;box-shadow:none!important}.massageInputDivMain textarea::placeholder{color:color-mix(in srgb,var(--background-text-color),transparent 60%)}.inputArrowMassageImg{position:absolute;right:8px;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center;width:32px;height:32px;background:color-mix(in srgb,var(--input-background-color),transparent 60%);border:none;border-radius:calc(var(--popup-container-radius) * .66);cursor:pointer;transition:all .2s var(--transition-smooth);color:var(--base-color)}.inputArrowMassageImg:hover{background:color-mix(in srgb,var(--base-color),var(--background-color) 90%);transform:translateY(-50%) scale(1.1)}.inputArrowMassageImg:active{transform:translateY(-50%) scale(.95)}.inputArrowMassageImg.attachment{right:48px}.inputArrowMassageImg svg{width:18px;height:18px}.inputArrowMassageImg:disabled{opacity:.3;cursor:not-allowed;pointer-events:none}.hoveringMessageInner{margin:8px 4px;display:flex;flex-direction:column;align-items:flex-end;gap:6px;animation:robodialog-slideUpFade .3s var(--transition-smooth)}@keyframes robodialog-slideUpFade{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.hoveringMessageInner>div{padding:10px 14px;background:var(--background-color);border:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);border-radius:calc(var(--popup-container-radius) * .66);font-size:13px;font-weight:500;cursor:pointer;transition:all .2s var(--transition-smooth);box-shadow:var(--shadow-sm);display:flex;align-items:center;gap:8px}.hoveringMessageInner>div:hover{background:color-mix(in srgb,var(--base-color),var(--background-color) 90%);border-color:var(--base-color);transform:translateY(-2px);box-shadow:var(--shadow-md)}.agents{display:flex;align-items:center;justify-content:center;height:36px;margin:0 auto}.mainAgents{height:44px;margin-top:30px}.agents>div{width:36px;height:36px;border-radius:50%;background:var(--base-text-color);border:3px solid var(--base-text-color);overflow:hidden;position:relative;box-shadow:var(--shadow-sm);transition:transform .2s var(--transition-smooth)}.mainAgents>div{width:44px;height:44px}.agents>div:hover{transform:translateY(-4px) scale(1.05);z-index:10;box-shadow:var(--shadow-lg)}.agents>div:nth-child(2){margin-left:-12px}.agents>div:nth-child(3){margin-left:-12px}.agents img{width:100%;height:100%;object-fit:cover}.onlineAgents{display:flex;flex-direction:column;align-items:center;gap:12px;margin-top:16px;animation:robodialog-fadeIn .4s var(--transition-smooth)}@keyframes robodialog-fadeIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.onlineAgents>div:nth-child(1){padding:12px 24px;background:var(--background-color);border:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);border-radius:calc(var(--popup-container-radius) / 1.5);font-size:14px;text-align:center;box-shadow:var(--shadow-sm)}.onlineAgents>div:nth-child(2){display:flex;align-items:center;gap:10px}.onlineAgents>div:nth-child(2)>p{font-size:13px;color:color-mix(in srgb,var(--background-text-color),transparent 40%);font-weight:500}.onlineAgents>div:nth-child(2)>p b{color:var(--base-color);font-weight:700}.chatHoveringMessages{display:flex;flex-direction:column;gap:8px;pointer-events:all}.chatHoveringMessage{padding:10px;background:var(--background-color);border-radius:calc(var(--popup-container-radius) / 1.5);font-size:13px;max-width:320px;cursor:pointer;box-shadow:var(--shadow-lg);border:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);transition:all .3s var(--transition-smooth);animation:robodialog-popIn .4s var(--transition-bounce);position:relative;overflow:hidden;width:max-content}.chatHoveringMessage.closeMessages{padding:10px 10px 5px}@keyframes robodialog-popIn{0%{opacity:0;transform:translateY(20px) scale(.9)}50%{transform:translateY(-5px) scale(1.02)}to{opacity:1;transform:translateY(0) scale(1)}}.chatHoveringMessage:hover{transform:translateY(-4px);box-shadow:var(--shadow-xl);border-color:var(--base-color)}.chatHoveringMessage:before{content:"";position:absolute;top:0;left:0;width:4px;height:100%;background:var(--base-color);transform:scaleY(0);transition:transform .3s var(--transition-smooth)}.chatHoveringMessage:hover:before{transform:scaleY(1)}.chatHoveringMessageUser{display:flex;align-items:center;gap:8px;margin-bottom:8px;font-weight:600;color:var(--background-text-color);font-size:13px}.chatHoveringMessageUser>div:nth-child(1){width:24px;height:24px;border-radius:50%;overflow:hidden;flex-shrink:0;box-shadow:var(--shadow-sm);background:color-mix(in srgb,var(--background-text-color) 5%,var(--background-color))}.chatHoveringMessageUser>div:nth-child(1)>img,.chatHoveringMessageUser>div:nth-child(1)>svg{width:100%;height:100%;object-fit:cover}@media screen and (max-width: 395px){.chatHoveringMessage{max-width:85vw}}',_p=".background-color{color:var(--background-color)}.background-text-color{color:var(--background-text-color)}.input-background-color{color:var(--input-background-color)}.input-text-color{color:var(--input-text-color)}.base-color{color:var(--base-color)}.base-text-color{color:var(--base-text-color)}",vp='.robodialog-chatbot-app .ai-generating{position:relative;border-radius:12px;padding:16px;overflow:hidden}.robodialog-chatbot-app .ai-generating:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border-radius:inherit;padding:2px;background:linear-gradient(120deg,#006fee,#1effda,#006fee,#1effda);background-size:300% 300%;animation:borderGradientMove 3s ease infinite;-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;pointer-events:none}@keyframes borderGradientMove{0%{background-position:0% 50%}50%{background-position:100% 50%}to{background-position:0% 50%}}.robodialog-chatbot-app .thinkingContainer{display:flex;flex-direction:column;gap:4px;margin-bottom:12px;overflow:hidden}.robodialog-chatbot-app .thinkingChunk{opacity:0;transform:translateY(8px);animation:thinkingFadeIn .35s ease-out forwards;font-size:11px;line-height:1.4;color:color-mix(in srgb,var(--background-text-color),transparent 40%);font-weight:500;max-height:1.4em;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;word-break:break-word}@keyframes thinkingFadeIn{to{opacity:1;transform:translateY(0)}}',yp='.robodialog-toast{position:absolute;padding:10px;display:flex;align-items:center;justify-content:space-between;pointer-events:all;animation:robodialog-toastSlideIn .4s var(--transition-bounce);transition:all .3s var(--transition-smooth);overflow:hidden;z-index:12;width:100%}@keyframes robodialog-toastSlideIn{0%{opacity:0;transform:translateY(-100%) scale(.9)}50%{transform:translateY(10px) scale(1.02)}to{opacity:1;transform:translateY(0) scale(1)}}.robodialog-toast:after{content:"";position:absolute;bottom:0;left:0;height:3px;background:currentColor;opacity:.3;animation:robodialog-toastProgress 3s linear forwards}@keyframes robodialog-toastProgress{0%{width:100%}to{width:0%}}.robodialog-toast-success{background:linear-gradient(160deg,var(--base-color) 0%,color-mix(in srgb,var(--base-color),var(--background-text-color) 30%) 100%);color:var(--base-text-color)}.robodialog-toast-success:before{background:color-mix(in srgb,var(--base-color),var(--background-color) 95%)}.robodialog-toast-error{background:linear-gradient(160deg,red,color-mix(in srgb,red,black 30%));color:#fff}.robodialog-toast-error:before{background:color-mix(in srgb,var(--base-color),var(--background-color) 95%)}.robodialog-toast-info{background:linear-gradient(160deg,var(--base-color) 0%,color-mix(in srgb,var(--base-color),var(--background-text-color) 10%) 100%);color:var(--base-text-color)}.robodialog-toast-info:before{background:color-mix(in srgb,var(--base-color),var(--background-color) 90%)}.robodialog-toast-message{flex:1;font-size:14px;font-weight:500;line-height:1.5;word-break:break-word;position:relative;z-index:1;letter-spacing:.01em}.robodialog-toast-close{width:28px;height:28px;border-radius:50%;background:color-mix(in srgb,var(--base-text-color),transparent 90%);border:none;color:inherit;font-size:20px;font-weight:500;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s var(--transition-smooth)}.robodialog-toast-close:hover{background:color-mix(in srgb,var(--base-text-color),transparent 80%);transform:scale(1.1)}.robodialog-toast-close:active{transform:scale(.95)}.robodialog-toast-icon{width:24px;height:24px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--base-text-color),transparent 80%);border-radius:50%;position:relative;z-index:1;animation:robodialog-iconPulse 2s ease-in-out infinite}@keyframes robodialog-iconPulse{0%,to{transform:scale(1);opacity:1}50%{transform:scale(1.1);opacity:.8}}.robodialog-toast.fade-out{animation:robodialog-toastFadeOut .3s var(--transition-smooth) forwards}@keyframes robodialog-toastFadeOut{0%{opacity:1;transform:translateY(0) scale(1)}to{opacity:0;transform:translateY(-20px) scale(.95)}}@media screen and (max-width: 768px){.robodialog-toast-message{font-size:13px}.robodialog-toast-close{width:24px;height:24px;right:10px;font-size:18px}}.robodialog-toast:focus-within{outline:2px solid color-mix(in srgb,var(--base-text-color),transparent 50%);outline-offset:2px}',xp=()=>Array.from(document.querySelectorAll("script[src]")).find(n=>n.dataset.chatbotId!==void 0)??null,wp=()=>{let n,e,t=!1;const r=xp();if(r){if(n=r.dataset.chatbotId,!n)throw console.error("[ChatbotWidget] missing data-chatbot-id"),new Error("ChatbotWidget: data-chatbot-id is required");const s=r.dataset.userId,i=r.dataset.email,o=r.dataset.bearer;t=r.dataset.fullScreen==="true",(s||i||o)&&(e={userId:s,email:i,bearer:o})}else{const s=new URLSearchParams(location.search);n=s.get("chatbotId")||"6981d77231807db8f3cfa34e",t=s.get("fullScreen")==="true",console.warn("[ChatbotWidget] running in dev mode – using fallback chatbot",n);const i=s.get("userId")||void 0,o=s.get("email")||void 0,a=s.get("bearer")||void 0;(i||o||a)&&(e={userId:i,email:o,bearer:a})}return{chatbotId:n,otherData:e,fullScreen:t}};let qe;const Sl=()=>{if(document.getElementById("my-chatbot-root"))return;const{chatbotId:n,otherData:e,fullScreen:t}=wp();if(!n)return;qe=document.createElement("div"),qe.id="my-chatbot-root",qe.style.position="fixed",qe.style.zIndex="101",qe.style.pointerEvents=t?"auto":"none",t&&(qe.style.top="0",qe.style.left="0",qe.style.width="100vw",qe.style.height="100vh"),document.body.appendChild(qe);const r=qe.attachShadow({mode:"open"}),s=document.createElement("div");t&&(s.style.width="100%",s.style.height="100%"),r.appendChild(s);const i=document.createElement("style");i.textContent=[gp,mp,bp,_p,vp,yp].join(`
116
- `),r.appendChild(i),Ct(p(pp,{chatbotId:n,userData:e,fullScreen:t}),s),console.log("[ChatbotWidget] mounted")},Cl=()=>{const n=document.getElementById("my-chatbot-root");if(n){if(n.shadowRoot){const e=n.shadowRoot.querySelector("div");e&&Ct(null,e)}n.remove(),qe=null,console.log("[ChatbotWidget] unmounted")}};Sl(),window.robodialog={refresh:()=>{Cl(),Sl()},_destroy:Cl}})();
115
+ `).map(t=>JSON.parse(t))}applyDeltaIfNeeded(e,t){let r,s;if(e.delta){const i=dp(t,new TextEncoder().encode(e.data));r=JSON.parse(new TextDecoder().decode(i)),s=i}else r=JSON.parse(e.data),s=new TextEncoder().encode(e.data);return{newData:r,newPrevValue:s}}}const hp={headers:{},token:"",getToken:null,data:null,getData:null,debug:!1,name:"js",version:"",fetch:null,readableStream:null,websocket:null,eventsource:null,sockjs:null,sockjsOptions:{},emulationEndpoint:"/emulation",minReconnectDelay:500,maxReconnectDelay:2e4,timeout:5e3,maxServerPingDelay:1e4,networkEventTarget:null};class pt extends Error{constructor(e){super(e),this.name=this.constructor.name}}class pr extends yl{constructor(e,t){super(),this._reconnectTimeout=null,this._refreshTimeout=null,this._serverPingTimeout=null,this.state=ge.Disconnected,this._transportIsOpen=!1,this._endpoint=e,this._emulation=!1,this._transports=[],this._currentTransportIndex=0,this._triedAllTransports=!1,this._transportWasOpen=!1,this._transport=null,this._transportId=0,this._deviceWentOffline=!1,this._transportClosed=!0,this._codec=new kl,this._reconnecting=!1,this._reconnectTimeout=null,this._reconnectAttempts=0,this._client=null,this._session="",this._node="",this._subs={},this._serverSubs={},this._commandId=0,this._commands=[],this._batching=!1,this._refreshRequired=!1,this._refreshTimeout=null,this._callbacks={},this._token="",this._data=null,this._dispatchPromise=Promise.resolve(),this._serverPing=0,this._serverPingTimeout=null,this._sendPong=!1,this._promises={},this._promiseId=0,this._debugEnabled=!1,this._networkEventsSet=!1,this._config=Object.assign(Object.assign({},hp),t),this._configure(),this._debugEnabled?(this.on("state",r=>{this._debug("client state",r.oldState,"->",r.newState)}),this.on("error",r=>{this._debug("client error",r)})):this.on("error",function(){Function.prototype()})}newSubscription(e,t){if(this.getSubscription(e)!==null)throw new Error("Subscription to the channel "+e+" already exists");const r=new np(this,e,t);return this._subs[e]=r,r}getSubscription(e){return this._getSub(e)}removeSubscription(e){e&&(e.state!==Ae.Unsubscribed&&e.unsubscribe(),this._removeSubscription(e))}subscriptions(){return this._subs}ready(e){return we(this,void 0,void 0,function*(){switch(this.state){case ge.Disconnected:throw{code:oe.clientDisconnected,message:"client disconnected"};case ge.Connected:return;default:return new Promise((t,r)=>{const s={resolve:t,reject:r};e&&(s.timeout=setTimeout(()=>{r({code:oe.timeout,message:"timeout"})},e)),this._promises[this._nextPromiseId()]=s})}})}connect(){if(this._isConnected()){this._debug("connect called when already connected");return}if(this._isConnecting()){this._debug("connect called when already connecting");return}this._debug("connect called"),this._reconnectAttempts=0,this._startConnecting()}disconnect(){this._disconnect(_n.disconnectCalled,"disconnect called",!1)}setToken(e){this._token=e}setData(e){this._data=e}setHeaders(e){this._config.headers=e}send(e){return we(this,void 0,void 0,function*(){const t={send:{data:e}};if(yield this._methodCall(),!this._transportSendCommands([t]))throw this._createErrorObject(oe.transportWriteError,"transport write error")})}rpc(e,t){return we(this,void 0,void 0,function*(){const r={rpc:{method:e,data:t}};return yield this._methodCall(),{data:(yield this._callPromise(r,i=>i.rpc)).data}})}publish(e,t){return we(this,void 0,void 0,function*(){const r={publish:{channel:e,data:t}};return yield this._methodCall(),yield this._callPromise(r,()=>({})),{}})}history(e,t){return we(this,void 0,void 0,function*(){const r={history:this._getHistoryRequest(e,t)};yield this._methodCall();const s=yield this._callPromise(r,o=>o.history),i=[];if(s.publications)for(let o=0;o<s.publications.length;o++)i.push(this._getPublicationContext(e,s.publications[o]));return{publications:i,epoch:s.epoch||"",offset:s.offset||0}})}presence(e){return we(this,void 0,void 0,function*(){const t={presence:{channel:e}};yield this._methodCall();const s=(yield this._callPromise(t,i=>i.presence)).presence;for(const i in s)if(Object.prototype.hasOwnProperty.call(s,i)){const o=s[i],a=o.conn_info,l=o.chan_info;a&&(o.connInfo=a),l&&(o.chanInfo=l)}return{clients:s}})}presenceStats(e){return we(this,void 0,void 0,function*(){const t={presence_stats:{channel:e}};yield this._methodCall();const r=yield this._callPromise(t,s=>s.presence_stats);return{numUsers:r.num_users,numClients:r.num_clients}})}startBatching(){this._batching=!0}stopBatching(){const e=this;Promise.resolve().then(function(){Promise.resolve().then(function(){e._batching=!1,e._flush()})})}_debug(...e){this._debugEnabled&&Qf("debug",e)}_codecName(){return this._codec.name()}_formatOverride(){}_configure(){if(!("Promise"in globalThis))throw new Error("Promise polyfill required");if(!this._endpoint)throw new Error("endpoint configuration required");if(this._config.token!==null&&(this._token=this._config.token),this._config.data!==null&&(this._data=this._config.data),this._codec=new kl,this._formatOverride(),(this._config.debug===!0||typeof localStorage<"u"&&typeof localStorage.getItem=="function"&&localStorage.getItem("centrifuge.debug"))&&(this._debugEnabled=!0),this._debug("config",this._config),typeof this._endpoint!="string")if(Array.isArray(this._endpoint)){this._transports=this._endpoint,this._emulation=!0;for(const e in this._transports)if(this._transports.hasOwnProperty(e)){const t=this._transports[e];if(!t.endpoint||!t.transport)throw new Error("malformed transport configuration");const r=t.transport;if(["websocket","http_stream","sse","sockjs","webtransport"].indexOf(r)<0)throw new Error("unsupported transport name: "+r)}}else throw new Error("unsupported url configuration type: only string or array of objects are supported")}_setState(e){if(this.state!==e){this._reconnecting=!1;const t=this.state;return this.state=e,this.emit("state",{newState:e,oldState:t}),!0}return!1}_isDisconnected(){return this.state===ge.Disconnected}_isConnecting(){return this.state===ge.Connecting}_isConnected(){return this.state===ge.Connected}_nextCommandId(){return++this._commandId}_setNetworkEvents(){if(this._networkEventsSet)return;let e=null;this._config.networkEventTarget!==null?e=this._config.networkEventTarget:typeof globalThis.addEventListener<"u"&&(e=globalThis),e&&(e.addEventListener("offline",()=>{this._debug("offline event triggered"),(this.state===ge.Connected||this.state===ge.Connecting)&&(this._disconnect(kt.transportClosed,"transport closed",!0),this._deviceWentOffline=!0)}),e.addEventListener("online",()=>{this._debug("online event triggered"),this.state===ge.Connecting&&(this._deviceWentOffline&&!this._transportClosed&&(this._deviceWentOffline=!1,this._transportClosed=!0),this._clearReconnectTimeout(),this._startReconnecting())}),this._networkEventsSet=!0)}_getReconnectDelay(){const e=hr(this._reconnectAttempts,this._config.minReconnectDelay,this._config.maxReconnectDelay);return this._reconnectAttempts+=1,e}_clearOutgoingRequests(){for(const e in this._callbacks)if(this._callbacks.hasOwnProperty(e)){const t=this._callbacks[e];clearTimeout(t.timeout);const r=t.errback;if(!r)continue;r({error:this._createErrorObject(oe.connectionClosed,"connection closed")})}this._callbacks={}}_clearConnectedState(){this._client=null,this._clearServerPingTimeout(),this._clearRefreshTimeout();for(const e in this._subs){if(!this._subs.hasOwnProperty(e))continue;const t=this._subs[e];t.state===Ae.Subscribed&&t._setSubscribing(ur.transportClosed,"transport closed")}for(const e in this._serverSubs)this._serverSubs.hasOwnProperty(e)&&this.emit("subscribing",{channel:e})}_handleWriteError(e){for(const t of e){const r=t.id;if(!(r in this._callbacks))continue;const s=this._callbacks[r];clearTimeout(this._callbacks[r].timeout),delete this._callbacks[r];const i=s.errback;i({error:this._createErrorObject(oe.transportWriteError,"transport write error")})}}_transportSendCommands(e){if(!e.length)return!0;if(!this._transport)return!1;try{this._transport.send(this._codec.encodeCommands(e),this._session,this._node)}catch(t){return this._debug("error writing commands",t),this._handleWriteError(e),!1}return!0}_initializeTransport(){let e;this._config.websocket!==null?e=this._config.websocket:typeof globalThis.WebSocket!="function"&&typeof globalThis.WebSocket!="object"||(e=globalThis.WebSocket);let t=null;this._config.sockjs!==null?t=this._config.sockjs:typeof globalThis.SockJS<"u"&&(t=globalThis.SockJS);let r=null;this._config.eventsource!==null?r=this._config.eventsource:typeof globalThis.EventSource<"u"&&(r=globalThis.EventSource);let s=null;this._config.fetch!==null?s=this._config.fetch:typeof globalThis.fetch<"u"&&(s=globalThis.fetch);let i=null;if(this._config.readableStream!==null?i=this._config.readableStream:typeof globalThis.ReadableStream<"u"&&(i=globalThis.ReadableStream),this._emulation){this._currentTransportIndex>=this._transports.length&&(this._triedAllTransports=!0,this._currentTransportIndex=0);let h=0;for(;;){if(h>=this._transports.length)throw new Error("no supported transport found");const f=this._transports[this._currentTransportIndex],m=f.transport,b=f.endpoint;if(m==="websocket"){if(this._debug("trying websocket transport"),this._transport=new wl(b,{websocket:e}),!this._transport.supported()){this._debug("websocket transport not available"),this._currentTransportIndex++,h++;continue}}else if(m==="webtransport"){if(this._debug("trying webtransport transport"),this._transport=new op(b,{webtransport:globalThis.WebTransport,decoder:this._codec,encoder:this._codec}),!this._transport.supported()){this._debug("webtransport transport not available"),this._currentTransportIndex++,h++;continue}}else if(m==="http_stream"){if(this._debug("trying http_stream transport"),this._transport=new sp(b,{fetch:s,readableStream:i,emulationEndpoint:this._config.emulationEndpoint,decoder:this._codec,encoder:this._codec}),!this._transport.supported()){this._debug("http_stream transport not available"),this._currentTransportIndex++,h++;continue}}else if(m==="sse"){if(this._debug("trying sse transport"),this._transport=new ip(b,{eventsource:r,fetch:s,emulationEndpoint:this._config.emulationEndpoint}),!this._transport.supported()){this._debug("sse transport not available"),this._currentTransportIndex++,h++;continue}}else if(m==="sockjs"){if(this._debug("trying sockjs"),this._transport=new rp(b,{sockjs:t,sockjsOptions:this._config.sockjsOptions}),!this._transport.supported()){this._debug("sockjs transport not available"),this._currentTransportIndex++,h++;continue}}else throw new Error("unknown transport "+m);break}}else{if(Kf(this._endpoint,"http"))throw new Error("Provide explicit transport endpoints configuration in case of using HTTP (i.e. using array of TransportEndpoint instead of a single string), or use ws(s):// scheme in an endpoint if you aimed using WebSocket transport");if(this._debug("client will use websocket"),this._transport=new wl(this._endpoint,{websocket:e}),!this._transport.supported())throw new Error("WebSocket constructor not found, make sure it is available globally or passed as a dependency in Centrifuge options")}const o=this,a=this._transport,l=this._nextTransportId();o._debug("id of transport",l);let c=!1;const u=[];if(this._transport.emulation()){const h=o._sendConnect(!0);u.push(h)}this._setNetworkEvents();const d=this._codec.encodeCommands(u);this._transportClosed=!1;let g;g=setTimeout(function(){a.close()},this._config.timeout),this._transport.initialize(this._codecName(),{onOpen:function(){if(g&&(clearTimeout(g),g=null),o._transportId!=l){o._debug("open callback from non-actual transport"),a.close();return}c=!0,o._debug(a.subName(),"transport open"),!a.emulation()&&(o._transportIsOpen=!0,o._transportWasOpen=!0,o.startBatching(),o._sendConnect(!1),o._sendSubscribeCommands(),o.stopBatching(),o.emit("__centrifuge_debug:connect_frame_sent",{}))},onError:function(h){if(o._transportId!=l){o._debug("error callback from non-actual transport");return}o._debug("transport level error",h)},onClose:function(h){if(g&&(clearTimeout(g),g=null),o._transportId!=l){o._debug("close callback from non-actual transport");return}o._debug(a.subName(),"transport closed"),o._transportClosed=!0,o._transportIsOpen=!1;let f="connection closed",m=!0,b=0;if(h&&"code"in h&&h.code&&(b=h.code),h&&h.reason)try{const v=JSON.parse(h.reason);f=v.reason,m=v.reconnect}catch{f=h.reason,(b>=3500&&b<4e3||b>=4500&&b<5e3)&&(m=!1)}b<3e3?(b===1009?(b=_n.messageSizeLimit,f="message size limit exceeded",m=!1):(b=kt.transportClosed,f="transport closed"),o._emulation&&!o._transportWasOpen&&(o._currentTransportIndex++,o._currentTransportIndex>=o._transports.length&&(o._triedAllTransports=!0,o._currentTransportIndex=0))):o._transportWasOpen=!0,o._isConnecting()&&!c&&o.emit("error",{type:"transport",error:{code:oe.transportClosed,message:"transport closed"},transport:a.name()}),o._reconnecting=!1,o._disconnect(b,f,m)},onMessage:function(h){o._dataReceived(h)}},d),o.emit("__centrifuge_debug:transport_initialized",{})}_sendConnect(e){const t=this._constructConnectCommand(),r=this;return this._call(t,e).then(s=>{const i=s.reply.connect;r._connectResponse(i),s.next&&s.next()},s=>{r._connectError(s.error),s.next&&s.next()}),t}_startReconnecting(){if(this._debug("start reconnecting"),!this._isConnecting()){this._debug("stop reconnecting: client not in connecting state");return}if(this._reconnecting){this._debug("reconnect already in progress, return from reconnect routine");return}if(this._transportClosed===!1){this._debug("waiting for transport close");return}this._reconnecting=!0;const e=this._token==="";if(!(this._refreshRequired||e&&this._config.getToken!==null)){this._config.getData?this._config.getData().then(s=>{this._isConnecting()&&(this._data=s,this._initializeTransport())}).catch(s=>this._handleGetDataError(s)):this._initializeTransport();return}const r=this;this._getToken().then(function(s){if(r._isConnecting()){if(s==null||s==null){r._failUnauthorized();return}r._token=s,r._debug("connection token refreshed"),r._config.getData?r._config.getData().then(function(i){r._isConnecting()&&(r._data=i,r._initializeTransport())}).catch(i=>r._handleGetDataError(i)):r._initializeTransport()}}).catch(function(s){if(!r._isConnecting())return;if(s instanceof pt){r._failUnauthorized();return}r.emit("error",{type:"connectToken",error:{code:oe.clientConnectToken,message:s!==void 0?s.toString():""}});const i=r._getReconnectDelay();r._debug("error on getting connection token, reconnect after "+i+" milliseconds",s),r._reconnecting=!1,r._reconnectTimeout=setTimeout(()=>{r._startReconnecting()},i)})}_handleGetDataError(e){if(e instanceof pt){this._failUnauthorized();return}this.emit("error",{type:"connectData",error:{code:oe.badConfiguration,message:(e==null?void 0:e.toString())||""}});const t=this._getReconnectDelay();this._debug("error on getting connect data, reconnect after "+t+" milliseconds",e),this._reconnecting=!1,this._reconnectTimeout=setTimeout(()=>{this._startReconnecting()},t)}_connectError(e){this.state===ge.Connecting&&(e.code===109&&(this._refreshRequired=!0),e.code<100||e.temporary===!0||e.code===109?(this.emit("error",{type:"connect",error:e}),this._debug("closing transport due to connect error"),this._disconnect(e.code,e.message,!0)):this._disconnect(e.code,e.message,!1))}_scheduleReconnect(){if(!this._isConnecting())return;let e=!1;this._emulation&&!this._transportWasOpen&&!this._triedAllTransports&&(e=!0);let t=this._getReconnectDelay();e&&(t=0),this._debug("reconnect after "+t+" milliseconds"),this._clearReconnectTimeout(),this._reconnectTimeout=setTimeout(()=>{this._startReconnecting()},t)}_constructConnectCommand(){const e={};this._token&&(e.token=this._token),this._data&&(e.data=this._data),this._config.name&&(e.name=this._config.name),this._config.version&&(e.version=this._config.version),Object.keys(this._config.headers).length>0&&(e.headers=this._config.headers);const t={};let r=!1;for(const s in this._serverSubs)if(this._serverSubs.hasOwnProperty(s)&&this._serverSubs[s].recoverable){r=!0;const i={recover:!0};this._serverSubs[s].offset&&(i.offset=this._serverSubs[s].offset),this._serverSubs[s].epoch&&(i.epoch=this._serverSubs[s].epoch),t[s]=i}return r&&(e.subs=t),{connect:e}}_getHistoryRequest(e,t){const r={channel:e};return t!==void 0&&(t.since&&(r.since={offset:t.since.offset},t.since.epoch&&(r.since.epoch=t.since.epoch)),t.limit!==void 0&&(r.limit=t.limit),t.reverse===!0&&(r.reverse=!0)),r}_methodCall(){return this._isConnected()?Promise.resolve():new Promise((e,t)=>{const r=setTimeout(function(){t({code:oe.timeout,message:"timeout"})},this._config.timeout);this._promises[this._nextPromiseId()]={timeout:r,resolve:e,reject:t}})}_callPromise(e,t){return new Promise((r,s)=>{this._call(e,!1).then(i=>{var o;const a=t(i.reply);r(a),(o=i.next)===null||o===void 0||o.call(i)},i=>{var o;s(i.error),(o=i.next)===null||o===void 0||o.call(i)})})}_dataReceived(e){this._serverPing>0&&this._waitServerPing();const t=this._codec.decodeReplies(e);this._dispatchPromise=this._dispatchPromise.then(()=>{let r;this._dispatchPromise=new Promise(s=>{r=s}),this._dispatchSynchronized(t,r)})}_dispatchSynchronized(e,t){let r=Promise.resolve();for(const s in e)e.hasOwnProperty(s)&&(r=r.then(()=>this._dispatchReply(e[s])));r=r.then(()=>{t()})}_dispatchReply(e){let t;const r=new Promise(i=>{t=i});if(e==null)return this._debug("dispatch: got undefined or null reply"),t(),r;const s=e.id;return s&&s>0?this._handleReply(e,t):e.push?this._handlePush(e.push,t):this._handleServerPing(t),r}_call(e,t){return new Promise((r,s)=>{e.id=this._nextCommandId(),this._registerCall(e.id,r,s),t||this._addCommand(e)})}_startConnecting(){this._debug("start connecting"),this._setState(ge.Connecting)&&this.emit("connecting",{code:kt.connectCalled,reason:"connect called"}),this._client=null,this._startReconnecting()}_disconnect(e,t,r){if(this._isDisconnected())return;this._transportIsOpen=!1;const s=this.state;this._reconnecting=!1;const i={code:e,reason:t};let o=!1;if(r?o=this._setState(ge.Connecting):(o=this._setState(ge.Disconnected),this._rejectPromises({code:oe.clientDisconnected,message:"disconnected"})),this._clearOutgoingRequests(),s===ge.Connecting&&this._clearReconnectTimeout(),s===ge.Connected&&this._clearConnectedState(),o&&(this._isConnecting()?this.emit("connecting",i):this.emit("disconnected",i)),this._transport){this._debug("closing existing transport");const a=this._transport;this._transport=null,a.close(),this._transportClosed=!0,this._nextTransportId()}else this._debug("no transport to close");this._scheduleReconnect()}_failUnauthorized(){this._disconnect(_n.unauthorized,"unauthorized",!1)}_getToken(){return this._debug("get connection token"),this._config.getToken?this._config.getToken({}):(this.emit("error",{type:"configuration",error:{code:oe.badConfiguration,message:"token expired but no getToken function set in the configuration"}}),Promise.reject(new pt("")))}_refresh(){const e=this._client,t=this;this._getToken().then(function(r){if(e!==t._client)return;if(!r){t._failUnauthorized();return}if(t._token=r,t._debug("connection token refreshed"),!t._isConnected())return;const s={refresh:{token:t._token}};t._call(s,!1).then(i=>{const o=i.reply.refresh;t._refreshResponse(o),i.next&&i.next()},i=>{t._refreshError(i.error),i.next&&i.next()})}).catch(function(r){if(t._isConnected()){if(r instanceof pt){t._failUnauthorized();return}t.emit("error",{type:"refreshToken",error:{code:oe.clientRefreshToken,message:r!==void 0?r.toString():""}}),t._refreshTimeout=setTimeout(()=>t._refresh(),t._getRefreshRetryDelay())}})}_refreshError(e){e.code<100||e.temporary===!0?(this.emit("error",{type:"refresh",error:e}),this._refreshTimeout=setTimeout(()=>this._refresh(),this._getRefreshRetryDelay())):this._disconnect(e.code,e.message,!1)}_getRefreshRetryDelay(){return hr(0,5e3,1e4)}_refreshResponse(e){this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null),e.expires&&(this._client=e.client,this._refreshTimeout=setTimeout(()=>this._refresh(),fr(e.ttl)))}_removeSubscription(e){e!==null&&delete this._subs[e.channel]}_unsubscribe(e){if(!this._transportIsOpen)return Promise.resolve();const r={unsubscribe:{channel:e.channel}},s=this;return new Promise((o,a)=>{this._call(r,!1).then(l=>{o(),l.next&&l.next()},l=>{o(),l.next&&l.next(),s._disconnect(kt.unsubscribeError,"unsubscribe error",!0)})})}_getSub(e,t){if(t&&t>0){for(const s in this._subs)if(this._subs.hasOwnProperty(s)){const i=this._subs[s];if(i._id===t)return i}return null}const r=this._subs[e];return r||null}_isServerSub(e){return this._serverSubs[e]!==void 0}_sendSubscribeCommands(){const e=[];for(const t in this._subs){if(!this._subs.hasOwnProperty(t))continue;const r=this._subs[t];if(r._inflight!==!0&&r.state===Ae.Subscribing){const s=r._subscribe();s&&e.push(s)}}return e}_connectResponse(e){if(this._transportIsOpen=!0,this._transportWasOpen=!0,this._reconnectAttempts=0,this._refreshRequired=!1,this._isConnected())return;this._client=e.client,this._setState(ge.Connected),this._refreshTimeout&&clearTimeout(this._refreshTimeout),e.expires&&(this._refreshTimeout=setTimeout(()=>this._refresh(),fr(e.ttl))),this._session=e.session,this._node=e.node,this.startBatching(),this._sendSubscribeCommands(),this.stopBatching();const t={client:e.client,transport:this._transport.subName()};e.data&&(t.data=e.data),this.emit("connected",t),this._resolvePromises(),this._processServerSubs(e.subs||{}),e.ping&&e.ping>0?(this._serverPing=e.ping*1e3,this._sendPong=e.pong===!0,this._waitServerPing()):this._serverPing=0}_processServerSubs(e){for(const t in e){if(!e.hasOwnProperty(t))continue;const r=e[t];this._serverSubs[t]={offset:r.offset,epoch:r.epoch,recoverable:r.recoverable||!1};const s=this._getSubscribeContext(t,r);this.emit("subscribed",s)}for(const t in e){if(!e.hasOwnProperty(t))continue;const r=e[t];if(r.recovered){const s=r.publications;if(s&&s.length>0)for(const i in s)s.hasOwnProperty(i)&&this._handlePublication(t,s[i])}}for(const t in this._serverSubs)this._serverSubs.hasOwnProperty(t)&&(e[t]||(this.emit("unsubscribed",{channel:t}),delete this._serverSubs[t]))}_clearRefreshTimeout(){this._refreshTimeout!==null&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearReconnectTimeout(){this._reconnectTimeout!==null&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null)}_clearServerPingTimeout(){this._serverPingTimeout!==null&&(clearTimeout(this._serverPingTimeout),this._serverPingTimeout=null)}_waitServerPing(){this._config.maxServerPingDelay!==0&&this._isConnected()&&(this._clearServerPingTimeout(),this._serverPingTimeout=setTimeout(()=>{this._isConnected()&&this._disconnect(kt.noPing,"no ping",!0)},this._serverPing+this._config.maxServerPingDelay))}_getSubscribeContext(e,t){const r={channel:e,positioned:!1,recoverable:!1,wasRecovering:!1,recovered:!1,hasRecoveredPublications:!1};t.recovered&&(r.recovered=!0),t.positioned&&(r.positioned=!0),t.recoverable&&(r.recoverable=!0),t.was_recovering&&(r.wasRecovering=!0);let s="";"epoch"in t&&(s=t.epoch);let i=0;return"offset"in t&&(i=t.offset),(r.positioned||r.recoverable)&&(r.streamPosition={offset:i,epoch:s}),Array.isArray(t.publications)&&t.publications.length>0&&(r.hasRecoveredPublications=!0),t.data&&(r.data=t.data),r}_handleReply(e,t){const r=e.id;if(!(r in this._callbacks)){t();return}const s=this._callbacks[r];if(clearTimeout(this._callbacks[r].timeout),delete this._callbacks[r],tp(e)){const i=s.errback;if(!i){t();return}const o={code:e.error.code,message:e.error.message||"",temporary:e.error.temporary||!1};i({error:o,next:t})}else{const i=s.callback;if(!i)return;i({reply:e,next:t})}}_handleJoin(e,t,r){const s=this._getSub(e,r);if(!s&&e){if(this._isServerSub(e)){const i={channel:e,info:this._getJoinLeaveContext(t.info)};this.emit("join",i)}return}s._handleJoin(t)}_handleLeave(e,t,r){const s=this._getSub(e,r);if(!s&&e){if(this._isServerSub(e)){const i={channel:e,info:this._getJoinLeaveContext(t.info)};this.emit("leave",i)}return}s._handleLeave(t)}_handleUnsubscribe(e,t){const r=this._getSub(e,0);if(!r&&e){this._isServerSub(e)&&(delete this._serverSubs[e],this.emit("unsubscribed",{channel:e}));return}t.code<2500?r._setUnsubscribed(t.code,t.reason,!1):r._setSubscribing(t.code,t.reason)}_handleSubscribe(e,t){this._serverSubs[e]={offset:t.offset,epoch:t.epoch,recoverable:t.recoverable||!1},this.emit("subscribed",this._getSubscribeContext(e,t))}_handleDisconnect(e){const t=e.code;let r=!0;(t>=3500&&t<4e3||t>=4500&&t<5e3)&&(r=!1),this._disconnect(t,e.reason,r)}_getPublicationContext(e,t){const r={channel:e,data:t.data};return t.offset&&(r.offset=t.offset),t.info&&(r.info=this._getJoinLeaveContext(t.info)),t.tags&&(r.tags=t.tags),r}_getJoinLeaveContext(e){const t={client:e.client,user:e.user},r=e.conn_info;r&&(t.connInfo=r);const s=e.chan_info;return s&&(t.chanInfo=s),t}_handlePublication(e,t,r){const s=this._getSub(e,r);if(!s&&e){if(this._isServerSub(e)){const i=this._getPublicationContext(e,t);this.emit("publication",i),t.offset!==void 0&&(this._serverSubs[e].offset=t.offset)}return}s._handlePublication(t)}_handleMessage(e){this.emit("message",{data:e.data})}_handleServerPing(e){if(this._sendPong){const t={};this._transportSendCommands([t])}e()}_handlePush(e,t){const r=e.channel,s=e.id;e.pub?this._handlePublication(r,e.pub,s):e.message?this._handleMessage(e.message):e.join?this._handleJoin(r,e.join,s):e.leave?this._handleLeave(r,e.leave,s):e.unsubscribe?this._handleUnsubscribe(r,e.unsubscribe):e.subscribe?this._handleSubscribe(r,e.subscribe):e.disconnect&&this._handleDisconnect(e.disconnect),t()}_flush(){const e=this._commands.slice(0);this._commands=[],this._transportSendCommands(e)}_createErrorObject(e,t,r){const s={code:e,message:t};return r&&(s.temporary=!0),s}_registerCall(e,t,r){this._callbacks[e]={callback:t,errback:r,timeout:null},this._callbacks[e].timeout=setTimeout(()=>{delete this._callbacks[e],xl(r)&&r({error:this._createErrorObject(oe.timeout,"timeout")})},this._config.timeout)}_addCommand(e){this._batching?this._commands.push(e):this._transportSendCommands([e])}_nextPromiseId(){return++this._promiseId}_nextTransportId(){return++this._transportId}_resolvePromises(){for(const e in this._promises)this._promises.hasOwnProperty(e)&&(this._promises[e].timeout&&clearTimeout(this._promises[e].timeout),this._promises[e].resolve(),delete this._promises[e])}_rejectPromises(e){for(const t in this._promises)this._promises.hasOwnProperty(t)&&(this._promises[t].timeout&&clearTimeout(this._promises[t].timeout),this._promises[t].reject(e),delete this._promises[t])}}pr.SubscriptionState=Ae,pr.State=ge,pr.UnauthorizedError=pt;const fp=({chatbotId:n,userData:e,fullScreen:t})=>{var ot,mt;const r=(ot=window==null?void 0:window.robodialog)==null?void 0:ot.default,s=(mt=window==null?void 0:window.robodialog)==null?void 0:mt.externalAPI,i=!!r,o=!!s,a=Qe(null),[l,c]=M(i?r:null),[u,d]=M(i?wd:null),[g,h]=M(i?nt:null),[f,m]=M(null),[b,v]=M(0),x=_t(()=>({chatbot:l,setChatbot:c,token:u,setToken:d,userId:g,setUserId:h,fileSizeLimit:b,setFileSizeLimit:v,userData:e||{},chatbotDefault:r,isChatbotDefault:i,defaultExternalAPI:s,isDefaultExternalAPI:o}),[l,u,g,b,e,i,s,o]),[w,k]=M(i?kd:[]),[_,S]=M(i?Td:[]),[P,T]=M(o?Sd:null),[A,D]=M(0),[E,j]=M(null),Z=Qe([]),se=Qe({call:!1,messagesCount:{},messagesLength:{}}),Re=_t(()=>({messages:w,setMessages:k,conversations:_,setConversations:S,currentConversation:P,setCurrentConversation:T,totalConversationsCount:A,setTotalConversationsCount:D,newMessage:E,setNewMessage:j,messagesRef:Z,messageCallOneTime:se}),[w,_,P,A,E]),[G,ve]=M(!!o),[de,qe]=M(!1),[C,R]=M(!1),[$,F]=M(!1),[I,q]=M(!1),[U,z]=M(!1),[H,X]=M(!1),[W,ae]=M(0),[O,$e]=M(null),[gt,Lt]=M(null),[mr,br]=M(null),B=Qe(!1),he=Qe(!1),Ne=_t(()=>({chatOpen:G,setChatOpen:ve,callChatFlow:de,setCallChatFlow:qe,interacted:C,setInteracted:R,canMessage:$,setCanMessage:F,humanControl:I,setHumanControl:q,aiLoading:U,setAiLoading:z,userLoading:H,setUserLoading:X,onlineAgents:W,setOnlineAgents:ae,ratingFromUser:O,setRatingFromUser:$e,dataFromUser:gt,setDataFromUser:Lt,hoveringMessageInner:mr,setHoveringMessageInner:br,callChatFlowRef:B,agentConversationEnded:he}),[G,de,C,$,I,U,H,W,O,gt,mr]);return be(()=>i||!n?void 0:((async()=>{var Be,ie;try{let le=Mr("robodialog-livechat-id");e!=null&&e.userId&&(le=e.userId),le||(le=wi(),Tn("robodialog-livechat-id",le)),h(le);const at=await Mo.readById({params:{id:n}});if(!((Be=at.data)!=null&&Be.chatbot))throw new Error("Chatbot not found");const bt=at.data.chatbot;c(bt),v(at.data.fileSizeLimit);const lt=await Mo.generateToken({body:{userId:le,chatbotId:bt._id,visitor:!(e!=null&&e.userId)}});if(!((ie=lt.data)!=null&&ie.token))throw new Error("Token generation failed");const{token:wp,socketToken:kp}=lt.data;if(d(wp),o)return;const _r=new pr(uu,{token:kp}),Cl=_r.newSubscription(`personal:${le}`),Tp=_r.newSubscription(`chatbot_widget:${bt._id}`);Cl.on("publication",Sp=>{const{event:El,data:Ze}=Sp.data;El==="conversation"&&(S(Ue=>{const vr=Ue.findIndex(jt=>jt._id===Ze._id);if(vr!==-1){const jt=[...Ue];return jt[vr]=Ze,jt}return[...Ue,Ze]}),T(Ue=>!Ue||Ue._id!==Ze._id?Ue:(!!Ue.assignedTo&&!Ze.assignedTo&&Ue.assignType&&(B.current=!0),Ze))),El==="message"&&(k(Ue=>{if(Ue.some(yr=>yr._id===Ze._id))return Ue.map(yr=>yr._id===Ze._id?Ze:yr);const jt=[...Ue,Ze];return Z.current=jt,jt}),G||j(Ze))}),Cl.subscribe(),Tp.subscribe(),_r.connect(),m(_r)}catch(le){yt().error("Widget initialization failed:",le)}})(),()=>{f==null||f.disconnect()}),[n]),be(()=>{if(!(l!=null&&l.appearance)||!a.current)return;const Be=a.current.getRootNode().host;if(Be&&Be instanceof HTMLElement){const ie=Be,le=l.appearance.color,at=l.appearance.others;ie.style.setProperty("--background-color",le.background||"#ffffff"),ie.style.setProperty("--background-text-color",le.backgroundText||"#111827"),ie.style.setProperty("--input-background-color",le.inputBackground||"#ffffff"),ie.style.setProperty("--input-text-color",le.inputText||"#111827"),ie.style.setProperty("--base-color",le.base||"#006fee"),ie.style.setProperty("--base-text-color",le.baseText||"#ffffff");const bt=lt=>typeof lt=="number"?`${lt}px`:lt;ie.style.setProperty("--popup-container-radius",bt(at.popupContainerRadius)||"20px"),ie.style.setProperty("--chatbot-radius",bt(at.chatbotRadius)||"12px"),ie.style.setProperty("--shadow-sm","0 0px 2px 0 rgba(0, 0, 0, 0.05)"),ie.style.setProperty("--shadow-md","0 0px 10px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"),ie.style.setProperty("--shadow-lg","0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"),ie.style.setProperty("--shadow-xl","0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)"),ie.style.setProperty("--transition-smooth","cubic-bezier(0.4, 0, 0.2, 1)"),ie.style.setProperty("--transition-bounce","cubic-bezier(0.68, -0.55, 0.05, 2)")}},[l]),be(()=>{if(i||o)return;(async()=>{if(!u||!P||_.length===0)return;const Be=w.filter(ie=>ie.conversationId===P._id&&!_.some(le=>le._id===ie.conversationId));for(const ie of Be)try{const le=await It.userRead({params:{id:ie.conversationId}},u);le.data&&S(at=>[...at,le.data])}catch(le){yt().error(`Failed to fetch conversation ${ie.conversationId}:`,le)}})()},[w,_,P,u]),!l||!u?p("div",{ref:a,className:"robodialog-chatbot-app"}):p("div",{ref:a,className:`robodialog-chatbot-app${t?" robodialog-chatbot-app-fullscreen":""}`,children:p(Bf,{coreState:x,conversationState:Re,uiState:Ne,fullScreen:t})})},pp='.robodialog-chatbot-app{width:calc(100vw - 20px);height:calc(100vh - 10px);pointer-events:none;position:fixed;top:0;left:0;z-index:1;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:var(--background-text-color);font-size:14px;line-height:1.5}.robodialog-chatbot-app *{scroll-behavior:smooth;box-sizing:border-box;margin:0;padding:0}.robodialog-chatbot-app *:focus-visible{outline:none}.robodialog-chatbot-app img{max-width:100%;height:auto;display:block}.robodialog-chatbot-app video{max-width:100%;border-radius:calc(var(--popup-container-radius) * .66);box-shadow:var(--shadow-sm)}.robodialog-chatbot-app .messageDiv a[href*=jpg],.robodialog-chatbot-app .messageDiv a[href*=png],.robodialog-chatbot-app .messageDiv a[href*=jpeg],.robodialog-chatbot-app .messageDiv a[href*=gif],.robodialog-chatbot-app .messageDiv a[href*=mp4],.robodialog-chatbot-app .messageDiv a[href*=webm]{display:inline-block;margin-top:8px;border-radius:var(--popup-container-radius);overflow:hidden;box-shadow:var(--shadow-md);transition:all .3s var(--transition-smooth);position:relative;width:max-content}.robodialog-chatbot-app .messageDiv a[href*=jpg]:hover,.robodialog-chatbot-app .messageDiv a[href*=png]:hover,.robodialog-chatbot-app .messageDiv a[href*=jpeg]:hover,.robodialog-chatbot-app .messageDiv a[href*=gif]:hover,.robodialog-chatbot-app .messageDiv a[href*=mp4]:hover,.robodialog-chatbot-app .messageDiv a[href*=webm]:hover{transform:scale(1.05);box-shadow:var(--shadow-xl)}.robodialog-chatbot-app .messageDiv a img,.robodialog-chatbot-app .messageDiv a video{display:block;max-height:200px;width:auto;transition:all .3s var(--transition-smooth)}.robodialog-chatbot-app .messageDiv .sources a[href$=".pdf"],.robodialog-chatbot-app .messageDiv .sources a[href$=".doc"],.robodialog-chatbot-app .messageDiv .sources a[href$=".docx"],.robodialog-chatbot-app .messageDiv .sources a[href$=".xlsx"],.robodialog-chatbot-app .messageDiv .sources a[href$=".txt"]{position:relative;padding-left:28px}.robodialog-chatbot-app .messageDiv .sources a[href$=".pdf"]:before,.robodialog-chatbot-app .messageDiv .sources a[href$=".doc"]:before,.robodialog-chatbot-app .messageDiv .sources a[href$=".docx"]:before,.robodialog-chatbot-app .messageDiv .sources a[href$=".xlsx"]:before,.robodialog-chatbot-app .messageDiv .sources a[href$=".txt"]:before{content:"📄";position:absolute;left:8px;top:50%;transform:translateY(-50%);font-size:14px}.robodialog-chatbot-app button:disabled{opacity:.5;cursor:not-allowed;pointer-events:none}@media screen and (max-width: 480px){.robodialog-chatbot-app .chatbotConversationContainer h2{font-size:20px}.robodialog-chatbot-app .chatbotConversationContainer h4{font-size:12px}.robodialog-chatbot-app .messageDiv .messageP{padding:10px 14px;font-size:13px}}.robodialog-chatbot-app{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}.robodialog-chatbot-app ::-webkit-scrollbar{width:8px;height:8px}.robodialog-chatbot-app ::-webkit-scrollbar-track{background:transparent}.robodialog-chatbot-app ::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--background-text-color),transparent 75%);border-radius:10px;border:2px solid transparent;background-clip:padding-box}.robodialog-chatbot-app ::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--background-text-color),transparent 60%);border-radius:10px;border:2px solid transparent;background-clip:padding-box}.robodialog-chatbot-app *{scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--background-text-color),transparent 75%) transparent}.robodialog-chatbot-app.robodialog-chatbot-app-fullscreen{width:100%;height:100%;position:relative;pointer-events:auto}',gp='.chatbotMain{position:fixed;display:flex;flex-direction:column;align-items:flex-end;z-index:999999;pointer-events:none;gap:10px}.chatbotMain>*{pointer-events:all}.chatbotChat{position:relative;display:flex;align-items:center;gap:8px}@keyframes robodialog-buttonEntry{0%{opacity:0;transform:scale(0) rotate(-180deg)}50%{transform:scale(1.15) rotate(10deg)}to{opacity:1;transform:scale(1) rotate(0)}}.chatbotChatInside{width:60px;height:60px;animation:robodialog-buttonEntry .5s var(--transition-bounce);position:relative;z-index:2;transition:transform .3s var(--transition-smooth);border-radius:var(--chatbot-radius);background:var(--background-color);box-shadow:var(--shadow-md);cursor:pointer;display:flex;align-items:center;justify-content:center;overflow:hidden}.chatbotChatInside:hover{transform:translateY(-5px) rotate(5deg) scale(1.05)}.chatbotChatInside:active{transform:translateY(-3px) rotate(5deg) scale(.95)}.chatbotChatInside img{width:100%;height:100%;object-fit:cover}.chatbotChatInside svg{width:28px;height:28px;transition:transform .3s var(--transition-smooth)}.chatbotConversationContainer.open~.chatbotChat .chatbotChatInside svg{transform:rotate(90deg)}.chatbotDrag{width:24px;height:40px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--background-color),transparent 30%);border-radius:calc(var(--popup-container-radius) / 2.5);cursor:grab;opacity:0;transition:all .2s var(--transition-smooth);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);box-shadow:var(--shadow-sm)}.chatbotMain:hover .chatbotDrag{opacity:1}.chatbotDrag:active{cursor:grabbing;background:var(--background-color)}.chatbotDrag svg{opacity:.6}.notification-badge{position:absolute;top:-4px;right:-4px;width:20px;height:20px;background:var(--base-color);border-radius:50%;border:3px solid var(--base-text-color);display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:var(--base-text-color);animation:robodialog-badgePop .4s var(--transition-bounce);box-shadow:0 2px 8px color-mix(in srgb,var(--base-color),transparent 60%)}@keyframes robodialog-badgePop{0%{opacity:0;transform:scale(0)}50%{transform:scale(1.2)}to{opacity:1;transform:scale(1)}}@media screen and (max-width: 768px){chatbotChatInside{width:56px;height:56px}.chatbotChatInside svg{width:24px;height:24px}}.chatbotConversationContainer{background:var(--background-color);border-radius:var(--popup-container-radius);box-shadow:var(--shadow-xl);overflow:hidden;display:flex;flex-direction:column;width:420px;max-width:95vw;height:0;max-height:0;opacity:0;transform:translateY(20px) scale(.95) rotate(-2deg);pointer-events:none;transition:opacity .3s var(--transition-smooth),transform .3s var(--transition-bounce)}.chatbotConversationContainer.open{height:700px;max-height:calc(95vh - 70px);opacity:1;transform:translateY(0) scale(1);pointer-events:all}.chatbotConversationContainer>.top-header{background:linear-gradient(135deg,var(--base-color) 0%,color-mix(in srgb,var(--base-color),var(--background-text-color) 10%) 100%);color:var(--base-text-color);padding:24px 20px;box-shadow:0 4px 12px color-mix(in srgb,var(--base-color),transparent 85%);position:relative;overflow:hidden}.chatbotConversationContainer .top-header:before{content:"";position:absolute;top:-50%;right:-20%;width:300px;height:300px;background:radial-gradient(circle,color-mix(in srgb,var(--base-text-color),transparent 90%) 0%,transparent 70%);border-radius:50%;pointer-events:none}.chatbotConversationContainer .top-header{text-align:center}.chatbotConversationContainer h2{font-size:24px;font-weight:700;margin-bottom:6px;letter-spacing:-.02em;position:relative;z-index:1}.chatbotConversationContainer h4{font-size:13px;font-weight:400;opacity:.9;line-height:1.4;position:relative;z-index:1}.liveLinkRightDiv{flex:1;display:flex;flex-direction:column;background:color-mix(in srgb,var(--background-text-color) 2%,var(--background-color));overflow:hidden}.liveLinkRightDiv .loadingDiv>svg,.newConversationLoading svg{animation:robodialog-spin 1s cubic-bezier(.4,0,.6,1.3) infinite}.liveLinkRightDiv .loadingDiv{margin:auto}.loadingIcon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px}@keyframes robodialog-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.conversationMain{display:flex;flex-direction:column;height:100%;width:100%;padding:16px;gap:12px}.robodialog-chatbot-app.robodialog-chatbot-app-fullscreen .conversationMain{max-width:600px;margin-left:auto;margin-right:auto}.conversationMain .newConversationBtn{padding:12px 24px;border:none;border-radius:calc(var(--popup-container-radius) * .5);font-size:14px;font-weight:600;cursor:pointer;position:relative;transition:all .2s var(--transition-smooth);box-shadow:var(--shadow-sm);background:var(--base-color);color:var(--base-text-color);overflow:hidden;min-height:40px}.conversationMain .newConversationBtn:hover{transform:translateY(-2px);box-shadow:var(--shadow-md);background:color-mix(in srgb,var(--base-color),var(--background-text-color) 10%)}.conversationMain .newConversationBtn:active{transform:translateY(0);box-shadow:var(--shadow-sm)}.conversationMain .newConversationBtn:before{content:"";position:absolute;top:50%;left:50%;width:0;height:0;border-radius:50%;background:color-mix(in srgb,var(--base-text-color),transparent 80%);transform:translate(-50%,-50%);transition:width .3s,height .3s}.conversationMain .newConversationBtn:hover:before{width:400px;height:400px}.conversationDetails{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column;background:var(--background-color);z-index:10;animation:robodialog-slideInRight .3s var(--transition-smooth)}@keyframes robodialog-slideInRight{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}.conversationDetails .conversationDetailsHeader{display:flex;align-items:center;justify-content:space-between;padding:12px;background:var(--background-color);border-bottom:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);font-size:13px;font-weight:500;box-shadow:var(--shadow-sm);position:relative;z-index:2}.conversationDetails .conversationDetailsHeader>div:nth-child(1){display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:calc(var(--popup-container-radius) * .66);cursor:pointer;transition:all .2s var(--transition-smooth);background:color-mix(in srgb,var(--background-text-color) 2%,var(--background-color))}.conversationDetails .conversationDetailsHeader>div:nth-child(1):hover{background:color-mix(in srgb,var(--background-text-color) 5%,var(--background-color));transform:scale(.95)}.conversationDetails .conversationDetailsHeader>div:nth-child(1) svg{width:14px;height:14px;transform:rotate(90deg);transition:transform .2s var(--transition-smooth)}.conversationDetails .headerImageWrapper{width:28px;height:28px;border-radius:50%;overflow:hidden;border:2px solid var(--background-color);box-shadow:var(--shadow-sm)}.conversationDetails .headerImageWrapper img{width:100%;height:100%;object-fit:cover}.conversationDetails .livelinkMsgs{flex:1;display:flex;flex-direction:column-reverse;padding:16px 12px;overflow-y:auto;background:color-mix(in srgb,var(--background-text-color) 2%,var(--background-color));gap:8px}.robodialog-chatbot-app.robodialog-chatbot-app-fullscreen .conversationDetails .livelinkMsgs{max-width:600px;margin-left:auto;margin-right:auto;background-color:transparent}@media screen and (max-width: 600px){.robodialog-chatbot-app.robodialog-chatbot-app-fullscreen .conversationDetails .livelinkMsgs{max-width:100%}}.conversationDetails .livelinkMsgs::-webkit-scrollbar{width:6px}.conversationDetails .livelinkMsgs::-webkit-scrollbar-track{background:transparent}.conversationDetails .livelinkMsgs::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--background-text-color),transparent 75%);border-radius:10px;transition:background .2s}.conversationDetails .livelinkMsgs::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--background-text-color),transparent 60%)}.conversationDetails>div:nth-last-child(1){position:relative;padding:10px;background:var(--background-color);border-top:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);box-shadow:0 -4px 12px #00000008}.robodialog-chatbot-app.robodialog-chatbot-app-fullscreen .conversationDetails>div:nth-last-child(1){max-width:576px;margin-left:auto;margin-right:auto;width:100%;border-top:0px}.liveLinkRightDiv textarea{width:100%;padding:8px 50px 8px 12px;background:inherit;color:inherit;font-size:14px;font-family:inherit;line-height:1.5;resize:none;outline:none;transition:all .2s var(--transition-smooth);min-height:44px;max-height:120px}.livelinkPoweredDiv2{display:flex;align-items:center;justify-content:center;padding:12px 0 8px;font-size:12px;color:color-mix(in srgb,var(--background-text-color),transparent 60%);gap:6px;background:var(--background-color);border-top:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%)}.livelinkPoweredDiv2 img{height:16px}.livelinkPoweredDiv2 a{text-decoration:none;color:#006fee;font-weight:600;transition:color .2s}.livelinkPoweredDiv2 a:hover{color:color-mix(in srgb,#006fee,var(--background-text-color) 10%)}.chatbotMain.fullscreen{position:relative;width:100%;height:100%}.chatbotConversationContainer.fullscreen{width:100%;height:100%;max-width:100%;max-height:100%;border-radius:0;transform:none!important;opacity:1!important;pointer-events:all!important}@media screen and (max-width: 480px){.chatbotConversationContainer.fullscreen{border-radius:0}}',mp='.conversationMainItemContainer{display:flex;flex-direction:column;gap:8px;width:100%;overflow-y:auto;padding-right:4px}.conversationMainItemContainer::-webkit-scrollbar{width:6px}.conversationMainItemContainer::-webkit-scrollbar-track{background:transparent}.conversationMainItemContainer::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--background-text-color),transparent 75%);border-radius:10px}.conversationMainItemContainer .conversationMainItem{display:flex;align-items:center;gap:12px;padding:12px 14px;background:var(--background-color);border-radius:calc(var(--popup-container-radius) / 1.5);border:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);cursor:pointer;transition:all .2s var(--transition-smooth);position:relative}.conversationMainItemContainer .conversationMainItem:before{content:"";position:absolute;left:0;top:0;bottom:0;width:0;background:linear-gradient(90deg,color-mix(in srgb,var(--base-color),var(--background-color) 90%) 0%,transparent 100%);border-radius:calc(var(--popup-container-radius) / 1.5);transition:width .3s var(--transition-smooth)}.conversationMainItemContainer .conversationMainItem:hover{border-color:var(--base-color);transform:translate(4px);box-shadow:var(--shadow-md)}.conversationMainItemContainer .conversationMainItem:hover:before{width:100%}.conversationMainItemContainer .conversationMainItem>div:nth-child(1){width:40px;height:40px;border-radius:50%;overflow:hidden;flex-shrink:0;box-shadow:var(--shadow-sm);border:2px solid var(--background-color);position:relative;z-index:1}.conversationMainItemContainer .conversationMainItem>div:nth-child(1) img{width:100%;height:100%;object-fit:cover}.conversationMainItemContainer .textHolder{flex:1;overflow:hidden;position:relative;z-index:1}.conversationMainItemContainer .textHolder>p:nth-child(1){font-size:14px;font-weight:500;color:var(--background-text-color);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:2px}.conversationMainItemContainer .textHolder>p:nth-child(2){font-size:11px;color:color-mix(in srgb,var(--background-text-color),transparent 40%);font-weight:400}.conversationMainItem .unreadMessage{position:absolute;bottom:-2px;right:-2px;width:12px;height:12px;border-radius:50%;background:var(--base-color);border:2px solid var(--background-color);animation:robodialog-pulse 2s infinite}@keyframes robodialog-pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.7;transform:scale(1.1)}}.conversationMainItemContainer .conversationMainItem>div:nth-last-child(1){width:24px;height:24px;display:flex;align-items:center;justify-content:center;position:relative;z-index:1;opacity:.4;transform:rotate(-90deg);transition:all .2s var(--transition-smooth)}.conversationMainItemContainer .conversationMainItem:hover>div:nth-last-child(1){opacity:1;transform:translate(4px) rotate(-90deg)}.mainMessageContainer{display:flex;align-items:flex-end;gap:10px;width:100%;animation:robodialog-messageSlideUp .4s var(--transition-smooth)}@keyframes robodialog-messageSlideUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.mainMessageContainer.mySelfTextDiv{flex-direction:row-reverse}.logoWithMessageDiv{display:flex;align-items:center;justify-content:center;width:32px;height:32px;min-width:32px;border-radius:50%;overflow:hidden;box-shadow:var(--shadow-sm);border:2px solid var(--background-color);animation:robodialog-avatarPop .3s var(--transition-bounce)}@keyframes robodialog-avatarPop{0%{opacity:0;transform:scale(.5)}50%{transform:scale(1.1)}to{opacity:1;transform:scale(1)}}.logoWithMessageDiv img{width:100%;height:100%;object-fit:cover}.messageDiv{display:flex;flex-direction:column;max-width:75%;gap:4px}.messageDiv.mySelfTextDiv{align-items:flex-end}.NameAndDate{font-size:11px;font-weight:500;color:color-mix(in srgb,var(--background-text-color),transparent 40%);padding:0 4px;letter-spacing:.01em}.messageDiv .messageP{padding:12px 16px;word-break:break-word;line-height:1.6;box-shadow:var(--shadow-sm);transition:all .2s var(--transition-smooth);position:relative;width:max-content;max-width:100%}.mainMessageContainer:not(.mySelfTextDiv) .messageP{background:var(--background-color);color:var(--background-text-color);border:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);border-radius:calc(var(--popup-container-radius) / 1.5) calc(var(--popup-container-radius) / 1.5) calc(var(--popup-container-radius) / 1.5) 4px}.mainMessageContainer.mySelfTextDiv .messageP{background:linear-gradient(135deg,var(--base-color) 0%,color-mix(in srgb,var(--base-color),var(--background-text-color) 10%) 100%);color:var(--base-text-color);border-radius:calc(var(--popup-container-radius) / 1.5) calc(var(--popup-container-radius) / 1.5) 4px calc(var(--popup-container-radius) / 1.5);border:none}.mainMessageContainer.mySelfTextDiv .messageP>*{color:var(--base-text-color)}.messageDiv .markdownText p{font-size:14px;margin-bottom:8px;line-height:1.6}.messageDiv .markdownText>p:last-child{margin-bottom:0}.messageDiv .markdownText ul,.messageDiv .markdownText ol{margin-left:20px;margin-bottom:8px}.messageDiv .markdownText ul{list-style-type:disc}.messageDiv .markdownText ol{list-style-type:decimal}.messageDiv .markdownText li{margin-bottom:4px}.messageDiv .markdownText a{color:inherit;text-decoration:underline;font-weight:500;opacity:.9;transition:opacity .2s}.messageDiv .markdownText a:hover{opacity:1}.messageDiv .markdownText h1,.messageDiv .markdownText h2,.messageDiv .markdownText h3{font-weight:600;margin-bottom:8px;line-height:1.3}.messageDiv .markdownText h1{font-size:20px}.messageDiv .markdownText h2{font-size:18px}.messageDiv .markdownText h3{font-size:16px}.messageDiv .markdownText strong{font-weight:600}.messageDiv .markdownText code{background:#0000000d;padding:2px 6px;border-radius:4px;font-family:Courier New,monospace;font-size:13px}.mainMessageContainer .sources{display:flex;flex-wrap:wrap;gap:6px}.mainMessageContainer .sources a{margin-top:8px;display:inline-flex;align-items:center;padding:6px 12px;background:color-mix(in srgb,var(--background-text-color) 5%,var(--background-color));color:var(--base-color);border-radius:calc(var(--popup-container-radius) * .66);font-size:11px;font-weight:600;text-decoration:none;transition:all .2s var(--transition-smooth);border:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%)}.mainMessageContainer .sources a:hover{background:color-mix(in srgb,var(--base-color),var(--background-color) 90%);border-color:var(--base-color);transform:translateY(-2px);box-shadow:var(--shadow-sm)}.messagesLoading{display:flex;justify-content:center;padding:20px}.messagesLoading>div{width:24px;height:24px;color:var(--base-color)}.otherUserTextLoading{display:inline-flex;align-items:center;gap:6px;padding:16px 20px;background:var(--background-color);border:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);border-radius:calc(var(--popup-container-radius) / 1.5);box-shadow:var(--shadow-sm)}.otherUserTextLoading .loading1,.otherUserTextLoading .loading2,.otherUserTextLoading .loading3{width:8px;height:8px;border-radius:50%;background:var(--base-color);animation:robodialog-bounce 1.4s infinite ease-in-out}.otherUserTextLoading .loading2{animation-delay:.2s}.otherUserTextLoading .loading3{animation-delay:.4s}@keyframes robodialog-bounce{0%,80%,to{opacity:.3;transform:scale(.8)}40%{opacity:1;transform:scale(1)}}.messageDiv form h3,.messageDiv form h4{font-weight:600;color:var(--background-text-color);margin-bottom:8px;font-size:14px}.messageDiv form input,.messageDiv form select,.messageDiv form textarea{width:100%;padding:10px 12px;border:1.5px solid color-mix(in srgb,var(--background-text-color),transparent 85%);border-radius:calc(var(--popup-container-radius) / 1.5);background:var(--input-background-color);color:var(--input-text-color);font-size:14px;font-family:inherit;outline:none;transition:all .2s var(--transition-smooth)}.messageDiv form input:focus,.messageDiv form select:focus,.messageDiv form textarea:focus{border-color:var(--base-color);box-shadow:0 0 0 3px color-mix(in srgb,var(--base-color),var(--background-color) 90%)}.messageDiv form textarea{resize:vertical;min-height:80px}.messageDiv form button{padding:10px 20px;border:none;border-radius:calc(var(--popup-container-radius) / 1.5);font-size:14px;font-weight:600;cursor:pointer;transition:all .2s var(--transition-smooth);background:var(--base-color);color:var(--base-text-color);margin-right:8px}.messageDiv form button:hover{background:color-mix(in srgb,var(--base-color),var(--background-text-color) 10%);transform:translateY(-2px);box-shadow:var(--shadow-md)}.messageDiv form button:active{transform:translateY(0)}.livelinkSubmitDiv{display:flex;gap:8px;margin-top:10px;padding-top:16px;border-top:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%)}.messageDiv form>div:has(svg){display:flex;gap:3px;padding:2px 0}.messageDiv form>div:has(svg)>div{cursor:pointer;transition:transform .2s var(--transition-bounce)}.messageDiv form>div:has(svg)>div:hover{transform:scale(1.2)}.hint{display:block;font-size:11px;color:color-mix(in srgb,var(--background-text-color),transparent 40%);margin-top:4px}.massageInputDivMain{position:relative;display:flex;align-items:center;background:var(--input-background-color);border:1.5px solid color-mix(in srgb,var(--background-text-color),transparent 85%);border-radius:calc(var(--popup-container-radius) / 1.5);overflow:hidden;transition:all .2s var(--transition-smooth);width:100%}.massageInputDivMain>form{width:100%}.massageInputDivMain:focus-within{border-color:var(--base-color);box-shadow:0 0 0 3px color-mix(in srgb,var(--base-color),var(--background-color) 90%)}.massageInputDivMain textarea{border:none!important;box-shadow:none!important}.massageInputDivMain textarea::placeholder{color:color-mix(in srgb,var(--background-text-color),transparent 60%)}.inputArrowMassageImg{position:absolute;right:8px;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center;width:32px;height:32px;background:color-mix(in srgb,var(--input-background-color),transparent 60%);border:none;border-radius:calc(var(--popup-container-radius) * .66);cursor:pointer;transition:all .2s var(--transition-smooth);color:var(--base-color)}.inputArrowMassageImg:hover{background:color-mix(in srgb,var(--base-color),var(--background-color) 90%);transform:translateY(-50%) scale(1.1)}.inputArrowMassageImg:active{transform:translateY(-50%) scale(.95)}.inputArrowMassageImg.attachment{right:48px}.inputArrowMassageImg svg{width:18px;height:18px}.inputArrowMassageImg:disabled{opacity:.3;cursor:not-allowed;pointer-events:none}.hoveringMessageInner{margin:8px 4px;display:flex;flex-direction:column;align-items:flex-end;gap:6px;animation:robodialog-slideUpFade .3s var(--transition-smooth)}@keyframes robodialog-slideUpFade{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.hoveringMessageInner>div{padding:10px 14px;background:var(--background-color);border:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);border-radius:calc(var(--popup-container-radius) * .66);font-size:13px;font-weight:500;cursor:pointer;transition:all .2s var(--transition-smooth);box-shadow:var(--shadow-sm);display:flex;align-items:center;gap:8px}.hoveringMessageInner>div:hover{background:color-mix(in srgb,var(--base-color),var(--background-color) 90%);border-color:var(--base-color);transform:translateY(-2px);box-shadow:var(--shadow-md)}.agents{display:flex;align-items:center;justify-content:center;height:36px;margin:0 auto}.mainAgents{height:44px;margin-top:30px}.agents>div{width:36px;height:36px;border-radius:50%;background:var(--base-text-color);border:3px solid var(--base-text-color);overflow:hidden;position:relative;box-shadow:var(--shadow-sm);transition:transform .2s var(--transition-smooth)}.mainAgents>div{width:44px;height:44px}.agents>div:hover{transform:translateY(-4px) scale(1.05);z-index:10;box-shadow:var(--shadow-lg)}.agents>div:nth-child(2){margin-left:-12px}.agents>div:nth-child(3){margin-left:-12px}.agents img{width:100%;height:100%;object-fit:cover}.onlineAgents{display:flex;flex-direction:column;align-items:center;gap:12px;margin-top:16px;animation:robodialog-fadeIn .4s var(--transition-smooth)}@keyframes robodialog-fadeIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.onlineAgents>div:nth-child(1){padding:12px 24px;background:var(--background-color);border:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);border-radius:calc(var(--popup-container-radius) / 1.5);font-size:14px;text-align:center;box-shadow:var(--shadow-sm)}.onlineAgents>div:nth-child(2){display:flex;align-items:center;gap:10px}.onlineAgents>div:nth-child(2)>p{font-size:13px;color:color-mix(in srgb,var(--background-text-color),transparent 40%);font-weight:500}.onlineAgents>div:nth-child(2)>p b{color:var(--base-color);font-weight:700}.chatHoveringMessages{display:flex;flex-direction:column;gap:8px;pointer-events:all}.chatHoveringMessage{padding:10px;background:var(--background-color);border-radius:calc(var(--popup-container-radius) / 1.5);font-size:13px;max-width:320px;cursor:pointer;box-shadow:var(--shadow-lg);border:1px solid color-mix(in srgb,var(--background-text-color),transparent 85%);transition:all .3s var(--transition-smooth);animation:robodialog-popIn .4s var(--transition-bounce);position:relative;overflow:hidden;width:max-content}.chatHoveringMessage.closeMessages{padding:10px 10px 5px}@keyframes robodialog-popIn{0%{opacity:0;transform:translateY(20px) scale(.9)}50%{transform:translateY(-5px) scale(1.02)}to{opacity:1;transform:translateY(0) scale(1)}}.chatHoveringMessage:hover{transform:translateY(-4px);box-shadow:var(--shadow-xl);border-color:var(--base-color)}.chatHoveringMessage:before{content:"";position:absolute;top:0;left:0;width:4px;height:100%;background:var(--base-color);transform:scaleY(0);transition:transform .3s var(--transition-smooth)}.chatHoveringMessage:hover:before{transform:scaleY(1)}.chatHoveringMessageUser{display:flex;align-items:center;gap:8px;margin-bottom:8px;font-weight:600;color:var(--background-text-color);font-size:13px}.chatHoveringMessageUser>div:nth-child(1){width:24px;height:24px;border-radius:50%;overflow:hidden;flex-shrink:0;box-shadow:var(--shadow-sm);background:color-mix(in srgb,var(--background-text-color) 5%,var(--background-color))}.chatHoveringMessageUser>div:nth-child(1)>img,.chatHoveringMessageUser>div:nth-child(1)>svg{width:100%;height:100%;object-fit:cover}@media screen and (max-width: 395px){.chatHoveringMessage{max-width:85vw}}',bp=".background-color{color:var(--background-color)}.background-text-color{color:var(--background-text-color)}.input-background-color{color:var(--input-background-color)}.input-text-color{color:var(--input-text-color)}.base-color{color:var(--base-color)}.base-text-color{color:var(--base-text-color)}",_p='.robodialog-chatbot-app .ai-generating{position:relative;border-radius:12px;padding:16px;overflow:hidden}.robodialog-chatbot-app .ai-generating:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border-radius:inherit;padding:2px;background:linear-gradient(120deg,#006fee,#1effda,#006fee,#1effda);background-size:300% 300%;animation:borderGradientMove 3s ease infinite;-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;pointer-events:none}@keyframes borderGradientMove{0%{background-position:0% 50%}50%{background-position:100% 50%}to{background-position:0% 50%}}.robodialog-chatbot-app .thinkingContainer{display:flex;flex-direction:column;gap:4px;margin-bottom:12px;overflow:hidden}.robodialog-chatbot-app .thinkingChunk{opacity:0;transform:translateY(8px);animation:thinkingFadeIn .35s ease-out forwards;font-size:11px;line-height:1.4;color:color-mix(in srgb,var(--background-text-color),transparent 40%);font-weight:500;max-height:1.4em;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;word-break:break-word}@keyframes thinkingFadeIn{to{opacity:1;transform:translateY(0)}}',vp='.robodialog-toast{position:absolute;padding:10px;display:flex;align-items:center;justify-content:space-between;pointer-events:all;animation:robodialog-toastSlideIn .4s var(--transition-bounce);transition:all .3s var(--transition-smooth);overflow:hidden;z-index:12;width:100%}@keyframes robodialog-toastSlideIn{0%{opacity:0;transform:translateY(-100%) scale(.9)}50%{transform:translateY(10px) scale(1.02)}to{opacity:1;transform:translateY(0) scale(1)}}.robodialog-toast:after{content:"";position:absolute;bottom:0;left:0;height:3px;background:currentColor;opacity:.3;animation:robodialog-toastProgress 3s linear forwards}@keyframes robodialog-toastProgress{0%{width:100%}to{width:0%}}.robodialog-toast-success{background:linear-gradient(160deg,var(--base-color) 0%,color-mix(in srgb,var(--base-color),var(--background-text-color) 30%) 100%);color:var(--base-text-color)}.robodialog-toast-success:before{background:color-mix(in srgb,var(--base-color),var(--background-color) 95%)}.robodialog-toast-error{background:linear-gradient(160deg,red,color-mix(in srgb,red,black 30%));color:#fff}.robodialog-toast-error:before{background:color-mix(in srgb,var(--base-color),var(--background-color) 95%)}.robodialog-toast-info{background:linear-gradient(160deg,var(--base-color) 0%,color-mix(in srgb,var(--base-color),var(--background-text-color) 10%) 100%);color:var(--base-text-color)}.robodialog-toast-info:before{background:color-mix(in srgb,var(--base-color),var(--background-color) 90%)}.robodialog-toast-message{flex:1;font-size:14px;font-weight:500;line-height:1.5;word-break:break-word;position:relative;z-index:1;letter-spacing:.01em}.robodialog-toast-close{width:28px;height:28px;border-radius:50%;background:color-mix(in srgb,var(--base-text-color),transparent 90%);border:none;color:inherit;font-size:20px;font-weight:500;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s var(--transition-smooth)}.robodialog-toast-close:hover{background:color-mix(in srgb,var(--base-text-color),transparent 80%);transform:scale(1.1)}.robodialog-toast-close:active{transform:scale(.95)}.robodialog-toast-icon{width:24px;height:24px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--base-text-color),transparent 80%);border-radius:50%;position:relative;z-index:1;animation:robodialog-iconPulse 2s ease-in-out infinite}@keyframes robodialog-iconPulse{0%,to{transform:scale(1);opacity:1}50%{transform:scale(1.1);opacity:.8}}.robodialog-toast.fade-out{animation:robodialog-toastFadeOut .3s var(--transition-smooth) forwards}@keyframes robodialog-toastFadeOut{0%{opacity:1;transform:translateY(0) scale(1)}to{opacity:0;transform:translateY(-20px) scale(.95)}}@media screen and (max-width: 768px){.robodialog-toast-message{font-size:13px}.robodialog-toast-close{width:24px;height:24px;right:10px;font-size:18px}}.robodialog-toast:focus-within{outline:2px solid color-mix(in srgb,var(--base-text-color),transparent 50%);outline-offset:2px}',yp=()=>Array.from(document.querySelectorAll("script[src]")).find(n=>n.dataset.chatbotId!==void 0)??null,xp=()=>{let n,e,t=!1;const r=yp();if(r){if(n=r.dataset.chatbotId,!n)throw console.error("[ChatbotWidget] missing data-chatbot-id"),new Error("ChatbotWidget: data-chatbot-id is required");const s=r.dataset.userId,i=r.dataset.email,o=r.dataset.bearer;t=r.dataset.fullScreen==="true",(s||i||o)&&(e={userId:s,email:i,bearer:o})}else{const s=new URLSearchParams(location.search);n=s.get("chatbotId")||"6981d77231807db8f3cfa34e",t=s.get("fullScreen")==="true",console.warn("[ChatbotWidget] running in dev mode – using fallback chatbot",n);const i=s.get("userId")||void 0,o=s.get("email")||void 0,a=s.get("bearer")||void 0;(i||o||a)&&(e={userId:i,email:o,bearer:a})}return{chatbotId:n,otherData:e,fullScreen:t}};let ze;const Tl=()=>{if(document.getElementById("my-chatbot-root"))return;const{chatbotId:n,otherData:e,fullScreen:t}=xp();if(!n)return;ze=document.createElement("div"),ze.id="my-chatbot-root",ze.style.position="fixed",ze.style.zIndex="101",ze.style.pointerEvents=t?"auto":"none",t&&(ze.style.top="0",ze.style.left="0",ze.style.width="100vw",ze.style.height="100vh"),document.body.appendChild(ze);const r=ze.attachShadow({mode:"open"}),s=document.createElement("div");t&&(s.style.width="100%",s.style.height="100%"),r.appendChild(s);const i=document.createElement("style");i.textContent=[pp,gp,mp,bp,_p,vp].join(`
116
+ `),r.appendChild(i),St(p(fp,{chatbotId:n,userData:e,fullScreen:t}),s),console.log("[ChatbotWidget] mounted")},Sl=()=>{const n=document.getElementById("my-chatbot-root");if(n){if(n.shadowRoot){const e=n.shadowRoot.querySelector("div");e&&St(null,e)}n.remove(),ze=null,console.log("[ChatbotWidget] unmounted")}};Tl(),window.robodialog={refresh:()=>{Sl(),Tl()},_destroy:Sl}})();
117
117
  //# sourceMappingURL=widget.js.map