@squadico/chatbot 1.1.0 → 1.1.2

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.
@@ -0,0 +1,8 @@
1
+ var e,t,n,r,i,a,o,s,c,l,u,d,f,p,m={},h=[],g=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_=Array.isArray;function v(e,t){for(var n in t)e[n]=t[n];return e}function y(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function b(t,n,r){var i,a,o,s={};for(o in n)o==`key`?i=n[o]:o==`ref`?a=n[o]:s[o]=n[o];if(arguments.length>2&&(s.children=arguments.length>3?e.call(arguments,2):r),typeof t==`function`&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return x(t,s,i,a,null)}function x(e,r,i,a,o){var s={type:e,props:r,key:i,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++n,__i:-1,__u:0};return o==null&&t.vnode!=null&&t.vnode(s),s}function S(e){return e.children}function C(e,t){this.props=e,this.context=t}function w(e,t){if(t==null)return e.__?w(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?w(e):null}function T(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,i=[],a=[],o=v({},n);o.__v=n.__v+1,t.vnode&&t.vnode(o),ee(e.__P,o,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,i,r??w(n),!!(32&n.__u),a),o.__v=n.__v,o.__.__k[o.__i]=o,L(i,o,a),n.__e=n.__=null,o.__e!=r&&E(o)}}function E(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),E(e)}function D(e){(!e.__d&&(e.__d=!0)&&r.push(e)&&!O.__r++||i!=t.debounceRendering)&&((i=t.debounceRendering)||a)(O)}function O(){try{for(var e,t=1;r.length;)r.length>t&&r.sort(o),e=r.shift(),t=r.length,T(e)}finally{r.length=O.__r=0}}function k(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,g,_,v,y=r&&r.__k||h,b=t.length;for(c=A(n,t,y,c,b),d=0;d<b;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&y[p.__i]||m,p.__i=d,v=ee(e,p,f,i,a,o,s,c,l,u),g=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&ne(f.ref,null,p),u.push(p.ref,p.__c||g,p)),_==null&&g!=null&&(_=g),4&p.__u?(c=j(p,c,e),f.__e&&(f.__e=null)):typeof p.type==`function`&&v!==void 0?c=v:g&&(c=g.nextSibling),p.__u&=-7);return n.__e=_,c}function A(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=x(null,o,null,null,null):_(o)?o=e.__k[a]=x(S,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=x(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=M(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=w(s)),z(s,s));return r}function j(e,t,n){var r,i;if(typeof e.type==`function`){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=j(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=w(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function M(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function N(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||g.test(t)?n:n+`px`}function P(e,t,n,r,i){var a,o;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||N(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||N(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(u,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?r?n[l]=r[l]:(n[l]=d,e.addEventListener(t,a?p:f,a)):e.removeEventListener(t,a?p:f,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function F(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[c]==null)n[c]=d++;else if(n[c]<r[l])return;return r(t.event?t.event(n):n)}}}function ee(e,n,r,i,a,o,s,c,l,u){var d,f,p,m,g,b,x,T,E,D,O,A,j,M,N,P,F=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),o=[c=n.__e=r.__e]),(d=t.__b)&&d(n);n:if(typeof F==`function`){f=s.length;try{if(E=n.props,D=F.prototype&&F.prototype.render,O=(d=F.contextType)&&i[d.__c],A=d?O?O.props.value:d.__:i,r.__c?T=(p=n.__c=r.__c).__=p.__E:(D?n.__c=p=new F(E,A):(n.__c=p=new C(E,A),p.constructor=F,p.render=re),O&&O.sub(p),p.state||(p.state={}),p.__n=i,m=p.__d=!0,p.__h=[],p._sb=[]),D&&p.__s==null&&(p.__s=p.state),D&&F.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,F.getDerivedStateFromProps(E,p.__s))),g=p.props,b=p.state,p.__v=n,m)D&&F.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),D&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(D&&F.getDerivedStateFromProps==null&&E!==g&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(E,A),n.__v==r.__v||!p.__e&&p.shouldComponentUpdate!=null&&!1===p.shouldComponentUpdate(E,p.__s,A)){n.__v!=r.__v&&(p.props=E,p.state=p.__s,p.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(e){e&&(e.__=n)}),h.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p),c=w(r);break n}p.componentWillUpdate!=null&&p.componentWillUpdate(E,p.__s,A),D&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(g,b,x)})}if(p.context=A,p.props=E,p.__P=e,p.__e=!1,j=t.__r,M=0,D)p.state=p.__s,p.__d=!1,j&&j(n),d=p.render(p.props,p.state,p.context),h.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,j&&j(n),d=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++M<25);p.state=p.__s,p.getChildContext!=null&&(i=v(v({},i),p.getChildContext())),D&&!m&&p.getSnapshotBeforeUpdate!=null&&(x=p.getSnapshotBeforeUpdate(g,b)),N=d!=null&&d.type===S&&d.key==null?te(d.props.children):d,c=k(e,_(N)?N:[N],n,r,i,a,o,s,c,l,u),p.base=n.__e,n.__u&=-161,p.__h.length&&s.push(p),T&&(p.__E=p.__=null)}catch(e){if(s.length=f,n.__v=null,l||o!=null){if(e.then){for(n.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o!=null&&(o[o.indexOf(c)]=null),n.__e=c}else if(o!=null)for(P=o.length;P--;)y(o[P])}else n.__e=r.__e;n.__k??(n.__k=r.__k||[]),e.then||I(n),t.__e(e,n,r)}}else o==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):c=n.__e=R(r.__e,n,r,i,a,o,s,l,u);return(d=t.diffed)&&d(n),128&n.__u?void 0:c}function I(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(I))}function L(e,n,r){for(var i=0;i<r.length;i++)ne(r[i],r[++i],r[++i]);t.__c&&t.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){t.__e(e,n.__v)}})}function te(e){return typeof e!=`object`||!e||e.__b>0?e:_(e)?e.map(te):e.constructor===void 0?v({},e):null}function R(n,r,i,a,o,s,c,l,u){var d,f,p,h,g,v,b,x=i.props||m,S=r.props,C=r.type;if(C==`svg`?o=`http://www.w3.org/2000/svg`:C==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||(o=`http://www.w3.org/1999/xhtml`),s!=null){for(d=0;d<s.length;d++)if((g=s[d])&&`setAttribute`in g==!!C&&(C?g.localName==C:g.nodeType==3)){n=g,s[d]=null;break}}if(n==null){if(C==null)return document.createTextNode(S);n=document.createElementNS(o,C,S.is&&S),l&&(t.__m&&t.__m(r,s),l=!1),s=null}if(C==null)x===S||l&&n.data==S||(n.data=S);else{if(s=C==`textarea`&&S.defaultValue!=null?null:s&&e.call(n.childNodes),!l&&s!=null)for(x={},d=0;d<n.attributes.length;d++)x[(g=n.attributes[d]).name]=g.value;for(d in x)g=x[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in S||d==`value`&&`defaultValue`in S||d==`checked`&&`defaultChecked`in S||P(n,d,null,g,o);for(d in S)g=S[d],d==`children`?h=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?v=g:d==`checked`?b=g:l&&typeof g!=`function`||x[d]===g||P(n,d,g,x[d],o);if(f)l||p&&(f.__html==p.__html||f.__html==n.innerHTML)||(n.innerHTML=f.__html),r.__k=[];else if(p&&(n.innerHTML=``),k(r.type==`template`?n.content:n,_(h)?h:[h],r,i,a,C==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:i.__k&&w(i,0),l,u),s!=null)for(d=s.length;d--;)y(s[d]);l&&C!=`textarea`||(d=`value`,C==`progress`&&v==null?n.removeAttribute(`value`):v!=null&&(v!==n[d]||C==`progress`&&!v||C==`option`&&v!=x[d])&&P(n,d,v,x[d],o),d=`checked`,b!=null&&b!=n[d]&&P(n,d,b,x[d],o))}return n}function ne(e,n,r){try{if(typeof e==`function`){var i=typeof e.__u==`function`;i&&e.__u(),i&&n==null||(e.__u=e(n))}else e.current=n}catch(e){t.__e(e,r)}}function z(e,n,r){var i,a;if(t.unmount&&t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||ne(i,null,n)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){t.__e(e,n)}i.base=i.__P=i.__n=null}if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&z(i[a],n,r||typeof e.type!=`function`);r||y(e.__e),e.__c=e.__=e.__e=void 0}function re(e,t,n){return this.constructor(e,n)}function ie(n,r,i){var a,o,s,c;r==document&&(r=document.documentElement),t.__&&t.__(n,r),o=(a=typeof i==`function`)?null:i&&i.__k||r.__k,s=[],c=[],ee(r,n=(!a&&i||r).__k=b(S,null,[n]),o||m,m,r.namespaceURI,!a&&i?[i]:o?null:r.firstChild?e.call(r.childNodes):null,s,!a&&i?i:o?o.__e:r.firstChild,a,c),L(s,n,c),n.props.children=null}e=h.slice,t={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},n=0,C.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=v({},this.state);typeof e==`function`&&(e=e(v({},n),this.props)),e&&v(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),D(this))},C.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),D(this))},C.prototype.render=S,r=[],a=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,o=function(e,t){return e.__v.__b-t.__v.__b},O.__r=0,s=Math.random().toString(8),c=`__d`+s,l=`__a`+s,u=/(PointerCapture)$|Capture$/i,d=0,f=F(!1),p=F(!0);var B,V,ae,oe,se=0,ce=[],H=t,le=H.__b,ue=H.__r,de=H.diffed,fe=H.__c,pe=H.unmount,me=H.__;function he(e,t){H.__h&&H.__h(V,e,se||t),se=0;var n=V.__H||(V.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function U(e){return se=1,ge(we,e)}function ge(e,t,n){var r=he(B++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):we(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=V,!V.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};V.__f=!0;var a=V.shouldComponentUpdate,o=V.componentWillUpdate;V.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},V.shouldComponentUpdate=i}return r.__N||r.__}function W(e,t){var n=he(B++,3);!H.__s&&Ce(n.__H,t)&&(n.__=e,n.u=t,V.__H.__h.push(n))}function _e(e,t){var n=he(B++,4);!H.__s&&Ce(n.__H,t)&&(n.__=e,n.u=t,V.__h.push(n))}function G(e){return se=5,K(function(){return{current:e}},[])}function K(e,t){var n=he(B++,7);return Ce(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function q(e,t){return se=8,K(function(){return e},t)}function ve(){for(var e;e=ce.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(xe),t.__h.some(Se),t.__h=[]}catch(n){t.__h=[],H.__e(n,e.__v)}}}H.__b=function(e){V=null,le&&le(e)},H.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),me&&me(e,t)},H.__r=function(e){ue&&ue(e),B=0;var t=(V=e.__c).__H;t&&(ae===V?(t.__h=[],V.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(xe),t.__h.some(Se),t.__h=[],B=0)),ae=V},H.diffed=function(e){de&&de(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ce.push(t)!==1&&oe===H.requestAnimationFrame||((oe=H.requestAnimationFrame)||be)(ve)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),ae=V=null},H.__c=function(e,t){t.some(function(e){try{e.__h.some(xe),e.__h=e.__h.filter(function(e){return!e.__||Se(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],H.__e(n,e.__v)}}),fe&&fe(e,t)},H.unmount=function(e){pe&&pe(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{xe(e)}catch(e){t=e}}),n.__H=void 0,t&&H.__e(t,n.__v))};var ye=typeof requestAnimationFrame==`function`;function be(e){var t,n=function(){clearTimeout(r),ye&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ye&&(t=requestAnimationFrame(n))}function xe(e){var t=V,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),V=t}function Se(e){var t=V;e.__c=e.__(),V=t}function Ce(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function we(e,t){return typeof t==`function`?t(e):t}var Te=new Set([`sessionId`]);function Ee(e){if(typeof e==`string`)return e.length>0?{id:e}:void 0;if(!e||typeof e!=`object`||Array.isArray(e))return;let{id:t,name:n}=e;if(typeof t==`string`&&t.length!==0)return typeof n==`string`&&n.length>0?{id:t,name:n}:{id:t}}function De(e){let t=Ee(e);if(t)return t.name??t.id}function Oe(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function ke(e){let t={};for(let[n,r]of Object.entries(e)){if(Te.has(n)||!Oe(r)){t[n]=r;continue}let e=Ee(r);e&&(t[`${n}Id`]=e.id,e.name&&(t[`${n}Name`]=e.name))}return t}var Ae=`en`,je=[`en`,`fr`,`es`],Me={en:{heading:`Assistant`,subheading:`Squadico`,placeholder:`Ask your question…`,greeting:`Hello! I am your assistant. What would you like to do?`,hint:`The assistant proposes an action; nothing is applied without your confirmation.`,assistant:`Assistant`,typing:`The assistant is writing its answer`,newConversation:`New conversation`,close:`Close the assistant`,closeTitle:`Close`,history:{open:`Conversation history`,menu:`Previous conversations`,loading:`Loading…`,empty:`No previous conversation.`,untitled:`Conversation`},context:{region:`Context sent to the assistant`},approval:{group:`Write confirmation`,approve:`Yes, apply`,reject:`No, cancel`,request:`The agent wants to use {tool}.`,arguments:`With`,edit:`Change…`,correction:`What to change — e.g. “the due date is next Monday”`,correctionLabel:`Correction to make before approving`,send:`Send`},confirm:{group:`Confirmation`,yes:`Yes`,no:`No`,yesValue:`yes`,noValue:`no`},choices:`Suggested options`,poweredBy:`Powered by Squadico`,handles:{picker:`Agents you can address`,unknown:`Nobody answers to that name here:`,instead:`You can address:`},selection:{group:`Suggested choice`,single:`Pick one option.`,multiple:`Pick one or more options, then validate.`,validate:`Validate`},composer:{label:`Your message`,send:`Send the message`,sendTitle:`Send`,stop:`Stop the answer`,stopTitle:`Stop`,attach:`Attach a file`,attachTitle:`Attach`,remove:`Remove {name}`},attachments:{unsupported:`This kind of file cannot be attached to a message.`,tooLarge:`This file is too large.`,tooMany:`This message already carries as many files as it may.`,unreadable:`This file could not be read.`,failed:`This file could not be attached.`},error:`Something went wrong, the assistant could not answer. Try again in a moment.`,withHuman:`A member of the team will reply to you here.`},fr:{heading:`Assistant`,subheading:`Squadico`,placeholder:`Posez votre question…`,greeting:`Bonjour ! Je suis votre assistant. Que souhaitez-vous faire ?`,hint:`L'assistant propose une action ; rien n'est appliqué sans votre confirmation.`,assistant:`Assistant`,typing:`L'assistant rédige sa réponse`,newConversation:`Nouvelle conversation`,close:`Fermer l'assistant`,closeTitle:`Fermer`,history:{open:`Historique des conversations`,menu:`Conversations précédentes`,loading:`Chargement…`,empty:`Aucune conversation précédente.`,untitled:`Conversation`},context:{region:`Contexte transmis à l'assistant`},approval:{group:`Validation de l'écriture`,approve:`Oui, appliquer`,reject:`Non, annuler`,request:`L'agent souhaite utiliser {tool}.`,arguments:`Avec`,edit:`Modifier…`,correction:`Ce qu'il faut changer — ex. « l'échéance est lundi prochain »`,correctionLabel:`Correction à apporter avant validation`,send:`Envoyer`},confirm:{group:`Confirmation`,yes:`Oui`,no:`Non`,yesValue:`oui`,noValue:`non`},choices:`Options proposées`,poweredBy:`Propulsé par Squadico`,handles:{picker:`Agents que vous pouvez adresser`,unknown:`Personne ne répond à ce nom ici :`,instead:`Vous pouvez adresser :`},selection:{group:`Choix proposé`,single:`Sélectionnez une option.`,multiple:`Sélectionnez une ou plusieurs options, puis validez.`,validate:`Valider`},composer:{label:`Votre message`,send:`Envoyer le message`,sendTitle:`Envoyer`,stop:`Interrompre la réponse`,stopTitle:`Interrompre`,attach:`Joindre un fichier`,attachTitle:`Joindre`,remove:`Retirer {name}`},attachments:{unsupported:`Ce format de fichier ne peut pas être joint à un message.`,tooLarge:`Ce fichier est trop volumineux.`,tooMany:`Ce message porte déjà autant de fichiers qu'il le peut.`,unreadable:`Ce fichier n'a pas pu être lu.`,failed:`Impossible de joindre ce fichier.`},error:`Une erreur est survenue, l'assistant n'a pas pu répondre. Réessayez dans un instant.`,withHuman:`Un membre de l'équipe va vous répondre ici.`},es:{heading:`Asistente`,subheading:`Squadico`,placeholder:`Haga su pregunta…`,greeting:`¡Hola! Soy su asistente. ¿Qué desea hacer?`,hint:`El asistente propone una acción; no se aplica nada sin su confirmación.`,assistant:`Asistente`,typing:`El asistente está redactando su respuesta`,newConversation:`Nueva conversación`,close:`Cerrar el asistente`,closeTitle:`Cerrar`,history:{open:`Historial de conversaciones`,menu:`Conversaciones anteriores`,loading:`Cargando…`,empty:`Ninguna conversación anterior.`,untitled:`Conversación`},context:{region:`Contexto enviado al asistente`},approval:{group:`Validación de la escritura`,approve:`Sí, aplicar`,reject:`No, cancelar`,request:`El agente quiere usar {tool}.`,arguments:`Con`,edit:`Modificar…`,correction:`Lo que hay que cambiar — p. ej. «el vencimiento es el lunes»`,correctionLabel:`Corrección antes de validar`,send:`Enviar`},confirm:{group:`Confirmación`,yes:`Sí`,no:`No`,yesValue:`sí`,noValue:`no`},choices:`Opciones propuestas`,poweredBy:`Con la tecnología de Squadico`,handles:{picker:`Agentes a los que puedes dirigirte`,unknown:`Nadie responde a ese nombre aquí:`,instead:`Puedes dirigirte a:`},selection:{group:`Opción propuesta`,single:`Seleccione una opción.`,multiple:`Seleccione una o varias opciones y valide.`,validate:`Validar`},composer:{label:`Su mensaje`,send:`Enviar el mensaje`,sendTitle:`Enviar`,stop:`Interrumpir la respuesta`,stopTitle:`Interrumpir`,attach:`Adjuntar un archivo`,attachTitle:`Adjuntar`,remove:`Quitar {name}`},attachments:{unsupported:`Este tipo de archivo no se puede adjuntar a un mensaje.`,tooLarge:`Este archivo es demasiado grande.`,tooMany:`Este mensaje ya lleva todos los archivos que puede llevar.`,unreadable:`No se ha podido leer este archivo.`,failed:`No se ha podido adjuntar este archivo.`},error:`Se ha producido un error, el asistente no ha podido responder. Inténtelo de nuevo.`,withHuman:`Un miembro del equipo le responderá aquí.`}},Ne={en:`en-GB`,fr:`fr-FR`,es:`es-ES`};function Pe(e){let t=e?.trim().toLowerCase().split(/[-_]/)[0];return t&&t in Me?t:void 0}function Fe(){return typeof navigator>`u`?[]:navigator.languages?.length?navigator.languages:[navigator.language]}function Ie(e){let t=e?.trim(),n=(t?[t]:Fe()).find(Pe),r=Pe(n)??`en`;return{code:r,tag:n?.includes(`-`)?n:Ne[r],t:Me[r]}}var Le=`squadico-chatbot:open`;function Re(){try{if(typeof sessionStorage>`u`)return;let e=sessionStorage.getItem(Le);return e===`1`||e!==`0`&&void 0}catch{return}}function ze(e){try{if(typeof sessionStorage>`u`)return;sessionStorage.setItem(Le,e?`1`:`0`)}catch{}}function Be(e,t){return t===!1?e??!1:Re()??e??!1}function Ve(){let e=globalThis.crypto;if(e&&typeof e.randomUUID==`function`)return e.randomUUID();let t=new Uint8Array(16);if(e&&typeof e.getRandomValues==`function`)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=[];for(let e=0;e<16;e++)n.push(t[e].toString(16).padStart(2,`0`));return n.slice(0,4).join(``)+`-`+n.slice(4,6).join(``)+`-`+n.slice(6,8).join(``)+`-`+n.slice(8,10).join(``)+`-`+n.slice(10,16).join(``)}function He(e){"@babel/helpers - typeof";return He=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},He(e)}function Ue(e,t){if(He(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(He(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function We(e){var t=Ue(e,`string`);return He(t)==`symbol`?t:t+``}function Ge(e,t,n){return(t=We(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ke=`https://api.squadico.com`,qe=2e4,J=class extends Error{constructor(e,t,n){super(e),Ge(this,`status`,void 0),Ge(this,`code`,void 0),this.name=`ChatHttpError`,this.status=t,this.code=n}};function Je(e,t){return`${e.replace(/\/+$/,``)}${t}`}function Ye(e,t){return{"Content-Type":`application/json`,Accept:`text/event-stream, application/json`,...e?{"X-Visitor-Token":e}:{},...t?{"X-Subject-Token":t}:{}}}function Xe(e){if(!e||typeof e!=`object`)return;let{loc:t,msg:n}=e;if(typeof n!=`string`||!n)return;let r=(Array.isArray(t)?t.filter(e=>typeof e==`string`):[]).at(-1);return r&&r!==`body`?`${r}: ${n}`:n}async function Ze(e){let t=``,n;try{let r=await e.text();if(r)try{let e=JSON.parse(r),i=e.detail??e.message;if(Array.isArray(i)){let e=i.map(e=>Xe(e)??(typeof e==`string`?e:void 0)).filter(e=>e!==void 0);t=e.length>0?e.join(`, `):r}else t=typeof i==`string`?i:r;n=typeof e.code==`string`?e.code:void 0}catch{t=r}}catch{}return new J(t||`The API answered ${e.status}`,e.status,n)}function Qe(e){if(!e||typeof e!=`object`)return;let t=e;if(!(typeof t.handle!=`string`||!t.handle))return{handle:t.handle,name:typeof t.name==`string`?t.name:t.handle,avatarEmoji:typeof t.avatar_emoji==`string`?t.avatar_emoji:void 0,color:typeof t.color==`string`?t.color:void 0}}function $e(e){return(Array.isArray(e)?e:[]).map(Qe).filter(e=>e!==void 0)}function et(e){if(!e||typeof e!=`object`)return;let t=e;if(!(typeof t.tool_call_id!=`string`||!t.tool_call_id))return{toolCallId:t.tool_call_id,tool:typeof t.tool==`string`?t.tool:``,arguments:t.arguments&&typeof t.arguments==`object`?t.arguments:{}}}var tt=new Set([`user`,`assistant`]);function nt(e){if(typeof e.role!=`string`||!tt.has(e.role)||typeof e.content!=`string`||!e.content)return null;let t=typeof e.created_at==`string`?Date.parse(e.created_at):NaN;return{id:typeof e.id==`string`&&e.id?e.id:Ve(),role:e.role,content:e.content,createdAt:Number.isNaN(t)?Date.now():t,agent:Qe(e.agent),attachments:rt(e.attachments),authorName:e.kind===`human`&&typeof e.author_name==`string`&&e.author_name?e.author_name:void 0}}function rt(e){if(!Array.isArray(e))return;let t=e.map(e=>it(e)).filter(e=>e!==null);return t.length>0?t:void 0}function it(e){if(!e||typeof e!=`object`)return null;let{id:t,kind:n,filename:r,content_type:i}=e;return typeof t!=`string`||!t||typeof r!=`string`||!r?null:{id:t,kind:n===`image`?`image`:`document`,filename:r,contentType:typeof i==`string`?i:`application/octet-stream`}}async function at(e){let t=await fetch(Je(e.apiUrl,`/public/applications/${encodeURIComponent(e.embedKey)}/conversations`),{method:`POST`,headers:Ye(),body:JSON.stringify({...e.user?{user:e.user}:{},...e.agent?{agent:e.agent}:{}}),signal:e.signal});if(!t.ok)throw await Ze(t);let n=await t.json();if(typeof n.id!=`string`||typeof n.visitor_token!=`string`)throw new J(`The API opened a conversation without an id or a token`);let r=(Array.isArray(n.messages)?n.messages:[]).map(nt).filter(e=>e!==null);return{conversationId:n.id,visitorToken:n.visitor_token,agentName:typeof n.agent_name==`string`?n.agent_name:``,agentSlug:typeof n.agent_slug==`string`?n.agent_slug:``,welcomeMessage:typeof n.welcome_message==`string`&&n.welcome_message?n.welcome_message:void 0,messages:r,handles:$e(n.handles),agentHandle:typeof n.agent_handle==`string`&&n.agent_handle?n.agent_handle:void 0,withHuman:typeof n.handling==`string`&&n.handling!==`agents`,branding:n.branding===!0}}async function ot(e){let t=await fetch(Je(e.apiUrl,`/public/conversations/${encodeURIComponent(e.conversationId)}`),{method:`GET`,headers:Ye(e.visitorToken),signal:e.signal});if(!t.ok)throw await Ze(t);let n=await t.json();if(typeof n.id!=`string`)throw new J(`The API replayed a conversation without an id`);return{conversationId:n.id,visitorToken:e.visitorToken,agentName:typeof n.agent_name==`string`?n.agent_name:``,agentSlug:typeof n.agent_slug==`string`?n.agent_slug:``,welcomeMessage:typeof n.welcome_message==`string`&&n.welcome_message?n.welcome_message:void 0,messages:(Array.isArray(n.messages)?n.messages:[]).map(nt).filter(e=>e!==null),handles:$e(n.handles),agentHandle:typeof n.agent_handle==`string`&&n.agent_handle?n.agent_handle:void 0,withHuman:typeof n.handling==`string`&&n.handling!==`agents`,branding:n.branding===!0}}async function st(e){let t=new FormData;t.append(`file`,e.file);let n=await fetch(ut(e),{method:`POST`,headers:{"X-Visitor-Token":e.visitorToken},body:t,signal:e.signal});if(!n.ok)throw await Ze(n);let r=it(await n.json());if(!r)throw new J(`The upload could not be read`,n.status);return r}async function ct(e){let t=await fetch(`${ut(e)}/${encodeURIComponent(e.attachmentId)}`,{method:`DELETE`,headers:{"X-Visitor-Token":e.visitorToken},signal:e.signal});if(!t.ok)throw await Ze(t)}async function lt(e){let t=await fetch(`${ut(e)}/${encodeURIComponent(e.attachmentId)}/content`,{headers:{"X-Visitor-Token":e.visitorToken},signal:e.signal});if(!t.ok)throw await Ze(t);return t.blob()}function ut(e){return Je(e.apiUrl,`/public/conversations/${encodeURIComponent(e.conversationId)}/attachments`)}async function dt(e){return pt(Je(e.apiUrl,`/public/conversations/${encodeURIComponent(e.conversationId)}/messages`),{content:e.message,attachment_ids:e.attachmentIds??[],...e.context&&Object.keys(e.context).length>0?{context:e.context}:{}},e)}async function ft(e){return pt(Je(e.apiUrl,`/public/conversations/${encodeURIComponent(e.conversationId)}/approvals`),{tool_call_id:e.toolCallId,approved:e.approved},e)}async function pt(e,t,n){let r=await fetch(e,{method:`POST`,headers:Ye(n.visitorToken,n.subjectToken),body:JSON.stringify(t),signal:n.signal});if(!r.ok)throw await Ze(r);if(!r.body)throw new J(`Answer with no stream body`);let i=r.body.getReader(),a=new TextDecoder,o=``,s=``,c=``,l,u,d={answer:``};try{for(;;){let{value:e,done:t}=await i.read();if(t)break;o+=a.decode(e,{stream:!0});let r=o.split(`
2
+ `);o=r.pop()??``;for(let e of r){let t=e.trim();if(!t){s=``;continue}if(t.startsWith(`event:`)){s=t.slice(6).trim();continue}if(!t.startsWith(`data:`))continue;let r=t.slice(5).trim();if(!r)continue;let i;try{i=JSON.parse(r)}catch{continue}s===`token`&&typeof i.text==`string`?(c+=i.text,n.onToken(i.text)):s===`done`?(d.answer=typeof i.content==`string`?i.content:c,d.agent=Qe(i.agent),typeof i.unknown_handle==`string`&&i.unknown_handle&&(d.unknownHandle=i.unknown_handle,d.offered=$e(i.handles))):s===`handoff`?(typeof i.to_agent_name==`string`&&(u=i.to_agent_name),c=``):s===`escalated`?d.withHuman=!0:s===`held`?(d.held=!0,d.withHuman=!0):s===`approval_required`?d.approval=et(i):s===`error`&&(l=typeof i.detail==`string`?i.detail:`The turn failed`)}if(l)break}}finally{i.cancel().catch(()=>void 0)}if(l)throw new J(l);return!d.answer&&!d.approval&&(d.answer=c),u&&!d.agent&&(d.authorName=u),d}var mt=`squadico-chatbot:conversation`;function ht(){try{if(typeof sessionStorage>`u`)return;let e=sessionStorage.getItem(mt);if(!e)return;let t=JSON.parse(e);return!t.sessionId||!t.visitorToken||!t.embedKey?void 0:{sessionId:t.sessionId,visitorToken:t.visitorToken,embedKey:t.embedKey,user:typeof t.user==`string`?t.user:void 0}}catch{return}}function gt(e){try{if(typeof sessionStorage>`u`)return;sessionStorage.setItem(mt,JSON.stringify(e))}catch{}}function _t(){try{if(typeof sessionStorage>`u`)return;sessionStorage.removeItem(mt)}catch{}}function vt(e,{embedKey:t,user:n}){return e.embedKey===t&&e.user===n}async function yt(e){if(e)try{return await e()||void 0}catch{return}}function bt(e){let t=e instanceof J?e.status:void 0;return t===415?`unsupported`:t===413?`tooLarge`:t===409?`tooMany`:t===422?`unreadable`:`failed`}var xt=5e3;function St(e){return e instanceof J&&e.code===`conversation_retired`}function Ct(e){let[t,n]=U([]),[r,i]=U(!1),[a,o]=U(``),[s,c]=U([]),[l,u]=U(``),[d,f]=U(null),[p,m]=U(!1),[h,g]=U(!1),[_,v]=U([]),[y,b]=U([]),[x,S]=U(null),C=G(null),w=G(e);w.current=e;let T=G(null),E=G(null),D=G(void 0),O=e.greeting,k=K(()=>O?{id:`greeting`,role:`assistant`,content:O,createdAt:Date.now()}:null,[O]),A=q(e=>{w.current.onEvent?.(e)},[]),j=q((e,t)=>{n(n=>n.map(n=>n.id===e?{...n,...t}:n))},[]),M=q((e,t)=>{let n=e instanceof J?e.status:void 0,r=e instanceof Error?e.message:String(e),i=(w.current.locale??Ie(void 0)).t.error;t&&j(t,{content:i,streaming:!1,error:!0}),A({type:`chatbot-error`,message:r,status:n,sessionId:E.current?.sessionId??``}),typeof console<`u`&&console.error(`[squadico-chatbot]`,r)},[A,j]),N=q(async()=>{if(E.current)return E.current;if(T.current)return T.current;let e=w.current;if(!e.embedKey)throw new J(`No embed key: nothing says which application to open`);let t=e.user,r=e.apiUrl??`https://api.squadico.com`,i=e.embedKey,a=r=>{let a={sessionId:r.conversationId,visitorToken:r.visitorToken};return E.current=a,D.current=t?.id,gt({...a,embedKey:i,user:t?.id}),o(r.conversationId),c(r.handles),u(e.agent&&r.agentHandle?r.agentHandle:``),m(!!r.withHuman),g(r.branding),r.messages.length>0&&n(e=>[...r.messages,...e]),a},s=()=>at({apiUrl:r,embedKey:i,user:t,agent:e.agent}).then(a),l=ht(),d=l&&vt(l,{embedKey:i,user:t?.id})?ot({apiUrl:r,conversationId:l.sessionId,visitorToken:l.visitorToken}).then(a).catch(()=>(_t(),s())):s();T.current=d;try{return await d}finally{T.current=null}},[]),P=q(()=>{E.current||T.current||N().catch(e=>M(e))},[N,M]),F=q((e,t,{retry:r=!1,carried:a=[]}={})=>{if(C.current)return;let o=new AbortController;C.current=o,i(!0),f(null);let s=Ve();n(t=>[...t,{id:Ve(),role:`user`,content:e,createdAt:Date.now(),attachments:a.length>0?a:void 0},{id:s,role:`assistant`,content:``,createdAt:Date.now(),streaming:!0}]),(async()=>{let i=await N();A({type:`chatbot-message`,role:`user`,content:e,sessionId:i.sessionId});let a=``,c=e=>{a+=e,j(s,{content:a})},l;try{l=await t(i,c,o.signal)}catch(e){if(!St(e)||(_t(),E.current=null,T.current=null,!r))throw e;i=await N(),a=``,j(s,{content:``}),l=await t(i,c,o.signal)}if(l.withHuman&&m(!0),l.held){n(e=>e.filter(e=>e.id!==s));return}j(s,{content:l.answer,streaming:!1,agent:l.agent,authorName:l.authorName,approval:l.approval,unknownHandle:l.unknownHandle,offered:l.offered}),f(l.approval??null),A({type:`chatbot-message`,role:`assistant`,content:l.answer,sessionId:i.sessionId,agent:l.agent?.handle})})().catch(e=>{if(o.signal.aborted){j(s,{streaming:!1});return}M(e,s)}).finally(()=>{C.current=null,i(!1)})},[N,A,M,j]),ee=q(e=>{let t=e.trim();if(!t&&_.length===0)return;let n=_;v([]),S(null),F(t,async(e,r,i)=>dt({subjectToken:await yt(w.current.getSubjectToken),apiUrl:w.current.apiUrl??`https://api.squadico.com`,conversationId:e.sessionId,visitorToken:e.visitorToken,message:t,attachmentIds:n.map(e=>e.id),context:w.current.context?ke(w.current.context):void 0,onToken:r,signal:i}),{retry:!0,carried:n})},[_,F]),I=q(e=>{S(null),b(t=>[...t,e.name]),N().then(t=>st({apiUrl:w.current.apiUrl??`https://api.squadico.com`,conversationId:t.sessionId,visitorToken:t.visitorToken,file:e})).then(e=>v(t=>[...t,e])).catch(e=>S(bt(e))).finally(()=>b(t=>{let n=t.indexOf(e.name);return n<0?t:[...t.slice(0,n),...t.slice(n+1)]}))},[N]),L=q(e=>{v(t=>t.filter(t=>t.id!==e));let t=E.current;t&&ct({apiUrl:w.current.apiUrl??`https://api.squadico.com`,conversationId:t.sessionId,visitorToken:t.visitorToken,attachmentId:e}).catch(()=>{})},[]),te=q(async e=>{let t=E.current;if(!t)throw new J(`No conversation to read that file from`);return lt({apiUrl:w.current.apiUrl??`https://api.squadico.com`,conversationId:t.sessionId,visitorToken:t.visitorToken,attachmentId:e})},[]),R=q((e,t)=>{let n=d;n&&F(t,async(t,r,i)=>ft({subjectToken:await yt(w.current.getSubjectToken),apiUrl:w.current.apiUrl??`https://api.squadico.com`,conversationId:t.sessionId,visitorToken:t.visitorToken,toolCallId:n.toolCallId,approved:e,onToken:r,signal:i}))},[d,F]),ne=q(()=>{C.current?.abort(),C.current=null,i(!1)},[]),z=q(()=>{C.current?.abort(),C.current=null,E.current=null,T.current=null,D.current=void 0,_t(),i(!1),f(null),m(!1),o(``),u(``),n([]),A({type:`chatbot-reset`,sessionId:``})},[A]),re=e.humanPollMs??xt;W(()=>{if(!p||!a)return;let e=setInterval(()=>{let e=E.current;!e||C.current||ot({apiUrl:w.current.apiUrl??`https://api.squadico.com`,conversationId:e.sessionId,visitorToken:e.visitorToken}).then(e=>{n(e.messages),m(!!e.withHuman)}).catch(()=>{})},re);return()=>clearInterval(e)},[p,a,re]);let ie=e.user?.id;return W(()=>{E.current&&D.current!==ie&&z()},[ie,z]),{messages:K(()=>t.length===0&&k?[k]:t,[k,t]),busy:r,sessionId:a,handles:s,addressee:l,approval:d,withHuman:p,branding:h,start:P,send:ee,attachments:_,uploading:y,attachmentError:x,attach:I,detach:L,loadAttachment:te,decide:R,stop:ne,reset:z}}var wt=0;Array.isArray;function Y(e,n,r,i,a,o){n||(n={});var s,c,l=n;if(`ref`in l)for(c in l={},n)c==`ref`?s=n[c]:l[c]=n[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--wt,__i:-1,__u:0,__source:a,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return t.vnode&&t.vnode(u),u}var Tt=132,Et=`image/png,image/jpeg,image/gif,image/webp,application/pdf,.docx,.txt,.md,.csv,.json`,Dt=/^[a-zA-Z0-9_-]*$/;function Ot(e,t){let n=e.slice(0,t),r=n.lastIndexOf(`@`);if(r<0||r>0&&!/\s/.test(n[r-1]??``))return null;let i=n.slice(r+1);return Dt.test(i)?{start:r,query:i}:null}function kt({placeholder:e,locale:t,busy:n,autoFocus:r,handles:i,addressee:a,attachments:o=[],uploading:s=[],attachmentError:c,onAttach:l,onDetach:u,onSend:d,onStop:f}){let[p,m]=U(``),[h,g]=U(null),[_,v]=U(0),[y,b]=U(!1),x=G(null),C=G(null),w=!!l,T=s.length>0,E=K(()=>{if(!h||!i||i.length===0)return[];let e=h.query.toLowerCase();return i.filter(t=>t.handle.startsWith(e))},[i,h]),D=E.length>0,O=q(()=>{let e=x.current;if(!e)return;e.style.height=`auto`;let t=e.scrollHeight>Tt;e.style.height=`${Math.min(e.scrollHeight,Tt)}px`,e.style.overflowY=t?`auto`:`hidden`},[]);W(()=>{r&&x.current?.focus(),O()},[r,O]),W(()=>{a&&(m(e=>e||`@${a} `),requestAnimationFrame(O))},[a,O]);let k=q(e=>{g(Ot(e.value,e.selectionStart??e.value.length)),v(0)},[]),A=q(e=>{let t=x.current;if(!t||!h)return;let n=t.selectionStart??t.value.length,r=`${p.slice(0,h.start)}@${e} ${p.slice(n)}`,i=h.start+e.length+2;m(r),g(null),requestAnimationFrame(()=>{t.focus(),t.setSelectionRange(i,i),O()})},[O,h,p]),j=q(e=>{if(!(!l||!e))for(let t of Array.from(e))l(t)},[l]),M=q(()=>{let e=p.trim();!e&&o.length===0||n||T||(d(e),m(``),g(null),requestAnimationFrame(O))},[o.length,n,O,d,p,T]),N=q(e=>{if(D&&!e.isComposing){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:E.length-1;v(e=>(e+t)%E.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),A((E[_]??E[0]).handle);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),g(null);return}}e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),M())},[_,E,A,D,M]),P=qe-p.length;return Y(`form`,{class:`sqc-composer${y?` sqc-composer--dropping`:``}`,onSubmit:e=>{e.preventDefault(),M()},onDragOver:e=>{w&&(e.preventDefault(),b(!0))},onDragLeave:()=>b(!1),onDrop:e=>{w&&(e.preventDefault(),b(!1),j(e.dataTransfer?.files??null))},children:[(o.length>0||T||c)&&Y(`div`,{class:`sqc-attachments`,children:[o.map(e=>Y(`span`,{class:`sqc-chip`,"data-kind":e.kind,children:[Y(`span`,{class:`sqc-chip__name`,children:e.filename}),Y(`button`,{type:`button`,class:`sqc-chip__remove`,"aria-label":t.t.composer.remove.replace(`{name}`,e.filename),onClick:()=>u?.(e.id),children:`×`})]},e.id)),s.map(e=>Y(`span`,{class:`sqc-chip sqc-chip--waiting`,children:Y(`span`,{class:`sqc-chip__name`,children:e})},e)),c&&Y(`p`,{class:`sqc-attachments__error`,role:`status`,children:c})]}),Y(`div`,{class:`sqc-composer__field`,children:[D&&Y(`ul`,{class:`sqc-mentions`,role:`listbox`,"aria-label":t.t.handles.picker,children:E.map((e,t)=>Y(`li`,{role:`option`,"aria-selected":t===_,class:`sqc-mention${t===_?` sqc-mention--active`:``}`,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>v(t),onClick:()=>A(e.handle),children:[Y(`span`,{class:`sqc-mention__icon`,"aria-hidden":`true`,children:e.avatarEmoji??`@`}),Y(`span`,{class:`sqc-mention__handle`,children:[`@`,e.handle]}),Y(`span`,{class:`sqc-mention__name`,children:e.name})]},e.handle))}),Y(`textarea`,{ref:x,class:`sqc-composer__input`,rows:1,value:p,placeholder:e,maxLength:qe,"aria-label":t.t.composer.label,onInput:e=>{m(e.currentTarget.value),k(e.currentTarget),O()},onKeyDown:N,onClick:e=>k(e.currentTarget),onPaste:e=>{let t=e.clipboardData?.files;!w||!t||t.length===0||(e.preventDefault(),j(t))}}),P<=200&&Y(`span`,{class:`sqc-composer__count`,"aria-live":`polite`,children:P})]}),w&&Y(S,{children:[Y(`input`,{ref:C,type:`file`,multiple:!0,accept:Et,class:`sqc-file-input`,onChange:e=>{j(e.currentTarget.files),e.currentTarget.value=``}}),Y(`button`,{type:`button`,class:`sqc-btn sqc-btn--attach`,onClick:()=>C.current?.click(),"aria-label":t.t.composer.attach,title:t.t.composer.attachTitle,children:Y(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.9`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:Y(`path`,{d:`M21 11.5l-8.8 8.8a5 5 0 01-7.1-7.1l9-9a3.3 3.3 0 014.7 4.7l-9 9a1.6 1.6 0 01-2.3-2.3l8.3-8.3`})})})]}),n?Y(`button`,{type:`button`,class:`sqc-btn sqc-btn--stop`,onClick:f,"aria-label":t.t.composer.stop,title:t.t.composer.stopTitle,children:Y(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:Y(`rect`,{x:`7`,y:`7`,width:`10`,height:`10`,rx:`2`,fill:`currentColor`})})}):Y(`button`,{type:`submit`,class:`sqc-btn sqc-btn--send`,disabled:!p.trim()&&o.length===0||T,"aria-label":t.t.composer.send,title:t.t.composer.sendTitle,children:Y(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.9`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:Y(`path`,{d:`M5 12l14-7-5 14-2.5-5.5L5 12z`})})})]})}var At={fr:/\br[ée]ponde?z? +«?\s*oui\b/i,en:/\b(?:reply|answer|respond) +[“"']?\s*yes\b/i,es:/\bresponda?e?d? +«?\s*s[íi]\b/i},jt={fr:[/\b(?:confirmes?[- ]tu|confirmez[- ]vous)\b/i,/\b(?:valides?[- ]tu|validez[- ]vous)\b/i,/\b(?:es[- ]tu s[ûu]re?|[êe]tes[- ]vous s[ûu]re?s?)\b/i,/\b(?:dois[- ]je|puis[- ]je)\b/i,/\b(?:je continue|on continue|on y va|je lance)\b/i,At.fr],en:[/\bdo you confirm\b/i,/\bdo you (?:want|wish) me to\b/i,/\b(?:shall|should) I\b/i,/\bare you sure\b/i,/\b(?:shall we|should I) (?:proceed|continue|go ahead)\b/i,At.en],es:[/\b(?:confirmas|confirma|confirm[áa]is)\b/i,/\b(?:validas|valida|valid[áa]is)\b/i,/\best[áa]s? seguro\b/i,/\b(?:contin[úu]o|procedo|lo lanzo|lo hago)\b/i,/\bquieres? que\b/i,At.es]},Mt=/^\s*(?:[-*•]\s+)?\[[ xX]\]\s+/m;function Nt(e,t=`en`){if(Mt.test(e))return!1;let n=e.split(`
3
+ `).map(e=>e.trim()).filter(Boolean),r=n[n.length-1];return!r||!r.includes(`?`)&&!At[t].test(r)?!1:jt[t].some(e=>e.test(r))}var Pt=/^(?:mcp|custom|a2a)_[0-9a-f]{8}_/;function Ft(e){let t=e.replace(Pt,``).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim().toLowerCase();return t?t.charAt(0).toUpperCase()+t.slice(1):e}function It(e,t){return e===!0?t.t.confirm.yes:e===!1?t.t.confirm.no:typeof e==`string`?e:JSON.stringify(e)??String(e)}function Lt({locale:e,call:t,onDecide:n}){let{approval:r,confirm:i}=e.t,[a,o]=U(null),s=!!n&&a===null,c=(e,t)=>{o(t),n?.(e,t)},l=t?Object.entries(t.arguments):[];return Y(`div`,{class:`sqc-approval`,role:`group`,"aria-label":r.group,children:[t&&Y(`p`,{class:`sqc-approval__request`,"data-testid":`sqc-approval-tool`,children:r.request.replace(`{tool}`,Ft(t.tool))}),l.length>0&&Y(`dl`,{class:`sqc-approval__args`,"data-testid":`sqc-approval-arguments`,children:l.map(([t,n])=>Y(`div`,{class:`sqc-approval__arg`,children:[Y(`dt`,{class:`sqc-approval__arg-name`,children:Ft(t)}),Y(`dd`,{class:`sqc-approval__arg-value`,children:It(n,e)})]},t))}),Y(`div`,{class:`sqc-approval__actions`,children:[Y(`button`,{type:`button`,class:`sqc-approval__btn sqc-approval__btn--yes`,"aria-pressed":a===i.yes,disabled:!s,onClick:()=>c(!0,i.yes),children:r.approve}),Y(`button`,{type:`button`,class:`sqc-approval__btn sqc-approval__btn--no`,"aria-pressed":a===i.no,disabled:!s,onClick:()=>c(!1,i.no),children:r.reject})]})]})}function Rt({locale:e,onPick:t}){let[n,r]=U(null),i=!!t&&n===null,{confirm:a}=e.t,o=[{value:a.yesValue,label:a.yes,kind:`yes`},{value:a.noValue,label:a.no,kind:`no`}];return Y(`div`,{class:`sqc-confirm`,role:`group`,"aria-label":a.group,children:o.map(e=>Y(`button`,{type:`button`,class:`sqc-confirm__btn sqc-confirm__btn--${e.kind}`,"aria-pressed":n===e.value,disabled:!i,onClick:()=>{r(e.value),t?.(e.value)},children:e.label},e.value))})}function zt(){return Y(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.2`,"aria-hidden":`true`,children:Y(`path`,{d:`M3.5 8.5l3 3 6-7`,"stroke-linecap":`round`,"stroke-linejoin":`round`})})}function Bt({items:e,locale:t,onPick:n}){let[r,i]=U(null),a=!!n&&r===null;return Y(`div`,{class:`sqc-choices`,role:`group`,"aria-label":t.t.choices,children:e.map((e,t)=>{let o=r===null?e.checked:r===e.label;return Y(`button`,{type:`button`,class:`sqc-choice`,"aria-pressed":o,disabled:!a,onClick:()=>{i(e.label),n?.(e.label)},children:[Y(`span`,{class:`sqc-choice__box${o?` sqc-choice__box--on`:``}`,"aria-hidden":`true`,children:o&&Y(zt,{})}),Y(`span`,{class:`sqc-choice__label`,children:e.content})]},`${t}-${e.label}`)})})}var Vt=/(\*\*[^*\n]+\*\*|`[^`\n]+`|~~[^~\n]+~~|\[[^\]\n]+\]\([^)\s]+\)|\*[^*\n]+\*|https?:\/\/[^\s<>()]+)/g,Ht=/^\[([^\]\n]+)\]\(([^)\s]+)\)$/,Ut=/^(https?:|mailto:)/i;function Wt(e,t,n){return Ut.test(e)?Y(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t},n):t}function Gt(e,t){let n=e.split(Vt),r=[];return n.forEach((e,n)=>{if(!e)return;let i=`${t}-${n}`,a=Ht.exec(e);e.startsWith(`**`)&&e.endsWith(`**`)&&e.length>4?r.push(Y(`strong`,{children:e.slice(2,-2)},i)):e.startsWith("`")&&e.endsWith("`")&&e.length>2?r.push(Y(`code`,{children:e.slice(1,-1)},i)):e.startsWith(`~~`)&&e.endsWith(`~~`)&&e.length>4?r.push(Y(`del`,{children:e.slice(2,-2)},i)):a?r.push(Wt(a[2],a[1],i)):e.startsWith(`*`)&&e.endsWith(`*`)&&e.length>2?r.push(Y(`em`,{children:e.slice(1,-1)},i)):/^https?:\/\//.test(e)?r.push(Wt(e,e,i)):r.push(e)}),r}var Kt=/^\s*(?:[-*•]\s+)?\[([ xX])\]\s+(.+)$/;function qt(e){return e.replace(/\[([^\]\n]+)\]\([^)\s]+\)/g,`$1`).replace(/\*\*|~~|`|\*/g,``).trim()}var Jt=/^(\s*)[-*•]\s+/,Yt=/^(\s*)\d+[.)]\s+/,Xt=/^\s{0,3}(#{1,6})\s+(.+?)#*\s*$/,Zt=/^\s*([-*_])(?:\s*\1){2,}\s*$/,Qt=/^\s*>\s?(.*)$/,$t=/^\s*\|.*\|\s*$/,en=/^\s*\|(?:\s*:?-{1,}:?\s*\|)+\s*$/,tn=/^\s*```/;function nn(e){return e.replace(/^\s*\|/,``).replace(/\|\s*$/,``).split(`|`).map(e=>e.trim())}function rn(e,t,n,r){let i=e[t].ordered,a=[],o=t;for(;o<e.length&&e[o].depth>=n;){let t=e[o];if(t.depth===n&&t.ordered!==i)break;if(t.depth>n){let[n,i]=rn(e,o,t.depth,`${r}-${o}`),s=a[a.length-1];s?s.nested.push(n):a.push({key:`${r}-${o}`,text:null,nested:[n]}),o=i;continue}a.push({key:`${r}-${o}`,text:t.text,nested:[]}),o+=1}let s=a.map(e=>Y(`li`,{children:[e.text===null?null:Gt(e.text,e.key),e.nested]},e.key));return[Y(i?`ol`:`ul`,{children:s},r),o]}function an({text:e,locale:t,onChoice:n}){let r=e.split(`
4
+ `),i=[],a=[],o=[],s=[],c=()=>{if(!a.length)return;let e=`p${i.length}`;i.push(Y(`p`,{children:Gt(a.join(`
5
+ `),e)},e)),a=[]},l=()=>{if(!o.length)return;let e=0;for(;e<o.length;){let t=`l${i.length}`,[n,r]=rn(o,e,o[e].depth,t);i.push(n),e=r}o=[]},u=()=>{if(!s.length)return;let e=`q${i.length}`;i.push(Y(`blockquote`,{children:Gt(s.join(`
6
+ `),e)},e)),s=[]},d=()=>{c(),l(),u()};for(let e=0;e<r.length;e+=1){let f=r[e];if(tn.test(f)){d();let t=[];for(e+=1;e<r.length&&!tn.test(r[e]);)t.push(r[e]),e+=1;let n=`c${i.length}`;i.push(Y(`pre`,{children:Y(`code`,{children:t.join(`
7
+ `)})},n));continue}if($t.test(f)&&e+1<r.length&&en.test(r[e+1])){d();let t=nn(f),n=[];for(e+=2;e<r.length&&$t.test(r[e]);)n.push(nn(r[e])),e+=1;--e;let a=`t${i.length}`;i.push(Y(`div`,{class:`sqc-table`,children:Y(`table`,{children:[Y(`thead`,{children:Y(`tr`,{children:t.map((e,t)=>Y(`th`,{children:Gt(e,`${a}-h${t}`)},`${a}-h${t}`))})}),Y(`tbody`,{children:n.map((e,n)=>Y(`tr`,{children:t.map((t,r)=>Y(`td`,{children:Gt(e[r]??``,`${a}-r${n}c${r}`)},`${a}-r${n}c${r}`))},`${a}-r${n}`))})]})},a));continue}if(!f.trim()){d();continue}if(Kt.test(f)){d();let a=[];for(;e<r.length;){let t=Kt.exec(r[e]);if(!t)break;let n=t[2].trim(),o=`o${i.length}-${a.length}`;a.push({label:qt(n),checked:t[1].toLowerCase()===`x`,content:Gt(n,o)}),e+=1}--e,i.push(Y(Bt,{items:a,locale:t,onPick:n},`o${i.length}`));continue}let p=Xt.exec(f);if(p){d();let e=p[1].length,t=e<=2?`h3`:e===3?`h4`:`h5`,n=`h${i.length}`;i.push(Y(t,{children:Gt(p[2],n)},n));continue}if(Zt.test(f)){d(),i.push(Y(`hr`,{},`r${i.length}`));continue}let m=Qt.exec(f);if(m){c(),l(),s.push(m[1]);continue}let h=Jt.exec(f),g=h?null:Yt.exec(f),_=h??g;if(_){c(),u(),o.push({depth:_[1].replace(/\t/g,` `).length,ordered:!!g,text:f.slice(_[0].length)});continue}l(),u(),a.push(f)}return d(),Y(S,{children:i})}var on=80;function sn({at:e,locale:t}){let n=new Date(e);return Y(`time`,{class:`sqc-msg__time`,dateTime:n.toISOString(),children:n.toLocaleTimeString(t.tag,{hour:`2-digit`,minute:`2-digit`})})}function cn({file:e,load:t}){let[n,r]=U(null);return W(()=>{let n=null,i=!0;return t(e.id).then(e=>{i&&(n=URL.createObjectURL(e),r(n))}).catch(()=>{}),()=>{i=!1,n&&URL.revokeObjectURL(n)}},[e.id,t]),n?Y(`img`,{class:`sqc-attachment__image`,src:n,alt:e.filename}):Y(`span`,{class:`sqc-chip sqc-chip--waiting`,children:e.filename})}function ln({files:e,load:t}){return e.length===0||!t?null:Y(`div`,{class:`sqc-attachments sqc-attachments--sent`,children:e.map(e=>e.kind===`image`?Y(cn,{file:e,load:t},e.id):Y(`span`,{class:`sqc-chip`,"data-kind":`document`,children:Y(`span`,{class:`sqc-chip__name`,children:e.filename})},e.id))})}function un({message:e,locale:t,assistantName:n,onChoice:r,onDecide:i,onLoadAttachment:a}){let o=e.streaming&&!e.content,s=!!e.approval;return Y(`div`,{class:`sqc-msg sqc-msg--${e.role}${e.error?` sqc-msg--error`:``}`,children:[e.role===`assistant`&&Y(`div`,{class:`sqc-msg__who`,children:[e.agent?.avatarEmoji?Y(`span`,{class:`sqc-msg__emoji`,"aria-hidden":`true`,children:e.agent.avatarEmoji}):Y(fn,{}),e.authorName??e.agent?.name??n]}),Y(`div`,{class:`sqc-msg__bubble`,children:[o?Y(`span`,{class:`sqc-typing`,"aria-label":t.t.typing,children:[Y(`i`,{}),Y(`i`,{}),Y(`i`,{})]}):Y(`div`,{class:`sqc-msg__body`,children:[Y(an,{text:e.content,locale:t,onChoice:r}),e.streaming&&Y(`span`,{class:`sqc-caret`,"aria-hidden":`true`}),s&&Y(Lt,{locale:t,call:e.content.trim()===``?e.approval:void 0,onDecide:i}),!s&&!e.streaming&&!e.error&&Nt(e.content,t.code)&&Y(Rt,{locale:t,onPick:r}),e.unknownHandle&&!e.streaming&&Y(dn,{message:e,locale:t}),Y(ln,{files:e.attachments??[],load:a})]}),!o&&Y(sn,{at:e.createdAt,locale:t})]})]})}function dn({message:e,locale:t}){let n=e.offered??[];return Y(`p`,{class:`sqc-msg__unaddressed`,children:[Y(`span`,{children:t.t.handles.unknown}),` `,Y(`code`,{children:[`@`,e.unknownHandle]}),n.length>0&&Y(S,{children:[` `,Y(`span`,{children:t.t.handles.instead}),` `,n.map(e=>Y(`code`,{children:[`@`,e.handle]},e.handle))]})]})}function fn(){return Y(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:Y(`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`})})}function pn({messages:e,locale:t,assistantName:n,suggestions:r,showSuggestions:i,busy:a,withHuman:o,onSuggestion:s,onChoice:c,onDecide:l,onLoadAttachment:u}){let d=G(null),f=G(!0);return _e(()=>{let e=d.current;e&&f.current&&(e.scrollTop=e.scrollHeight)},[e]),W(()=>{let e=d.current;if(!e)return;let t=()=>{f.current=e.scrollHeight-e.scrollTop-e.clientHeight<on};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[]),Y(`div`,{class:`sqc-messages`,ref:d,role:`log`,"aria-live":`polite`,"aria-atomic":`false`,children:[e.map((r,i)=>Y(un,{message:r,locale:t,assistantName:n,onChoice:!a&&r.role===`assistant`&&i===e.length-1?c:void 0,onDecide:!a&&r.role===`assistant`&&i===e.length-1?l:void 0,onLoadAttachment:u},r.id)),o&&Y(`p`,{class:`sqc-with-human`,role:`status`,children:t.t.withHuman}),i&&r&&r.length>0&&Y(`div`,{class:`sqc-suggestions`,children:r.map(e=>Y(`button`,{type:`button`,class:`sqc-suggestion`,onClick:()=>s(e),children:e},e))})]})}var mn={width:`min(392px, 100vw)`},hn=new Set([`sessionId`]);function gn(e){let t=e.replace(/Id$|Ref$/,``).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim().toLowerCase();return t?t.charAt(0).toUpperCase()+t.slice(1):e}function _n(e){if(!e)return[];let t=[];for(let[n,r]of Object.entries(e)){if(hn.has(n)||typeof r!=`string`&&!Oe(r))continue;let e=De(r);e&&t.push({label:gn(n),value:e})}return t}function vn(e,t){return e?.trim()?e:t}function yn(e){let[t,n]=U(!1);return W(()=>{if(e!==`auto`||typeof matchMedia!=`function`)return;let t=matchMedia(`(prefers-color-scheme: dark)`);n(t.matches);let r=e=>n(e.matches);return t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),e===`dark`?`dark`:e===`light`?`light`:t?`dark`:`light`}function bn(e){let t=e.persistOpen??!0,[n,r]=U(()=>Be(e.defaultOpen,t)),[i,a]=U(!1),[o,s]=U(!1),c=G(null),l=G(null),u=yn(e.theme??`light`),d=K(()=>Ie(e.locale),[e.locale]),f=d.t,p=vn(e.heading,f.heading),m=vn(e.assistantName,f.assistant),h=vn(e.greeting,f.greeting),g=e.onEvent,{send:_,reset:v,decide:y,stop:b,start:x,busy:S,messages:C,withHuman:w,branding:T,sessionId:E,handles:D,addressee:O,attachments:k,uploading:A,attachmentError:j,attach:M,detach:N,loadAttachment:P}=Ct({embedKey:e.embedKey,user:e.user,getSubjectToken:e.getSubjectToken,agent:e.agent,context:e.context,greeting:h,locale:d,onEvent:g});W(()=>{!n&&C.some(e=>e.role===`assistant`&&e.id!==`greeting`)&&s(!0)},[C,n]);let F=G(n);F.current=n;let ee=q(()=>{s(!1),!F.current&&(F.current=!0,r(!0),t&&ze(!0),g?.({type:`chatbot-open`,sessionId:E}))},[g,t,E]),I=q(()=>{F.current&&(F.current=!1,r(!1),t&&ze(!1),g?.({type:`chatbot-close`,sessionId:E}),l.current?.focus())},[g,t,E]);W(()=>{n&&x()},[n,x]);let L=q(e=>{a(!0),_(e)},[_]),te=q(()=>{a(!1),s(!1),v()},[v]),R=G({openPanel:ee,closePanel:I,send:L,reset:te,sessionId:E});R.current={openPanel:ee,closePanel:I,send:L,reset:te,sessionId:E};let ne=G({open:()=>R.current.openPanel(),close:()=>R.current.closePanel(),toggle:()=>F.current?R.current.closePanel():R.current.openPanel(),reset:()=>R.current.reset(),send:e=>{R.current.openPanel(),R.current.send(e)},isOpen:()=>F.current,sessionId:()=>R.current.sessionId}),z=e.bind;_e(()=>(z?.(ne.current),()=>z?.(null)),[z]),W(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),I())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[I,n]);let re=K(()=>C.some(e=>e.id!==`greeting`),[C]),ie=K(()=>_n(e.context),[e.context]),B={...e.accent?{"--sqc-accent":e.accent}:{},"--sqc-width":e.width??mn.width};return Y(`div`,{class:`sqc`,"data-theme":u,"data-position":e.position??`bottom-right`,"data-layout":e.layout??`sidebar`,"data-open":n?`true`:`false`,style:B,children:[Y(`button`,{ref:l,type:`button`,class:`sqc-launcher`,"aria-label":p,"aria-expanded":n,"aria-haspopup":`dialog`,onClick:ee,children:[Y(`span`,{class:`sqc-launcher__icon`,children:Y(`slot`,{name:`launcher-icon`,class:`sqc-slot-icon`,children:Y(fn,{})})}),o&&Y(`span`,{class:`sqc-launcher__badge`,"aria-hidden":`true`})]}),Y(`aside`,{ref:c,class:`sqc-panel`,role:`dialog`,"aria-modal":`false`,"aria-label":p,...n?{}:{inert:!0},children:[Y(`header`,{class:`sqc-header`,children:[Y(`span`,{class:`sqc-header__icon`,"aria-hidden":`true`,children:Y(fn,{})}),Y(`div`,{class:`sqc-header__titles`,children:[Y(`p`,{class:`sqc-header__heading`,children:p}),Y(`p`,{class:`sqc-header__sub`,children:vn(e.subheading,f.subheading)})]}),Y(`button`,{type:`button`,class:`sqc-icon-btn`,onClick:te,"aria-label":f.newConversation,"data-tip":f.newConversation,children:Y(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,children:Y(`path`,{d:`M20 12a8 8 0 1 1-2.6-5.9M20 4v4h-4`,"stroke-linecap":`round`})})}),Y(`button`,{type:`button`,class:`sqc-icon-btn`,onClick:I,"aria-label":f.close,"data-tip":f.closeTitle,children:Y(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,children:Y(`path`,{d:`M6 6l12 12M18 6L6 18`,"stroke-linecap":`round`})})})]}),ie.length>0&&Y(`div`,{class:`sqc-context`,"aria-label":f.context.region,children:ie.map(e=>Y(`span`,{class:`sqc-chip`,title:`${e.label}: ${e.value}`,children:[Y(`b`,{children:e.label}),e.value]},e.label))}),Y(pn,{messages:C,locale:d,assistantName:m,suggestions:e.suggestions,showSuggestions:!i&&!re,busy:S,withHuman:w,onSuggestion:L,onChoice:L,onDecide:y,onLoadAttachment:P}),Y(kt,{placeholder:vn(e.placeholder,f.placeholder),locale:d,busy:S,autoFocus:n,handles:D,addressee:O,attachments:k,uploading:A,attachmentError:j?f.attachments[j]:void 0,onAttach:M,onDetach:N,onSend:L,onStop:b}),Y(`p`,{class:`sqc-hint`,children:f.hint}),T&&Y(`p`,{class:`sqc-powered`,children:Y(`a`,{href:`https://squadico.com`,target:`_blank`,rel:`noopener noreferrer`,children:f.poweredBy})})]})]})}var xn=`:host{--sqc-width:min(392px, 100vw);--sqc-height:640px;--sqc-z:2147480000;--sqc-radius:16px;--sqc-font-family:"Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--sqc-font-heading:var(--sqc-font-family);z-index:var(--sqc-z);pointer-events:none;font-family:var(--sqc-font-family);-webkit-font-smoothing:antialiased;text-align:left;font-size:14px;line-height:1.5;display:block;position:fixed;top:0;bottom:0;left:0;right:0;margin:0!important}:host([hidden]){display:none}.sqc{--sqc-neutral-50:#f8fafc;--sqc-neutral-100:#f1f5f9;--sqc-neutral-200:#e2e8f0;--sqc-neutral-300:#cbd5e1;--sqc-neutral-400:#94a3b8;--sqc-neutral-500:#64748b;--sqc-neutral-600:#475569;--sqc-neutral-900:#0f172a;--sqc-error-50:#fff1f2;--sqc-error-100:#ffe4e6;--sqc-error-600:#e11d48;--sqc-accent-default:#000;--sqc-accent-color:var(--sqc-accent,var(--sqc-accent-default));--sqc-on-accent:#fff;--sqc-accent-hover:color-mix(in oklab, var(--sqc-accent-color) 84%, var(--sqc-on-accent));--sqc-accent-fg:var(--sqc-accent,var(--sqc-text));--sqc-bg:#fff;--sqc-surface:var(--sqc-neutral-50);--sqc-selected:var(--sqc-neutral-100);--sqc-border:var(--sqc-neutral-200);--sqc-border-strong:var(--sqc-neutral-300);--sqc-text:var(--sqc-neutral-900);--sqc-text-muted:var(--sqc-neutral-500);--sqc-link:#2563eb;--sqc-bubble-user:var(--sqc-accent-color);--sqc-bubble-user-text:var(--sqc-on-accent);--sqc-code-bg:var(--sqc-neutral-100);--sqc-disabled:var(--sqc-neutral-300);--sqc-shadow:0 10px 15px -3px #0f172a1a, 0 4px 6px -4px #0f172a1a;--sqc-shadow-bottom:0 6px 8px -6px #0f172a2e;--sqc-focus:0 0 0 2px var(--sqc-bg), 0 0 0 4px #0f172a4d;--sqc-focus-input:0 0 0 3px #0f172a1a;--sqc-danger:var(--sqc-error-600);color:var(--sqc-text);position:absolute;top:0;bottom:0;left:0;right:0}.sqc[data-theme=dark]{--sqc-neutral-50:#172033;--sqc-neutral-100:#1e293b;--sqc-neutral-200:#334155;--sqc-neutral-300:#475569;--sqc-neutral-400:#64748b;--sqc-neutral-500:#94a3b8;--sqc-neutral-600:#cbd5e1;--sqc-neutral-900:#f8fafc;--sqc-error-50:#2a0a12;--sqc-error-100:#4c0519;--sqc-error-600:#fb7185;--sqc-accent-default:#fff;--sqc-on-accent:#0f172a;--sqc-bg:#0f172a;--sqc-link:#60a5fa;--sqc-code-bg:#020617;--sqc-shadow:0 10px 24px -4px #0000008c;--sqc-shadow-bottom:0 6px 8px -6px #0000008c;--sqc-focus:0 0 0 2px var(--sqc-bg), 0 0 0 4px #f8fafc59;--sqc-focus-input:0 0 0 3px #f8fafc1f}@supports (color:oklch(from red l c h)){.sqc{--sqc-on-accent:oklch(from var(--sqc-accent-color) clamp(.208, (.62 - l) * 1000, 1) 0 0)}}.sqc *,.sqc :before,.sqc :after{box-sizing:border-box}.sqc-launcher{background:var(--sqc-accent-color);width:56px;height:56px;color:var(--sqc-on-accent);cursor:pointer;pointer-events:auto;box-shadow:var(--sqc-shadow);border:none;border-radius:50%;place-items:center;padding:0;transition:transform .18s,opacity .18s,background .18s,box-shadow .18s;display:grid;position:absolute;bottom:24px;right:24px}.sqc[data-position=bottom-left] .sqc-launcher{left:24px;right:auto}.sqc-launcher:hover{background:var(--sqc-accent-hover);transform:scale(1.06)}.sqc-launcher:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc[data-open=true] .sqc-launcher{opacity:0;pointer-events:none;transform:scale(.5)}.sqc-launcher__icon svg{width:26px;height:26px;display:block}.sqc-slot-icon::slotted(*){justify-content:center;align-items:center;width:26px;height:26px;display:inline-flex}.sqc-launcher__badge{background:var(--sqc-error-600);border:2px solid var(--sqc-bg);border-radius:50%;width:12px;height:12px;position:absolute;top:6px;right:6px}.sqc-panel{width:var(--sqc-width);background:var(--sqc-bg);border-left:1px solid var(--sqc-border);box-shadow:var(--sqc-shadow);pointer-events:auto;visibility:hidden;flex-direction:column;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility 0s linear .26s;display:flex;position:absolute;top:0;bottom:0;right:0;transform:translate(100%)}.sqc[data-open=true] .sqc-panel{visibility:visible;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility;transform:translate(0)}.sqc[data-layout=floating] .sqc-panel{max-width:calc(100% - 48px);height:var(--sqc-height);border:1px solid var(--sqc-border);border-radius:var(--sqc-radius);opacity:0;transform-origin:100% 100%;max-height:calc(100% - 48px);transition:transform .22s cubic-bezier(.22,1,.36,1),opacity .22s,visibility 0s linear .22s;top:auto;bottom:24px;right:24px;overflow:hidden;transform:translateY(16px)scale(.96)}.sqc[data-layout=floating][data-position=bottom-left] .sqc-panel{transform-origin:0 100%;left:24px;right:auto}.sqc[data-layout=floating][data-open=true] .sqc-panel{opacity:1;transition:transform .22s cubic-bezier(.22,1,.36,1),opacity .22s,visibility;transform:none}.sqc-header{background:var(--sqc-bg);color:var(--sqc-text);border-bottom:1px solid var(--sqc-border);flex-shrink:0;align-items:center;gap:8px;padding:13px 12px 13px 16px;display:flex}.sqc-header__icon{color:var(--sqc-accent-fg);flex-shrink:0;place-items:center;display:grid}.sqc-header__icon svg{width:17px;height:17px;display:block}.sqc-header__titles{flex:1;min-width:0}.sqc-header__heading,.sqc-header__sub{text-overflow:ellipsis;white-space:nowrap;margin:0;overflow:hidden}.sqc-header__heading{font-family:var(--sqc-font-heading);letter-spacing:-.2px;font-size:15px;font-weight:700}.sqc-header__sub{color:var(--sqc-text-muted);font-size:12px}.sqc-icon-btn{width:26px;height:26px;color:var(--sqc-text-muted);cursor:pointer;background:0 0;border:none;border-radius:8px;flex-shrink:0;place-items:center;transition:background .15s;display:grid}.sqc-icon-btn:hover{background:var(--sqc-surface);color:var(--sqc-text)}.sqc-icon-btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-icon-btn svg{width:16px;height:16px}.sqc-icon-btn[data-tip]{position:relative}.sqc-icon-btn[data-tip]:after{content:attr(data-tip);z-index:6;background:var(--sqc-text);color:var(--sqc-bg);font-family:var(--sqc-font-family);white-space:nowrap;pointer-events:none;opacity:0;border-radius:8px;padding:4px 8px;font-size:11px;font-weight:500;line-height:1.3;transition:opacity .12s .15s;position:absolute;top:calc(100% + 6px);right:0}.sqc-icon-btn[data-tip]:hover:after{opacity:1}.sqc-icon-btn[data-tip]:focus-visible:after{opacity:1}.sqc-history-pop{z-index:5;position:absolute;top:54px;left:0;right:0}.sqc-history{background:var(--sqc-bg);max-height:320px;box-shadow:var(--sqc-shadow-bottom);flex-direction:column;display:flex;overflow-y:auto}.sqc-history__empty{color:var(--sqc-text-muted);text-align:center;margin:0;padding:14px 16px;font-size:12px}.sqc-history__item{border:none;border-bottom:1px solid var(--sqc-border);width:100%;color:var(--sqc-text);text-align:left;cursor:pointer;background:0 0;flex-direction:column;gap:2px;padding:10px 16px;transition:background .15s;display:flex}.sqc-history__item:last-child{border-bottom:none}.sqc-history__item:hover{background:var(--sqc-surface)}.sqc-history__item:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-history__item[aria-current=true]{background:var(--sqc-selected)}.sqc-history__item[aria-current=true] .sqc-history__title{color:var(--sqc-text);font-weight:600}.sqc-history__title{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.sqc-history__date{color:var(--sqc-text-muted);font-size:11px}.sqc-context{background:var(--sqc-selected);border:1px solid var(--sqc-border);color:var(--sqc-text);border-radius:12px;flex-wrap:wrap;flex-shrink:0;align-items:center;gap:8px;margin:12px 16px 4px;padding:8px 11px;font-size:12px;display:flex}.sqc-chip{text-overflow:ellipsis;white-space:nowrap;align-items:baseline;gap:4px;max-width:100%;display:inline-flex;overflow:hidden}.sqc-chip b{font-weight:600}.sqc-chip:not(:last-child):after{content:"·";opacity:.5;margin-left:4px}.sqc-messages{overscroll-behavior:contain;background:var(--sqc-bg);scrollbar-width:thin;scrollbar-color:var(--sqc-neutral-300) transparent;flex-direction:column;flex:1;gap:13px;min-height:0;padding:12px 16px;display:flex;overflow-y:auto}.sqc-messages::-webkit-scrollbar{width:6px}.sqc-messages::-webkit-scrollbar-thumb{background:var(--sqc-neutral-300);border-radius:99px}.sqc-msg{flex-direction:column;max-width:93%;font-size:13.5px;display:flex}.sqc-msg--assistant{align-self:flex-start}.sqc-msg--user{align-self:flex-end}.sqc-msg__who{color:var(--sqc-text-muted);align-items:center;gap:6px;margin-bottom:4px;font-size:11px;font-weight:500;display:flex}.sqc-msg__who svg{width:12px;height:12px;color:var(--sqc-accent-fg);flex-shrink:0}.sqc-msg__unaddressed{color:var(--sqc-text-muted);margin:8px 0 0;font-size:11.5px;line-height:1.5}.sqc-msg__unaddressed code{background:var(--sqc-code-bg);color:var(--sqc-text);border-radius:4px;margin-right:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px}.sqc-msg--user .sqc-msg__bubble{background:var(--sqc-bubble-user);color:var(--sqc-bubble-user-text);border-radius:var(--sqc-radius) var(--sqc-radius) 4px var(--sqc-radius);padding:9px 13px}.sqc-msg--error .sqc-msg__bubble{background:var(--sqc-error-50);color:var(--sqc-error-600);border:1px solid var(--sqc-error-100);border-radius:12px;padding:11px}.sqc-msg__body{overflow-wrap:anywhere}.sqc-msg--assistant .sqc-msg__body{font-size:14px;line-height:1.6}.sqc-msg__body>:first-child{margin-top:0}.sqc-msg__body>:last-child{margin-bottom:0}.sqc-msg__body p{white-space:pre-wrap;margin:0 0 8px}.sqc-msg__body ul,.sqc-msg__body ol{margin:0 0 8px;padding-left:20px}.sqc-msg__body li{margin-bottom:3px}.sqc-msg__body code{background:var(--sqc-code-bg);border-radius:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.85em}.sqc-msg--user .sqc-msg__body code{background:#ffffff38}.sqc-msg__body pre{background:var(--sqc-code-bg);border-radius:8px;margin:0 0 8px;padding:9px 11px;overflow-x:auto}.sqc-msg__body pre code{background:0 0;padding:0}.sqc-msg__body a{color:inherit;text-underline-offset:2px;text-decoration:underline}.sqc-msg--assistant .sqc-msg__body a{color:var(--sqc-link);text-decoration:none}.sqc-msg--assistant .sqc-msg__body a:hover{text-decoration:underline}.sqc-msg__body h3,.sqc-msg__body h4,.sqc-msg__body h5,.sqc-msg__body h6{font-family:var(--sqc-font-heading);letter-spacing:-.2px;margin:12px 0 6px;font-weight:700;line-height:1.3}.sqc-msg__body h3{font-size:1.05em}.sqc-msg__body h4{font-size:1em}.sqc-msg__body h5,.sqc-msg__body h6{font-size:.94em}.sqc-msg__body ul ul,.sqc-msg__body ul ol,.sqc-msg__body ol ul,.sqc-msg__body ol ol{margin:3px 0 0}.sqc-msg__body blockquote{border-left:2px solid var(--sqc-border-strong);color:var(--sqc-text-muted);white-space:pre-wrap;margin:0 0 8px;padding:2px 0 2px 10px}.sqc-msg--user .sqc-msg__body blockquote{color:inherit;opacity:.85;border-left-color:#ffffff73}.sqc-msg__body hr{border:0;border-top:1px solid var(--sqc-border);margin:10px 0}.sqc-msg--user .sqc-msg__body hr{border-top-color:#ffffff4d}.sqc-msg__body del{opacity:.7}.sqc-approval{flex-direction:column;gap:8px;margin:11px 0 2px;display:flex}.sqc-approval__actions{flex-wrap:wrap;gap:8px;display:flex}.sqc-approval__request{color:var(--sqc-text);margin:0;font-size:13px}.sqc-approval__args{border:1px solid var(--sqc-border);background:var(--sqc-surface);border-radius:12px;flex-direction:column;gap:4px;margin:0;padding:8px 10px;font-size:12px;display:flex}.sqc-approval__arg{gap:8px;display:flex}.sqc-approval__arg-name{color:var(--sqc-text-muted);flex:none;font-weight:500}.sqc-approval__arg-value{overflow-wrap:anywhere;min-width:0;color:var(--sqc-text);margin:0}.sqc-approval__btn{height:32px;font-family:var(--sqc-font-family);border:1px solid var(--sqc-border);background:var(--sqc-bg);color:var(--sqc-text);cursor:pointer;border-radius:12px;flex:auto;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:500;transition:border-color .12s,background .12s;display:inline-flex}.sqc-approval__btn--yes:not(:disabled),.sqc-approval__btn--send:not(:disabled){background:var(--sqc-accent-color);color:var(--sqc-on-accent);border-color:#0000;font-weight:600}.sqc-approval__btn:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-approval__btn--yes:hover:not(:disabled),.sqc-approval__btn--send:hover:not(:disabled){background:var(--sqc-accent-hover);border-color:#0000}.sqc-approval__btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-approval__btn:disabled{cursor:default}.sqc-approval__btn:disabled[aria-pressed=false]{opacity:.45}.sqc-approval__btn[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected);color:var(--sqc-text);font-weight:600}.sqc-approval__edit{flex-direction:column;gap:8px;display:flex}.sqc-approval__input{width:100%;font-family:var(--sqc-font-family);color:var(--sqc-text);background:var(--sqc-bg);border:1px solid var(--sqc-border-strong);resize:vertical;border-radius:12px;padding:8px 10px;font-size:13px;line-height:1.4}.sqc-approval__input:focus-visible{border-color:var(--sqc-text);box-shadow:var(--sqc-focus-input);outline:none}.sqc-approval__btn--send{flex:none;align-self:flex-end}.sqc-confirm{gap:8px;margin:11px 0 2px;display:flex}.sqc-confirm__btn{height:32px;font-family:var(--sqc-font-family);border:1px solid var(--sqc-border);background:var(--sqc-bg);color:var(--sqc-text);cursor:pointer;border-radius:12px;flex:1 1 0;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:500;transition:border-color .12s,background .12s;display:inline-flex}.sqc-confirm__btn--yes:not(:disabled){background:var(--sqc-accent-color);color:var(--sqc-on-accent);border-color:#0000;font-weight:600}.sqc-confirm__btn:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-confirm__btn--yes:hover:not(:disabled){background:var(--sqc-accent-hover);border-color:#0000}.sqc-confirm__btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-confirm__btn:disabled{cursor:default}.sqc-confirm__btn:disabled[aria-pressed=false]{opacity:.45}.sqc-confirm__btn[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected);color:var(--sqc-text);font-weight:600}.sqc-choices{flex-direction:column;gap:7px;margin:10px 0 2px;display:flex}.sqc-choice{width:100%;font-family:var(--sqc-font-family);text-align:left;color:var(--sqc-text);background:var(--sqc-bg);border:1px solid var(--sqc-border);cursor:pointer;border-radius:12px;align-items:center;gap:8px;padding:8px 11px;font-size:12.5px;transition:border-color .12s,background .12s;display:flex}.sqc-choice:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-choice:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-choice:disabled{cursor:default}.sqc-choice:disabled[aria-pressed=false]{opacity:.55}.sqc-choice[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected)}.sqc-choice__box{border:1.5px solid var(--sqc-border-strong);border-radius:4px;flex:none;justify-content:center;align-items:center;width:15px;height:15px;display:inline-flex}.sqc-choice__box--on{color:var(--sqc-on-accent);background:var(--sqc-accent-color);border-color:var(--sqc-accent-color)}.sqc-choice__box svg{width:11px;height:11px}.sqc-choice__label{overflow-wrap:anywhere}.sqc-choice__detail{color:var(--sqc-text-muted);margin-top:1px;font-size:11.5px;display:block}.sqc-selection{flex-direction:column;gap:10px;margin:2px 0;display:flex}.sqc-selection__question{flex-direction:column;gap:2px;display:flex}.sqc-selection__ask{font-family:var(--sqc-font-family);color:var(--sqc-text);margin:0;font-size:13px;font-weight:600}.sqc-selection__actions{display:flex}.sqc-selection__validate{height:32px;font-family:var(--sqc-font-family);color:var(--sqc-on-accent);background:var(--sqc-accent-color);cursor:pointer;border:1px solid #0000;border-radius:12px;flex:auto;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:600;transition:filter .12s,background .12s;display:inline-flex}.sqc-selection__validate:hover:not(:disabled){background:var(--sqc-accent-hover)}.sqc-selection__validate:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-selection__validate:disabled{cursor:not-allowed;color:#fff;background:var(--sqc-disabled)}.sqc-selection__hint{font-family:var(--sqc-font-family);color:var(--sqc-text-muted);margin:0;font-size:11.5px}.sqc-table{scrollbar-width:thin;margin:0 0 8px;overflow-x:auto}.sqc-table table{border-collapse:collapse;min-width:100%;font-family:var(--sqc-font-family);white-space:nowrap;font-size:12.5px}.sqc-table th,.sqc-table td{text-align:left;vertical-align:top;border-bottom:1px solid var(--sqc-border);padding:6px 10px 6px 0}.sqc-table thead th{text-transform:uppercase;letter-spacing:.05em;color:var(--sqc-text-muted);font-size:10.5px;font-weight:600}.sqc-table tbody th{font-weight:500}.sqc-msg--user .sqc-table th,.sqc-msg--user .sqc-table td{border-bottom-color:#ffffff40}.sqc-msg--user .sqc-table thead th{color:#fffc}.sqc-table tbody tr:last-child th,.sqc-table tbody tr:last-child td{border-bottom:0}.sqc-msg__time{color:var(--sqc-text-muted);font-variant-numeric:tabular-nums;margin-top:3px;font-size:10px;display:block}.sqc-msg--user .sqc-msg__time{color:#ffffffb3;text-align:right}.sqc-caret{vertical-align:text-bottom;background:currentColor;width:2px;height:1em;margin-left:2px;animation:1s step-end infinite sqc-blink;display:inline-block}@keyframes sqc-blink{0%,to{opacity:1}50%{opacity:0}}.sqc-typing{gap:3px;padding:2px 0;display:inline-flex}.sqc-typing i{background:var(--sqc-neutral-400);border-radius:50%;width:5px;height:5px;animation:1.2s infinite sqc-pulse}.sqc-typing i:nth-child(2){animation-delay:.2s}.sqc-typing i:nth-child(3){animation-delay:.4s}@keyframes sqc-pulse{0%,60%,to{opacity:.25}30%{opacity:1}}.sqc-suggestions{flex-direction:column;gap:7px;display:flex}.sqc-suggestion{border:1px solid var(--sqc-border);background:var(--sqc-bg);width:100%;color:var(--sqc-text);font-family:var(--sqc-font-family);cursor:pointer;text-align:left;border-radius:12px;align-items:center;gap:8px;padding:8px 11px;font-size:12.5px;transition:background .15s,border-color .15s;display:flex}.sqc-suggestion:before{content:"";background:var(--sqc-accent-fg);border-radius:50%;flex:none;width:5px;height:5px}.sqc-suggestion:hover{background:var(--sqc-surface);border-color:var(--sqc-border-strong)}.sqc-suggestion:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-composer{border-top:1px solid var(--sqc-border);background:var(--sqc-bg);flex-wrap:wrap;flex-shrink:0;align-items:flex-end;gap:8px;padding:12px 14px;display:flex}.sqc-composer--dropping{outline:2px dashed var(--sqc-accent-color);outline-offset:-4px}.sqc-attachments{flex-wrap:wrap;flex-basis:100%;gap:6px;display:flex}.sqc-attachments--sent{margin-top:8px}.sqc-chip{border:1px solid var(--sqc-border);background:var(--sqc-selected);max-width:100%;color:var(--sqc-text);border-radius:999px;align-items:center;gap:4px;padding:3px 4px 3px 10px;font-size:12px;display:inline-flex}.sqc-chip--waiting{opacity:.6;padding-right:10px}.sqc-chip__name{text-overflow:ellipsis;white-space:nowrap;max-width:180px;overflow:hidden}.sqc-chip__remove{width:18px;height:18px;color:var(--sqc-text-muted);cursor:pointer;background:0 0;border:0;border-radius:999px;justify-content:center;align-items:center;padding:0;font-size:14px;line-height:1;display:inline-flex}.sqc-chip__remove:hover{background:var(--sqc-selected);color:var(--sqc-text)}.sqc-attachments__error{color:var(--sqc-error-600);flex-basis:100%;margin:0;font-size:12px}.sqc-attachment__image{border-radius:12px;max-width:100%;max-height:180px;display:block}.sqc-file-input{display:none}.sqc-btn--attach{color:var(--sqc-text-muted);background:0 0}.sqc-btn--attach:hover{background:var(--sqc-selected);color:var(--sqc-text)}.sqc-composer__field{flex:1;min-width:0;position:relative}.sqc-composer__input{border:1px solid var(--sqc-border-strong);background:var(--sqc-bg);width:100%;min-height:38px;max-height:132px;color:var(--sqc-text);font-family:var(--sqc-font-family);resize:none;border-radius:12px;outline:none;padding:9px 12px;font-size:13.5px;line-height:1.4;transition:border-color .15s,box-shadow .15s;display:block;overflow-y:hidden}.sqc-composer__input::placeholder{color:var(--sqc-neutral-400)}.sqc-composer__input:focus{border-color:var(--sqc-text);box-shadow:var(--sqc-focus-input)}.sqc-mentions{z-index:2;border:1px solid var(--sqc-border);background:var(--sqc-bg);max-height:184px;box-shadow:var(--sqc-shadow);scrollbar-width:thin;border-radius:12px;margin:0;padding:4px;list-style:none;position:absolute;bottom:calc(100% + 6px);left:0;right:0;overflow-y:auto}.sqc-mention{cursor:pointer;color:var(--sqc-text);border-radius:8px;align-items:baseline;gap:6px;padding:6px 8px;font-size:12.5px;display:flex}.sqc-mention--active{background:var(--sqc-neutral-100)}.sqc-mention__icon{flex-shrink:0}.sqc-mention__handle{font-weight:600}.sqc-mention__name{text-overflow:ellipsis;white-space:nowrap;color:var(--sqc-text-muted);overflow:hidden}.sqc-composer__count{color:var(--sqc-text-muted);pointer-events:none;font-variant-numeric:tabular-nums;font-size:10px;position:absolute;bottom:4px;right:8px}.sqc-btn{cursor:pointer;border:none;border-radius:12px;flex-shrink:0;place-items:center;width:38px;height:38px;transition:background .15s,opacity .15s;display:grid}.sqc-btn svg{width:17px;height:17px}.sqc-btn--send{background:var(--sqc-accent-color);color:var(--sqc-on-accent)}.sqc-btn--send:hover:not(:disabled){background:var(--sqc-accent-hover)}.sqc-btn--send:disabled{background:var(--sqc-disabled);color:#fff;cursor:not-allowed}.sqc-btn--stop{background:var(--sqc-bg);color:var(--sqc-text);border:1px solid var(--sqc-border)}.sqc-btn--stop:hover{border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-hint{padding:0 16px max(9px, env(safe-area-inset-bottom));color:var(--sqc-text-muted);text-align:center;flex-shrink:0;margin:0;font-size:10.5px;line-height:1.35}.sqc-powered{padding:0 16px max(9px, env(safe-area-inset-bottom));text-align:center;flex-shrink:0;margin:0;font-size:10.5px;line-height:1.35}.sqc-powered a{color:var(--sqc-text-muted);text-decoration:none}.sqc-powered a:hover{text-decoration:underline}@media (max-width:520px){.sqc{--sqc-width:100vw}.sqc-panel{border-left:none}.sqc-launcher{bottom:16px;right:16px}.sqc[data-position=bottom-left] .sqc-launcher{left:16px}.sqc[data-layout=floating] .sqc-panel,.sqc[data-layout=floating][data-position=bottom-left] .sqc-panel{border:none;border-radius:0;max-width:none;height:auto;max-height:none;top:0;bottom:0;left:0;right:0}}@media (prefers-reduced-motion:reduce){.sqc-launcher,.sqc-panel,.sqc-btn,.sqc-suggestion,.sqc-choice,.sqc-confirm__btn,.sqc-icon-btn,.sqc-icon-btn[data-tip]:after{transition:none}.sqc-typing i,.sqc-caret{animation:none}}.sqc-with-human{border:1px solid var(--sqc-border);background:var(--sqc-selected);color:var(--sqc-neutral-600);border-radius:12px;margin:8px 0 0;padding:8px 12px;font-size:13px}`;function Sn(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function Cn(e,t){Sn(e,t),t.add(e)}function X(e,t,n){Sn(e,t),t.set(e,n)}function Z(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function Q(e,t,n){return e.set(Z(e,t),n),n}function $(e,t){return e.get(Z(e,t))}var wn=`squadico-chatbot`,Tn=[`embed-key`,`context`,`user`,`agent`,`heading`,`subheading`,`assistant-name`,`placeholder`,`greeting`,`suggestions`,`width`,`accent`,`theme`,`position`,`layout`,`open`,`persist-open`,`locale`],En;function Dn(){if(En!==void 0)return En;try{let e=new CSSStyleSheet;e.replaceSync(xn),En=e}catch{En=null}return En}function On(e,t){typeof console<`u`&&console.warn(`[${wn}] ${e}`,t??``)}function kn(e){if(!(!e||!e.trim()))try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t;if(typeof e.id==`string`&&e.id)return{id:e.id,name:typeof e.name==`string`&&e.name?e.name:void 0,digest:typeof e.digest==`string`&&e.digest?e.digest:void 0}}On(`the "user" attribute needs an object with an id`,e)}catch(e){On(`the "user" attribute is not valid JSON`,e)}}function An(e){if(!(!e||!e.trim()))try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t;On("the `context` attribute must be a JSON object",e)}catch(e){On("the `context` attribute is not valid JSON",e)}}function jn(e){if(!(!e||!e.trim())){if(e.trim().startsWith(`[`))try{let t=JSON.parse(e);if(Array.isArray(t))return t.map(String)}catch(e){On("the `suggestions` attribute is not valid JSON",e);return}return e.split(`|`).map(e=>e.trim()).filter(Boolean)}}function Mn(e){if(e!==null)return e!==`false`&&e!==`0`}function Nn(e){return e===`dark`||e===`light`||e===`auto`?e:void 0}function Pn(e){return e===`bottom-left`||e===`bottom-right`?e:void 0}function Fn(e){return e===`floating`||e===`sidebar`?e:void 0}var In=[`context`,`embedKey`,`user`,`getSubjectToken`,`agent`];function Ln(){var e,t,n,r,i,a,o,s,c,l,u,d,f,p;return t=new WeakMap,n=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakSet,f=new WeakMap,p=new WeakMap,e=class extends HTMLElement{constructor(){super(),Cn(this,d),X(this,t,void 0),X(this,n,null),X(this,r,!1),X(this,i,!1),X(this,a,``),X(this,o,void 0),X(this,s,void 0),X(this,c,void 0),X(this,l,void 0),X(this,u,void 0),X(this,f,e=>{let{type:t,...n}=e;Q(a,this,n.sessionId),this.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0}))}),X(this,p,e=>{Q(n,this,e),e&&Q(a,this,e.sessionId())});let e=this.attachShadow({mode:`open`}),m=Dn();if(m)e.adoptedStyleSheets=[m];else{let t=document.createElement(`style`);t.textContent=xn,e.append(t)}Q(t,this,document.createElement(`div`)),e.append($(t,this));for(let e of In){if(!Object.hasOwn(this,e))continue;let t=this[e];delete this[e],this[e]=t}}connectedCallback(){Q(i,this,!0),Z(d,this,h).call(this)}disconnectedCallback(){Q(i,this,!1),ie(null,$(t,this)),Q(n,this,null)}attributeChangedCallback(e,t,r){if(t!==r){if(e===`open`&&$(n,this)){Mn(r)?$(n,this).open():$(n,this).close();return}Z(d,this,m).call(this)}}get context(){return $(o,this)??An(this.getAttribute(`context`))}set context(e){Q(o,this,e),Z(d,this,m).call(this)}get embedKey(){return $(u,this)??this.getAttribute(`embed-key`)??void 0}set embedKey(e){Q(u,this,e),Z(d,this,m).call(this)}get user(){return $(s,this)??kn(this.getAttribute(`user`))}set user(e){Q(s,this,e),Z(d,this,m).call(this)}get getSubjectToken(){return $(c,this)}set getSubjectToken(e){Q(c,this,e),Z(d,this,m).call(this)}get agent(){return $(l,this)??this.getAttribute(`agent`)??void 0}set agent(e){Q(l,this,e),Z(d,this,m).call(this)}get open(){return $(n,this)?.isOpen()??Mn(this.getAttribute(`open`))??!1}set open(e){e?this.openChat():this.closeChat()}get sessionId(){return $(n,this)?.sessionId()??$(a,this)}openChat(){$(n,this)?.open()}closeChat(){$(n,this)?.close()}toggleChat(){$(n,this)?.toggle()}reset(){$(n,this)?.reset()}sendMessage(e){if(!$(n,this)){On(`sendMessage() called before the component was mounted — ignored`);return}$(n,this).send(e)}},Ge(e,`observedAttributes`,Tn),e;function m(){$(r,this)||!$(i,this)||(Q(r,this,!0),queueMicrotask(()=>{Q(r,this,!1),$(i,this)&&Z(d,this,h).call(this)}))}function h(){let e=e=>this.getAttribute(e)??void 0;ie(Y(bn,{embedKey:this.embedKey,context:this.context,user:this.user,getSubjectToken:this.getSubjectToken,agent:this.agent,heading:e(`heading`),subheading:e(`subheading`),assistantName:e(`assistant-name`),placeholder:e(`placeholder`),greeting:e(`greeting`),suggestions:jn(this.getAttribute(`suggestions`)),width:e(`width`),accent:e(`accent`),theme:Nn(this.getAttribute(`theme`)),position:Pn(this.getAttribute(`position`)),layout:Fn(this.getAttribute(`layout`)),defaultOpen:Mn(this.getAttribute(`open`))??!1,persistOpen:Mn(this.getAttribute(`persist-open`))??!0,locale:e(`locale`),onEvent:$(f,this),bind:$(p,this)}),$(t,this))}}var Rn;function zn(e=wn){typeof window>`u`||typeof HTMLElement>`u`||(Rn??(Rn=Ln()),window.customElements.get(e)||window.customElements.define(e,Rn))}zn(),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return zn}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return wn}});
8
+ //# sourceMappingURL=src-DNagSAPN.cjs.map