robodialog 0.1.1 → 0.1.3

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,61 +1,73 @@
1
- var Sp=Object.defineProperty;var Tp=(be,Fe,I)=>Fe in be?Sp(be,Fe,{enumerable:!0,configurable:!0,writable:!0,value:I}):be[Fe]=I;var ne=(be,Fe,I)=>Tp(be,typeof Fe!="symbol"?Fe+"":Fe,I);(function(){"use strict";var dr;var be={env:{}},Fe,I,Ys,xt,Xs,Js,Zs,Gs,yr,xr,wr,Ks,Gt={},Qs=[],Rl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Kt=Array.isArray;function Ke(n,e){for(var t in e)n[t]=e[t];return n}function kr(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 Qt(n,o,r,s,null)}function Qt(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??++Ys,__i:-1,__u:0};return s==null&&I.vnode!=null&&I.vnode(i),i}function ei(){return{current:null}}function Ce(n){return n.children}function He(n,e){this.props=n,this.context=e}function Mt(n,e){if(e==null)return n.__?Mt(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"?Mt(n):null}function ti(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 ti(n)}}function Sr(n){(!n.__d&&(n.__d=!0)&&xt.push(n)&&!vn.__r++||Xs!=I.debounceRendering)&&((Xs=I.debounceRendering)||Js)(vn)}function vn(){for(var n,e,t,r,s,i,o,a=1;xt.length;)xt.length>a&&xt.sort(Zs),n=xt.shift(),a=xt.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,I.vnode&&I.vnode(t),Tr(e.__P,t,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,i,s??Mt(r),!!(32&r.__u),o),t.__v=r.__v,t.__.__k[t.__i]=t,oi(i,t,o),r.__e=r.__=null,t.__e!=s&&ti(t)));vn.__r=0}function ni(n,e,t,r,s,i,o,a,l,c,u){var d,f,h,p,b,m,y,x=r&&r.__k||Qs,w=e.length;for(l=Dl(t,e,x,l,w),d=0;d<w;d++)(h=t.__k[d])!=null&&(f=h.__i==-1?Gt:x[h.__i]||Gt,h.__i=d,m=Tr(n,h,f,s,i,o,a,l,c,u),p=h.__e,h.ref&&f.ref!=h.ref&&(f.ref&&Er(f.ref,null,h),u.push(h.ref,h.__c||p,h)),b==null&&p!=null&&(b=p),(y=!!(4&h.__u))||f.__k===h.__k?l=ri(h,l,n,y):typeof h.type=="function"&&m!==void 0?l=m:p&&(l=p.nextSibling),h.__u&=-7);return t.__e=b,l}function Dl(n,e,t,r,s){var i,o,a,l,c,u=t.length,d=u,f=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]=Qt(null,o,null,null,null):Kt(o)?o=n.__k[i]=Qt(Ce,{children:o},null,null,null):o.constructor==null&&o.__b>0?o=n.__k[i]=Qt(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):n.__k[i]=o,l=i+f,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?f--:s<u&&f++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?f--:c==l+1?f++:(c>l?f--:f++,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=Mt(a)),li(a,a));return r}function ri(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=ri(s[i],e,t,r));return e}n.__e!=e&&(r&&(e&&n.type&&!e.parentNode&&(e=Mt(n)),t.insertBefore(n.__e,e||null)),e=n.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function at(n,e){return e=e||[],n==null||typeof n=="boolean"||(Kt(n)?n.some(function(t){at(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 si(n,e,t){e[0]=="-"?n.setProperty(e,t??""):n[e]=t==null?"":typeof t!="number"||Rl.test(e)?t:t+"px"}function yn(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||si(n.style,e,"");if(t)for(e in t)r&&t[e]==r[e]||si(n.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")i=e!=(e=e.replace(Gs,"$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=yr,n.addEventListener(e,i?wr:xr,i)):n.removeEventListener(e,i?wr:xr,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 ii(n){return function(e){if(this.l){var t=this.l[e.type+n];if(e.t==null)e.t=yr++;else if(e.t<t.u)return;return t(I.event?I.event(e):e)}}}function Tr(n,e,t,r,s,i,o,a,l,c){var u,d,f,h,p,b,m,y,x,w,k,_,T,R,E,A,F,P=e.type;if(e.constructor!=null)return null;128&t.__u&&(l=!!(32&t.__u),i=[a=e.__e=t.__e]),(u=I.__b)&&u(e);e:if(typeof P=="function")try{if(y=e.props,x="prototype"in P&&P.prototype.render,w=(u=P.contextType)&&r[u.__c],k=u?w?w.props.value:u.__:r,t.__c?m=(d=e.__c=t.__c).__=d.__E:(x?e.__c=d=new P(y,k):(e.__c=d=new He(y,k),d.constructor=P,d.render=$l),w&&w.sub(d),d.state||(d.state={}),d.__n=r,f=d.__d=!0,d.__h=[],d._sb=[]),x&&d.__s==null&&(d.__s=d.state),x&&P.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Ke({},d.__s)),Ke(d.__s,P.getDerivedStateFromProps(y,d.__s))),h=d.props,p=d.state,d.__v=e,f)x&&P.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),x&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(x&&P.getDerivedStateFromProps==null&&y!==h&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(y,k),e.__v==t.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(y,d.__s,k)===!1){for(e.__v!=t.__v&&(d.props=y,d.state=d.__s,d.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(Y){Y&&(Y.__=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(y,d.__s,k),x&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(h,p,b)})}if(d.context=k,d.props=y,d.__P=n,d.__e=!1,T=I.__r,R=0,x){for(d.state=d.__s,d.__d=!1,T&&T(e),u=d.render(d.props,d.state,d.context),E=0;E<d._sb.length;E++)d.__h.push(d._sb[E]);d._sb=[]}else do d.__d=!1,T&&T(e),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++R<25);d.state=d.__s,d.getChildContext!=null&&(r=Ke(Ke({},r),d.getChildContext())),x&&!f&&d.getSnapshotBeforeUpdate!=null&&(b=d.getSnapshotBeforeUpdate(h,p)),A=u,u!=null&&u.type===Ce&&u.key==null&&(A=ai(u.props.children)),a=ni(n,Kt(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),m&&(d.__E=d.__=null)}catch(Y){if(e.__v=null,l||i!=null)if(Y.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(F=i.length;F--;)kr(i[F]);Cr(e)}else e.__e=t.__e,e.__k=t.__k,Y.then||Cr(e);I.__e(Y,e,t)}else i==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=Ol(t.__e,e,t,r,s,i,o,l,c);return(u=I.diffed)&&u(e),128&e.__u?void 0:a}function Cr(n){n&&n.__c&&(n.__c.__e=!0),n&&n.__k&&n.__k.forEach(Cr)}function oi(n,e,t){for(var r=0;r<t.length;r++)Er(t[r],t[++r],t[++r]);I.__c&&I.__c(e,n),n.some(function(s){try{n=s.__h,s.__h=[],n.some(function(i){i.call(s)})}catch(i){I.__e(i,s.__v)}})}function ai(n){return typeof n!="object"||n==null||n.__b&&n.__b>0?n:Kt(n)?n.map(ai):Ke({},n)}function Ol(n,e,t,r,s,i,o,a,l){var c,u,d,f,h,p,b,m=t.props||Gt,y=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(y);n=document.createElementNS(s,x,y.is&&y),a&&(I.__m&&I.__m(e,i),a=!1),i=null}if(x==null)m===y||a&&n.data==y||(n.data=y);else{if(i=i&&Fe.call(n.childNodes),!a&&i!=null)for(m={},c=0;c<n.attributes.length;c++)m[(h=n.attributes[c]).name]=h.value;for(c in m)if(h=m[c],c!="children"){if(c=="dangerouslySetInnerHTML")d=h;else if(!(c in y)){if(c=="value"&&"defaultValue"in y||c=="checked"&&"defaultChecked"in y)continue;yn(n,c,null,h,s)}}for(c in y)h=y[c],c=="children"?f=h:c=="dangerouslySetInnerHTML"?u=h:c=="value"?p=h:c=="checked"?b=h:a&&typeof h!="function"||m[c]===h||yn(n,c,h,m[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=""),ni(e.type=="template"?n.content:n,Kt(f)?f:[f],e,t,r,x=="foreignObject"?"http://www.w3.org/1999/xhtml":s,i,o,i?i[0]:t.__k&&Mt(t,0),a,l),i!=null)for(c=i.length;c--;)kr(i[c]);a||(c="value",x=="progress"&&p==null?n.removeAttribute("value"):p!=null&&(p!==n[c]||x=="progress"&&!p||x=="option"&&p!=m[c])&&yn(n,c,p,m[c],s),c="checked",b!=null&&b!=n[c]&&yn(n,c,b,m[c],s))}return n}function Er(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){I.__e(s,t)}}function li(n,e,t){var r,s;if(I.unmount&&I.unmount(n),(r=n.ref)&&(r.current&&r.current!=n.__e||Er(r,null,e)),(r=n.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){I.__e(i,e)}r.base=r.__P=null}if(r=n.__k)for(s=0;s<r.length;s++)r[s]&&li(r[s],e,t||typeof n.type!="function");t||kr(n.__e),n.__c=n.__=n.__e=void 0}function $l(n,e,t){return this.constructor(n,t)}function wt(n,e,t){var r,s,i,o;e==document&&(e=document.documentElement),I.__&&I.__(n,e),s=(r=typeof t=="function")?null:t&&t.__k||e.__k,i=[],o=[],Tr(e,n=(!r&&t||e).__k=Qe(Ce,null,[n]),s||Gt,Gt,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),oi(i,n,o)}function ci(n,e){wt(n,e,ci)}function Il(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),Qt(n.type,a,r||n.key,s||n.ref,null)}function ui(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"+Ks++,e.__=n,e.Provider=e.__l=(e.Consumer=function(t,r){return t.children(r)}).contextType=e,e}Fe=Qs.slice,I={__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}},Ys=0,He.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),Sr(this))},He.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),Sr(this))},He.prototype.render=Ce,xt=[],Js=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Zs=function(n,e){return n.__v.__b-e.__v.__b},vn.__r=0,Gs=/(PointerCapture)$|Capture$/i,yr=0,xr=ii(!1),wr=ii(!0),Ks=0;var Nl=0;function g(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 I.vnode&&I.vnode(c),c}var lt,re,Ar,di,Ft=0,hi=[],ce=I,fi=ce.__b,pi=ce.__r,gi=ce.diffed,mi=ce.__c,bi=ce.unmount,_i=ce.__;function kt(n,e){ce.__h&&ce.__h(re,n,Ft||e),Ft=0;var t=re.__H||(re.__H={__:[],__h:[]});return n>=t.__.length&&t.__.push({}),t.__[n]}function N(n){return Ft=1,xn(yi,n)}function xn(n,e,t){var r=kt(lt++,2);if(r.t=n,!r.__c&&(r.__=[t?t(e):yi(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(f){return!!f.__c});if(u.every(function(f){return!f.__N}))return!i||i.call(this,a,l,c);var d=r.__c.props!==a;return u.forEach(function(f){if(f.__N){var h=f.__[0];f.__=f.__N,f.__N=void 0,h!==f.__[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=kt(lt++,3);!ce.__s&&Ir(t.__H,e)&&(t.__=n,t.u=e,re.__H.__h.push(t))}function Lt(n,e){var t=kt(lt++,4);!ce.__s&&Ir(t.__H,e)&&(t.__=n,t.u=e,re.__h.push(t))}function et(n){return Ft=5,pt(function(){return{current:n}},[])}function Rr(n,e,t){Ft=6,Lt(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 pt(n,e){var t=kt(lt++,7);return Ir(t.__H,e)&&(t.__=n(),t.__H=e,t.__h=n),t.__}function jt(n,e){return Ft=8,pt(function(){return n},e)}function Dr(n){var e=re.context[n.__c],t=kt(lt++,9);return t.c=n,e?(t.__==null&&(t.__=!0,e.sub(re)),e.props.value):n.__}function Pr(n,e){ce.useDebugValue&&ce.useDebugValue(e?e(n):n)}function Ml(n){var e=kt(lt++,10),t=N();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 Or(){var n=kt(lt++,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=hi.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(wn),n.__H.__h.forEach($r),n.__H.__h=[]}catch(e){n.__H.__h=[],ce.__e(e,n.__v)}}ce.__b=function(n){re=null,fi&&fi(n)},ce.__=function(n,e){n&&e.__k&&e.__k.__m&&(n.__m=e.__k.__m),_i&&_i(n,e)},ce.__r=function(n){pi&&pi(n),lt=0;var e=(re=n.__c).__H;e&&(Ar===re?(e.__h=[],re.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(wn),e.__h.forEach($r),e.__h=[],lt=0)),Ar=re},ce.diffed=function(n){gi&&gi(n);var e=n.__c;e&&e.__H&&(e.__H.__h.length&&(hi.push(e)!==1&&di===ce.requestAnimationFrame||((di=ce.requestAnimationFrame)||Ll)(Fl)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),Ar=re=null},ce.__c=function(n,e){e.some(function(t){try{t.__h.forEach(wn),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)}}),mi&&mi(n,e)},ce.unmount=function(n){bi&&bi(n);var e,t=n.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{wn(r)}catch(s){e=s}}),t.__H=void 0,e&&ce.__e(e,t.__v))};var vi=typeof requestAnimationFrame=="function";function Ll(n){var e,t=function(){clearTimeout(r),vi&&cancelAnimationFrame(e),setTimeout(n)},r=setTimeout(t,35);vi&&(e=requestAnimationFrame(t))}function wn(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 Ir(n,e){return!n||n.length!==e.length||e.some(function(t,r){return t!==n[r]})}function yi(n,e){return typeof e=="function"?e(n):e}const xi=()=>{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]??"")});function oe(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 Nr=(n,e)=>{const t=JSON.stringify(e);localStorage.setItem(n,t)},wi=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:Mr}=Object,{iterator:kn,toStringTag:Si}=Symbol,Sn=(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=>Sn(e)===n),Tn=n=>e=>typeof e===n,{isArray:Ut}=Array,zt=Tn("undefined");function en(n){return n!==null&&!zt(n)&&n.constructor!==null&&!zt(n.constructor)&&$e(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const Ti=We("ArrayBuffer");function zl(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&Ti(n.buffer),e}const ql=Tn("string"),$e=Tn("function"),Ci=Tn("number"),tn=n=>n!==null&&typeof n=="object",Bl=n=>n===!0||n===!1,Cn=n=>{if(Sn(n)!=="object")return!1;const e=Mr(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Si in n)&&!(kn in n)},Hl=n=>{if(!tn(n)||en(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=>tn(n)&&$e(n.pipe),Zl=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||$e(n.append)&&((e=Sn(n))==="formdata"||e==="object"&&$e(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 nn(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,s;if(typeof n!="object"&&(n=[n]),Ut(n))for(r=0,s=n.length;r<s;r++)e.call(null,n[r],r,n);else{if(en(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(en(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 St=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ai=n=>!zt(n)&&n!==St;function Fr(){const{caseless:n,skipUndefined:e}=Ai(this)&&this||{},t={},r=(s,i)=>{const o=n&&Ei(t,i)||i;Cn(t[o])&&Cn(s)?t[o]=Fr(t[o],s):Cn(s)?t[o]=Fr({},s):Ut(s)?t[o]=s.slice():(!e||!zt(s))&&(t[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&nn(arguments[s],r);return t}const rc=(n,e,t,{allOwnKeys:r}={})=>(nn(e,(s,i)=>{t&&$e(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&&Mr(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(Ut(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"&&Mr(Uint8Array)),uc=(n,e)=>{const r=(n&&n[kn]).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"),Di=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};nn(t,(s,i)=>{let o;(o=e(s,i,n))!==!1&&(r[i]=o||s)}),Object.defineProperties(n,r)},gc=n=>{Di(n,(e,t)=>{if($e(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if($e(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 Ut(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&&$e(n.append)&&n[Si]==="FormData"&&n[kn])}const yc=n=>{const e=new Array(10),t=(r,s)=>{if(tn(r)){if(e.indexOf(r)>=0)return;if(en(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Ut(r)?[]:{};return nn(r,(o,a)=>{const l=t(o,s+1);!zt(l)&&(i[a]=l)}),e[s]=void 0,i}}return r};return t(n,0)},xc=We("AsyncFunction"),wc=n=>n&&(tn(n)||$e(n))&&$e(n.then)&&$e(n.catch),Pi=((n,e)=>n?setImmediate:e?((t,r)=>(St.addEventListener("message",({source:s,data:i})=>{s===St&&i===t&&r.length&&r.shift()()},!1),s=>{r.push(s),St.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",$e(St.postMessage)),kc=typeof queueMicrotask<"u"?queueMicrotask.bind(St):typeof be<"u"&&be.nextTick||Pi,v={isArray:Ut,isArrayBuffer:Ti,isBuffer:en,isFormData:Zl,isArrayBufferView:zl,isString:ql,isNumber:Ci,isBoolean:Bl,isObject:tn,isPlainObject:Cn,isEmptyObject:Hl,isReadableStream:Kl,isRequest:Ql,isResponse:ec,isHeaders:tc,isUndefined:zt,isDate:Wl,isFile:Vl,isBlob:Yl,isRegExp:pc,isFunction:$e,isStream:Jl,isURLSearchParams:Gl,isTypedArray:cc,isFileList:Xl,forEach:nn,merge:Fr,extend:rc,trim:nc,stripBOM:sc,inherits:ic,toFlatObject:oc,kindOf:Sn,kindOfTest:We,endsWith:ac,toArray:lc,forEachEntry:uc,matchAll:dc,isHTMLForm:hc,hasOwnProperty:Ri,hasOwnProp:Ri,reduceDescriptors:Di,freezeMethods:gc,toObjectSet:mc,toCamelCase:fc,noop:bc,toFiniteNumber:_c,findKey:Ei,global:St,isContextDefined:Ai,isSpecCompliantForm:vc,toJSONObject:yc,isAsyncFn:xc,isThenable:wc,setImmediate:Pi,asap:kc,isIterable:n=>n!=null&&$e(n[kn])};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)}v.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:v.toJSONObject(this.config),code:this.code,status:this.status}}});const Oi=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(Oi,"isAxiosError",{value:!0}),L.from=(n,e,t,r,s,i)=>{const o=Object.create(Oi);v.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 Lr(n){return v.isPlainObject(n)||v.isArray(n)}function Ii(n){return v.endsWith(n,"[]")?n.slice(0,-2):n}function Ni(n,e,t){return n?n.concat(e).map(function(s,i){return s=Ii(s),!t&&i?"["+s+"]":s}).join(t?".":""):e}function Tc(n){return v.isArray(n)&&!n.some(Lr)}const Cc=v.toFlatObject(v,{},null,function(e){return/^is[A-Z]/.test(e)});function En(n,e,t){if(!v.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=v.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,m){return!v.isUndefined(m[b])});const r=t.metaTokens,s=t.visitor||u,i=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&v.isSpecCompliantForm(e);if(!v.isFunction(s))throw new TypeError("visitor must be a function");function c(p){if(p===null)return"";if(v.isDate(p))return p.toISOString();if(v.isBoolean(p))return p.toString();if(!l&&v.isBlob(p))throw new L("Blob is not supported. Use a Buffer instead.");return v.isArrayBuffer(p)||v.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function u(p,b,m){let y=p;if(p&&!m&&typeof p=="object"){if(v.endsWith(b,"{}"))b=r?b:b.slice(0,-2),p=JSON.stringify(p);else if(v.isArray(p)&&Tc(p)||(v.isFileList(p)||v.endsWith(b,"[]"))&&(y=v.toArray(p)))return b=Ii(b),y.forEach(function(w,k){!(v.isUndefined(w)||w===null)&&e.append(o===!0?Ni([b],k,i):o===null?b:b+"[]",c(w))}),!1}return Lr(p)?!0:(e.append(Ni(m,b,i),c(p)),!1)}const d=[],f=Object.assign(Cc,{defaultVisitor:u,convertValue:c,isVisitable:Lr});function h(p,b){if(!v.isUndefined(p)){if(d.indexOf(p)!==-1)throw Error("Circular reference detected in "+b.join("."));d.push(p),v.forEach(p,function(y,x){(!(v.isUndefined(y)||y===null)&&s.call(e,y,v.isString(x)?x.trim():x,b,f))===!0&&h(y,b?b.concat(x):[x])}),d.pop()}}if(!v.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 jr(n,e){this._pairs=[],n&&En(n,this,e)}const Fi=jr.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;v.isFunction(t)&&(t={serialize:t});const s=t&&t.serialize;let i;if(s?i=s(e,t):i=v.isURLSearchParams(e)?e.toString():new jr(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){v.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:jr,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Ur=typeof window<"u"&&typeof document<"u",zr=typeof navigator=="object"&&navigator||void 0,Rc=Ur&&(!zr||["ReactNative","NativeScript","NS"].indexOf(zr.product)<0),Dc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Pc=Ur&&window.location.href||"http://localhost",we={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ur,hasStandardBrowserEnv:Rc,hasStandardBrowserWebWorkerEnv:Dc,navigator:zr,origin:Pc},Symbol.toStringTag,{value:"Module"})),...Ac};function Oc(n,e){return En(n,new we.classes.URLSearchParams,{visitor:function(t,r,s,i){return we.isNode&&v.isBuffer(t)?(this.append(r,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function $c(n){return v.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Ic(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&&v.isArray(s)?s.length:o,l?(v.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!a):((!s[o]||!v.isObject(s[o]))&&(s[o]=[]),e(t,r,s[o],i)&&v.isArray(s[o])&&(s[o]=Ic(s[o])),!a)}if(v.isFormData(n)&&v.isFunction(n.entries)){const t={};return v.forEachEntry(n,(r,s)=>{e($c(r),s,t,0)}),t}return null}function Nc(n,e,t){if(v.isString(n))try{return(e||JSON.parse)(n),v.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const rn={transitional:Ui,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",s=r.indexOf("application/json")>-1,i=v.isObject(e);if(i&&v.isHTMLForm(e)&&(e=new FormData(e)),v.isFormData(e))return s?JSON.stringify(zi(e)):e;if(v.isArrayBuffer(e)||v.isBuffer(e)||v.isStream(e)||v.isFile(e)||v.isBlob(e)||v.isReadableStream(e))return e;if(v.isArrayBufferView(e))return e.buffer;if(v.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 Oc(e,this.formSerializer).toString();if((a=v.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return En(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||rn.transitional,r=t&&t.forcedJSONParsing,s=this.responseType==="json";if(v.isResponse(e)||v.isReadableStream(e))return e;if(e&&v.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:we.classes.FormData,Blob:we.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};v.forEach(["delete","get","head","post","put","patch"],n=>{rn.headers[n]={}});const Mc=v.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 sn(n){return n&&String(n).trim().toLowerCase()}function An(n){return n===!1||n==null?n:v.isArray(n)?n.map(An):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 qr(n,e,t,r,s){if(v.isFunction(r))return r.call(this,e,t);if(s&&(e=t),!!v.isString(e)){if(v.isString(r))return e.indexOf(r)!==-1;if(v.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=v.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 Ie=class{constructor(e){e&&this.set(e)}set(e,t,r){const s=this;function i(a,l,c){const u=sn(l);if(!u)throw new Error("header name must be a non-empty string");const d=v.findKey(s,u);(!d||s[d]===void 0||c===!0||c===void 0&&s[d]!==!1)&&(s[d||l]=An(a))}const o=(a,l)=>v.forEach(a,(c,u)=>i(c,u,l));if(v.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(v.isString(e)&&(e=e.trim())&&!jc(e))o(Fc(e),t);else if(v.isObject(e)&&v.isIterable(e)){let a={},l,c;for(const u of e){if(!v.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[c=u[0]]=(l=a[c])?v.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=sn(e),e){const r=v.findKey(this,e);if(r){const s=this[r];if(!t)return s;if(t===!0)return Lc(s);if(v.isFunction(t))return t.call(this,s,r);if(v.isRegExp(t))return t.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=sn(e),e){const r=v.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||qr(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let s=!1;function i(o){if(o=sn(o),o){const a=v.findKey(r,o);a&&(!t||qr(r,r[a],a,t))&&(delete r[a],s=!0)}}return v.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||qr(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const t=this,r={};return v.forEach(this,(s,i)=>{const o=v.findKey(r,i);if(o){t[o]=An(s),delete t[i];return}const a=e?Uc(i):String(i).trim();a!==i&&delete t[i],t[a]=An(s),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return v.forEach(this,(r,s)=>{r!=null&&r!==!1&&(t[s]=e&&v.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=sn(o);r[a]||(zc(s,o),r[a]=!0)}return v.isArray(e)?e.forEach(i):i(e),this}};Ie.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),v.reduceDescriptors(Ie.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}}),v.freezeMethods(Ie);function Br(n,e){const t=this||rn,r=e||t,s=Ie.from(r.headers);let i=r.data;return v.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 qt(n,e,t){L.call(this,n??"canceled",L.ERR_CANCELED,e,t),this.name="CanceledError"}v.inherits(qt,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,f=0;for(;d!==s;)f+=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(f*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 Rn=(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)=>v.asap(()=>n(...e)),Wc=we.hasStandardBrowserEnv?((n,e)=>t=>(t=new URL(t,we.origin),n.protocol===t.protocol&&n.host===t.host&&(e||n.port===t.port)))(new URL(we.origin),we.navigator&&/(msie|trident)/i.test(we.navigator.userAgent)):()=>!0,Vc=we.hasStandardBrowserEnv?{write(n,e,t,r,s,i,o){if(typeof document>"u")return;const a=[`${n}=${encodeURIComponent(e)}`];v.isNumber(t)&&a.push(`expires=${new Date(t).toUTCString()}`),v.isString(r)&&a.push(`path=${r}`),v.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),v.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 Ie?{...n}:n;function Tt(n,e){e=e||{};const t={};function r(c,u,d,f){return v.isPlainObject(c)&&v.isPlainObject(u)?v.merge.call({caseless:f},c,u):v.isPlainObject(u)?v.merge({},u):v.isArray(u)?u.slice():u}function s(c,u,d,f){if(v.isUndefined(u)){if(!v.isUndefined(c))return r(void 0,c,d,f)}else return r(c,u,d,f)}function i(c,u){if(!v.isUndefined(u))return r(void 0,u)}function o(c,u){if(v.isUndefined(u)){if(!v.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 v.forEach(Object.keys({...n,...e}),function(u){const d=l[u]||s,f=d(n[u],e[u],u);v.isUndefined(f)&&d!==a||(t[u]=f)}),t}const Ji=n=>{const e=Tt({},n);let{data:t,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=e;if(e.headers=o=Ie.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)):""))),v.isFormData(t)){if(we.hasStandardBrowserEnv||we.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(v.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(we.hasStandardBrowserEnv&&(r&&v.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=Ie.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=s,u,d,f,h,p;function b(){h&&h(),p&&p(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let m=new XMLHttpRequest;m.open(s.method.toUpperCase(),s.url,!0),m.timeout=s.timeout;function y(){if(!m)return;const w=Ie.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),_={data:!a||a==="text"||a==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:w,config:n,request:m};Hi(function(R){t(R),b()},function(R){r(R),b()},_),m=null}"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(y)},m.onabort=function(){m&&(r(new L("Request aborted",L.ECONNABORTED,n,m)),m=null)},m.onerror=function(k){const _=k&&k.message?k.message:"Network Error",T=new L(_,L.ERR_NETWORK,n,m);T.event=k||null,r(T),m=null},m.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,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&v.forEach(o.toJSON(),function(k,_){m.setRequestHeader(_,k)}),v.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),a&&a!=="json"&&(m.responseType=s.responseType),c&&([f,p]=Rn(c,!0),m.addEventListener("progress",f)),l&&m.upload&&([d,h]=Rn(l),m.upload.addEventListener("progress",d),m.upload.addEventListener("loadend",h)),(s.cancelToken||s.signal)&&(u=w=>{m&&(r(!w||w.type?new qt(null,n,m):w),m.abort(),m=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&&we.protocols.indexOf(x)===-1){r(new L("Unsupported protocol "+x+":",L.ERR_BAD_REQUEST,n));return}m.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 qt(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=()=>v.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 f=i+=d;t(f)}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}=v,eu=(({Request:n,Response:e})=>({Request:n,Response:e}))(v.global),{ReadableStream:Ki,TextEncoder:Qi}=v.global,eo=(n,...e)=>{try{return!!n(...e)}catch{return!1}},tu=n=>{n=v.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"?(p=>b=>p.encode(b))(new Qi):async p=>new Uint8Array(await new t(p).arrayBuffer())),c=i&&a&&eo(()=>{let p=!1;const b=new t(we.origin,{body:new Ki,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!b}),u=o&&a&&eo(()=>v.isReadableStream(new r("").body)),d={stream:u&&(p=>p.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!d[p]&&(d[p]=(b,m)=>{let y=b&&b[p];if(y)return y.call(b);throw new L(`Response type '${p}' is not supported`,L.ERR_NOT_SUPPORT,m)})});const f=async p=>{if(p==null)return 0;if(v.isBlob(p))return p.size;if(v.isSpecCompliantForm(p))return(await new t(we.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(v.isArrayBufferView(p)||v.isArrayBuffer(p))return p.byteLength;if(v.isURLSearchParams(p)&&(p=p+""),v.isString(p))return(await l(p)).byteLength},h=async(p,b)=>{const m=v.toFiniteNumber(p.getContentLength());return m??f(b)};return async p=>{let{url:b,method:m,data:y,signal:x,cancelToken:w,timeout:k,onDownloadProgress:_,onUploadProgress:T,responseType:R,headers:E,withCredentials:A="same-origin",fetchOptions:F}=Ji(p),P=e||fetch;R=R?(R+"").toLowerCase():"text";let Y=Zc([x,w&&w.toAbortSignal()],k),se=null;const ee=Y&&Y.unsubscribe&&(()=>{Y.unsubscribe()});let Te;try{if(T&&c&&m!=="get"&&m!=="head"&&(Te=await h(E,y))!==0){let D=new t(b,{method:"POST",body:y,duplex:"half"}),$;if(v.isFormData(y)&&($=D.headers.get("content-type"))&&E.setContentType($),D.body){const[M,O]=Wi(Te,Rn(Vi(T)));y=Zi(D.body,Gi,M,O)}}v.isString(A)||(A=A?"include":"omit");const Z=i&&"credentials"in t.prototype,ve={...F,signal:Y,method:m.toUpperCase(),headers:E.normalize().toJSON(),body:y,duplex:"half",credentials:Z?A:void 0};se=i&&new t(b,ve);let fe=await(i?P(se,F):P(b,ve));const ze=u&&(R==="stream"||R==="response");if(u&&(_||ze&&ee)){const D={};["status","statusText","headers"].forEach(z=>{D[z]=fe[z]});const $=v.toFiniteNumber(fe.headers.get("content-length")),[M,O]=_&&Wi($,Rn(Vi(_),!0))||[];fe=new r(Zi(fe.body,Gi,M,()=>{O&&O(),ee&&ee()}),D)}R=R||"text";let C=await d[v.findKey(d,R)||"text"](fe,p);return!ze&&ee&&ee(),await new Promise((D,$)=>{Hi(D,$,{data:C,headers:Ie.from(fe.headers),status:fe.status,statusText:fe.statusText,config:p,request:se})})}catch(Z){throw ee&&ee(),Z&&Z.name==="TypeError"&&/Load failed|fetch/i.test(Z.message)?Object.assign(new L("Network Error",L.ERR_NETWORK,p,se),{cause:Z.cause||Z}):L.from(Z,Z&&Z.code,p,se)}}},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 Hr={http:Sc,xhr:Jc,fetch:{get:to}};v.forEach(Hr,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const no=n=>`- ${n}`,ru=n=>v.isFunction(n)||n===null||n===!1;function su(n,e){n=v.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=Hr[(a=String(r)).toLowerCase()],s===void 0))throw new L(`Unknown adapter '${a}'`);if(s&&(v.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:Hr};function Wr(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new qt(null,n)}function so(n){return Wr(n),n.headers=Ie.from(n.headers),n.data=Br.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),ro.getAdapter(n.adapter||rn.adapter,n)(n).then(function(r){return Wr(n),r.data=Br.call(n,n.transformResponse,r),r.headers=Ie.from(r.headers),r},function(r){return Bi(r)||(Wr(n),r&&r.response&&(r.response.data=Br.call(n,n.transformResponse,r.response),r.response.headers=Ie.from(r.response.headers))),Promise.reject(r)})}const io="1.13.2",Pn={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{Pn[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const oo={};Pn.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}},Pn.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 On={assertOptions:iu,validators:Pn},tt=On.validators;let Ct=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=Tt(this.defaults,t);const{transitional:r,paramsSerializer:s,headers:i}=t;r!==void 0&&On.assertOptions(r,{silentJSONParsing:tt.transitional(tt.boolean),forcedJSONParsing:tt.transitional(tt.boolean),clarifyTimeoutError:tt.transitional(tt.boolean)},!1),s!=null&&(v.isFunction(s)?t.paramsSerializer={serialize:s}:On.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),On.assertOptions(t,{baseUrl:tt.spelling("baseURL"),withXsrfToken:tt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&v.merge(i.common,i[t.method]);i&&v.forEach(["delete","get","head","post","put","patch","common"],p=>{delete i[p]}),t.headers=Ie.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(t)===!1||(l=l&&b.synchronous,a.unshift(b.fulfilled,b.rejected))});const c=[];this.interceptors.response.forEach(function(b){c.push(b.fulfilled,b.rejected)});let u,d=0,f;if(!l){const p=[so.bind(this),void 0];for(p.unshift(...a),p.push(...c),f=p.length,u=Promise.resolve(t);d<f;)u=u.then(p[d++],p[d++]);return u}f=a.length;let h=t;for(;d<f;){const p=a[d++],b=a[d++];try{h=p(h)}catch(m){b.call(this,m);break}}try{u=so.call(this,h)}catch(p){return Promise.reject(p)}for(d=0,f=c.length;d<f;)u=u.then(c[d++],c[d++]);return u}getUri(e){e=Tt(this.defaults,e);const t=Yi(e.baseURL,e.url,e.allowAbsoluteUrls);return Li(t,e.params,e.paramsSerializer)}};v.forEach(["delete","get","head","options"],function(e){Ct.prototype[e]=function(t,r){return this.request(Tt(r||{},{method:e,url:t,data:(r||{}).data}))}}),v.forEach(["post","put","patch"],function(e){function t(r){return function(i,o,a){return this.request(Tt(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Ct.prototype[e]=t(),Ct.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 qt(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 v.isObject(n)&&n.isAxiosError===!0}const Vr={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(Vr).forEach(([n,e])=>{Vr[e]=n});function ao(n){const e=new Ct(n),t=ki(Ct.prototype.request,e);return v.extend(t,Ct.prototype,e,{allOwnKeys:!0}),v.extend(t,e,null,{allOwnKeys:!0}),t.create=function(s){return ao(Tt(n,s))},t}const he=ao(rn);he.Axios=Ct,he.CanceledError=qt,he.CancelToken=ou,he.isCancel=Bi,he.VERSION=io,he.toFormData=En,he.AxiosError=L,he.Cancel=he.CanceledError,he.all=function(e){return Promise.all(e)},he.spread=au,he.isAxiosError=lu,he.mergeConfig=Tt,he.AxiosHeaders=Ie,he.formToJSON=n=>zi(v.isHTMLForm(n)?new FormData(n):n),he.getAdapter=ro.getAdapter,he.HttpStatusCode=Vr,he.default=he;const{Axios:Op,AxiosError:$p,CanceledError:Ip,isCancel:Np,CancelToken:Mp,VERSION:Fp,all:Lp,Cancel:jp,isAxiosError:Up,spread:zp,toFormData:qp,AxiosHeaders:Bp,HttpStatusCode:Hp,formToJSON:Wp,getAdapter:Vp,mergeConfig:Yp}=he,cu="http://localhost:4500",uu="wss://realtime.robodialog.com/connection/websocket",lo=cu+"/api/v1",Ne=he.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 Et(n){this._maxSize=n,this.clear()}Et.prototype.clear=function(){this._size=0,this._values=Object.create(null)},Et.prototype.get=function(n){return this._values[n]},Et.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*$/,Yr=512,ho=new Et(Yr),fo=new Et(Yr),po=new Et(Yr),At={Cache:Et,split:Jr,normalizePath:Xr,setter:function(n){var e=Xr(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=Xr(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+(Zr(t)||uo.test(t)?"["+t+"]":(e?".":"")+t)},"")},forEach:function(n,e,t){mu(Array.isArray(n)?n:Jr(n),e,t)}};function Xr(n){return ho.get(n)||ho.set(n,Jr(n).map(function(e){return e.replace(gu,"$2")}))}function Jr(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=Zr(s),o=!a&&/^\d+$/.test(s),e.call(t,s,a,o,i,n))}function Zr(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!Zr(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,$n=n=>n.match(yu)||[],In=n=>n[0].toUpperCase()+n.slice(1),Gr=(n,e)=>$n(n).join(e).toLowerCase(),go=n=>$n(n).reduce((e,t)=>`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,"");var Kr={words:$n,upperFirst:In,camelCase:go,pascalCase:n=>In(go(n)),snakeCase:n=>Gr(n,"_"),kebabCase:n=>Gr(n,"-"),sentenceCase:n=>In(Gr(n," ")),titleCase:n=>$n(n).map(In).join(" ")},Qr={exports:{}};Qr.exports=function(n){return mo(xu(n),n)},Qr.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 f;try{f=", node was:"+JSON.stringify(c)}catch{f=""}throw new Error("Cyclic dependency"+f)}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 p=h[--u];l(p,a.get(p),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 Su=Qr.exports;const Tu=co(Su),Cu=Object.prototype.toString,Eu=Error.prototype.toString,Au=RegExp.prototype.toString,Ru=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Du=/^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(Du,"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 ct(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,Ou=/\$\{\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(xe.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 xe 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(Ou,(s,i)=>ct(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,xe)}static[yo](e){return wo[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 \`${ct(r,!0)}\`).`:".";return e!=="mixed"?`${n} must be a \`${e}\` type, but the final value was: \`${ct(t,!0)}\``+s:`${n} must match the configured type. The validated value was: \`${ct(t,!0)}\``+s}},Me={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"},gt={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"},es={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},ts={isValue:"${path} field must be ${value}"},Nn={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Mn={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:Me,number:gt,date:es,object:Nn,array:Mn,boolean:ts,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: \`${ct(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: \`${ct(t,!0)}\``}return xe.formatError(nt.notType,n)}}});const Fn=n=>n&&n.__isYupSchema__;class Ln{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 Ln(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(!Fn(s))throw new TypeError("conditions must return a schema object");return s.resolve(t)}}const jn={context:"$",value:"."};class Rt{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]===jn.context,this.isValue=this.key[0]===jn.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?jn.context:this.isValue?jn.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&At.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}}Rt.prototype.__isYupRef=!0;const Ve=n=>n==null;function Bt(n){function e({value:t,path:r="",options:s,originalValue:i,schema:o},a,l){const{name:c,test:u,params:d,message:f,skipAbsent:h}=n;let{parent:p,context:b,abortEarly:m=o.spec.abortEarly,disableStackTrace:y=o.spec.disableStackTrace}=s;const x={value:t,parent:p,context:b};function w(P={}){const Y=ko(Object.assign({value:t,originalValue:i,label:o.spec.label,path:P.path||r,spec:o.spec,disableStackTrace:P.disableStackTrace||y},d,P.params),x),se=new xe(xe.formatError(P.message||f,Y),t,Y.path,P.type||c,Y.disableStackTrace);return se.params=Y,se}const k=m?a:l;let _={path:r,parent:p,type:c,from:s.from,createError:w,resolve(P){return So(P,x)},options:s,originalValue:i,schema:o};const T=P=>{xe.isError(P)?k(P):P?l(null):k(w())},R=P=>{xe.isError(P)?k(P):a(P)};if(h&&Ve(t))return T(!0);let A;try{var F;if(A=u.call(_,t,_),typeof((F=A)==null?void 0:F.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(T,R)}}catch(P){R(P);return}T(A)}return e.OPTIONS=n,e}function ko(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 Rt.isRef(n)?n.getValue(e.value,e.parent,e.context):n}function $u(n,e,t,r=t){let s,i,o;return e?(At.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",f=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&&f>=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[f],n=d?n.spec.types[f]: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 Un extends Set{describe(){const e=[];for(const t of this.values())e.push(Rt.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 Un(this.values())}merge(e,t){const r=this.clone();return e.forEach(s=>r.add(s)),t.forEach(s=>r.delete(s)),r}}function Ht(n,e=new Map){if(Fn(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]=Ht(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,Ht(s,e))}else if(n instanceof Set){t=new Set,e.set(n,t);for(const r of n)t.add(Ht(r,e))}else if(n instanceof Object){t={},e.set(n,t);for(const[r,s]of Object.entries(n))t[r]=Ht(s,e)}else throw Error(`Unable to clone ${n}`);return t}function Iu(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:Iu(t)}))}function To(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=>To(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 Un,this._blacklist=new Un,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=Ht(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=ct(e),a=ct(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 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=(()=>{var t,r;if(typeof window>"u")return"https://api.robodialog.com";const n=document.currentScript;if((t=n==null?void 0:n.src)!=null&&t.includes("localhost")||(r=n==null?void 0:n.src)!=null&&r.includes("127.0.0.1"))return"http://localhost:4500";const e=document.getElementsByTagName("script");for(let s=0;s<e.length;s++){const i=e[s].src;if((i.includes("localhost")||i.includes("127.0.0.1"))&&(i.includes("robodialog")||i.includes("widget")))return"http://localhost:4500"}return"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}".
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=b=>{s||(s=!0,t(b,o))},d=b=>{s||(s=!0,r(b,o))},f=i.length,h=[];if(!f)return d([]);let p={value:o,originalValue:a,path:l,options:c,schema:this};for(let b=0;b<i.length;b++){const m=i[b];m(p,u,function(x){x&&(Array.isArray(x)?h.push(...x):h.push(x)),--f<=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,f,h)=>this.resolve(u)._validate(c,u,f,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)=>{xe.isError(l)&&(l.value=c),a(l)},(l,c)=>{l.length?a(new xe(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 xe.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new xe(a,e,void 0,void 0,o);i=l}),i}isValid(e,t){return this.validate(e,t).then(()=>!0,r=>{if(xe.isError(r))return!1;throw r})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(r){if(xe.isError(r))return!1;throw r}}_getDefault(e){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this,e):Ht(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=Bt({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=Bt({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=Bt(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 Rt(i));return s.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof t=="function"?new Ln(s,t):Ln.fromOptions(s,t)),r}typeError(e){let t=this.clone();return t.internalTests.typeError=Bt({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=Bt({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=Bt({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 xe)return{issues:To(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 ns(){return new Co}class Co 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=ts.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"true"},test(t){return Ve(t)||t===!0}})}isFalse(e=ts.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)}}ns.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=rs(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 rs(n){var e,t;const r=Mu.exec(n);return r?{year:ut(r[1]),month:ut(r[2],1)-1,day:ut(r[3],1),hour:ut(r[4]),minute:ut(r[5]),second:ut(r[6]),millisecond:r[7]?ut(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:ut(r[10]),minuteOffset:ut(r[11])}:null}function ut(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 V(){return new Eo}class Eo 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===Vu?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=Me.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=Me.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=Me.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||Me.matches,params:{regex:e},skipAbsent:!0,test:o=>o===""&&r||o.search(e)!==-1})}email(e=Me.email){return this.matches(Lu,{name:"email",message:e,excludeEmptyString:!0})}url(e=Me.url){return this.matches(ju,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=Me.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||Me.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:t||Me.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const o=rs(i);return o?!!o.z:!1}}).test({name:"datetime_precision",message:t||Me.datetime_precision,params:{precision:s},skipAbsent:!0,test:i=>{if(!i||s==null)return!0;const o=rs(i);return o?o.precision===s:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=Me.trim){return this.transform(t=>t!=null?t.trim():t).test({message:e,name:"trim",test:Wu})}lowercase(e=Me.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=Me.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()})}}V.prototype=Eo.prototype;let Yu=n=>n!=+n;function on(){return new Ao}class Ao extends Le{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=gt.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=gt.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=gt.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=gt.moreThan){return this.test({message:t,name:"min",exclusive:!0,params:{more:e},skipAbsent:!0,test(r){return r>this.resolve(e)}})}positive(e=gt.positive){return this.moreThan(0,e)}negative(e=gt.negative){return this.lessThan(0,e)}integer(e=gt.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))}}on.prototype=Ao.prototype;let Xu=new Date(""),Ju=n=>Object.prototype.toString.call(n)==="[object Date]";class ss extends Le{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)?ss.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let r;if(Rt.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=es.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=es.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)}})}}ss.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=At.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),Rt.isRef(a)&&a.isSibling?i(a.path,o):Fn(a)&&"deps"in a&&a.deps.forEach(l=>i(l,o))}return Tu.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 Do(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 zn(n){if("fields"in n){const e={};for(const[t,r]of Object.entries(n.fields))e[t]=zn(r);return n.setFields(e)}if(n.type==="array"){const e=n.optional();return e.innerType&&(e.innerType=zn(e.innerType)),e}return n.type==="tuple"?n.optional().clone({types:n.spec.types.map(zn)}):"optional"in n?n.optional():n}const Gu=(n,e)=>{const t=[...At.normalizePath(e)];if(t.length===1)return t[0]in n;let r=t.pop(),s=At.getter(At.join(t),!0)(n);return!!(s&&r in s)};let Oo=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 Ku=Do([]);function W(n){return new Io(n)}class Io extends Le{constructor(e){super({type:"object",check(t){return Oo(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 f=i[d],h=d in s,p=s[d];if(f){let b;c.path=(t.path?`${t.path}.`:"")+d,f=f.resolve({value:p,context:t.context,parent:l});let m=f instanceof Le?f.spec:void 0,y=m==null?void 0:m.strict;if(m!=null&&m.strip){u=u||d in s;continue}b=!t.__validating||!y?f.cast(p,c):p,b!==void 0&&(l[d]=b)}else h&&!o&&(l[d]=p);(h!==d in l||l[d]!==p)&&(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||!Oo(c)){s(l,c);return}o=o||c;let u=[];for(let d of this._nodes){let f=this.fields[d];!f||Rt.isRef(f)||u.push(f.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=Do(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 zn(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=At.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||Nn.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=Nn.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=Nn.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(Kr.camelCase)}snakeCase(){return this.transformKeys(Kr.snakeCase)}constantCase(){return this.transformKeys(e=>Kr.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}}W.prototype=Io.prototype;function qn(n){return new No(n)}class No 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 f;d[h]=o.asNestedTest({options:t,index:h,parent:c,parentPath:t.path,originalParent:(f=t.originalValue)!=null?f: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(!Fn(e))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+ct(e));return t.innerType=e,t.spec=Object.assign({},t.spec,{types:e}),t}length(e,t=Mn.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||Mn.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||Mn.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}}qn.prototype=No.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 xe(`Unknown properties: ${r.join(", ")}`,t,"custom-validation");return!0},Qu=W().shape({params:W().shape({id:V().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",n=>ge(["id"],[])(n))}),ed=W().shape({body:W().shape({userId:V().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:ns().required("Visitor is required"),chatbotId:V().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"]))}),Mo={readById:async n=>{await Qu.validate({params:n.params},{abortEarly:!1});const{data:e}=await Ne.get(`/live/readById/${n.params.id}`);return e},generateToken:async n=>{await ed.validate({body:n.body},{abortEarly:!1});const{data:e}=await Ne.post("/live/generateToken",n.body);return e}},td=W().shape({params:W().shape({id:V().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"],[]))}),nd=W().shape({query:W().shape({skip:V().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"]))}),rd=W().shape({body:W().shape({currentNode:V().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:W().shape({id:V().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"],[]))}),sd=W().shape({body:W().shape({assignType:V().oneOf(["role","teamMember","everyone"]).required("Assign Type is required"),assignTo:V().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:W().shape({id:V().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"],[]))}),id=W().shape({body:W().shape({chatflow:W().shape({key:V().max(1e3,"Key cannot exceed 1000 characters").optional(),index:on().max(1e3,"Index cannot exceed 1000").optional()}).nullable().optional(),nodeId:V().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"]))}),Dt={userRead:async(n,e)=>{await td.validate({params:n.params},{abortEarly:!1});const{data:t}=await Ne.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 Ne.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 Ne.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 Ne.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 Ne.post("/conversation/user/create",n.body,{headers:{Authorization:`Bearer ${e}`}});return t}},od=({className:n,style:e={}})=>g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",viewBox:"0 0 256 256",className:n,style:e,children:g("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"})}),an=({className:n,width:e=16,height:t=16})=>g("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 256 256",className:n,children:g("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"})}),Wt=({className:n})=>g("svg",{width:"100%",height:"100%",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg",className:n,children:g("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})=>g("svg",{width:"11",height:"6",viewBox:"0 0 11 6",xmlns:"http://www.w3.org/2000/svg",className:n,children:g("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})=>g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 256 256",className:n,children:g("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})=>g("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 256 256",className:n,children:g("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})=>g("svg",{width:e,height:e*2,viewBox:"0 0 9 14",xmlns:"http://www.w3.org/2000/svg",className:n,children:[g("circle",{cx:"6.99929",cy:"1.27273",r:"1.27273",fill:"currentColor"}),g("circle",{cx:"1.27273",cy:"1.27273",r:"1.27273",fill:"currentColor"}),g("circle",{cx:"6.99929",cy:"7.00002",r:"1.27273",fill:"currentColor"}),g("circle",{cx:"1.27273",cy:"7.00002",r:"1.27273",fill:"currentColor"}),g("circle",{cx:"6.99929",cy:"12.7273",r:"1.27273",fill:"currentColor"}),g("circle",{cx:"1.27273",cy:"12.7273",r:"1.27273",fill:"currentColor"})]}),cd=({className:n})=>g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 256 256",className:n,children:g("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})=>g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 256 256",className:n,children:g("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==",is=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"in the future";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(f=>r<f.limit);return d?d.label:l>0?`${l} month${l!==1?"s":""} ago`:`${c} year${c!==1?"s":""} ago`},hd=W().shape({name:V().min(1,"Name must be at least 1 character").max(1e3,"Name cannot exceed 1000 characters").required("Name is required"),url:V().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"])),fd=W().shape({text:V().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",ge([],["text","file"])),pd=W().shape({params:W().shape({id:V().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"]))}),gd=W().shape({body:W().shape({conversationId:V().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Conversation Id").required("Conversation Id is required"),skip:on().min(0,"Skip must be at least 0").max(1e4,"Skip cannot exceed 10000").optional()}).test("custom-validation","Custom validation failed",ge(["conversationId"],["skip"]))}),jo=W().shape({body:W().shape({owner:V().oneOf(["ai","user"]).required("Owner must be 'ai' or 'user'"),conversationId:V().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Conversation Id").required("Conversation Id is required"),type:V().oneOf(["AI Text","Human Text","External API","External API Text","AI Response"]).required("Type is required"),data:fd.required("Message data is required"),currentChatflow:W().shape({key:V().max(1e3,"Key cannot exceed 1000 characters").optional(),index:on().max(1e3,"Index cannot exceed 1000").optional()}).nullable().optional()}).test("custom-validation","Custom validation failed",ge(["owner","conversationId","type","data"],["currentChatflow"]))}),md=W().shape({body:W().shape({queries:qn().of(V().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:qn().of(W().shape({user:V().min(1,"User message must be at least 1 character").max(1e3,"User message cannot exceed 1000 characters").optional(),ai:V().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"]))}),bd=W().shape({body:W().shape({conversationId:V().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Conversation Id").required("Conversation Id is required"),conversationHistory:qn().of(W().shape({user:V().min(1,"User message must be at least 1 character").max(1e3,"User message cannot exceed 1000 characters").optional(),ai:V().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:ns().optional()}).test("custom-validation","Custom validation failed",ge(["conversationId","conversationHistory"],["enableStreaming"]))}),os={userReadAll:async(n,e)=>{await gd.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ne.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 Ne.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 Ne.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 Ne.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 Ne.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 Ne.post("/asset/userUpload",t,{headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e}`}});return r}};W().shape({rating:V().trim().min(1).max(1),skip:V().trim().min(1).max(1e3),limit:V().trim().min(1).max(1e3)}).test("custom-validation","Custom validation failed",ge([],["rating","skip","limit"]));const vd=W().shape({body:W().shape({conversationId:V().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Conversation Id is required"),chatbotId:V().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Chatbot Id is required"),comment:V().trim().max(500).min(3).required("Comment is required"),rating:on().max(5).min(1).required("Rating is required")}).test("custom-validation","Custom validation failed",ge(["conversationId","chatbotId","comment","rating"]))}),yd={userCreate:async(n,e)=>{await vd.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ne.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(console.log("Starting SSE parsing...");;){const{done:o,value:a}=await s.read();if(o)break;this.buffer+=i.decode(a,{stream:!0}),console.log("Buffer:",this.buffer),this.processBuffer(t)}this.buffer.trim()&&(console.log("Processing remaining data:",this.buffer),this.processBuffer(t)),console.log("SSE parsing done."),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(console.log("Processing line:",r),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{console.log("Parsing SSE data:",this.eventData),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",rt="3",kd=[{_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)=>{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"in the future";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
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"}],Td={_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=async(n,e,t,r,s)=>{if(!(!e.token||n.owner!=="agent"||n.seen))try{await os.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){Pt(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 Dt.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){Pt(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){Pt(i,s,"Failed to submit review")}},Uo=async n=>{const{data:e,coreState:t,conversationState:r,uiState:s,type:i,showToast:o,currentChatflow:a,owner:l}=n,{isDefaultExternalAPI:c}=t;if(c){const d={_id:xi(),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||[],d];return r.messagesRef.current=f,r.setMessages(f),null}if(!t.token||!r.currentConversation)return null;const u={owner:l,conversationId:r.currentConversation._id,data:e,type:i,currentChatflow:a};try{await jo.validate({body:u},{abortEarly:!1});const d=await os.userCreate({body:u},t.token);if(!d.data)throw new Error("Message creation failed");const f=d.data,h=[...r.messagesRef.current||[],f];if(r.messagesRef.current=h,r.setMessages(h),a){const p=r.conversations.map(b=>b._id===r.currentConversation._id?{...b,currentChatflow:a}:b);r.setConversations(p)}return{messages:r.messagesRef.current,conversations:r.conversations.map(p=>p._id===r.currentConversation._id&&a?{...p,currentChatflow:a}:p)}}catch(d){if(d instanceof xe){const f=d.inner.map(h=>h.message).join(", ");o(f,"error")}else Pt(d,o,"Failed to send message");return null}},Vt=async n=>{const{coreState:e,conversationState:t,uiState:r,showToast:s,...i}=n;r.setAiLoading(!0);try{await Uo({...i,coreState:e,conversationState:t,uiState:r,type:"AI Text",owner:"ai",showToast:s})}finally{r.setAiLoading(!1)}},as=async n=>{const{showToast:e,conversationState:t,coreState:r,uiState:s}=n;s.setUserLoading(!0);try{return await Uo({...n,conversationState:t,coreState:r,uiState:s,showToast:e,type:"Human Text"})}finally{s.setUserLoading(!1)}},zo=async n=>{var d,f,h,p;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 b=e.url;if((d=e.params)!=null&&d.length){const E=new URLSearchParams;e.params.forEach(A=>{const F=String(t[A.key]??A.value??"");E.append(A.key,F)}),b+=`?${E.toString()}`}const m=e.method.toUpperCase();let y;m!=="GET"&&((f=e.body)!=null&&f.length)&&(y={},e.body.forEach(E=>{y[E.key]=t[E.key]??E.value??""}));const x={Accept:"application/json"};y&&(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(b,{method:m,headers:x,body:y?JSON.stringify(y):void 0}),k=w.status;let _=null;try{_=await w.json()}catch{_=null}const T=(p=e.response)==null?void 0:p.find(E=>E.statusCode===k);if(T){if(T.type==="path"&&T.id)return u?(await Vt({data:{text:"The AI will continue with specified path"},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),!0):await Bn({source:s.id,sourceHandle:T.id,conversationState:i,coreState:o,showToast:a,uiState:l});if(T.message){const E=jl(T.message,t,_);return await Vt({data:{text:E},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),!1}}const R=w.ok?"Successfully Submitted":"Sorry, we encountered an error while processing your request. Please try again later.";return await Vt({data:{text:R},currentChatflow:r,coreState:o,conversationState:i,uiState:l,showToast:a,type:"AI Text"}),!1}catch(b){return console.error("External API call failed:",b),await Vt({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"}),!1}finally{l.setAiLoading(!1)}},qo=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 f=>{let h="";for(const b in f){const m=e.dataFromUser.find(y=>y.key===b);h+=`${m==null?void 0:m.name}: ${f[b]}
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 ):
16
+ \`\`\`json
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 ):
19
+ \`\`\`json
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 ):
22
+ \`\`\`json
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 ):
25
+ \`\`\`json
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]}
16
28
 
17
- `}await as({data:{text:h},currentChatflow:t,coreState:s,conversationState:i,uiState:o,showToast:a,type:"Human Text",owner:"user"});const p=await zo({userData:f,externalAPI:e,currentChatflow:t,currentNode:r,coreState:s,conversationState:i,uiState:o,showToast:a});o.setDataFromUser(null),l(p)},d=()=>{l(!1)};o.setDataFromUser({data:e.dataFromUser,onSubmit:u,onCancel:d})}else(async()=>{const d=await zo({externalAPI:e,currentChatflow:t,currentNode:r,coreState:s,conversationState:i,uiState:o,showToast:a,userData:{}});l(d)})()})},Bo=async(n,e,t,r,s)=>{if(!n.token||!e.currentConversation)return;const{chatbot:i}=n,{currentConversation:o,setMessages:a,messagesRef:l}=e,{setAiLoading:c}=t,u=Rd(s,o._id);c(!0);const d={_id:`streaming_${Date.now()}`,conversationId:o._id,owner:"ai",ownerId:null,data:{text:"Analyzing user query",thinking:[],path:null},type:"AI Response",createdAt:new Date().toString(),updatedAt:new Date().toString(),chatbotId:i._id,seen:!1};a(f=>{const h=[...f,d];return l.current=h,h});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:o._id,conversationHistory:u,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 h=new xd;let p="",b=null,m=!1,y=!0;await h.parseStream(f,x=>{var w,k;switch(console.log("Streaming event:",x),x.type){case"token":m=!0;const _=((w=x.data)==null?void 0:w.data)||"";y?p=_:p+=_,a(R=>{const E=R.map(A=>A._id===d._id?{...A,data:{...A.data,...y&&{thinking:[...A.data.thinking,A.data.text??""]},text:p}}:A);return l.current=E,E}),y=!1;break;case"tool":y=!0;break;case"complete":const T=((k=x.data)==null?void 0:k.data)||"{}";try{const R=typeof T=="string"?JSON.parse(T):T;b=R.path||null,R.message&&!m&&(p=R.message)}catch{console.error("Failed to parse complete event data:",T)}break;case"done":if(a(R=>{const E=R.map(A=>A._id===d._id?{_id:`ai_${Date.now()}`,conversationId:o._id,owner:"ai",ownerId:null,data:{text:b?"":p,path:b},type:"AI Response",createdAt:new Date,updatedAt:new Date,chatbotId:i._id,seen:!0}:A);return l.current=E,E}),b){const R=i.chatflow.nodes.find(E=>E.type==="AIControlNode");R&&Bn({source:R.id,sourceHandle:b,conversationState:e,coreState:n,showToast:r,uiState:t})}break;case"error":console.error("Streaming error:",x.data),r("Failed to get AI response","error"),a(R=>R.filter(E=>E._id!==d._id));break}},x=>{console.error("Stream parsing error:",x),r("Failed to get AI response","error"),a(w=>w.filter(k=>k._id!==d._id))})}catch(f){if(console.error("Error in sendAIMessageStream:",f),f.message==="AI Message Limit Reached"){const h=i.chatflow.nodes.find(p=>p.type==="AIControlNode");h&&await Bn({source:h.id,sourceHandle:h.data.outOfCredits.id,conversationState:e,coreState:n,showToast:r,uiState:t})}else Pt(f,r,"Failed to get AI response");a(h=>h.filter(p=>p._id!==d._id))}finally{c(!1)}},Bn=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;if(!l||!u||!c)return!1;const f=l.chatflow.edges.find(p=>p.source===e&&p.sourceHandle===t);if(!f)return!1;const h=l.chatflow.nodes.find(p=>p.id===f.target);if(!h)return!1;try{if(a)await ln({coreState:s,conversationState:r,uiState:o,showToast:i,updatedConversation:a});else{const p=await Dt.userUpdateCurrentNode({params:{id:u._id},body:{currentNode:h.id}},c);if(!p.data)throw new Error("Node update failed");d(!1);const b=r.conversations.map(m=>m._id===u._id?p.data:m);r.setConversations(b),await ln({coreState:s,conversationState:r,uiState:o,showToast:i,updatedConversation:p.data})}return!0}catch(p){return Pt(p,i,"Failed to change node"),!1}},ln=async({coreState:n,conversationState:e,uiState:t,showToast:r,updatedConversation:s=null})=>{var b,m,y,x,w,k,_,T,R,E,A,F,P,Y,se;const{chatbot:i,isDefaultExternalAPI:o,defaultExternalAPI:a}=n,{setCanMessage:l,setHumanControl:c,setHoveringMessageInner:u,setRatingFromUser:d}=t;if(o){await qo({externalAPI:a,currentChatflow:{key:"externalAPI",index:0},currentNode:{},coreState:n,conversationState:e,uiState:t,showToast:r});return}const f=s||e.currentConversation;if(!i||!f)return;l(!1),c(!1),u(null);const h=i.chatflow.nodes.find(ee=>ee.id===f.currentNode);if(!h){r("Invalid conversation node","error");return}await Dd(h,f,n,e,t,r),!await Pd(h,f,n,e,t,r)&&(((m=(b=h.data)==null?void 0:b.hoveringMessageInner)==null?void 0:m.length)>0&&((y=f.currentChatflow)==null?void 0:y.key)!=="hoveringMessage"&&((x=f.currentChatflow)==null?void 0:x.key)!=="end"&&u({data:h.data.hoveringMessageInner,onClick:async ee=>{if(u(null),ee.type==="path")await Bn({source:h.id,sourceHandle:ee.id,conversationState:e,coreState:n,showToast:r,uiState:t});else{l(!1);const Te=await as({data:{text:ee.query},currentChatflow:{key:"hoveringMessage",index:0},coreState:n,conversationState:e,uiState:t,showToast:r,type:"Human Text",owner:"user"});!t.humanControl&&!f.assignedTo&&await Bo(n,e,t,r,(Te==null?void 0:Te.messages)||[]),l(!0)}}}),h.type==="EndConversation"?(l(!1),c(!1),(k=(w=h.data)==null?void 0:w.askForReview)!=null&&k.value&&((_=f.currentChatflow)==null?void 0:_.key)!=="end"&&d({onSubmit:async ee=>{await Ad(ee,n,e,t,r),await Vt({data:{text:"Thanks for your feedback"},coreState:n,conversationState:e,uiState:t,showToast:r,currentChatflow:{key:"end",index:0},type:"AI Text"}),d(null)}})):((R=(T=h.data)==null?void 0:T.control)==null?void 0:R.type)==="ai"?(c(!1),l(!0)):(await Ed(n,e,t,r,(A=(E=h.data)==null?void 0:E.control)==null?void 0:A.assignType,((P=(F=h.data)==null?void 0:F.control)==null?void 0:P.user)||((se=(Y=h.data)==null?void 0:Y.control)==null?void 0:se.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 Dd(n,e,t,r,s,i){const o=n.data;if(o!=null&&o.text)for(const[a,l]of o.text.entries())(!e.currentChatflow||e.currentChatflow.key==="text"&&typeof e.currentChatflow.index<"u"&&a>e.currentChatflow.index)&&await Vt({data:{text:l.value},currentChatflow:{key:"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((!e.currentChatflow||e.currentChatflow.key==="text"||e.currentChatflow.key==="externalAPI"&&typeof e.currentChatflow.index<"u"&&a>e.currentChatflow.index)&&await qo({externalAPI:l.externalAPI,currentChatflow:{key:"externalAPI",index:a},currentNode:n,coreState:t,conversationState:r,uiState:s,showToast:i}))return!0}return!1}function Pt(n,e,t){e(t,"error"),console.error(t,n)}async function ls(n){var b;const{conversationState:e,coreState:t,uiState:r,userMessage:s,setUserMessage:i,file:o,setFile:a,latestCurrentConversation:l,showToast:c}=n;if(!(s!=null&&s.trim()))return;const u=s.trim();i(""),r.setCanMessage(!1),r.setUserLoading(!0);const d=o;a(null);let f={text:u};if(d)try{const m=await _d.userUploadAsset(d,t.token);if(!m.data)throw new Error("File upload failed");f.file={name:d.name,url:m.data.url}}catch(m){Pt(m,c,"Failed to upload file"),r.setUserLoading(!1),r.setCanMessage(!0);return}const h=((b=l==null?void 0:l.currentChatflow)==null?void 0:b.key)!=="end"?{key:"end",index:0}:null;h&&r.setHoveringMessageInner(null);const p=await as({data:f,currentChatflow:h,coreState:t,conversationState:e,uiState:r,showToast:c,type:"Human Text",owner:"user"});!r.humanControl&&!(l!=null&&l.assignedTo)&&await Bo(t,e,r,c,(p==null?void 0:p.messages)||[]),r.setCanMessage(!0)}function cs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ot=cs();function Ho(n){Ot=n}var cn={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(Ee.caret,"$1"),t=t.replace(s,o),r},getRegex:()=>new RegExp(t,e)};return r}var Od=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ee={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|$))+/,Id=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Nd=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,un=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Md=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,us=/(?:[*+-]|\d{1,9}[.)])/,Wo=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Vo=J(Wo).replace(/bull/g,us).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(Wo).replace(/bull/g,us).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(),ds=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ld=/^[^\n]+/,hs=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,jd=J(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",hs).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ud=J(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,us).getRegex(),Hn="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",fs=/<!--(?:-?>|[\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",fs).replace("tag",Hn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Yo=J(ds).replace("hr",un).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",Hn).getRegex(),qd=J(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Yo).getRegex(),ps={blockquote:qd,code:Id,def:jd,fences:Nd,heading:Md,hr:un,html:zd,lheading:Vo,list:Ud,newline:$d,paragraph:Yo,table:cn,text:Ld},Xo=J("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",un).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",Hn).getRegex(),Bd={...ps,lheading:Fd,table:Xo,paragraph:J(ds).replace("hr",un).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Xo).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",Hn).getRegex()},Hd={...ps,html:J(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",fs).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:cn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:J(ds).replace("hr",un).replace("heading",` *#{1,6} *[^
18
- ]`).replace("lheading",Vo).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Wd=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Vd=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Jo=/^( {2,}|\\)\n(?!\s*$)/,Yd=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Wn=/[\p{P}\p{S}]/u,gs=/[\s\p{P}\p{S}]/u,Zo=/[^\s\p{P}\p{S}]/u,Xd=J(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,gs).getRegex(),Go=/(?!~)[\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-",Od?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ko=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Kd=J(Ko,"u").replace(/punct/g,Wn).getRegex(),Qd=J(Ko,"u").replace(/punct/g,Go).getRegex(),Qo="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",eh=J(Qo,"gu").replace(/notPunctSpace/g,Zo).replace(/punctSpace/g,gs).replace(/punct/g,Wn).getRegex(),th=J(Qo,"gu").replace(/notPunctSpace/g,Zd).replace(/punctSpace/g,Jd).replace(/punct/g,Go).getRegex(),nh=J("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Zo).replace(/punctSpace/g,gs).replace(/punct/g,Wn).getRegex(),rh=J(/\\(punct)/,"gu").replace(/punct/g,Wn).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(fs).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(),Vn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,ah=J(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Vn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ea=J(/^!?\[(label)\]\[(ref)\]/).replace("label",Vn).replace("ref",hs).getRegex(),ta=J(/^!?\[(ref)\](?:\[\])?/).replace("ref",hs).getRegex(),lh=J("reflink|nolink(?!\\()","g").replace("reflink",ea).replace("nolink",ta).getRegex(),na=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ms={_backpedal:cn,anyPunctuation:rh,autolink:sh,blockSkip:Gd,br:Jo,code:Vd,del:cn,emStrongLDelim:Kd,emStrongRDelimAst:eh,emStrongRDelimUnd:nh,escape:Wd,link:ah,nolink:ta,punctuation:Xd,reflink:ea,reflinkSearch:lh,tag:oh,text:Yd,url:cn},ch={...ms,link:J(/^!?\[(label)\]\((.*?)\)/).replace("label",Vn).getRegex(),reflink:J(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Vn).getRegex()},bs={...ms,emStrongRDelimAst:th,emStrongLDelim:Qd,url:J(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",na).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",na).getRegex()},uh={...bs,br:J(Jo).replace("{2,}","*").getRegex(),text:J(bs.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Yn={normal:ps,gfm:Bd,pedantic:Hd},dn={normal:ms,gfm:bs,breaks:uh,pedantic:ch},dh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ra=n=>dh[n];function dt(n,e){if(e){if(Ee.escapeTest.test(n))return n.replace(Ee.escapeReplace,ra)}else if(Ee.escapeTestNoEncode.test(n))return n.replace(Ee.escapeReplaceNoEncode,ra);return n}function sa(n){try{n=encodeURI(n).replace(Ee.percentDecode,"%")}catch{return null}return n}function ia(n,e){var i;let t=n.replace(Ee.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),r=t.split(Ee.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(Ee.slashPipe,"|");return r}function hn(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 oa(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(`
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(`
19
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(`
20
- `)}var Xn=class{constructor(n){ne(this,"options");ne(this,"rules");ne(this,"lexer");this.options=n||Ot}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:hn(t,`
21
- `)}}}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=hn(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:hn(e[0],`
22
- `)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=hn(e[0],`
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],`
23
35
  `).split(`
24
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(`
25
37
  `),u=c.replace(this.rules.other.blockquoteSetextReplace,`
26
38
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
27
39
  ${c}`:c,s=s?`${s}
28
- ${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=d,t.length===0)break;let f=i.at(-1);if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){let h=f,p=h.raw+`
40
+ ${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=d,t.length===0)break;let g=i.at(-1);if((g==null?void 0:g.type)==="code")break;if((g==null?void 0:g.type)==="blockquote"){let h=g,f=h.raw+`
29
41
  `+t.join(`
30
- `),b=this.blockquote(p);i[i.length-1]=b,r=r.substring(0,r.length-h.raw.length)+b.raw,s=s.substring(0,s.length-h.text.length)+b.text;break}else if((f==null?void 0:f.type)==="list"){let h=f,p=h.raw+`
42
+ `),m=this.blockquote(f);i[i.length-1]=m,r=r.substring(0,r.length-h.raw.length)+m.raw,s=s.substring(0,s.length-h.text.length)+m.text;break}else if((g==null?void 0:g.type)==="list"){let h=g,f=h.raw+`
31
43
  `+t.join(`
32
- `),b=this.list(p);i[i.length-1]=b,r=r.substring(0,r.length-f.raw.length)+b.raw,s=s.substring(0,s.length-h.raw.length)+b.raw,t=p.substring(i.at(-1).raw.length).split(`
33
- `);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(n){var t,r;let e=this.rules.block.list.exec(n);if(e){let s=e[1].trim(),i=s.length>1,o={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");let a=this.rules.other.listItemRegex(s),l=!1;for(;n;){let u=!1,d="",f="";if(!(e=a.exec(n))||this.rules.block.hr.test(n))break;d=e[0],n=n.substring(d.length);let h=e[2].split(`
34
- `,1)[0].replace(this.rules.other.listReplaceTabs,y=>" ".repeat(3*y.length)),p=n.split(`
35
- `,1)[0],b=!h.trim(),m=0;if(this.options.pedantic?(m=2,f=h.trimStart()):b?m=e[1].length+1:(m=e[2].search(this.rules.other.nonSpaceChar),m=m>4?1:m,f=h.slice(m),m+=e[1].length),b&&this.rules.other.blankLine.test(p)&&(d+=p+`
36
- `,n=n.substring(p.length+1),u=!0),!u){let y=this.rules.other.nextBulletRegex(m),x=this.rules.other.hrRegex(m),w=this.rules.other.fencesBeginRegex(m),k=this.rules.other.headingBeginRegex(m),_=this.rules.other.htmlBeginRegex(m);for(;n;){let T=n.split(`
37
- `,1)[0],R;if(p=T,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),R=p):R=p.replace(this.rules.other.tabCharGlobal," "),w.test(p)||k.test(p)||_.test(p)||y.test(p)||x.test(p))break;if(R.search(this.rules.other.nonSpaceChar)>=m||!p.trim())f+=`
38
- `+R.slice(m);else{if(b||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(h)||k.test(h)||x.test(h))break;f+=`
39
- `+p}!b&&!p.trim()&&(b=!0),d+=T+`
40
- `,n=n.substring(T.length+1),h=R.slice(m)}}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(f),loose:!1,text:f,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 f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}}let d=this.rules.other.listTaskCheckbox.exec(u.raw);if(d){let f={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};u.checked=f.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=f.raw+u.tokens[0].raw,u.tokens[0].text=f.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(f)):u.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):u.tokens.unshift(f)}}if(!o.loose){let d=u.tokens.filter(h=>h.type==="space"),f=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));o.loose=f}}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=ia(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(`
41
- `):[],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(ia(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)===`
42
- `?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=hn(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)),oa(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 oa(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 f=d.slice(2,-2);return{type:"strong",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}}}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 Ws{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||Ot,this.options.tokenizer=this.options.tokenizer||new Xn,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:Ee,block:Yn.normal,inline:dn.normal};this.options.pedantic?(t.block=Yn.pedantic,t.inline=dn.pedantic):this.options.gfm&&(t.block=Yn.gfm,this.options.breaks?t.inline=dn.breaks:t.inline=dn.gfm),this.tokenizer.rules=t}static get rules(){return{block:Yn,inline:dn}}static lex(e,t){return new Ws(t).lex(e)}static lexInline(e,t){return new Ws(t).inlineTokens(e)}lex(e){e=e.replace(Ee.carriageReturn,`
43
- `),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(Ee.tabCharGlobal," ").replace(Ee.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+=`
44
+ `),m=this.list(f);i[i.length-1]=m,r=r.substring(0,r.length-g.raw.length)+m.raw,s=s.substring(0,s.length-h.raw.length)+m.raw,t=f.substring(i.at(-1).raw.length).split(`
45
+ `);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(n){var t,r;let e=this.rules.block.list.exec(n);if(e){let s=e[1].trim(),i=s.length>1,o={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");let a=this.rules.other.listItemRegex(s),l=!1;for(;n;){let u=!1,d="",g="";if(!(e=a.exec(n))||this.rules.block.hr.test(n))break;d=e[0],n=n.substring(d.length);let h=e[2].split(`
46
+ `,1)[0].replace(this.rules.other.listReplaceTabs,v=>" ".repeat(3*v.length)),f=n.split(`
47
+ `,1)[0],m=!h.trim(),b=0;if(this.options.pedantic?(b=2,g=h.trimStart()):m?b=e[1].length+1:(b=e[2].search(this.rules.other.nonSpaceChar),b=b>4?1:b,g=h.slice(b),b+=e[1].length),m&&this.rules.other.blankLine.test(f)&&(d+=f+`
48
+ `,n=n.substring(f.length+1),u=!0),!u){let v=this.rules.other.nextBulletRegex(b),x=this.rules.other.hrRegex(b),w=this.rules.other.fencesBeginRegex(b),k=this.rules.other.headingBeginRegex(b),_=this.rules.other.htmlBeginRegex(b);for(;n;){let S=n.split(`
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
+ `+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
+ `+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+=`
44
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(`
45
57
  `)?"":`
46
58
  `)+a.raw,c.text+=`
47
59
  `+a.text,this.inlineQueue.at(-1).src=c.text):t.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.def(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(`
48
60
  `)?"":`
49
61
  `)+a.raw,c.text+=`
50
- `+a.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},t.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if((o=this.options.extensions)!=null&&o.startBlock){let c=1/0,u=e.slice(1),d;this.options.extensions.startBlock.forEach(f=>{d=f.call({lexer:this},u),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(this.state.top&&(a=this.tokenizer.paragraph(l))){let c=t.at(-1);r&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=(c.raw.endsWith(`
62
+ `+a.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},t.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if((o=this.options.extensions)!=null&&o.startBlock){let c=1/0,u=e.slice(1),d;this.options.extensions.startBlock.forEach(g=>{d=g.call({lexer:this},u),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(this.state.top&&(a=this.tokenizer.paragraph(l))){let c=t.at(-1);r&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=(c.raw.endsWith(`
51
63
  `)?"":`
52
64
  `)+a.raw,c.text+=`
53
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(`
54
66
  `)?"":`
55
67
  `)+a.raw,c.text+=`
56
- `+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,f;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(b=>(h=b.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 b=t.at(-1);h.type==="text"&&(b==null?void 0:b.type)==="text"?(b.raw+=h.raw,b.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 p=e;if((f=this.options.extensions)!=null&&f.startInline){let b=1/0,m=e.slice(1),y;this.options.extensions.startInline.forEach(x=>{y=x.call({lexer:this},m),typeof y=="number"&&y>=0&&(b=Math.min(b,y))}),b<1/0&&b>=0&&(p=e.substring(0,b+1))}if(h=this.tokenizer.inlineText(p)){e=e.substring(h.raw.length),h.raw.slice(-1)!=="_"&&(a=h.raw.slice(-1)),o=!0;let b=t.at(-1);(b==null?void 0:b.type)==="text"?(b.raw+=h.raw,b.text+=h.text):t.push(h);continue}if(e){let b="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(b);break}else throw new Error(b)}}return t}},Jn=class{constructor(e){ne(this,"options");ne(this,"parser");this.options=e||Ot}space(e){return""}code({text:e,lang:t,escaped:r}){var o;let s=(o=(t||"").match(Ee.notSpaceStart))==null?void 0:o[0],i=e.replace(Ee.endingNewline,"")+`
57
- `;return s?'<pre><code class="language-'+dt(s)+'">'+(r?i:dt(i,!0))+`</code></pre>
58
- `:"<pre><code>"+(r?i:dt(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}},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>
59
71
  `}blockquote({tokens:e}){return`<blockquote>
60
72
  ${this.parser.parse(e)}</blockquote>
61
73
  `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
@@ -71,35 +83,35 @@ ${this.parser.parse(e)}</blockquote>
71
83
  `}tablerow({text:e}){return`<tr>
72
84
  ${e}</tr>
73
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}>
74
- `}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>${dt(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=sa(e);if(i===null)return s;e=i;let o='<a href="'+e+'"';return t&&(o+=' title="'+dt(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=sa(e);if(i===null)return dt(r);e=i;let o=`<img src="${e}" alt="${r}"`;return t&&(o+=` title="${dt(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:dt(e.text)}},_s=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 Vs{constructor(e){ne(this,"options");ne(this,"renderer");ne(this,"textRenderer");this.options=e||Ot,this.options.renderer=this.options.renderer||new Jn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _s}static parse(e,t){return new Vs(t).parse(e)}static parseInline(e,t){return new Vs(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}},fn=(dr=class{constructor(n){ne(this,"options");ne(this,"block");this.options=n||Ot}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(dr,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ne(dr,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),dr),ph=class{constructor(...e){ne(this,"defaults",cs());ne(this,"options",this.setOptions);ne(this,"parse",this.parseMarkdown(!0));ne(this,"parseInline",this.parseMarkdown(!1));ne(this,"Parser",Xe);ne(this,"Renderer",Jn);ne(this,"TextRenderer",_s);ne(this,"Lexer",Ye);ne(this,"Tokenizer",Xn);ne(this,"Hooks",fn);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 Jn(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 Xn(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 fn;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];fn.passThroughHooks.has(o)?i[a]=u=>{if(this.defaults.async&&fn.passThroughHooksRespectAsync.has(o))return(async()=>{let f=await l.call(i,u);return c.call(i,f)})();let d=l.call(i,u);return c.call(i,d)}:i[a]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await l.apply(i,u);return f===!1&&(f=await c.apply(i,u)),f})();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+=`
75
- Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+dt(r.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}},$t=new ph;function G(n,e){return $t.parse(n,e)}G.options=G.setOptions=function(n){return $t.setOptions(n),G.defaults=$t.defaults,Ho(G.defaults),G},G.getDefaults=cs,G.defaults=Ot,G.use=function(...n){return $t.use(...n),G.defaults=$t.defaults,Ho(G.defaults),G},G.walkTokens=function(n,e){return $t.walkTokens(n,e)},G.parseInline=$t.parseInline,G.Parser=Xe,G.parser=Xe.parse,G.Renderer=Jn,G.TextRenderer=_s,G.Lexer=Ye,G.lexer=Ye.lex,G.Tokenizer=Xn,G.Hooks=fn,G.parse=G,G.options,G.setOptions,G.use,G.walkTokens,G.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 g("div",{className:"conversationMainItemContainer",children:[c.map((u,d)=>g(bh,{chatbot:n,data:u,handleChangeConversation:o},d)),r>e.length&&g("button",{className:"newConversationBtn",onClick:i,children:s?g("div",{className:"newConversationLoading",children:g(an,{className:"base-text-color"})}):"Load More Conversations"})]})},mh=(n="")=>n.split(`
76
- `)[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?g("img",{src:oe(a.user.profilePicture,70),alt:"User"},oe(a.user.profilePicture,70)):g(Wt,{className:"input-background-color"})}return g("img",{src:oe(n.appearance.images.popupChat,70),alt:"Bot"},oe(n.appearance.images.popupChat,70))},o=mh(s==null?void 0:s.data.text);return g("div",{className:"conversationMainItem",onClick:()=>t(r),children:[g("div",{children:g(i,{})}),g("div",{className:"textHolder",children:[g("p",{children:o||"Send a message"}),g("p",{children:is((s==null?void 0:s.createdAt)||(r==null?void 0:r.createdAt))})]}),g("div",{children:[g(Fo,{className:"base-color"}),s.owner==="agent"&&!s.seen&&g("div",{className:"unreadMessage"})]})]})},vs=({chatbot:n,className:e=""})=>g("div",{className:`agents ${e}`,children:n.teamMembers.members.filter(t=>t.joined).slice(0,3).map((t,r)=>g("div",{children:t.user.profilePicture?g("img",{src:oe(t.user.profilePicture,70),alt:"Agent"},oe(t.user.profilePicture,70)):g(Wt,{className:"input-text-color"})},r))}),_h=({chatbot:n,humanControl:e,latestCurrentConversation:t})=>{var o;const r=(o=n.teamMembers.members.find(a=>a.user._id===(t==null?void 0:t.assignedTo)))==null?void 0:o.user,s=()=>t!=null&&t.assignedTo?r!=null&&r.profilePicture?g("div",{className:"headerImageWrapper",children:g("img",{src:oe(r.profilePicture,70),width:"100%",alt:"Profile",style:{borderRadius:"50%"}},oe(r.profilePicture,70))}):g("div",{className:"headerImageWrapper",children:g(Wt,{className:"background-text-color"})}):g(vs,{chatbot:n}),i=()=>g("div",{className:"headerImageWrapper",children:g("img",{src:oe(n.appearance.images.popupChat,70),width:"100%",alt:"Chat"},oe(n.appearance.images.popupChat,70))});return g(Ce,{children:e||t!=null&&t.assignType||t!=null&&t.assignedTo?s():i()})},vh=({email:n,chatbot:e,dataFromUser:t})=>{const[r,s]=N(()=>{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 g("div",{children:[g("h3",{children:o.name}),g("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 g("div",{children:[g("h4",{children:o.name}),g("select",{required:o.required,name:o.name,onChange:l=>s({...r,[o.key]:l.target.value}),children:[g("option",{value:"",children:"Select"}),o.data.map(l=>g("option",{value:l.value,children:l.label},l.value))]})]},`${a}-${o.key}`);case"date":return g("div",{children:[g("h4",{children:o.name}),g("input",{required:o.required,type:"date",onChange:l=>s({...r,[o.key]:l.target.value})})]},`${a}-${o.key}`);case"time":return g("div",{children:[g("h4",{children:o.name}),g("input",{required:o.required,type:"time",onChange:l=>s({...r,[o.key]:l.target.value})})]},`${a}-${o.key}`);case"textarea":return g("div",{children:[g("h4",{children:o.name}),g("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 g("div",{children:[g("h4",{children:o.name}),g("input",{required:o.required,placeholder:o.data.placeholder,type:"email",value:r[o.key]||"",onInput:l=>s({...r,[o.key]:l.currentTarget.value})}),g("span",{className:"hint",children:o.error})]},`${a}-${o.key}`);default:return null}};return g("div",{className:"mainMessageContainer",children:[g("div",{className:"logoWithMessageDiv",children:g("img",{src:oe(e.appearance.images.chat,70),alt:"Bot"},oe(e.appearance.images.chat,70))}),g("div",{className:"messageDiv",children:g("form",{className:"messageP",onSubmit:o=>{o.preventDefault(),t.onSubmit(r)},children:[t.data.map((o,a)=>i(o,a)),g("div",{className:"livelinkSubmitDiv",children:g("button",{type:"submit",children:"Submit"})})]})})]})},yh=({chatbot:n,ratingFromUser:e})=>{const[t,r]=N({comment:"",rating:4});return g("div",{className:"mainMessageContainer",children:[g("div",{className:"logoWithMessageDiv",children:g("img",{src:oe(n.appearance.images.chat,70),alt:"Bot"},oe(n.appearance.images.chat,70))}),g("div",{className:"messageDiv",children:g("form",{onSubmit:s=>{s.preventDefault(),t.rating!==0&&e.onSubmit(t)},children:[g("h3",{style:{fontWeight:"400"},children:"Please Leave a review"}),g("div",{children:[g("h4",{children:"Comment"}),g("textarea",{required:!0,minLength:3,maxLength:500,rows:4,onChange:s=>r({...t,comment:s.target.value})})]}),g("div",{style:{display:"flex"},children:[1,2,3,4,5].map(s=>g("div",{style:{cursor:"pointer"},onClick:()=>r({...t,rating:s}),children:g(ad,{className:t.rating>=s?n.appearance.color.base:"input-text-color"})},s))}),g("div",{className:"livelinkSubmitDiv",children:g("button",{type:"submit",children:"Submit"})})]})})]})},xh=({chatbot:n,onlineAgents:e,currentConversation:t})=>{var s,i,o,a;const r=n.chatflow.nodes.find(l=>l.id===t.currentNode);return g("div",{className:"onlineAgents",children:[g("div",{children:g("span",{children:(i=(s=r==null?void 0:r.data)==null?void 0:s.expectedTime)!=null&&i.value?(o=r.data)==null?void 0:o.expectedTime.text:"Connecting to an Agent"})}),((a=r==null?void 0:r.data.expectedTime)==null?void 0:a.showOnlineAgents)&&e>0&&g("div",{children:[g(vs,{chatbot:n}),g("p",{children:["Online Agents: ",g("b",{children:e})]})]})]})},wh=({chatbot:n})=>g("div",{className:"mainMessageContainer mySelfTextDiv",children:g("div",{className:"messageDiv mySelfTextDiv",children:g("div",{className:"otherUserTextLoading",children:[g("div",{className:"loading1"}),g("div",{className:"loading2"}),g("div",{className:"loading3"})]})})}),kh=({chatbot:n})=>g("div",{className:"mainMessageContainer",children:[g("div",{className:"logoWithMessageDiv",children:g("img",{src:oe(n.appearance.images.chat,70),alt:"Bot"},oe(n.appearance.images.chat,70))}),g("div",{className:"messageDiv",children:g("div",{className:"otherUserTextLoading",children:[g("div",{className:"loading1"}),g("div",{className:"loading2"}),g("div",{className:"loading3"})]})})]}),Sh=({chatbot:n,message:e,AIControlNode:t})=>{var f,h;const r=e.owner==="agent",s=r?n.teamMembers.members.find(p=>p.user._id===e.ownerId):null,o=(((f=e.data.sources)==null?void 0:f.filter((p,b,m)=>m.indexOf(p)===b))||[]).filter(p=>p.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]=N("");return _e(()=>{const p=G.parse(e.data.text||"");typeof p=="string"?d(p):p.then(d)},[e.data.text]),g("div",{className:`mainMessageContainer ${e.owner==="user"?"mySelfTextDiv":""}`,children:[e.owner!=="user"&&(r?g("div",{className:"logoWithMessageDiv",children:s!=null&&s.user.profilePicture?g("img",{src:oe(s.user.profilePicture,70),alt:"Agent"},oe(s.user.profilePicture,70)):g(Wt,{className:"input-background-color"})}):g("div",{className:"logoWithMessageDiv",children:g("img",{src:oe(n.appearance.images.popupChat,70),alt:"Bot"},oe(n.appearance.images.popupChat,70))})),g("div",{className:`messageDiv ${e.owner==="user"?"mySelfTextDiv":""}`,children:[g("div",{className:"NameAndDate",children:e.owner!=="user"?g(Ce,{children:[(s==null?void 0:s.user.name)||"AI"," -"," ",is(e.createdAt)]}):is(e.createdAt)}),l&&e.data.file&&g("a",{target:"_blank",rel:"noopener noreferrer",href:e.data.file.url,style:{borderRadius:"5px"},children:g("img",{src:e.data.file.url,style:{height:"80px"},alt:"Image"},e.data.file.url)}),c&&e.data.file&&g("a",{target:"_blank",rel:"noopener noreferrer",href:e.data.file.url,style:{borderRadius:"5px"},children:g("video",{src:e.data.file.url,style:{height:"80px"},controls:!0,children:"Video"})}),u&&g("div",{className:"messageP markdownText",dangerouslySetInnerHTML:{__html:u}}),g("div",{className:"sources",children:[e.data.file&&!l&&!c&&g("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((p,b)=>g("a",{target:"_blank",href:p,children:p},`${p}-${b}`))]})]})]})},Th=({chatbot:n})=>g("div",{className:"messagesLoading",children:g("div",{children:g(an,{className:"base-color"})})}),Ch=({hoveringMessageInner:n,chatbot:e})=>g("div",{className:"hoveringMessageInner",children:n.data.map((t,r)=>g("div",{onClick:()=>n.onClick(t),children:t.message},r))}),Eh=({file:n,setFile:e,chatbot:t})=>g("div",{className:"hoveringMessageInner",children:g("div",{onClick:()=>e(null),children:[g(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 E;const[c,u]=N(!1),{token:d}=s,{newMessage:f,setNewMessage:h,setCurrentConversation:p,conversations:b,setConversations:m}=i,{callChatFlowRef:y,chatOpen:x}=o,w=(a==null?void 0:a.data.popupMessage.value)&&f,k=()=>{h(null),r(!1)},_=(f==null?void 0:f.owner)==="agent"?(E=t.teamMembers.members.find(A=>A.user._id===f.ownerId))==null?void 0:E.user:null,T=()=>{r(!1),h(null);const A=b.find(F=>(f==null?void 0:f.conversationId)===F._id);A&&(y.current=!0,p(A),l(!0))},R=_!=null&&_.profilePicture?g("div",{className:"headerImageWrapper",children:g("img",{src:oe(_.profilePicture,70),width:"100%",alt:"Profile",style:{borderRadius:"50%"}},oe(_.profilePicture,70))}):g("div",{className:"headerImageWrapper",children:g(Wt,{className:"background-text-color"})});return!(n&&(e==null?void 0:e.length)>0||w)||x?null:g("div",{className:"chatHoveringMessages",children:[g("div",{onClick:k,className:"chatHoveringMessage closeMessages",children:c?g("div",{className:"loadingIcon",children:g("div",{style:{width:"16px",height:"16px"},children:g(an,{className:"background-text-color"})})}):g(Lo,{className:"background-text-color",width:"16px",height:"16px"})}),w&&g("div",{className:"chatHoveringMessage",onClick:T,children:[g("div",{className:"chatHoveringMessageUser",children:[R,f.owner==="agent"?_==null?void 0:_.name:"AI"]}),g("div",{style:{maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis"},children:f.data.text})]}),!w&&n&&(e==null?void 0:e.map((A,F)=>g(Rh,{hoveringMessage:A,chatbot:t,loading:c,setLoading:u,coreState:s,conversationState:i,uiState:o,setShowHoveringMessage:r,token:d,node:a,setChatOpen:l,conversations:b,setConversations:m,setCurrentConversation:p,callChatFlowRef:y},F)))]})},Rh=({hoveringMessage:n,chatbot:e,loading:t,setLoading:r,setShowHoveringMessage:s,token:i,node:o,setChatOpen:a,setConversations:l,conversations:c,setCurrentConversation:u,callChatFlowRef:d,coreState:f,conversationState:h,uiState:p})=>{var y;const b=async()=>{if(t)return;r(!0);let x={};if(n.type==="query")x.chatflow={key:"end",index:0};else{const w=e.chatflow.edges.find(k=>k.sourceHandle===n.id);if(!w){r(!1);return}x.nodeId=w.target}try{const w=await Dt.userCreate({body:x},i);if(!w.data)throw new Error("Conversation creation failed");const k=w.data;if(l([...c,k]),n.type==="query"){const _=e.chatflow.nodes.find(T=>T.id===k.currentNode);_&&(p.humanControl=_.data.control.type==="human"),await ls({coreState:f,conversationState:h,uiState:p,userMessage:n.query,setUserMessage:()=>{},file:null,setFile:()=>{},showToast:()=>{},latestCurrentConversation:k}),u(k)}else d.current=!0,u(k);s(!1),a(!0)}catch(w){console.error("Chat hovering message error:",w)}finally{r(!1)}},m=n.showUser?(y=e.teamMembers.members.find(x=>{var w;return x.user._id===((w=n==null?void 0:n.user)==null?void 0:w._id)}))==null?void 0:y.user:null;return g("div",{className:"chatHoveringMessage",onClick:b,children:[n.showUser&&m&&g("div",{className:"chatHoveringMessageUser",children:[g("div",{children:m.profilePicture?g("img",{src:oe(m.profilePicture,70),crossOrigin:"anonymous"},oe(m.profilePicture,70)):g(Wt,{className:"input-background-color"})}),n.title]}),g("div",{children:n.message})]})};var Zn={exports:{}},aa={};function la(n,e){for(var t in e)n[t]=e[t];return n}function ys(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 xs(n,e){var t=e(),r=N({t:{__:t,u:e}}),s=r[0].t,i=r[1];return Lt(function(){s.__=t,s.u=e,ws(s)&&i({t:s})},[n,t,e]),_e(function(){return ws(s)&&i({t:s}),n(function(){ws(s)&&i({t:s})})},[n]),t}function ws(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 ks(n){n()}function Ss(n){return n}function Ts(){return[!1,ks]}var Cs=Lt;function Gn(n,e){this.props=n,this.context=e}function ca(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:ys(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}(Gn.prototype=new He).isPureReactComponent=!0,Gn.prototype.shouldComponentUpdate=function(n,e){return ys(this.props,n)||ys(this.state,e)};var ua=I.__b;I.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),ua&&ua(n)};var Dh=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function da(n){function e(t){var r=la({},t);return delete r.ref,n(r,t.ref||null)}return e.$$typeof=Dh,e.render=n,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(n.displayName||n.name)+")",e}var ha=function(n,e){return n==null?null:at(at(n).map(e))},fa={map:ha,forEach:ha,count:function(n){return n?at(n).length:0},only:function(n){var e=at(n);if(e.length!==1)throw"Children.only";return e[0]},toArray:at},Ph=I.__e;I.__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 pa=I.unmount;function ga(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=la({},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 ga(r,e,t)})),n}function ma(n,e,t){return n&&t&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(r){return ma(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 pn(){this.__u=0,this.o=null,this.__b=null}function ba(n){var e=n.__.__c;return e&&e.__a&&e.__a(n)}function _a(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 Yt(){this.i=null,this.l=null}I.unmount=function(n){var e=n.__c;e&&e.__R&&e.__R(),e&&32&n.__u&&(n.type=null),pa&&pa(n)},(pn.prototype=new He).__c=function(n,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var s=ba(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]=ma(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)},pn.prototype.componentWillUnmount=function(){this.o=[]},pn.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]=ga(this.__b,t,r.__O=r.__P)}this.__b=null}var s=e.__a&&Qe(Ce,null,n.fallback);return s&&(s.__u&=-33),[Qe(Ce,null,e.__a?null:n.children),s]};var va=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 Oh(n){return this.getChildContext=function(){return n.context},n.children}function $h(n){var e=this,t=n.h;if(e.componentWillUnmount=function(){wt(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)}}}wt(Qe(Oh,{context:e.context},n.__v),e.v)}function ya(n,e){var t=Qe($h,{__v:n,h:e});return t.containerInfo=e,t}(Yt.prototype=new He).__a=function(n){var e=this,t=ba(e.__v),r=e.l.get(n);return r[0]++,function(s){var i=function(){e.props.revealOrder?(r.push(s),va(e,n,r)):s()};t?t(i):i()}},Yt.prototype.render=function(n){this.i=null,this.l=new Map;var e=at(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},Yt.prototype.componentDidUpdate=Yt.prototype.componentDidMount=function(){var n=this;this.l.forEach(function(e,t){va(n,t,e)})};var xa=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Ih=/^(?: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 wa(n,e,t){return e.__k==null&&(e.textContent=""),wt(n,e),typeof t=="function"&&t(),n?n.__c:null}function ka(n,e,t){return ci(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=I.event;function jh(){}function Uh(){return this.cancelBubble}function zh(){return this.defaultPrevented}I.event=function(n){return Sa&&(n=Sa(n)),n.persist=jh,n.isPropagationStopped=Uh,n.isDefaultPrevented=zh,n.nativeEvent=n};var Es,qh={enumerable:!1,configurable:!0,get:function(){return this.class}},Ta=I.vnode;I.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&&Ih.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=at(t.children).forEach(function(c){c.props.selected=s.value.indexOf(c.props.value)!=-1})),r=="select"&&s.defaultValue!=null&&(s.value=at(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=xa,Ta&&Ta(n)};var Ca=I.__r;I.__r=function(n){Ca&&Ca(n),Es=n.__c};var Ea=I.diffed;I.diffed=function(n){Ea&&Ea(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),Es=null};var Aa={ReactCurrentDispatcher:{current:{readContext:function(n){return Es.__n[n.__c].props.value},useCallback:jt,useContext:Dr,useDebugValue:Pr,useDeferredValue:Ss,useEffect:_e,useId:Or,useImperativeHandle:Rr,useInsertionEffect:Cs,useLayoutEffect:Lt,useMemo:pt,useReducer:xn,useRef:et,useState:N,useSyncExternalStore:xs,useTransition:Ts}}},Bh="18.3.1";function Ra(n){return Qe.bind(null,n)}function gn(n){return!!n&&n.$$typeof===xa}function Da(n){return gn(n)&&n.type===Ce}function Pa(n){return!!n&&!!n.displayName&&(typeof n.displayName=="string"||n.displayName instanceof String)&&n.displayName.startsWith("Memo(")}function Oa(n){return gn(n)?Il.apply(null,arguments):n}function $a(n){return!!n.__k&&(wt(null,n),!0)}function Ia(n){return n&&(n.base||n.nodeType===1&&n)||null}var Na=function(n,e){return n(e)},Ma=function(n,e){return n(e)},Fa=Ce,La=gn,Hh={useState:N,useId:Or,useReducer:xn,useEffect:_e,useLayoutEffect:Lt,useInsertionEffect:Cs,useTransition:Ts,useDeferredValue:Ss,useSyncExternalStore:xs,startTransition:ks,useRef:et,useImperativeHandle:Rr,useMemo:pt,useCallback:jt,useContext:Dr,useDebugValue:Pr,version:"18.3.1",Children:fa,render:wa,hydrate:ka,unmountComponentAtNode:$a,createPortal:ya,createElement:Qe,createContext:ui,createFactory:Ra,cloneElement:Oa,createRef:ei,Fragment:Ce,isValidElement:gn,isElement:La,isFragment:Da,isMemo:Pa,findDOMNode:Ia,Component:He,PureComponent:Gn,memo:ca,forwardRef:da,flushSync:Ma,unstable_batchedUpdates:Na,StrictMode:Fa,Suspense:pn,SuspenseList:Yt,lazy:_a,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Aa};const Kn=du(Object.freeze(Object.defineProperty({__proto__:null,Children:fa,Component:He,Fragment:Ce,PureComponent:Gn,StrictMode:Fa,Suspense:pn,SuspenseList:Yt,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Aa,cloneElement:Oa,createContext:ui,createElement:Qe,createFactory:Ra,createPortal:ya,createRef:ei,default:Hh,findDOMNode:Ia,flushSync:Ma,forwardRef:da,hydrate:ka,isElement:La,isFragment:Da,isMemo:Pa,isValidElement:gn,lazy:_a,memo:ca,render:wa,startTransition:ks,unmountComponentAtNode:$a,unstable_batchedUpdates:Na,useCallback:jt,useContext:Dr,useDebugValue:Pr,useDeferredValue:Ss,useEffect:_e,useErrorBoundary:Ml,useId:Or,useImperativeHandle:Rr,useInsertionEffect:Cs,useLayoutEffect:Lt,useMemo:pt,useReducer:xn,useRef:et,useState:N,useSyncExternalStore:xs,useTransition:Ts,version:Bh},Symbol.toStringTag,{value:"Module"})));var As={exports:{}},Qn={exports:{}},K={};/** @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>${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,70),alt:"User"},ie(a.user.profilePicture,70)):p(Zt,{className:"input-background-color"})}return p("img",{src:ie(n.appearance.images.popupChat,70),alt:"Bot"},ie(n.appearance.images.popupChat,70))},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,70),alt:"Agent"},ie(t.user.profilePicture,70)):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,70),width:"100%",alt:"Profile",style:{borderRadius:"50%"}},ie(t.profilePicture,70))}):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,70),width:"100%",alt:"Chat"},ie(n.appearance.images.popupChat,70))});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,70),alt:"Bot"},ie(e.appearance.images.chat,70))}),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,70),alt:"Bot"},ie(n.appearance.images.chat,70))}),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,70),alt:"Bot"},ie(n.appearance.images.chat,70))}),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,70),alt:"Agent"},ie(s.user.profilePicture,70)):p(Zt,{className:"input-background-color"})}):p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(n.appearance.images.popupChat,70),alt:"Bot"},ie(n.appearance.images.popupChat,70))})),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,70),width:"100%",alt:"Profile",style:{borderRadius:"50%"}},ie(A.profilePicture,70))}):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,70)},ie(m.profilePicture,70)):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
77
89
  * react-is.production.min.js
78
90
  *
79
91
  * Copyright (c) Facebook, Inc. and its affiliates.
80
92
  *
81
93
  * This source code is licensed under the MIT license found in the
82
94
  * LICENSE file in the root directory of this source tree.
83
- */var ja;function Wh(){if(ja)return K;ja=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,f=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,p=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,m=n?Symbol.for("react.fundamental"):60117,y=n?Symbol.for("react.responder"):60118,x=n?Symbol.for("react.scope"):60119;function w(_){if(typeof _=="object"&&_!==null){var T=_.$$typeof;switch(T){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 p:case h:case o:return _;default:return T}}case t:return T}}}function k(_){return w(_)===c}return K.AsyncMode=l,K.ConcurrentMode=c,K.ContextConsumer=a,K.ContextProvider=o,K.Element=e,K.ForwardRef=u,K.Fragment=r,K.Lazy=p,K.Memo=h,K.Portal=t,K.Profiler=i,K.StrictMode=s,K.Suspense=d,K.isAsyncMode=function(_){return k(_)||w(_)===l},K.isConcurrentMode=k,K.isContextConsumer=function(_){return w(_)===a},K.isContextProvider=function(_){return w(_)===o},K.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===e},K.isForwardRef=function(_){return w(_)===u},K.isFragment=function(_){return w(_)===r},K.isLazy=function(_){return w(_)===p},K.isMemo=function(_){return w(_)===h},K.isPortal=function(_){return w(_)===t},K.isProfiler=function(_){return w(_)===i},K.isStrictMode=function(_){return w(_)===s},K.isSuspense=function(_){return w(_)===d},K.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===r||_===c||_===i||_===s||_===d||_===f||typeof _=="object"&&_!==null&&(_.$$typeof===p||_.$$typeof===h||_.$$typeof===o||_.$$typeof===a||_.$$typeof===u||_.$$typeof===m||_.$$typeof===y||_.$$typeof===x||_.$$typeof===b)},K.typeOf=w,K}var Q={};/** @license React v16.13.1
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
84
96
  * react-is.development.js
85
97
  *
86
98
  * Copyright (c) Facebook, Inc. and its affiliates.
87
99
  *
88
100
  * This source code is licensed under the MIT license found in the
89
101
  * LICENSE file in the root directory of this source tree.
90
- */var Ua;function Vh(){return Ua||(Ua=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,f=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,p=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,m=n?Symbol.for("react.fundamental"):60117,y=n?Symbol.for("react.responder"):60118,x=n?Symbol.for("react.scope"):60119;function w(S){return typeof S=="string"||typeof S=="function"||S===r||S===c||S===i||S===s||S===d||S===f||typeof S=="object"&&S!==null&&(S.$$typeof===p||S.$$typeof===h||S.$$typeof===o||S.$$typeof===a||S.$$typeof===u||S.$$typeof===m||S.$$typeof===y||S.$$typeof===x||S.$$typeof===b)}function k(S){if(typeof S=="object"&&S!==null){var pe=S.$$typeof;switch(pe){case e:var ft=S.type;switch(ft){case l:case c:case r:case i:case s:case d:return ft;default:var Zt=ft&&ft.$$typeof;switch(Zt){case a:case u:case p:case h:case o:return Zt;default:return pe}}case t:return pe}}}var _=l,T=c,R=a,E=o,A=e,F=u,P=r,Y=p,se=h,ee=t,Te=i,Z=s,ve=d,fe=!1;function ze(S){return fe||(fe=!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(S)||k(S)===l}function C(S){return k(S)===c}function D(S){return k(S)===a}function $(S){return k(S)===o}function M(S){return typeof S=="object"&&S!==null&&S.$$typeof===e}function O(S){return k(S)===u}function z(S){return k(S)===r}function j(S){return k(S)===p}function U(S){return k(S)===h}function B(S){return k(S)===t}function X(S){return k(S)===i}function H(S){return k(S)===s}function ye(S){return k(S)===d}Q.AsyncMode=_,Q.ConcurrentMode=T,Q.ContextConsumer=R,Q.ContextProvider=E,Q.Element=A,Q.ForwardRef=F,Q.Fragment=P,Q.Lazy=Y,Q.Memo=se,Q.Portal=ee,Q.Profiler=Te,Q.StrictMode=Z,Q.Suspense=ve,Q.isAsyncMode=ze,Q.isConcurrentMode=C,Q.isContextConsumer=D,Q.isContextProvider=$,Q.isElement=M,Q.isForwardRef=O,Q.isFragment=z,Q.isLazy=j,Q.isMemo=U,Q.isPortal=B,Q.isProfiler=X,Q.isStrictMode=H,Q.isSuspense=ye,Q.isValidElementType=w,Q.typeOf=k}()),Q}var za;function qa(){return za||(za=1,be.env.NODE_ENV==="production"?Qn.exports=Wh():Qn.exports=Vh()),Qn.exports}/*
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}/*
91
103
  object-assign
92
104
  (c) Sindre Sorhus
93
105
  @license MIT
94
- */var Rs,Ba;function Yh(){if(Ba)return Rs;Ba=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 Rs=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 f=0;f<c.length;f++)t.call(a,c[f])&&(l[c[f]]=a[c[f]])}}return l},Rs}var Ds,Ha;function Ps(){if(Ha)return Ds;Ha=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ds=n,Ds}var Os,Wa;function Va(){return Wa||(Wa=1,Os=Function.call.bind(Object.prototype.hasOwnProperty)),Os}var $s,Ya;function Xh(){if(Ya)return $s;Ya=1;var n=function(){};if(be.env.NODE_ENV!=="production"){var e=Ps(),t={},r=Va();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 f=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 f.name="Invariant Violation",f}d=i[u](o,u,l,a,null,e)}catch(p){d=p}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={})},$s=s,$s}var Is,Xa;function Jh(){if(Xa)return Is;Xa=1;var n=qa(),e=Yh(),t=Ps(),r=Va(),s=Xh(),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 Is=function(a,l){var c=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function d(C){var D=C&&(c&&C[c]||C[u]);if(typeof D=="function")return D}var f="<<anonymous>>",h={array:y("array"),bigint:y("bigint"),bool:y("boolean"),func:y("function"),number:y("number"),object:y("object"),string:y("string"),symbol:y("symbol"),any:x(),arrayOf:w,element:k(),elementType:_(),instanceOf:T,node:F(),objectOf:E,oneOf:R,oneOfType:A,shape:Y,exact:se};function p(C,D){return C===D?C!==0||1/C===1/D:C!==C&&D!==D}function b(C,D){this.message=C,this.data=D&&typeof D=="object"?D:{},this.stack=""}b.prototype=Error.prototype;function m(C){if(be.env.NODE_ENV!=="production")var D={},$=0;function M(z,j,U,B,X,H,ye){if(B=B||f,H=H||U,ye!==t){if(l){var S=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 S.name="Invariant Violation",S}else if(be.env.NODE_ENV!=="production"&&typeof console<"u"){var pe=B+":"+U;!D[pe]&&$<3&&(i("You are manually calling a React.PropTypes validation function for the `"+H+"` prop on `"+B+"`. 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."),D[pe]=!0,$++)}}return j[U]==null?z?j[U]===null?new b("The "+X+" `"+H+"` is marked as required "+("in `"+B+"`, but its value is `null`.")):new b("The "+X+" `"+H+"` is marked as required in "+("`"+B+"`, but its value is `undefined`.")):null:C(j,U,B,X,H)}var O=M.bind(null,!1);return O.isRequired=M.bind(null,!0),O}function y(C){function D($,M,O,z,j,U){var B=$[M],X=Z(B);if(X!==C){var H=ve(B);return new b("Invalid "+z+" `"+j+"` of type "+("`"+H+"` supplied to `"+O+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return m(D)}function x(){return m(o)}function w(C){function D($,M,O,z,j){if(typeof C!="function")return new b("Property `"+j+"` of component `"+O+"` has invalid PropType notation inside arrayOf.");var U=$[M];if(!Array.isArray(U)){var B=Z(U);return new b("Invalid "+z+" `"+j+"` of type "+("`"+B+"` supplied to `"+O+"`, expected an array."))}for(var X=0;X<U.length;X++){var H=C(U,X,O,z,j+"["+X+"]",t);if(H instanceof Error)return H}return null}return m(D)}function k(){function C(D,$,M,O,z){var j=D[$];if(!a(j)){var U=Z(j);return new b("Invalid "+O+" `"+z+"` of type "+("`"+U+"` supplied to `"+M+"`, expected a single ReactElement."))}return null}return m(C)}function _(){function C(D,$,M,O,z){var j=D[$];if(!n.isValidElementType(j)){var U=Z(j);return new b("Invalid "+O+" `"+z+"` of type "+("`"+U+"` supplied to `"+M+"`, expected a single ReactElement type."))}return null}return m(C)}function T(C){function D($,M,O,z,j){if(!($[M]instanceof C)){var U=C.name||f,B=ze($[M]);return new b("Invalid "+z+" `"+j+"` of type "+("`"+B+"` supplied to `"+O+"`, expected ")+("instance of `"+U+"`."))}return null}return m(D)}function R(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 D($,M,O,z,j){for(var U=$[M],B=0;B<C.length;B++)if(p(U,C[B]))return null;var X=JSON.stringify(C,function(ye,S){var pe=ve(S);return pe==="symbol"?String(S):S});return new b("Invalid "+z+" `"+j+"` of value `"+String(U)+"` "+("supplied to `"+O+"`, expected one of "+X+"."))}return m(D)}function E(C){function D($,M,O,z,j){if(typeof C!="function")return new b("Property `"+j+"` of component `"+O+"` has invalid PropType notation inside objectOf.");var U=$[M],B=Z(U);if(B!=="object")return new b("Invalid "+z+" `"+j+"` of type "+("`"+B+"` supplied to `"+O+"`, expected an object."));for(var X in U)if(r(U,X)){var H=C(U,X,O,z,j+"."+X,t);if(H instanceof Error)return H}return null}return m(D)}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 D=0;D<C.length;D++){var $=C[D];if(typeof $!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+fe($)+" at index "+D+"."),o}function M(O,z,j,U,B){for(var X=[],H=0;H<C.length;H++){var ye=C[H],S=ye(O,z,j,U,B,t);if(S==null)return null;S.data&&r(S.data,"expectedType")&&X.push(S.data.expectedType)}var pe=X.length>0?", expected one of type ["+X.join(", ")+"]":"";return new b("Invalid "+U+" `"+B+"` supplied to "+("`"+j+"`"+pe+"."))}return m(M)}function F(){function C(D,$,M,O,z){return ee(D[$])?null:new b("Invalid "+O+" `"+z+"` supplied to "+("`"+M+"`, expected a ReactNode."))}return m(C)}function P(C,D,$,M,O){return new b((C||"React class")+": "+D+" type `"+$+"."+M+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+O+"`.")}function Y(C){function D($,M,O,z,j){var U=$[M],B=Z(U);if(B!=="object")return new b("Invalid "+z+" `"+j+"` of type `"+B+"` "+("supplied to `"+O+"`, expected `object`."));for(var X in C){var H=C[X];if(typeof H!="function")return P(O,z,j,X,ve(H));var ye=H(U,X,O,z,j+"."+X,t);if(ye)return ye}return null}return m(D)}function se(C){function D($,M,O,z,j){var U=$[M],B=Z(U);if(B!=="object")return new b("Invalid "+z+" `"+j+"` of type `"+B+"` "+("supplied to `"+O+"`, expected `object`."));var X=e({},$[M],C);for(var H in X){var ye=C[H];if(r(C,H)&&typeof ye!="function")return P(O,z,j,H,ve(ye));if(!ye)return new b("Invalid "+z+" `"+j+"` key `"+H+"` supplied to `"+O+"`.\nBad object: "+JSON.stringify($[M],null," ")+`
95
- Valid keys: `+JSON.stringify(Object.keys(C),null," "));var S=ye(U,H,O,z,j+"."+H,t);if(S)return S}return null}return m(D)}function ee(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(ee);if(C===null||a(C))return!0;var D=d(C);if(D){var $=D.call(C),M;if(D!==C.entries){for(;!(M=$.next()).done;)if(!ee(M.value))return!1}else for(;!(M=$.next()).done;){var O=M.value;if(O&&!ee(O[1]))return!1}}else return!1;return!0;default:return!1}}function Te(C,D){return C==="symbol"?!0:D?D["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&D instanceof Symbol:!1}function Z(C){var D=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":Te(D,C)?"symbol":D}function ve(C){if(typeof C>"u"||C===null)return""+C;var D=Z(C);if(D==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return D}function fe(C){var D=ve(C);switch(D){case"array":case"object":return"an "+D;case"boolean":case"date":case"regexp":return"a "+D;default:return D}}function ze(C){return!C.constructor||!C.constructor.name?f:C.constructor.name}return h.checkPropTypes=s,h.resetWarningCache=s.resetWarningCache,h.PropTypes=h,h},Is}var Ns,Ja;function Zh(){if(Ja)return Ns;Ja=1;var n=Ps();function e(){}function t(){}return t.resetWarningCache=e,Ns=function(){function r(o,a,l,c,u,d){if(d!==n){var f=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 f.name="Invariant Violation",f}}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},Ns}if(be.env.NODE_ENV!=="production"){var Gh=qa(),Kh=!0;As.exports=Jh()(Gh.isElement,Kh)}else As.exports=Zh()();var Za=As.exports,Ms={exports:{}};function Ga(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=Ga(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function Ka(){for(var n,e,t=0,r="",s=arguments.length;t<s;t++)(n=arguments[t])&&(e=Ga(n))&&(r&&(r+=" "),r+=e);return r}Ms.exports=Ka,Ms.exports.clsx=Ka;var Qh=Ms.exports,de={},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 It={};Object.defineProperty(It,"__esModule",{value:!0}),It.browserPrefixToKey=el,It.browserPrefixToStyle=of,It.default=void 0,It.getPrefix=Qa;const Fs=["Moz","Webkit","O","ms"];function Qa(){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<Fs.length;s++)if(el(n,Fs[s])in e)return Fs[s];return""}function el(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}It.default=Qa(),Object.defineProperty(de,"__esModule",{value:!0}),de.addClassName=il,de.addEvent=cf,de.addUserSelectStyles=yf,de.createCSSTransform=mf,de.createSVGTransform=bf,de.getTouch=_f,de.getTouchIdentifier=vf,de.getTranslation=Ls,de.innerHeight=ff,de.innerWidth=pf,de.matchesSelector=rl,de.matchesSelectorAndParentsTo=lf,de.offsetXYFromParent=gf,de.outerHeight=df,de.outerWidth=hf,de.removeClassName=ol,de.removeEvent=uf,de.scheduleRemoveUserSelectStyles=xf;var je=st,tl=nl(It);function nl(n,e){if(typeof WeakMap=="function")var t=new WeakMap,r=new WeakMap;return(nl=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 er="";function rl(n,e){return er||(er=(0,je.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(t){return(0,je.isFunction)(n[t])})),(0,je.isFunction)(n[er])?n[er](e):!1}function lf(n,e,t){let r=n;do{if(rl(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,je.int)(t.borderTopWidth),e+=(0,je.int)(t.borderBottomWidth),e}function hf(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 ff(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 pf(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 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=Ls(n,e,"px");return{[(0,tl.browserPrefixToKey)("transform",tl.default)]:t}}function bf(n,e){return Ls(n,e,"")}function Ls(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,je.findInArray)(n.targetTouches,t=>e===t.identifier)||n.changedTouches&&(0,je.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;}
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;}
96
108
  `,e.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
97
- `,n.getElementsByTagName("head")[0].appendChild(e)),n.body&&il(n.body,"react-draggable-transparent-selection")}function xf(n){window.requestAnimationFrame?window.requestAnimationFrame(()=>{sl(n)}):sl(n)}function sl(n){if(n)try{if(n.body&&ol(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 il(n,e){n.classList?n.classList.add(e):n.className.match(new RegExp(`(?:^|\\s)${e}(?!\\S)`))||(n.className+=` ${e}`)}function ol(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=Sf,it.canDragY=Tf,it.createCoreData=Ef,it.createDraggableData=Af,it.getBoundPosition=wf,it.getControlPosition=Cf,it.snapToGrid=kf;var Ue=st,Xt=de;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=js(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,Xt.innerWidth)(l)-(0,Xt.outerWidth)(s)-s.offsetLeft+(0,Ue.int)(u.paddingRight)-(0,Ue.int)(c.marginRight),bottom:(0,Xt.innerHeight)(l)-(0,Xt.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 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 Sf(n){return n.props.axis==="both"||n.props.axis==="x"}function Tf(n){return n.props.axis==="both"||n.props.axis==="y"}function Cf(n,e,t){const r=typeof e=="number"?(0,Xt.getTouch)(n,e):null;if(typeof e=="number"&&!r)return null;const s=js(t),i=t.props.offsetParent||s.offsetParent||s.ownerDocument.body;return(0,Xt.offsetXYFromParent)(r||n,i,t.props.scale)}function Ef(n,e,t){const r=!(0,Ue.isNum)(n.lastX),s=js(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 js(n){const e=n.findDOMNode();if(!e)throw new Error("<DraggableCore>: Unmounted during event!");return e}var tr={},nr={};Object.defineProperty(nr,"__esModule",{value:!0}),nr.default=Df;function Df(){}Object.defineProperty(tr,"__esModule",{value:!0}),tr.default=void 0;var Us=al(Kn),Ae=qs(Za),Pf=qs(Kn),ke=de,mt=it,zs=st,mn=qs(nr);function qs(n){return n&&n.__esModule?n:{default:n}}function al(n,e){if(typeof WeakMap=="function")var t=new WeakMap,r=new WeakMap;return(al=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 Re(n,e,t){return(e=Of(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Of(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 Je={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let bt=Je.mouse,rr=class extends Us.Component{constructor(){super(...arguments),Re(this,"dragging",!1),Re(this,"lastX",NaN),Re(this,"lastY",NaN),Re(this,"touchIdentifier",null),Re(this,"mounted",!1),Re(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,ke.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,ke.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;e.type==="touchstart"&&!this.props.allowMobileScroll&&e.preventDefault();const s=(0,ke.getTouchIdentifier)(e);this.touchIdentifier=s;const i=(0,mt.getControlPosition)(e,s,this);if(i==null)return;const{x:o,y:a}=i,l=(0,mt.createCoreData)(this,o,a);(0,mn.default)("DraggableCore: handleDragStart: %j",l),(0,mn.default)("calling",this.props.onStart),!(this.props.onStart(e,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,ke.addUserSelectStyles)(r),this.dragging=!0,this.lastX=o,this.lastY=a,(0,ke.addEvent)(r,bt.move,this.handleDrag),(0,ke.addEvent)(r,bt.stop,this.handleDragStop))}),Re(this,"handleDrag",e=>{const t=(0,mt.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,mt.snapToGrid)(this.props.grid,a,l),!a&&!l)return;r=this.lastX+a,s=this.lastY+l}const i=(0,mt.createCoreData)(this,r,s);if((0,mn.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}),Re(this,"handleDragStop",e=>{if(!this.dragging)return;const t=(0,mt.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,mt.snapToGrid)(this.props.grid,l,c),r=this.lastX+l,s=this.lastY+c}const i=(0,mt.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,ke.scheduleRemoveUserSelectStyles)(a.ownerDocument),(0,mn.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&((0,mn.default)("DraggableCore: Removing handlers"),(0,ke.removeEvent)(a.ownerDocument,bt.move,this.handleDrag),(0,ke.removeEvent)(a.ownerDocument,bt.stop,this.handleDragStop))}),Re(this,"onMouseDown",e=>(bt=Je.mouse,this.handleDragStart(e))),Re(this,"onMouseUp",e=>(bt=Je.mouse,this.handleDragStop(e))),Re(this,"onTouchStart",e=>(bt=Je.touch,this.handleDragStart(e))),Re(this,"onTouchEnd",e=>(bt=Je.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,ke.addEvent)(e,Je.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;(0,ke.removeEvent)(t,Je.mouse.move,this.handleDrag),(0,ke.removeEvent)(t,Je.touch.move,this.handleDrag),(0,ke.removeEvent)(t,Je.mouse.stop,this.handleDragStop),(0,ke.removeEvent)(t,Je.touch.stop,this.handleDragStop),(0,ke.removeEvent)(e,Je.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,ke.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 Us.cloneElement(Us.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};tr.default=rr,Re(rr,"displayName","DraggableCore"),Re(rr,"propTypes",{allowAnyClick:Ae.default.bool,allowMobileScroll:Ae.default.bool,children:Ae.default.node.isRequired,disabled:Ae.default.bool,enableUserSelectHack:Ae.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:Ae.default.arrayOf(Ae.default.number),handle:Ae.default.string,cancel:Ae.default.string,nodeRef:Ae.default.object,onStart:Ae.default.func,onDrag:Ae.default.func,onStop:Ae.default.func,onMouseDown:Ae.default.func,scale:Ae.default.number,className:zs.dontSetMe,style:zs.dontSetMe,transform:zs.dontSetMe}),Re(rr,"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(Kn),t=u(Za),r=u(Kn),s=Qh,i=de,o=it,a=st,l=u(tr),c=u(nr);function u(y){return y&&y.__esModule?y:{default:y}}function d(y,x){if(typeof WeakMap=="function")var w=new WeakMap,k=new WeakMap;return(d=function(_,T){if(!T&&_&&_.__esModule)return _;var R,E,A={__proto__:null,default:_};if(_===null||typeof _!="object"&&typeof _!="function")return A;if(R=T?k:w){if(R.has(_))return R.get(_);R.set(_,A)}for(const F in _)F!=="default"&&{}.hasOwnProperty.call(_,F)&&((E=(R=Object.defineProperty)&&Object.getOwnPropertyDescriptor(_,F))&&(E.get||E.set)?R(A,F,E):A[F]=_[F]);return A})(y,x)}function f(){return f=Object.assign?Object.assign.bind():function(y){for(var x=1;x<arguments.length;x++){var w=arguments[x];for(var k in w)({}).hasOwnProperty.call(w,k)&&(y[k]=w[k])}return y},f.apply(null,arguments)}function h(y,x,w){return(x=p(x))in y?Object.defineProperty(y,x,{value:w,enumerable:!0,configurable:!0,writable:!0}):y[x]=w,y}function p(y){var x=b(y,"string");return typeof x=="symbol"?x:x+""}function b(y,x){if(typeof y!="object"||!y)return y;var w=y[Symbol.toPrimitive];if(w!==void 0){var k=w.call(y,x);if(typeof k!="object")return k;throw new TypeError("@@toPrimitive must return a primitive value.")}return(x==="string"?String:Number)(y)}class m 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),T={x:_.x,y:_.y,slackX:0,slackY:0};if(this.props.bounds){const{x:E,y:A}=T;T.x+=this.state.slackX,T.y+=this.state.slackY;const[F,P]=(0,o.getBoundPosition)(this,T.x,T.y);T.x=F,T.y=P,T.slackX=this.state.slackX+(E-T.x),T.slackY=this.state.slackY+(A-T.y),_.x=T.x,_.y=T.y,_.deltaX=T.x-this.state.x,_.deltaY=T.y-this.state.y}if(this.props.onDrag(w,_)===!1)return!1;this.setState(T)}),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 T={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:E,y:A}=this.props.position;T.x=E,T.y=A}this.setState(T)}),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:T,defaultClassNameDragging:R,defaultClassNameDragged:E,position:A,positionOffset:F,scale:P,...Y}=this.props;let se={},ee=null;const Z=!!!A||this.state.dragging,ve=A||_,fe={x:(0,o.canDragX)(this)&&Z?this.state.x:ve.x,y:(0,o.canDragY)(this)&&Z?this.state.y:ve.y};this.state.isElementSVG?ee=(0,i.createSVGTransform)(fe,F):se=(0,i.createCSSTransform)(fe,F);const ze=(0,s.clsx)(k.props.className||"",T,{[R]:this.state.dragging,[E]:this.state.dragged});return e.createElement(l.default,f({},Y,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(k),{className:ze,style:{...k.props.style,...se},transform:ee}))}}n.default=m,h(m,"displayName","Draggable"),h(m,"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(m,"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})}(aa);const{default:ll,DraggableCore:If}=aa;Zn.exports=ll,Zn.exports.default=ll,Zn.exports.DraggableCore=If;var Nf=Zn.exports;const Mf=co(Nf),Ff=({chatbot:n,message:e})=>{const t=et(null),[r,s]=N(""),{thinking:i=[],text:o=""}=e.data;return _e(()=>{const a=G.parse(o||"");typeof a=="string"?s(a):a.then(s)},[o]),g("div",{className:"mainMessageContainer",children:[g("div",{className:"logoWithMessageDiv",children:g("img",{src:oe(n.appearance.images.popupChat,70),alt:"Bot"})}),g("div",{className:"messageDiv ",children:g("div",{className:"messageP markdownText ai-generating",children:[i.length>0&&g("div",{className:"thinkingContainer",ref:t,children:i.map((a,l)=>g("div",{className:"thinkingChunk",children:["• ",a]},l))}),r&&g("div",{dangerouslySetInnerHTML:{__html:r}})]})})]})},Lf=({message:n,type:e,onDismiss:t})=>{const[r,s]=N(!0);return _e(()=>{const i=setTimeout(()=>{s(!1),t()},4e3);return()=>clearTimeout(i)},[t]),r?g("div",{className:`robodialog-toast robodialog-toast-${e}`,children:[g("span",{className:"robodialog-toast-message",children:n}),g("button",{className:"robodialog-toast-close",onClick:()=>{s(!1),t()},children:"×"})]}):null},jf=()=>{const[n,e]=N([]),t=jt((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=jt(i=>{e(o=>o.filter(a=>a.id!==i))},[]);return{showToast:t,ToastContainer:()=>n.length===0?null:g(Ce,{children:n.map(i=>g(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 gr;const i=et(null),[o,a]=N(null),[l,c]=N(!1),[u,d]=N(!1),[f,h]=N("auto"),[p,b]=N(""),{chatbot:m,token:y,fileSizeLimit:x,userData:w,isChatbotDefault:k,isDefaultExternalAPI:_}=e,{messageCallOneTime:T,messages:R,currentConversation:E,conversations:A,messagesRef:F,setMessages:P}=t,{ratingFromUser:Y,canMessage:se,setCanMessage:ee,humanControl:Te,aiLoading:Z,hoveringMessageInner:ve,userLoading:fe,dataFromUser:ze,setHoveringMessageInner:C,onlineAgents:D,setOnlineAgents:$,callChatFlowRef:M,callChatFlow:O,setCallChatFlow:z,setHumanControl:j,setAiLoading:U,setUserLoading:B,setDataFromUser:X,setRatingFromUser:H}=r,ye=m.chatflow.nodes.find(q=>q.type==="AIControlNode"),S=A.find(q=>q._id===(E==null?void 0:E._id))||null,pe=(R&&E?R.filter(q=>q.conversationId===E._id):[]).sort((q,ue)=>new Date(ue.createdAt||"").getTime()-new Date(q.createdAt||"").getTime()),ft=q=>{var ot;const ue=q.target,Pe=(ot=ue.files)==null?void 0:ot[0];if(Pe&&!/^image\//.test(Pe.type)){a(null),s("Only image files are allowed","error");return}if(Pe){if(Pe.size>x*1024*1024){d(!0),setTimeout(()=>d(!1),3e3),ue.value="";return}a(Pe),ue.value=""}},Zt=jt(q=>{const ue=q.currentTarget;b(ue.value),requestAnimationFrame(()=>{ue.style.height="auto",ue.style.height=`${ue.scrollHeight}px`,h(`${ue.scrollHeight}px`)})},[b]),hr=q=>{q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),p.trim()&&ls({coreState:e,conversationState:t,uiState:r,userMessage:p,setUserMessage:b,file:o,setFile:a,showToast:s,latestCurrentConversation:S}))};async function fr(){var Pe,ot,Oe;if(!E||(Pe=T.current)!=null&&Pe.call)return;const q=((ot=T.current)==null?void 0:ot.messagesCount[E._id])||-1,ue=((Oe=T.current)==null?void 0:Oe.messagesLength[E._id])||0;if(!(q<=ue&&q!==-1))try{c(!0),T.current.call=!0;const ae=ue===1?0:ue,ie=await os.userReadAll({body:{conversationId:E._id,skip:ae}},y);if(!ie.data)throw new Error("Failed to load messages");P(Ze=>{const vt=new Set(Ze.map(_n=>_n._id)),yt=ie.data.messages.filter(_n=>!vt.has(_n._id)),mr=[...Ze,...yt];return F.current=mr,mr}),T.current.messagesCount[E._id]=ie.data.count}catch{s("Failed to load messages","error")}finally{T.current.call=!1,c(!1)}}function pr(){n(null),ee(!1),b(""),j(!1),U(!1),C(null),B(!1),X(null),$(0),H(null),a(null)}return _e(()=>{M.current&&E&&!k&&(ln({coreState:e,conversationState:t,uiState:r,showToast:s}),M.current=!1)},[E==null?void 0:E._id]),_e(()=>{if(!E||k)return;if(_){ln({coreState:e,conversationState:t,uiState:r,showToast:s});return}O&&(fr(),ln({coreState:e,conversationState:t,uiState:r,showToast:s}),z(!1));const q=i.current;if(!q||q.scrollEventAdded)return;let ue;const Pe=ot=>{const Oe=ot.target;Oe.scrollTop*-1+Oe.clientHeight===Oe.scrollHeight&&fr()};return ue=requestAnimationFrame(()=>{q.addEventListener("scroll",Pe),q.scrollEventAdded=!0}),()=>{cancelAnimationFrame(ue),q.removeEventListener("scroll",Pe)}},[O,E==null?void 0:E._id]),_e(()=>{if(!(pe!=null&&pe.length))return;T.current.messagesLength[(E==null?void 0:E._id)||""]=pe.length;const q=pe[0];q.owner==="agent"&&!q.seen&&Cd(q,e,t,r,s)},[pe.length]),E?g("div",{className:"conversationDetails",children:[g("div",{className:"conversationDetailsHeader",children:[g("div",{onClick:pr,style:{pointerEvents:Z||_?"none":"",opacity:Z||_?"0.5":"1"},children:g(Fo,{className:"background-text-color"})}),g("div",{style:{display:"flex",gap:"5px",alignItems:"center",color:m.appearance.color.backgroundText},children:[g(_h,{chatbot:m,humanControl:Te,latestCurrentConversation:S}),"Controlled By"," ",Te||S!=null&&S.assignType||S!=null&&S.assignedTo?"Human":"AI"]}),g("div",{style:{width:"21px"}})]}),g("div",{className:"livelinkMsgs",ref:i,children:[ze&&!(S!=null&&S.assignedTo)&&g(vh,{email:(w==null?void 0:w.email)||"",chatbot:m,dataFromUser:ze}),Y&&!(S!=null&&S.assignedTo)&&g(yh,{chatbot:m,ratingFromUser:Y}),(S==null?void 0:S.assignType)&&!(S!=null&&S.assignedTo)&&g(xh,{currentConversation:E,chatbot:m,onlineAgents:D}),pe.map((q,ue)=>q._id.startsWith("streaming_")?g(Ff,{chatbot:m,message:q},q._id):g(Sh,{AIControlNode:ye,chatbot:m,message:q},q._id||ue)),fe&&g(wh,{chatbot:m}),Z&&!((gr=pe[0])!=null&&gr._id.startsWith("streaming_"))&&g(kh,{chatbot:m}),l&&g(Th,{chatbot:m})]}),g("div",{children:[ve&&se&&!(S!=null&&S.assignedTo)&&!o&&g(Ch,{hoveringMessageInner:ve,chatbot:m}),o&&g(Eh,{file:o,setFile:a,chatbot:m}),g("div",{className:"massageInputDivMain",style:{opacity:se||S!=null&&S.assignedTo?"1":"0.7",pointerEvents:se||S!=null&&S.assignedTo?"all":"none"},children:g("form",{onSubmit:q=>{q.preventDefault(),p.trim()&&ls({coreState:e,conversationState:t,uiState:r,userMessage:p,setUserMessage:b,file:o,setFile:a,latestCurrentConversation:S,showToast:s})},children:[g("textarea",{style:{height:f},placeholder:u?"File Size Limit Reached":m.appearance.text.messagePlaceholder,maxLength:500,onChange:Zt,onKeyDown:hr,value:p,rows:1,disabled:u}),g("input",{type:"file",onChange:ft,style:{display:"none"},id:"fileUpload",accept:"image/*"}),(S==null?void 0:S.assignedTo)&&g("label",{className:"inputArrowMassageImg attachment",htmlFor:"fileUpload",children:g(ud,{className:"input-text-color"})}),g("button",{className:"inputArrowMassageImg",type:"submit",disabled:!p.trim(),children:g(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:f,setMessages:h}=t,{setCallChatFlow:p}=r,[b,m]=N(!1),[y,x]=N(!1),[w,k]=N(!1);return g("div",{className:"conversationMain",children:[g("button",{className:"newConversationBtn",onClick:async()=>{var R,E,A,F;if(!(y||b))try{x(!0);const P=await Dt.userCreate({body:{}},o);if(!P.data)throw new Error("Conversation creation failed");const Y=P.data;l(Y),a(se=>[...se,Y]),p(!0)}catch(P){((E=(R=P.response)==null?void 0:R.data)==null?void 0:E.error)==="Limit Reached"&&m(!0),s(((F=(A=P.response)==null?void 0:A.data)==null?void 0:F.message)||"Failed to create conversation","error")}finally{x(!1)}},children:y?g("div",{className:"newConversationLoading",children:g(an,{className:"base-text-color",width:13,height:13})}):b?"Limit Reached":"+ Conversation"}),g(gh,{conversations:c,chatbot:i,handleChangeConversation:n,messages:u,totalConversationsCount:d,conversationsLoading:w,loadMoreConversations:async()=>{if(!w)try{k(!0);const R=await Dt.userReadAll(o,{query:{skip:c.length.toString()}});if(!R.data)throw new Error("Failed to load conversations");h(E=>{const A=[...E,...R.data.messages];return t.messagesRef.current=A,A}),a(E=>[...E,...R.data.conversations]),f(R.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:f,messagesRef:h,setConversations:p,setTotalConversationsCount:b,setCurrentConversation:m}=t,[y,x]=N(!u),w=_=>{m(_),_!==null&&!u&&d(!0)},k=async()=>{try{x(!0);const _=await Dt.userReadAll(c);if(!_.data)throw new Error("Failed to load conversations");const T=_.data.messages||[];h.current=T,f(T),p(_.data.conversations||[]),b(_.data.count||0)}catch{o("Failed to initialize conversations","error")}finally{x(!1)}};return _e(()=>{u||k()},[c]),g("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:[g(a,{}),g("div",{className:"top-header",children:[g("h2",{children:l.appearance.text.heading}),g("h4",{children:l.appearance.text.description}),l.appearance.others.showAgents&&g(vs,{className:"mainAgents",chatbot:l})]}),g("div",{className:"liveLinkRightDiv",children:y?g("div",{className:"loadingDiv",children:g(an,{className:"background-text-color"})}):g(Ce,{children:[g(Uf,{handleChangeConversation:w,coreState:e,conversationState:t,uiState:r,showToast:o}),g(zf,{handleChangeConversation:w,coreState:e,conversationState:t,uiState:r,showToast:o})]})}),!l.appearance.others.removePoweredBy&&g("div",{className:"livelinkPoweredDiv2",children:[g("span",{children:"Powered By "}),g("img",{src:dd,alt:"Logo"}),g("a",{href:"https://robodialog.com",target:"_blank",children:"Robodialog"})]})]})},Bf=({coreState:n,conversationState:e,uiState:t,fullScreen:r})=>{const[s,i]=N(!1),[o,a]=N(!0),l=wi("robodialog-chatbot-opened"),[c,u]=N(null),{userData:d,chatbot:f}=n,{newMessage:h,setNewMessage:p}=e,{setInteracted:b,chatOpen:m,setChatOpen:y}=t,x=f.chatflow.nodes.find(A=>d!=null&&d.isUser?A.type==="StartNode"&&A.data.channel.users:A.type==="StartNode"&&A.data.channel.visitors),w=(x==null?void 0:x.data.hoveringMessage)||null,k=()=>{y(!m)};typeof window<"u"&&(window.robodialog={...window.robodialog||{},openChat:k});const _=f.appearance.others.position,T=_[s?"mobile":"desktop"].position==="bottomleft",R={alignItems:s?_.mobile.position==="bottomleft"?"flex-start":"flex-end":_.desktop.position==="bottomleft"?"flex-start":"flex-end",bottom:s?`${_.mobile.verticalSpace}px`:`${_.desktop.verticalSpace}px`,[T?"left":"right"]:s?`${_.mobile.horizontalSpace}px`:`${_.desktop.horizontalSpace}px`};_e(()=>{const A=()=>{i(window.innerWidth<_.mobileStartsFrom)};return A(),window.addEventListener("resize",A),()=>window.removeEventListener("resize",A)},[_.mobileStartsFrom]),_e(()=>{m&&(b(!0),a(!1),Nr("robodialog-chatbot-opened",!0))},[m]),_e(()=>{if(h&&(x!=null&&x.data.popupMessage.value)){const A=x.data.popupMessage.duration;c&&clearTimeout(c);const F=window.setTimeout(()=>{p(null)},A*1e3);u(F)}return()=>{c&&clearTimeout(c)}},[h]),_e(()=>{const A=x==null?void 0:x.data.automaticallyOpenConversation;!(A!=null&&A.value)||r||(A.type==="allTheTime"||A.type==="oncePerVisit"&&!l)&&(y(!0),a(!1),Nr("robodialog-chatbot-opened",!0))},[]),_e(()=>{r&&y(!0)},[r,y]);const E=g("div",{className:`chatbotMain ${r?"fullscreen":""}`,style:r?void 0:R,children:[g(qf,{chatOpen:m,coreState:n,conversationState:e,uiState:t,isMobileVersion:s,fullScreen:r}),!r&&g(Ce,{children:[g(Ah,{chatbot:f,showHoveringMessage:o,hoveringMessages:w,setShowHoveringMessage:a,coreState:n,conversationState:e,uiState:t,node:x,setChatOpen:y}),g("div",{className:"chatbotChat",style:{flexDirection:T?"row-reverse":"row"},children:[g("div",{className:"chatbotDrag handle",children:g(ld,{className:"background-text-color",width:10})}),g("div",{className:"chatbotChatInside",onClick:k,children:[g("img",{src:oe(f.appearance.images.chat,70),alt:"Chat",style:{display:m?"none":"block"}}),g(od,{className:"background-text-color",style:{display:m?"block":"none"}})]})]})]})]});return r?E:g(Mf,{axis:"both",handle:".handle",defaultPosition:{x:0,y:0},position:m?{x:0,y:0}:void 0,scale:1,bounds:".robodialog-chatbot-app",children:E})},cl=()=>typeof window<"u"&&window.console&&window.location.hostname!=="localhost"?console:{log:()=>{},error:()=>{}};function Se(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 Bs={exports:{}},Jt=typeof Reflect=="object"?Reflect:null,ul=Jt&&typeof Jt.apply=="function"?Jt.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},sr;Jt&&typeof Jt.ownKeys=="function"?sr=Jt.ownKeys:Object.getOwnPropertySymbols?sr=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:sr=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)}Bs.exports=te,Bs.exports.once=Jf,te.EventEmitter=te,te.prototype._events=void 0,te.prototype._eventsCount=0,te.prototype._maxListeners=void 0;var hl=10;function ir(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(ir(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 ir(t),this.on(e,gl(this,e,t)),this},te.prototype.prependOnceListener=function(e,t){return ir(t),this.prependListener(e,gl(this,e,t)),this},te.prototype.removeListener=function(e,t){var r,s,i,o,a;if(ir(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?sr(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=Bs.exports,yl=Hf(Gf),le;(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"})(le||(le={}));var _t;(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"})(_t||(_t={}));var bn;(function(n){n[n.disconnectCalled=0]="disconnectCalled",n[n.unauthorized=1]="unauthorized",n[n.badProtocol=2]="badProtocol",n[n.messageSizeLimit=3]="messageSizeLimit"})(bn||(bn={}));var or;(function(n){n[n.subscribeCalled=0]="subscribeCalled",n[n.transportClosed=1]="transportClosed"})(or||(or={}));var ar;(function(n){n[n.unsubscribeCalled=0]="unsubscribeCalled",n[n.unauthorized=1]="unauthorized",n[n.clientClosed=2]="clientClosed"})(ar||(ar={}));var Hs;(function(n){n[n.channelCompaction=1]="channelCompaction"})(Hs||(Hs={}));var me;(function(n){n.Disconnected="disconnected",n.Connecting="connecting",n.Connected="connected"})(me||(me={}));var De;(function(n){n.Unsubscribed="unsubscribed",n.Subscribing="subscribing",n.Subscribed="subscribed"})(De||(De={}));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 lr(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 cr(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=De.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===De.Unsubscribed?Promise.reject({code:le.subscriptionUnsubscribed,message:this.state}):this.state===De.Subscribed?Promise.resolve():new Promise((t,r)=>{const s={resolve:t,reject:r};e&&(s.timeout=setTimeout(function(){r({code:le.timeout,message:"timeout"})},e)),this._promises[this._nextPromiseId()]=s})}subscribe(){this._isSubscribed()||(this._resubscribeAttempts=0,this._setSubscribing(or.subscribeCalled,"subscribe called"))}unsubscribe(){this._unsubPromise=this._setUnsubscribed(ar.unsubscribeCalled,"unsubscribe called",!0)}publish(e){return Se(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.publish(this.channel,e)})}presence(){return Se(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.presence(this.channel)})}presenceStats(){return Se(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.presenceStats(this.channel)})}history(e){return Se(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:le.subscriptionUnsubscribed,message:this.state}):new Promise((e,t)=>{const r=this._centrifuge._config.timeout,s=setTimeout(()=>{t({code:le.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===De.Unsubscribed}_isSubscribing(){return this.state===De.Subscribing}_isSubscribed(){return this.state===De.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(De.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(),cr(e.ttl)))}_setSubscribing(e,t){return Se(this,void 0,void 0,function*(){this._isSubscribing()||(this._isSubscribed()&&this._clearSubscribedState(),this._setState(De.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 ht){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeData",channel:this.channel,error:{code:le.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 ht){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeToken",channel:this.channel,error:{code:le.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=Hs.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===le.timeout){this._centrifuge._disconnect(_t.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(De.Unsubscribed)&&this.emit("unsubscribed",{channel:this.channel,code:e,reason:t}),this._rejectPromises({code:le.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=lr(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:le.badConfiguration,message:"provide a function to get channel subscription token"}}),Promise.reject(new ht(""))):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 ht){e._failUnauthorized();return}e.emit("error",{type:"refreshToken",channel:e.channel,error:{code:le.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(),cr(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 lr(0,1e4,2e4)}_failUnauthorized(){this._setUnsubscribed(ar.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 f(){return u.read().then(({done:h,value:p})=>{if(h){s.dispatchEvent(new Event("close")),d.close();return}try{if(e._protocol==="json")for(a+=e._utf8decoder.decode(p);l<a.length;)if(a[l]===`
98
- `){const b=a.substring(0,l);s.dispatchEvent(new MessageEvent("message",{data:b})),a=a.substring(l+1),l=0}else++l;else{const b=new Uint8Array(c.length+p.length);for(b.set(c),b.set(p,c.length),c=b;;){const m=e.options.decoder.decodeReply(c);if(m.ok){const y=c.slice(0,m.pos);s.dispatchEvent(new MessageEvent("message",{data:y})),c=c.slice(m.pos);continue}break}}}catch(b){s.dispatchEvent(new Event("error",{detail:b})),s.dispatchEvent(new Event("close")),d.close();return}f()}).catch(function(h){s.dispatchEvent(new Event("error",{detail:h})),s.dispatchEvent(new Event("close")),d.close()})}return f()}})}).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 Se(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 Se(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]===`
99
- `){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 Se(this,void 0,void 0,function*(){try{this._writer&&(yield this._writer.close()),this._transport.close()}catch{}})}send(e){return Se(this,void 0,void 0,function*(){let t;this._protocol==="json"?t=new TextEncoder().encode(e+`
100
- `):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()!==`
101
- `)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(`
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,70),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,70),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(`
102
114
  `)}decodeReplies(e){return e.trim().split(`
103
- `).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 ht extends Error{constructor(e){super(e),this.name=this.constructor.name}}class ur extends yl{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 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!==De.Unsubscribed&&e.unsubscribe(),this._removeSubscription(e))}subscriptions(){return this._subs}ready(e){return Se(this,void 0,void 0,function*(){switch(this.state){case me.Disconnected:throw{code:le.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:le.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(bn.disconnectCalled,"disconnect called",!1)}setToken(e){this._token=e}setData(e){this._data=e}setHeaders(e){this._config.headers=e}send(e){return Se(this,void 0,void 0,function*(){const t={send:{data:e}};if(yield this._methodCall(),!this._transportSendCommands([t]))throw this._createErrorObject(le.transportWriteError,"transport write error")})}rpc(e,t){return Se(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 Se(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 Se(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 Se(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 Se(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===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(_t.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=lr(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(le.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===De.Subscribed&&t._setSubscribing(or.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(le.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 p=this._transports[this._currentTransportIndex],b=p.transport,m=p.endpoint;if(b==="websocket"){if(this._debug("trying websocket transport"),this._transport=new wl(m,{websocket:e}),!this._transport.supported()){this._debug("websocket transport not available"),this._currentTransportIndex++,h++;continue}}else if(b==="webtransport"){if(this._debug("trying webtransport transport"),this._transport=new op(m,{webtransport:globalThis.WebTransport,decoder:this._codec,encoder:this._codec}),!this._transport.supported()){this._debug("webtransport transport not available"),this._currentTransportIndex++,h++;continue}}else if(b==="http_stream"){if(this._debug("trying http_stream transport"),this._transport=new sp(m,{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(b==="sse"){if(this._debug("trying sse transport"),this._transport=new ip(m,{eventsource:r,fetch:s,emulationEndpoint:this._config.emulationEndpoint}),!this._transport.supported()){this._debug("sse transport not available"),this._currentTransportIndex++,h++;continue}}else if(b==="sockjs"){if(this._debug("trying sockjs"),this._transport=new rp(m,{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 "+b);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 f;f=setTimeout(function(){a.close()},this._config.timeout),this._transport.initialize(this._codecName(),{onOpen:function(){if(f&&(clearTimeout(f),f=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(f&&(clearTimeout(f),f=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 p="connection closed",b=!0,m=0;if(h&&"code"in h&&h.code&&(m=h.code),h&&h.reason)try{const y=JSON.parse(h.reason);p=y.reason,b=y.reconnect}catch{p=h.reason,(m>=3500&&m<4e3||m>=4500&&m<5e3)&&(b=!1)}m<3e3?(m===1009?(m=bn.messageSizeLimit,p="message size limit exceeded",b=!1):(m=_t.transportClosed,p="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:le.transportClosed,message:"transport closed"},transport:a.name()}),o._reconnecting=!1,o._disconnect(m,p,b)},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 ht){r._failUnauthorized();return}r.emit("error",{type:"connectToken",error:{code:le.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 ht){this._failUnauthorized();return}this.emit("error",{type:"connectData",error:{code:le.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:le.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:_t.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:le.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(bn.unauthorized,"unauthorized",!1)}_getToken(){return this._debug("get connection token"),this._config.getToken?this._config.getToken({}):(this.emit("error",{type:"configuration",error:{code:le.badConfiguration,message:"token expired but no getToken function set in the configuration"}}),Promise.reject(new ht("")))}_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 ht){t._failUnauthorized();return}t.emit("error",{type:"refreshToken",error:{code:le.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 lr(0,5e3,1e4)}_refreshResponse(e){this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null),e.expires&&(this._client=e.client,this._refreshTimeout=setTimeout(()=>this._refresh(),cr(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(_t.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===De.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(),cr(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(_t.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(le.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])}}ur.SubscriptionState=De,ur.State=me,ur.UnauthorizedError=ht;const fp=({chatbotId:n,userData:e,fullScreen:t})=>{var ue,Pe;const r=(ue=window==null?void 0:window.robodialog)==null?void 0:ue.default,s=(Pe=window==null?void 0:window.robodialog)==null?void 0:Pe.externalAPI,i=!!r,o=!!s,a=et(null),[l,c]=N(i?r:null),[u,d]=N(i?wd:null),[f,h]=N(i?rt:null),[p,b]=N(null),[m,y]=N(0),x=pt(()=>({chatbot:l,setChatbot:c,token:u,setToken:d,userId:f,setUserId:h,fileSizeLimit:m,setFileSizeLimit:y,userData:e||{},chatbotDefault:r,isChatbotDefault:i,defaultExternalAPI:s,isDefaultExternalAPI:o}),[l,u,f,m,e,i,s,o]),[w,k]=N(i?kd:[]),[_,T]=N(i?Sd:[]),[R,E]=N(o?Td:null),[A,F]=N(0),[P,Y]=N(null),se=et([]),ee=et({call:!1,messagesCount:{},messagesLength:{}}),Te=pt(()=>({messages:w,setMessages:k,conversations:_,setConversations:T,currentConversation:R,setCurrentConversation:E,totalConversationsCount:A,setTotalConversationsCount:F,newMessage:P,setNewMessage:Y,messagesRef:se,messageCallOneTime:ee}),[w,_,R,A,P]),[Z,ve]=N(!!o),[fe,ze]=N(!1),[C,D]=N(!1),[$,M]=N(!1),[O,z]=N(!1),[j,U]=N(!1),[B,X]=N(!1),[H,ye]=N(0),[S,pe]=N(null),[ft,Zt]=N(null),[hr,fr]=N(null),pr=et(!1),gr=et(!1),q=pt(()=>({chatOpen:Z,setChatOpen:ve,callChatFlow:fe,setCallChatFlow:ze,interacted:C,setInteracted:D,canMessage:$,setCanMessage:M,humanControl:O,setHumanControl:z,aiLoading:j,setAiLoading:U,userLoading:B,setUserLoading:X,onlineAgents:H,setOnlineAgents:ye,ratingFromUser:S,setRatingFromUser:pe,dataFromUser:ft,setDataFromUser:Zt,hoveringMessageInner:hr,setHoveringMessageInner:fr,callChatFlowRef:pr,agentConversationEnded:gr}),[Z,fe,C,$,O,j,B,H,S,ft,hr]);return _e(()=>i||!n?void 0:((async()=>{var Oe,ae;try{let ie=wi("robodialog-livechat-id");e!=null&&e.userId&&(ie=e.userId),ie||(ie=xi(),Nr("robodialog-livechat-id",ie)),h(ie);const Ze=await Mo.readById({params:{id:n}});if(!((Oe=Ze.data)!=null&&Oe.chatbot))throw new Error("Chatbot not found");const vt=Ze.data.chatbot;c(vt),y(Ze.data.fileSizeLimit);const yt=await Mo.generateToken({body:{userId:ie,chatbotId:vt._id,visitor:!(e!=null&&e.userId)}});if(!((ae=yt.data)!=null&&ae.token))throw new Error("Token generation failed");const{token:mr,socketToken:_n}=yt.data;if(d(mr),o)return;const br=new ur(uu,{token:_n}),Cl=br.newSubscription(`personal:${ie}`),wp=br.newSubscription(`chatbot_widget:${vt._id}`);Cl.on("publication",kp=>{const{event:El,data:Ge}=kp.data;El==="conversation"&&(T(qe=>{const _r=qe.findIndex(Nt=>Nt._id===Ge._id);if(_r!==-1){const Nt=[...qe];return Nt[_r]=Ge,Nt}return[...qe,Ge]}),E(qe=>!qe||qe._id!==Ge._id?qe:(!!qe.assignedTo&&!Ge.assignedTo&&qe.assignType&&(pr.current=!0),Ge))),El==="message"&&(k(qe=>{if(qe.some(vr=>vr._id===Ge._id))return qe.map(vr=>vr._id===Ge._id?Ge:vr);const Nt=[...qe,Ge];return se.current=Nt,Nt}),Z||Y(Ge))}),Cl.subscribe(),wp.subscribe(),br.connect(),b(br)}catch(ie){cl().error("Widget initialization failed:",ie)}})(),()=>{p==null||p.disconnect()}),[n]),_e(()=>{if(!(l!=null&&l.appearance)||!a.current)return;const Oe=a.current.getRootNode().host;if(Oe&&Oe instanceof HTMLElement){const ae=Oe,ie=l.appearance.color,Ze=l.appearance.others;ae.style.setProperty("--background-color",ie.background||"#ffffff"),ae.style.setProperty("--background-text-color",ie.backgroundText||"#111827"),ae.style.setProperty("--input-background-color",ie.inputBackground||"#ffffff"),ae.style.setProperty("--input-text-color",ie.inputText||"#111827"),ae.style.setProperty("--base-color",ie.base||"#006fee"),ae.style.setProperty("--base-text-color",ie.baseText||"#ffffff");const vt=yt=>typeof yt=="number"?`${yt}px`:yt;ae.style.setProperty("--popup-container-radius",vt(Ze.popupContainerRadius)||"20px"),ae.style.setProperty("--chatbot-radius",vt(Ze.chatbotRadius)||"12px"),ae.style.setProperty("--shadow-sm","0 0px 2px 0 rgba(0, 0, 0, 0.05)"),ae.style.setProperty("--shadow-md","0 0px 10px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"),ae.style.setProperty("--shadow-lg","0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"),ae.style.setProperty("--shadow-xl","0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)"),ae.style.setProperty("--transition-smooth","cubic-bezier(0.4, 0, 0.2, 1)"),ae.style.setProperty("--transition-bounce","cubic-bezier(0.68, -0.55, 0.05, 2)")}},[l]),_e(()=>{if(i||o)return;(async()=>{if(!u||!R||_.length===0)return;const Oe=w.filter(ae=>ae.conversationId===R._id&&!_.some(ie=>ie._id===ae.conversationId));for(const ae of Oe)try{const ie=await Dt.userRead({params:{id:ae.conversationId}},u);ie.data&&T(Ze=>[...Ze,ie.data])}catch(ie){cl().error(`Failed to fetch conversation ${ae.conversationId}:`,ie)}})()},[w,_,R,u]),!l||!u?g("div",{ref:a,className:"robodialog-chatbot-app"}):g("div",{ref:a,className:`robodialog-chatbot-app${t?" robodialog-chatbot-app-fullscreen":""}`,children:g(Bf,{coreState:x,conversationState:Te,uiState:q,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;border-radius:4px}.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:700px;max-height:calc(95vh - 70px);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{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:var(--popup-container-radius);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>div{margin-bottom:16px}.messageDiv form>div:last-child{margin-bottom:0}.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) * .66);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) * .66);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:16px;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:4px;padding:8px 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{position:absolute;bottom:100%;left:0;right:0;margin-bottom:8px;display:flex;flex-direction:column;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:var(--popup-container-radius);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;margin-bottom:12px;pointer-events:all}.chatHoveringMessage{padding:14px 16px;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 Be;const Sl=()=>{if(document.getElementById("my-chatbot-root"))return;const{chatbotId:n,otherData:e,fullScreen:t}=xp();if(!n)return;Be=document.createElement("div"),Be.id="my-chatbot-root",Be.style.position="fixed",Be.style.zIndex="101",Be.style.pointerEvents=t?"auto":"none",t&&(Be.style.top="0",Be.style.left="0",Be.style.width="100vw",Be.style.height="100vh"),document.body.appendChild(Be);const r=Be.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(`
104
- `),r.appendChild(i),wt(g(fp,{chatbotId:n,userData:e,fullScreen:t}),s),console.log("[ChatbotWidget] mounted")},Tl=()=>{const n=document.getElementById("my-chatbot-root");if(n){if(n.shadowRoot){const e=n.shadowRoot.querySelector("div");e&&wt(null,e)}n.remove(),Be=null,console.log("[ChatbotWidget] unmounted")}};Sl(),window.robodialog={refresh:()=>{Tl(),Sl()},_destroy:Tl}})();
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}})();
105
117
  //# sourceMappingURL=widget.js.map