@helpai/elements 0.8.1 → 0.9.0
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/elements-web-component.esm.js +12 -12
- package/elements-web-component.esm.js.map +3 -3
- package/elements.cjs.js +12 -12
- package/elements.cjs.js.map +3 -3
- package/elements.esm.js +12 -12
- package/elements.esm.js.map +3 -3
- package/elements.js +13 -13
- package/elements.js.map +3 -3
- package/index.d.ts +1 -1
- package/index.mjs +3 -1
- package/package.json +1 -1
- package/schema.d.ts +35 -35
- package/web-component.mjs +3 -1
package/elements.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Nt=Object.defineProperty;var qs=Object.getOwnPropertyDescriptor;var Xs=Object.getOwnPropertyNames;var js=Object.prototype.hasOwnProperty;var Ys=(e,t,n)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Js=(e,t)=>{for(var n in t)Nt(e,n,{get:t[n],enumerable:!0})},Qs=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xs(t))!js.call(e,i)&&i!==n&&Nt(e,i,{get:()=>t[i],enumerable:!(o=qs(t,i))||o.enumerable});return e};var Zs=e=>Qs(Nt({},"__esModule",{value:!0}),e);var F=(e,t,n)=>Ys(e,typeof t!="symbol"?t+"":t,n);var b_={};Js(b_,{HOOK_WILDCARD:()=>Hn,brand:()=>v_,destroy:()=>p_,getAllInstances:()=>g_,getInstance:()=>f_,hook:()=>m_,init:()=>u_,mount:()=>Cs,resolveInitialHostMode:()=>As,version:()=>h_});module.exports=Zs(b_);var zt,H,xr,to,De,mr,yr,Pr,Jn,Dt,ft,Sr,no,Qn,Zn,el,$t={},Bt=[],tl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ft=Array.isArray;function Te(e,t){for(var n in t)e[n]=t[n];return e}function oo(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Wt(e,t,n){var o,i,a,s={};for(a in t)a=="key"?o=t[a]:a=="ref"?i=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?zt.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return Ht(e,s,o,i,null)}function Ht(e,t,n,o,i){var a={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++xr,__i:-1,__u:0};return i==null&&H.vnode!=null&&H.vnode(a),a}function te(e){return e.children}function He(e,t){this.props=e,this.context=t}function Je(e,t){if(t==null)return e.__?Je(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"?Je(e):null}function nl(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],i=[],a=Te({},t);a.__v=t.__v+1,H.vnode&&H.vnode(a),ro(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??Je(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,Cr(o,a,i),t.__e=t.__=null,a.__e!=n&&wr(a)}}function wr(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}),wr(e)}function hr(e){(!e.__d&&(e.__d=!0)&&De.push(e)&&!Ut.__r++||mr!=H.debounceRendering)&&((mr=H.debounceRendering)||yr)(Ut)}function Ut(){try{for(var e,t=1;De.length;)De.length>t&&De.sort(Pr),e=De.shift(),t=De.length,nl(e)}finally{De.length=Ut.__r=0}}function kr(e,t,n,o,i,a,s,l,c,u,p){var d,_,f,v,m,y,b,S=o&&o.__k||Bt,I=t.length;for(c=ol(n,t,S,c,I),d=0;d<I;d++)(f=n.__k[d])!=null&&(_=f.__i!=-1&&S[f.__i]||$t,f.__i=d,y=ro(e,f,_,i,a,s,l,c,u,p),v=f.__e,f.ref&&_.ref!=f.ref&&(_.ref&&io(_.ref,null,f),p.push(f.ref,f.__c||v,f)),m==null&&v!=null&&(m=v),(b=!!(4&f.__u))||_.__k===f.__k?(c=Er(f,c,e,b),b&&_.__e&&(_.__e=null)):typeof f.type=="function"&&y!==void 0?c=y:v&&(c=v.nextSibling),f.__u&=-7);return n.__e=m,c}function ol(e,t,n,o,i){var a,s,l,c,u,p=n.length,d=p,_=0;for(e.__k=new Array(i),a=0;a<i;a++)(s=t[a])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[a]=Ht(null,s,null,null,null):Ft(s)?s=e.__k[a]=Ht(te,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=Ht(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,c=a+_,s.__=e,s.__b=e.__b+1,l=null,(u=s.__i=rl(s,n,c,d))!=-1&&(d--,(l=n[u])&&(l.__u|=2)),l==null||l.__v==null?(u==-1&&(i>p?_--:i<p&&_++),typeof s.type!="function"&&(s.__u|=4)):u!=c&&(u==c-1?_--:u==c+1?_++:(u>c?_--:_++,s.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<p;a++)(l=n[a])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=Je(l)),Tr(l,l));return o}function Er(e,t,n,o){var i,a;if(typeof e.type=="function"){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=Er(i[a],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=Je(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function rl(e,t,n,o){var i,a,s,l=e.key,c=e.type,u=t[n],p=u!=null&&(2&u.__u)==0;if(u===null&&l==null||p&&l==u.key&&c==u.type)return n;if(o>(p?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((u=t[s=i>=0?i--:a++])!=null&&(2&u.__u)==0&&l==u.key&&c==u.type)return s}return-1}function vr(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||tl.test(t)?n:n+"px"}function Ot(e,t,n,o,i){var a,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||vr(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||vr(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(Sr,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?o?n[ft]=o[ft]:(n[ft]=no,e.addEventListener(t,a?Zn:Qn,a)):e.removeEventListener(t,a?Zn:Qn,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 e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function br(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Dt]==null)t[Dt]=no++;else if(t[Dt]<n[ft])return;return n(H.event?H.event(t):t)}}}function ro(e,t,n,o,i,a,s,l,c,u){var p,d,_,f,v,m,y,b,S,I,L,U,X,de,ee,J=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[l=t.__e=n.__e]),(p=H.__b)&&p(t);e:if(typeof J=="function")try{if(b=t.props,S=J.prototype&&J.prototype.render,I=(p=J.contextType)&&o[p.__c],L=p?I?I.props.value:p.__:o,n.__c?y=(d=t.__c=n.__c).__=d.__E:(S?t.__c=d=new J(b,L):(t.__c=d=new He(b,L),d.constructor=J,d.render=al),I&&I.sub(d),d.state||(d.state={}),d.__n=o,_=d.__d=!0,d.__h=[],d._sb=[]),S&&d.__s==null&&(d.__s=d.state),S&&J.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Te({},d.__s)),Te(d.__s,J.getDerivedStateFromProps(b,d.__s))),f=d.props,v=d.state,d.__v=t,_)S&&J.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),S&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(S&&J.getDerivedStateFromProps==null&&b!==f&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(b,L),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(b,d.__s,L)===!1){t.__v!=n.__v&&(d.props=b,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(re){re&&(re.__=t)}),Bt.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&s.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(b,d.__s,L),S&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(f,v,m)})}if(d.context=L,d.props=b,d.__P=e,d.__e=!1,U=H.__r,X=0,S)d.state=d.__s,d.__d=!1,U&&U(t),p=d.render(d.props,d.state,d.context),Bt.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,U&&U(t),p=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++X<25);d.state=d.__s,d.getChildContext!=null&&(o=Te(Te({},o),d.getChildContext())),S&&!_&&d.getSnapshotBeforeUpdate!=null&&(m=d.getSnapshotBeforeUpdate(f,v)),de=p!=null&&p.type===te&&p.key==null?Ar(p.props.children):p,l=kr(e,Ft(de)?de:[de],t,n,o,i,a,s,l,c,u),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),y&&(d.__E=d.__=null)}catch(re){if(t.__v=null,c||a!=null)if(re.then){for(t.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a[a.indexOf(l)]=null,t.__e=l}else{for(ee=a.length;ee--;)oo(a[ee]);eo(t)}else t.__e=n.__e,t.__k=n.__k,re.then||eo(t);H.__e(re,t,n)}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=il(n.__e,t,n,o,i,a,s,c,u);return(p=H.diffed)&&p(t),128&t.__u?void 0:l}function eo(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(eo))}function Cr(e,t,n){for(var o=0;o<n.length;o++)io(n[o],n[++o],n[++o]);H.__c&&H.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){H.__e(a,i.__v)}})}function Ar(e){return typeof e!="object"||e==null||e.__b>0?e:Ft(e)?e.map(Ar):e.constructor!==void 0?null:Te({},e)}function il(e,t,n,o,i,a,s,l,c){var u,p,d,_,f,v,m,y=n.props||$t,b=t.props,S=t.type;if(S=="svg"?i="http://www.w3.org/2000/svg":S=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),a!=null){for(u=0;u<a.length;u++)if((f=a[u])&&"setAttribute"in f==!!S&&(S?f.localName==S:f.nodeType==3)){e=f,a[u]=null;break}}if(e==null){if(S==null)return document.createTextNode(b);e=document.createElementNS(i,S,b.is&&b),l&&(H.__m&&H.__m(t,a),l=!1),a=null}if(S==null)y===b||l&&e.data==b||(e.data=b);else{if(a=S=="textarea"&&b.defaultValue!=null?null:a&&zt.call(e.childNodes),!l&&a!=null)for(y={},u=0;u<e.attributes.length;u++)y[(f=e.attributes[u]).name]=f.value;for(u in y)f=y[u],u=="dangerouslySetInnerHTML"?d=f:u=="children"||u in b||u=="value"&&"defaultValue"in b||u=="checked"&&"defaultChecked"in b||Ot(e,u,null,f,i);for(u in b)f=b[u],u=="children"?_=f:u=="dangerouslySetInnerHTML"?p=f:u=="value"?v=f:u=="checked"?m=f:l&&typeof f!="function"||y[u]===f||Ot(e,u,f,y[u],i);if(p)l||d&&(p.__html==d.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(d&&(e.innerHTML=""),kr(t.type=="template"?e.content:e,Ft(_)?_:[_],t,n,o,S=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,s,a?a[0]:n.__k&&Je(n,0),l,c),a!=null)for(u=a.length;u--;)oo(a[u]);l&&S!="textarea"||(u="value",S=="progress"&&v==null?e.removeAttribute("value"):v!=null&&(v!==e[u]||S=="progress"&&!v||S=="option"&&v!=y[u])&&Ot(e,u,v,y[u],i),u="checked",m!=null&&m!=e[u]&&Ot(e,u,m,y[u],i))}return e}function io(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t))}else e.current=t}catch(i){H.__e(i,n)}}function Tr(e,t,n){var o,i;if(H.unmount&&H.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||io(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){H.__e(a,t)}o.base=o.__P=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&Tr(o[i],t,n||typeof e.type!="function");n||oo(e.__e),e.__c=e.__=e.__e=void 0}function al(e,t,n){return this.constructor(e,n)}function ao(e,t,n){var o,i,a,s;t==document&&(t=document.documentElement),H.__&&H.__(e,t),i=(o=typeof n=="function")?null:n&&n.__k||t.__k,a=[],s=[],ro(t,e=(!o&&n||t).__k=Wt(te,null,[e]),i||$t,$t,t.namespaceURI,!o&&n?[n]:i?null:t.firstChild?zt.call(t.childNodes):null,a,!o&&n?n:i?i.__e:t.firstChild,o,s),Cr(a,e,s)}zt=Bt.slice,H={__e:function(e,t,n,o){for(var i,a,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,o||{}),s=i.__d),s)return i.__E=i}catch(l){e=l}throw e}},xr=0,to=function(e){return e!=null&&e.constructor===void 0},He.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Te({},this.state),typeof e=="function"&&(e=e(Te({},n),this.props)),e&&Te(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),hr(this))},He.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),hr(this))},He.prototype.render=te,De=[],yr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Pr=function(e,t){return e.__v.__b-t.__v.__b},Ut.__r=0,Jn=Math.random().toString(8),Dt="__d"+Jn,ft="__a"+Jn,Sr=/(PointerCapture)$|Capture$/i,no=0,Qn=br(!1),Zn=br(!0),el=0;var Qe,Q,so,Ir,gt=0,$r=[],ne=H,Rr=ne.__b,Mr=ne.__r,Lr=ne.diffed,Nr=ne.__c,Or=ne.unmount,Dr=ne.__;function Gt(e,t){ne.__h&&ne.__h(Q,e,gt||t),gt=0;var n=Q.__H||(Q.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function k(e){return gt=1,sl(Ur,e)}function sl(e,t,n){var o=Gt(Qe++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Ur(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],u=o.t(c,l);c!==u&&(o.__N=[u,o.__[1]],o.__c.setState({}))}],o.__c=Q,!Q.__f)){var i=function(l,c,u){if(!o.__c.__H)return!0;var p=o.__c.__H.__.filter(function(_){return _.__c});if(p.every(function(_){return!_.__N}))return!a||a.call(this,l,c,u);var d=o.__c.props!==l;return p.some(function(_){if(_.__N){var f=_.__[0];_.__=_.__N,_.__N=void 0,f!==_.__[0]&&(d=!0)}}),a&&a.call(this,l,c,u)||d};Q.__f=!0;var a=Q.shouldComponentUpdate,s=Q.componentWillUpdate;Q.componentWillUpdate=function(l,c,u){if(this.__e){var p=a;a=void 0,i(l,c,u),a=p}s&&s.call(this,l,c,u)},Q.shouldComponentUpdate=i}return o.__N||o.__}function w(e,t){var n=Gt(Qe++,3);!ne.__s&&co(n.__H,t)&&(n.__=e,n.u=t,Q.__H.__h.push(n))}function Br(e,t){var n=Gt(Qe++,4);!ne.__s&&co(n.__H,t)&&(n.__=e,n.u=t,Q.__h.push(n))}function O(e){return gt=5,ge(function(){return{current:e}},[])}function ge(e,t){var n=Gt(Qe++,7);return co(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function R(e,t){return gt=8,ge(function(){return e},t)}function ll(){for(var e;e=$r.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Kt),t.__h.some(lo),t.__h=[]}catch(n){t.__h=[],ne.__e(n,e.__v)}}}ne.__b=function(e){Q=null,Rr&&Rr(e)},ne.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Dr&&Dr(e,t)},ne.__r=function(e){Mr&&Mr(e),Qe=0;var t=(Q=e.__c).__H;t&&(so===Q?(t.__h=[],Q.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Kt),t.__h.some(lo),t.__h=[],Qe=0)),so=Q},ne.diffed=function(e){Lr&&Lr(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&($r.push(t)!==1&&Ir===ne.requestAnimationFrame||((Ir=ne.requestAnimationFrame)||cl)(ll)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),so=Q=null},ne.__c=function(e,t){t.some(function(n){try{n.__h.some(Kt),n.__h=n.__h.filter(function(o){return!o.__||lo(o)})}catch(o){t.some(function(i){i.__h&&(i.__h=[])}),t=[],ne.__e(o,n.__v)}}),Nr&&Nr(e,t)},ne.unmount=function(e){Or&&Or(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{Kt(o)}catch(i){t=i}}),n.__H=void 0,t&&ne.__e(t,n.__v))};var Hr=typeof requestAnimationFrame=="function";function cl(e){var t,n=function(){clearTimeout(o),Hr&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Hr&&(t=requestAnimationFrame(n))}function Kt(e){var t=Q,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Q=t}function lo(e){var t=Q;e.__c=e.__(),Q=t}function co(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Ur(e,t){return typeof t=="function"?t(e):t}var dl=Symbol.for("preact-signals");function jt(){if(Ie>1)Ie--;else{var e,t=!1;for((function(){var i=qt;for(qt=void 0;i!==void 0;)i.S.v===i.v&&(i.S.i=i.i),i=i.o})();mt!==void 0;){var n=mt;for(mt=void 0,Vt++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Wr(n))try{n.c()}catch(i){t||(e=i,t=!0)}n=o}}if(Vt=0,Ie--,t)throw e}}function uo(e){if(Ie>0)return e();_o=++_l,Ie++;try{return e()}finally{jt()}}var G=void 0;function Yt(e){var t=G;G=void 0;try{return e()}finally{G=t}}var zr,mt=void 0,Ie=0,Vt=0,_l=0,_o=0,qt=void 0,Xt=0;function Fr(e){if(G!==void 0){var t=e.n;if(t===void 0||t.t!==G)return t={i:0,S:e,p:G.s,n:void 0,t:G,e:void 0,x:void 0,r:t},G.s!==void 0&&(G.s.n=t),G.s=t,e.n=t,32&G.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=G.s,t.n=void 0,G.s.n=t,G.s=t),t}}function ae(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}ae.prototype.brand=dl;ae.prototype.h=function(){return!0};ae.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:Yt(function(){var o;(o=t.W)==null||o.call(t)}))};ae.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,o=e.x;n!==void 0&&(n.x=o,e.e=void 0),o!==void 0&&(o.e=n,e.x=void 0),e===this.t&&(this.t=o,o===void 0&&Yt(function(){var i;(i=t.Z)==null||i.call(t)}))}};ae.prototype.subscribe=function(e){var t=this;return Re(function(){var n=t.value,o=G;G=void 0;try{e(n)}finally{G=o}},{name:"sub"})};ae.prototype.valueOf=function(){return this.value};ae.prototype.toString=function(){return this.value+""};ae.prototype.toJSON=function(){return this.value};ae.prototype.peek=function(){var e=this;return Yt(function(){return e.value})};Object.defineProperty(ae.prototype,"value",{get:function(){var e=Fr(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Vt>100)throw new Error("Cycle detected");(function(n){Ie!==0&&Vt===0&&n.l!==_o&&(n.l=_o,qt={S:n,v:n.v,i:n.i,o:qt})})(this),this.v=e,this.i++,Xt++,Ie++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{jt()}}}});function N(e,t){return new ae(e,t)}function Wr(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Kr(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Gr(e){for(var t=e.s,n=void 0;t!==void 0;){var o=t.p;t.i===-1?(t.S.U(t),o!==void 0&&(o.n=t.n),t.n!==void 0&&(t.n.p=o)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=o}e.s=n}function ze(e,t){ae.call(this,void 0),this.x=e,this.s=void 0,this.g=Xt-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}ze.prototype=new ae;ze.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Xt))return!0;if(this.g=Xt,this.f|=1,this.i>0&&!Wr(this))return this.f&=-2,!0;var e=G;try{Kr(this),G=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return G=e,Gr(this),this.f&=-2,!0};ze.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}ae.prototype.S.call(this,e)};ze.prototype.U=function(e){if(this.t!==void 0&&(ae.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};ze.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(ze.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Fr(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function ht(e,t){return new ze(e,t)}function Vr(e){var t=e.m;if(e.m=void 0,typeof t=="function"){Ie++;var n=G;G=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,po(e),o}finally{G=n,jt()}}}function po(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Vr(e)}function ul(e){if(G!==this)throw new Error("Out-of-order effect");Gr(this),G=e,this.f&=-2,8&this.f&&po(this),jt()}function Ze(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,zr&&zr.push(this)}Ze.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};Ze.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Vr(this),Kr(this),Ie++;var e=G;return G=this,ul.bind(this,e)};Ze.prototype.N=function(){2&this.f||(this.f|=2,this.u=mt,mt=this)};Ze.prototype.d=function(){this.f|=8,1&this.f||po(this)};Ze.prototype.dispose=function(){this.d()};function Re(e,t){var n=new Ze(e,t);try{n.c()}catch(i){throw n.d(),i}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var qr,Zt,Jt,pl=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var Xr=[];Re(function(){qr=this.N})();function et(e,t){H[e]=t.bind(null,H[e]||function(){})}function Qt(e){if(Jt){var t=Jt;Jt=void 0,t()}Jt=e&&e.S()}function jr(e){var t=this,n=e.data,o=vt(n);o.value=n;var i=ge(function(){for(var l=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var u=ht(function(){var f=o.value.value;return f===0?0:f===!0?"":f||""}),p=ht(function(){return!Array.isArray(u.value)&&!to(u.value)}),d=Re(function(){if(this.N=Yr,p.value){var f=u.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=f)}}),_=t.__$u.d;return t.__$u.d=function(){d(),_.call(this)},[p,u]},[]),a=i[0],s=i[1];return a.value?s.peek():s.value}jr.displayName="ReactiveTextNode";Object.defineProperties(ae.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:jr},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});et("__b",function(e,t){if(typeof t.type=="string"){var n,o=t.props;for(var i in o)if(i!=="children"){var a=o[i];a instanceof ae&&(n||(t.__np=n={}),n[i]=a,o[i]=a.peek())}}e(t)});et("__r",function(e,t){if(e(t),t.type!==te){Qt();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(i,a){var s;return Re(function(){s=this},{name:a}),s.c=i,s})(function(){var i;pl&&((i=n.y)==null||i.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),Zt=o,Qt(n)}});et("__e",function(e,t,n,o){Qt(),Zt=void 0,e(t,n,o)});et("diffed",function(e,t){Qt(),Zt=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var o=t.__np,i=t.props;if(o){var a=n.U;if(a)for(var s in a){var l=a[s];l!==void 0&&!(s in o)&&(l.d(),a[s]=void 0)}else a={},n.U=a;for(var c in o){var u=a[c],p=o[c];u===void 0?(u=fl(n,c,p),a[c]=u):u.o(p,i)}}}e(t)});function fl(e,t,n,o){var i=t in e&&e.ownerSVGElement===void 0,a=N(n),s=n.peek();return{o:function(l,c){a.value=l,s=l.peek()},d:Re(function(){this.N=Yr;var l=a.value.value;s!==l?(s=void 0,i?e[t]=l:l!=null&&(l!==!1||t[4]==="-")?e.setAttribute(t,l):e.removeAttribute(t)):s=void 0})}}et("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var o=n.U;if(o){n.U=void 0;for(var i in o){var a=o[i];a&&a.d()}}}var s=t.__np;if(s){var l=t.props;for(var c in s)l[c]=s[c]}t.__np=void 0}else{var u=t.__c;if(u){var p=u.__$u;p&&(u.__$u=void 0,p.d())}}e(t)});et("__h",function(e,t,n,o){(o<3||o===9)&&(t.__$f|=2),e(t,n,o)});He.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,o=n&&n.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(o||a||4&this.__$f)||1&this.__$f)return!0}else if(!(o||4&this.__$f)||3&this.__$f)return!0;for(var s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var l in this.props)if(!(l in e))return!0;return!1};function vt(e,t){return ge(function(){return N(e,t)},[])}function we(e,t){var n=O(e);return n.current=e,Zt.__$f|=4,ge(function(){return ht(function(){return n.current()},t)},[])}var gl=function(e){queueMicrotask(function(){queueMicrotask(e)})};function ml(){uo(function(){for(var e;e=Xr.shift();)qr.call(e)})}function Yr(){Xr.push(this)===1&&(H.requestAnimationFrame||gl)(ml)}var h={id:"help-ai",name:"@helpai/elements",global:"HelpAI",tagName:"web-ai-chat",cssPrefix:"helpai",defaultBaseUrl:"https://help.ai/api",standaloneUrl:"https://help.ai/chat",displayName:"Help AI",domain:"help.ai",siteUrl:"https://help.ai"};var hl={attach:"Attach files",attachmentMimeRejected:"File type not supported",attachmentTooLarge:"File is too large",attachmentTooMany:"Attachment limit reached",chatClosed:"This conversation is closed",close:"Close",collapse:"Collapse",collapseSidebar:"Collapse sidebar",composerPlaceholder:"Type a message\u2026",dateLastWeek:"Last 7 days",dateOlder:"Older",dateToday:"Today",dateYesterday:"Yesterday",dropZone:"Drop files to attach",errorGeneric:"Something went wrong",errorRateLimited:"Too many requests \u2014 please try again in a moment.",errorRetry:"Retry",expand:"Expand",expandSidebar:"Expand sidebar",exitFullscreen:"Exit fullscreen",fullscreen:"Fullscreen",history:"History",historyBack:"Back to chat",historyEmpty:"No previous conversations yet",historyLoading:"Loading your chats\u2026",historyNewChat:"New chat",historyTitle:"Chat history",language:"Language",launcherOpen:"Open chat",messagesLoading:"Loading conversation\u2026",micStart:"Start voice input",micStop:"Stop voice input",micUnsupported:"Voice input is not supported in this browser",moreActions:"More actions",newConversation:"New conversation",panelTitle:"Chat",popOut:"Open in a new tab",resizeHandle:"Drag to resize",send:"Send",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new conversation",stop:"Stop",theme:"Theme",themeAuto:"Auto (system)",themeDark:"Dark",themeLight:"Light",loading:"Loading\u2026",thinking:"Thinking\u2026",thoughts:"Thoughts",usedTool:"Used tool",tabHome:"Home",tabMessages:"Messages",tabHelp:"Help",tabNews:"News",modulesEmpty:"Nothing here yet",moduleBack:"Back",contentLoading:"Loading\u2026",homeGreeting:"How can we help?",homeGreetingNamed:"Hi {name} \u{1F44B}",homeGreetingLead:"How can we help?",homeSearchPlaceholder:"Search for help",homeContentTitle:"Popular articles",helpTitle:"Help",helpSearchPlaceholder:"Search for help",helpEmpty:"No help articles yet",helpLoading:"Loading help\u2026",helpSearchEmpty:"No results found",newsTitle:"News",newsEmpty:"No news yet",newsLoading:"Loading news\u2026",newsBack:"Back to news",newsPublishedAt:"Published {date}"};function en(e,t){let n=vl(e),o=nn(t),i=o?t[n]??{}:t??{},a=o?t.en??{}:{};return{...hl,...a,...i}}function vl(e){return(e.split("-")[0]??"en").toLowerCase()}function tn(e,t){return e[t]??t}function nn(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}function Jr(e,t){try{return new Intl.DisplayNames([t],{type:"language"}).of(e)??e.toUpperCase()}catch{return e.toUpperCase()}}var fo=class{get(t){try{return localStorage.getItem(t)}catch{return null}}set(t,n){try{localStorage.setItem(t,n)}catch{}}remove(t){try{localStorage.removeItem(t)}catch{}}},on=new fo;var ho=["off","error","warn","info","debug","trace"],vo=h.cssPrefix,Qr=`${vo}.debug`,bl=`__${h.global}_DEBUG__`,xl=`${vo}-debug`,rn=2,go=null;function yl(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(xl);if(e!==null){let t=mo(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(Qr);if(e){let t=mo(e);if(t>=0)return t}}catch{}return window[bl]?4:2}function mo(e){if(e===!0||e==="1"||e==="true")return 4;if(e===!1||e==="0"||e==="false"||e==="off")return 0;if(typeof e=="number")return Math.max(0,Math.min(5,Math.floor(e)));if(typeof e=="string"){let t=ho.indexOf(e);if(t>=0)return t}return-1}function an(e){let t=mo(e);if(!(t<0)){rn=t;try{window.localStorage?.setItem(Qr,ho[t])}catch{}}}function bo(){return ho[rn]}rn=yl();function Zr(e){let t=`[${vo}:${e}]`,n=(o,i,a)=>(s,l)=>{if(!(rn<o)&&(l===void 0?console[i](t,s):console[i](t,s,l),go))try{go({level:a,scope:e,message:s,payload:l})}catch{}};return{error:n(1,"error","error"),warn:n(2,"warn","warn"),info:n(3,"info","info"),debug:n(4,"debug","debug"),trace:n(5,"debug","trace"),scope:o=>Zr(`${e}:${o}`)}}var M=Zr("core");function ei(e){go=e}var Fe=M.scope("context"),Pl=new Set(["visitorId","sessionId","sessionId","jwt","token","authorization","password"]),ti=50,xo=1024,Sl=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function yo(e){return ni(e,"userContext",!0)}function Po(e){return ni(e,"pageContext",!1)}function ni(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){Fe.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let o={},i=0;for(let[a,s]of Object.entries(e)){if(Pl.has(a)){Fe.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(s==null)continue;if(i>=ti){Fe.warn(`${t} truncated at ${ti} keys \u2014 dropped "${a}"`);continue}let l=wl(t,a,s);l!==void 0&&(o[a]=l,i++)}return n&&typeof o.email=="string"&&!Sl.test(o.email)&&(Fe.warn(`dropped malformed ${t}.email "${o.email}"`),delete o.email),Object.keys(o).length>0?o:void 0}function wl(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){Fe.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let o=n.trim();return o===""?void 0:o.length>xo?(Fe.warn(`truncated ${e}.${t} to ${xo} chars`),o.slice(0,xo)):o}Fe.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}var sn={maxBytes:10485760,maxCount:10,accept:"*/*"},oi={animation:"typewriter",speed:60},So={files:!0,voice:"local"},wo={upload:"/ai/agent/upload-file",transcribe:"/ai/agent/transcribe-audio"},tt={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},ri={floating:{main:["theme","history","close"],overflow:["clear","expand","fullscreen","popOut","sound","language"]},inline:{main:["theme","history","close"],overflow:["clear","fullscreen","popOut","sound","language"]},standalone:{main:["theme","history"],overflow:["clear","sound","language"]},page:{main:["theme","history"],overflow:["clear","sound","language"]},modal:{main:["theme","history","close"],overflow:["clear","fullscreen","popOut","sound","language"]},drawer:{main:["theme","history","close"],overflow:["clear","fullscreen","popOut","sound","language"]}},ko={enabled:!0,volume:.3,events:void 0},ii={enabled:!0,events:void 0},ai=[{label:"tabMessages",layout:"chat"}],si={showSearchBar:!0};function bt(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},o=t.behavior??{},i=t.i18n??{},a=t.feedback??{},s=t.footer??{},l=t.header??{},{themeMode:c,themeOverrides:u}=kl(t.theme),p=n.mode??"floating",d=i.locale??El(i.defaultLocale),_=i.availableLocales??[d];return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:(t.baseUrl??h.defaultBaseUrl).replace(/\/$/,""),userContext:yo(t.userContext),pageContext:Po(t.pageContext),position:n.position??"bottom-right",themeMode:c,themeOverrides:u,mode:p,iframe:n.iframe??!1,responseMode:o.responseMode??"streaming",showReasoning:o.showReasoning??!1,showToolCalls:o.showToolCalls??!1,popOutUrl:o.popOutUrl??h.standaloneUrl,welcome:{...oi,...t.welcome},features:{files:t.features?.files??So.files,voice:t.features?.voice??So.voice,tools:t.features?.tools},endpoints:{upload:t.endpoints?.upload??wo.upload,transcribe:t.endpoints?.transcribe??wo.transcribe},attachments:{accept:t.composer?.attachments?.accept??sn.accept,maxBytes:t.composer?.attachments?.maxBytes??sn.maxBytes,maxCount:t.composer?.attachments?.maxCount??sn.maxCount},locale:d,availableLocales:_,startMinimized:o.startMinimized??!0,actions:Cl(p,l.actions),size:n.size??{},launcher:Ll(t.launcher),sound:Al(a.sound),haptics:Tl(a.haptics),strings:en(d,i.strings),stringsOverride:i.strings,composerDisclaimer:s.composerDisclaimer??"",poweredBy:Il(s.poweredBy),composer:Rl(t.composer),modules:Ml(t.modules),storage:t.storage??on,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function kl(e){return typeof e=="string"?{themeMode:e,themeOverrides:{}}:e&&typeof e=="object"?{themeMode:"auto",themeOverrides:e}:{themeMode:"auto",themeOverrides:{}}}function El(e){return e&&e!=="auto"?e:typeof navigator<"u"&&navigator.language?navigator.language:"en"}function Cl(e,t){let n=ri[e];return{main:t?.main??n.main,overflow:t?.overflow??n.overflow}}function Al(e){return{enabled:e?.enabled??ko.enabled,volume:e?.volume??ko.volume,events:e?.events}}function Tl(e){return{enabled:e?.enabled??ii.enabled,events:e?.events}}function Il(e){let n={...{text:`Powered by ${h.displayName}`,href:h.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function Rl(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function Ml(e){let t=e===void 0?ai:e,n=new Set,o=[];for(let a of t.slice(0,4)){if(!a?.label||!a?.layout)continue;let s=a.contentTags?.filter(Boolean),l=a.id??s?.[0]??a.layout;for(;n.has(l);)l=`${l}-${o.length}`;n.add(l);let c={id:l,label:a.label,layout:a.layout};s&&s.length>0&&(c.contentTags=s),a.layout==="home"&&(c.brandName=a.brandName,c.greetingText=a.greetingText,c.showGreeting=a.showGreeting??!0,c.showSearchBar=a.showSearchBar??si.showSearchBar,c.showRecentMessages=a.showRecentMessages??!0,a.userAvatars&&a.userAvatars.length>0&&(c.userAvatars=a.userAvatars),a.status&&(c.status=a.status),c.contentBlockTitle=a.contentBlockTitle),o.push(c)}let i=Object.fromEntries(o.map(a=>[a.id,a]));return{list:o,byId:i}}function Ll(e){let t=e?.callout?.text?{shape:"pill",position:"auto",delayMs:1200,autoDismissMs:0,animated:!0,persistent:!0,...e.callout}:null;return{variant:e?.variant??tt.variant,size:e?.size??tt.size,label:e?.label??tt.label,icon:e?.icon??tt.icon,hidden:e?.hidden??tt.hidden,callout:t}}function Eo(e,t,n){if(t===e.locale&&n===e.themeMode)return e;let o={...e};return t!==e.locale&&(o.locale=t,o.strings=en(t,e.stringsOverride)),n!==e.themeMode&&(o.themeMode=n),o}var Nl=["presentation","behavior","theme","launcher","header","composer","welcome","feedback","i18n","footer","features","endpoints"];function Co(e,t){if(!t)return e;let n={...e};for(let a of Nl){let s=t[a];if(s===void 0)continue;let l=e[a];if(a==="theme"){l===void 0&&(n[a]=s);continue}a!=="i18n"&&(n[a]=li(s,l))}t.modules!==void 0&&e.modules===void 0&&(n.modules=t.modules);let o=e.i18n,i=t.i18n;if(o||i){let a=li(i??{},o),s=o?.strings,l=i?.strings;(s||l)&&(a.strings=Ol(l,s)),n.i18n=a}return n}function li(e,t){if(!t)return e;let n={...e};for(let[o,i]of Object.entries(t))i!==void 0&&(n[o]=i);return n}function Ol(e,t){if(!e)return t;if(!t)return e;let n=nn(e),o=nn(t);if(!n&&!o)return{...e,...t};let i={},a=n?e:{en:e},s=o?t:{en:t};for(let[l,c]of Object.entries(a))i[l]={...c};for(let[l,c]of Object.entries(s))i[l]={...i[l],...c};return i}var Dl=["clear","expand","fullscreen","popOut","sound","history","language","theme","close"],nt=e=>e!=="false",Hl=e=>e.split(",").map(t=>t.trim()).filter(Boolean),$l=[["public-key","publicKey"],["ai-agent-deployment-id","aiAgentDeploymentId"],["base-url","baseUrl"],["theme","theme",e=>e]],Bl=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",nt]],Ul=[["width","width"],["height","height"]],zl=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",nt],["show-reasoning","showReasoning",nt],["show-tool-calls","showToolCalls",nt]],Fl=[["locale","locale"]],J_=new Set(Dl);var Wl=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",nt]],Kl=[["features-files","files",nt],["features-voice","voice",e=>e],["features-tools","tools",Hl]],Gl=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],Vl=[["user-id","id"],["user-email","email"],["user-name","name"]],ql=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],Xl=["launcher-label","callout-text","callout-delay","actions-main","actions-overflow","user-context","page-context"],jl=[$l,Bl,Ul,zl,Fl,Wl,Kl,Gl,Vl,ql],Yl=new Set(["iframe","start-minimized"]),Jl=[...jl.flatMap(e=>e.map(([t])=>t).filter(t=>!Yl.has(t))),...Xl];function ci(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function di(e){return ci(e)}function _i(e){return!(!ci(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function ui(e){return`${h.cssPrefix}:${e}`}function xt(e,t){e.dispatchEvent(new CustomEvent(ui(t)))}function pi(e,t){let o=Object.entries(t).map(([i,a])=>{let s=ui(i),l=()=>a();return e.addEventListener(s,l),[s,l]});return()=>{for(let[i,a]of o)e.removeEventListener(i,a)}}var fi=`:host{--__P__-accent: __BRAND_ACCENT__;--__P__-accent-text: __BRAND_ACCENT_TEXT__;--__P__-radius: __BRAND_RADIUS__;--__P__-radius-sm: 8px;--__P__-radius-md: 10px;--__P__-radius-lg: 16px;--__P__-font: __BRAND_FONT__;--__P__-font-display: var(--__P__-font);--__P__-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;--__P__-bg: oklch(1 0 0);--__P__-bg-elevated: oklch(.9789 .0029 278.3);--__P__-surface: var(--__P__-bg-elevated);--__P__-muted: var(--__P__-fg-muted);--__P__-hover: oklch(.1686 .011 278.3 / .06);--__P__-fg: oklch(.1686 .011 278.3);--__P__-fg-muted: oklch(.4932 .0301 278.3);--__P__-border: oklch(.9312 .0084 278.3);--__P__-border-strong: oklch(.8757 .0131 278.3);--__P__-bubble-user: var(--__P__-accent);--__P__-bubble-user-text: var(--__P__-accent-text);--__P__-bubble-assistant: oklch(.9638 .0058 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-on-accent: var(--__P__-accent-text);--__P__-success: oklch(.6456 .1654 151.53);--__P__-warning: oklch(.7135 .1494 74.05);--__P__-danger: oklch(.5966 .1818 24.51);--__P__-danger-text: oklch(.5054 .1905 27.52);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .1);--__P__-neutral: oklch(.7137 .0192 278.3);--__P__-focus: var(--__P__-accent);--__P__-shadow-panel: 0 8px 24px -8px rgba(13, 15, 20, .18), 0 24px 64px -24px rgba(13, 15, 20, .24);--__P__-shadow-card: 0 1px 2px rgba(13, 15, 20, .06), 0 4px 12px -6px rgba(13, 15, 20, .12);--__P__-backdrop: oklch(.1686 .011 278.3 / .55);--__P__-shadow-fab: 0 6px 16px -4px color-mix(in oklch, var(--__P__-accent) 45%, transparent), 0 12px 32px -12px rgba(13, 15, 20, .25);--__P__-z-fab: 2147483600;--__P__-z-panel: 2147483601;--__P__-panel-w: 380px;--__P__-panel-h: 600px;--__P__-fab-size: 56px;--__P__-space-1: 4px;--__P__-space-2: 8px;--__P__-space-3: 12px;--__P__-space-4: 16px;--__P__-space-5: 20px;--__P__-space-6: 24px;--__P__-space-8: 32px;--__P__-text-xs: 12px;--__P__-text-sm: 13px;--__P__-text-base: 15px;--__P__-text-md: 16px;--__P__-text-lg: 18px;--__P__-text-xl: 22px;--__P__-text-2xl: 30px;--__P__-ease: cubic-bezier(.2, .7, .2, 1);--__P__-ease-out: cubic-bezier(.2, .7, .2, 1);--__P__-ease-in: cubic-bezier(.4, 0, 1, 1);--__P__-ease-in-out: cubic-bezier(.65, 0, .35, 1);--__P__-dur-quick: .12s;--__P__-dur-base: .22s;--__P__-dur-slow: .32s;font-family:var(--__P__-font);color:var(--__P__-fg);color-scheme:light}:host([data-theme="dark"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-danger-text: oklch(.8077 .1035 19.57);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .18);--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);--__P__-shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px -6px rgba(0, 0, 0, .5);--__P__-backdrop: rgba(0, 0, 0, .65);color-scheme:dark}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);color-scheme:dark}}@media(prefers-reduced-motion:reduce){:host{--__P__-dur-quick: 1ms;--__P__-dur-base: 1ms;--__P__-dur-slow: 1ms}}
|
|
1
|
+
"use strict";var Nt=Object.defineProperty;var qs=Object.getOwnPropertyDescriptor;var Xs=Object.getOwnPropertyNames;var js=Object.prototype.hasOwnProperty;var Ys=(e,t,n)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Js=(e,t)=>{for(var n in t)Nt(e,n,{get:t[n],enumerable:!0})},Qs=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xs(t))!js.call(e,i)&&i!==n&&Nt(e,i,{get:()=>t[i],enumerable:!(o=qs(t,i))||o.enumerable});return e};var Zs=e=>Qs(Nt({},"__esModule",{value:!0}),e);var F=(e,t,n)=>Ys(e,typeof t!="symbol"?t+"":t,n);var b_={};Js(b_,{HOOK_WILDCARD:()=>Hn,brand:()=>v_,destroy:()=>p_,getAllInstances:()=>g_,getInstance:()=>f_,hook:()=>m_,init:()=>u_,mount:()=>Cs,resolveInitialHostMode:()=>As,version:()=>h_});module.exports=Zs(b_);var zt,H,xr,to,De,mr,yr,Pr,Jn,Dt,ft,Sr,no,Qn,Zn,el,$t={},Bt=[],tl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ft=Array.isArray;function Te(e,t){for(var n in t)e[n]=t[n];return e}function oo(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Wt(e,t,n){var o,i,a,s={};for(a in t)a=="key"?o=t[a]:a=="ref"?i=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?zt.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return Ht(e,s,o,i,null)}function Ht(e,t,n,o,i){var a={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++xr,__i:-1,__u:0};return i==null&&H.vnode!=null&&H.vnode(a),a}function te(e){return e.children}function He(e,t){this.props=e,this.context=t}function Je(e,t){if(t==null)return e.__?Je(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"?Je(e):null}function nl(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],i=[],a=Te({},t);a.__v=t.__v+1,H.vnode&&H.vnode(a),ro(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??Je(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,Cr(o,a,i),t.__e=t.__=null,a.__e!=n&&wr(a)}}function wr(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}),wr(e)}function hr(e){(!e.__d&&(e.__d=!0)&&De.push(e)&&!Ut.__r++||mr!=H.debounceRendering)&&((mr=H.debounceRendering)||yr)(Ut)}function Ut(){try{for(var e,t=1;De.length;)De.length>t&&De.sort(Pr),e=De.shift(),t=De.length,nl(e)}finally{De.length=Ut.__r=0}}function kr(e,t,n,o,i,a,s,l,c,u,p){var d,_,f,v,m,y,b,S=o&&o.__k||Bt,I=t.length;for(c=ol(n,t,S,c,I),d=0;d<I;d++)(f=n.__k[d])!=null&&(_=f.__i!=-1&&S[f.__i]||$t,f.__i=d,y=ro(e,f,_,i,a,s,l,c,u,p),v=f.__e,f.ref&&_.ref!=f.ref&&(_.ref&&io(_.ref,null,f),p.push(f.ref,f.__c||v,f)),m==null&&v!=null&&(m=v),(b=!!(4&f.__u))||_.__k===f.__k?(c=Er(f,c,e,b),b&&_.__e&&(_.__e=null)):typeof f.type=="function"&&y!==void 0?c=y:v&&(c=v.nextSibling),f.__u&=-7);return n.__e=m,c}function ol(e,t,n,o,i){var a,s,l,c,u,p=n.length,d=p,_=0;for(e.__k=new Array(i),a=0;a<i;a++)(s=t[a])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[a]=Ht(null,s,null,null,null):Ft(s)?s=e.__k[a]=Ht(te,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=Ht(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,c=a+_,s.__=e,s.__b=e.__b+1,l=null,(u=s.__i=rl(s,n,c,d))!=-1&&(d--,(l=n[u])&&(l.__u|=2)),l==null||l.__v==null?(u==-1&&(i>p?_--:i<p&&_++),typeof s.type!="function"&&(s.__u|=4)):u!=c&&(u==c-1?_--:u==c+1?_++:(u>c?_--:_++,s.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<p;a++)(l=n[a])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=Je(l)),Tr(l,l));return o}function Er(e,t,n,o){var i,a;if(typeof e.type=="function"){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=Er(i[a],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=Je(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function rl(e,t,n,o){var i,a,s,l=e.key,c=e.type,u=t[n],p=u!=null&&(2&u.__u)==0;if(u===null&&l==null||p&&l==u.key&&c==u.type)return n;if(o>(p?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((u=t[s=i>=0?i--:a++])!=null&&(2&u.__u)==0&&l==u.key&&c==u.type)return s}return-1}function vr(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||tl.test(t)?n:n+"px"}function Ot(e,t,n,o,i){var a,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||vr(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||vr(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(Sr,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?o?n[ft]=o[ft]:(n[ft]=no,e.addEventListener(t,a?Zn:Qn,a)):e.removeEventListener(t,a?Zn:Qn,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 e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function br(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Dt]==null)t[Dt]=no++;else if(t[Dt]<n[ft])return;return n(H.event?H.event(t):t)}}}function ro(e,t,n,o,i,a,s,l,c,u){var p,d,_,f,v,m,y,b,S,I,L,U,X,_e,ee,J=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[l=t.__e=n.__e]),(p=H.__b)&&p(t);e:if(typeof J=="function")try{if(b=t.props,S=J.prototype&&J.prototype.render,I=(p=J.contextType)&&o[p.__c],L=p?I?I.props.value:p.__:o,n.__c?y=(d=t.__c=n.__c).__=d.__E:(S?t.__c=d=new J(b,L):(t.__c=d=new He(b,L),d.constructor=J,d.render=al),I&&I.sub(d),d.state||(d.state={}),d.__n=o,_=d.__d=!0,d.__h=[],d._sb=[]),S&&d.__s==null&&(d.__s=d.state),S&&J.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Te({},d.__s)),Te(d.__s,J.getDerivedStateFromProps(b,d.__s))),f=d.props,v=d.state,d.__v=t,_)S&&J.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),S&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(S&&J.getDerivedStateFromProps==null&&b!==f&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(b,L),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(b,d.__s,L)===!1){t.__v!=n.__v&&(d.props=b,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(re){re&&(re.__=t)}),Bt.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&s.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(b,d.__s,L),S&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(f,v,m)})}if(d.context=L,d.props=b,d.__P=e,d.__e=!1,U=H.__r,X=0,S)d.state=d.__s,d.__d=!1,U&&U(t),p=d.render(d.props,d.state,d.context),Bt.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,U&&U(t),p=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++X<25);d.state=d.__s,d.getChildContext!=null&&(o=Te(Te({},o),d.getChildContext())),S&&!_&&d.getSnapshotBeforeUpdate!=null&&(m=d.getSnapshotBeforeUpdate(f,v)),_e=p!=null&&p.type===te&&p.key==null?Ar(p.props.children):p,l=kr(e,Ft(_e)?_e:[_e],t,n,o,i,a,s,l,c,u),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),y&&(d.__E=d.__=null)}catch(re){if(t.__v=null,c||a!=null)if(re.then){for(t.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a[a.indexOf(l)]=null,t.__e=l}else{for(ee=a.length;ee--;)oo(a[ee]);eo(t)}else t.__e=n.__e,t.__k=n.__k,re.then||eo(t);H.__e(re,t,n)}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=il(n.__e,t,n,o,i,a,s,c,u);return(p=H.diffed)&&p(t),128&t.__u?void 0:l}function eo(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(eo))}function Cr(e,t,n){for(var o=0;o<n.length;o++)io(n[o],n[++o],n[++o]);H.__c&&H.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){H.__e(a,i.__v)}})}function Ar(e){return typeof e!="object"||e==null||e.__b>0?e:Ft(e)?e.map(Ar):e.constructor!==void 0?null:Te({},e)}function il(e,t,n,o,i,a,s,l,c){var u,p,d,_,f,v,m,y=n.props||$t,b=t.props,S=t.type;if(S=="svg"?i="http://www.w3.org/2000/svg":S=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),a!=null){for(u=0;u<a.length;u++)if((f=a[u])&&"setAttribute"in f==!!S&&(S?f.localName==S:f.nodeType==3)){e=f,a[u]=null;break}}if(e==null){if(S==null)return document.createTextNode(b);e=document.createElementNS(i,S,b.is&&b),l&&(H.__m&&H.__m(t,a),l=!1),a=null}if(S==null)y===b||l&&e.data==b||(e.data=b);else{if(a=S=="textarea"&&b.defaultValue!=null?null:a&&zt.call(e.childNodes),!l&&a!=null)for(y={},u=0;u<e.attributes.length;u++)y[(f=e.attributes[u]).name]=f.value;for(u in y)f=y[u],u=="dangerouslySetInnerHTML"?d=f:u=="children"||u in b||u=="value"&&"defaultValue"in b||u=="checked"&&"defaultChecked"in b||Ot(e,u,null,f,i);for(u in b)f=b[u],u=="children"?_=f:u=="dangerouslySetInnerHTML"?p=f:u=="value"?v=f:u=="checked"?m=f:l&&typeof f!="function"||y[u]===f||Ot(e,u,f,y[u],i);if(p)l||d&&(p.__html==d.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(d&&(e.innerHTML=""),kr(t.type=="template"?e.content:e,Ft(_)?_:[_],t,n,o,S=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,s,a?a[0]:n.__k&&Je(n,0),l,c),a!=null)for(u=a.length;u--;)oo(a[u]);l&&S!="textarea"||(u="value",S=="progress"&&v==null?e.removeAttribute("value"):v!=null&&(v!==e[u]||S=="progress"&&!v||S=="option"&&v!=y[u])&&Ot(e,u,v,y[u],i),u="checked",m!=null&&m!=e[u]&&Ot(e,u,m,y[u],i))}return e}function io(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t))}else e.current=t}catch(i){H.__e(i,n)}}function Tr(e,t,n){var o,i;if(H.unmount&&H.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||io(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){H.__e(a,t)}o.base=o.__P=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&Tr(o[i],t,n||typeof e.type!="function");n||oo(e.__e),e.__c=e.__=e.__e=void 0}function al(e,t,n){return this.constructor(e,n)}function ao(e,t,n){var o,i,a,s;t==document&&(t=document.documentElement),H.__&&H.__(e,t),i=(o=typeof n=="function")?null:n&&n.__k||t.__k,a=[],s=[],ro(t,e=(!o&&n||t).__k=Wt(te,null,[e]),i||$t,$t,t.namespaceURI,!o&&n?[n]:i?null:t.firstChild?zt.call(t.childNodes):null,a,!o&&n?n:i?i.__e:t.firstChild,o,s),Cr(a,e,s)}zt=Bt.slice,H={__e:function(e,t,n,o){for(var i,a,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,o||{}),s=i.__d),s)return i.__E=i}catch(l){e=l}throw e}},xr=0,to=function(e){return e!=null&&e.constructor===void 0},He.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Te({},this.state),typeof e=="function"&&(e=e(Te({},n),this.props)),e&&Te(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),hr(this))},He.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),hr(this))},He.prototype.render=te,De=[],yr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Pr=function(e,t){return e.__v.__b-t.__v.__b},Ut.__r=0,Jn=Math.random().toString(8),Dt="__d"+Jn,ft="__a"+Jn,Sr=/(PointerCapture)$|Capture$/i,no=0,Qn=br(!1),Zn=br(!0),el=0;var Qe,Q,so,Ir,gt=0,$r=[],ne=H,Rr=ne.__b,Mr=ne.__r,Lr=ne.diffed,Nr=ne.__c,Or=ne.unmount,Dr=ne.__;function Gt(e,t){ne.__h&&ne.__h(Q,e,gt||t),gt=0;var n=Q.__H||(Q.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function k(e){return gt=1,sl(Ur,e)}function sl(e,t,n){var o=Gt(Qe++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Ur(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],u=o.t(c,l);c!==u&&(o.__N=[u,o.__[1]],o.__c.setState({}))}],o.__c=Q,!Q.__f)){var i=function(l,c,u){if(!o.__c.__H)return!0;var p=o.__c.__H.__.filter(function(_){return _.__c});if(p.every(function(_){return!_.__N}))return!a||a.call(this,l,c,u);var d=o.__c.props!==l;return p.some(function(_){if(_.__N){var f=_.__[0];_.__=_.__N,_.__N=void 0,f!==_.__[0]&&(d=!0)}}),a&&a.call(this,l,c,u)||d};Q.__f=!0;var a=Q.shouldComponentUpdate,s=Q.componentWillUpdate;Q.componentWillUpdate=function(l,c,u){if(this.__e){var p=a;a=void 0,i(l,c,u),a=p}s&&s.call(this,l,c,u)},Q.shouldComponentUpdate=i}return o.__N||o.__}function w(e,t){var n=Gt(Qe++,3);!ne.__s&&co(n.__H,t)&&(n.__=e,n.u=t,Q.__H.__h.push(n))}function Br(e,t){var n=Gt(Qe++,4);!ne.__s&&co(n.__H,t)&&(n.__=e,n.u=t,Q.__h.push(n))}function O(e){return gt=5,ge(function(){return{current:e}},[])}function ge(e,t){var n=Gt(Qe++,7);return co(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function R(e,t){return gt=8,ge(function(){return e},t)}function ll(){for(var e;e=$r.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Kt),t.__h.some(lo),t.__h=[]}catch(n){t.__h=[],ne.__e(n,e.__v)}}}ne.__b=function(e){Q=null,Rr&&Rr(e)},ne.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Dr&&Dr(e,t)},ne.__r=function(e){Mr&&Mr(e),Qe=0;var t=(Q=e.__c).__H;t&&(so===Q?(t.__h=[],Q.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Kt),t.__h.some(lo),t.__h=[],Qe=0)),so=Q},ne.diffed=function(e){Lr&&Lr(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&($r.push(t)!==1&&Ir===ne.requestAnimationFrame||((Ir=ne.requestAnimationFrame)||cl)(ll)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),so=Q=null},ne.__c=function(e,t){t.some(function(n){try{n.__h.some(Kt),n.__h=n.__h.filter(function(o){return!o.__||lo(o)})}catch(o){t.some(function(i){i.__h&&(i.__h=[])}),t=[],ne.__e(o,n.__v)}}),Nr&&Nr(e,t)},ne.unmount=function(e){Or&&Or(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{Kt(o)}catch(i){t=i}}),n.__H=void 0,t&&ne.__e(t,n.__v))};var Hr=typeof requestAnimationFrame=="function";function cl(e){var t,n=function(){clearTimeout(o),Hr&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Hr&&(t=requestAnimationFrame(n))}function Kt(e){var t=Q,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Q=t}function lo(e){var t=Q;e.__c=e.__(),Q=t}function co(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Ur(e,t){return typeof t=="function"?t(e):t}var dl=Symbol.for("preact-signals");function jt(){if(Ie>1)Ie--;else{var e,t=!1;for((function(){var i=qt;for(qt=void 0;i!==void 0;)i.S.v===i.v&&(i.S.i=i.i),i=i.o})();mt!==void 0;){var n=mt;for(mt=void 0,Vt++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Wr(n))try{n.c()}catch(i){t||(e=i,t=!0)}n=o}}if(Vt=0,Ie--,t)throw e}}function uo(e){if(Ie>0)return e();_o=++_l,Ie++;try{return e()}finally{jt()}}var G=void 0;function Yt(e){var t=G;G=void 0;try{return e()}finally{G=t}}var zr,mt=void 0,Ie=0,Vt=0,_l=0,_o=0,qt=void 0,Xt=0;function Fr(e){if(G!==void 0){var t=e.n;if(t===void 0||t.t!==G)return t={i:0,S:e,p:G.s,n:void 0,t:G,e:void 0,x:void 0,r:t},G.s!==void 0&&(G.s.n=t),G.s=t,e.n=t,32&G.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=G.s,t.n=void 0,G.s.n=t,G.s=t),t}}function se(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}se.prototype.brand=dl;se.prototype.h=function(){return!0};se.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:Yt(function(){var o;(o=t.W)==null||o.call(t)}))};se.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,o=e.x;n!==void 0&&(n.x=o,e.e=void 0),o!==void 0&&(o.e=n,e.x=void 0),e===this.t&&(this.t=o,o===void 0&&Yt(function(){var i;(i=t.Z)==null||i.call(t)}))}};se.prototype.subscribe=function(e){var t=this;return Re(function(){var n=t.value,o=G;G=void 0;try{e(n)}finally{G=o}},{name:"sub"})};se.prototype.valueOf=function(){return this.value};se.prototype.toString=function(){return this.value+""};se.prototype.toJSON=function(){return this.value};se.prototype.peek=function(){var e=this;return Yt(function(){return e.value})};Object.defineProperty(se.prototype,"value",{get:function(){var e=Fr(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Vt>100)throw new Error("Cycle detected");(function(n){Ie!==0&&Vt===0&&n.l!==_o&&(n.l=_o,qt={S:n,v:n.v,i:n.i,o:qt})})(this),this.v=e,this.i++,Xt++,Ie++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{jt()}}}});function N(e,t){return new se(e,t)}function Wr(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Kr(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Gr(e){for(var t=e.s,n=void 0;t!==void 0;){var o=t.p;t.i===-1?(t.S.U(t),o!==void 0&&(o.n=t.n),t.n!==void 0&&(t.n.p=o)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=o}e.s=n}function ze(e,t){se.call(this,void 0),this.x=e,this.s=void 0,this.g=Xt-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}ze.prototype=new se;ze.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Xt))return!0;if(this.g=Xt,this.f|=1,this.i>0&&!Wr(this))return this.f&=-2,!0;var e=G;try{Kr(this),G=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return G=e,Gr(this),this.f&=-2,!0};ze.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}se.prototype.S.call(this,e)};ze.prototype.U=function(e){if(this.t!==void 0&&(se.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};ze.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(ze.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Fr(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function ht(e,t){return new ze(e,t)}function Vr(e){var t=e.m;if(e.m=void 0,typeof t=="function"){Ie++;var n=G;G=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,po(e),o}finally{G=n,jt()}}}function po(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Vr(e)}function ul(e){if(G!==this)throw new Error("Out-of-order effect");Gr(this),G=e,this.f&=-2,8&this.f&&po(this),jt()}function Ze(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,zr&&zr.push(this)}Ze.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};Ze.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Vr(this),Kr(this),Ie++;var e=G;return G=this,ul.bind(this,e)};Ze.prototype.N=function(){2&this.f||(this.f|=2,this.u=mt,mt=this)};Ze.prototype.d=function(){this.f|=8,1&this.f||po(this)};Ze.prototype.dispose=function(){this.d()};function Re(e,t){var n=new Ze(e,t);try{n.c()}catch(i){throw n.d(),i}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var qr,Zt,Jt,pl=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var Xr=[];Re(function(){qr=this.N})();function et(e,t){H[e]=t.bind(null,H[e]||function(){})}function Qt(e){if(Jt){var t=Jt;Jt=void 0,t()}Jt=e&&e.S()}function jr(e){var t=this,n=e.data,o=vt(n);o.value=n;var i=ge(function(){for(var l=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var u=ht(function(){var f=o.value.value;return f===0?0:f===!0?"":f||""}),p=ht(function(){return!Array.isArray(u.value)&&!to(u.value)}),d=Re(function(){if(this.N=Yr,p.value){var f=u.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=f)}}),_=t.__$u.d;return t.__$u.d=function(){d(),_.call(this)},[p,u]},[]),a=i[0],s=i[1];return a.value?s.peek():s.value}jr.displayName="ReactiveTextNode";Object.defineProperties(se.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:jr},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});et("__b",function(e,t){if(typeof t.type=="string"){var n,o=t.props;for(var i in o)if(i!=="children"){var a=o[i];a instanceof se&&(n||(t.__np=n={}),n[i]=a,o[i]=a.peek())}}e(t)});et("__r",function(e,t){if(e(t),t.type!==te){Qt();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(i,a){var s;return Re(function(){s=this},{name:a}),s.c=i,s})(function(){var i;pl&&((i=n.y)==null||i.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),Zt=o,Qt(n)}});et("__e",function(e,t,n,o){Qt(),Zt=void 0,e(t,n,o)});et("diffed",function(e,t){Qt(),Zt=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var o=t.__np,i=t.props;if(o){var a=n.U;if(a)for(var s in a){var l=a[s];l!==void 0&&!(s in o)&&(l.d(),a[s]=void 0)}else a={},n.U=a;for(var c in o){var u=a[c],p=o[c];u===void 0?(u=fl(n,c,p),a[c]=u):u.o(p,i)}}}e(t)});function fl(e,t,n,o){var i=t in e&&e.ownerSVGElement===void 0,a=N(n),s=n.peek();return{o:function(l,c){a.value=l,s=l.peek()},d:Re(function(){this.N=Yr;var l=a.value.value;s!==l?(s=void 0,i?e[t]=l:l!=null&&(l!==!1||t[4]==="-")?e.setAttribute(t,l):e.removeAttribute(t)):s=void 0})}}et("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var o=n.U;if(o){n.U=void 0;for(var i in o){var a=o[i];a&&a.d()}}}var s=t.__np;if(s){var l=t.props;for(var c in s)l[c]=s[c]}t.__np=void 0}else{var u=t.__c;if(u){var p=u.__$u;p&&(u.__$u=void 0,p.d())}}e(t)});et("__h",function(e,t,n,o){(o<3||o===9)&&(t.__$f|=2),e(t,n,o)});He.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,o=n&&n.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(o||a||4&this.__$f)||1&this.__$f)return!0}else if(!(o||4&this.__$f)||3&this.__$f)return!0;for(var s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var l in this.props)if(!(l in e))return!0;return!1};function vt(e,t){return ge(function(){return N(e,t)},[])}function we(e,t){var n=O(e);return n.current=e,Zt.__$f|=4,ge(function(){return ht(function(){return n.current()},t)},[])}var gl=function(e){queueMicrotask(function(){queueMicrotask(e)})};function ml(){uo(function(){for(var e;e=Xr.shift();)qr.call(e)})}function Yr(){Xr.push(this)===1&&(H.requestAnimationFrame||gl)(ml)}var h={id:"help-ai",name:"@helpai/elements",global:"HelpAI",tagName:"web-ai-chat",cssPrefix:"helpai",defaultBaseUrl:"https://help.ai/api",standaloneUrl:"https://help.ai/chat",displayName:"Help AI",domain:"help.ai",siteUrl:"https://help.ai"};var hl={attach:"Attach files",attachmentMimeRejected:"File type not supported",attachmentTooLarge:"File is too large",attachmentTooMany:"Attachment limit reached",chatClosed:"This conversation is closed",close:"Close",collapse:"Collapse",collapseSidebar:"Collapse sidebar",composerPlaceholder:"Type a message\u2026",dateLastWeek:"Last 7 days",dateOlder:"Older",dateToday:"Today",dateYesterday:"Yesterday",dropZone:"Drop files to attach",errorGeneric:"Something went wrong",errorRateLimited:"Too many requests \u2014 please try again in a moment.",errorRetry:"Retry",expand:"Expand",expandSidebar:"Expand sidebar",exitFullscreen:"Exit fullscreen",fullscreen:"Fullscreen",history:"History",historyBack:"Back to chat",historyEmpty:"No previous conversations yet",historyLoading:"Loading your chats\u2026",historyNewChat:"New chat",historyTitle:"Chat history",language:"Language",launcherOpen:"Open chat",messagesLoading:"Loading conversation\u2026",micStart:"Start voice input",micStop:"Stop voice input",micUnsupported:"Voice input is not supported in this browser",moreActions:"More actions",newConversation:"New conversation",panelTitle:"Chat",popOut:"Open in a new tab",resizeHandle:"Drag to resize",send:"Send",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new conversation",stop:"Stop",theme:"Theme",themeAuto:"Auto (system)",themeDark:"Dark",themeLight:"Light",loading:"Loading\u2026",thinking:"Thinking\u2026",thoughts:"Thoughts",usedTool:"Used tool",tabHome:"Home",tabMessages:"Messages",tabHelp:"Help",tabNews:"News",modulesEmpty:"Nothing here yet",moduleBack:"Back",contentLoading:"Loading\u2026",homeGreeting:"How can we help?",homeGreetingNamed:"Hi {name} \u{1F44B}",homeGreetingLead:"How can we help?",homeSearchPlaceholder:"Search for help",homeContentTitle:"Popular articles",helpTitle:"Help",helpSearchPlaceholder:"Search for help",helpEmpty:"No help articles yet",helpLoading:"Loading help\u2026",helpSearchEmpty:"No results found",newsTitle:"News",newsEmpty:"No news yet",newsLoading:"Loading news\u2026",newsBack:"Back to news",newsPublishedAt:"Published {date}"};function en(e,t){let n=vl(e),o=nn(t),i=o?t[n]??{}:t??{},a=o?t.en??{}:{};return{...hl,...a,...i}}function vl(e){return(e.split("-")[0]??"en").toLowerCase()}function tn(e,t){return e[t]??t}function nn(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}function Jr(e,t){try{return new Intl.DisplayNames([t],{type:"language"}).of(e)??e.toUpperCase()}catch{return e.toUpperCase()}}var fo=class{get(t){try{return localStorage.getItem(t)}catch{return null}}set(t,n){try{localStorage.setItem(t,n)}catch{}}remove(t){try{localStorage.removeItem(t)}catch{}}},on=new fo;var ho=["off","error","warn","info","debug","trace"],vo=h.cssPrefix,Qr=`${vo}.debug`,bl=`__${h.global}_DEBUG__`,xl=`${vo}-debug`,rn=2,go=null;function yl(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(xl);if(e!==null){let t=mo(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(Qr);if(e){let t=mo(e);if(t>=0)return t}}catch{}return window[bl]?4:2}function mo(e){if(e===!0||e==="1"||e==="true")return 4;if(e===!1||e==="0"||e==="false"||e==="off")return 0;if(typeof e=="number")return Math.max(0,Math.min(5,Math.floor(e)));if(typeof e=="string"){let t=ho.indexOf(e);if(t>=0)return t}return-1}function an(e){let t=mo(e);if(!(t<0)){rn=t;try{window.localStorage?.setItem(Qr,ho[t])}catch{}}}function bo(){return ho[rn]}rn=yl();function Zr(e){let t=`[${vo}:${e}]`,n=(o,i,a)=>(s,l)=>{if(!(rn<o)&&(l===void 0?console[i](t,s):console[i](t,s,l),go))try{go({level:a,scope:e,message:s,payload:l})}catch{}};return{error:n(1,"error","error"),warn:n(2,"warn","warn"),info:n(3,"info","info"),debug:n(4,"debug","debug"),trace:n(5,"debug","trace"),scope:o=>Zr(`${e}:${o}`)}}var M=Zr("core");function ei(e){go=e}var Fe=M.scope("context"),Pl=new Set(["visitorId","sessionId","sessionId","jwt","token","authorization","password"]),ti=50,xo=1024,Sl=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function yo(e){return ni(e,"userContext",!0)}function Po(e){return ni(e,"pageContext",!1)}function ni(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){Fe.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let o={},i=0;for(let[a,s]of Object.entries(e)){if(Pl.has(a)){Fe.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(s==null)continue;if(i>=ti){Fe.warn(`${t} truncated at ${ti} keys \u2014 dropped "${a}"`);continue}let l=wl(t,a,s);l!==void 0&&(o[a]=l,i++)}return n&&typeof o.email=="string"&&!Sl.test(o.email)&&(Fe.warn(`dropped malformed ${t}.email "${o.email}"`),delete o.email),Object.keys(o).length>0?o:void 0}function wl(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){Fe.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let o=n.trim();return o===""?void 0:o.length>xo?(Fe.warn(`truncated ${e}.${t} to ${xo} chars`),o.slice(0,xo)):o}Fe.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}var sn={maxBytes:10485760,maxCount:10,accept:"*/*"},oi={animation:"typewriter",speed:60},So={files:!0,voice:"local"},wo={upload:"/ai/agent/upload-file",transcribe:"/ai/agent/transcribe-audio"},tt={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},ri={floating:{main:["theme","history","close"],overflow:["clear","expand","fullscreen","popOut","sound","language"]},inline:{main:["theme","history","close"],overflow:["clear","fullscreen","popOut","sound","language"]},standalone:{main:["theme","history"],overflow:["clear","sound","language"]},page:{main:["theme","history"],overflow:["clear","sound","language"]},modal:{main:["theme","history","close"],overflow:["clear","fullscreen","popOut","sound","language"]},drawer:{main:["theme","history","close"],overflow:["clear","fullscreen","popOut","sound","language"]}},ko={enabled:!0,volume:.3,events:void 0},ii={enabled:!0,events:void 0},ai=[{label:"tabMessages",layout:"chat"}],si={showSearchBar:!0};function bt(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},o=t.behavior??{},i=t.i18n??{},a=t.feedback??{},s=t.footer??{},l=t.header??{},{themeMode:c,themeOverrides:u}=kl(t.theme),p=n.mode??"floating",d=i.locale??El(i.defaultLocale),_=i.availableLocales??[d];return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:(t.baseUrl??h.defaultBaseUrl).replace(/\/$/,""),userContext:yo(t.userContext),pageContext:Po(t.pageContext),position:n.position??"bottom-right",themeMode:c,themeOverrides:u,mode:p,iframe:n.iframe??!1,responseMode:o.responseMode??"streaming",showReasoning:o.showReasoning??!1,showToolCalls:o.showToolCalls??!1,popOutUrl:o.popOutUrl??h.standaloneUrl,welcome:{...oi,...t.welcome},features:{files:t.features?.files??So.files,voice:t.features?.voice??So.voice,tools:t.features?.tools},endpoints:{upload:t.endpoints?.upload??wo.upload,transcribe:t.endpoints?.transcribe??wo.transcribe},attachments:{accept:t.composer?.attachments?.accept??sn.accept,maxBytes:t.composer?.attachments?.maxBytes??sn.maxBytes,maxCount:t.composer?.attachments?.maxCount??sn.maxCount},locale:d,availableLocales:_,startMinimized:o.startMinimized??!0,actions:Cl(p,l.actions),size:n.size??{},launcher:Ll(t.launcher),sound:Al(a.sound),haptics:Tl(a.haptics),strings:en(d,i.strings),stringsOverride:i.strings,composerDisclaimer:s.composerDisclaimer??"",poweredBy:Il(s.poweredBy),composer:Rl(t.composer),modules:Ml(t.modules),storage:t.storage??on,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function kl(e){return typeof e=="string"?{themeMode:e,themeOverrides:{}}:e&&typeof e=="object"?{themeMode:"auto",themeOverrides:e}:{themeMode:"auto",themeOverrides:{}}}function El(e){return e&&e!=="auto"?e:typeof navigator<"u"&&navigator.language?navigator.language:"en"}function Cl(e,t){let n=ri[e];return{main:t?.main??n.main,overflow:t?.overflow??n.overflow}}function Al(e){return{enabled:e?.enabled??ko.enabled,volume:e?.volume??ko.volume,events:e?.events}}function Tl(e){return{enabled:e?.enabled??ii.enabled,events:e?.events}}function Il(e){let n={...{text:`Powered by ${h.displayName}`,href:h.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function Rl(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function Ml(e){let t=e===void 0?ai:e,n=new Set,o=[];for(let a of t.slice(0,4)){if(!a?.label||!a?.layout)continue;let s=a.contentTags?.filter(Boolean),l=a.id??s?.[0]??a.layout;for(;n.has(l);)l=`${l}-${o.length}`;n.add(l);let c={id:l,label:a.label,layout:a.layout};s&&s.length>0&&(c.contentTags=s),a.layout==="home"&&(c.brandName=a.brandName,c.greetingText=a.greetingText,c.showGreeting=a.showGreeting??!0,c.showSearchBar=a.showSearchBar??si.showSearchBar,c.showRecentMessages=a.showRecentMessages??!0,a.userAvatars&&a.userAvatars.length>0&&(c.userAvatars=a.userAvatars),a.status&&(c.status=a.status),c.contentBlockTitle=a.contentBlockTitle),o.push(c)}let i=Object.fromEntries(o.map(a=>[a.id,a]));return{list:o,byId:i}}function Ll(e){let t=e?.callout?.text?{shape:"pill",position:"auto",delayMs:1200,autoDismissMs:0,animated:!0,persistent:!0,...e.callout}:null;return{variant:e?.variant??tt.variant,size:e?.size??tt.size,label:e?.label??tt.label,icon:e?.icon??tt.icon,hidden:e?.hidden??tt.hidden,callout:t}}function Eo(e,t,n){if(t===e.locale&&n===e.themeMode)return e;let o={...e};return t!==e.locale&&(o.locale=t,o.strings=en(t,e.stringsOverride)),n!==e.themeMode&&(o.themeMode=n),o}var Nl=["presentation","behavior","theme","launcher","header","composer","welcome","feedback","i18n","footer","features","endpoints"];function Co(e,t){if(!t)return e;let n={...e};for(let a of Nl){let s=t[a];if(s===void 0)continue;let l=e[a];if(a==="theme"){l===void 0&&(n[a]=s);continue}a!=="i18n"&&(n[a]=li(s,l))}t.modules!==void 0&&e.modules===void 0&&(n.modules=t.modules);let o=e.i18n,i=t.i18n;if(o||i){let a=li(i??{},o),s=o?.strings,l=i?.strings;(s||l)&&(a.strings=Ol(l,s)),n.i18n=a}return n}function li(e,t){if(!t)return e;let n={...e};for(let[o,i]of Object.entries(t))i!==void 0&&(n[o]=i);return n}function Ol(e,t){if(!e)return t;if(!t)return e;let n=nn(e),o=nn(t);if(!n&&!o)return{...e,...t};let i={},a=n?e:{en:e},s=o?t:{en:t};for(let[l,c]of Object.entries(a))i[l]={...c};for(let[l,c]of Object.entries(s))i[l]={...i[l],...c};return i}var Dl=["clear","expand","fullscreen","popOut","sound","history","language","theme","close"],nt=e=>e!=="false",Hl=e=>e.split(",").map(t=>t.trim()).filter(Boolean),$l=[["public-key","publicKey"],["ai-agent-deployment-id","aiAgentDeploymentId"],["base-url","baseUrl"],["theme","theme",e=>e]],Bl=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",nt]],Ul=[["width","width"],["height","height"]],zl=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",nt],["show-reasoning","showReasoning",nt],["show-tool-calls","showToolCalls",nt]],Fl=[["locale","locale"]],J_=new Set(Dl);var Wl=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",nt]],Kl=[["features-files","files",nt],["features-voice","voice",e=>e],["features-tools","tools",Hl]],Gl=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],Vl=[["user-id","id"],["user-email","email"],["user-name","name"]],ql=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],Xl=["launcher-label","callout-text","callout-delay","actions-main","actions-overflow","user-context","page-context"],jl=[$l,Bl,Ul,zl,Fl,Wl,Kl,Gl,Vl,ql],Yl=new Set(["iframe","start-minimized"]),Jl=[...jl.flatMap(e=>e.map(([t])=>t).filter(t=>!Yl.has(t))),...Xl];function ci(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function di(e){return ci(e)}function _i(e){return!(!ci(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function ui(e){return`${h.cssPrefix}:${e}`}function xt(e,t){e.dispatchEvent(new CustomEvent(ui(t)))}function pi(e,t){let o=Object.entries(t).map(([i,a])=>{let s=ui(i),l=()=>a();return e.addEventListener(s,l),[s,l]});return()=>{for(let[i,a]of o)e.removeEventListener(i,a)}}var fi=`:host{--__P__-accent: __BRAND_ACCENT__;--__P__-accent-text: __BRAND_ACCENT_TEXT__;--__P__-radius: __BRAND_RADIUS__;--__P__-radius-sm: 8px;--__P__-radius-md: 10px;--__P__-radius-lg: 16px;--__P__-font: __BRAND_FONT__;--__P__-font-display: var(--__P__-font);--__P__-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;--__P__-bg: oklch(1 0 0);--__P__-bg-elevated: oklch(.9789 .0029 278.3);--__P__-surface: var(--__P__-bg-elevated);--__P__-muted: var(--__P__-fg-muted);--__P__-hover: oklch(.1686 .011 278.3 / .06);--__P__-fg: oklch(.1686 .011 278.3);--__P__-fg-muted: oklch(.4932 .0301 278.3);--__P__-border: oklch(.9312 .0084 278.3);--__P__-border-strong: oklch(.8757 .0131 278.3);--__P__-bubble-user: var(--__P__-accent);--__P__-bubble-user-text: var(--__P__-accent-text);--__P__-bubble-assistant: oklch(.9638 .0058 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-on-accent: var(--__P__-accent-text);--__P__-success: oklch(.6456 .1654 151.53);--__P__-warning: oklch(.7135 .1494 74.05);--__P__-danger: oklch(.5966 .1818 24.51);--__P__-danger-text: oklch(.5054 .1905 27.52);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .1);--__P__-neutral: oklch(.7137 .0192 278.3);--__P__-focus: var(--__P__-accent);--__P__-shadow-panel: 0 8px 24px -8px rgba(13, 15, 20, .18), 0 24px 64px -24px rgba(13, 15, 20, .24);--__P__-shadow-card: 0 1px 2px rgba(13, 15, 20, .06), 0 4px 12px -6px rgba(13, 15, 20, .12);--__P__-backdrop: oklch(.1686 .011 278.3 / .55);--__P__-shadow-fab: 0 6px 16px -4px color-mix(in oklch, var(--__P__-accent) 45%, transparent), 0 12px 32px -12px rgba(13, 15, 20, .25);--__P__-z-fab: 2147483600;--__P__-z-panel: 2147483601;--__P__-panel-w: 380px;--__P__-panel-h: 600px;--__P__-fab-size: 56px;--__P__-space-1: 4px;--__P__-space-2: 8px;--__P__-space-3: 12px;--__P__-space-4: 16px;--__P__-space-5: 20px;--__P__-space-6: 24px;--__P__-space-8: 32px;--__P__-text-xs: 12px;--__P__-text-sm: 13px;--__P__-text-base: 15px;--__P__-text-md: 16px;--__P__-text-lg: 18px;--__P__-text-xl: 22px;--__P__-text-2xl: 30px;--__P__-ease: cubic-bezier(.2, .7, .2, 1);--__P__-ease-out: cubic-bezier(.2, .7, .2, 1);--__P__-ease-in: cubic-bezier(.4, 0, 1, 1);--__P__-ease-in-out: cubic-bezier(.65, 0, .35, 1);--__P__-dur-quick: .12s;--__P__-dur-base: .22s;--__P__-dur-slow: .32s;font-family:var(--__P__-font);color:var(--__P__-fg);color-scheme:light}:host([data-theme="dark"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-danger-text: oklch(.8077 .1035 19.57);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .18);--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);--__P__-shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px -6px rgba(0, 0, 0, .5);--__P__-backdrop: rgba(0, 0, 0, .65);color-scheme:dark}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);color-scheme:dark}}@media(prefers-reduced-motion:reduce){:host{--__P__-dur-quick: 1ms;--__P__-dur-base: 1ms;--__P__-dur-slow: 1ms}}
|
|
2
2
|
`;var gi=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0;border:0}button{font:inherit;color:inherit;background:none;cursor:pointer;-webkit-appearance:none;appearance:none;line-height:1}button:focus-visible,[tabindex]:focus-visible,textarea:focus-visible,input:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}textarea,input{font:inherit;color:inherit;background:none;border:0;outline:0;resize:none}a{color:var(--__P__-accent);text-decoration:underline;text-underline-offset:2px}img,svg{display:block;max-width:100%}ul,ol{list-style:none}.__P__-app{display:block;width:100%;height:100%;font-family:var(--__P__-font);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-feature-settings:"cv11","ss01","ss03"}.__P__-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
|
|
3
3
|
`;var mi=`.__P__-anchor{right:16px;bottom:16px}:host([data-position="bottom-left"]) .__P__-anchor,:host([data-position="top-left"]) .__P__-anchor{right:auto;left:16px}:host([data-position="top-right"]) .__P__-anchor,:host([data-position="top-left"]) .__P__-anchor{bottom:auto;top:16px}.__P__-anchor{position:fixed;display:flex;flex-direction:column;align-items:flex-end;gap:var(--__P__-space-3);pointer-events:none}.__P__-anchor{--__P__-fab-size: 56px}.__P__-anchor[data-launcher-size=sm]{--__P__-fab-size: 44px}.__P__-anchor[data-launcher-size=md]{--__P__-fab-size: 56px}.__P__-anchor[data-launcher-size=lg]{--__P__-fab-size: 68px}.__P__-anchor>*{pointer-events:auto}.__P__-fab[data-size=sm]{--__P__-fab-size: 44px;font-size:var(--__P__-text-sm)}.__P__-fab[data-size=md]{--__P__-fab-size: 56px;font-size:14px}.__P__-fab[data-size=lg]{--__P__-fab-size: 68px;font-size:var(--__P__-text-base)}.__P__-fab{display:inline-flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);color:var(--__P__-accent-text);background:var(--__P__-accent);box-shadow:var(--__P__-shadow-fab);font-weight:600;line-height:1;transform-origin:bottom right;animation:__P__-fab-in var(--__P__-dur-base) var(--__P__-ease) both;transition:transform var(--__P__-dur-base) var(--__P__-ease),opacity var(--__P__-dur-base) var(--__P__-ease),box-shadow var(--__P__-dur-base) var(--__P__-ease)}.__P__-fab:hover{transform:translateY(-2px)}.__P__-fab:active{transform:translateY(0)}.__P__-fab:focus-visible{outline:2px solid var(--__P__-on-accent);outline-offset:3px}.__P__-fab svg{width:24px;height:24px;flex-shrink:0}@keyframes __P__-fab-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:none}}.__P__-fab[data-leaving]{position:absolute;right:0;bottom:0;animation:__P__-fab-out var(--__P__-dur-quick) var(--__P__-ease) forwards;pointer-events:none}:host([data-position^="top-"]) .__P__-fab[data-leaving]{bottom:auto;top:0}:host([data-position$="-left"]) .__P__-fab[data-leaving]{right:auto;left:0}@keyframes __P__-fab-out{0%{opacity:1;transform:none}to{opacity:0;transform:scale(.85)}}.__P__-fab[data-variant=circle]{width:var(--__P__-fab-size);height:var(--__P__-fab-size);border-radius:999px}.__P__-fab[data-variant=circle] .__P__-fab-label{display:none}.__P__-fab[data-variant=pill]{height:var(--__P__-fab-size);padding:0 18px 0 16px;border-radius:999px}.__P__-fab[data-variant=bar]{height:var(--__P__-fab-size);padding:0 22px;border-radius:var(--__P__-radius)}.__P__-fab[data-variant=minimal]{height:var(--__P__-fab-size);padding:0 var(--__P__-space-4);border-radius:999px;background:transparent;color:var(--__P__-accent);box-shadow:none;border:1px solid currentColor}.__P__-fab[data-variant=minimal]:hover{background:color-mix(in srgb,var(--__P__-accent) 12%,transparent)}.__P__-callout{--__P__-callout-fab-h: var(--__P__-fab-size, 56px);--__P__-callout-gap: clamp(12px, calc(var(--__P__-callout-fab-h) * .25), 22px);--__P__-callout-nudge-direction: -1;position:absolute;display:inline-flex;align-items:center;gap:var(--__P__-space-2);padding:10px 14px;background:var(--__P__-fg);color:var(--__P__-bg);border-radius:999px;font-size:var(--__P__-text-sm);font-weight:600;line-height:1.2;box-shadow:0 10px 30px -8px #00000059;pointer-events:auto;animation:__P__-callout-in var(--__P__-dur-slow) var(--__P__-ease);z-index:1;max-width:240px;white-space:nowrap}.__P__-callout[data-position=left]{right:calc(100% + var(--__P__-callout-gap));bottom:calc(var(--__P__-callout-fab-h) / 2);transform:translateY(50%)}.__P__-callout[data-position=right]{left:calc(100% + var(--__P__-callout-gap));bottom:calc(var(--__P__-callout-fab-h) / 2);transform:translateY(50%);--__P__-callout-nudge-direction: 1}.__P__-callout[data-position=top]{bottom:calc(100% + var(--__P__-callout-gap));right:0;max-width:min(280px,calc(100vw - 32px))}.__P__-callout[data-position=bottom]{top:calc(100% + var(--__P__-callout-gap));right:0;max-width:min(280px,calc(100vw - 32px))}:host([data-position$="-left"]) .__P__-callout[data-position=top],:host([data-position$="-left"]) .__P__-callout[data-position=bottom]{right:auto;left:0}.__P__-callout[data-shape=bubble]{border-radius:var(--__P__-radius-md);white-space:normal;width:max-content;max-width:min(280px,calc(100vw - 32px))}.__P__-callout[data-shape=callout]{padding:12px 18px;font-size:14px;background:var(--__P__-accent);color:var(--__P__-accent-text)}.__P__-callout:after{content:"";position:absolute;width:12px;height:12px;background:inherit;border-radius:2px;transform:rotate(45deg)}.__P__-callout[data-position=left]:after{right:-5px;top:50%;margin-top:-6px}.__P__-callout[data-position=right]:after{left:-5px;top:50%;margin-top:-6px}.__P__-callout[data-position=top]:after{bottom:-5px;right:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}.__P__-callout[data-position=bottom]:after{top:-5px;right:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}:host([data-position$="-left"]) .__P__-callout[data-position=top]:after,:host([data-position$="-left"]) .__P__-callout[data-position=bottom]:after{right:auto;left:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}.__P__-callout[data-animated]{animation:__P__-callout-in var(--__P__-dur-slow) var(--__P__-ease),__P__-callout-nudge 1.6s var(--__P__-ease-in-out) var(--__P__-dur-slow) infinite}@keyframes __P__-callout-in{0%{opacity:0}to{opacity:1}}@keyframes __P__-callout-nudge{0%,to{margin-left:0;margin-right:0}50%{margin-left:calc(6px * var(--__P__-callout-nudge-direction));margin-right:calc(-6px * var(--__P__-callout-nudge-direction))}}@media(prefers-reduced-motion:reduce){.__P__-callout[data-animated]{animation:__P__-callout-in 1ms var(--__P__-ease)}.__P__-icon-btn[data-recording=true],.__P__-typing span{animation:none}}.__P__-callout-close{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:999px;color:inherit;opacity:.7;cursor:pointer}.__P__-callout-close:hover{opacity:1;background:#ffffff26}.__P__-callout-close svg{width:12px;height:12px}.__P__-panel{width:var(--__P__-panel-w);height:var(--__P__-panel-h);max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);background:var(--__P__-bg);color:var(--__P__-fg);border-radius:var(--__P__-radius-lg);box-shadow:var(--__P__-shadow-panel);display:flex;flex-direction:column;overflow:hidden;transform-origin:bottom right;animation:__P__-panel-in var(--__P__-dur-slow) var(--__P__-ease);border:1px solid var(--__P__-border)}:host([data-mode="open"]) .__P__-panel{width:var(--__P__-widget-w, var(--__P__-panel-w));height:var(--__P__-widget-h, var(--__P__-panel-h));min-width:var(--__P__-resize-min-w, auto);min-height:var(--__P__-resize-min-h, auto);max-width:var(--__P__-resize-max-w, calc(100vw - 32px) );max-height:var(--__P__-resize-max-h, calc(100dvh - 32px) )}@keyframes __P__-panel-in{0%{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}:host([data-mode="expanded"]) .__P__-panel{width:var(--__P__-expanded-w, 640px);height:var(--__P__-expanded-h, 820px);max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px)}:host([data-mode="fullscreen"]){z-index:var(--__P__-z-panel)!important}:host([data-mode="fullscreen"]) .__P__-anchor{inset:0;align-items:stretch;padding:0}:host([data-mode="fullscreen"]) .__P__-panel{width:100vw;height:100dvh;max-width:none;max-height:none;border-radius:0;border:0}:host([data-mode="fullscreen"]) .__P__-fab{display:none}:host([data-mode="inline"]) .__P__-anchor,:host([data-mode="standalone"]) .__P__-anchor{position:static;inset:auto;padding:0;align-items:stretch;width:100%;height:100%;min-height:0}:host([data-mode="inline"]) .__P__-panel,:host([data-mode="standalone"]) .__P__-panel{width:100%;height:100%;min-width:0;min-height:0;max-width:none;max-height:none;animation:none}:host([data-mode="inline"]) .__P__-fab,:host([data-mode="standalone"]) .__P__-fab{display:none}:host([data-mode="inline"]){min-height:320px}:host([data-mode="inline"]) .__P__-panel{border-radius:var(--__P__-radius)}:host([data-mode="standalone"]) .__P__-panel{border-radius:0;border:0;box-shadow:none}:host([data-mode="modal"]){position:fixed!important;inset:0!important;z-index:var(--__P__-z-panel)!important;display:block!important;width:100vw;height:100dvh;background:var(--__P__-modal-backdrop, var(--__P__-backdrop));animation:__P__-backdrop-in var(--__P__-dur-base) var(--__P__-ease) both;--__P__-panel-w: min(960px, 92vw);--__P__-panel-h: min(720px, 88dvh)}:host([data-mode="modal"]) .__P__-anchor{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:var(--__P__-space-6);pointer-events:none}:host([data-mode="modal"]) .__P__-panel{pointer-events:auto;width:var(--__P__-widget-w, var(--__P__-panel-w));height:var(--__P__-widget-h, var(--__P__-panel-h));max-width:calc(100vw - 48px);max-height:calc(100dvh - 48px);min-width:0;min-height:0;border-radius:var(--__P__-radius);box-shadow:var(--__P__-shadow-panel);animation:__P__-modal-in var(--__P__-dur-base) var(--__P__-ease);translate:var(--__P__-modal-dx, 0px) var(--__P__-modal-dy, 0px)}:host([data-mode="modal"]) .__P__-header,:host([data-mode="modal"]) .__P__-back-header,:host([data-mode="modal"]) .__P__-home-hero{cursor:grab;touch-action:none}:host([data-mode="modal"]) .__P__-panel[data-dragging]{cursor:grabbing;user-select:none}:host([data-mode="modal"]) .__P__-panel[data-dragging] *{cursor:grabbing}:host([data-mode="modal"]) .__P__-fab{display:none}@keyframes __P__-backdrop-in{0%{background:#0000}to{background:var(--__P__-modal-backdrop, var(--__P__-backdrop))}}@keyframes __P__-modal-in{0%{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}:host([data-mode="drawer"]){--__P__-panel-w: min(440px, calc(100vw - 32px) );--__P__-panel-h: 100dvh}:host([data-mode="drawer"]) .__P__-anchor{position:fixed;--__P__-inset-x: var(--__P__-panel-inset, 12px);--__P__-inset-y: var(--__P__-panel-inset, 3dvh);top:var(--__P__-inset-y);bottom:auto;right:var(--__P__-inset-x);left:auto;width:min(var(--__P__-widget-w, var(--__P__-panel-w)),calc(100vw - var(--__P__-inset-x) * 2));height:min(var(--__P__-widget-h, var(--__P__-panel-h)),calc(100dvh - var(--__P__-inset-y) * 2));padding:0;display:block;pointer-events:auto}:host([data-mode="drawer"][data-position$="-left"]) .__P__-anchor{right:auto;left:var(--__P__-inset-x)}:host([data-mode="drawer"][data-position^="bottom-"]) .__P__-anchor{top:auto;bottom:var(--__P__-inset-y)}:host([data-mode="drawer"]) .__P__-panel{width:100%;height:100%;max-width:none;max-height:none;min-width:0;min-height:0;border-radius:var(--__P__-radius, 12px);border:1px solid var(--__P__-border);box-shadow:-8px 16px 32px -12px #00000038;animation:__P__-drawer-in var(--__P__-dur-base) var(--__P__-ease)}:host([data-mode="drawer"][data-position$="-left"]) .__P__-panel{box-shadow:8px 16px 32px -12px #00000038;animation:__P__-drawer-in-left var(--__P__-dur-base) var(--__P__-ease)}.__P__-fab[data-edge-tab]{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--__P__-space-2);position:fixed;top:50%;height:140px;width:auto;min-width:0;padding:10px 8px;writing-mode:vertical-rl;text-orientation:mixed;transform:translateY(-50%);transform-origin:center;animation:__P__-edge-tab-in var(--__P__-dur-base) var(--__P__-ease) both}.__P__-fab[data-edge-tab] svg{writing-mode:horizontal-tb}.__P__-fab[data-edge-tab]:hover{transform:translateY(-50%) scale(1.03)}.__P__-fab[data-edge-tab]:active{transform:translateY(-50%) scale(.97)}:host([data-position$="-right"]) .__P__-fab[data-edge-tab]{right:0;left:auto;border-radius:12px 0 0 12px;box-shadow:-6px 0 18px -8px #0000004d}:host([data-position$="-left"]) .__P__-fab[data-edge-tab]{left:0;right:auto;border-radius:0 12px 12px 0;box-shadow:6px 0 18px -8px #0000004d}.__P__-fab[data-edge-tab][data-leaving]{position:fixed;top:50%;bottom:auto;animation:__P__-edge-tab-out var(--__P__-dur-quick) var(--__P__-ease) forwards}@keyframes __P__-edge-tab-in{0%{opacity:0;transform:translateY(-50%) scale(.9)}to{opacity:1;transform:translateY(-50%) scale(1)}}@keyframes __P__-edge-tab-out{0%{opacity:1;transform:translateY(-50%) scale(1)}to{opacity:0;transform:translateY(-50%) scale(.85)}}@keyframes __P__-drawer-in{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes __P__-drawer-in-left{0%{transform:translate(-100%)}to{transform:translate(0)}}@media(prefers-reduced-motion:reduce){:host([data-mode="drawer"]) .__P__-panel,.__P__-fab[data-edge-tab]{animation:none}}.__P__-header{display:flex;align-items:center;gap:var(--__P__-space-2);padding:12px 14px;border-bottom:1px solid var(--__P__-border);background:var(--__P__-bg)}.__P__-header h1{font-size:14px;font-weight:600;flex:1;letter-spacing:-.01em}.__P__-agent{flex:1;display:inline-flex;align-items:center;gap:10px;min-width:0}.__P__-agent-avatar{position:relative;width:32px;height:32px;border-radius:999px;background:var(--__P__-bg-elevated);color:var(--__P__-fg-muted);display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:var(--__P__-text-xs);overflow:hidden;flex-shrink:0}.__P__-agent-avatar img{width:100%;height:100%;object-fit:cover}.__P__-agent-avatar:after{content:"";position:absolute;right:-1px;bottom:-1px;width:10px;height:10px;border-radius:999px;border:2px solid var(--__P__-bg);background:var(--__P__-neutral)}.__P__-agent-avatar[data-status=online]:after{background:var(--__P__-success)}.__P__-agent-avatar[data-status=away]:after{background:var(--__P__-warning)}.__P__-agent-avatar[data-status=offline]:after{background:var(--__P__-neutral)}.__P__-agent-meta{display:flex;flex-direction:column;line-height:1.15;min-width:0}.__P__-agent-meta strong{font-size:14px;font-weight:600;letter-spacing:-.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-agent-meta span{font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-suggestions{display:flex;flex-wrap:nowrap;gap:var(--__P__-space-2);padding:6px 14px 10px;overflow-x:auto;overflow-y:hidden;scroll-behavior:smooth;scroll-snap-type:x proximity;scrollbar-width:none;-ms-overflow-style:none;min-width:0}.__P__-suggestions::-webkit-scrollbar{display:none}.__P__-suggestions:before,.__P__-suggestions:after{content:"";flex:1 1 0;min-width:0}.__P__-suggestion{flex:0 0 auto;scroll-snap-align:center;padding:7px 14px;border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);color:var(--__P__-fg);font-size:var(--__P__-text-sm);font-weight:500;white-space:nowrap;transition:background var(--__P__-dur-quick) var(--__P__-ease),border-color var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease)}.__P__-suggestion:hover{border-color:var(--__P__-accent);color:var(--__P__-accent);transform:translateY(-1px)}.__P__-suggestion:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px;border-color:var(--__P__-accent)}.__P__-suggestion:active{transform:translateY(0)}.__P__-icon-btn{width:32px;height:32px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted);transition:background var(--__P__-dur-quick) var(--__P__-ease),color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-icon-btn:hover{background:var(--__P__-bg-elevated);color:var(--__P__-fg)}.__P__-icon-btn:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-icon-btn:active{background:var(--__P__-border)}.__P__-icon-btn:disabled{opacity:.45;cursor:not-allowed}.__P__-icon-btn:before{content:"";position:absolute;inset:-6px}.__P__-icon-btn{position:relative}.__P__-icon-btn svg{width:18px;height:18px}.__P__-icon-btn[data-recording=true]{color:var(--__P__-accent);background:color-mix(in srgb,var(--__P__-accent) 12%,transparent);animation:__P__-pulse 1.2s var(--__P__-ease) infinite}@keyframes __P__-pulse{0%,to{box-shadow:0 0 color-mix(in srgb,var(--__P__-accent) 40%,transparent)}50%{box-shadow:0 0 0 6px color-mix(in srgb,var(--__P__-accent) 0%,transparent)}}.__P__-list{flex:1;min-height:0;overflow-y:auto;padding:var(--__P__-space-4);display:flex;flex-direction:column;gap:14px;scroll-behavior:smooth;scrollbar-width:thin;scrollbar-color:var(--__P__-border-strong) transparent;scrollbar-gutter:stable}.__P__-list::-webkit-scrollbar{width:8px}.__P__-list::-webkit-scrollbar-thumb{background:var(--__P__-border-strong);border-radius:8px}.__P__-bubble-row{display:flex}.__P__-bubble-row[data-role=user]{justify-content:flex-end}.__P__-bubble-row[data-role=assistant]{justify-content:flex-start}.__P__-bubble{max-width:85%;padding:var(--__P__-space-3) var(--__P__-space-4);border-radius:var(--__P__-radius);line-height:1.6;font-size:14px;word-wrap:break-word;overflow-wrap:anywhere;box-shadow:0 1px 2px #0000000a,0 1px 8px -4px #0000000f;animation:__P__-bubble-in var(--__P__-dur-base) var(--__P__-ease)}.__P__-bubble ::selection{background:color-mix(in srgb,var(--__P__-accent) 30%,transparent)}@keyframes __P__-bubble-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.__P__-bubble-row[data-role=user] .__P__-bubble{background:var(--__P__-bubble-user);color:var(--__P__-bubble-user-text);border-bottom-right-radius:var(--__P__-radius-sm)}.__P__-bubble-row[data-role=assistant] .__P__-bubble{background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border-bottom-left-radius:var(--__P__-radius-sm)}.__P__-md>*:first-child{margin-top:0}.__P__-md>*:last-child{margin-bottom:0}.__P__-md p{margin:10px 0}.__P__-md h1,.__P__-md h2,.__P__-md h3,.__P__-md h4,.__P__-md h5,.__P__-md h6{margin:18px 0 8px;line-height:1.3;letter-spacing:-.01em;font-weight:700}.__P__-md h1{font-size:1.4em}.__P__-md h2{font-size:1.22em}.__P__-md h3{font-size:1.08em}.__P__-md h4,.__P__-md h5,.__P__-md h6{font-size:1em}.__P__-md>h1:first-child,.__P__-md>h2:first-child,.__P__-md>h3:first-child,.__P__-md>h4:first-child,.__P__-md>h5:first-child,.__P__-md>h6:first-child{margin-top:0}.__P__-md ul,.__P__-md ol{padding-left:1.5em;margin:10px 0}.__P__-md ul{list-style:disc}.__P__-md ol{list-style:decimal}.__P__-md li{margin:6px 0;padding-left:2px}.__P__-md li::marker{color:var(--__P__-fg-muted)}.__P__-md li>p{margin:6px 0}.__P__-md li>ul,.__P__-md li>ol{margin:6px 0}.__P__-md strong,.__P__-md b{font-weight:650;letter-spacing:-.005em}.__P__-md em,.__P__-md i{font-style:italic}.__P__-md code{font-family:var(--__P__-font-mono);font-size:.86em;padding:1px 6px;border-radius:5px;background:color-mix(in srgb,var(--__P__-accent) 10%,transparent);color:var(--__P__-fg);border:1px solid color-mix(in srgb,var(--__P__-accent) 16%,transparent)}.__P__-md pre{font-family:var(--__P__-font-mono);font-size:12.5px;padding:12px 14px;border-radius:var(--__P__-radius-sm);background:#7f7f7f1f;overflow-x:auto;margin:var(--__P__-space-3) 0;line-height:1.5}.__P__-md pre code{padding:0;background:none}.__P__-md a{color:inherit;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.__P__-md a:hover{text-decoration-thickness:2px}.__P__-md blockquote{margin:14px 0;padding:6px 14px;border-left:3px solid color-mix(in srgb,var(--__P__-accent) 50%,transparent);background:color-mix(in srgb,var(--__P__-accent) 5%,transparent);border-radius:0 var(--__P__-radius-sm) var(--__P__-radius-sm) 0;color:var(--__P__-fg-muted)}.__P__-md blockquote>:first-child{margin-top:0}.__P__-md blockquote>:last-child{margin-bottom:0}.__P__-md hr{border:0;height:1px;background:color-mix(in srgb,currentColor 18%,transparent);margin:var(--__P__-space-4) 0}.__P__-md table{border-collapse:collapse;margin:var(--__P__-space-3) 0;font-size:.95em;display:block;overflow-x:auto;max-width:100%;font-variant-numeric:tabular-nums}.__P__-md th,.__P__-md td{padding:6px 10px;border-bottom:1px solid color-mix(in srgb,currentColor 12%,transparent);text-align:left}.__P__-md th{font-weight:700;background:color-mix(in srgb,currentColor 6%,transparent)}.__P__-md h1+ul,.__P__-md h1+ol,.__P__-md h2+ul,.__P__-md h2+ol,.__P__-md h3+ul,.__P__-md h3+ol,.__P__-md h4+ul,.__P__-md h4+ol{margin-top:var(--__P__-space-1)}.__P__-loading{display:inline-flex;align-items:center;gap:var(--__P__-space-2);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-loading-spinner{width:14px;height:14px;border-radius:999px;border:2px solid currentColor;border-top-color:transparent;animation:__P__-spin .8s linear infinite}@keyframes __P__-spin{to{transform:rotate(1turn)}}.__P__-typing{display:inline-flex;gap:var(--__P__-space-1);padding:var(--__P__-space-1) 0}.__P__-typing span{width:6px;height:6px;border-radius:999px;background:currentColor;opacity:.4;animation:__P__-blink 1.2s var(--__P__-ease) infinite}.__P__-typing span:nth-child(2){animation-delay:.2s}.__P__-typing span:nth-child(3){animation-delay:.4s}@keyframes __P__-blink{0%,80%,to{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-2px)}}.__P__-reasoning{margin:var(--__P__-space-1) 0 var(--__P__-space-2);padding-left:var(--__P__-space-3);border-left:2px solid var(--__P__-border-strong)}.__P__-reasoning-summary{display:inline-flex;align-items:center;gap:var(--__P__-space-1);cursor:pointer;list-style:none;user-select:none;color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);font-weight:600}.__P__-reasoning-summary::-webkit-details-marker{display:none}.__P__-reasoning-summary:before{content:"";width:5px;height:5px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(-45deg);opacity:.7;transition:transform var(--__P__-dur-quick) var(--__P__-ease)}.__P__-reasoning[open] .__P__-reasoning-summary:before{transform:rotate(45deg)}.__P__-reasoning[data-active=true] .__P__-reasoning-label{animation:__P__-reasoning-pulse 1.4s var(--__P__-ease) infinite}@keyframes __P__-reasoning-pulse{0%,to{opacity:.5}50%{opacity:1}}@media(prefers-reduced-motion:reduce){.__P__-reasoning[data-active=true] .__P__-reasoning-label{animation:none}}.__P__-reasoning-body{margin-top:var(--__P__-space-1);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-reasoning-body>:first-child{margin-top:0}.__P__-reasoning-body>:last-child{margin-bottom:0}.__P__-tool-chip{display:inline-flex;align-items:center;gap:6px;padding:var(--__P__-space-1) var(--__P__-space-2);margin-top:6px;border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs)}.__P__-composer{border-top:1px solid var(--__P__-border);padding:10px 12px;background:var(--__P__-bg);display:flex;flex-direction:column;gap:var(--__P__-space-2)}.__P__-composer-row{display:flex;align-items:flex-end;gap:6px}.__P__-textarea{flex:1;height:40px;max-height:160px;padding:10px 12px;border-radius:var(--__P__-radius);background:var(--__P__-bg-elevated);border:1px solid transparent;font-size:14px;line-height:1.4;transition:height var(--__P__-dur-quick) var(--__P__-ease),border-color var(--__P__-dur-quick) var(--__P__-ease),box-shadow var(--__P__-dur-quick) var(--__P__-ease)}.__P__-textarea:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:1px;border-color:var(--__P__-focus)}@media(pointer:coarse){.__P__-textarea,.__P__-home-search-input{font-size:16px}.__P__-textarea{height:44px}}.__P__-send{width:40px;height:40px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease),background var(--__P__-dur-quick) var(--__P__-ease)}.__P__-send[data-shape=circle]{border-radius:999px}.__P__-send[data-shape=square]{border-radius:var(--__P__-radius-sm)}.__P__-send[data-shape=pill]{width:auto;padding:0 18px;border-radius:999px}.__P__-send[data-variant=filled]{background:var(--__P__-accent);color:var(--__P__-accent-text)}.__P__-send[data-variant=outline]{background:transparent;color:var(--__P__-accent);border-color:var(--__P__-accent)}.__P__-send[data-variant=outline]:not(:disabled):hover{background:color-mix(in srgb,var(--__P__-accent) 10%,transparent)}.__P__-send[data-variant=ghost]{background:transparent;color:var(--__P__-accent)}.__P__-send[data-variant=ghost]:not(:disabled):hover{background:color-mix(in srgb,var(--__P__-accent) 8%,transparent)}.__P__-send:disabled{opacity:.4;cursor:not-allowed}.__P__-send:not(:disabled):hover{transform:translateY(-1px)}.__P__-send:not(:disabled):active{transform:translateY(0)}.__P__-send:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-send svg{width:18px;height:18px}.__P__-composer-actions{display:flex;gap:var(--__P__-space-1);flex-wrap:wrap}.__P__-attachments{display:flex;flex-wrap:wrap;gap:6px}.__P__-attachment-chip{display:inline-flex;align-items:center;gap:6px;padding:var(--__P__-space-1) var(--__P__-space-2) var(--__P__-space-1) var(--__P__-space-1);border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);font-size:var(--__P__-text-xs);max-width:200px}.__P__-attachment-thumb{width:24px;height:24px;border-radius:999px;object-fit:cover;background:var(--__P__-border)}.__P__-attachment-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-attachment-remove{width:18px;height:18px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted)}.__P__-attachment-remove:hover{background:var(--__P__-border);color:var(--__P__-fg)}.__P__-dropzone{position:absolute;inset:8px;border:2px dashed var(--__P__-accent);border-radius:var(--__P__-radius);background:color-mix(in srgb,var(--__P__-accent) 8%,transparent);display:flex;align-items:center;justify-content:center;font-weight:600;color:var(--__P__-accent);pointer-events:none;z-index:10;animation:__P__-fade-in var(--__P__-dur-quick) var(--__P__-ease)}@keyframes __P__-fade-in{0%{opacity:0}to{opacity:1}}.__P__-error{margin-top:var(--__P__-space-1);padding:8px 10px;border-radius:var(--__P__-radius-sm);background:var(--__P__-danger-bg);color:var(--__P__-danger-text);font-size:var(--__P__-text-sm);display:flex;align-items:center;gap:var(--__P__-space-2)}.__P__-error button{color:inherit;text-decoration:underline;font-size:var(--__P__-text-sm)}.__P__-history{flex:1;overflow-y:auto;padding:var(--__P__-space-2) var(--__P__-space-1) var(--__P__-space-3)}.__P__-history-footer{flex:none;padding:var(--__P__-space-2) var(--__P__-space-3) var(--__P__-space-3);border-top:1px solid var(--__P__-border);background:var(--__P__-surface)}.__P__-history-new{width:100%;display:flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);padding:var(--__P__-space-2) var(--__P__-space-3);border:none;border-radius:var(--__P__-radius-md);background:var(--__P__-accent);color:var(--__P__-on-accent);cursor:pointer;font-size:var(--__P__-text-sm);font-weight:600;transition:filter var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-history-new svg{width:16px;height:16px}.__P__-history-new:hover{filter:brightness(1.08)}.__P__-history-new:active{transform:translateY(1px)}.__P__-history-new:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-history-empty{flex:1;display:flex;align-items:center;justify-content:center;padding:40px 16px;color:var(--__P__-fg-muted);font-size:14px;text-align:center}.__P__-history-group{display:flex;flex-direction:column;padding:0 var(--__P__-space-2)}.__P__-history-heading{font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);padding:12px 8px 6px;text-transform:uppercase;letter-spacing:.04em}.__P__-history-item{all:unset;display:flex;flex-direction:column;gap:3px;padding:10px 12px;border-radius:var(--__P__-radius-md);cursor:pointer;transition:background var(--__P__-dur-base) var(--__P__-ease)}.__P__-history-item:hover{background:var(--__P__-bg-elevated)}.__P__-history-item:focus-visible{background:var(--__P__-bg-elevated);outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-history-title{font-size:14px;font-weight:500;color:var(--__P__-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-history-preview{font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-history-item[data-closed=true] .__P__-history-title:after{content:"\\2022";margin-left:var(--__P__-space-2);opacity:.5}.__P__-list-loading{margin:auto;padding:var(--__P__-space-6) var(--__P__-space-4);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);text-align:center}.__P__-readonly-banner{display:flex;flex-direction:column;align-items:center;gap:10px;padding:14px 12px;margin:0 var(--__P__-space-3) var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg-elevated);color:var(--__P__-fg-muted);text-align:center;font-size:var(--__P__-text-sm)}.__P__-readonly-label{line-height:1.4}.__P__-readonly-cta{appearance:none;border:0;cursor:pointer;padding:var(--__P__-space-2) var(--__P__-space-4);border-radius:999px;background:var(--__P__-accent);color:var(--__P__-accent-text, #fff);font:inherit;font-weight:600;font-size:var(--__P__-text-sm);transition:filter var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-readonly-cta:hover,.__P__-readonly-cta:focus-visible{filter:brightness(1.1)}.__P__-readonly-cta:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}.__P__-composer-footer{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:10px 16px;margin:0 var(--__P__-space-3);border-top:1px solid var(--__P__-border);text-align:center;font-size:11px;line-height:1.4;color:var(--__P__-fg-muted)}.__P__-disclaimer{max-width:320px;margin:0 auto;opacity:.9;letter-spacing:.01em}.__P__-poweredby{display:inline-flex;align-items:center;justify-content:center;gap:6px;color:inherit;text-decoration:none;opacity:.7;transition:opacity var(--__P__-dur-base) var(--__P__-ease);font-size:11px;letter-spacing:.02em}.__P__-poweredby:hover{opacity:1}.__P__-poweredby-logo{height:12px;width:auto;display:inline-block;vertical-align:middle}.__P__-poweredby-bar{flex:none;display:flex;align-items:center;justify-content:center;padding:6px 16px;border-top:1px solid var(--__P__-border);background:var(--__P__-bg-elevated)}.__P__-menu-wrap{position:relative;display:inline-flex}.__P__-menu{position:absolute;top:100%;right:0;margin-top:6px;min-width:200px;padding:6px;background:var(--__P__-bg);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);box-shadow:var(--__P__-shadow-panel);z-index:10;display:flex;flex-direction:column;gap:2px;animation:__P__-menu-in var(--__P__-dur-base) var(--__P__-ease)}@media(prefers-reduced-motion:reduce){.__P__-menu{animation:none}}@keyframes __P__-menu-in{0%{opacity:0;transform:translateY(-4px) scale(.98);transform-origin:top right}to{opacity:1;transform:none}}.__P__-menu-item{all:unset;display:flex;align-items:center;gap:10px;padding:8px 10px;font-size:var(--__P__-text-sm);color:var(--__P__-fg);border-radius:var(--__P__-radius-sm);cursor:pointer;user-select:none}.__P__-menu-item:hover{background:var(--__P__-bg-elevated)}.__P__-menu-item:focus-visible{background:var(--__P__-bg-elevated);outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-menu-item[disabled]{opacity:.45;cursor:not-allowed}.__P__-menu-icon{display:inline-flex;width:16px;height:16px;color:var(--__P__-fg-muted)}.__P__-menu-icon svg{width:16px;height:16px}.__P__-menu-label{flex:1}.__P__-menu-check{display:inline-flex;color:var(--__P__-accent)}.__P__-menu-check svg{width:14px;height:14px}.__P__-resize-grip{position:absolute;width:18px;height:18px;display:flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted);opacity:.45;transition:opacity var(--__P__-dur-base) var(--__P__-ease);z-index:2;touch-action:none;user-select:none}.__P__-resize-grip:hover,.__P__-resize-grip:focus-visible{opacity:1}.__P__-resize-grip svg{width:10px;height:10px}.__P__-resize-grip--bottom-left{bottom:2px;left:2px;cursor:nesw-resize;transform:scaleX(-1)}.__P__-resize-grip--bottom-right{bottom:2px;right:2px;cursor:nwse-resize}.__P__-resize-grip--top-left{top:2px;left:2px;cursor:nwse-resize;transform:rotate(180deg)}.__P__-resize-grip--top-right{top:2px;right:2px;cursor:nesw-resize;transform:scaleY(-1)}:host(:not([data-mode="open"])) .__P__-resize-grip{display:none}.__P__-messenger{display:flex;flex-direction:column;overflow:hidden}.__P__-messenger-body{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.__P__-module{display:flex;flex-direction:column;height:100%;min-height:0}.__P__-module-scroll{flex:1;min-height:0;overflow-y:auto;padding:var(--__P__-space-3);display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-home{background:radial-gradient(125% 65% at 88% 0%,color-mix(in srgb,#fff 16%,transparent),transparent 55%),linear-gradient(180deg,var(--__P__-accent) 0%,var(--__P__-accent) 22%,color-mix(in srgb,var(--__P__-accent) 28%,var(--__P__-surface)) 44%,var(--__P__-surface) 70%);border-radius:var(--__P__-radius-lg) var(--__P__-radius-lg) 0 0}.__P__-home-scroll{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;background:transparent}.__P__-home-cards{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:4px 14px 16px}.__P__-module-pad{padding:var(--__P__-space-3) var(--__P__-space-3) 0}.__P__-module-empty{display:flex;flex-direction:column;align-items:center;gap:var(--__P__-space-3);padding:var(--__P__-space-8) var(--__P__-space-4);text-align:center;color:var(--__P__-fg-muted);font-size:var(--__P__-text-base)}.__P__-module-retry{padding:var(--__P__-space-2) var(--__P__-space-4);border:1px solid var(--__P__-border-strong);border-radius:var(--__P__-radius-sm);color:var(--__P__-fg);font-weight:600;cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out),border-color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-module-retry:hover{background:var(--__P__-hover);border-color:var(--__P__-accent)}.__P__-module-retry:active{background:var(--__P__-border)}.__P__-module-retry:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-help-list{flex:1;min-height:0;overflow-y:auto;padding-bottom:var(--__P__-space-3)}.__P__-help-group{display:flex;flex-direction:column}.__P__-help-section-title{position:sticky;top:0;z-index:1;margin:0;padding:var(--__P__-space-3) var(--__P__-space-5) var(--__P__-space-2);font-size:var(--__P__-text-xs);font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--__P__-fg-muted);background:var(--__P__-bg)}.__P__-help-card{margin:0 var(--__P__-space-3) var(--__P__-space-3);background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden}.__P__-help-card .__P__-list-row{border-bottom:0;border-radius:0}.__P__-help-card .__P__-list-row+.__P__-list-row{border-top:1px solid var(--__P__-border)}.__P__-help-card .__P__-list-row:hover{background:var(--__P__-hover)}.__P__-module-cta{padding:var(--__P__-space-3);border-top:1px solid var(--__P__-border)}.__P__-tabbar{display:flex;border-top:1px solid var(--__P__-border);background:var(--__P__-bg-elevated);flex-shrink:0}.__P__-tab{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--__P__-space-1);min-height:48px;padding:var(--__P__-space-2) var(--__P__-space-1);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);font-weight:600;transition:color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-tab:hover{color:var(--__P__-fg)}.__P__-tab[aria-selected=true]{color:var(--__P__-accent)}.__P__-tab:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-tab:active{background:var(--__P__-hover)}.__P__-tab-icon{position:relative;display:inline-flex}.__P__-tab-icon svg{width:22px;height:22px}.__P__-tab-badge{position:absolute;top:-4px;left:calc(50% + 6px);min-width:16px;height:16px;padding:0 4px;display:inline-flex;align-items:center;justify-content:center;border-radius:999px;background:var(--__P__-accent);color:var(--__P__-on-accent);font-size:10px;font-weight:600;line-height:1}.__P__-home-hero{flex-shrink:0;padding:var(--__P__-space-5) var(--__P__-space-5) var(--__P__-space-3);color:var(--__P__-on-accent);--__P__-focus: var(--__P__-on-accent)}.__P__-home-hero-top{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-3);min-height:32px}.__P__-home-brand{font-size:14px;font-weight:600;letter-spacing:.01em;color:color-mix(in srgb,#fff 82%,transparent);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.__P__-home-brand-spacer{flex:1}.__P__-home-hero-actions{display:flex;align-items:center;gap:var(--__P__-space-2);flex-shrink:0}.__P__-home-close{color:#fff}.__P__-home-greeting{margin:28px 0 0;font-family:var(--__P__-font-display);font-size:var(--__P__-text-2xl);font-weight:800;line-height:1.18;letter-spacing:-.01em;overflow-wrap:anywhere}.__P__-home-lead{margin:2px 0 0;font-family:var(--__P__-font-display);font-size:var(--__P__-text-2xl);font-weight:800;line-height:1.18;letter-spacing:-.01em;color:color-mix(in srgb,var(--__P__-on-accent) 88%,transparent);overflow-wrap:anywhere}.__P__-home-avatars{display:flex}.__P__-home-avatar{width:30px;height:30px;border-radius:999px;overflow:hidden;margin-left:-10px;border:2px solid color-mix(in srgb,#fff 92%,transparent);box-shadow:0 1px 3px #0000002e;background:var(--__P__-surface);display:inline-flex;align-items:center;justify-content:center;font-size:var(--__P__-text-xs);font-weight:700;color:var(--__P__-fg)}.__P__-home-avatar:first-child{margin-left:0}.__P__-home-avatar img{width:100%;height:100%;object-fit:cover}.__P__-home-content{background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);box-shadow:var(--__P__-shadow-card);overflow:hidden}.__P__-home-content-title{padding:var(--__P__-space-4) var(--__P__-space-4) var(--__P__-space-3);font-size:var(--__P__-text-sm);font-weight:700}.__P__-home-content-list{display:flex;flex-direction:column;padding:0 var(--__P__-space-2) var(--__P__-space-2)}.__P__-home-content-list .__P__-list-row+.__P__-list-row{border-top:1px solid var(--__P__-border)}.__P__-home-card{display:block;width:100%;text-align:left;background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);padding:var(--__P__-space-4);box-shadow:var(--__P__-shadow-card)}.__P__-home-card[data-interactive=true]{cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-home-card[data-interactive=true]:hover{background:var(--__P__-bg-elevated)}.__P__-home-card[data-interactive=true]:active{transform:translateY(1px)}.__P__-home-card[data-interactive=true]:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-home-recent-row{display:flex;align-items:center;gap:var(--__P__-space-3)}.__P__-home-recent-avatar{display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;flex-shrink:0;border-radius:999px;background:color-mix(in oklch,var(--__P__-accent) 14%,transparent);color:var(--__P__-accent)}.__P__-home-recent-avatar svg{width:20px;height:20px}.__P__-home-recent-body{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}.__P__-home-recent-title{font-weight:600;font-size:14px}.__P__-home-recent-preview{color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-home-recent-at{color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);flex-shrink:0}.__P__-home-recent-dot{width:8px;height:8px;border-radius:999px;background:var(--__P__-accent);flex-shrink:0}.__P__-home-recent-row[data-unread=true] .__P__-home-recent-title{font-weight:700}.__P__-home-status{display:flex;align-items:center;gap:var(--__P__-space-3)}.__P__-home-status-icon svg{width:22px;height:22px;color:var(--__P__-success)}.__P__-home-status[data-level=degraded] .__P__-home-status-icon svg{color:var(--__P__-warning)}.__P__-home-status[data-level=down] .__P__-home-status-icon svg{color:var(--__P__-danger)}.__P__-home-status-text{font-weight:600;font-size:14px}.__P__-home-search{display:flex;align-items:center;gap:var(--__P__-space-2);width:100%;padding:var(--__P__-space-3) var(--__P__-space-4);border-radius:var(--__P__-radius);border:1px solid var(--__P__-border);background:var(--__P__-surface);text-align:left}.__P__-home-search[data-input=true]{background:var(--__P__-bg-elevated)}.__P__-home-search:hover{border-color:var(--__P__-border-strong)}.__P__-home-search:focus-visible,.__P__-home-search:focus-within{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-home-search-text{flex:1;color:var(--__P__-fg-muted);font-size:14px}.__P__-home-search-input{flex:1;border:0;background:transparent;font-size:14px;color:var(--__P__-fg);outline:none}.__P__-home-search-icon svg{width:18px;height:18px;color:var(--__P__-accent)}.__P__-list-row{display:flex;align-items:center;gap:var(--__P__-space-3);width:100%;min-height:44px;text-align:left;padding:var(--__P__-space-3) var(--__P__-space-2);border-radius:var(--__P__-radius-sm)}.__P__-list-row:hover{background:var(--__P__-bg-elevated)}.__P__-list-row:active{background:var(--__P__-border)}.__P__-list-row:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-list-row-body{display:flex;flex-direction:column;min-width:0;flex:1}.__P__-list-row-title{font-weight:600;font-size:var(--__P__-text-md);line-height:1.35}.__P__-list-row-sub{color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);margin-top:var(--__P__-space-1);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.__P__-list-row-chevron svg{width:18px;height:18px;color:var(--__P__-accent);flex-shrink:0}.__P__-back-header{display:flex;align-items:center;gap:var(--__P__-space-2);padding:10px 12px;border-bottom:1px solid var(--__P__-border);flex-shrink:0}.__P__-back-title{flex:1;text-align:center;font-size:var(--__P__-text-md);font-weight:700;margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-back-spacer{width:32px;height:1px}.__P__-content{display:flex;flex-direction:column;gap:14px;width:100%;max-width:68ch;margin:0 auto}.__P__-content-hero{width:100%;border-radius:var(--__P__-radius)}.__P__-content-subtitle{color:var(--__P__-fg-muted);margin:0}.__P__-content-frame{flex:1;min-height:0;width:100%;border:0;background:#fff}.__P__-news-list{display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-news-card{display:block;width:100%;text-align:left;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden;background:var(--__P__-surface)}.__P__-news-card{transition:background var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-news-card:hover{background:var(--__P__-bg-elevated)}.__P__-news-card:active{transform:translateY(1px)}.__P__-news-card:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-news-hero{width:100%;display:block}.__P__-news-body{display:flex;flex-direction:column;gap:6px;padding:14px 16px}.__P__-news-tags{display:flex;gap:6px;flex-wrap:wrap}.__P__-news-tag{font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-accent);background:color-mix(in srgb,var(--__P__-accent) 12%,transparent);padding:2px 8px;border-radius:999px}.__P__-news-title{font-weight:700;font-size:var(--__P__-text-md)}.__P__-news-summary{color:var(--__P__-fg-muted);font-size:14px;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.__P__-modules-empty{display:flex;align-items:center;justify-content:center;position:relative}.__P__-modules-empty-close{position:absolute;top:12px;right:12px}.__P__-modules-empty-text{color:var(--__P__-fg-muted);font-size:var(--__P__-text-base)}
|
|
4
4
|
`;var hi=`.__P__-standalone-page{margin:0;height:100vh;background:var(--__P__-bg, #fff);display:grid;place-items:stretch}
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
`))!==-1;){let l=o.slice(0,s);o=o.slice(s+2);let c=ki(l);c&&(yield c)}}}finally{n.releaseLock()}}function ki(e){let t="",n;for(let o of e.split(`
|
|
10
10
|
`))if(!(o===""||o.startsWith(":"))){if(o.startsWith("data:")){let i=o.slice(5).replace(/^ /,"");t=t?`${t}
|
|
11
|
-
${i}`:i;continue}o.startsWith("id:")&&(n=o.slice(3).trim())}if(!t||t==="[DONE]")return null;try{let o=JSON.parse(t);return wi.trace("chunk",{type:o.type,eventId:n}),{chunk:o,eventId:n}}catch(o){return wi.trace("frame parse failed",{err:o,payload:t.slice(0,200)}),null}}function vc(e){let t=new TextEncoder().encode(e),n="";for(let o of t)n+=String.fromCharCode(o);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var Ei=e=>e&&Object.keys(e).length>0?e:void 0;function Ci(e,t){let n=Ei(e),o=Ei(t);if(!n&&!o)return;let i={};return n&&(i.user=n),o&&(i.page=o),vc(JSON.stringify(i))}var Ee={startSession:"/ai/agent/start-session",streamMessage:"/ai/agent/stream-message",streamResume:"/ai/agent/stream-resume",cancelStream:"/ai/agent/cancel-stream",listSessions:"/ai/agent/list-sessions",listMessages:"/ai/agent/list-messages",updateSettings:"/ai/agent/update-settings",markRead:"/ai/agent/mark-read",content:"/ai/agent/content"},Ai="context";function Ti(e){let n={messages:e.messages.map(a=>({id:a.id,parts:xc(a),role:a.role})),sessionId:e.sessionId,trigger:e.trigger??"submit-message"};e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs);let o={},i=e.tools?.map(bc).filter(a=>a!==null);return i?.length&&(o.tools=i),e.responseMode&&(o.responseMode=e.responseMode),Object.keys(o).length>0&&(n.data=o),n}function bc(e){return typeof e=="string"?e?{code:e}:null:e?.code?e:null}function xc(e){let t=[];for(let n of e.parts)n.kind==="text"&&n.text&&t.push({text:n.text,type:"text"}),n.kind==="file"&&n.url&&t.push({mediaType:n.mediaType,type:"file",url:n.url});for(let n of e.attachments??[])n.url&&t.push({type:"file",url:n.url,mediaType:n.mediaType,filename:n.name,fileId:n.id,fileSize:n.size});return t}var q=M.scope("transport"),yc=3,Mi=400,Ii=3,Pc=new Set([408,425,429,500,502,503,504]);function Ri(e){return Mi*2**e+Math.floor(Math.random()*250)}function Sc(e){let t=e.get("retry-after");if(!t)return null;let n=Number(t),o=Number.isFinite(n)?n*1e3:Date.parse(t)-Date.now();return Number.isFinite(o)&&o>=0?Math.min(o,3e4):null}function Ro(e,t){return new Promise(n=>{if(t?.aborted)return n();let o=setTimeout(a,e),i=()=>a();t?.addEventListener("abort",i,{once:!0});function a(){clearTimeout(o),t?.removeEventListener("abort",i),n()}})}var un=class{constructor(t){F(this,"opts",t);F(this,"visitorId");F(this,"sessionId");F(this,"userContext");F(this,"pageContext")}setContext(t,n){this.userContext=t,this.pageContext=n}primeIdentity(t,n){t&&(this.visitorId=t),n&&(this.sessionId=n)}envelope(){let t={};this.visitorId&&(t.visitorId=this.visitorId),this.sessionId&&(t.sessionId=this.sessionId);let n=Ci(this.userContext,this.pageContext);return n&&(t[Ai]=n),t}withEnvelope(t){return{...this.envelope(),...t}}appendEnvelope(t){for(let[n,o]of Object.entries(this.envelope()))t.append(n,o);return t}withEnvelopeQuery(t){let n=new URL(this.url(t));for(let[o,i]of Object.entries(this.envelope()))n.searchParams.has(o)||n.searchParams.set(o,i);return n.toString()}async startSession(t){q.debug("startSession \u2192",{visitorId:t.visitorId,sessionId:t.sessionId,locale:t.locale});let n=await this.postJson(Ee.startSession,t,"startSession");return q.debug("startSession \u2190",{visitorId:n.visitorId,sessionId:n.sessionId,canContinue:n.canContinue,hasMessages:!!n.messages?.length,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),kc(n)||q.warn("startSession response did not match expected shape; using raw response",{response:n}),this.visitorId=n.visitorId??t.visitorId,this.sessionId=n.sessionId,n}async uploadFile(t){q.debug("uploadFile \u2192",{name:t.name,size:t.size,type:t.type});let n=new FormData;n.append("file",t,t.name);let o=await this.postForm(this.uploadPath,n,"upload");return q.debug("uploadFile \u2190",{id:o.id,url:o.url}),o}async transcribe(t,n="audio/webm"){q.debug("transcribe \u2192",{size:t.size,mimeType:n});let o=new FormData;o.append("audio",t,`voice.${wc(n)}`),o.append("mimeType",n);let i=await this.postForm(this.transcribePath,o,"transcribe");return q.debug("transcribe \u2190",{textLen:i.text.length}),i}async listSessions(t={}){let n=new URL(this.url(Ee.listSessions));t.visitorId&&n.searchParams.set("visitorId",t.visitorId),t.limit&&n.searchParams.set("limit",String(t.limit)),t.cursor&&n.searchParams.set("cursor",t.cursor),q.debug("listSessions \u2192",{visitorId:t.visitorId??this.visitorId,limit:t.limit,cursor:t.cursor});let o=await this.getJson(n.toString(),"listSessions"),i=o.sessions??[];return q.debug("listSessions \u2190",{count:i.length,nextCursor:o.nextCursor}),{sessions:i.map(a=>({sessionId:a.sessionId,title:a.title,lastMessageAt:a.lastMessageAt,preview:a.preview,canContinue:a.canContinue,unreadCount:a.unreadCount})),nextCursor:o.nextCursor}}async loadSession(t){let n=new URL(this.url(Ee.listMessages));n.searchParams.set("sessionId",t),q.debug("loadSession \u2192",{sessionId:t,visitorId:this.visitorId});let o=await this.getJson(n.toString(),"loadSession"),i=o.messages??[];return q.debug("loadSession \u2190",{sessionId:o.sessionId,canContinue:o.canContinue,messageCount:i.length,hasSuggestions:!!o.suggestions}),{sessionId:o.sessionId,canContinue:o.canContinue??!0,messages:i,agent:o.agent,suggestions:o.suggestions}}async markRead(t){if(!(!this.visitorId||!t)){q.debug("markRead \u2192",{sessionId:t,visitorId:this.visitorId});try{await this.postJson(Ee.markRead,{sessionId:t},"markRead")}catch(n){q.debug("markRead failed (non-fatal)",{err:n})}}}async listContent(t={}){let n=new URL(this.url(Ee.content));for(let[a,s]of Object.entries(t))s!==void 0&&n.searchParams.set(a,Array.isArray(s)?s.join(","):String(s));q.debug("listContent \u2192",t);let o=await this.getJson(n.toString(),"listContent"),i=o.items??[];return q.debug("listContent \u2190",{count:i.length,total:o.pagination?.total}),{...o,items:i}}async saveUserPrefs(t){q.debug("saveUserPrefs \u2192",{visitorId:this.visitorId,sessionId:this.sessionId,settingsKeys:Object.keys(t)});let n=await this.postJson(Ee.updateSettings,{userPrefs:t},"saveUserPrefs");return q.debug("saveUserPrefs \u2190",{ok:n.ok}),n}get uploadPath(){return this.opts.endpoints?.upload??"/ai/agent/upload-file"}get transcribePath(){return this.opts.endpoints?.transcribe??"/ai/agent/transcribe-audio"}sendMessage(t){q.debug("message \u2192",{sessionId:t.sessionId,visitorId:t.visitorId,messageCount:t.messages.length,trigger:t.trigger,responseMode:t.data?.responseMode,tools:t.data?.tools?.map(s=>s.code)});let n=new AbortController,o=new Set;return{iter:this.runStream(t,n,o),cancel:()=>this.cancelStream(n,t.sessionId)}}resumeStream(){let t=new AbortController,n=new Set;return{iter:this.resumeStreamGen(t,n,!0),cancel:()=>t.abort()}}async*runStream(t,n,o){(yield*this.drain(this.openMessageStream(t,n.signal),o,n))||(yield*this.resumeStreamGen(n,o,!1))}async*resumeStreamGen(t,n,o){for(let i=1;i<=yc&&!t.signal.aborted;i++){if((!o||i>1)&&(await Ro(Mi*i,t.signal),t.signal.aborted))return;let a;try{a=await this.fetchImpl(this.resumeUrl(n.size),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.opts.auth.headers()},signal:t.signal})}catch(l){if(t.signal.aborted)return;q.debug("resume fetch failed \u2014 retrying",{attempt:i,err:l});continue}if(a.status===204||!a.ok){q.debug("resume \u2192 no in-flight stream",{status:a.status});return}let s=n.size;if(yield*this.drain(Io(a,t.signal),n,t))return;if(n.size===s){q.debug("resume \u2192 stream closed with no new events; nothing to resume");return}}if(!t.signal.aborted)throw new he("stream incomplete after resume attempts","server")}async*drain(t,n,o){try{for await(let i of t){if(o.signal.aborted)return!0;if(i.eventId){if(n.has(i.eventId))continue;n.add(i.eventId)}if(yield i,i.chunk.type==="finish"||i.chunk.type==="error")return!0}}catch(i){if(o.signal.aborted)return!0;if(i instanceof he&&i.status!==void 0)throw i;q.debug("stream segment dropped",{err:i})}return!1}cancelStream(t,n){t.signal.aborted||(q.debug("cancel stream",{sessionId:n,visitorId:this.visitorId}),t.abort(),!(!this.visitorId||!n)&&this.fetchImpl(this.url(Ee.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope({})),keepalive:!0}).catch(o=>q.debug("cancel POST failed (non-fatal)",{err:o})))}async*openMessageStream(t,n){let o=await this.fetchImpl(this.url(Ee.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"text/event-stream","content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(t)),signal:n});yield*Io(o,n)}resumeUrl(t){let n=new URL(this.withEnvelopeQuery(Ee.streamResume));return n.searchParams.set("resumeAt",String(t)),n.toString()}async postJson(t,n,o){let i=await this.fetchWithRetry(()=>[this.url(t),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(n))}],o);return this.assertOk(i,o)}async postForm(t,n,o){let i=await this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.opts.auth.headers(),body:this.appendEnvelope(n)});return this.assertOk(i,o)}async getJson(t,n){let o=await this.fetchWithRetry(()=>[this.withEnvelopeQuery(t),{method:"GET",credentials:"omit",headers:{accept:"application/json",...this.opts.auth.headers()}}],n);return this.assertOk(o,n)}async fetchWithRetry(t,n){for(let o=0;;o++){let[i,a]=t(),s;try{s=await this.fetchImpl(i,a)}catch(c){if(o>=Ii)throw new he(`${n} failed: network error`,"network",void 0,c);q.debug("request network error \u2014 retrying",{label:n,attempt:o}),await Ro(Ri(o));continue}if(s.ok||!Pc.has(s.status)||o>=Ii)return s;let l=Sc(s.headers)??Ri(o);q.debug("request retryable status \u2014 retrying",{label:n,status:s.status,attempt:o,wait:l}),await Ro(l)}}async assertOk(t,n){if(!t.ok)throw new he(`${n} failed: ${t.status}`,"server",t.status);return await t.json()}url(t){return/^https?:\/\//i.test(t)?t:`${this.opts.baseUrl}${t}`}get fetchImpl(){return this.opts.fetchImpl??globalThis.fetch.bind(globalThis)}};function wc(e){return e.includes("webm")?"webm":e.includes("ogg")?"ogg":e.includes("mp4")||e.includes("m4a")?"m4a":e.includes("mpeg")?"mp3":e.includes("wav")?"wav":"bin"}function kc(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.visitorId=="string"&&typeof t.sessionId=="string"&&typeof t.canContinue=="boolean"}function Li(e,t){let n=e?[{kind:"text",id:"t0",textSig:N(e),doneSig:N(!0)}]:[];return{id:ke(),role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:N(n)}}function Mo(){return{id:ke(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:N([])}}function Ni(e){return{id:e.id,role:e.role,createdAt:Date.now(),status:"streaming",partsSig:N([{kind:"text",id:`${e.id}-t0`,textSig:N(""),doneSig:N(!1)}])}}function Oi(e){return Ec({id:e.id,role:e.role,createdAt:Date.now(),status:"complete",parts:[{kind:"text",id:`${e.id}-t0`,text:e.text,done:!0}]})}function Ec(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,errorText:e.errorText,finishReason:e.finishReason,attachments:e.attachments,partsSig:N(e.parts.map(Cc))}}function Lo(e){let t=e.parts.map((n,o)=>n.type==="text"?{kind:"text",id:`${e.id}-t${o}`,textSig:N(n.text),doneSig:N(!0)}:n.type==="file"?{kind:"file",url:n.url,mediaType:n.mediaType}:null).filter(n=>n!==null);return{id:e.id,role:e.role,createdAt:Date.now(),status:"complete",partsSig:N(t)}}function Di(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,errorText:e.errorText,finishReason:e.finishReason,attachments:e.attachments,parts:e.partsSig.value.map(Ac)}}function No(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function Cc(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:N(e.text),doneSig:N(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,inputPartialSig:N(e.inputPartial),inputSig:N(e.input),outputSig:N(e.output),errorSig:N(e.error),stateSig:N(e.state)}:e}function Ac(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,text:e.textSig.value,done:e.doneSig.value}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,inputPartial:e.inputPartialSig.value,input:e.inputSig.value,output:e.outputSig.value,error:e.errorSig.value,state:e.stateSig.value}:e}var Hi=M.scope("reducer"),pn=class{constructor(t){F(this,"messagesSig",t);F(this,"active",null)}attach(t){this.active=t}detach(){this.active=null}apply(t){let n=this.active;if(n)switch(t.type){case"start":case"start-step":case"finish-step":return;case"finish":Hi.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.status="complete",t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":Hi.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"text-start":rt(n,"text",t.id);return;case"text-delta":{let o=rt(n,"text",t.id);o.textSig.value+=t.delta;return}case"text-end":rt(n,"text",t.id).doneSig.value=!0;return;case"reasoning-start":rt(n,"reasoning",t.id).doneSig.value=!1;return;case"reasoning-delta":{let o=rt(n,"reasoning",t.id);o.textSig.value+=t.delta;return}case"reasoning-end":rt(n,"reasoning",t.id).doneSig.value=!0;return;case"tool-input-start":case"tool-input-delta":case"tool-input-available":case"tool-output-available":case"tool-output-error":Tc(n,t);return;case"file":fn(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":{if(n.partsSig.value.some(i=>i.kind==="source"&&i.sourceId===t.sourceId))return;fn(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return}case"data-notification":return;default:{let o=t}}}bumpDone(t){t.partsSig.value=[...t.partsSig.value],this.messagesSig.value=[...this.messagesSig.value]}};function rt(e,t,n){let o=e.partsSig.value.find(a=>a.kind===t&&a.id===n);if(o)return o;let i={kind:t,id:n,textSig:N(""),doneSig:N(!1)};return fn(e,i),i}function Pt(e,t,n){let o=e.partsSig.value.find(a=>a.kind==="tool"&&a.toolCallId===t);if(o)return o;let i={kind:"tool",toolCallId:t,toolName:n??"tool",inputPartialSig:N(""),inputSig:N(void 0),outputSig:N(void 0),errorSig:N(void 0),stateSig:N("input")};return fn(e,i),i}function fn(e,t){e.partsSig.value=[...e.partsSig.value,t]}function Tc(e,t){switch(t.type){case"tool-input-start":Pt(e,t.toolCallId,t.toolName);return;case"tool-input-delta":{let n=Pt(e,t.toolCallId);n.inputPartialSig.value+=t.delta;return}case"tool-input-available":{let n=Pt(e,t.toolCallId,t.toolName);n.inputSig.value=t.input,n.stateSig.value="awaiting";return}case"tool-output-available":{let n=Pt(e,t.toolCallId);n.outputSig.value=t.output,n.stateSig.value="output";return}case"tool-output-error":{let n=Pt(e,t.toolCallId);n.errorSig.value=t.errorText,n.stateSig.value="error";return}default:return}}var gn=M.scope("persistence");function St(e,t=on){let n=`${h.cssPrefix}.${e}`,o=`${n}.visitorId`,i=`${n}.sessionId`,a=`${n}.userPrefs`,s=`${n}.panelOpen`,l=`${n}.panelSize`,c=`${n}.calloutDismissed`,u=`${n}.sidebarCollapsed`,p=`${n}.activeModule`,d={getVisitorId(){let _=t.get(o);if(_)return _;let f=ke();return t.set(o,f),f},setVisitorId(_){gn.debug("setVisitorId (rebind)",{id:_,widgetId:e}),t.set(o,_)},loadSessionId(){return t.get(i)??void 0},saveSessionId(_){gn.trace("saveSessionId",{id:_,widgetId:e}),_?t.set(i,_):t.remove(i)},loadUserPrefs(){let _=t.get(a);if(!_)return{};try{let f=JSON.parse(_);return Ic(f)?f:{}}catch(f){return gn.warn("loadUserPrefs parse failed",{error:f}),{}}},saveUserPrefs(_){try{t.set(a,JSON.stringify(_))}catch(f){gn.warn("saveUserPrefs serialise failed",{error:f})}},patchUserPrefs(_){let f=d.loadUserPrefs();d.saveUserPrefs({...f,..._})},loadPanelOpen(){let _=t.get(s);return _==="1"?!0:_==="0"?!1:null},savePanelOpen(_){t.set(s,_?"1":"0")},loadPanelSize(){let _=t.get(l);return _==="normal"||_==="expanded"||_==="fullscreen"?_:null},savePanelSize(_){t.set(l,_)},loadCalloutDismissed(_){if(!_)return!1;let f=t.get(c);return!!f&&f===_},saveCalloutDismissed(_){_?t.set(c,_):t.remove(c)},loadSidebarCollapsed(){let _=t.get(u);return _==="1"?!0:_==="0"?!1:null},saveSidebarCollapsed(_){t.set(u,_?"1":"0")},loadActiveModule(){return t.get(p)||null},saveActiveModule(_){t.set(p,_)},clearSession(){t.remove(i)}};return d}function Ic(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var $i=M.scope("feedback:audio"),mn=class{constructor(){F(this,"ctx",null);F(this,"master",null);F(this,"buffers",new Map)}unlock(){if(this.ctx){this.ctx.state==="suspended"&&this.ctx.resume();return}let t=globalThis.AudioContext??globalThis.webkitAudioContext;if(t)try{this.ctx=new t,this.master=this.ctx.createGain(),this.master.gain.value=1,this.master.connect(this.ctx.destination)}catch(n){$i.warn("AudioContext init failed",{err:n})}}setVolume(t){if(!this.master||!this.ctx)return;let n=Math.max(0,Math.min(1,t));this.master.gain.setTargetAtTime(n,this.ctx.currentTime,.01)}playTone(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let i=n.currentTime,a=t.noteMs/1e3;t.notes.forEach((s,l)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=s;let u=n.createGain(),p=i+l*a;u.gain.setValueAtTime(1e-4,p),u.gain.exponentialRampToValueAtTime(t.peakGain,p+.005),u.gain.exponentialRampToValueAtTime(1e-4,p+a),c.connect(u).connect(o),c.start(p),c.stop(p+a+.01)})}async playUrl(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let i=await this.getBuffer(t);if(!i)return;let a=n.createBufferSource();a.buffer=i,a.connect(o),a.start()}destroy(){this.ctx&&this.ctx.close().catch(()=>{}),this.ctx=null,this.master=null,this.buffers.clear()}async getBuffer(t){if(!this.ctx)return null;let n=this.buffers.get(t);if(n)return n instanceof Promise,n;let o=this.ctx,i=fetch(t).then(a=>a.ok?a.arrayBuffer():Promise.reject(new Error(`fetch ${a.status}`))).then(a=>o.decodeAudioData(a)).then(a=>(this.buffers.set(t,a),a)).catch(a=>($i.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,i),i}};var Bi={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},Ui={messageReceived:{notes:[880,1318.51],noteMs:90,type:"sine",peakGain:.45},messageSent:{notes:[1568],noteMs:60,type:"sine",peakGain:.25},error:{notes:[523.25,392],noteMs:120,type:"triangle",peakGain:.55},voiceStart:{notes:[1318.51],noteMs:50,type:"sine",peakGain:.3},voiceStop:{notes:[880],noteMs:50,type:"sine",peakGain:.3}};var $e=null,hn=0;function Rc(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function Mc(){if(typeof document>"u")return null;let e=document.createElement("input");e.type="checkbox",e.setAttribute("switch",""),e.setAttribute("aria-hidden","true"),e.tabIndex=-1,e.id=`__${h.cssPrefix}_haptic_${Math.random().toString(36).slice(2)}`;let t=document.createElement("label");t.htmlFor=e.id,t.setAttribute("aria-hidden","true");let n="position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;opacity:0!important;pointer-events:none!important;";return e.style.cssText=n,t.style.cssText=n,document.body.append(e,t),{input:e,label:t}}function zi(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(Rc())try{navigator.vibrate(e);return}catch{}if($e||($e=Mc()),!!$e)try{$e.label.click()}catch{}}}function Fi(){hn++;let e=!1;return()=>{e||(e=!0,hn=Math.max(0,hn-1),hn===0&&$e&&($e.input.remove(),$e.label.remove(),$e=null))}}var Lc=M.scope("feedback"),Nc=100,vn=class{constructor(t,n){F(this,"mutedSig",N(!1));F(this,"audio",new mn);F(this,"releaseHaptics");F(this,"sound");F(this,"haptics");F(this,"lastPlayed",new Map);F(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=Fi(),this.audio.setVolume(this.effectiveVolume()),typeof matchMedia<"u"&&(this.reducedMotionMq=matchMedia("(prefers-reduced-motion: reduce)"))}unlock(){this.audio.unlock(),this.audio.setVolume(this.effectiveVolume())}update(t,n){this.sound=t,this.haptics=n,this.audio.setVolume(this.effectiveVolume())}setMuted(t){this.mutedSig.value!==t&&(this.mutedSig.value=t)}toggleMuted(){this.mutedSig.value=!this.mutedSig.value}play(t){this.mutedSig.value||this.isDeduped(t)||(this.lastPlayed.set(t,performance.now()),this.sound.enabled&&this.playSound(t),this.haptics.enabled&&this.isTouchDevice()&&this.playHaptic(t))}destroy(){this.audio.destroy(),this.releaseHaptics()}isDeduped(t){let n=this.lastPlayed.get(t);return n===void 0?!1:performance.now()-n<Nc}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(i=>Lc.warn("audio play failed",{err:i,url:n}));return}let o=Ui[t];o&&this.audio.playTone(o)}playHaptic(t){if(this.reducedMotionMq?.matches)return;let n=this.haptics.events?.[t];if(n===!1)return;let o=n===!0||n===void 0?Bi[t]:n;zi(o)}effectiveVolume(){let t=this.sound.volume??.3;return this.reducedMotionMq?.matches?t*.5:t}isTouchDevice(){return typeof window>"u"?!1:matchMedia("(hover: none) and (pointer: coarse)").matches}};function We(e,t){return e instanceof he&&e.status===429?t.errorRateLimited:t.errorGeneric}var Oc=0;function r(e,t,n,o,i,a){t||(t={});var s,l,c=t;if("ref"in c)for(l in c={},t)l=="ref"?s=t[l]:c[l]=t[l];var u={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Oc,__i:-1,__u:0,__source:i,__self:a};if(typeof e=="function"&&(s=e.defaultProps))for(l in s)c[l]===void 0&&(c[l]=s[l]);return H.vnode&&H.vnode(u),u}var T={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},Dc=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})}),fe=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M18 6 6 18M6 6l12 12"})}),Wi=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M12 5v14M5 12h14"})}),Ki=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"m22 2-7 20-4-9-9-4Z"}),r("path",{d:"M22 2 11 13"})]}),Gi=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M12 19V5M5 12l7-7 7 7"})}),Vi=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M3 20V4l18 8-18 8Z"})}),bn=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"m9 18 6-6-6-6"})}),qi=()=>r("svg",{...T,"aria-hidden":"true",children:r("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),Xi=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"m21 11-9 9a5.5 5.5 0 0 1-7.78-7.78l8.49-8.49a3.67 3.67 0 0 1 5.19 5.19l-8.49 8.49a1.83 1.83 0 0 1-2.6-2.6l7.78-7.78"})}),ji=()=>r("svg",{...T,"aria-hidden":"true",children:[r("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),r("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]}),Yi=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})}),Ji=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})}),Qi=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})}),Zi=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})}),ea=()=>r("svg",{...T,"aria-hidden":"true",viewBox:"0 0 10 10",children:r("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})}),ta=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),r("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),r("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]}),na=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})}),oa=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})}),it=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M20 6 9 17l-5-5"})}),ra=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M3 3v6h6"}),r("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),r("path",{d:"M12 7v5l3 2"})]}),ia=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("path",{d:"M2 12h20"}),r("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),wt=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),aa=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M15 3h6v6M10 14 21 3M21 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5"})}),sa=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"})}),la=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),r("path",{d:"M14 2v6h6"})]}),Hc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),r("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]}),$c=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})}),Oo=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),r("path",{d:"M12 17h.01"})]}),Bc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"m15 4 3 3-9 9-3-3z"}),r("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]}),Uc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),r("path",{d:"M12 8V4"}),r("circle",{cx:"12",cy:"3",r:"1"}),r("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]}),zc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),r("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),r("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),r("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]}),Fc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("circle",{cx:"12",cy:"12",r:"4"}),r("path",{d:"m4.93 4.93 4.24 4.24M14.83 14.83l4.24 4.24M14.83 9.17l4.24-4.24M4.93 19.07l4.24-4.24"})]}),Do=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"11",cy:"11",r:"7"}),r("path",{d:"m21 21-4.3-4.3"})]}),ca=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),da=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M3 9.5 12 3l9 6.5"}),r("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]}),_a=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"m3 11 15-5v12L3 13z"}),r("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),r("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),r("path",{d:"M21 10a3 3 0 0 1 0 4"})]}),kt=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),r("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]}),ua=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"4"}),r("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),pa=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),fa=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M12 3v18"}),r("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]}),Wc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),r("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),r("path",{d:"m20 20-4.4-4.4"})]}),Kc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M12 3.5 13.6 9 19 10.5 13.6 12 12 17.5 10.4 12 5 10.5 10.4 9z"}),r("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]}),Gc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M4 18h16"}),r("path",{d:"M5 18a7 7 0 0 1 14 0"}),r("path",{d:"M12 8V6"}),r("path",{d:"M10 6h4"})]}),Vc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),r("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),r("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),r("path",{d:"M16 9.5a1.5 1.5 0 0 1 3 0v2.5a7 7 0 0 1-7 7 7 7 0 0 1-6.4-4.2L4 12.5a1.5 1.5 0 0 1 2.6-1.5L7 11"})]}),ga={chat:Dc,message:$c,bubbles:kt,spark:Hc,wand:Bc,bot:Uc,help:Oo,lifebuoy:Fc,headset:zc,search:Wc,sparkles:Kc,concierge:Gc,wave:Vc};var C=h.cssPrefix,P={launcher:`${C}-launcher`,callout:`${C}-callout`,calloutDismiss:`${C}-callout-dismiss`,panel:`${C}-panel`,panelHeader:`${C}-panel-header`,resizeGrip:`${C}-resize-grip`,actionClear:`${C}-action-clear`,actionExpand:`${C}-action-expand`,actionFullscreen:`${C}-action-fullscreen`,actionPopOut:`${C}-action-popout`,actionSound:`${C}-action-sound`,actionHistory:`${C}-action-history`,actionLanguage:`${C}-action-language`,actionTheme:`${C}-action-theme`,actionClose:`${C}-action-close`,actionOverflow:`${C}-action-overflow`,languageOption:`${C}-language-option`,themeOption:`${C}-theme-option`,composer:`${C}-composer`,composerInput:`${C}-composer-input`,composerSend:`${C}-composer-send`,composerStop:`${C}-composer-stop`,composerAttach:`${C}-composer-attach`,composerFileInput:`${C}-composer-file-input`,composerVoice:`${C}-composer-voice`,attachmentChip:`${C}-attachment-chip`,attachmentRemove:`${C}-attachment-remove`,suggestion:`${C}-suggestion`,messageBubble:`${C}-message`,messageRetry:`${C}-message-retry`,historyPane:`${C}-history-pane`,historyBack:`${C}-history-back`,historyItem:`${C}-history-item`,sidebar:`${C}-sidebar`,sidebarToggle:`${C}-sidebar-toggle`,sidebarNewChat:`${C}-sidebar-new-chat`,sidebarItem:`${C}-sidebar-item`,messengerHome:`${C}-messenger-home`,modulesEmpty:`${C}-modules-empty`,tab:`${C}-tab`,tabBadge:`${C}-tab-badge`,homeView:`${C}-home-view`,homeGreeting:`${C}-home-greeting`,homeBrand:`${C}-home-brand`,backHeader:`${C}-back-header`,contentView:`${C}-content-view`,contentScroll:`${C}-content-scroll`,homeSearch:`${C}-home-search`,helpSearch:`${C}-help-search`,homeRecent:`${C}-home-recent`,homeContentRow:`${C}-home-content-row`,helpArticle:`${C}-help-article`,newsItem:`${C}-news-item`};function ce(e,t){return`${e}-${t}`}var ma={clear:P.actionClear,expand:P.actionExpand,fullscreen:P.actionFullscreen,popOut:P.actionPopOut,sound:P.actionSound,history:P.actionHistory,language:P.actionLanguage,theme:P.actionTheme,close:P.actionClose};var xn=h.cssPrefix;function ha({onToggle:e,launcher:t,strings:n,leaving:o,edgeTab:i}){let a=t.variant!=="circle"&&!!t.label;return r("button",{type:"button",class:`${xn}-fab`,"data-variant":t.variant,"data-size":t.size,"data-edge-tab":i?"true":void 0,"data-leaving":o?"true":void 0,"data-testid":P.launcher,onClick:e,"aria-label":n.launcherOpen,children:[qc(t.icon),a?r("span",{class:`${xn}-fab-label`,children:t.label}):null]})}function qc(e){let t=ga[e];return t?r(t,{}):r(Xc,{source:e})}function Xc({source:e}){return r("span",{ref:t=>{t&&jc(t,e)},"aria-hidden":"true"})}function jc(e,t){if(e.dataset.svgMounted!==t)try{let o=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;o&&o.tagName.toLowerCase()==="svg"&&(e.replaceChildren(document.importNode(o,!0)),e.dataset.svgMounted=t)}catch{}}function va({callout:e,launcherPosition:t,closeLabel:n,onDismiss:o}){let[i,a]=k(!1);return w(()=>{let s=setTimeout(()=>a(!0),e.delayMs);return()=>clearTimeout(s)},[e.delayMs]),w(()=>{if(!i||e.autoDismissMs<=0)return;let s=setTimeout(o,e.autoDismissMs);return()=>clearTimeout(s)},[i,e.autoDismissMs,o]),i?r("div",{class:`${xn}-callout`,role:"status","data-shape":e.shape,"data-position":Yc(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":P.callout,children:[r("span",{children:e.text}),r("button",{type:"button",class:`${xn}-callout-close`,onClick:o,"aria-label":n,title:n,"data-testid":P.calloutDismiss,children:r(fe,{})})]}):null}function Yc(e,t){let n=t.endsWith("-right"),o=t.startsWith("bottom-");return e==="vertical"?o?"top":"bottom":n?"left":"right"}function yn({panelEl:e,resize:t,position:n,initialSize:o,onSizeChange:i,strings:a}){let s=h.cssPrefix,l=O(null);if(w(()=>{if(!e)return;let v=e.style;t.minWidth&&v.setProperty(`--${s}-resize-min-w`,t.minWidth),t.maxWidth&&v.setProperty(`--${s}-resize-max-w`,t.maxWidth),t.minHeight&&v.setProperty(`--${s}-resize-min-h`,t.minHeight),t.maxHeight&&v.setProperty(`--${s}-resize-max-h`,t.maxHeight),o&&(v.setProperty(`--${s}-widget-w`,`${o.width}px`),v.setProperty(`--${s}-widget-h`,`${o.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,s,o]),!e)return null;let c=n.startsWith("top-"),u=n.endsWith("-right"),p=`${s}-resize-grip ${s}-resize-grip--${c?"bottom":"top"}-${u?"left":"right"}`,d=v=>{if(!e)return;let m=v.currentTarget,y=e.getBoundingClientRect();l.current={pointerId:v.pointerId,startX:v.clientX,startY:v.clientY,startW:y.width,startH:y.height,dirX:u?-1:1,dirY:c?1:-1},m.setPointerCapture(v.pointerId),v.preventDefault()},_=v=>{let m=l.current;if(!m||v.pointerId!==m.pointerId||!e)return;let y=(v.clientX-m.startX)*m.dirX,b=(v.clientY-m.startY)*m.dirY;e.style.setProperty(`--${s}-widget-w`,`${m.startW+y}px`),e.style.setProperty(`--${s}-widget-h`,`${m.startH+b}px`)},f=v=>{let m=l.current;if(!m||v.pointerId!==m.pointerId||!e)return;v.currentTarget.releasePointerCapture(v.pointerId);let y=e.getBoundingClientRect();i({width:Math.round(y.width),height:Math.round(y.height)}),l.current=null};return r("div",{class:p,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:d,onPointerMove:_,onPointerUp:f,onPointerCancel:f,"data-testid":P.resizeGrip,children:r(ea,{})})}var Ke=h.cssPrefix,Jc=`.${Ke}-header, .${Ke}-back-header, .${Ke}-home-hero`,Qc='button, a, input, textarea, select, [role="tab"], [contenteditable]',ba=56;function Pn(e,t){w(()=>{if(!t||!e)return;let n=c=>Number.parseFloat(c)||0,o=(c,u)=>Math.min(u,Math.max(-u,c)),i=null,a=c=>{let u=c.target;if(!(u instanceof Element)||!u.closest(Jc)||u.closest(Qc))return;let p=e.getBoundingClientRect();i={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${Ke}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${Ke}-modal-dy`)),maxX:(window.innerWidth+p.width)/2-ba,maxY:(window.innerHeight+p.height)/2-ba},e.dataset.dragging="true",c.preventDefault()},s=c=>{if(!i||c.pointerId!==i.id)return;let u=o(i.dx+c.clientX-i.x,i.maxX),p=o(i.dy+c.clientY-i.y,i.maxY);e.style.setProperty(`--${Ke}-modal-dx`,`${u}px`),e.style.setProperty(`--${Ke}-modal-dy`,`${p}px`)},l=c=>{!i||c.pointerId!==i.id||(i=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",s),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",l)}},[e,t])}function Sn(e,t,n,o){switch(e){case"clear":case"sound":case"history":case"language":case"theme":return!0;case"expand":return t==="floating";case"fullscreen":return t!=="standalone";case"popOut":return t!=="standalone"&&!!o?.popOutUrl;case"close":return t==="standalone"||t==="page"?!1:t==="inline"?n==="fullscreen":!0}}function Ho(e,t,n,o){return e.filter(i=>Sn(i,t,n,o))}function xa(e,t,n){return Sn("close",e,t)?n.main.includes("close")||n.overflow.includes("close"):!1}function ya(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}var Zc='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function wn(e){let t=n=>{if(n.key!=="Tab")return;let o=[...e.querySelectorAll(Zc)].filter(l=>l.offsetParent!==null||l===document.activeElement);if(o.length===0){n.preventDefault();return}let i=o[0],a=o[o.length-1];if(!i||!a)return;let s=e.getRootNode().activeElement;n.shiftKey&&s===i?(n.preventDefault(),a.focus()):!n.shiftKey&&s===a&&(n.preventDefault(),i.focus())};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}function kn(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var $o=h.cssPrefix;function Pa({agent:e}){let t=e.status??"online";return r("div",{class:`${$o}-agent`,children:[r("div",{class:`${$o}-agent-avatar`,"data-status":t,children:e.avatar?r("img",{src:e.avatar,alt:""}):r("span",{children:kn(e.name)})}),r("div",{class:`${$o}-agent-meta`,children:[r("strong",{children:e.name}),e.title?r("span",{children:e.title}):null]})]})}var Sa=M.scope("attachments");function En(e,t,n){let o=td(e),i=[],a=[],s=rd(n.accept),l=t.reduce((u,p)=>u+p.size,0),c=t.length;for(let u of o){let p=ed(u,c,l,n,s);if(p){a.push({file:u,reason:p});continue}i.push(od(u)),l+=u.size,c+=1}return(i.length||a.length)&&Sa.debug("ingest",{accepted:i.length,rejected:a.map(u=>({name:u.file.name,reason:u.reason}))}),{accepted:i,rejected:a}}function Bo(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){Sa.debug("revokeObjectURL failed",{error:t})}}function ed(e,t,n,o,i){return t>=o.maxCount?"count":n+e.size>o.maxBytes?"bytes":id(e,i)?null:"mime"}function td(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:nd(t)).filter(t=>t!==null):[]}function nd(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function od(e){return{file:e,id:ke(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function rd(e){return e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean).map(t=>{if(t.startsWith("."))return{kind:"ext",ext:t};let[n="*",o="*"]=t.split("/");return{kind:"mime",type:n,subtype:o}})}function id(e,t){if(t.length===0)return!0;let[n="*",o="*"]=(e.type||"").toLowerCase().split("/"),i=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?i.endsWith(a.ext):(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===o))}var Et=h.cssPrefix;function wa({attachment:e,onRemove:t}){let n=e.mediaType.startsWith("image/");return r("span",{class:`${Et}-attachment-chip`,title:e.name,"data-testid":ce(P.attachmentChip,e.id),children:[n?r("img",{class:`${Et}-attachment-thumb`,src:e.previewUrl,alt:""}):r("span",{class:`${Et}-attachment-thumb`,"aria-hidden":"true",children:r(la,{})}),r("span",{class:`${Et}-attachment-name`,children:e.name}),r("button",{type:"button",class:`${Et}-attachment-remove`,onClick:t,"aria-label":`Remove ${e.name}`,"data-testid":ce(P.attachmentRemove,e.id),children:r(fe,{})})]})}var Uo={isSupported:!1,start:()=>{},stop:()=>{}};function zo(e,t,n){return e==="disabled"?Uo:e==="server"?cd(n):ad(t)}function ad(e){let t=sd();if(!t)return Uo;let n=null;return{isSupported:!0,start(o,i){n=new t,n.continuous=!0,n.interimResults=!0,n.lang=e,n.addEventListener("result",s=>{let l=s,c="",u=!1;for(let p=l.resultIndex;p<l.results.length;p++){let d=l.results[p];d&&(c+=d[0].transcript,d.isFinal&&(u=!0))}o(c,u)});let a=()=>{n=null,i()};n.addEventListener("end",a),n.addEventListener("error",a),n.start()},stop(){n?.stop()}}}function sd(){let e=globalThis;return e.SpeechRecognition??e.webkitSpeechRecognition}var ld=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function cd(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Uo;let t=null,n=null,o=[],i=()=>{for(let a of n?.getTracks()??[])a.stop();n=null};return{isSupported:!0,async start(a,s){try{n=await navigator.mediaDevices.getUserMedia({audio:!0});let l=dd();t=new MediaRecorder(n,l?{mimeType:l}:void 0),o=[],t.addEventListener("dataavailable",c=>{c.data.size>0&&o.push(c.data)}),t.addEventListener("stop",async()=>{let c=t?.mimeType??"audio/webm";i();let u=new Blob(o,{type:c});o=[];try{let{text:p}=await e(u,c);p&&a(p,!0)}catch{}finally{s()}}),t.start()}catch{i(),s()}},stop(){t?.stop()}}}function dd(){for(let e of ld)if(MediaRecorder.isTypeSupported(e))return e}var me=h.cssPrefix,Ge=M.scope("composer");function at(e){return e.reduce((t,n)=>t+n.size,0)}var _d={arrowUp:Gi,paperPlane:Ki,send:Vi,chevron:bn};function ka({options:e,transport:t,feedback:n,bus:o,isStreaming:i,onSend:a,onStop:s,attachApiRef:l}){let c=e.strings,[u,p]=k(""),[d,_]=k([]),[f,v]=k(!1),m=O(null),y=O(null),b=e.features.files,S=e.features.voice,[I,L]=k(()=>zo(S,e.locale,(E,$)=>t.transcribe(E,$)));w(()=>{f||S==="disabled"||L(zo(S,e.locale,(E,$)=>t.transcribe(E,$)))},[e.locale,S,t,f]),w(()=>{let E=m.current;if(!E)return;let $=E.getRootNode(),j="activeElement"in $?$.activeElement:null;j&&E.closest(`.${me}-panel`)?.contains(j)||E.focus({preventScroll:!0})},[]),w(()=>{let E=m.current;if(E){if(u.length===0){E.style.height="";return}E.style.height="auto",E.style.height=`${Math.min(E.scrollHeight,160)}px`}},[u]);let U=O(d);U.current=d,w(()=>()=>U.current.forEach(Bo),[]),w(()=>{if(l)return l.current={attachFromDrop:E=>{let $=En(E,U.current,e.attachments);$.accepted.length!==0&&(Ge.info("attach (drop)",{count:$.accepted.length,totalBytes:at($.accepted)}),o.emit("attach",{count:$.accepted.length,totalBytes:at($.accepted)}),_(j=>[...j,...$.accepted]))}},()=>{l.current&&(l.current=null)}},[l,e.attachments]),w(()=>{let E=m.current;if(!E)return;let $=E.closest(`.${me}-panel`);if(!$)return;let j=le=>{let D=le.clipboardData;if(!D)return;if(b){let xe=En(D.items,U.current,e.attachments);if(xe.accepted.length>0){le.preventDefault(),Ge.info("attach (paste)",{count:xe.accepted.length,totalBytes:at(xe.accepted)}),o.emit("attach",{count:xe.accepted.length,totalBytes:at(xe.accepted)}),_($n=>[...$n,...xe.accepted]);return}}if(le.target===E)return;let be=D.getData("text/plain");be&&(le.preventDefault(),p(xe=>xe+be),E.focus())};return $.addEventListener("paste",j),()=>$.removeEventListener("paste",j)},[b,e.attachments,me]);let X=()=>{let E=u.trim();!E&&d.length===0||i||(a(E,d),p(""),_([]))},de=E=>{E.key!=="Enter"||E.shiftKey||E.isComposing||(E.preventDefault(),i?s():X())},ee=E=>{let $=E.target,j=En($.files,d,e.attachments);j.accepted.length>0&&(Ge.info("attach (file picker)",{count:j.accepted.length,totalBytes:at(j.accepted)}),o.emit("attach",{count:j.accepted.length,totalBytes:at(j.accepted)}),_(le=>[...le,...j.accepted])),$.value=""},J=E=>{Ge.info("removeAttachment",{id:E}),o.emit("removeAttachment",{id:E}),_($=>{let j=$.find(le=>le.id===E);return j&&Bo(j),$.filter(le=>le.id!==E)})},re=O(null),Be=()=>{if(I.isSupported){if(f){let E=re.current?Date.now()-re.current:0;Ge.info("voiceStop",{durationMs:E}),o.emit("voiceStop",{durationMs:E}),I.stop(),v(!1),n.play("voiceStop"),re.current=null;return}re.current=Date.now(),Ge.info("voiceStart"),o.emit("voiceStart",void 0),v(!0),n.play("voiceStart"),I.start((E,$)=>p(j=>$?`${j}${E} `:j),()=>{if(v(!1),re.current){let E=Date.now()-re.current;Ge.debug("voiceStop (auto)",{durationMs:E}),o.emit("voiceStop",{durationMs:E}),re.current=null}})}},je=_d[e.composer.sendButton.icon];return r("div",{class:`${me}-composer`,"data-testid":P.composer,children:[d.length>0?r("div",{class:`${me}-attachments`,children:d.map(E=>r(wa,{attachment:E,onRemove:()=>J(E.id)},E.id))}):null,r("div",{class:`${me}-composer-row`,children:[r("div",{class:`${me}-composer-actions`,children:[b?r("button",{type:"button",class:`${me}-icon-btn`,onClick:()=>y.current?.click(),"aria-label":c.attach,"data-testid":P.composerAttach,children:r(Xi,{})}):null,I.isSupported?r("button",{type:"button",class:`${me}-icon-btn`,onClick:Be,"aria-label":f?c.micStop:c.micStart,"aria-pressed":f,"data-recording":f?"true":void 0,"data-testid":P.composerVoice,children:r(ji,{})}):null]}),r("textarea",{ref:m,class:`${me}-textarea`,rows:1,value:u,placeholder:c.composerPlaceholder,onInput:E=>p(E.target.value),onKeyDown:de,"aria-label":c.composerPlaceholder,"data-testid":P.composerInput}),i?r("button",{type:"button",class:`${me}-send`,onClick:s,"aria-label":c.stop,"data-testid":P.composerStop,children:r(qi,{})}):r("button",{type:"button",class:`${me}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:X,disabled:!u.trim()&&d.length===0,"aria-label":c.send,"data-testid":P.composerSend,children:r(je,{})})]}),r("input",{ref:y,type:"file",multiple:!0,accept:e.attachments.accept,onChange:ee,class:`${me}-sr-only`,"data-testid":P.composerFileInput})]})}var ud=h.cssPrefix;function Ea({visible:e,strings:t}){return e?r("div",{class:`${ud}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}function Cn({containerRef:e,onDrop:t}){let[n,o]=k(!1);return w(()=>{let i=e.current;if(!i)return;let a=0,s=p=>{a+=1,p.dataTransfer?.types.includes("Files")&&(p.preventDefault(),o(!0))},l=()=>{a-=1,!(a>0)&&(a=0,o(!1))},c=p=>{p.dataTransfer?.types.includes("Files")&&p.preventDefault()},u=p=>{a=0,o(!1),p.dataTransfer&&(p.preventDefault(),t(p.dataTransfer.items))};return i.addEventListener("dragenter",s),i.addEventListener("dragleave",l),i.addEventListener("dragover",c),i.addEventListener("drop",u),()=>{i.removeEventListener("dragenter",s),i.removeEventListener("dragleave",l),i.removeEventListener("dragover",c),i.removeEventListener("drop",u)}},[e,t]),{visible:n}}var Ko=1,Aa=2,Ta=4,Ia=8,Ra=16;function pd(e){switch(e){case Ko:return"href";case Aa:return"src";case Ta:return"class";case Ia:return"checked";case Ra:return"start"}}var fd=e=>{switch(e){case 1:return 3;case 2:return 4;case 3:return 5;case 4:return 6;case 5:return 7;default:return 8}},gd=fd;var Ca=24;function Vo(e){let t=new Uint32Array(Ca);return t[0]=1,{renderer:e,text:"",pending:"",tokens:t,len:0,token:1,fence_end:0,blockquote_idx:0,hr_char:"",hr_chars:0,fence_start:0,spaces:new Uint8Array(Ca),indent:"",indent_len:0,table_state:0}}function Ma(e){e.pending.length>0&&se(e,`
|
|
12
|
-
`)}function B(e){e.text.length!==0&&(console.assert(e.len>0,"Never adding text to root"),e.renderer.add_text(e.renderer.data,e.text),e.text="")}function Z(e){console.assert(e.len>0,"No nodes to end"),e.len-=1,e.token=e.tokens[e.len],e.renderer.end_token(e.renderer.data)}function W(e,t){(e.tokens[e.len]===24||e.tokens[e.len]===23)&&t!==25&&Z(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function md(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function Ve(e,t){for(e.fence_start=0;e.len>t;)Z(e)}function An(e,t){let n=0;for(let o=0;o<=e.len&&(t-=e.spaces[o],!(t<0));o+=1)switch(e.tokens[o]){case 9:case 10:case 20:case 25:n=o;break}for(;e.len>n;)Z(e);return t}function Fo(e,t){let n=-1,o=-1;for(let i=e.blockquote_idx+1;i<=e.len;i+=1)if(e.tokens[i]===25){if(e.indent_len<e.spaces[i]){o=-1;break}o=i}else e.tokens[i]===t&&(n=i);return o===-1?n===-1?(Ve(e,e.blockquote_idx),W(e,t),!0):(Ve(e,n),!1):(Ve(e,o),W(e,t),!0)}function Wo(e,t){W(e,25),e.spaces[e.len]=e.indent_len+t,Me(e),e.token=103}function Me(e){e.indent="",e.indent_len=0,e.pending=""}function Go(e){switch(e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return!0;default:return!1}}function hd(e){switch(e){case 32:case 58:case 59:case 41:case 44:case 33:case 46:case 63:case 93:case 10:return!0;default:return!1}}function vd(e){return Go(e)||hd(e)}function
|
|
11
|
+
${i}`:i;continue}o.startsWith("id:")&&(n=o.slice(3).trim())}if(!t||t==="[DONE]")return null;try{let o=JSON.parse(t);return wi.trace("chunk",{type:o.type,eventId:n}),{chunk:o,eventId:n}}catch(o){return wi.trace("frame parse failed",{err:o,payload:t.slice(0,200)}),null}}function vc(e){let t=new TextEncoder().encode(e),n="";for(let o of t)n+=String.fromCharCode(o);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var Ei=e=>e&&Object.keys(e).length>0?e:void 0;function Ci(e,t){let n=Ei(e),o=Ei(t);if(!n&&!o)return;let i={};return n&&(i.user=n),o&&(i.page=o),vc(JSON.stringify(i))}var Ee={startSession:"/ai/agent/start-session",streamMessage:"/ai/agent/stream-message",streamResume:"/ai/agent/stream-resume",cancelStream:"/ai/agent/cancel-stream",listSessions:"/ai/agent/list-sessions",listMessages:"/ai/agent/list-messages",updateSettings:"/ai/agent/update-settings",markRead:"/ai/agent/mark-read",content:"/ai/agent/content"},Ai="context";function Ti(e){let n={messages:e.messages.map(a=>({id:a.id,parts:xc(a),role:a.role})),sessionId:e.sessionId,trigger:e.trigger??"submit-message"};e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs);let o={},i=e.tools?.map(bc).filter(a=>a!==null);return i?.length&&(o.tools=i),e.responseMode&&(o.responseMode=e.responseMode),Object.keys(o).length>0&&(n.data=o),n}function bc(e){return typeof e=="string"?e?{code:e}:null:e?.code?e:null}function xc(e){let t=[];for(let n of e.parts)n.kind==="text"&&n.text&&t.push({text:n.text,type:"text"}),n.kind==="file"&&n.url&&t.push({mediaType:n.mediaType,type:"file",url:n.url});for(let n of e.attachments??[])n.url&&t.push({type:"file",url:n.url,mediaType:n.mediaType,filename:n.name,fileId:n.id,fileSize:n.size});return t}var q=M.scope("transport"),yc=3,Mi=400,Ii=3,Pc=new Set([408,425,429,500,502,503,504]);function Ri(e){return Mi*2**e+Math.floor(Math.random()*250)}function Sc(e){let t=e.get("retry-after");if(!t)return null;let n=Number(t),o=Number.isFinite(n)?n*1e3:Date.parse(t)-Date.now();return Number.isFinite(o)&&o>=0?Math.min(o,3e4):null}function Ro(e,t){return new Promise(n=>{if(t?.aborted)return n();let o=setTimeout(a,e),i=()=>a();t?.addEventListener("abort",i,{once:!0});function a(){clearTimeout(o),t?.removeEventListener("abort",i),n()}})}var un=class{constructor(t){F(this,"opts",t);F(this,"visitorId");F(this,"sessionId");F(this,"userContext");F(this,"pageContext")}setContext(t,n){this.userContext=t,this.pageContext=n}primeIdentity(t,n){t&&(this.visitorId=t),n&&(this.sessionId=n)}envelope(){let t={};this.visitorId&&(t.visitorId=this.visitorId),this.sessionId&&(t.sessionId=this.sessionId);let n=Ci(this.userContext,this.pageContext);return n&&(t[Ai]=n),t}withEnvelope(t){return{...this.envelope(),...t}}appendEnvelope(t){for(let[n,o]of Object.entries(this.envelope()))t.append(n,o);return t}withEnvelopeQuery(t){let n=new URL(this.url(t));for(let[o,i]of Object.entries(this.envelope()))n.searchParams.has(o)||n.searchParams.set(o,i);return n.toString()}async startSession(t){q.debug("startSession \u2192",{visitorId:t.visitorId,sessionId:t.sessionId,locale:t.locale});let n=await this.postJson(Ee.startSession,t,"startSession");return q.debug("startSession \u2190",{visitorId:n.visitorId,sessionId:n.sessionId,canContinue:n.canContinue,hasMessages:!!n.messages?.length,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),kc(n)||q.warn("startSession response did not match expected shape; using raw response",{response:n}),this.visitorId=n.visitorId??t.visitorId,this.sessionId=n.sessionId,n}async uploadFile(t){q.debug("uploadFile \u2192",{name:t.name,size:t.size,type:t.type});let n=new FormData;n.append("file",t,t.name);let o=await this.postForm(this.uploadPath,n,"upload");return q.debug("uploadFile \u2190",{id:o.id,url:o.url}),o}async transcribe(t,n="audio/webm"){q.debug("transcribe \u2192",{size:t.size,mimeType:n});let o=new FormData;o.append("audio",t,`voice.${wc(n)}`),o.append("mimeType",n);let i=await this.postForm(this.transcribePath,o,"transcribe");return q.debug("transcribe \u2190",{textLen:i.text.length}),i}async listSessions(t={}){let n=new URL(this.url(Ee.listSessions));t.visitorId&&n.searchParams.set("visitorId",t.visitorId),t.limit&&n.searchParams.set("limit",String(t.limit)),t.cursor&&n.searchParams.set("cursor",t.cursor),q.debug("listSessions \u2192",{visitorId:t.visitorId??this.visitorId,limit:t.limit,cursor:t.cursor});let o=await this.getJson(n.toString(),"listSessions"),i=o.sessions??[];return q.debug("listSessions \u2190",{count:i.length,nextCursor:o.nextCursor}),{sessions:i.map(a=>({sessionId:a.sessionId,title:a.title,lastMessageAt:a.lastMessageAt,preview:a.preview,canContinue:a.canContinue,unreadCount:a.unreadCount})),nextCursor:o.nextCursor}}async loadSession(t){let n=new URL(this.url(Ee.listMessages));n.searchParams.set("sessionId",t),q.debug("loadSession \u2192",{sessionId:t,visitorId:this.visitorId});let o=await this.getJson(n.toString(),"loadSession"),i=o.messages??[];return q.debug("loadSession \u2190",{sessionId:o.sessionId,canContinue:o.canContinue,messageCount:i.length,hasSuggestions:!!o.suggestions}),{sessionId:o.sessionId,canContinue:o.canContinue??!0,messages:i,agent:o.agent,suggestions:o.suggestions}}async markRead(t){if(!(!this.visitorId||!t)){q.debug("markRead \u2192",{sessionId:t,visitorId:this.visitorId});try{await this.postJson(Ee.markRead,{sessionId:t},"markRead")}catch(n){q.debug("markRead failed (non-fatal)",{err:n})}}}async listContent(t={}){let n=new URL(this.url(Ee.content));for(let[a,s]of Object.entries(t))s!==void 0&&n.searchParams.set(a,Array.isArray(s)?s.join(","):String(s));q.debug("listContent \u2192",t);let o=await this.getJson(n.toString(),"listContent"),i=o.items??[];return q.debug("listContent \u2190",{count:i.length,total:o.pagination?.total}),{...o,items:i}}async saveUserPrefs(t){q.debug("saveUserPrefs \u2192",{visitorId:this.visitorId,sessionId:this.sessionId,settingsKeys:Object.keys(t)});let n=await this.postJson(Ee.updateSettings,{userPrefs:t},"saveUserPrefs");return q.debug("saveUserPrefs \u2190",{ok:n.ok}),n}get uploadPath(){return this.opts.endpoints?.upload??"/ai/agent/upload-file"}get transcribePath(){return this.opts.endpoints?.transcribe??"/ai/agent/transcribe-audio"}sendMessage(t){q.debug("message \u2192",{sessionId:t.sessionId,visitorId:t.visitorId,messageCount:t.messages.length,trigger:t.trigger,responseMode:t.data?.responseMode,tools:t.data?.tools?.map(s=>s.code)});let n=new AbortController,o=new Set;return{iter:this.runStream(t,n,o),cancel:()=>this.cancelStream(n,t.sessionId)}}resumeStream(){let t=new AbortController,n=new Set;return{iter:this.resumeStreamGen(t,n,!0),cancel:()=>t.abort()}}async*runStream(t,n,o){(yield*this.drain(this.openMessageStream(t,n.signal),o,n))||(yield*this.resumeStreamGen(n,o,!1))}async*resumeStreamGen(t,n,o){for(let i=1;i<=yc&&!t.signal.aborted;i++){if((!o||i>1)&&(await Ro(Mi*i,t.signal),t.signal.aborted))return;let a;try{a=await this.fetchImpl(this.resumeUrl(n.size),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.opts.auth.headers()},signal:t.signal})}catch(l){if(t.signal.aborted)return;q.debug("resume fetch failed \u2014 retrying",{attempt:i,err:l});continue}if(a.status===204||!a.ok){q.debug("resume \u2192 no in-flight stream",{status:a.status});return}let s=n.size;if(yield*this.drain(Io(a,t.signal),n,t))return;if(n.size===s){q.debug("resume \u2192 stream closed with no new events; nothing to resume");return}}if(!t.signal.aborted)throw new he("stream incomplete after resume attempts","server")}async*drain(t,n,o){try{for await(let i of t){if(o.signal.aborted)return!0;if(i.eventId){if(n.has(i.eventId))continue;n.add(i.eventId)}if(yield i,i.chunk.type==="finish"||i.chunk.type==="error")return!0}}catch(i){if(o.signal.aborted)return!0;if(i instanceof he&&i.status!==void 0)throw i;q.debug("stream segment dropped",{err:i})}return!1}cancelStream(t,n){t.signal.aborted||(q.debug("cancel stream",{sessionId:n,visitorId:this.visitorId}),t.abort(),!(!this.visitorId||!n)&&this.fetchImpl(this.url(Ee.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope({})),keepalive:!0}).catch(o=>q.debug("cancel POST failed (non-fatal)",{err:o})))}async*openMessageStream(t,n){let o=await this.fetchImpl(this.url(Ee.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"text/event-stream","content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(t)),signal:n});yield*Io(o,n)}resumeUrl(t){let n=new URL(this.withEnvelopeQuery(Ee.streamResume));return n.searchParams.set("resumeAt",String(t)),n.toString()}async postJson(t,n,o){let i=await this.fetchWithRetry(()=>[this.url(t),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(n))}],o);return this.assertOk(i,o)}async postForm(t,n,o){let i=await this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.opts.auth.headers(),body:this.appendEnvelope(n)});return this.assertOk(i,o)}async getJson(t,n){let o=await this.fetchWithRetry(()=>[this.withEnvelopeQuery(t),{method:"GET",credentials:"omit",headers:{accept:"application/json",...this.opts.auth.headers()}}],n);return this.assertOk(o,n)}async fetchWithRetry(t,n){for(let o=0;;o++){let[i,a]=t(),s;try{s=await this.fetchImpl(i,a)}catch(c){if(o>=Ii)throw new he(`${n} failed: network error`,"network",void 0,c);q.debug("request network error \u2014 retrying",{label:n,attempt:o}),await Ro(Ri(o));continue}if(s.ok||!Pc.has(s.status)||o>=Ii)return s;let l=Sc(s.headers)??Ri(o);q.debug("request retryable status \u2014 retrying",{label:n,status:s.status,attempt:o,wait:l}),await Ro(l)}}async assertOk(t,n){if(!t.ok)throw new he(`${n} failed: ${t.status}`,"server",t.status);return await t.json()}url(t){return/^https?:\/\//i.test(t)?t:`${this.opts.baseUrl}${t}`}get fetchImpl(){return this.opts.fetchImpl??globalThis.fetch.bind(globalThis)}};function wc(e){return e.includes("webm")?"webm":e.includes("ogg")?"ogg":e.includes("mp4")||e.includes("m4a")?"m4a":e.includes("mpeg")?"mp3":e.includes("wav")?"wav":"bin"}function kc(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.visitorId=="string"&&typeof t.sessionId=="string"&&typeof t.canContinue=="boolean"}function Li(e,t){let n=e?[{kind:"text",id:"t0",textSig:N(e),doneSig:N(!0)}]:[];return{id:ke(),role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:N(n)}}function Mo(){return{id:ke(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:N([])}}function Ni(e){return{id:e.id,role:e.role,createdAt:Date.now(),status:"streaming",partsSig:N([{kind:"text",id:`${e.id}-t0`,textSig:N(""),doneSig:N(!1)}])}}function Oi(e){return Ec({id:e.id,role:e.role,createdAt:Date.now(),status:"complete",parts:[{kind:"text",id:`${e.id}-t0`,text:e.text,done:!0}]})}function Ec(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,errorText:e.errorText,finishReason:e.finishReason,attachments:e.attachments,partsSig:N(e.parts.map(Cc))}}function Lo(e){let t=e.parts.map((n,o)=>n.type==="text"?{kind:"text",id:`${e.id}-t${o}`,textSig:N(n.text),doneSig:N(!0)}:n.type==="file"?{kind:"file",url:n.url,mediaType:n.mediaType}:null).filter(n=>n!==null);return{id:e.id,role:e.role,createdAt:Date.now(),status:"complete",partsSig:N(t)}}function Di(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,errorText:e.errorText,finishReason:e.finishReason,attachments:e.attachments,parts:e.partsSig.value.map(Ac)}}function No(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function Cc(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:N(e.text),doneSig:N(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,inputPartialSig:N(e.inputPartial),inputSig:N(e.input),outputSig:N(e.output),errorSig:N(e.error),stateSig:N(e.state)}:e}function Ac(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,text:e.textSig.value,done:e.doneSig.value}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,inputPartial:e.inputPartialSig.value,input:e.inputSig.value,output:e.outputSig.value,error:e.errorSig.value,state:e.stateSig.value}:e}var Hi=M.scope("reducer"),pn=class{constructor(t){F(this,"messagesSig",t);F(this,"active",null)}attach(t){this.active=t}detach(){this.active=null}apply(t){let n=this.active;if(n)switch(t.type){case"start":case"start-step":case"finish-step":return;case"finish":Hi.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.status="complete",t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":Hi.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"text-start":rt(n,"text",t.id);return;case"text-delta":{let o=rt(n,"text",t.id);o.textSig.value+=t.delta;return}case"text-end":rt(n,"text",t.id).doneSig.value=!0;return;case"reasoning-start":rt(n,"reasoning",t.id).doneSig.value=!1;return;case"reasoning-delta":{let o=rt(n,"reasoning",t.id);o.textSig.value+=t.delta;return}case"reasoning-end":rt(n,"reasoning",t.id).doneSig.value=!0;return;case"tool-input-start":case"tool-input-delta":case"tool-input-available":case"tool-output-available":case"tool-output-error":Tc(n,t);return;case"file":fn(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":{if(n.partsSig.value.some(i=>i.kind==="source"&&i.sourceId===t.sourceId))return;fn(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return}case"data-notification":return;default:{let o=t}}}bumpDone(t){t.partsSig.value=[...t.partsSig.value],this.messagesSig.value=[...this.messagesSig.value]}};function rt(e,t,n){let o=e.partsSig.value.find(a=>a.kind===t&&a.id===n);if(o)return o;let i={kind:t,id:n,textSig:N(""),doneSig:N(!1)};return fn(e,i),i}function Pt(e,t,n){let o=e.partsSig.value.find(a=>a.kind==="tool"&&a.toolCallId===t);if(o)return o;let i={kind:"tool",toolCallId:t,toolName:n??"tool",inputPartialSig:N(""),inputSig:N(void 0),outputSig:N(void 0),errorSig:N(void 0),stateSig:N("input")};return fn(e,i),i}function fn(e,t){e.partsSig.value=[...e.partsSig.value,t]}function Tc(e,t){switch(t.type){case"tool-input-start":Pt(e,t.toolCallId,t.toolName);return;case"tool-input-delta":{let n=Pt(e,t.toolCallId);n.inputPartialSig.value+=t.delta;return}case"tool-input-available":{let n=Pt(e,t.toolCallId,t.toolName);n.inputSig.value=t.input,n.stateSig.value="awaiting";return}case"tool-output-available":{let n=Pt(e,t.toolCallId);n.outputSig.value=t.output,n.stateSig.value="output";return}case"tool-output-error":{let n=Pt(e,t.toolCallId);n.errorSig.value=t.errorText,n.stateSig.value="error";return}default:return}}var gn=M.scope("persistence");function St(e,t=on){let n=`${h.cssPrefix}.${e}`,o=`${n}.visitorId`,i=`${n}.sessionId`,a=`${n}.userPrefs`,s=`${n}.panelOpen`,l=`${n}.panelSize`,c=`${n}.calloutDismissed`,u=`${n}.sidebarCollapsed`,p=`${n}.activeModule`,d={getVisitorId(){let _=t.get(o);if(_)return _;let f=ke();return t.set(o,f),f},setVisitorId(_){gn.debug("setVisitorId (rebind)",{id:_,widgetId:e}),t.set(o,_)},loadSessionId(){return t.get(i)??void 0},saveSessionId(_){gn.trace("saveSessionId",{id:_,widgetId:e}),_?t.set(i,_):t.remove(i)},loadUserPrefs(){let _=t.get(a);if(!_)return{};try{let f=JSON.parse(_);return Ic(f)?f:{}}catch(f){return gn.warn("loadUserPrefs parse failed",{error:f}),{}}},saveUserPrefs(_){try{t.set(a,JSON.stringify(_))}catch(f){gn.warn("saveUserPrefs serialise failed",{error:f})}},patchUserPrefs(_){let f=d.loadUserPrefs();d.saveUserPrefs({...f,..._})},loadPanelOpen(){let _=t.get(s);return _==="1"?!0:_==="0"?!1:null},savePanelOpen(_){t.set(s,_?"1":"0")},loadPanelSize(){let _=t.get(l);return _==="normal"||_==="expanded"||_==="fullscreen"?_:null},savePanelSize(_){t.set(l,_)},loadCalloutDismissed(_){if(!_)return!1;let f=t.get(c);return!!f&&f===_},saveCalloutDismissed(_){_?t.set(c,_):t.remove(c)},loadSidebarCollapsed(){let _=t.get(u);return _==="1"?!0:_==="0"?!1:null},saveSidebarCollapsed(_){t.set(u,_?"1":"0")},loadActiveModule(){return t.get(p)||null},saveActiveModule(_){t.set(p,_)},clearSession(){t.remove(i)}};return d}function Ic(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var $i=M.scope("feedback:audio"),mn=class{constructor(){F(this,"ctx",null);F(this,"master",null);F(this,"buffers",new Map)}unlock(){if(this.ctx){this.ctx.state==="suspended"&&this.ctx.resume();return}let t=globalThis.AudioContext??globalThis.webkitAudioContext;if(t)try{this.ctx=new t,this.master=this.ctx.createGain(),this.master.gain.value=1,this.master.connect(this.ctx.destination)}catch(n){$i.warn("AudioContext init failed",{err:n})}}setVolume(t){if(!this.master||!this.ctx)return;let n=Math.max(0,Math.min(1,t));this.master.gain.setTargetAtTime(n,this.ctx.currentTime,.01)}playTone(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let i=n.currentTime,a=t.noteMs/1e3;t.notes.forEach((s,l)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=s;let u=n.createGain(),p=i+l*a;u.gain.setValueAtTime(1e-4,p),u.gain.exponentialRampToValueAtTime(t.peakGain,p+.005),u.gain.exponentialRampToValueAtTime(1e-4,p+a),c.connect(u).connect(o),c.start(p),c.stop(p+a+.01)})}async playUrl(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let i=await this.getBuffer(t);if(!i)return;let a=n.createBufferSource();a.buffer=i,a.connect(o),a.start()}destroy(){this.ctx&&this.ctx.close().catch(()=>{}),this.ctx=null,this.master=null,this.buffers.clear()}async getBuffer(t){if(!this.ctx)return null;let n=this.buffers.get(t);if(n)return n instanceof Promise,n;let o=this.ctx,i=fetch(t).then(a=>a.ok?a.arrayBuffer():Promise.reject(new Error(`fetch ${a.status}`))).then(a=>o.decodeAudioData(a)).then(a=>(this.buffers.set(t,a),a)).catch(a=>($i.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,i),i}};var Bi={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},Ui={messageReceived:{notes:[880,1318.51],noteMs:90,type:"sine",peakGain:.45},messageSent:{notes:[1568],noteMs:60,type:"sine",peakGain:.25},error:{notes:[523.25,392],noteMs:120,type:"triangle",peakGain:.55},voiceStart:{notes:[1318.51],noteMs:50,type:"sine",peakGain:.3},voiceStop:{notes:[880],noteMs:50,type:"sine",peakGain:.3}};var $e=null,hn=0;function Rc(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function Mc(){if(typeof document>"u")return null;let e=document.createElement("input");e.type="checkbox",e.setAttribute("switch",""),e.setAttribute("aria-hidden","true"),e.tabIndex=-1,e.id=`__${h.cssPrefix}_haptic_${Math.random().toString(36).slice(2)}`;let t=document.createElement("label");t.htmlFor=e.id,t.setAttribute("aria-hidden","true");let n="position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;opacity:0!important;pointer-events:none!important;";return e.style.cssText=n,t.style.cssText=n,document.body.append(e,t),{input:e,label:t}}function zi(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(Rc())try{navigator.vibrate(e);return}catch{}if($e||($e=Mc()),!!$e)try{$e.label.click()}catch{}}}function Fi(){hn++;let e=!1;return()=>{e||(e=!0,hn=Math.max(0,hn-1),hn===0&&$e&&($e.input.remove(),$e.label.remove(),$e=null))}}var Lc=M.scope("feedback"),Nc=100,vn=class{constructor(t,n){F(this,"mutedSig",N(!1));F(this,"audio",new mn);F(this,"releaseHaptics");F(this,"sound");F(this,"haptics");F(this,"lastPlayed",new Map);F(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=Fi(),this.audio.setVolume(this.effectiveVolume()),typeof matchMedia<"u"&&(this.reducedMotionMq=matchMedia("(prefers-reduced-motion: reduce)"))}unlock(){this.audio.unlock(),this.audio.setVolume(this.effectiveVolume())}update(t,n){this.sound=t,this.haptics=n,this.audio.setVolume(this.effectiveVolume())}setMuted(t){this.mutedSig.value!==t&&(this.mutedSig.value=t)}toggleMuted(){this.mutedSig.value=!this.mutedSig.value}play(t){this.mutedSig.value||this.isDeduped(t)||(this.lastPlayed.set(t,performance.now()),this.sound.enabled&&this.playSound(t),this.haptics.enabled&&this.isTouchDevice()&&this.playHaptic(t))}destroy(){this.audio.destroy(),this.releaseHaptics()}isDeduped(t){let n=this.lastPlayed.get(t);return n===void 0?!1:performance.now()-n<Nc}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(i=>Lc.warn("audio play failed",{err:i,url:n}));return}let o=Ui[t];o&&this.audio.playTone(o)}playHaptic(t){if(this.reducedMotionMq?.matches)return;let n=this.haptics.events?.[t];if(n===!1)return;let o=n===!0||n===void 0?Bi[t]:n;zi(o)}effectiveVolume(){let t=this.sound.volume??.3;return this.reducedMotionMq?.matches?t*.5:t}isTouchDevice(){return typeof window>"u"?!1:matchMedia("(hover: none) and (pointer: coarse)").matches}};function We(e,t){return e instanceof he&&e.status===429?t.errorRateLimited:t.errorGeneric}var Oc=0;function r(e,t,n,o,i,a){t||(t={});var s,l,c=t;if("ref"in c)for(l in c={},t)l=="ref"?s=t[l]:c[l]=t[l];var u={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Oc,__i:-1,__u:0,__source:i,__self:a};if(typeof e=="function"&&(s=e.defaultProps))for(l in s)c[l]===void 0&&(c[l]=s[l]);return H.vnode&&H.vnode(u),u}var T={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},Dc=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})}),fe=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M18 6 6 18M6 6l12 12"})}),Wi=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M12 5v14M5 12h14"})}),Ki=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"m22 2-7 20-4-9-9-4Z"}),r("path",{d:"M22 2 11 13"})]}),Gi=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M12 19V5M5 12l7-7 7 7"})}),Vi=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M3 20V4l18 8-18 8Z"})}),bn=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"m9 18 6-6-6-6"})}),qi=()=>r("svg",{...T,"aria-hidden":"true",children:r("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),Xi=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"m21 11-9 9a5.5 5.5 0 0 1-7.78-7.78l8.49-8.49a3.67 3.67 0 0 1 5.19 5.19l-8.49 8.49a1.83 1.83 0 0 1-2.6-2.6l7.78-7.78"})}),ji=()=>r("svg",{...T,"aria-hidden":"true",children:[r("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),r("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]}),Yi=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})}),Ji=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})}),Qi=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})}),Zi=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})}),ea=()=>r("svg",{...T,"aria-hidden":"true",viewBox:"0 0 10 10",children:r("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})}),ta=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),r("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),r("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]}),na=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})}),oa=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})}),it=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M20 6 9 17l-5-5"})}),ra=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M3 3v6h6"}),r("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),r("path",{d:"M12 7v5l3 2"})]}),ia=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("path",{d:"M2 12h20"}),r("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),wt=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),aa=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M15 3h6v6M10 14 21 3M21 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5"})}),sa=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"})}),la=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),r("path",{d:"M14 2v6h6"})]}),Hc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),r("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]}),$c=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})}),Oo=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),r("path",{d:"M12 17h.01"})]}),Bc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"m15 4 3 3-9 9-3-3z"}),r("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]}),Uc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),r("path",{d:"M12 8V4"}),r("circle",{cx:"12",cy:"3",r:"1"}),r("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]}),zc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),r("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),r("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),r("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]}),Fc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("circle",{cx:"12",cy:"12",r:"4"}),r("path",{d:"m4.93 4.93 4.24 4.24M14.83 14.83l4.24 4.24M14.83 9.17l4.24-4.24M4.93 19.07l4.24-4.24"})]}),Do=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"11",cy:"11",r:"7"}),r("path",{d:"m21 21-4.3-4.3"})]}),ca=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),da=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M3 9.5 12 3l9 6.5"}),r("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]}),_a=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"m3 11 15-5v12L3 13z"}),r("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),r("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),r("path",{d:"M21 10a3 3 0 0 1 0 4"})]}),kt=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),r("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]}),ua=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"4"}),r("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),pa=()=>r("svg",{...T,"aria-hidden":"true",children:r("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),fa=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M12 3v18"}),r("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]}),Wc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),r("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),r("path",{d:"m20 20-4.4-4.4"})]}),Kc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M12 3.5 13.6 9 19 10.5 13.6 12 12 17.5 10.4 12 5 10.5 10.4 9z"}),r("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]}),Gc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M4 18h16"}),r("path",{d:"M5 18a7 7 0 0 1 14 0"}),r("path",{d:"M12 8V6"}),r("path",{d:"M10 6h4"})]}),Vc=()=>r("svg",{...T,"aria-hidden":"true",children:[r("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),r("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),r("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),r("path",{d:"M16 9.5a1.5 1.5 0 0 1 3 0v2.5a7 7 0 0 1-7 7 7 7 0 0 1-6.4-4.2L4 12.5a1.5 1.5 0 0 1 2.6-1.5L7 11"})]}),ga={chat:Dc,message:$c,bubbles:kt,spark:Hc,wand:Bc,bot:Uc,help:Oo,lifebuoy:Fc,headset:zc,search:Wc,sparkles:Kc,concierge:Gc,wave:Vc};var C=h.cssPrefix,P={launcher:`${C}-launcher`,callout:`${C}-callout`,calloutDismiss:`${C}-callout-dismiss`,panel:`${C}-panel`,panelHeader:`${C}-panel-header`,resizeGrip:`${C}-resize-grip`,actionClear:`${C}-action-clear`,actionExpand:`${C}-action-expand`,actionFullscreen:`${C}-action-fullscreen`,actionPopOut:`${C}-action-popout`,actionSound:`${C}-action-sound`,actionHistory:`${C}-action-history`,actionLanguage:`${C}-action-language`,actionTheme:`${C}-action-theme`,actionClose:`${C}-action-close`,actionOverflow:`${C}-action-overflow`,languageOption:`${C}-language-option`,themeOption:`${C}-theme-option`,composer:`${C}-composer`,composerInput:`${C}-composer-input`,composerSend:`${C}-composer-send`,composerStop:`${C}-composer-stop`,composerAttach:`${C}-composer-attach`,composerFileInput:`${C}-composer-file-input`,composerVoice:`${C}-composer-voice`,attachmentChip:`${C}-attachment-chip`,attachmentRemove:`${C}-attachment-remove`,suggestion:`${C}-suggestion`,messageBubble:`${C}-message`,messageRetry:`${C}-message-retry`,historyPane:`${C}-history-pane`,historyBack:`${C}-history-back`,historyItem:`${C}-history-item`,sidebar:`${C}-sidebar`,sidebarToggle:`${C}-sidebar-toggle`,sidebarNewChat:`${C}-sidebar-new-chat`,sidebarItem:`${C}-sidebar-item`,messengerHome:`${C}-messenger-home`,modulesEmpty:`${C}-modules-empty`,tab:`${C}-tab`,tabBadge:`${C}-tab-badge`,homeView:`${C}-home-view`,homeGreeting:`${C}-home-greeting`,homeBrand:`${C}-home-brand`,backHeader:`${C}-back-header`,contentView:`${C}-content-view`,contentScroll:`${C}-content-scroll`,homeSearch:`${C}-home-search`,helpSearch:`${C}-help-search`,homeRecent:`${C}-home-recent`,homeContentRow:`${C}-home-content-row`,helpArticle:`${C}-help-article`,newsItem:`${C}-news-item`};function de(e,t){return`${e}-${t}`}var ma={clear:P.actionClear,expand:P.actionExpand,fullscreen:P.actionFullscreen,popOut:P.actionPopOut,sound:P.actionSound,history:P.actionHistory,language:P.actionLanguage,theme:P.actionTheme,close:P.actionClose};var xn=h.cssPrefix;function ha({onToggle:e,launcher:t,strings:n,leaving:o,edgeTab:i}){let a=t.variant!=="circle"&&!!t.label;return r("button",{type:"button",class:`${xn}-fab`,"data-variant":t.variant,"data-size":t.size,"data-edge-tab":i?"true":void 0,"data-leaving":o?"true":void 0,"data-testid":P.launcher,onClick:e,"aria-label":n.launcherOpen,children:[qc(t.icon),a?r("span",{class:`${xn}-fab-label`,children:t.label}):null]})}function qc(e){let t=ga[e];return t?r(t,{}):r(Xc,{source:e})}function Xc({source:e}){return r("span",{ref:t=>{t&&jc(t,e)},"aria-hidden":"true"})}function jc(e,t){if(e.dataset.svgMounted!==t)try{let o=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;o&&o.tagName.toLowerCase()==="svg"&&(e.replaceChildren(document.importNode(o,!0)),e.dataset.svgMounted=t)}catch{}}function va({callout:e,launcherPosition:t,closeLabel:n,onDismiss:o}){let[i,a]=k(!1);return w(()=>{let s=setTimeout(()=>a(!0),e.delayMs);return()=>clearTimeout(s)},[e.delayMs]),w(()=>{if(!i||e.autoDismissMs<=0)return;let s=setTimeout(o,e.autoDismissMs);return()=>clearTimeout(s)},[i,e.autoDismissMs,o]),i?r("div",{class:`${xn}-callout`,role:"status","data-shape":e.shape,"data-position":Yc(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":P.callout,children:[r("span",{children:e.text}),r("button",{type:"button",class:`${xn}-callout-close`,onClick:o,"aria-label":n,title:n,"data-testid":P.calloutDismiss,children:r(fe,{})})]}):null}function Yc(e,t){let n=t.endsWith("-right"),o=t.startsWith("bottom-");return e==="vertical"?o?"top":"bottom":n?"left":"right"}function yn({panelEl:e,resize:t,position:n,initialSize:o,onSizeChange:i,strings:a}){let s=h.cssPrefix,l=O(null);if(w(()=>{if(!e)return;let v=e.style;t.minWidth&&v.setProperty(`--${s}-resize-min-w`,t.minWidth),t.maxWidth&&v.setProperty(`--${s}-resize-max-w`,t.maxWidth),t.minHeight&&v.setProperty(`--${s}-resize-min-h`,t.minHeight),t.maxHeight&&v.setProperty(`--${s}-resize-max-h`,t.maxHeight),o&&(v.setProperty(`--${s}-widget-w`,`${o.width}px`),v.setProperty(`--${s}-widget-h`,`${o.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,s,o]),!e)return null;let c=n.startsWith("top-"),u=n.endsWith("-right"),p=`${s}-resize-grip ${s}-resize-grip--${c?"bottom":"top"}-${u?"left":"right"}`,d=v=>{if(!e)return;let m=v.currentTarget,y=e.getBoundingClientRect();l.current={pointerId:v.pointerId,startX:v.clientX,startY:v.clientY,startW:y.width,startH:y.height,dirX:u?-1:1,dirY:c?1:-1},m.setPointerCapture(v.pointerId),v.preventDefault()},_=v=>{let m=l.current;if(!m||v.pointerId!==m.pointerId||!e)return;let y=(v.clientX-m.startX)*m.dirX,b=(v.clientY-m.startY)*m.dirY;e.style.setProperty(`--${s}-widget-w`,`${m.startW+y}px`),e.style.setProperty(`--${s}-widget-h`,`${m.startH+b}px`)},f=v=>{let m=l.current;if(!m||v.pointerId!==m.pointerId||!e)return;v.currentTarget.releasePointerCapture(v.pointerId);let y=e.getBoundingClientRect();i({width:Math.round(y.width),height:Math.round(y.height)}),l.current=null};return r("div",{class:p,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:d,onPointerMove:_,onPointerUp:f,onPointerCancel:f,"data-testid":P.resizeGrip,children:r(ea,{})})}var Ke=h.cssPrefix,Jc=`.${Ke}-header, .${Ke}-back-header, .${Ke}-home-hero`,Qc='button, a, input, textarea, select, [role="tab"], [contenteditable]',ba=56;function Pn(e,t){w(()=>{if(!t||!e)return;let n=c=>Number.parseFloat(c)||0,o=(c,u)=>Math.min(u,Math.max(-u,c)),i=null,a=c=>{let u=c.target;if(!(u instanceof Element)||!u.closest(Jc)||u.closest(Qc))return;let p=e.getBoundingClientRect();i={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${Ke}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${Ke}-modal-dy`)),maxX:(window.innerWidth+p.width)/2-ba,maxY:(window.innerHeight+p.height)/2-ba},e.dataset.dragging="true",c.preventDefault()},s=c=>{if(!i||c.pointerId!==i.id)return;let u=o(i.dx+c.clientX-i.x,i.maxX),p=o(i.dy+c.clientY-i.y,i.maxY);e.style.setProperty(`--${Ke}-modal-dx`,`${u}px`),e.style.setProperty(`--${Ke}-modal-dy`,`${p}px`)},l=c=>{!i||c.pointerId!==i.id||(i=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",s),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",l)}},[e,t])}function Sn(e,t,n,o){switch(e){case"clear":case"sound":case"history":case"language":case"theme":return!0;case"expand":return t==="floating";case"fullscreen":return t!=="standalone";case"popOut":return t!=="standalone"&&!!o?.popOutUrl;case"close":return t==="standalone"||t==="page"?!1:t==="inline"?n==="fullscreen":!0}}function Ho(e,t,n,o){return e.filter(i=>Sn(i,t,n,o))}function xa(e,t,n){return Sn("close",e,t)?n.main.includes("close")||n.overflow.includes("close"):!1}function ya(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}var Zc='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function wn(e){let t=n=>{if(n.key!=="Tab")return;let o=[...e.querySelectorAll(Zc)].filter(l=>l.offsetParent!==null||l===document.activeElement);if(o.length===0){n.preventDefault();return}let i=o[0],a=o[o.length-1];if(!i||!a)return;let s=e.getRootNode().activeElement;n.shiftKey&&s===i?(n.preventDefault(),a.focus()):!n.shiftKey&&s===a&&(n.preventDefault(),i.focus())};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}function kn(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var $o=h.cssPrefix;function Pa({agent:e}){let t=e.status??"online";return r("div",{class:`${$o}-agent`,children:[r("div",{class:`${$o}-agent-avatar`,"data-status":t,children:e.avatar?r("img",{src:e.avatar,alt:""}):r("span",{children:kn(e.name)})}),r("div",{class:`${$o}-agent-meta`,children:[r("strong",{children:e.name}),e.title?r("span",{children:e.title}):null]})]})}var Sa=M.scope("attachments");function En(e,t,n){let o=td(e),i=[],a=[],s=rd(n.accept),l=t.reduce((u,p)=>u+p.size,0),c=t.length;for(let u of o){let p=ed(u,c,l,n,s);if(p){a.push({file:u,reason:p});continue}i.push(od(u)),l+=u.size,c+=1}return(i.length||a.length)&&Sa.debug("ingest",{accepted:i.length,rejected:a.map(u=>({name:u.file.name,reason:u.reason}))}),{accepted:i,rejected:a}}function Bo(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){Sa.debug("revokeObjectURL failed",{error:t})}}function ed(e,t,n,o,i){return t>=o.maxCount?"count":n+e.size>o.maxBytes?"bytes":id(e,i)?null:"mime"}function td(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:nd(t)).filter(t=>t!==null):[]}function nd(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function od(e){return{file:e,id:ke(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function rd(e){return e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean).map(t=>{if(t.startsWith("."))return{kind:"ext",ext:t};let[n="*",o="*"]=t.split("/");return{kind:"mime",type:n,subtype:o}})}function id(e,t){if(t.length===0)return!0;let[n="*",o="*"]=(e.type||"").toLowerCase().split("/"),i=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?i.endsWith(a.ext):(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===o))}var Et=h.cssPrefix;function wa({attachment:e,onRemove:t}){let n=e.mediaType.startsWith("image/");return r("span",{class:`${Et}-attachment-chip`,title:e.name,"data-testid":de(P.attachmentChip,e.id),children:[n?r("img",{class:`${Et}-attachment-thumb`,src:e.previewUrl,alt:""}):r("span",{class:`${Et}-attachment-thumb`,"aria-hidden":"true",children:r(la,{})}),r("span",{class:`${Et}-attachment-name`,children:e.name}),r("button",{type:"button",class:`${Et}-attachment-remove`,onClick:t,"aria-label":`Remove ${e.name}`,"data-testid":de(P.attachmentRemove,e.id),children:r(fe,{})})]})}var Uo={isSupported:!1,start:()=>{},stop:()=>{}};function zo(e,t,n){return e==="disabled"?Uo:e==="server"?cd(n):ad(t)}function ad(e){let t=sd();if(!t)return Uo;let n=null;return{isSupported:!0,start(o,i){n=new t,n.continuous=!0,n.interimResults=!0,n.lang=e,n.addEventListener("result",s=>{let l=s,c="",u=!1;for(let p=l.resultIndex;p<l.results.length;p++){let d=l.results[p];d&&(c+=d[0].transcript,d.isFinal&&(u=!0))}o(c,u)});let a=()=>{n=null,i()};n.addEventListener("end",a),n.addEventListener("error",a),n.start()},stop(){n?.stop()}}}function sd(){let e=globalThis;return e.SpeechRecognition??e.webkitSpeechRecognition}var ld=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function cd(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Uo;let t=null,n=null,o=[],i=()=>{for(let a of n?.getTracks()??[])a.stop();n=null};return{isSupported:!0,async start(a,s){try{n=await navigator.mediaDevices.getUserMedia({audio:!0});let l=dd();t=new MediaRecorder(n,l?{mimeType:l}:void 0),o=[],t.addEventListener("dataavailable",c=>{c.data.size>0&&o.push(c.data)}),t.addEventListener("stop",async()=>{let c=t?.mimeType??"audio/webm";i();let u=new Blob(o,{type:c});o=[];try{let{text:p}=await e(u,c);p&&a(p,!0)}catch{}finally{s()}}),t.start()}catch{i(),s()}},stop(){t?.stop()}}}function dd(){for(let e of ld)if(MediaRecorder.isTypeSupported(e))return e}var me=h.cssPrefix,Ge=M.scope("composer");function at(e){return e.reduce((t,n)=>t+n.size,0)}var _d={arrowUp:Gi,paperPlane:Ki,send:Vi,chevron:bn};function ka({options:e,transport:t,feedback:n,bus:o,isStreaming:i,onSend:a,onStop:s,attachApiRef:l}){let c=e.strings,[u,p]=k(""),[d,_]=k([]),[f,v]=k(!1),m=O(null),y=O(null),b=e.features.files,S=e.features.voice,[I,L]=k(()=>zo(S,e.locale,(E,$)=>t.transcribe(E,$)));w(()=>{f||S==="disabled"||L(zo(S,e.locale,(E,$)=>t.transcribe(E,$)))},[e.locale,S,t,f]),w(()=>{let E=m.current;if(!E)return;let $=E.getRootNode(),j="activeElement"in $?$.activeElement:null;j&&E.closest(`.${me}-panel`)?.contains(j)||E.focus({preventScroll:!0})},[]),w(()=>{let E=m.current;if(E){if(u.length===0){E.style.height="";return}E.style.height="auto",E.style.height=`${Math.min(E.scrollHeight,160)}px`}},[u]);let U=O(d);U.current=d,w(()=>()=>U.current.forEach(Bo),[]),w(()=>{if(l)return l.current={attachFromDrop:E=>{let $=En(E,U.current,e.attachments);$.accepted.length!==0&&(Ge.info("attach (drop)",{count:$.accepted.length,totalBytes:at($.accepted)}),o.emit("attach",{count:$.accepted.length,totalBytes:at($.accepted)}),_(j=>[...j,...$.accepted]))}},()=>{l.current&&(l.current=null)}},[l,e.attachments]),w(()=>{let E=m.current;if(!E)return;let $=E.closest(`.${me}-panel`);if(!$)return;let j=ce=>{let D=ce.clipboardData;if(!D)return;if(b){let xe=En(D.items,U.current,e.attachments);if(xe.accepted.length>0){ce.preventDefault(),Ge.info("attach (paste)",{count:xe.accepted.length,totalBytes:at(xe.accepted)}),o.emit("attach",{count:xe.accepted.length,totalBytes:at(xe.accepted)}),_($n=>[...$n,...xe.accepted]);return}}if(ce.target===E)return;let be=D.getData("text/plain");be&&(ce.preventDefault(),p(xe=>xe+be),E.focus())};return $.addEventListener("paste",j),()=>$.removeEventListener("paste",j)},[b,e.attachments,me]);let X=()=>{let E=u.trim();!E&&d.length===0||i||(a(E,d),p(""),_([]))},_e=E=>{E.key!=="Enter"||E.shiftKey||E.isComposing||(E.preventDefault(),i?s():X())},ee=E=>{let $=E.target,j=En($.files,d,e.attachments);j.accepted.length>0&&(Ge.info("attach (file picker)",{count:j.accepted.length,totalBytes:at(j.accepted)}),o.emit("attach",{count:j.accepted.length,totalBytes:at(j.accepted)}),_(ce=>[...ce,...j.accepted])),$.value=""},J=E=>{Ge.info("removeAttachment",{id:E}),o.emit("removeAttachment",{id:E}),_($=>{let j=$.find(ce=>ce.id===E);return j&&Bo(j),$.filter(ce=>ce.id!==E)})},re=O(null),Be=()=>{if(I.isSupported){if(f){let E=re.current?Date.now()-re.current:0;Ge.info("voiceStop",{durationMs:E}),o.emit("voiceStop",{durationMs:E}),I.stop(),v(!1),n.play("voiceStop"),re.current=null;return}re.current=Date.now(),Ge.info("voiceStart"),o.emit("voiceStart",void 0),v(!0),n.play("voiceStart"),I.start((E,$)=>p(j=>$?`${j}${E} `:j),()=>{if(v(!1),re.current){let E=Date.now()-re.current;Ge.debug("voiceStop (auto)",{durationMs:E}),o.emit("voiceStop",{durationMs:E}),re.current=null}})}},je=_d[e.composer.sendButton.icon];return r("div",{class:`${me}-composer`,"data-testid":P.composer,children:[d.length>0?r("div",{class:`${me}-attachments`,children:d.map(E=>r(wa,{attachment:E,onRemove:()=>J(E.id)},E.id))}):null,r("div",{class:`${me}-composer-row`,children:[r("div",{class:`${me}-composer-actions`,children:[b?r("button",{type:"button",class:`${me}-icon-btn`,onClick:()=>y.current?.click(),"aria-label":c.attach,"data-testid":P.composerAttach,children:r(Xi,{})}):null,I.isSupported?r("button",{type:"button",class:`${me}-icon-btn`,onClick:Be,"aria-label":f?c.micStop:c.micStart,"aria-pressed":f,"data-recording":f?"true":void 0,"data-testid":P.composerVoice,children:r(ji,{})}):null]}),r("textarea",{ref:m,class:`${me}-textarea`,rows:1,value:u,placeholder:c.composerPlaceholder,onInput:E=>p(E.target.value),onKeyDown:_e,"aria-label":c.composerPlaceholder,"data-testid":P.composerInput}),i?r("button",{type:"button",class:`${me}-send`,onClick:s,"aria-label":c.stop,"data-testid":P.composerStop,children:r(qi,{})}):r("button",{type:"button",class:`${me}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:X,disabled:!u.trim()&&d.length===0,"aria-label":c.send,"data-testid":P.composerSend,children:r(je,{})})]}),r("input",{ref:y,type:"file",multiple:!0,accept:e.attachments.accept,onChange:ee,class:`${me}-sr-only`,"data-testid":P.composerFileInput})]})}var ud=h.cssPrefix;function Ea({visible:e,strings:t}){return e?r("div",{class:`${ud}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}function Cn({containerRef:e,onDrop:t}){let[n,o]=k(!1);return w(()=>{let i=e.current;if(!i)return;let a=0,s=p=>{a+=1,p.dataTransfer?.types.includes("Files")&&(p.preventDefault(),o(!0))},l=()=>{a-=1,!(a>0)&&(a=0,o(!1))},c=p=>{p.dataTransfer?.types.includes("Files")&&p.preventDefault()},u=p=>{a=0,o(!1),p.dataTransfer&&(p.preventDefault(),t(p.dataTransfer.items))};return i.addEventListener("dragenter",s),i.addEventListener("dragleave",l),i.addEventListener("dragover",c),i.addEventListener("drop",u),()=>{i.removeEventListener("dragenter",s),i.removeEventListener("dragleave",l),i.removeEventListener("dragover",c),i.removeEventListener("drop",u)}},[e,t]),{visible:n}}var Ko=1,Aa=2,Ta=4,Ia=8,Ra=16;function pd(e){switch(e){case Ko:return"href";case Aa:return"src";case Ta:return"class";case Ia:return"checked";case Ra:return"start"}}var fd=e=>{switch(e){case 1:return 3;case 2:return 4;case 3:return 5;case 4:return 6;case 5:return 7;default:return 8}},gd=fd;var Ca=24;function Vo(e){let t=new Uint32Array(Ca);return t[0]=1,{renderer:e,text:"",pending:"",tokens:t,len:0,token:1,fence_end:0,blockquote_idx:0,hr_char:"",hr_chars:0,fence_start:0,spaces:new Uint8Array(Ca),indent:"",indent_len:0,table_state:0}}function Ma(e){e.pending.length>0&&le(e,`
|
|
12
|
+
`)}function B(e){e.text.length!==0&&(console.assert(e.len>0,"Never adding text to root"),e.renderer.add_text(e.renderer.data,e.text),e.text="")}function Z(e){console.assert(e.len>0,"No nodes to end"),e.len-=1,e.token=e.tokens[e.len],e.renderer.end_token(e.renderer.data)}function W(e,t){(e.tokens[e.len]===24||e.tokens[e.len]===23)&&t!==25&&Z(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function md(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function Ve(e,t){for(e.fence_start=0;e.len>t;)Z(e)}function An(e,t){let n=0;for(let o=0;o<=e.len&&(t-=e.spaces[o],!(t<0));o+=1)switch(e.tokens[o]){case 9:case 10:case 20:case 25:n=o;break}for(;e.len>n;)Z(e);return t}function Fo(e,t){let n=-1,o=-1;for(let i=e.blockquote_idx+1;i<=e.len;i+=1)if(e.tokens[i]===25){if(e.indent_len<e.spaces[i]){o=-1;break}o=i}else e.tokens[i]===t&&(n=i);return o===-1?n===-1?(Ve(e,e.blockquote_idx),W(e,t),!0):(Ve(e,n),!1):(Ve(e,o),W(e,t),!0)}function Wo(e,t){W(e,25),e.spaces[e.len]=e.indent_len+t,Me(e),e.token=103}function Me(e){e.indent="",e.indent_len=0,e.pending=""}function Go(e){switch(e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return!0;default:return!1}}function hd(e){switch(e){case 32:case 58:case 59:case 41:case 44:case 33:case 46:case 63:case 93:case 10:return!0;default:return!1}}function vd(e){return Go(e)||hd(e)}function le(e,t){for(let n of t){if(e.token===101){switch(n){case" ":e.indent_len+=1;continue;case" ":e.indent_len+=4;continue}let i=An(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],i>0&&le(e," ".repeat(i))}let o=e.pending+n;switch(e.token){case 21:case 1:case 20:case 24:case 23:switch(console.assert(e.text.length===0,"Root should not have any text"),e.pending[0]){case void 0:e.pending=n;continue;case" ":console.assert(e.pending.length===1),e.pending=n,e.indent+=" ",e.indent_len+=1;continue;case" ":console.assert(e.pending.length===1),e.pending=n,e.indent+=" ",e.indent_len+=4;continue;case`
|
|
13
13
|
`:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){Z(e),Me(e),e.pending=n;continue}Ve(e,e.blockquote_idx),Me(e),e.blockquote_idx=0,e.fence_start=0,e.pending=n;continue;case"#":switch(n){case"#":if(e.pending.length<6){e.pending=o;continue}break;case" ":An(e,e.indent_len),W(e,gd(e.pending.length)),Me(e);continue}break;case">":{let a=md(e,20,e.blockquote_idx+1);a===-1?(Ve(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,W(e,20)):e.blockquote_idx=a,Me(e),e.pending=n;continue}case"-":case"*":case"_":if(e.hr_chars===0&&(console.assert(e.pending.length===1,"Pending should be one character"),e.hr_chars=1,e.hr_char=e.pending),e.hr_chars>0){switch(n){case e.hr_char:e.hr_chars+=1,e.pending=o;continue;case" ":e.pending=o;continue;case`
|
|
14
|
-
`:if(e.hr_chars<3)break;An(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),Me(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){Fo(e,23),Wo(e,2),
|
|
15
|
-
`:{An(e,e.indent_len),W(e,10),e.pending.length>e.fence_start&&e.renderer.set_attr(e.renderer.data,Ta,e.pending.slice(e.fence_start)),Me(e),e.token=101;continue}default:e.pending=o;continue}case"+":if(n!==" ")break;Fo(e,23),Wo(e,2);continue;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":if(e.pending[e.pending.length-1]==="."){if(n!==" ")break;Fo(e,24)&&e.pending!=="1."&&e.renderer.set_attr(e.renderer.data,Ra,e.pending.slice(0,-1)),Wo(e,e.pending.length+1);continue}else{let a=n.charCodeAt(0);if(a===46||Go(a)){e.pending=o;continue}}break;case"|":Ve(e,e.blockquote_idx),W(e,27),W(e,28),e.pending="",
|
|
16
|
-
`:e.table_state=2,e.pending="";continue;default:Z(e),e.table_state=0;break}else switch(e.pending){case"|":W(e,28),e.pending="",
|
|
17
|
-
`:Z(e),e.pending="",e.table_state=0,
|
|
18
|
-
`:Z(e),e.table_state=Math.min(e.table_state+1,2),e.pending="",
|
|
14
|
+
`:if(e.hr_chars<3)break;An(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),Me(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){Fo(e,23),Wo(e,2),le(e,o.slice(2));continue}break;case"`":if(e.pending.length<3){if(n==="`"){e.pending=o,e.fence_start=o.length;continue}e.fence_start=0;break}switch(n){case"`":e.pending.length===e.fence_start?(e.pending=o,e.fence_start=o.length):(W(e,2),Me(e),e.fence_start=0,le(e,o));continue;case`
|
|
15
|
+
`:{An(e,e.indent_len),W(e,10),e.pending.length>e.fence_start&&e.renderer.set_attr(e.renderer.data,Ta,e.pending.slice(e.fence_start)),Me(e),e.token=101;continue}default:e.pending=o;continue}case"+":if(n!==" ")break;Fo(e,23),Wo(e,2);continue;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":if(e.pending[e.pending.length-1]==="."){if(n!==" ")break;Fo(e,24)&&e.pending!=="1."&&e.renderer.set_attr(e.renderer.data,Ra,e.pending.slice(0,-1)),Wo(e,e.pending.length+1);continue}else{let a=n.charCodeAt(0);if(a===46||Go(a)){e.pending=o;continue}}break;case"|":Ve(e,e.blockquote_idx),W(e,27),W(e,28),e.pending="",le(e,n);continue}let i=o;if(e.token===21)e.token=e.tokens[e.len],e.renderer.add_token(e.renderer.data,21),e.renderer.end_token(e.renderer.data);else if(e.indent_len>=4){let a=0;for(;a<4;a+=1)if(e.indent[a]===" "){a=a+1;break}i=e.indent.slice(a)+o,W(e,9)}else W(e,2);Me(e),le(e,i);continue;case 27:if(e.table_state===1)switch(n){case"-":case" ":case"|":case":":e.pending=o;continue;case`
|
|
16
|
+
`:e.table_state=2,e.pending="";continue;default:Z(e),e.table_state=0;break}else switch(e.pending){case"|":W(e,28),e.pending="",le(e,n);continue;case`
|
|
17
|
+
`:Z(e),e.pending="",e.table_state=0,le(e,n);continue}break;case 28:switch(e.pending){case"":break;case"|":W(e,29),Z(e),e.pending="",le(e,n);continue;case`
|
|
18
|
+
`:Z(e),e.table_state=Math.min(e.table_state+1,2),e.pending="",le(e,n);continue;default:W(e,29),le(e,n);continue}break;case 29:if(e.pending==="|"){B(e),Z(e),e.pending="",le(e,n);continue}break;case 9:switch(o){case`
|
|
19
19
|
`:case`
|
|
20
20
|
`:case`
|
|
21
21
|
`:case`
|
|
@@ -28,13 +28,13 @@ ${i}`:i;continue}o.startsWith("id:")&&(n=o.slice(3).trim())}if(!t||t==="[DONE]")
|
|
|
28
28
|
`:e.pending=o;continue;default:e.pending.length!==0?(B(e),Z(e),e.pending=n):e.text+=n;continue}case 10:switch(n){case"`":e.pending=o;continue;case`
|
|
29
29
|
`:if(o.length===e.fence_start+e.fence_end+1){B(e),Z(e),e.pending="",e.fence_start=0,e.fence_end=0,e.token=101;continue}e.token=101;break;case" ":if(e.pending[0]===`
|
|
30
30
|
`){e.pending=o,e.fence_end+=1;continue}break}e.text+=e.pending,e.pending=n,e.fence_end=1;continue;case 11:switch(n){case"`":o.length===e.fence_start+ +(e.pending[0]===" ")?(B(e),Z(e),e.pending="",e.fence_start=0):e.pending=o;continue;case`
|
|
31
|
-
`:e.text+=e.pending,e.pending="",e.token=21,e.blockquote_idx=0,B(e);continue;case" ":e.text+=e.pending,e.pending=n;continue;default:e.text+=o,e.pending="";continue}case 103:switch(e.pending.length){case 0:if(n!=="[")break;e.pending=o;continue;case 1:if(n!==" "&&n!=="x")break;e.pending=o;continue;case 2:if(n!=="]")break;e.pending=o;continue;case 3:if(n!==" ")break;e.renderer.add_token(e.renderer.data,26),e.pending[1]==="x"&&e.renderer.set_attr(e.renderer.data,Ia,""),e.renderer.end_token(e.renderer.data),e.pending=" ";continue}e.token=e.tokens[e.len],e.pending="",
|
|
32
|
-
`?(B(e),W(e,30),e.pending=""):(e.token=e.tokens[e.len],e.pending[0]==="\\"?e.text+="[":e.text+="$$",e.pending="",
|
|
33
|
-
`||n==="\\"?(e.renderer.set_attr(e.renderer.data,Ko,e.pending),B(e),Z(e),e.pending=n):(e.text+=n,e.pending=o);continue;case 104:if(o.startsWith("<br")){if(o.length===3||n===" "||n==="/"&&(o.length===4||e.pending[e.pending.length-1]===" ")){e.pending=o;continue}if(n===">"){B(e),e.token=e.tokens[e.len],e.renderer.add_token(e.renderer.data,21),e.renderer.end_token(e.renderer.data),e.pending="";continue}}e.token=e.tokens[e.len],e.text+="<",e.pending=e.pending.slice(1),
|
|
31
|
+
`:e.text+=e.pending,e.pending="",e.token=21,e.blockquote_idx=0,B(e);continue;case" ":e.text+=e.pending,e.pending=n;continue;default:e.text+=o,e.pending="";continue}case 103:switch(e.pending.length){case 0:if(n!=="[")break;e.pending=o;continue;case 1:if(n!==" "&&n!=="x")break;e.pending=o;continue;case 2:if(n!=="]")break;e.pending=o;continue;case 3:if(n!==" ")break;e.renderer.add_token(e.renderer.data,26),e.pending[1]==="x"&&e.renderer.set_attr(e.renderer.data,Ia,""),e.renderer.end_token(e.renderer.data),e.pending=" ";continue}e.token=e.tokens[e.len],e.pending="",le(e,o);continue;case 14:case 15:{let a="*",s=12;if(e.token===15&&(a="_",s=13),a===e.pending){if(B(e),a===n){Z(e),e.pending="";continue}W(e,s),e.pending=n;continue}break}case 12:case 13:{let a="*",s=14;switch(e.token===13&&(a="_",s=15),e.pending){case a:a===n?e.tokens[e.len-1]===s?e.pending=o:(B(e),W(e,s),e.pending=""):(B(e),Z(e),e.pending=n);continue;case a+a:let l=e.token;B(e),Z(e),Z(e),a!==n?(W(e,l),e.pending=n):e.pending="";continue}break}case 16:if(o==="~~"){B(e),Z(e),e.pending="";continue}break;case 105:n===`
|
|
32
|
+
`?(B(e),W(e,30),e.pending=""):(e.token=e.tokens[e.len],e.pending[0]==="\\"?e.text+="[":e.text+="$$",e.pending="",le(e,n));continue;case 30:if(o==="\\]"||o==="$$"){B(e),Z(e),e.pending="";continue}break;case 31:if(o==="\\)"||e.pending[0]==="$"){B(e),Z(e),n===")"?e.pending="":e.pending=n;continue}break;case 102:o==="http://"||o==="https://"?(B(e),W(e,18),e.pending=o,e.text=o):"http:/"[e.pending.length]===n||"https:/"[e.pending.length]===n?e.pending=o:(e.token=e.tokens[e.len],le(e,n));continue;case 17:case 19:if(e.pending==="]"){B(e),n==="("?e.pending=o:(Z(e),e.pending=n);continue}if(e.pending[0]==="]"&&e.pending[1]==="("){if(n===")"){let a=e.token===17?Ko:Aa,s=e.pending.slice(2);e.renderer.set_attr(e.renderer.data,a,s),Z(e),e.pending=""}else e.pending+=n;continue}break;case 18:n===" "||n===`
|
|
33
|
+
`||n==="\\"?(e.renderer.set_attr(e.renderer.data,Ko,e.pending),B(e),Z(e),e.pending=n):(e.text+=n,e.pending=o);continue;case 104:if(o.startsWith("<br")){if(o.length===3||n===" "||n==="/"&&(o.length===4||e.pending[e.pending.length-1]===" ")){e.pending=o;continue}if(n===">"){B(e),e.token=e.tokens[e.len],e.renderer.add_token(e.renderer.data,21),e.renderer.end_token(e.renderer.data),e.pending="";continue}}e.token=e.tokens[e.len],e.text+="<",e.pending=e.pending.slice(1),le(e,n);continue}switch(e.pending[0]){case"\\":if(e.token===19||e.token===30||e.token===31)break;switch(n){case"(":B(e),W(e,31),e.pending="";continue;case"[":e.token=105,e.pending=o;continue;case`
|
|
34
34
|
`:e.pending=n;continue;default:let i=n.charCodeAt(0);e.pending="",e.text+=Go(i)||i>=65&&i<=90||i>=97&&i<=122?o:n;continue}case`
|
|
35
35
|
`:switch(e.token){case 19:case 30:case 31:break;case 3:case 4:case 5:case 6:case 7:case 8:B(e),Ve(e,e.blockquote_idx),e.blockquote_idx=0,e.pending=n;continue;default:B(e),e.pending=n,e.token=21,e.blockquote_idx=0;continue}break;case"<":if(e.token!==19&&e.token!==30&&e.token!==31){B(e),e.pending=o,e.token=104;continue}break;case"`":if(e.token===19)break;n==="`"?(e.fence_start+=1,e.pending=o):(e.fence_start+=1,B(e),W(e,11),e.text=n===" "||n===`
|
|
36
36
|
`?"":n,e.pending="");continue;case"_":case"*":{if(e.token===19||e.token===30||e.token===31||e.token===14)break;let i=12,a=14,s=e.pending[0];if(s==="_"&&(i=13,a=15),e.pending.length===1){if(s===n){e.pending=o;continue}if(n!==" "&&n!==`
|
|
37
37
|
`){B(e),W(e,i),e.pending=n;continue}}else{if(s===n){B(e),W(e,a),W(e,i),e.pending="";continue}if(n!==" "&&n!==`
|
|
38
38
|
`){B(e),W(e,a),e.pending=n;continue}}break}case"~":if(e.token!==19&&e.token!==16){if(e.pending==="~"){if(n==="~"){e.pending=o;continue}}else if(n!==" "&&n!==`
|
|
39
|
-
`){B(e),W(e,16),e.pending=n;continue}}break;case"$":if(e.token!==19&&e.token!==16&&e.pending==="$")if(n==="$"){e.token=105,e.pending=o;continue}else{if(vd(n.charCodeAt(0)))break;B(e),W(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){B(e),W(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){B(e),W(e,19),e.pending="";continue}break;case" ":if(e.pending.length===1&&n===" ")continue;break}if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n==="h"&&(e.pending===" "||e.pending==="")){e.text+=e.pending,e.pending=n,e.token=102;continue}e.text+=e.pending,e.pending=n}B(e)}function qo(e){return{add_token:bd,end_token:xd,add_text:yd,set_attr:Pd,data:{nodes:[e,,,,,],index:0}}}function bd(e,t){let n=e.nodes[e.index],o;switch(t){case 1:return;case 20:o=document.createElement("blockquote");break;case 2:o=document.createElement("p");break;case 21:o=document.createElement("br");break;case 22:o=document.createElement("hr");break;case 3:o=document.createElement("h1");break;case 4:o=document.createElement("h2");break;case 5:o=document.createElement("h3");break;case 6:o=document.createElement("h4");break;case 7:o=document.createElement("h5");break;case 8:o=document.createElement("h6");break;case 12:case 13:o=document.createElement("em");break;case 14:case 15:o=document.createElement("strong");break;case 16:o=document.createElement("s");break;case 11:o=document.createElement("code");break;case 18:case 17:o=document.createElement("a");break;case 19:o=document.createElement("img");break;case 23:o=document.createElement("ul");break;case 24:o=document.createElement("ol");break;case 25:o=document.createElement("li");break;case 26:let i=o=document.createElement("input");i.type="checkbox",i.disabled=!0;break;case 9:case 10:n=n.appendChild(document.createElement("pre")),o=document.createElement("code");break;case 27:o=document.createElement("table");break;case 28:switch(n.children.length){case 0:n=n.appendChild(document.createElement("thead"));break;case 1:n=n.appendChild(document.createElement("tbody"));break;default:n=n.children[1]}o=document.createElement("tr");break;case 29:o=document.createElement(n.parentElement?.tagName==="THEAD"?"th":"td");break;case 30:o=document.createElement("equation-block");break;case 31:o=document.createElement("equation-inline");break}e.nodes[++e.index]=n.appendChild(o)}function xd(e){e.index-=1}function yd(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function Pd(e,t,n){e.nodes[e.index].setAttribute(pd(t),n)}function Tn({textSig:e,doneSig:t}){let n=O(null);return w(()=>{let o=n.current;if(!o)return;o.classList.add(`${h.cssPrefix}-md`);let i=qo(o),a=Vo(i),s=0,l=Re(()=>{let p=e.value,d=t.value;p.length<s&&(o.replaceChildren(),i=qo(o),a=Vo(i),s=0);let _=p.slice(s);_&&se(a,_),s=p.length,d&&Ma(a)}),c=new MutationObserver(p=>{for(let d of p)for(let _ of d.addedNodes){if(!(_ instanceof HTMLElement))continue;let f=_.matches?.("a")?[_]:[..._.querySelectorAll?.("a")??[]];for(let v of f)La(v)}});c.observe(o,{childList:!0,subtree:!0});for(let p of o.querySelectorAll("a"))La(p);let u=p=>{let d=p.target?.closest?.("a");if(!d||!(d instanceof HTMLAnchorElement))return;let _=d.getAttribute("href")??"";!_||_.startsWith("#")||(p.preventDefault(),window.open(_,"_blank","noopener,noreferrer"))};return o.addEventListener("click",u),()=>{l(),c.disconnect(),o.removeEventListener("click",u)}},[e,t]),r("div",{ref:n})}function Na({text:e}){let t=ge(()=>N(e),[e]),n=ge(()=>N(!0),[]);return r(Tn,{textSig:t,doneSig:n})}function La(e){let t=e.getAttribute("href")??"";if(!t||t.startsWith("#"))return;e.target!=="_blank"&&(e.target="_blank");let n=new Set((e.rel||"").split(/\s+/).filter(Boolean));n.add("noopener"),n.add("noreferrer"),e.rel=[...n].join(" ")}function Oa({part:e,strings:t}){let n=h.cssPrefix;return r("span",{class:`${n}-tool-chip`,role:"status",children:[r("span",{children:[t.usedTool,":"]}),r("strong",{children:e.toolName})]})}var Se=h.cssPrefix;function Da({message:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:i}){let s=we(()=>e.partsSig.value).value,l=we(()=>e.partsSig.value.some(f=>f.kind==="text"&&f.textSig.value.length>0)),c=we(()=>o&&e.partsSig.value.some(f=>f.kind==="reasoning")),u=e.role==="assistant"&&e.status==="streaming",p=n==="buffered"&&u,d=u&&!l.value,_=!p&&d&&!c.value;return r("div",{class:`${Se}-bubble-row`,"data-role":e.role,"data-testid":ce(P.messageBubble,e.id),children:r("div",{class:`${Se}-bubble`,children:[p?r(Ad,{label:t.loading}):s.map(f=>r(wd,{part:f,active:d,strings:t,showReasoning:o,showToolCalls:i},Ed(f))),_&&r(Cd,{}),e.status==="error"&&e.errorText?r("div",{class:`${Se}-error`,role:"alert",children:r("span",{children:e.errorText})}):null]})})}function wd({part:e,active:t,strings:n,showReasoning:o,showToolCalls:i}){switch(e.kind){case"text":return r(Tn,{textSig:e.textSig,doneSig:e.doneSig});case"reasoning":return o?r(kd,{part:e,active:t,strings:n}):null;case"tool":return i?r(Oa,{part:e,strings:n}):null;case"file":return e.mediaType.startsWith("image/")?r("img",{src:e.url,alt:"",loading:"lazy"}):r("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",children:e.url});case"source":return null}}function kd({part:e,active:t,strings:n}){return r("details",{class:`${Se}-reasoning`,open:t,"data-active":t?"true":void 0,children:[r("summary",{class:`${Se}-reasoning-summary`,children:r("span",{class:`${Se}-reasoning-label`,children:t?n.thinking:n.thoughts})}),r("div",{class:`${Se}-reasoning-body`,children:r(Tn,{textSig:e.textSig,doneSig:e.doneSig})})]})}function Ed(e){switch(e.kind){case"text":case"reasoning":return`${e.kind}:${e.id}`;case"tool":return`tool:${e.toolCallId}`;case"file":return`file:${e.url}`;case"source":return`source:${e.sourceId}`}}function Cd(){return r("span",{class:`${Se}-typing`,"aria-hidden":"true",children:[r("span",{}),r("span",{}),r("span",{})]})}function Ad({label:e}){return r("span",{class:`${Se}-loading`,role:"status",children:[r("span",{class:`${Se}-loading-spinner`,"aria-hidden":"true"}),r("span",{class:`${Se}-loading-label`,children:e})]})}var Ha=h.cssPrefix,Xo=120;function $a({messagesSig:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:i,loading:a}){let s=O(null),l=we(()=>e.value),c=O(!1),u=l.value[0]?.id;return Br(()=>{let p=s.current;if(!p||l.value.length===0)return;c.current=!0;let d=()=>{p.scrollTop=p.scrollHeight};d();let _=new ResizeObserver(d);_.observe(p);let f=new MutationObserver(d);f.observe(p,{childList:!0,subtree:!0,characterData:!0});let v=setTimeout(()=>{_.disconnect(),f.disconnect()},300);return()=>{_.disconnect(),f.disconnect(),clearTimeout(v)}},[u]),w(()=>{let p=s.current;if(!p||!c.current)return;p.scrollHeight-p.scrollTop-p.clientHeight<Xo&&(p.scrollTop=p.scrollHeight)},[l.value.length]),w(()=>{let p=s.current;if(!p)return;let d=l.value.at(-1);if(!d)return;if(d.status!=="streaming"){let f=requestAnimationFrame(()=>{p.scrollHeight-p.scrollTop-p.clientHeight<Xo*2&&(p.scrollTop=p.scrollHeight)});return()=>cancelAnimationFrame(f)}let _=setInterval(()=>{p.scrollHeight-p.scrollTop-p.clientHeight<Xo*2&&(p.scrollTop=p.scrollHeight)},250);return()=>clearInterval(_)},[l.value]),r("div",{ref:s,class:`${Ha}-list`,role:"log","aria-live":"polite","aria-relevant":"additions text",children:[a&&l.value.length===0?r("div",{class:`${Ha}-list-loading`,role:"status",children:t.messagesLoading}):null,l.value.map(p=>r(Da,{message:p,strings:t,responseMode:n,showReasoning:o,showToolCalls:i},p.id))]})}function st({itemCount:e,initialFocusIndex:t}){let[n,o]=k(!1),i=O(null),a=O(null),[s,l]=k(-1),c=R(()=>{o(!1),l(-1),i.current?.focus()},[]),u=R(()=>o(_=>!_),[]);w(()=>{if(!n)return;let _=f=>{let v=a.current,m=i.current;if(!v||!m)return;let y=f.composedPath();y.includes(v)||y.includes(m)||(o(!1),l(-1))};return document.addEventListener("click",_,!0),()=>document.removeEventListener("click",_,!0)},[n]),w(()=>{if(!n||e===0)return;let _=t?.()??0,f=_<0||_>=e?0:_;l(f)},[n,e,t]),w(()=>{if(!n||s<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[s]?.focus()},[n,s]);let p=R(_=>{(_.key==="ArrowDown"||_.key==="Enter"||_.key===" ")&&(_.preventDefault(),o(!0))},[]),d=R(_=>{if(e!==0)switch(_.key){case"Escape":_.preventDefault(),c();return;case"ArrowDown":_.preventDefault(),l(f=>(f+1)%e);return;case"ArrowUp":_.preventDefault(),l(f=>(f-1+e)%e);return;case"Home":_.preventDefault(),l(0);return;case"End":_.preventDefault(),l(e-1)}},[e,c]);return{open:n,focusIndex:s,triggerRef:i,menuRef:a,toggle:u,close:c,onTriggerKey:p,onMenuKey:d}}function Ba({items:e,triggerLabel:t}){let n=h.cssPrefix,o=st({itemCount:e.length}),i=a=>{a.disabled||(a.onSelect(),o.close())};return r("div",{class:`${n}-menu-wrap`,children:[r("button",{ref:o.triggerRef,type:"button",class:`${n}-icon-btn`,"aria-label":t,"aria-haspopup":"menu","aria-expanded":o.open,title:t,onClick:o.toggle,onKeyDown:o.onTriggerKey,children:r(ta,{})}),o.open?r("div",{ref:o.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:o.onMenuKey,tabIndex:-1,children:e.map(a=>r("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":a.type==="switch"?a.on:void 0,disabled:a.disabled,lang:a.lang,onClick:()=>i(a),children:[a.icon?r("span",{class:`${n}-menu-icon`,children:a.icon}):null,r("span",{class:`${n}-menu-label`,children:a.label}),a.type==="switch"&&a.on?r("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:r(it,{})}):null]},a.id))}):null]})}var Td=["today","yesterday","lastWeek","older"];function Id(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let o=Math.floor((Ua(e)-Ua(n))/(1440*60*1e3));return o<=0?"today":o===1?"yesterday":o<7?"lastWeek":"older"}function za(e,t){let n=new Map;for(let o of t){let i=Id(e,o.lastMessageAt),a=n.get(i);a?a.push(o):n.set(i,[o])}return Td.filter(o=>n.has(o)).map(o=>({bucket:o,sessions:n.get(o)}))}function Ua(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var Rd=M.scope("history"),Md={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function In({transport:e,strings:t,visitorId:n,onSelect:o,onNewChat:i}){let a=h.cssPrefix,[s,l]=k("loading"),[c,u]=k([]);w(()=>{let _=!1;return e.listSessions({visitorId:n}).then(f=>{_||(u(f.sessions??[]),l("loaded"))}).catch(f=>{_||(Rd.warn("listSessions failed",{err:f}),l("error"))}),()=>{_=!0}},[e,n]);let p=i?r("div",{class:`${a}-history-footer`,children:r("button",{type:"button",class:`${a}-history-new`,onClick:i,"data-testid":P.sidebarNewChat,children:[r(Wi,{}),t.historyNewChat]})}):null;if(s==="loading")return r(te,{children:[r("div",{class:`${a}-history-empty`,children:t.historyLoading}),p]});if(s==="error"||c.length===0)return r(te,{children:[r("div",{class:`${a}-history-empty`,children:t.historyEmpty}),p]});let d=za(Date.now(),c);return r(te,{children:[r("div",{class:`${a}-history`,role:"list",children:d.map(_=>r("div",{class:`${a}-history-group`,children:[r("div",{class:`${a}-history-heading`,children:t[Md[_.bucket]]}),_.sessions.map(f=>r("button",{type:"button",role:"listitem",class:`${a}-history-item`,onClick:()=>o(f),"data-closed":f.canContinue?void 0:"true","data-testid":ce(P.historyItem,f.sessionId),children:[r("span",{class:`${a}-history-title`,children:f.title}),f.preview?r("span",{class:`${a}-history-preview`,children:f.preview}):null]},f.sessionId))]},_.bucket))}),p]})}function Fa(e){return r(In,{...e})}function Wa({available:e,active:t,onSelect:n,triggerLabel:o}){let i=h.cssPrefix,a=R(()=>e.indexOf(t),[e,t]),s=st({itemCount:e.length,initialFocusIndex:a}),l=c=>{n(c),s.close()};return r("div",{class:`${i}-menu-wrap`,children:[r("button",{ref:s.triggerRef,type:"button",class:`${i}-icon-btn`,"aria-label":o,"aria-haspopup":"menu","aria-expanded":s.open,title:o,onClick:s.toggle,onKeyDown:s.onTriggerKey,children:r(ia,{})}),s.open?r("div",{ref:s.menuRef,class:`${i}-menu`,role:"menu","aria-label":o,onKeyDown:s.onMenuKey,tabIndex:-1,children:e.map(c=>{let u=c===t;return r("button",{type:"button",role:"menuitem",class:`${i}-menu-item`,lang:c,"aria-current":u?"true":void 0,onClick:()=>l(c),children:[r("span",{class:`${i}-menu-label`,children:Jr(c,t)}),u?r("span",{class:`${i}-menu-check`,"aria-hidden":"true",children:r(it,{})}):null]},c)})}):null]})}var jo=["auto","light","dark"];function Ka(e){switch(e){case"light":return r(ua,{});case"dark":return r(pa,{});case"auto":return r(fa,{})}}function Yo({active:e,onSelect:t,triggerLabel:n,optionLabels:o}){let i=h.cssPrefix,a=R(()=>jo.indexOf(e),[e]),s=st({itemCount:jo.length,initialFocusIndex:a}),l=c=>{t(c),s.close()};return r("div",{class:`${i}-menu-wrap`,children:[r("button",{ref:s.triggerRef,type:"button",class:`${i}-icon-btn`,"aria-label":n,"aria-haspopup":"menu","aria-expanded":s.open,title:n,"data-theme-active":e,onClick:s.toggle,onKeyDown:s.onTriggerKey,children:Ka(e)}),s.open?r("div",{ref:s.menuRef,class:`${i}-menu`,role:"menu","aria-label":n,onKeyDown:s.onMenuKey,tabIndex:-1,children:jo.map(c=>{let u=c===e;return r("button",{type:"button",role:"menuitem",class:`${i}-menu-item`,"aria-current":u?"true":void 0,onClick:()=>l(c),children:[r("span",{class:`${i}-menu-icon`,children:Ka(c)}),r("span",{class:`${i}-menu-label`,children:o[c]}),u?r("span",{class:`${i}-menu-check`,"aria-hidden":"true",children:r(it,{})}):null]},c)})}):null]})}var Ga=h.cssPrefix;function Va({suggestions:e,onPick:t}){return e.length===0?null:r("div",{class:`${Ga}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((n,o)=>r("button",{type:"button",class:`${Ga}-suggestion`,onClick:()=>t(n),"data-testid":ce(P.suggestion,o),children:n.label},n.id))})}var ue=h.cssPrefix;function qa(e){let{options:t,onClose:n}=e,o=t.strings,i=O(null);w(()=>{let c=i.current;if(!c)return;let u=wn(c),p=d=>{d.key==="Escape"&&n?.()};return c.addEventListener("keydown",p),()=>{u(),c.removeEventListener("keydown",p)}},[n]);let a=O(null),s=R(c=>{a.current?.attachFromDrop(c)},[]),{visible:l}=Cn({containerRef:i,onDrop:s});return Pn(i.current,t.mode==="modal"),r("div",{ref:i,class:`${ue}-panel`,role:"dialog","aria-modal":"false","aria-label":o.panelTitle,style:{position:"relative"},"data-testid":P.panel,children:[r(Jo,{...e,containerEl:i.current,dragOver:l,composerAttachApiRef:a}),r(Qo,{poweredBy:e.options.poweredBy})]})}function Jo({options:e,transport:t,feedback:n,bus:o,panelSize:i,view:a,canSend:s,isStreaming:l,loadingMessages:c,messagesSig:u,agent:p,suggestions:d,initialWidgetSize:_,visitorId:f,onClose:v,onBack:m,onClear:y,onExpand:b,onFullscreen:S,onPopOut:I,onSoundToggle:L,onToggleHistory:U,onSelectHistoryChat:X,onNewChat:de,onLocaleChange:ee,onThemeChange:J,onWidgetSizeChange:re,onSend:Be,onStop:je,onSuggestion:E,containerEl:$,dragOver:j,composerAttachApiRef:le}){let D=e.strings;return r(te,{children:[a==="history"?r(Ld,{strings:D,onBack:U,onClose:v,showClose:xa(e.mode,i,e.actions)}):r(Hd,{agent:p,onBack:m,backLabel:D.moduleBack,moreActionsLabel:D.moreActions,languageLabel:D.language,themeLabel:D.theme,themeOptionLabels:{auto:D.themeAuto,light:D.themeLight,dark:D.themeDark},activeThemeMode:e.themeMode,onThemeChange:J,panelTitle:D.panelTitle,activeLocale:e.locale,availableLocales:e.availableLocales,onLocaleChange:ee,main:Ho(e.actions.main,e.mode,i,{popOutUrl:e.popOutUrl}),overflow:Ho(e.actions.overflow,e.mode,i,{popOutUrl:e.popOutUrl}),descriptors:$d({strings:D,panelSize:i,feedback:n,onClear:y,onExpand:b,onFullscreen:S,onPopOut:I,onSoundToggle:L,onToggleHistory:U,onClose:v})}),a==="history"?r(Fa,{transport:t,strings:D,visitorId:f,onSelect:be=>X(be.sessionId),onNewChat:de}):r(te,{children:[r(Ea,{visible:j,strings:D}),r($a,{messagesSig:u,strings:D,responseMode:e.responseMode,showReasoning:e.showReasoning,showToolCalls:e.showToolCalls,loading:c}),s?r(te,{children:[r(Va,{suggestions:d,onPick:E}),r(ka,{options:e,transport:t,feedback:n,bus:o,isStreaming:l,onSend:Be,onStop:je,attachApiRef:le})]}):r(Nd,{label:D.chatClosed,ctaLabel:D.startNewConversation,onNewChat:y}),r(Od,{disclaimer:e.composerDisclaimer})]}),e.size.resize?.enabled?r(yn,{panelEl:$,resize:e.size.resize,position:e.position,initialSize:_,onSizeChange:re,strings:D}):null]})}function Ld({strings:e,onBack:t,onClose:n,showClose:o}){return r("header",{class:`${ue}-header`,children:[r("button",{type:"button",class:`${ue}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:r(wt,{})}),r("h1",{children:e.historyTitle}),o?r("button",{type:"button",class:`${ue}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:r(fe,{})}):null]})}function Nd({label:e,ctaLabel:t,onNewChat:n}){return r("div",{class:`${ue}-readonly-banner`,role:"note",children:[r("span",{class:`${ue}-readonly-label`,children:e}),r("button",{type:"button",class:`${ue}-readonly-cta`,onClick:n,children:t})]})}function Od({disclaimer:e}){return e?r("div",{class:`${ue}-composer-footer`,children:r("div",{class:`${ue}-disclaimer`,children:e})}):null}function Qo({poweredBy:e}){return e?r("div",{class:`${ue}-poweredby-bar`,children:r(Dd,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function Dd({logoUrl:e,text:t,href:n}){let o=r(te,{children:[e?r("img",{class:`${ue}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?r("span",{children:t}):null]});return n?r("a",{class:`${ue}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:o}):r("span",{class:`${ue}-poweredby`,children:o})}function Hd({agent:e,onBack:t,backLabel:n,moreActionsLabel:o,languageLabel:i,themeLabel:a,themeOptionLabels:s,activeThemeMode:l,onThemeChange:c,panelTitle:u,activeLocale:p,availableLocales:d,onLocaleChange:_,main:f,overflow:v,descriptors:m}){let y=d.length>1,b=[];for(let I of v){if(I==="theme")continue;if(I==="language"){if(!y)continue;for(let U of d)b.push({id:`language:${U}`,label:i+` \u2014 ${U}`,lang:U,onSelect:()=>_(U),type:"switch",on:U===p});continue}let L=m[I];b.push({id:I,icon:L.icon,label:L.label,onSelect:L.onSelect,type:L.switchable?"switch":"button",on:L.switchOn})}let S=v.includes("theme");return r("header",{class:`${ue}-header`,"data-testid":P.panelHeader,children:[t?r("button",{type:"button",class:`${ue}-icon-btn`,onClick:t,"aria-label":n,title:n,children:r(wt,{})}):null,e?r(Pa,{agent:e}):r("h1",{children:u}),f.map(I=>{if(I==="language")return y?r(Wa,{available:d,active:p,onSelect:_,triggerLabel:i},"language"):null;if(I==="theme")return r(Yo,{active:l,onSelect:c,triggerLabel:a,optionLabels:s},"theme");let L=m[I];return r("button",{type:"button",class:`${ue}-icon-btn`,onClick:L.onSelect,"aria-label":L.label,"aria-pressed":L.switchable?L.switchOn:void 0,title:L.label,"data-testid":ma[I],children:L.icon},I)}),S?r(Yo,{active:l,onSelect:c,triggerLabel:a,optionLabels:s}):null,b.length>0?r(Ba,{items:b,triggerLabel:o}):null]})}function $d(e){let{strings:t,panelSize:n,feedback:o,onClear:i,onExpand:a,onFullscreen:s,onPopOut:l,onSoundToggle:c,onToggleHistory:u,onClose:p}=e,d=n==="expanded",_=n==="fullscreen",f=we(()=>o.mutedSig.value).value;return{clear:{icon:r(sa,{}),label:t.newConversation,onSelect:i},expand:{icon:d?r(Ji,{}):r(Yi,{}),label:d?t.collapse:t.expand,onSelect:a,switchable:!0,switchOn:d},fullscreen:{icon:_?r(Zi,{}):r(Qi,{}),label:_?t.exitFullscreen:t.fullscreen,onSelect:s,switchable:!0,switchOn:_},popOut:{icon:r(aa,{}),label:t.popOut,onSelect:l},sound:{icon:f?r(oa,{}):r(na,{}),label:f?t.soundOff:t.soundOn,onSelect:c,switchable:!0,switchOn:!f},history:{icon:r(ra,{}),label:t.history,onSelect:u},close:{icon:r(fe,{}),label:t.close,onSelect:p??(()=>{})}}}function Xa(e){let t=h.cssPrefix,{site:n,blocks:o,strings:i,collapsed:a}=e,s=o?.navigation??[],l=o?.linkCards??[],c=a?i.expandSidebar:i.collapseSidebar;return r("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":P.sidebar,children:[r("div",{class:`${t}-sidebar-header`,children:[r(Bd,{site:n}),r("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":P.sidebarToggle,children:r(Ud,{collapsed:a})})]}),a?null:r(te,{children:[s.length>0?r("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:r(zd,{items:s})}):null,l.length>0?r("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:r(Fd,{items:l})}):null,e.showConversations?r("div",{class:`${t}-sidebar-conversations`,children:r(In,{transport:e.transport,strings:e.strings,visitorId:e.visitorId,onSelect:e.onSelectChat,onNewChat:e.onNewChat})}):null]})]})}function Bd({site:e}){let t=h.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return r("picture",{children:[e.logoDark?.url?r("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,r("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return r("div",{class:`${t}-sidebar-title`,children:e?.title??h.name})}function Ud({collapsed:e}){return r("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?r("polyline",{points:"9 6 15 12 9 18"}):r("polyline",{points:"15 6 9 12 15 18"})})}function zd({items:e}){let t=h.cssPrefix;return r("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>r("li",{children:r("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?r("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,r("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function Fd({items:e}){let t=h.cssPrefix;return r("div",{class:`${t}-sidebar-cards`,children:e.map(n=>r("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[r("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?r("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var ja=h.cssPrefix;function Ya(e){return r("main",{class:`${ja}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[r(Xa,{site:e.site,blocks:e.blocks,transport:e.transport,strings:e.strings,visitorId:e.visitorId,showConversations:e.showConversations,onSelectChat:e.onSelectChat,onNewChat:e.onNewChat,collapsed:e.sidebarCollapsed,onToggleCollapsed:e.onToggleSidebarCollapsed}),r("section",{class:`${ja}-page-chat`,"aria-label":"Chat",children:e.children})]})}var Ja=e=>Object.fromEntries(e.map(t=>[t,[]]));function Qa(e,t,n){let o=N({activeTab:e,stacks:Ja(t)});return{sig:o,switchTab(i){o.value.activeTab!==i&&(o.value={...o.value,activeTab:i},n?.(i))},push(i){let a=o.value,s=a.stacks[a.activeTab]??[];o.value={...a,stacks:{...a.stacks,[a.activeTab]:[...s,i]}}},pop(){let i=o.value,a=i.stacks[i.activeTab]??[];a.length!==0&&(o.value={...i,stacks:{...i.stacks,[i.activeTab]:a.slice(0,-1)}})},reset(i){o.value={activeTab:i,stacks:Ja(t)}}}}var Za=e=>e.stacks[e.activeTab]??[],es=e=>Za(e).at(-1),ts=e=>Za(e).length===0;var ns={Icon:kt};var Ce=h.cssPrefix;function Rn({title:e,onClose:t,closeLabel:n}){return r("header",{class:`${Ce}-back-header`,"data-variant":"title",children:[r("span",{class:`${Ce}-back-spacer`,"aria-hidden":"true"}),r("h1",{class:`${Ce}-back-title`,children:e}),t?r("button",{type:"button",class:`${Ce}-icon-btn`,onClick:t,"aria-label":n,title:n,children:r(fe,{})}):r("span",{class:`${Ce}-back-spacer`,"aria-hidden":"true"})]})}function Mn({title:e,backLabel:t,onBack:n,onClose:o,closeLabel:i,testid:a}){return r("header",{class:`${Ce}-back-header`,"data-testid":a,children:[r("button",{type:"button",class:`${Ce}-icon-btn`,onClick:n,"aria-label":t,title:t,children:r(wt,{})}),r("h1",{class:`${Ce}-back-title`,children:e}),o?r("button",{type:"button",class:`${Ce}-icon-btn`,onClick:o,"aria-label":i,title:i,children:r(fe,{})}):r("span",{class:`${Ce}-back-spacer`,"aria-hidden":"true"})]})}var lt=h.cssPrefix;function os({placeholder:e,onActivate:t}){return r("button",{type:"button",class:`${lt}-home-search`,onClick:t,"data-testid":P.homeSearch,children:[r("span",{class:`${lt}-home-search-text`,children:e}),r("span",{class:`${lt}-home-search-icon`,"aria-hidden":"true",children:r(Do,{})})]})}function rs({placeholder:e,value:t,onInput:n}){return r("div",{class:`${lt}-home-search`,"data-input":"true",children:[r("input",{type:"search",class:`${lt}-home-search-input`,placeholder:e,value:t,onInput:o=>n(o.currentTarget.value),"data-testid":P.helpSearch}),r("span",{class:`${lt}-home-search-icon`,"aria-hidden":"true",children:r(Do,{})})]})}var Ct=h.cssPrefix;function Ln({title:e,subtitle:t,onClick:n,testid:o}){return r("button",{type:"button",class:`${Ct}-list-row`,onClick:n,"data-testid":o,children:[r("span",{class:`${Ct}-list-row-body`,children:[r("span",{class:`${Ct}-list-row-title`,children:e}),t?r("span",{class:`${Ct}-list-row-sub`,children:t}):null]}),r("span",{class:`${Ct}-list-row-chevron`,"aria-hidden":"true",children:r(bn,{})})]})}var is=h.cssPrefix;function ve({tone:e="info",message:t,onRetry:n,strings:o}){return r("div",{class:`${is}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[r("span",{children:t}),n?r("button",{type:"button",class:`${is}-module-retry`,onClick:n,children:o.errorRetry}):null]})}var qe=h.cssPrefix,Wd=M.scope("help"),Kd=(e,t)=>t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title});function Gd(e){let t=new Map;for(let n of e){let o=n.categories?.[0]??"";(t.get(o)??t.set(o,[]).get(o)).push(n)}return[...t.entries()]}function as(e,t){let n=t.toLowerCase(),o=n.indexOf(e);if(o!==-1)return 100-Math.min(o,99);let i=0;for(let a of e){if(i=n.indexOf(a,i),i===-1)return 0;i+=1}return 1}function Vd(e,t){let n=t.toLowerCase().trim();return n?e.map(o=>({item:o,score:Math.max(as(n,o.title)*2,as(n,o.description??""))})).filter(o=>o.score>0).toSorted((o,i)=>i.score-o.score).map(o=>o.item):[]}function ss({article:e,nav:t}){return r(Ln,{title:e.title,subtitle:e.description,onClick:()=>Kd(t,e),testid:ce(P.helpArticle,e.id)})}function qd({transport:e,strings:t,config:n,nav:o,panelProps:i}){let a=n.contentTags,[s,l]=k("loading"),[c,u]=k(t.errorGeneric),[p,d]=k([]),[_,f]=k(""),[v,m]=k(0);w(()=>{let S=!1;return l("loading"),e.listContent({tags:a,sortBy:"order",limit:100}).then(I=>{S||(d(I.items??[]),l("loaded"))}).catch(I=>{S||(Wd.warn("listContent (help) failed",{err:I}),u(We(I,t)),l("error"))}),()=>{S=!0}},[e,a,v]);let y=ge(()=>Vd(p,_),[p,_]);function b(){return _.trim().length>0?y.length===0?r(ve,{message:t.helpSearchEmpty,strings:t}):r("div",{class:`${qe}-help-card`,children:y.map(S=>r(ss,{article:S,nav:o},S.id))}):s==="loading"?r(ve,{message:t.helpLoading,strings:t}):s==="error"?r(ve,{tone:"error",message:c,onRetry:()=>m(S=>S+1),strings:t}):p.length===0?r(ve,{message:t.helpEmpty,strings:t}):Gd(p).map(([S,I])=>r("section",{class:`${qe}-help-group`,children:[S?r("h2",{class:`${qe}-help-section-title`,children:S}):null,r("div",{class:`${qe}-help-card`,children:I.map(L=>r(ss,{article:L,nav:o},L.id))})]},S))}return r("div",{class:`${qe}-module`,children:[r(Rn,{title:t.helpTitle,onClose:i.onClose,closeLabel:t.close}),r("div",{class:`${qe}-module-pad`,children:r(rs,{placeholder:t.helpSearchPlaceholder,value:_,onInput:f})}),r("div",{class:`${qe}-help-list`,children:b()})]})}var ls={Icon:Oo,Root:e=>r(qd,{...e})};var cs=h.cssPrefix;function Zo({onClick:e,children:t,testid:n}){return e?r("button",{type:"button",class:`${cs}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):r("div",{class:`${cs}-home-card`,"data-testid":n,children:t})}var V=h.cssPrefix,ds=M.scope("home");function Xd(e){let t=e.options.userContext?.name,n=e.config.greetingText;return n?{title:t?n.replace("{name}",t):n.replace(/\s*\{name\}\s*/," ").trim(),subtitle:e.strings.homeGreetingLead}:t?{title:e.strings.homeGreetingNamed.replace("{name}",t),subtitle:e.strings.homeGreetingLead}:{title:e.strings.homeGreeting}}var jd=(e,t)=>t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title});function Yd(e){let{transport:t,strings:n,config:o,nav:i,panelProps:a}=e,[s,l]=k(null),[c,u]=k([]),p=o.contentTags?.join(",");w(()=>{if(!o.showRecentMessages)return;let m=!1;return t.listSessions({limit:1}).then(y=>!m&&l(y.sessions?.[0]??null)).catch(y=>!m&&ds.warn("listSessions (home) failed",{err:y})),()=>{m=!0}},[t,o.showRecentMessages]),w(()=>{if(!o.contentTags?.length)return;let m=!1;return t.listContent({tags:o.contentTags,limit:6}).then(y=>!m&&u(y.items??[])).catch(y=>!m&&ds.warn("listContent (home) failed",{err:y})),()=>{m=!0}},[t,p]);let d=Xd(e),_=o.userAvatars??[],f=o.status,v=o.contentBlockTitle?tn(n,o.contentBlockTitle):n.homeContentTitle;return r("div",{class:`${V}-module ${V}-home`,"data-testid":P.homeView,children:r("div",{class:`${V}-home-scroll`,children:[r("div",{class:`${V}-home-hero`,children:[r("div",{class:`${V}-home-hero-top`,children:[o.brandName?r("span",{class:`${V}-home-brand`,"data-testid":P.homeBrand,children:o.brandName}):r("span",{class:`${V}-home-brand-spacer`,"aria-hidden":"true"}),r("div",{class:`${V}-home-hero-actions`,children:[_.length>0?r("div",{class:`${V}-home-avatars`,children:_.map(m=>r("span",{class:`${V}-home-avatar`,title:m.role?`${m.name} \xB7 ${m.role}`:m.name,children:m.avatar?r("img",{src:m.avatar,alt:"",loading:"lazy"}):r("span",{children:kn(m.name)})},m.name))}):null,a.onClose?r("button",{type:"button",class:`${V}-icon-btn ${V}-home-close`,onClick:a.onClose,"aria-label":n.close,title:n.close,children:r(fe,{})}):null]})]}),o.showGreeting!==!1?r(te,{children:[r("h1",{class:`${V}-home-greeting`,"data-testid":P.homeGreeting,children:d.title}),d.subtitle?r("p",{class:`${V}-home-lead`,children:d.subtitle}):null]}):null]}),r("div",{class:`${V}-home-cards`,children:[o.showSearchBar!==!1?r(os,{placeholder:n.homeSearchPlaceholder,onActivate:()=>i.switchToLayout("help")}):null,s?r(Zo,{onClick:()=>i.selectSession(s.sessionId),testid:P.homeRecent,children:r("div",{class:`${V}-home-recent-row`,"data-unread":(s.unreadCount??0)>0?"true":void 0,children:[r("span",{class:`${V}-home-recent-avatar`,"aria-hidden":"true",children:r(kt,{})}),r("span",{class:`${V}-home-recent-body`,children:[r("span",{class:`${V}-home-recent-title`,children:s.title}),s.preview?r("span",{class:`${V}-home-recent-preview`,children:s.preview}):null]}),(s.unreadCount??0)>0?r("span",{class:`${V}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,f?r(Zo,{onClick:f.url?()=>i.push({kind:"iframe",url:f.url,title:f.text}):void 0,children:r("div",{class:`${V}-home-status`,"data-level":f.level??"operational",children:[r("span",{class:`${V}-home-status-icon`,"aria-hidden":"true",children:r(ca,{})}),r("span",{class:`${V}-home-status-text`,children:f.text})]})}):null,c.length>0?r("section",{class:`${V}-home-content`,children:[r("div",{class:`${V}-home-content-title`,children:v}),r("div",{class:`${V}-home-content-list`,children:c.map(m=>r(Ln,{title:m.title,subtitle:m.description,onClick:()=>jd(i,m),testid:ce(P.homeContentRow,m.id)},m.id))})]}):null]})]})})}var _s={Icon:da,Root:e=>r(Yd,{...e})};var Ae=h.cssPrefix,Jd=M.scope("news");function Qd({transport:e,strings:t,config:n,nav:o,panelProps:i}){let a=n.contentTags,[s,l]=k("loading"),[c,u]=k(t.errorGeneric),[p,d]=k([]),[_,f]=k(0);w(()=>{let m=!1;return l("loading"),e.listContent({tags:a,sortBy:"publishedAt",sortOrder:"desc"}).then(y=>{m||(d(y.items??[]),l("loaded"))}).catch(y=>{m||(Jd.warn("listContent (news) failed",{err:y}),u(We(y,t)),l("error"))}),()=>{m=!0}},[e,a,_]);function v(){return s==="loading"?r(ve,{message:t.newsLoading,strings:t}):s==="error"?r(ve,{tone:"error",message:c,onRetry:()=>f(m=>m+1),strings:t}):p.length===0?r(ve,{message:t.newsEmpty,strings:t}):r("div",{class:`${Ae}-news-list`,children:p.map(m=>r("button",{type:"button",class:`${Ae}-news-card`,onClick:()=>o.push({kind:"content",id:m.id,title:m.title}),"data-testid":ce(P.newsItem,m.id),children:[m.image?r("img",{class:`${Ae}-news-hero`,src:m.image,alt:"",loading:"lazy"}):null,r("span",{class:`${Ae}-news-body`,children:[m.tags&&m.tags.length>0?r("span",{class:`${Ae}-news-tags`,children:m.tags.map(y=>r("span",{class:`${Ae}-news-tag`,children:y},y))}):null,r("span",{class:`${Ae}-news-title`,children:m.title}),m.description?r("span",{class:`${Ae}-news-summary`,children:m.description}):null]})]},m.id))})}return r("div",{class:`${Ae}-module`,children:[r(Rn,{title:t.newsTitle,onClose:i.onClose,closeLabel:t.close}),r("div",{class:`${Ae}-module-scroll`,children:v()})]})}var us={Icon:_a,Root:e=>r(Qd,{...e})};var Nn={chat:ns,home:_s,help:ls,news:us};var At=h.cssPrefix;function ps({modules:e,activeTab:t,strings:n,unreadCount:o,onSelect:i}){return r("nav",{class:`${At}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let s=Nn[a.layout].Icon,l=a.id===t,c=a.layout==="chat"&&o>0?o>9?"9+":String(o):null;return r("button",{type:"button",role:"tab","aria-selected":l,class:`${At}-tab`,onClick:()=>i(a.id),"data-testid":ce(P.tab,a.id),children:[r("span",{class:`${At}-tab-icon`,"aria-hidden":"true",children:[r(s,{}),c?r("span",{class:`${At}-tab-badge`,"data-testid":P.tabBadge,children:c}):null]}),r("span",{class:`${At}-tab-label`,children:tn(n,a.label)})]},a.id)})})}var fs=h.cssPrefix,Zd="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function gs({url:e,title:t,strings:n,onBack:o,onClose:i}){return r("div",{class:`${fs}-module`,children:[r(Mn,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:o,onClose:i,closeLabel:n.close}),r("iframe",{class:`${fs}-content-frame`,src:e,title:t||"content",sandbox:Zd,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var Xe=h.cssPrefix,e_=M.scope("content");function ms({id:e,title:t,transport:n,strings:o,onBack:i,onClose:a}){let[s,l]=k(null),[c,u]=k(!1),[p,d]=k(0),_=R(()=>{u(!1),l(null),d(v=>v+1)},[]);w(()=>{let v=!1;return n.listContent({ids:[e],limit:1}).then(m=>{if(v)return;let y=m.items[0];y?l(y):u(!0)}).catch(m=>{v||(e_.warn("listContent (reader) failed",{err:m}),u(!0))}),()=>{v=!0}},[n,e,p]);function f(){return c?r(ve,{tone:"error",message:o.errorGeneric,onRetry:_,strings:o}):s===null?r(ve,{message:o.contentLoading,strings:o}):r("article",{class:`${Xe}-content`,"data-testid":P.contentView,children:[s.image?r("img",{class:`${Xe}-content-hero`,src:s.image,alt:"",loading:"lazy"}):null,s.description?r("p",{class:`${Xe}-content-subtitle`,children:s.description}):null,s.tags&&s.tags.length>0?r("span",{class:`${Xe}-news-tags`,children:s.tags.map(v=>r("span",{class:`${Xe}-news-tag`,children:v},v))}):null,r(Na,{text:s.content??""})]})}return r("div",{class:`${Xe}-module`,children:[r(Mn,{title:s?.title||t||o.moduleBack,backLabel:o.moduleBack,onBack:i,onClose:a,closeLabel:o.close,testid:P.backHeader}),r("div",{class:`${Xe}-module-scroll`,"data-testid":P.contentScroll,children:f()})]})}var er=h.cssPrefix;function hs({panelProps:e,enabledModules:t,nav:n,unreadCount:o,onSelectSession:i,onStartNewSession:a,onSetPanelSize:s}){let l=e.options,c=l.strings,u=O(null);w(()=>{let X=u.current;if(!X)return;let de=wn(X),ee=J=>{J.key==="Escape"&&e.onClose?.()};return X.addEventListener("keydown",ee),()=>{de(),X.removeEventListener("keydown",ee)}},[e.onClose]);let p=O(null),d=R(X=>{p.current?.attachFromDrop(X)},[]),{visible:_}=Cn({containerRef:u,onDrop:d});Pn(u.current,l.mode==="modal");let f=we(()=>n.sig.value).value,v=es(f),m=l.modules.byId[f.activeTab],y=v?.kind==="iframe"||v?.kind==="content",b=t.length>1&&(ts(f)||!y),S=O(null);w(()=>{if(y&&S.current===null)S.current=e.panelSize,e.panelSize==="normal"&&s("expanded");else if(!y&&S.current!==null){let X=S.current;S.current=null,s(X)}},[y]);let I={push:n.push,pop:n.pop,switchTab:n.switchTab,switchToLayout:X=>{let de=t.find(ee=>ee.layout===X);de&&n.switchTab(de.id)},selectSession:i,startNewSession:a},L=X=>({options:l,transport:e.transport,strings:c,config:X,visitorId:e.visitorId,nav:I,panelProps:e}),U;if(v?.kind==="iframe")U=r(gs,{url:v.url,title:v.title,strings:c,onBack:n.pop,onClose:e.onClose});else if(v?.kind==="content")U=r(ms,{id:v.id,title:v.title,transport:e.transport,strings:c,onBack:n.pop,onClose:e.onClose});else if(m?.layout==="chat")U=r(Jo,{...e,containerEl:u.current,dragOver:_,composerAttachApiRef:p});else if(m){let X=Nn[m.layout].Root;U=X?r(X,{...L(m)},m.id):null}else U=null;return r("div",{ref:u,class:`${er}-panel ${er}-messenger`,role:"dialog","aria-modal":"false","aria-label":c.panelTitle,style:{position:"relative"},"data-testid":P.messengerHome,children:[r("div",{class:`${er}-messenger-body`,children:U}),b?r(ps,{modules:t,activeTab:f.activeTab,strings:c,unreadCount:o,onSelect:n.switchTab}):null,r(Qo,{poweredBy:l.poweredBy}),l.size.resize?.enabled&&!(m?.layout==="chat"&&!v)?r(yn,{panelEl:u.current,resize:l.size.resize,position:l.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:c}):null]})}var Tt=h.cssPrefix;function vs({strings:e,onClose:t}){return r("div",{class:`${Tt}-panel ${Tt}-modules-empty`,role:"dialog","aria-label":e.panelTitle,"data-testid":P.modulesEmpty,children:[t?r("button",{type:"button",class:`${Tt}-icon-btn ${Tt}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:r(fe,{})}):null,r("p",{class:`${Tt}-modules-empty-text`,children:e.modulesEmpty})]})}async function bs(e,t,n,o){for(let i=0;i<e.length;i++){if(o.aborted)return;let a=e[i],s=t[i];!a||!s||await t_(a,s.text,n,o)}}function t_(e,t,n,o){return new Promise(i=>{let a=e.partsSig.value[0];if(!a||a.kind!=="text"){i();return}let s=()=>{a.textSig.value=t,a.doneSig.value=!0,e.status="complete",i()};if(typeof requestAnimationFrame>"u"){s();return}let l=t.length/Math.max(1,n)*1e3,c=performance.now(),u=d=>{if(o.aborted)return s();let _=l===0?1:Math.min(1,(d-c)/l);if(a.textSig.value=t.slice(0,Math.floor(_*t.length)),_>=1)return s();p=requestAnimationFrame(u)},p=requestAnimationFrame(u);o.addEventListener("abort",()=>{cancelAnimationFrame(p),s()},{once:!0})})}function xs({callout:e,persistence:t}){let n=e?.text??"",o=e?.persistent??!0,[i,a]=k(()=>o?!1:t.loadCalloutDismissed(n));w(()=>{a(o?!1:t.loadCalloutDismissed(n))},[n,o,t]);let s=R(()=>{a(!0),o||t.saveCalloutDismissed(n)},[t,n,o]);return{dismissed:i,dismissCallout:s}}var K=M.scope("app"),tr=h.cssPrefix;function ys({options:e,hostElement:t,bus:n}){let[o]=k(()=>St(e.widgetId,e.storage)),[i,a]=k(()=>o.getVisitorId()),s=o.loadUserPrefs(),[l,c]=k(()=>s.locale??e.locale),[u,p]=k(()=>s.themeMode??e.themeMode),d=vt(o.loadSessionId()),_=vt([]),f=vt(0),[v,m]=k(!1);function y(){let g=e.modules.list,x=new Set(g.map(_e=>_e.id)),z=o.loadActiveModule();return z&&x.has(z)?z:g[0]?.id??""}function b(){return e.modules.list.find(g=>g.layout==="chat")?.id}let S=O();if(!S.current){let g=e.modules.list.map(x=>x.id);S.current=Qa(y(),g,x=>o.saveActiveModule(x))}let I=S.current,[L,U]=k(!1),X=e.mode==="standalone"||e.mode==="inline",de=O(yt(e,ot(),o.loadPanelOpen(),o.loadPanelSize())),[ee,J]=k(de.current.panelOpen),re=O(!1),[Be,je]=k(!1),{dismissed:E,dismissCallout:$}=xs({callout:e.launcher.callout,persistence:o}),j=e.launcher.callout?.persistent??!0,le=R(()=>{K.info("calloutDismiss"),n.emit("calloutDismiss",void 0),$()},[n,$]),[D,be]=k(de.current.panelSize),xe=O(!1),[$n,Bn]=k("chat"),[Ts,ct]=k(!0),[Ue,It]=k(!1),[Is,ir]=k(null),[Un,Rt]=k([]),[Mt,Lt]=k(null),zn=O(null),[Rs,Ms]=k(void 0),[Ls,Ns]=k(void 0),[Os,Ds]=k(()=>o.loadSidebarCollapsed()??!1),[ie]=k(()=>new un({baseUrl:e.baseUrl,auth:Si({publicKey:e.publicKey,aiAgentDeploymentId:e.aiAgentDeploymentId,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints})),[Ne]=k(()=>new pn(_)),[Y]=k(()=>new vn(e.sound,e.haptics)),Oe=R(g=>{o.patchUserPrefs(g),ie.saveUserPrefs(o.loadUserPrefs()).catch(x=>{K.warn("saveUserPrefs failed",{err:x})})},[o,ie]);w(()=>{s.soundMuted!==void 0&&Y.setMuted(s.soundMuted)},[]),w(()=>{t.dataset.theme=u},[t,u,e]),w(()=>{Y.update(e.sound,e.haptics)},[Y,e.sound,e.haptics]),w(()=>()=>Y.destroy(),[Y]),w(()=>{let g=!0;return Y.mutedSig.subscribe(x=>{if(g){g=!1;return}Oe({soundMuted:x})})},[Y,Oe]),w(()=>{xe.current||!e.size.initialSize||(xe.current=!0,!o.loadPanelSize()&&be(To(e.mode,e.size,ot())))},[e.mode,e.size,o]),w(()=>{if(!L||re.current)return;re.current=!0;let g=yt(e,ot(),o.loadPanelOpen(),o.loadPanelSize());J(g.panelOpen),be(g.panelSize)},[L,e,o]);let ar=O(!1);w(()=>{!L||ar.current||(ar.current=!0,I.reset(y()))},[L]);let sr=R(g=>{if(!g||g.length===0)return;let{animation:x,speed:z}=e.welcome;if(x==="instant"){_.value=g.map(Oi);return}zn.current?.abort();let _e=new AbortController;zn.current=_e;let oe=g.map(Ni);_.value=oe,bs(oe,g,z,_e.signal)},[_,e.welcome]),Fn=O(0),dt=R(async({newConversation:g})=>{let x=++Fn.current,z=()=>x!==Fn.current,_e=d.value,oe=g||!_e?ke():_e;oe!==_e&&(d.value=oe,o.saveSessionId(oe));let A;try{A=await ie.startSession({visitorId:i,sessionId:oe,userPrefs:o.loadUserPrefs(),locale:e.locale})}catch(Pe){if(z())return;n.emit("error",Pe),e.onError?.(Pe),g||U(!0);return}if(z())return;if(A.visitorId&&A.visitorId!==i&&(K.info("visitor rebound",{previous:i,current:A.visitorId,reason:A.rebind?.visitorId}),o.setVisitorId(A.visitorId),a(A.visitorId),n.emit("visitorRebound",{previous:i,current:A.visitorId,reason:A.rebind?.visitorId})),A.sessionId&&A.sessionId!==oe&&(K.info("session rebound",{previous:oe,current:A.sessionId,reason:A.rebind?.sessionId}),n.emit("sessionRebound",{previous:oe,current:A.sessionId,reason:A.rebind?.sessionId})),A.agent&&ir(A.agent),A.welcome?.suggestions&&Rt(A.welcome.suggestions),e.mode==="page"&&(A.site&&di(A.site)?Ms(A.site):A.site&&K.warn("invalid site config, using fallback",{site:A.site}),A.blocks&&_i(A.blocks)?Ns(A.blocks):A.blocks&&K.warn("invalid blocks config, using fallback",{blocks:A.blocks})),A.userPrefs&&!g&&(o.saveUserPrefs(A.userPrefs),A.userPrefs.locale&&c(A.userPrefs.locale),A.userPrefs.soundMuted!==void 0&&Y.setMuted(A.userPrefs.soundMuted),A.userPrefs.themeMode&&p(A.userPrefs.themeMode)),!g&&_e&&A.sessionId===_e){m(!0);try{let Pe=A.messages?.length?{sessionId:_e,canContinue:A.canContinue??!0,messages:A.messages}:await ie.loadSession(_e);if(z())return;let pe=(Pe.messages??[]).map(Lo);pe.length&&(_.value=pe),ct(Pe.canContinue??!0),Rt(Pe.suggestions??[])}catch(Pe){if(z())return;K.warn("loadSession failed; resetting sessionId",{err:Pe,sessionId:_e}),d.value=void 0,o.saveSessionId(void 0)}finally{z()||m(!1)}}else d.value=A.sessionId,o.saveSessionId(A.sessionId),sr(A.welcome?.messages);g||(n.emit("sessionStarted",A),U(!0))},[ie,i,o,e,n,_,d,Y,sr]),_t=JSON.stringify(e.userContext??null),Hs=JSON.stringify(e.pageContext??null);w(()=>{ie.setContext(e.userContext,n_(e.pageContext))},[ie,_t,Hs]);let $s=R(async g=>{let x=null;try{for await(let z of g.iter)x||(x=Mo(),Ne.attach(x),_.value=[..._.value,x],It(!0),Lt(()=>g.cancel),K.info("resumed in-flight reply on mount")),Ne.apply(z.chunk),z.chunk.type==="finish"&&z.chunk.canContinue===!1&&ct(!1);x&&(x.status="complete",Y.play("messageReceived"),nr(n,e,"assistant",No(x)))}catch(z){x&&(x.status="error",x.errorText=We(z,e.strings),Y.play("error")),K.debug("mount resume ended without completing",{err:z})}finally{x&&(Ne.detach(),It(!1),Lt(null),_.value=[..._.value])}},[Ne,_,Y,n,e]);w(()=>{dt({newConversation:!1});let g=d.value,x=null;return g&&(ie.primeIdentity(i,g),x=ie.resumeStream(),$s(x)),()=>{Fn.current++,x?.cancel()}},[]);let lr=O(_t);w(()=>{!L||lr.current===_t||(lr.current=_t,dt({newConversation:!1}))},[_t,L,dt]),w(()=>{dn(t,_n(e.mode,D,ee))},[t,ee,D,e.mode]),w(()=>{if(e.mode!=="modal"||!ee)return;let g=x=>{x.composedPath().some(oe=>oe instanceof HTMLElement&&oe.classList.contains(`${h.cssPrefix}-panel`))||J(!1)};return t.addEventListener("click",g),()=>t.removeEventListener("click",g)},[t,ee,e.mode]),w(()=>{if(e.mode!=="drawer"||!ee)return;let g=x=>{x.key==="Escape"&&J(!1)};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[ee,e.mode]);let cr=R(async(g,x)=>{if(K.info("send",{textLen:g.length,attachments:x.length,streaming:Ue}),Ue)return;n.emit("send",{text:g,attachmentCount:x.length}),Un.length>0&&Rt([]);let z=await r_(ie,x,pe=>{K.warn("upload failed",{err:pe}),n.emit("error",pe),e.onError?.(pe)});Y.unlock(),Y.play("messageSent");let _e=Li(g,z),oe=Mo();_.value=[..._.value,_e,oe],Ne.attach(oe),nr(n,e,"user",g);let A=d.value??ke();d.value||(d.value=A,o.saveSessionId(A));let gr=Ti({messages:_.value.slice(0,-1).map(Di),sessionId:A,tools:e.features.tools,responseMode:e.responseMode,visitorId:i,userPrefs:o.loadUserPrefs()});It(!0);let Pe=ie.sendMessage(gr);Lt(()=>Pe.cancel);try{for await(let pe of Pe.iter)Ne.apply(pe.chunk),pe.chunk.type==="finish"&&pe.chunk.canContinue===!1&&ct(!1);oe.status="complete",Y.play("messageReceived"),nr(n,e,"assistant",No(oe))}catch(pe){oe.status="error",oe.errorText=We(pe,e.strings),Y.play("error"),n.emit("error",pe),e.onError?.(pe)}finally{Ne.detach(),It(!1),Lt(null),_.value=[..._.value]}},[Ue,ie,Ne,_,d,e,n,Un.length,Y,o,i]),Bs=R(()=>{K.info("stop"),n.emit("stop",void 0),Mt?.()},[Mt,n]),Us=R(()=>{Y.toggleMuted();let g=Y.mutedSig.value;K.info("soundToggle",{muted:g}),n.emit("soundToggle",{muted:g})},[Y,n]),ut=R(()=>{if(ya(e.mode,D)==="exit-fullscreen"){K.info("close \u2192 exit-fullscreen",{mode:e.mode}),be("normal"),n.emit("fullscreen",!1);return}K.info("close \u2192 panel closed",{mode:e.mode}),J(!1),o.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,o,D]),Ye=R(()=>{e.modules.list.some(g=>g.layout==="chat")&&ie.listSessions({limit:50}).then(g=>{f.value=g.sessions.reduce((x,z)=>x+(z.unreadCount??0),0)}).catch(g=>K.debug("refreshUnread failed (non-fatal)",{err:g}))},[ie,e.modules,f]),dr=O(!1);w(()=>{!L||dr.current||(dr.current=!0,Ye())},[L,Ye]);let Wn=R(()=>{K.info("open",{mode:e.mode}),Y.unlock(),je(!0),J(!0),o.savePanelOpen(!0),!E&&!j&&le(),setTimeout(()=>je(!1),o_),Ye(),n.emit("open",void 0),e.onOpen?.()},[n,e,Y,o,E,j,le,Ye]),Kn=R(()=>{K.info("clear \u2192 new conversation",{wasStreaming:Ue}),n.emit("clear",void 0),Ue&&Mt?.(),zn.current?.abort(),_.value=[],d.value=void 0,o.clearSession(),ct(!0),dt({newConversation:!0})},[Ue,Mt,_,d,o,dt,n]),Gn=R(()=>{Kn(),Bn("chat");let g=e.modules.list.find(x=>x.layout==="chat")?.id;g&&I.switchTab(g)},[Kn,I,e]),Vn=R(()=>{let g=D==="expanded"?"normal":"expanded";K.info("expand",{from:D,expanded:g==="expanded"}),be(g),o.savePanelSize(g),n.emit("expand",g==="expanded")},[n,D,o]),qn=R(()=>{let g=D==="fullscreen"?"normal":"fullscreen";K.info("fullscreen",{from:D,fullscreen:g==="fullscreen"}),be(g),o.savePanelSize(g),n.emit("fullscreen",g==="fullscreen")},[n,D,o]),Xn=R(()=>{if(!e.popOutUrl)return;let g=new URL(e.popOutUrl);d.value&&g.searchParams.set("chat",d.value),e.widgetId!=="default"&&g.searchParams.set("widgetId",e.widgetId),K.info("popOut",{url:g.toString()}),window.open(g.toString(),"_blank","noopener,noreferrer"),n.emit("popOut",void 0)},[n,d,e.popOutUrl,e.widgetId]),zs=R(()=>{Bn(g=>{let x=g==="history"?"chat":"history";return K.info("toggleHistory",{view:x}),n.emit("toggleHistory",{view:x}),x})},[n]),Fs=R(g=>{K.info("localeChange",{locale:g}),c(g),Oe({locale:g}),n.emit("localeChange",g)},[Oe,n]),Ws=R(g=>{K.info("themeChange",{mode:g}),p(g),t.dataset.theme=g,Oe({themeMode:g}),n.emit("themeChange",g)},[t,Oe,n]),Ks=R(()=>{Ds(g=>{let x=!g;return K.info("sidebarToggle",{collapsed:x}),o.saveSidebarCollapsed(x),n.emit("sidebarToggle",{collapsed:x}),x})},[o,n]),Gs=R(g=>{K.info("resize",g),Oe({widgetSize:g}),n.emit("resize",g)},[Oe,n]),jn=R(async g=>{K.info("selectChat",{sessionId:g}),n.emit("selectChat",{sessionId:g});try{let x=await ie.loadSession(g),z=x.messages.map(Lo);_.value=z,d.value=x.sessionId,o.saveSessionId(x.sessionId),x.agent&&ir(x.agent),ct(x.canContinue),Rt(x.suggestions??[]),Bn("chat"),await ie.markRead(g),Ye()}catch(x){n.emit("error",x),e.onError?.(x)}},[ie,_,d,n,e,o,Ye]);w(()=>pi(t,{open:Wn,close:ut,expand:Vn,fullscreen:qn,popout:Xn}),[t,Wn,ut,Vn,qn,Xn]);let ye=ge(()=>Eo(e,l,u),[e,l,u]),_r={options:ye,transport:ie,feedback:Y,bus:n,view:$n,canSend:Ts,isStreaming:Ue,loadingMessages:v,messagesSig:_,agent:Is,suggestions:Un,initialWidgetSize:s.widgetSize??null,visitorId:i,onClose:ut,onClear:Kn,onExpand:Vn,onFullscreen:qn,onPopOut:Xn,onSoundToggle:Us,onToggleHistory:zs,onSelectHistoryChat:jn,onNewChat:Gn,onLocaleChange:Fs,onThemeChange:Ws,onWidgetSizeChange:Gs,onSend:cr,onStop:Bs,onSuggestion:g=>{let x=g.text??g.label;K.info("suggestion",{text:x}),n.emit("suggestion",{text:x}),cr(x,[])}},Vs=g=>{jn(g);let x=b();x&&I.switchTab(x)};if(!L)return null;let pt=ye.modules.list,Yn=g=>{let x=Sn("close",ye.mode,g);return pt.length===0?r(vs,{strings:ye.strings,onClose:x?ut:void 0}):pt.length===1&&pt[0]?.layout==="chat"?r(qa,{..._r,panelSize:g}):r(hs,{panelProps:{..._r,panelSize:g,onClose:x?ut:void 0},enabledModules:pt,nav:I,unreadCount:f.value,onSelectSession:Vs,onStartNewSession:Gn,onSetPanelSize:be})};if(e.mode==="page"){let g=z=>{jn(z.sessionId)},x=pt.some(z=>z.layout==="chat");return r("div",{class:`${tr}-anchor`,children:r(Ya,{site:Rs,blocks:Ls,transport:ie,strings:ye.strings,visitorId:i,showConversations:x,onSelectChat:g,onNewChat:Gn,sidebarCollapsed:Os,onToggleSidebarCollapsed:Ks,children:Yn("fullscreen")})})}if(X){let g=e.mode==="standalone"?"fullscreen":D;return r("div",{class:`${tr}-anchor`,children:Yn(g)})}let ur=e.mode==="drawer",pr=!(e.mode==="modal")&&!e.launcher.hidden&&(!ee||Be),fr=pr&&!Be&&!E&&!ur?ye.launcher.callout:null;return r("div",{class:`${tr}-anchor`,"data-launcher-size":ye.launcher.size,children:[ee?Yn(D):null,pr?r(ha,{onToggle:Wn,launcher:ye.launcher,strings:ye.strings,leaving:Be,edgeTab:ur}):null,fr?r(va,{callout:fr,launcherPosition:ye.position,closeLabel:ye.strings.close,onDismiss:le}):null]})}function n_(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var o_=120;async function r_(e,t,n){let o=[];for(let i of t)try{let{id:a,url:s}=await e.uploadFile(i.file);o.push({id:a,name:i.name,mediaType:i.mediaType,size:i.size,url:s})}catch(a){n(a)}return o}function nr(e,t,n,o){let i={role:n,text:o};e.emit("message",i),t.onMessage?.(i)}var i_=M.scope("error-boundary"),On=class extends He{constructor(){super(...arguments);F(this,"state",{crashed:!1})}componentDidCatch(n,o){i_.error("widget render crashed",{error:n,componentStack:o?.componentStack}),this.setState({crashed:!0}),this.props.onError(n,o?.componentStack)}render(){return this.state.crashed?this.props.fallback:this.props.children}};var a_=M.scope("iframe"),s_='<!doctype html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:transparent;overflow:hidden}</style></head><body></body></html>';function ws(e,t,n="closed",o="floating",i=null){a_.debug("createIframeMount",{position:t,initialMode:n,layoutMode:o,hasTarget:!!i});let a=document.createElement("iframe");a.title=`${h.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),Ss(a,t,n,o),(o==="inline"&&i?i:document.body).appendChild(a);let l=a.contentDocument;if(!l)throw new Error("iframe contentDocument unavailable (cross-origin?)");l.open(),l.write(s_),l.close();let c=cn({...e,target:l.body}),u=new MutationObserver(()=>{Ss(a,t,c.hostElement.dataset.mode??"closed",o)});return u.observe(c.hostElement,{attributes:!0,attributeFilter:["data-mode"]}),{...c,iframeElement:a,destroy(){u.disconnect(),c.destroy(),a.remove()}}}var or="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",Ps={closed:{w:"88px",h:"88px"},expanded:{w:"min(calc(100vw - 32px), 680px)",h:"min(calc(100vh - 32px), 860px)"},open:{w:"min(calc(100vw - 32px), 440px)",h:"min(calc(100vh - 32px), 700px)"}};function Ss(e,t,n,o){if(n==="fullscreen"||o==="standalone"){e.style.cssText=`${or}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(o==="inline"){e.style.cssText=`${or}position:static;display:block;width:100%;height:100%;`;return}let i=t.startsWith("top-")?"top":"bottom",a=t.endsWith("-left")?"left":"right",{w:s,h:l}=Ps[n]??Ps.open;e.style.cssText=`${or}position:fixed;${i}:16px;${a}:16px;width:${s};height:${l};`}var Dn=class{constructor(){F(this,"handlers",new Map)}on(t,n){let o=this.handlers.get(t);return o||(o=new Set,this.handlers.set(t,o)),o.add(n),()=>this.handlers.get(t)?.delete(n)}emit(t,n){let o=this.handlers.get(t);if(o)for(let i of o)try{i(n)}catch{}}clear(){this.handlers.clear()}};var l_=M.scope("hooks"),Hn="*",rr=new Set;function ks(e,t,n){let o={widgetId:e,event:t,listener:n};return rr.add(o),()=>{rr.delete(o)}}function c_(e,t,n){let o=[...rr];for(let i of o)if(d_(i.widgetId,e.widgetId)&&!(i.event!==Hn&&i.event!==t))try{i.listener(e,t,n)}catch(a){l_.warn("hook listener threw",{event:t,error:a})}}function Es(e,t){let n=[];for(let o of __)n.push(t.on(o,i=>{c_(e,o,i)}));return()=>{for(let o of n)o()}}function d_(e,t){return e===Hn||e===t}var __=["open","close","expand","fullscreen","popOut","resize","message","send","stop","clear","selectChat","suggestion","toggleHistory","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","soundToggle","sidebarToggle","calloutDismiss","error","sessionStarted","visitorRebound","sessionRebound"];var Le=new Map;function Cs(e){e.debug!==void 0&&an(e.debug);let t=M.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=e,o=bt(n),i=o.widgetId,a=Le.get(i);a&&(t.debug("destroy existing instance at slot",{widgetId:i}),a.destroy());let s=As(o),l=o.iframe?ws({position:ln(o.mode)},o.position,s,o.mode,e.target??null):cn({position:ln(o.mode),target:e.target??null}),c=St(o.widgetId,o.storage),u=()=>{let b=c.loadUserPrefs().themeMode;Pi(l.hostElement,b?{...o,themeMode:b}:o)};u(),dn(l.hostElement,s),l.hostElement.dataset.widgetId=i;let p=new Dn,d=b=>{p.emit("error",b),o.onError?.(b)},_=()=>{ao(Wt(On,{onError:d},Wt(ys,{bus:p,hostElement:l.hostElement,options:o})),l.appRoot)};_(),p.on("sessionStarted",b=>{b.config&&(n=Co(n,b.config),o=bt(n),yi(l.hostElement,ln(o.mode)),u(),_())});let f=l.hostElement,v=null,m=b=>{b.debug!==void 0&&an(b.debug),n={...n,...b},o=bt(n),u(),_()},y={widgetId:i,open:()=>xt(f,"open"),close:()=>xt(f,"close"),expand:()=>xt(f,"expand"),popOut:()=>xt(f,"popout"),on:(b,S)=>p.on(b,S),update:b=>{t.debug("update",{patch:b}),m(b)},setUserContext:b=>{t.debug("setUserContext",{keys:Object.keys(b)}),m({userContext:{...n.userContext,...b}})},clearUserContext:()=>{t.debug("clearUserContext"),m({userContext:void 0})},setPageContext:b=>{t.debug("setPageContext",{keys:Object.keys(b)}),m({pageContext:{...n.pageContext,...b}})},clearPageContext:()=>{t.debug("clearPageContext"),m({pageContext:void 0})},setDebug:b=>{an(b),t.info("debug level set",{level:bo()})},debugLevel:()=>bo(),onLog:b=>ei(b),destroy:()=>{t.info("destroy",{widgetId:i}),v?.(),p.clear(),ao(null,l.appRoot),l.destroy(),Le.get(i)===y&&Le.delete(i)}};return v=Es(y,p),Le.set(i,y),y}function u_(e){let t=e.widgetId??"default",n=Le.get(t);return n?(n.update(e),n):Cs(e)}function p_(e){if(e!==void 0){Le.get(e)?.destroy();return}let t=[...Le.values()];for(let n of t)n.destroy()}function f_(e="default"){return Le.get(e)??null}function g_(){return[...Le.values()]}function m_(e,t,n){return ks(e,t,n)}var h_="0.1.0",v_=h;function As(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=St(e.widgetId,e.storage),{panelOpen:n,panelSize:o}=yt(e,ot(),t.loadPanelOpen(),t.loadPanelSize());return _n(e.mode,o,n)}
|
|
39
|
+
`){B(e),W(e,16),e.pending=n;continue}}break;case"$":if(e.token!==19&&e.token!==16&&e.pending==="$")if(n==="$"){e.token=105,e.pending=o;continue}else{if(vd(n.charCodeAt(0)))break;B(e),W(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){B(e),W(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){B(e),W(e,19),e.pending="";continue}break;case" ":if(e.pending.length===1&&n===" ")continue;break}if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n==="h"&&(e.pending===" "||e.pending==="")){e.text+=e.pending,e.pending=n,e.token=102;continue}e.text+=e.pending,e.pending=n}B(e)}function qo(e){return{add_token:bd,end_token:xd,add_text:yd,set_attr:Pd,data:{nodes:[e,,,,,],index:0}}}function bd(e,t){let n=e.nodes[e.index],o;switch(t){case 1:return;case 20:o=document.createElement("blockquote");break;case 2:o=document.createElement("p");break;case 21:o=document.createElement("br");break;case 22:o=document.createElement("hr");break;case 3:o=document.createElement("h1");break;case 4:o=document.createElement("h2");break;case 5:o=document.createElement("h3");break;case 6:o=document.createElement("h4");break;case 7:o=document.createElement("h5");break;case 8:o=document.createElement("h6");break;case 12:case 13:o=document.createElement("em");break;case 14:case 15:o=document.createElement("strong");break;case 16:o=document.createElement("s");break;case 11:o=document.createElement("code");break;case 18:case 17:o=document.createElement("a");break;case 19:o=document.createElement("img");break;case 23:o=document.createElement("ul");break;case 24:o=document.createElement("ol");break;case 25:o=document.createElement("li");break;case 26:let i=o=document.createElement("input");i.type="checkbox",i.disabled=!0;break;case 9:case 10:n=n.appendChild(document.createElement("pre")),o=document.createElement("code");break;case 27:o=document.createElement("table");break;case 28:switch(n.children.length){case 0:n=n.appendChild(document.createElement("thead"));break;case 1:n=n.appendChild(document.createElement("tbody"));break;default:n=n.children[1]}o=document.createElement("tr");break;case 29:o=document.createElement(n.parentElement?.tagName==="THEAD"?"th":"td");break;case 30:o=document.createElement("equation-block");break;case 31:o=document.createElement("equation-inline");break}e.nodes[++e.index]=n.appendChild(o)}function xd(e){e.index-=1}function yd(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function Pd(e,t,n){e.nodes[e.index].setAttribute(pd(t),n)}function Tn({textSig:e,doneSig:t}){let n=O(null);return w(()=>{let o=n.current;if(!o)return;o.classList.add(`${h.cssPrefix}-md`);let i=qo(o),a=Vo(i),s=0,l=Re(()=>{let p=e.value,d=t.value;p.length<s&&(o.replaceChildren(),i=qo(o),a=Vo(i),s=0);let _=p.slice(s);_&&le(a,_),s=p.length,d&&Ma(a)}),c=new MutationObserver(p=>{for(let d of p)for(let _ of d.addedNodes){if(!(_ instanceof HTMLElement))continue;let f=_.matches?.("a")?[_]:[..._.querySelectorAll?.("a")??[]];for(let v of f)La(v)}});c.observe(o,{childList:!0,subtree:!0});for(let p of o.querySelectorAll("a"))La(p);let u=p=>{let d=p.target?.closest?.("a");if(!d||!(d instanceof HTMLAnchorElement))return;let _=d.getAttribute("href")??"";!_||_.startsWith("#")||(p.preventDefault(),window.open(_,"_blank","noopener,noreferrer"))};return o.addEventListener("click",u),()=>{l(),c.disconnect(),o.removeEventListener("click",u)}},[e,t]),r("div",{ref:n})}function Na({text:e}){let t=ge(()=>N(e),[e]),n=ge(()=>N(!0),[]);return r(Tn,{textSig:t,doneSig:n})}function La(e){let t=e.getAttribute("href")??"";if(!t||t.startsWith("#"))return;e.target!=="_blank"&&(e.target="_blank");let n=new Set((e.rel||"").split(/\s+/).filter(Boolean));n.add("noopener"),n.add("noreferrer"),e.rel=[...n].join(" ")}function Oa({part:e,strings:t}){let n=h.cssPrefix;return r("span",{class:`${n}-tool-chip`,role:"status",children:[r("span",{children:[t.usedTool,":"]}),r("strong",{children:e.toolName})]})}var Se=h.cssPrefix;function Da({message:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:i}){let s=we(()=>e.partsSig.value).value,l=we(()=>e.partsSig.value.some(f=>f.kind==="text"&&f.textSig.value.length>0)),c=we(()=>o&&e.partsSig.value.some(f=>f.kind==="reasoning")),u=e.role==="assistant"&&e.status==="streaming",p=n==="buffered"&&u,d=u&&!l.value,_=!p&&d&&!c.value;return r("div",{class:`${Se}-bubble-row`,"data-role":e.role,"data-testid":de(P.messageBubble,e.id),children:r("div",{class:`${Se}-bubble`,children:[p?r(Ad,{label:t.loading}):s.map(f=>r(wd,{part:f,active:d,strings:t,showReasoning:o,showToolCalls:i},Ed(f))),_&&r(Cd,{}),e.status==="error"&&e.errorText?r("div",{class:`${Se}-error`,role:"alert",children:r("span",{children:e.errorText})}):null]})})}function wd({part:e,active:t,strings:n,showReasoning:o,showToolCalls:i}){switch(e.kind){case"text":return r(Tn,{textSig:e.textSig,doneSig:e.doneSig});case"reasoning":return o?r(kd,{part:e,active:t,strings:n}):null;case"tool":return i?r(Oa,{part:e,strings:n}):null;case"file":return e.mediaType.startsWith("image/")?r("img",{src:e.url,alt:"",loading:"lazy"}):r("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",children:e.url});case"source":return null}}function kd({part:e,active:t,strings:n}){return r("details",{class:`${Se}-reasoning`,open:t,"data-active":t?"true":void 0,children:[r("summary",{class:`${Se}-reasoning-summary`,children:r("span",{class:`${Se}-reasoning-label`,children:t?n.thinking:n.thoughts})}),r("div",{class:`${Se}-reasoning-body`,children:r(Tn,{textSig:e.textSig,doneSig:e.doneSig})})]})}function Ed(e){switch(e.kind){case"text":case"reasoning":return`${e.kind}:${e.id}`;case"tool":return`tool:${e.toolCallId}`;case"file":return`file:${e.url}`;case"source":return`source:${e.sourceId}`}}function Cd(){return r("span",{class:`${Se}-typing`,"aria-hidden":"true",children:[r("span",{}),r("span",{}),r("span",{})]})}function Ad({label:e}){return r("span",{class:`${Se}-loading`,role:"status",children:[r("span",{class:`${Se}-loading-spinner`,"aria-hidden":"true"}),r("span",{class:`${Se}-loading-label`,children:e})]})}var Ha=h.cssPrefix,Xo=120;function $a({messagesSig:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:i,loading:a}){let s=O(null),l=we(()=>e.value),c=O(!1),u=l.value[0]?.id;return Br(()=>{let p=s.current;if(!p||l.value.length===0)return;c.current=!0;let d=()=>{p.scrollTop=p.scrollHeight};d();let _=new ResizeObserver(d);_.observe(p);let f=new MutationObserver(d);f.observe(p,{childList:!0,subtree:!0,characterData:!0});let v=setTimeout(()=>{_.disconnect(),f.disconnect()},300);return()=>{_.disconnect(),f.disconnect(),clearTimeout(v)}},[u]),w(()=>{let p=s.current;if(!p||!c.current)return;p.scrollHeight-p.scrollTop-p.clientHeight<Xo&&(p.scrollTop=p.scrollHeight)},[l.value.length]),w(()=>{let p=s.current;if(!p)return;let d=l.value.at(-1);if(!d)return;if(d.status!=="streaming"){let f=requestAnimationFrame(()=>{p.scrollHeight-p.scrollTop-p.clientHeight<Xo*2&&(p.scrollTop=p.scrollHeight)});return()=>cancelAnimationFrame(f)}let _=setInterval(()=>{p.scrollHeight-p.scrollTop-p.clientHeight<Xo*2&&(p.scrollTop=p.scrollHeight)},250);return()=>clearInterval(_)},[l.value]),r("div",{ref:s,class:`${Ha}-list`,role:"log","aria-live":"polite","aria-relevant":"additions text",children:[a&&l.value.length===0?r("div",{class:`${Ha}-list-loading`,role:"status",children:t.messagesLoading}):null,l.value.map(p=>r(Da,{message:p,strings:t,responseMode:n,showReasoning:o,showToolCalls:i},p.id))]})}function st({itemCount:e,initialFocusIndex:t}){let[n,o]=k(!1),i=O(null),a=O(null),[s,l]=k(-1),c=R(()=>{o(!1),l(-1),i.current?.focus()},[]),u=R(()=>o(_=>!_),[]);w(()=>{if(!n)return;let _=f=>{let v=a.current,m=i.current;if(!v||!m)return;let y=f.composedPath();y.includes(v)||y.includes(m)||(o(!1),l(-1))};return document.addEventListener("click",_,!0),()=>document.removeEventListener("click",_,!0)},[n]),w(()=>{if(!n||e===0)return;let _=t?.()??0,f=_<0||_>=e?0:_;l(f)},[n,e,t]),w(()=>{if(!n||s<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[s]?.focus()},[n,s]);let p=R(_=>{(_.key==="ArrowDown"||_.key==="Enter"||_.key===" ")&&(_.preventDefault(),o(!0))},[]),d=R(_=>{if(e!==0)switch(_.key){case"Escape":_.preventDefault(),c();return;case"ArrowDown":_.preventDefault(),l(f=>(f+1)%e);return;case"ArrowUp":_.preventDefault(),l(f=>(f-1+e)%e);return;case"Home":_.preventDefault(),l(0);return;case"End":_.preventDefault(),l(e-1)}},[e,c]);return{open:n,focusIndex:s,triggerRef:i,menuRef:a,toggle:u,close:c,onTriggerKey:p,onMenuKey:d}}function Ba({items:e,triggerLabel:t}){let n=h.cssPrefix,o=st({itemCount:e.length}),i=a=>{a.disabled||(a.onSelect(),o.close())};return r("div",{class:`${n}-menu-wrap`,children:[r("button",{ref:o.triggerRef,type:"button",class:`${n}-icon-btn`,"aria-label":t,"aria-haspopup":"menu","aria-expanded":o.open,title:t,onClick:o.toggle,onKeyDown:o.onTriggerKey,children:r(ta,{})}),o.open?r("div",{ref:o.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:o.onMenuKey,tabIndex:-1,children:e.map(a=>r("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":a.type==="switch"?a.on:void 0,disabled:a.disabled,lang:a.lang,onClick:()=>i(a),children:[a.icon?r("span",{class:`${n}-menu-icon`,children:a.icon}):null,r("span",{class:`${n}-menu-label`,children:a.label}),a.type==="switch"&&a.on?r("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:r(it,{})}):null]},a.id))}):null]})}var Td=["today","yesterday","lastWeek","older"];function Id(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let o=Math.floor((Ua(e)-Ua(n))/(1440*60*1e3));return o<=0?"today":o===1?"yesterday":o<7?"lastWeek":"older"}function za(e,t){let n=new Map;for(let o of t){let i=Id(e,o.lastMessageAt),a=n.get(i);a?a.push(o):n.set(i,[o])}return Td.filter(o=>n.has(o)).map(o=>({bucket:o,sessions:n.get(o)}))}function Ua(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var Rd=M.scope("history"),Md={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function In({transport:e,strings:t,visitorId:n,onSelect:o,onNewChat:i}){let a=h.cssPrefix,[s,l]=k("loading"),[c,u]=k([]);w(()=>{let _=!1;return e.listSessions({visitorId:n}).then(f=>{_||(u(f.sessions??[]),l("loaded"))}).catch(f=>{_||(Rd.warn("listSessions failed",{err:f}),l("error"))}),()=>{_=!0}},[e,n]);let p=i?r("div",{class:`${a}-history-footer`,children:r("button",{type:"button",class:`${a}-history-new`,onClick:i,"data-testid":P.sidebarNewChat,children:[r(Wi,{}),t.historyNewChat]})}):null;if(s==="loading")return r(te,{children:[r("div",{class:`${a}-history-empty`,children:t.historyLoading}),p]});if(s==="error"||c.length===0)return r(te,{children:[r("div",{class:`${a}-history-empty`,children:t.historyEmpty}),p]});let d=za(Date.now(),c);return r(te,{children:[r("div",{class:`${a}-history`,role:"list",children:d.map(_=>r("div",{class:`${a}-history-group`,children:[r("div",{class:`${a}-history-heading`,children:t[Md[_.bucket]]}),_.sessions.map(f=>r("button",{type:"button",role:"listitem",class:`${a}-history-item`,onClick:()=>o(f),"data-closed":f.canContinue?void 0:"true","data-testid":de(P.historyItem,f.sessionId),children:[r("span",{class:`${a}-history-title`,children:f.title}),f.preview?r("span",{class:`${a}-history-preview`,children:f.preview}):null]},f.sessionId))]},_.bucket))}),p]})}function Fa(e){return r(In,{...e})}function Wa({available:e,active:t,onSelect:n,triggerLabel:o}){let i=h.cssPrefix,a=R(()=>e.indexOf(t),[e,t]),s=st({itemCount:e.length,initialFocusIndex:a}),l=c=>{n(c),s.close()};return r("div",{class:`${i}-menu-wrap`,children:[r("button",{ref:s.triggerRef,type:"button",class:`${i}-icon-btn`,"aria-label":o,"aria-haspopup":"menu","aria-expanded":s.open,title:o,onClick:s.toggle,onKeyDown:s.onTriggerKey,children:r(ia,{})}),s.open?r("div",{ref:s.menuRef,class:`${i}-menu`,role:"menu","aria-label":o,onKeyDown:s.onMenuKey,tabIndex:-1,children:e.map(c=>{let u=c===t;return r("button",{type:"button",role:"menuitem",class:`${i}-menu-item`,lang:c,"aria-current":u?"true":void 0,onClick:()=>l(c),children:[r("span",{class:`${i}-menu-label`,children:Jr(c,t)}),u?r("span",{class:`${i}-menu-check`,"aria-hidden":"true",children:r(it,{})}):null]},c)})}):null]})}var jo=["auto","light","dark"];function Ka(e){switch(e){case"light":return r(ua,{});case"dark":return r(pa,{});case"auto":return r(fa,{})}}function Yo({active:e,onSelect:t,triggerLabel:n,optionLabels:o}){let i=h.cssPrefix,a=R(()=>jo.indexOf(e),[e]),s=st({itemCount:jo.length,initialFocusIndex:a}),l=c=>{t(c),s.close()};return r("div",{class:`${i}-menu-wrap`,children:[r("button",{ref:s.triggerRef,type:"button",class:`${i}-icon-btn`,"aria-label":n,"aria-haspopup":"menu","aria-expanded":s.open,title:n,"data-theme-active":e,onClick:s.toggle,onKeyDown:s.onTriggerKey,children:Ka(e)}),s.open?r("div",{ref:s.menuRef,class:`${i}-menu`,role:"menu","aria-label":n,onKeyDown:s.onMenuKey,tabIndex:-1,children:jo.map(c=>{let u=c===e;return r("button",{type:"button",role:"menuitem",class:`${i}-menu-item`,"aria-current":u?"true":void 0,onClick:()=>l(c),children:[r("span",{class:`${i}-menu-icon`,children:Ka(c)}),r("span",{class:`${i}-menu-label`,children:o[c]}),u?r("span",{class:`${i}-menu-check`,"aria-hidden":"true",children:r(it,{})}):null]},c)})}):null]})}var Ga=h.cssPrefix;function Va({suggestions:e,onPick:t}){return e.length===0?null:r("div",{class:`${Ga}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((n,o)=>r("button",{type:"button",class:`${Ga}-suggestion`,onClick:()=>t(n),"data-testid":de(P.suggestion,o),children:n.label},n.id))})}var ue=h.cssPrefix;function qa(e){let{options:t,onClose:n}=e,o=t.strings,i=O(null);w(()=>{let c=i.current;if(!c)return;let u=wn(c),p=d=>{d.key==="Escape"&&n?.()};return c.addEventListener("keydown",p),()=>{u(),c.removeEventListener("keydown",p)}},[n]);let a=O(null),s=R(c=>{a.current?.attachFromDrop(c)},[]),{visible:l}=Cn({containerRef:i,onDrop:s});return Pn(i.current,t.mode==="modal"),r("div",{ref:i,class:`${ue}-panel`,role:"dialog","aria-modal":"false","aria-label":o.panelTitle,style:{position:"relative"},"data-testid":P.panel,children:[r(Jo,{...e,containerEl:i.current,dragOver:l,composerAttachApiRef:a}),r(Qo,{poweredBy:e.options.poweredBy})]})}function Jo({options:e,transport:t,feedback:n,bus:o,panelSize:i,view:a,canSend:s,isStreaming:l,loadingMessages:c,messagesSig:u,agent:p,suggestions:d,initialWidgetSize:_,visitorId:f,onClose:v,onBack:m,onClear:y,onExpand:b,onFullscreen:S,onPopOut:I,onSoundToggle:L,onToggleHistory:U,onSelectHistoryChat:X,onNewChat:_e,onLocaleChange:ee,onThemeChange:J,onWidgetSizeChange:re,onSend:Be,onStop:je,onSuggestion:E,containerEl:$,dragOver:j,composerAttachApiRef:ce}){let D=e.strings;return r(te,{children:[a==="history"?r(Ld,{strings:D,onBack:U,onClose:v,showClose:xa(e.mode,i,e.actions)}):r(Hd,{agent:p,onBack:m,backLabel:D.moduleBack,moreActionsLabel:D.moreActions,languageLabel:D.language,themeLabel:D.theme,themeOptionLabels:{auto:D.themeAuto,light:D.themeLight,dark:D.themeDark},activeThemeMode:e.themeMode,onThemeChange:J,panelTitle:D.panelTitle,activeLocale:e.locale,availableLocales:e.availableLocales,onLocaleChange:ee,main:Ho(e.actions.main,e.mode,i,{popOutUrl:e.popOutUrl}),overflow:Ho(e.actions.overflow,e.mode,i,{popOutUrl:e.popOutUrl}),descriptors:$d({strings:D,panelSize:i,feedback:n,onClear:y,onExpand:b,onFullscreen:S,onPopOut:I,onSoundToggle:L,onToggleHistory:U,onClose:v})}),a==="history"?r(Fa,{transport:t,strings:D,visitorId:f,onSelect:be=>X(be.sessionId),onNewChat:_e}):r(te,{children:[r(Ea,{visible:j,strings:D}),r($a,{messagesSig:u,strings:D,responseMode:e.responseMode,showReasoning:e.showReasoning,showToolCalls:e.showToolCalls,loading:c}),s?r(te,{children:[r(Va,{suggestions:d,onPick:E}),r(ka,{options:e,transport:t,feedback:n,bus:o,isStreaming:l,onSend:Be,onStop:je,attachApiRef:ce})]}):r(Nd,{label:D.chatClosed,ctaLabel:D.startNewConversation,onNewChat:y}),r(Od,{disclaimer:e.composerDisclaimer})]}),e.size.resize?.enabled?r(yn,{panelEl:$,resize:e.size.resize,position:e.position,initialSize:_,onSizeChange:re,strings:D}):null]})}function Ld({strings:e,onBack:t,onClose:n,showClose:o}){return r("header",{class:`${ue}-header`,children:[r("button",{type:"button",class:`${ue}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:r(wt,{})}),r("h1",{children:e.historyTitle}),o?r("button",{type:"button",class:`${ue}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:r(fe,{})}):null]})}function Nd({label:e,ctaLabel:t,onNewChat:n}){return r("div",{class:`${ue}-readonly-banner`,role:"note",children:[r("span",{class:`${ue}-readonly-label`,children:e}),r("button",{type:"button",class:`${ue}-readonly-cta`,onClick:n,children:t})]})}function Od({disclaimer:e}){return e?r("div",{class:`${ue}-composer-footer`,children:r("div",{class:`${ue}-disclaimer`,children:e})}):null}function Qo({poweredBy:e}){return e?r("div",{class:`${ue}-poweredby-bar`,children:r(Dd,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function Dd({logoUrl:e,text:t,href:n}){let o=r(te,{children:[e?r("img",{class:`${ue}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?r("span",{children:t}):null]});return n?r("a",{class:`${ue}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:o}):r("span",{class:`${ue}-poweredby`,children:o})}function Hd({agent:e,onBack:t,backLabel:n,moreActionsLabel:o,languageLabel:i,themeLabel:a,themeOptionLabels:s,activeThemeMode:l,onThemeChange:c,panelTitle:u,activeLocale:p,availableLocales:d,onLocaleChange:_,main:f,overflow:v,descriptors:m}){let y=d.length>1,b=[];for(let I of v){if(I==="theme")continue;if(I==="language"){if(!y)continue;for(let U of d)b.push({id:`language:${U}`,label:i+` \u2014 ${U}`,lang:U,onSelect:()=>_(U),type:"switch",on:U===p});continue}let L=m[I];b.push({id:I,icon:L.icon,label:L.label,onSelect:L.onSelect,type:L.switchable?"switch":"button",on:L.switchOn})}let S=v.includes("theme");return r("header",{class:`${ue}-header`,"data-testid":P.panelHeader,children:[t?r("button",{type:"button",class:`${ue}-icon-btn`,onClick:t,"aria-label":n,title:n,children:r(wt,{})}):null,e?r(Pa,{agent:e}):r("h1",{children:u}),f.map(I=>{if(I==="language")return y?r(Wa,{available:d,active:p,onSelect:_,triggerLabel:i},"language"):null;if(I==="theme")return r(Yo,{active:l,onSelect:c,triggerLabel:a,optionLabels:s},"theme");let L=m[I];return r("button",{type:"button",class:`${ue}-icon-btn`,onClick:L.onSelect,"aria-label":L.label,"aria-pressed":L.switchable?L.switchOn:void 0,title:L.label,"data-testid":ma[I],children:L.icon},I)}),S?r(Yo,{active:l,onSelect:c,triggerLabel:a,optionLabels:s}):null,b.length>0?r(Ba,{items:b,triggerLabel:o}):null]})}function $d(e){let{strings:t,panelSize:n,feedback:o,onClear:i,onExpand:a,onFullscreen:s,onPopOut:l,onSoundToggle:c,onToggleHistory:u,onClose:p}=e,d=n==="expanded",_=n==="fullscreen",f=we(()=>o.mutedSig.value).value;return{clear:{icon:r(sa,{}),label:t.newConversation,onSelect:i},expand:{icon:d?r(Ji,{}):r(Yi,{}),label:d?t.collapse:t.expand,onSelect:a,switchable:!0,switchOn:d},fullscreen:{icon:_?r(Zi,{}):r(Qi,{}),label:_?t.exitFullscreen:t.fullscreen,onSelect:s,switchable:!0,switchOn:_},popOut:{icon:r(aa,{}),label:t.popOut,onSelect:l},sound:{icon:f?r(oa,{}):r(na,{}),label:f?t.soundOff:t.soundOn,onSelect:c,switchable:!0,switchOn:!f},history:{icon:r(ra,{}),label:t.history,onSelect:u},close:{icon:r(fe,{}),label:t.close,onSelect:p??(()=>{})}}}function Xa(e){let t=h.cssPrefix,{site:n,blocks:o,strings:i,collapsed:a}=e,s=o?.navigation??[],l=o?.linkCards??[],c=a?i.expandSidebar:i.collapseSidebar;return r("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":P.sidebar,children:[r("div",{class:`${t}-sidebar-header`,children:[r(Bd,{site:n}),r("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":P.sidebarToggle,children:r(Ud,{collapsed:a})})]}),a?null:r(te,{children:[s.length>0?r("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:r(zd,{items:s})}):null,l.length>0?r("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:r(Fd,{items:l})}):null,e.showConversations?r("div",{class:`${t}-sidebar-conversations`,children:r(In,{transport:e.transport,strings:e.strings,visitorId:e.visitorId,onSelect:e.onSelectChat,onNewChat:e.onNewChat})}):null]})]})}function Bd({site:e}){let t=h.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return r("picture",{children:[e.logoDark?.url?r("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,r("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return r("div",{class:`${t}-sidebar-title`,children:e?.title??h.name})}function Ud({collapsed:e}){return r("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?r("polyline",{points:"9 6 15 12 9 18"}):r("polyline",{points:"15 6 9 12 15 18"})})}function zd({items:e}){let t=h.cssPrefix;return r("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>r("li",{children:r("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?r("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,r("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function Fd({items:e}){let t=h.cssPrefix;return r("div",{class:`${t}-sidebar-cards`,children:e.map(n=>r("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[r("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?r("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var ja=h.cssPrefix;function Ya(e){return r("main",{class:`${ja}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[r(Xa,{site:e.site,blocks:e.blocks,transport:e.transport,strings:e.strings,visitorId:e.visitorId,showConversations:e.showConversations,onSelectChat:e.onSelectChat,onNewChat:e.onNewChat,collapsed:e.sidebarCollapsed,onToggleCollapsed:e.onToggleSidebarCollapsed}),r("section",{class:`${ja}-page-chat`,"aria-label":"Chat",children:e.children})]})}var Ja=e=>Object.fromEntries(e.map(t=>[t,[]]));function Qa(e,t,n){let o=N({activeTab:e,stacks:Ja(t)});return{sig:o,switchTab(i){o.value.activeTab!==i&&(o.value={...o.value,activeTab:i},n?.(i))},push(i){let a=o.value,s=a.stacks[a.activeTab]??[];o.value={...a,stacks:{...a.stacks,[a.activeTab]:[...s,i]}}},pop(){let i=o.value,a=i.stacks[i.activeTab]??[];a.length!==0&&(o.value={...i,stacks:{...i.stacks,[i.activeTab]:a.slice(0,-1)}})},reset(i){o.value={activeTab:i,stacks:Ja(t)}}}}var Za=e=>e.stacks[e.activeTab]??[],es=e=>Za(e).at(-1),ts=e=>Za(e).length===0;var ns={Icon:kt};var Ce=h.cssPrefix;function Rn({title:e,onClose:t,closeLabel:n}){return r("header",{class:`${Ce}-back-header`,"data-variant":"title",children:[r("span",{class:`${Ce}-back-spacer`,"aria-hidden":"true"}),r("h1",{class:`${Ce}-back-title`,children:e}),t?r("button",{type:"button",class:`${Ce}-icon-btn`,onClick:t,"aria-label":n,title:n,children:r(fe,{})}):r("span",{class:`${Ce}-back-spacer`,"aria-hidden":"true"})]})}function Mn({title:e,backLabel:t,onBack:n,onClose:o,closeLabel:i,testid:a}){return r("header",{class:`${Ce}-back-header`,"data-testid":a,children:[r("button",{type:"button",class:`${Ce}-icon-btn`,onClick:n,"aria-label":t,title:t,children:r(wt,{})}),r("h1",{class:`${Ce}-back-title`,children:e}),o?r("button",{type:"button",class:`${Ce}-icon-btn`,onClick:o,"aria-label":i,title:i,children:r(fe,{})}):r("span",{class:`${Ce}-back-spacer`,"aria-hidden":"true"})]})}var lt=h.cssPrefix;function os({placeholder:e,onActivate:t}){return r("button",{type:"button",class:`${lt}-home-search`,onClick:t,"data-testid":P.homeSearch,children:[r("span",{class:`${lt}-home-search-text`,children:e}),r("span",{class:`${lt}-home-search-icon`,"aria-hidden":"true",children:r(Do,{})})]})}function rs({placeholder:e,value:t,onInput:n}){return r("div",{class:`${lt}-home-search`,"data-input":"true",children:[r("input",{type:"search",class:`${lt}-home-search-input`,placeholder:e,value:t,onInput:o=>n(o.currentTarget.value),"data-testid":P.helpSearch}),r("span",{class:`${lt}-home-search-icon`,"aria-hidden":"true",children:r(Do,{})})]})}var Ct=h.cssPrefix;function Ln({title:e,subtitle:t,onClick:n,testid:o}){return r("button",{type:"button",class:`${Ct}-list-row`,onClick:n,"data-testid":o,children:[r("span",{class:`${Ct}-list-row-body`,children:[r("span",{class:`${Ct}-list-row-title`,children:e}),t?r("span",{class:`${Ct}-list-row-sub`,children:t}):null]}),r("span",{class:`${Ct}-list-row-chevron`,"aria-hidden":"true",children:r(bn,{})})]})}var is=h.cssPrefix;function ve({tone:e="info",message:t,onRetry:n,strings:o}){return r("div",{class:`${is}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[r("span",{children:t}),n?r("button",{type:"button",class:`${is}-module-retry`,onClick:n,children:o.errorRetry}):null]})}var qe=h.cssPrefix,Wd=M.scope("help"),Kd=(e,t)=>t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title});function Gd(e){let t=new Map;for(let n of e){let o=n.categories?.[0]??"";(t.get(o)??t.set(o,[]).get(o)).push(n)}return[...t.entries()]}function as(e,t){let n=t.toLowerCase(),o=n.indexOf(e);if(o!==-1)return 100-Math.min(o,99);let i=0;for(let a of e){if(i=n.indexOf(a,i),i===-1)return 0;i+=1}return 1}function Vd(e,t){let n=t.toLowerCase().trim();return n?e.map(o=>({item:o,score:Math.max(as(n,o.title)*2,as(n,o.description??""))})).filter(o=>o.score>0).toSorted((o,i)=>i.score-o.score).map(o=>o.item):[]}function ss({article:e,nav:t}){return r(Ln,{title:e.title,subtitle:e.description,onClick:()=>Kd(t,e),testid:de(P.helpArticle,e.id)})}function qd({transport:e,strings:t,config:n,nav:o,panelProps:i}){let a=n.contentTags,[s,l]=k("loading"),[c,u]=k(t.errorGeneric),[p,d]=k([]),[_,f]=k(""),[v,m]=k(0);w(()=>{let S=!1;return l("loading"),e.listContent({tags:a,sortBy:"order",limit:100}).then(I=>{S||(d(I.items??[]),l("loaded"))}).catch(I=>{S||(Wd.warn("listContent (help) failed",{err:I}),u(We(I,t)),l("error"))}),()=>{S=!0}},[e,a,v]);let y=ge(()=>Vd(p,_),[p,_]);function b(){return _.trim().length>0?y.length===0?r(ve,{message:t.helpSearchEmpty,strings:t}):r("div",{class:`${qe}-help-card`,children:y.map(S=>r(ss,{article:S,nav:o},S.id))}):s==="loading"?r(ve,{message:t.helpLoading,strings:t}):s==="error"?r(ve,{tone:"error",message:c,onRetry:()=>m(S=>S+1),strings:t}):p.length===0?r(ve,{message:t.helpEmpty,strings:t}):Gd(p).map(([S,I])=>r("section",{class:`${qe}-help-group`,children:[S?r("h2",{class:`${qe}-help-section-title`,children:S}):null,r("div",{class:`${qe}-help-card`,children:I.map(L=>r(ss,{article:L,nav:o},L.id))})]},S))}return r("div",{class:`${qe}-module`,children:[r(Rn,{title:t.helpTitle,onClose:i.onClose,closeLabel:t.close}),r("div",{class:`${qe}-module-pad`,children:r(rs,{placeholder:t.helpSearchPlaceholder,value:_,onInput:f})}),r("div",{class:`${qe}-help-list`,children:b()})]})}var ls={Icon:Oo,Root:e=>r(qd,{...e})};var cs=h.cssPrefix;function Zo({onClick:e,children:t,testid:n}){return e?r("button",{type:"button",class:`${cs}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):r("div",{class:`${cs}-home-card`,"data-testid":n,children:t})}var V=h.cssPrefix,ds=M.scope("home");function Xd(e){let t=e.options.userContext?.name,n=e.config.greetingText;return n?{title:t?n.replace("{name}",t):n.replace(/\s*\{name\}\s*/," ").trim(),subtitle:e.strings.homeGreetingLead}:t?{title:e.strings.homeGreetingNamed.replace("{name}",t),subtitle:e.strings.homeGreetingLead}:{title:e.strings.homeGreeting}}var jd=(e,t)=>t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title});function Yd(e){let{transport:t,strings:n,config:o,nav:i,panelProps:a}=e,[s,l]=k(null),[c,u]=k([]),p=o.contentTags?.join(",");w(()=>{if(!o.showRecentMessages)return;let m=!1;return t.listSessions({limit:1}).then(y=>!m&&l(y.sessions?.[0]??null)).catch(y=>!m&&ds.warn("listSessions (home) failed",{err:y})),()=>{m=!0}},[t,o.showRecentMessages]),w(()=>{if(!o.contentTags?.length)return;let m=!1;return t.listContent({tags:o.contentTags,limit:6}).then(y=>!m&&u(y.items??[])).catch(y=>!m&&ds.warn("listContent (home) failed",{err:y})),()=>{m=!0}},[t,p]);let d=Xd(e),_=o.userAvatars??[],f=o.status,v=o.contentBlockTitle?tn(n,o.contentBlockTitle):n.homeContentTitle;return r("div",{class:`${V}-module ${V}-home`,"data-testid":P.homeView,children:r("div",{class:`${V}-home-scroll`,children:[r("div",{class:`${V}-home-hero`,children:[r("div",{class:`${V}-home-hero-top`,children:[o.brandName?r("span",{class:`${V}-home-brand`,"data-testid":P.homeBrand,children:o.brandName}):r("span",{class:`${V}-home-brand-spacer`,"aria-hidden":"true"}),r("div",{class:`${V}-home-hero-actions`,children:[_.length>0?r("div",{class:`${V}-home-avatars`,children:_.map(m=>r("span",{class:`${V}-home-avatar`,title:m.role?`${m.name} \xB7 ${m.role}`:m.name,children:m.avatar?r("img",{src:m.avatar,alt:"",loading:"lazy"}):r("span",{children:kn(m.name)})},m.name))}):null,a.onClose?r("button",{type:"button",class:`${V}-icon-btn ${V}-home-close`,onClick:a.onClose,"aria-label":n.close,title:n.close,children:r(fe,{})}):null]})]}),o.showGreeting!==!1?r(te,{children:[r("h1",{class:`${V}-home-greeting`,"data-testid":P.homeGreeting,children:d.title}),d.subtitle?r("p",{class:`${V}-home-lead`,children:d.subtitle}):null]}):null]}),r("div",{class:`${V}-home-cards`,children:[o.showSearchBar!==!1?r(os,{placeholder:n.homeSearchPlaceholder,onActivate:()=>i.switchToLayout("help")}):null,s?r(Zo,{onClick:()=>i.selectSession(s.sessionId),testid:P.homeRecent,children:r("div",{class:`${V}-home-recent-row`,"data-unread":(s.unreadCount??0)>0?"true":void 0,children:[r("span",{class:`${V}-home-recent-avatar`,"aria-hidden":"true",children:r(kt,{})}),r("span",{class:`${V}-home-recent-body`,children:[r("span",{class:`${V}-home-recent-title`,children:s.title}),s.preview?r("span",{class:`${V}-home-recent-preview`,children:s.preview}):null]}),(s.unreadCount??0)>0?r("span",{class:`${V}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,f?r(Zo,{onClick:f.url?()=>i.push({kind:"iframe",url:f.url,title:f.text}):void 0,children:r("div",{class:`${V}-home-status`,"data-level":f.level??"operational",children:[r("span",{class:`${V}-home-status-icon`,"aria-hidden":"true",children:r(ca,{})}),r("span",{class:`${V}-home-status-text`,children:f.text})]})}):null,c.length>0?r("section",{class:`${V}-home-content`,children:[r("div",{class:`${V}-home-content-title`,children:v}),r("div",{class:`${V}-home-content-list`,children:c.map(m=>r(Ln,{title:m.title,subtitle:m.description,onClick:()=>jd(i,m),testid:de(P.homeContentRow,m.id)},m.id))})]}):null]})]})})}var _s={Icon:da,Root:e=>r(Yd,{...e})};var Ae=h.cssPrefix,Jd=M.scope("news");function Qd({transport:e,strings:t,config:n,nav:o,panelProps:i}){let a=n.contentTags,[s,l]=k("loading"),[c,u]=k(t.errorGeneric),[p,d]=k([]),[_,f]=k(0);w(()=>{let m=!1;return l("loading"),e.listContent({tags:a,sortBy:"publishedAt",sortOrder:"desc"}).then(y=>{m||(d(y.items??[]),l("loaded"))}).catch(y=>{m||(Jd.warn("listContent (news) failed",{err:y}),u(We(y,t)),l("error"))}),()=>{m=!0}},[e,a,_]);function v(){return s==="loading"?r(ve,{message:t.newsLoading,strings:t}):s==="error"?r(ve,{tone:"error",message:c,onRetry:()=>f(m=>m+1),strings:t}):p.length===0?r(ve,{message:t.newsEmpty,strings:t}):r("div",{class:`${Ae}-news-list`,children:p.map(m=>r("button",{type:"button",class:`${Ae}-news-card`,onClick:()=>o.push({kind:"content",id:m.id,title:m.title}),"data-testid":de(P.newsItem,m.id),children:[m.image?r("img",{class:`${Ae}-news-hero`,src:m.image,alt:"",loading:"lazy"}):null,r("span",{class:`${Ae}-news-body`,children:[m.tags&&m.tags.length>0?r("span",{class:`${Ae}-news-tags`,children:m.tags.map(y=>r("span",{class:`${Ae}-news-tag`,children:y},y))}):null,r("span",{class:`${Ae}-news-title`,children:m.title}),m.description?r("span",{class:`${Ae}-news-summary`,children:m.description}):null]})]},m.id))})}return r("div",{class:`${Ae}-module`,children:[r(Rn,{title:t.newsTitle,onClose:i.onClose,closeLabel:t.close}),r("div",{class:`${Ae}-module-scroll`,children:v()})]})}var us={Icon:_a,Root:e=>r(Qd,{...e})};var Nn={chat:ns,home:_s,help:ls,news:us};var At=h.cssPrefix;function ps({modules:e,activeTab:t,strings:n,unreadCount:o,onSelect:i}){return r("nav",{class:`${At}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let s=Nn[a.layout].Icon,l=a.id===t,c=a.layout==="chat"&&o>0?o>9?"9+":String(o):null;return r("button",{type:"button",role:"tab","aria-selected":l,class:`${At}-tab`,onClick:()=>i(a.id),"data-testid":de(P.tab,a.id),children:[r("span",{class:`${At}-tab-icon`,"aria-hidden":"true",children:[r(s,{}),c?r("span",{class:`${At}-tab-badge`,"data-testid":P.tabBadge,children:c}):null]}),r("span",{class:`${At}-tab-label`,children:tn(n,a.label)})]},a.id)})})}var fs=h.cssPrefix,Zd="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function gs({url:e,title:t,strings:n,onBack:o,onClose:i}){return r("div",{class:`${fs}-module`,children:[r(Mn,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:o,onClose:i,closeLabel:n.close}),r("iframe",{class:`${fs}-content-frame`,src:e,title:t||"content",sandbox:Zd,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var Xe=h.cssPrefix,e_=M.scope("content");function ms({id:e,title:t,transport:n,strings:o,onBack:i,onClose:a}){let[s,l]=k(null),[c,u]=k(!1),[p,d]=k(0),_=R(()=>{u(!1),l(null),d(v=>v+1)},[]);w(()=>{let v=!1;return n.listContent({ids:[e],limit:1}).then(m=>{if(v)return;let y=m.items[0];y?l(y):u(!0)}).catch(m=>{v||(e_.warn("listContent (reader) failed",{err:m}),u(!0))}),()=>{v=!0}},[n,e,p]);function f(){return c?r(ve,{tone:"error",message:o.errorGeneric,onRetry:_,strings:o}):s===null?r(ve,{message:o.contentLoading,strings:o}):r("article",{class:`${Xe}-content`,"data-testid":P.contentView,children:[s.image?r("img",{class:`${Xe}-content-hero`,src:s.image,alt:"",loading:"lazy"}):null,s.description?r("p",{class:`${Xe}-content-subtitle`,children:s.description}):null,s.tags&&s.tags.length>0?r("span",{class:`${Xe}-news-tags`,children:s.tags.map(v=>r("span",{class:`${Xe}-news-tag`,children:v},v))}):null,r(Na,{text:s.content??""})]})}return r("div",{class:`${Xe}-module`,children:[r(Mn,{title:s?.title||t||o.moduleBack,backLabel:o.moduleBack,onBack:i,onClose:a,closeLabel:o.close,testid:P.backHeader}),r("div",{class:`${Xe}-module-scroll`,"data-testid":P.contentScroll,children:f()})]})}var er=h.cssPrefix;function hs({panelProps:e,enabledModules:t,nav:n,unreadCount:o,onSelectSession:i,onStartNewSession:a,onSetPanelSize:s}){let l=e.options,c=l.strings,u=O(null);w(()=>{let X=u.current;if(!X)return;let _e=wn(X),ee=J=>{J.key==="Escape"&&e.onClose?.()};return X.addEventListener("keydown",ee),()=>{_e(),X.removeEventListener("keydown",ee)}},[e.onClose]);let p=O(null),d=R(X=>{p.current?.attachFromDrop(X)},[]),{visible:_}=Cn({containerRef:u,onDrop:d});Pn(u.current,l.mode==="modal");let f=we(()=>n.sig.value).value,v=es(f),m=l.modules.byId[f.activeTab],y=v?.kind==="iframe"||v?.kind==="content",b=t.length>1&&(ts(f)||!y),S=O(null);w(()=>{if(y&&S.current===null)S.current=e.panelSize,e.panelSize==="normal"&&s("expanded");else if(!y&&S.current!==null){let X=S.current;S.current=null,s(X)}},[y]);let I={push:n.push,pop:n.pop,switchTab:n.switchTab,switchToLayout:X=>{let _e=t.find(ee=>ee.layout===X);_e&&n.switchTab(_e.id)},selectSession:i,startNewSession:a},L=X=>({options:l,transport:e.transport,strings:c,config:X,visitorId:e.visitorId,nav:I,panelProps:e}),U;if(v?.kind==="iframe")U=r(gs,{url:v.url,title:v.title,strings:c,onBack:n.pop,onClose:e.onClose});else if(v?.kind==="content")U=r(ms,{id:v.id,title:v.title,transport:e.transport,strings:c,onBack:n.pop,onClose:e.onClose});else if(m?.layout==="chat")U=r(Jo,{...e,containerEl:u.current,dragOver:_,composerAttachApiRef:p});else if(m){let X=Nn[m.layout].Root;U=X?r(X,{...L(m)},m.id):null}else U=null;return r("div",{ref:u,class:`${er}-panel ${er}-messenger`,role:"dialog","aria-modal":"false","aria-label":c.panelTitle,style:{position:"relative"},"data-testid":P.messengerHome,children:[r("div",{class:`${er}-messenger-body`,children:U}),b?r(ps,{modules:t,activeTab:f.activeTab,strings:c,unreadCount:o,onSelect:n.switchTab}):null,r(Qo,{poweredBy:l.poweredBy}),l.size.resize?.enabled&&!(m?.layout==="chat"&&!v)?r(yn,{panelEl:u.current,resize:l.size.resize,position:l.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:c}):null]})}var Tt=h.cssPrefix;function vs({strings:e,onClose:t}){return r("div",{class:`${Tt}-panel ${Tt}-modules-empty`,role:"dialog","aria-label":e.panelTitle,"data-testid":P.modulesEmpty,children:[t?r("button",{type:"button",class:`${Tt}-icon-btn ${Tt}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:r(fe,{})}):null,r("p",{class:`${Tt}-modules-empty-text`,children:e.modulesEmpty})]})}async function bs(e,t,n,o){for(let i=0;i<e.length;i++){if(o.aborted)return;let a=e[i],s=t[i];!a||!s||await t_(a,s.text,n,o)}}function t_(e,t,n,o){return new Promise(i=>{let a=e.partsSig.value[0];if(!a||a.kind!=="text"){i();return}let s=()=>{a.textSig.value=t,a.doneSig.value=!0,e.status="complete",i()};if(typeof requestAnimationFrame>"u"){s();return}let l=t.length/Math.max(1,n)*1e3,c=performance.now(),u=d=>{if(o.aborted)return s();let _=l===0?1:Math.min(1,(d-c)/l);if(a.textSig.value=t.slice(0,Math.floor(_*t.length)),_>=1)return s();p=requestAnimationFrame(u)},p=requestAnimationFrame(u);o.addEventListener("abort",()=>{cancelAnimationFrame(p),s()},{once:!0})})}function xs({callout:e,persistence:t}){let n=e?.text??"",o=e?.persistent??!0,[i,a]=k(()=>o?!1:t.loadCalloutDismissed(n));w(()=>{a(o?!1:t.loadCalloutDismissed(n))},[n,o,t]);let s=R(()=>{a(!0),o||t.saveCalloutDismissed(n)},[t,n,o]);return{dismissed:i,dismissCallout:s}}var K=M.scope("app"),tr=h.cssPrefix;function ys({options:e,hostElement:t,bus:n}){let[o]=k(()=>St(e.widgetId,e.storage)),[i,a]=k(()=>o.getVisitorId()),s=o.loadUserPrefs(),[l,c]=k(()=>s.locale??e.locale),[u,p]=k(()=>s.themeMode??e.themeMode),d=vt(o.loadSessionId()),_=vt([]),f=vt(0),[v,m]=k(!1);function y(){let g=e.modules.list,x=new Set(g.map(ae=>ae.id)),z=o.loadActiveModule();return z&&x.has(z)?z:g[0]?.id??""}function b(){return e.modules.list.find(g=>g.layout==="chat")?.id}let S=O();if(!S.current){let g=e.modules.list.map(x=>x.id);S.current=Qa(y(),g,x=>o.saveActiveModule(x))}let I=S.current,[L,U]=k(!1),X=e.mode==="standalone"||e.mode==="inline",_e=O(yt(e,ot(),o.loadPanelOpen(),o.loadPanelSize())),[ee,J]=k(_e.current.panelOpen),re=O(!1),[Be,je]=k(!1),{dismissed:E,dismissCallout:$}=xs({callout:e.launcher.callout,persistence:o}),j=e.launcher.callout?.persistent??!0,ce=R(()=>{K.info("calloutDismiss"),n.emit("calloutDismiss",void 0),$()},[n,$]),[D,be]=k(_e.current.panelSize),xe=O(!1),[$n,Bn]=k("chat"),[Ts,ct]=k(!0),[Ue,It]=k(!1),[Is,ir]=k(null),[Un,Rt]=k([]),[Mt,Lt]=k(null),zn=O(null),[Rs,Ms]=k(void 0),[Ls,Ns]=k(void 0),[Os,Ds]=k(()=>o.loadSidebarCollapsed()??!1),[ie]=k(()=>new un({baseUrl:e.baseUrl,auth:Si({publicKey:e.publicKey,aiAgentDeploymentId:e.aiAgentDeploymentId,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints})),[Ne]=k(()=>new pn(_)),[Y]=k(()=>new vn(e.sound,e.haptics)),Oe=R(g=>{o.patchUserPrefs(g),ie.saveUserPrefs(o.loadUserPrefs()).catch(x=>{K.warn("saveUserPrefs failed",{err:x})})},[o,ie]);w(()=>{s.soundMuted!==void 0&&Y.setMuted(s.soundMuted)},[]),w(()=>{t.dataset.theme=u},[t,u,e]),w(()=>{Y.update(e.sound,e.haptics)},[Y,e.sound,e.haptics]),w(()=>()=>Y.destroy(),[Y]),w(()=>{let g=!0;return Y.mutedSig.subscribe(x=>{if(g){g=!1;return}Oe({soundMuted:x})})},[Y,Oe]),w(()=>{xe.current||!e.size.initialSize||(xe.current=!0,!o.loadPanelSize()&&be(To(e.mode,e.size,ot())))},[e.mode,e.size,o]),w(()=>{if(!L||re.current)return;re.current=!0;let g=yt(e,ot(),o.loadPanelOpen(),o.loadPanelSize());J(g.panelOpen),be(g.panelSize)},[L,e,o]);let ar=O(!1);w(()=>{!L||ar.current||(ar.current=!0,I.reset(y()))},[L]);let sr=R(g=>{if(!g||g.length===0)return;let{animation:x,speed:z}=e.welcome;if(x==="instant"){_.value=g.map(Oi);return}zn.current?.abort();let ae=new AbortController;zn.current=ae;let oe=g.map(Ni);_.value=oe,bs(oe,g,z,ae.signal)},[_,e.welcome]),Fn=O(0),dt=R(async({newConversation:g})=>{let x=++Fn.current,z=()=>x!==Fn.current,ae=d.value,oe=g||!ae?ke():ae;oe!==ae&&(d.value=oe,o.saveSessionId(oe));let A;try{A=await ie.startSession({visitorId:i,sessionId:oe,userPrefs:o.loadUserPrefs(),locale:e.locale})}catch(Pe){if(z())return;n.emit("error",Pe),e.onError?.(Pe),g||U(!0);return}if(z())return;if(A.visitorId&&A.visitorId!==i&&(K.info("visitor rebound",{previous:i,current:A.visitorId,reason:A.rebind?.visitorId}),o.setVisitorId(A.visitorId),a(A.visitorId),n.emit("visitorRebound",{previous:i,current:A.visitorId,reason:A.rebind?.visitorId})),A.sessionId&&A.sessionId!==oe&&(K.info("session rebound",{previous:oe,current:A.sessionId,reason:A.rebind?.sessionId}),n.emit("sessionRebound",{previous:oe,current:A.sessionId,reason:A.rebind?.sessionId})),A.agent&&ir(A.agent),A.welcome?.suggestions&&Rt(A.welcome.suggestions),e.mode==="page"&&(A.site&&di(A.site)?Ms(A.site):A.site&&K.warn("invalid site config, using fallback",{site:A.site}),A.blocks&&_i(A.blocks)?Ns(A.blocks):A.blocks&&K.warn("invalid blocks config, using fallback",{blocks:A.blocks})),A.userPrefs&&!g&&(o.saveUserPrefs(A.userPrefs),A.userPrefs.locale&&c(A.userPrefs.locale),A.userPrefs.soundMuted!==void 0&&Y.setMuted(A.userPrefs.soundMuted),A.userPrefs.themeMode&&p(A.userPrefs.themeMode)),!g&&ae&&A.sessionId===ae){m(!0);try{let Pe=A.messages?.length?{sessionId:ae,canContinue:A.canContinue??!0,messages:A.messages}:await ie.loadSession(ae);if(z())return;let pe=(Pe.messages??[]).map(Lo);pe.length&&(_.value=pe),ct(Pe.canContinue??!0),Rt(Pe.suggestions??[])}catch(Pe){if(z())return;K.warn("loadSession failed; resetting sessionId",{err:Pe,sessionId:ae}),d.value=void 0,o.saveSessionId(void 0)}finally{z()||m(!1)}}else d.value=A.sessionId,o.saveSessionId(A.sessionId),sr(A.welcome?.messages);g||(n.emit("sessionStarted",A),U(!0))},[ie,i,o,e,n,_,d,Y,sr]),_t=JSON.stringify(e.userContext??null),Hs=JSON.stringify(e.pageContext??null);w(()=>{ie.setContext(e.userContext,n_(e.pageContext))},[ie,_t,Hs]);let $s=R(async g=>{let x=null;try{for await(let z of g.iter){if(!x){x=Mo(),Ne.attach(x),_.value=[..._.value,x],It(!0),Lt(()=>g.cancel);let ae=b();ae&&I.switchTab(ae),K.info("resumed in-flight reply on mount")}Ne.apply(z.chunk),z.chunk.type==="finish"&&z.chunk.canContinue===!1&&ct(!1)}x&&(x.status="complete",Y.play("messageReceived"),nr(n,e,"assistant",No(x)))}catch(z){x&&(x.status="error",x.errorText=We(z,e.strings),Y.play("error")),K.debug("mount resume ended without completing",{err:z})}finally{x&&(Ne.detach(),It(!1),Lt(null),_.value=[..._.value])}},[Ne,_,Y,n,e,I]);w(()=>{dt({newConversation:!1});let g=d.value,x=null;return g&&(ie.primeIdentity(i,g),x=ie.resumeStream(),$s(x)),()=>{Fn.current++,x?.cancel()}},[]);let lr=O(_t);w(()=>{!L||lr.current===_t||(lr.current=_t,dt({newConversation:!1}))},[_t,L,dt]),w(()=>{dn(t,_n(e.mode,D,ee))},[t,ee,D,e.mode]),w(()=>{if(e.mode!=="modal"||!ee)return;let g=x=>{x.composedPath().some(oe=>oe instanceof HTMLElement&&oe.classList.contains(`${h.cssPrefix}-panel`))||J(!1)};return t.addEventListener("click",g),()=>t.removeEventListener("click",g)},[t,ee,e.mode]),w(()=>{if(e.mode!=="drawer"||!ee)return;let g=x=>{x.key==="Escape"&&J(!1)};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[ee,e.mode]);let cr=R(async(g,x)=>{if(K.info("send",{textLen:g.length,attachments:x.length,streaming:Ue}),Ue)return;n.emit("send",{text:g,attachmentCount:x.length}),Un.length>0&&Rt([]);let z=await r_(ie,x,pe=>{K.warn("upload failed",{err:pe}),n.emit("error",pe),e.onError?.(pe)});Y.unlock(),Y.play("messageSent");let ae=Li(g,z),oe=Mo();_.value=[..._.value,ae,oe],Ne.attach(oe),nr(n,e,"user",g);let A=d.value??ke();d.value||(d.value=A,o.saveSessionId(A));let gr=Ti({messages:_.value.slice(0,-1).map(Di),sessionId:A,tools:e.features.tools,responseMode:e.responseMode,visitorId:i,userPrefs:o.loadUserPrefs()});It(!0);let Pe=ie.sendMessage(gr);Lt(()=>Pe.cancel);try{for await(let pe of Pe.iter)Ne.apply(pe.chunk),pe.chunk.type==="finish"&&pe.chunk.canContinue===!1&&ct(!1);oe.status="complete",Y.play("messageReceived"),nr(n,e,"assistant",No(oe))}catch(pe){oe.status="error",oe.errorText=We(pe,e.strings),Y.play("error"),n.emit("error",pe),e.onError?.(pe)}finally{Ne.detach(),It(!1),Lt(null),_.value=[..._.value]}},[Ue,ie,Ne,_,d,e,n,Un.length,Y,o,i]),Bs=R(()=>{K.info("stop"),n.emit("stop",void 0),Mt?.()},[Mt,n]),Us=R(()=>{Y.toggleMuted();let g=Y.mutedSig.value;K.info("soundToggle",{muted:g}),n.emit("soundToggle",{muted:g})},[Y,n]),ut=R(()=>{if(ya(e.mode,D)==="exit-fullscreen"){K.info("close \u2192 exit-fullscreen",{mode:e.mode}),be("normal"),n.emit("fullscreen",!1);return}K.info("close \u2192 panel closed",{mode:e.mode}),J(!1),o.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,o,D]),Ye=R(()=>{e.modules.list.some(g=>g.layout==="chat")&&ie.listSessions({limit:50}).then(g=>{f.value=g.sessions.reduce((x,z)=>x+(z.unreadCount??0),0)}).catch(g=>K.debug("refreshUnread failed (non-fatal)",{err:g}))},[ie,e.modules,f]),dr=O(!1);w(()=>{!L||dr.current||(dr.current=!0,Ye())},[L,Ye]);let Wn=R(()=>{K.info("open",{mode:e.mode}),Y.unlock(),je(!0),J(!0),o.savePanelOpen(!0),!E&&!j&&ce(),setTimeout(()=>je(!1),o_),Ye(),n.emit("open",void 0),e.onOpen?.()},[n,e,Y,o,E,j,ce,Ye]),Kn=R(()=>{K.info("clear \u2192 new conversation",{wasStreaming:Ue}),n.emit("clear",void 0),Ue&&Mt?.(),zn.current?.abort(),_.value=[],d.value=void 0,o.clearSession(),ct(!0),dt({newConversation:!0})},[Ue,Mt,_,d,o,dt,n]),Gn=R(()=>{Kn(),Bn("chat");let g=e.modules.list.find(x=>x.layout==="chat")?.id;g&&I.switchTab(g)},[Kn,I,e]),Vn=R(()=>{let g=D==="expanded"?"normal":"expanded";K.info("expand",{from:D,expanded:g==="expanded"}),be(g),o.savePanelSize(g),n.emit("expand",g==="expanded")},[n,D,o]),qn=R(()=>{let g=D==="fullscreen"?"normal":"fullscreen";K.info("fullscreen",{from:D,fullscreen:g==="fullscreen"}),be(g),o.savePanelSize(g),n.emit("fullscreen",g==="fullscreen")},[n,D,o]),Xn=R(()=>{if(!e.popOutUrl)return;let g=new URL(e.popOutUrl);d.value&&g.searchParams.set("chat",d.value),e.widgetId!=="default"&&g.searchParams.set("widgetId",e.widgetId),K.info("popOut",{url:g.toString()}),window.open(g.toString(),"_blank","noopener,noreferrer"),n.emit("popOut",void 0)},[n,d,e.popOutUrl,e.widgetId]),zs=R(()=>{Bn(g=>{let x=g==="history"?"chat":"history";return K.info("toggleHistory",{view:x}),n.emit("toggleHistory",{view:x}),x})},[n]),Fs=R(g=>{K.info("localeChange",{locale:g}),c(g),Oe({locale:g}),n.emit("localeChange",g)},[Oe,n]),Ws=R(g=>{K.info("themeChange",{mode:g}),p(g),t.dataset.theme=g,Oe({themeMode:g}),n.emit("themeChange",g)},[t,Oe,n]),Ks=R(()=>{Ds(g=>{let x=!g;return K.info("sidebarToggle",{collapsed:x}),o.saveSidebarCollapsed(x),n.emit("sidebarToggle",{collapsed:x}),x})},[o,n]),Gs=R(g=>{K.info("resize",g),Oe({widgetSize:g}),n.emit("resize",g)},[Oe,n]),jn=R(async g=>{K.info("selectChat",{sessionId:g}),n.emit("selectChat",{sessionId:g});try{let x=await ie.loadSession(g),z=x.messages.map(Lo);_.value=z,d.value=x.sessionId,o.saveSessionId(x.sessionId),x.agent&&ir(x.agent),ct(x.canContinue),Rt(x.suggestions??[]),Bn("chat"),await ie.markRead(g),Ye()}catch(x){n.emit("error",x),e.onError?.(x)}},[ie,_,d,n,e,o,Ye]);w(()=>pi(t,{open:Wn,close:ut,expand:Vn,fullscreen:qn,popout:Xn}),[t,Wn,ut,Vn,qn,Xn]);let ye=ge(()=>Eo(e,l,u),[e,l,u]),_r={options:ye,transport:ie,feedback:Y,bus:n,view:$n,canSend:Ts,isStreaming:Ue,loadingMessages:v,messagesSig:_,agent:Is,suggestions:Un,initialWidgetSize:s.widgetSize??null,visitorId:i,onClose:ut,onClear:Kn,onExpand:Vn,onFullscreen:qn,onPopOut:Xn,onSoundToggle:Us,onToggleHistory:zs,onSelectHistoryChat:jn,onNewChat:Gn,onLocaleChange:Fs,onThemeChange:Ws,onWidgetSizeChange:Gs,onSend:cr,onStop:Bs,onSuggestion:g=>{let x=g.text??g.label;K.info("suggestion",{text:x}),n.emit("suggestion",{text:x}),cr(x,[])}},Vs=g=>{jn(g);let x=b();x&&I.switchTab(x)};if(!L)return null;let pt=ye.modules.list,Yn=g=>{let x=Sn("close",ye.mode,g);return pt.length===0?r(vs,{strings:ye.strings,onClose:x?ut:void 0}):pt.length===1&&pt[0]?.layout==="chat"?r(qa,{..._r,panelSize:g}):r(hs,{panelProps:{..._r,panelSize:g,onClose:x?ut:void 0},enabledModules:pt,nav:I,unreadCount:f.value,onSelectSession:Vs,onStartNewSession:Gn,onSetPanelSize:be})};if(e.mode==="page"){let g=z=>{jn(z.sessionId)},x=pt.some(z=>z.layout==="chat");return r("div",{class:`${tr}-anchor`,children:r(Ya,{site:Rs,blocks:Ls,transport:ie,strings:ye.strings,visitorId:i,showConversations:x,onSelectChat:g,onNewChat:Gn,sidebarCollapsed:Os,onToggleSidebarCollapsed:Ks,children:Yn("fullscreen")})})}if(X){let g=e.mode==="standalone"?"fullscreen":D;return r("div",{class:`${tr}-anchor`,children:Yn(g)})}let ur=e.mode==="drawer",pr=!(e.mode==="modal")&&!e.launcher.hidden&&(!ee||Be),fr=pr&&!Be&&!E&&!ur?ye.launcher.callout:null;return r("div",{class:`${tr}-anchor`,"data-launcher-size":ye.launcher.size,children:[ee?Yn(D):null,pr?r(ha,{onToggle:Wn,launcher:ye.launcher,strings:ye.strings,leaving:Be,edgeTab:ur}):null,fr?r(va,{callout:fr,launcherPosition:ye.position,closeLabel:ye.strings.close,onDismiss:ce}):null]})}function n_(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var o_=120;async function r_(e,t,n){let o=[];for(let i of t)try{let{id:a,url:s}=await e.uploadFile(i.file);o.push({id:a,name:i.name,mediaType:i.mediaType,size:i.size,url:s})}catch(a){n(a)}return o}function nr(e,t,n,o){let i={role:n,text:o};e.emit("message",i),t.onMessage?.(i)}var i_=M.scope("error-boundary"),On=class extends He{constructor(){super(...arguments);F(this,"state",{crashed:!1})}componentDidCatch(n,o){i_.error("widget render crashed",{error:n,componentStack:o?.componentStack}),this.setState({crashed:!0}),this.props.onError(n,o?.componentStack)}render(){return this.state.crashed?this.props.fallback:this.props.children}};var a_=M.scope("iframe"),s_='<!doctype html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:transparent;overflow:hidden}</style></head><body></body></html>';function ws(e,t,n="closed",o="floating",i=null){a_.debug("createIframeMount",{position:t,initialMode:n,layoutMode:o,hasTarget:!!i});let a=document.createElement("iframe");a.title=`${h.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),Ss(a,t,n,o),(o==="inline"&&i?i:document.body).appendChild(a);let l=a.contentDocument;if(!l)throw new Error("iframe contentDocument unavailable (cross-origin?)");l.open(),l.write(s_),l.close();let c=cn({...e,target:l.body}),u=new MutationObserver(()=>{Ss(a,t,c.hostElement.dataset.mode??"closed",o)});return u.observe(c.hostElement,{attributes:!0,attributeFilter:["data-mode"]}),{...c,iframeElement:a,destroy(){u.disconnect(),c.destroy(),a.remove()}}}var or="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",Ps={closed:{w:"88px",h:"88px"},expanded:{w:"min(calc(100vw - 32px), 680px)",h:"min(calc(100vh - 32px), 860px)"},open:{w:"min(calc(100vw - 32px), 440px)",h:"min(calc(100vh - 32px), 700px)"}};function Ss(e,t,n,o){if(n==="fullscreen"||o==="standalone"){e.style.cssText=`${or}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(o==="inline"){e.style.cssText=`${or}position:static;display:block;width:100%;height:100%;`;return}let i=t.startsWith("top-")?"top":"bottom",a=t.endsWith("-left")?"left":"right",{w:s,h:l}=Ps[n]??Ps.open;e.style.cssText=`${or}position:fixed;${i}:16px;${a}:16px;width:${s};height:${l};`}var Dn=class{constructor(){F(this,"handlers",new Map)}on(t,n){let o=this.handlers.get(t);return o||(o=new Set,this.handlers.set(t,o)),o.add(n),()=>this.handlers.get(t)?.delete(n)}emit(t,n){let o=this.handlers.get(t);if(o)for(let i of o)try{i(n)}catch{}}clear(){this.handlers.clear()}};var l_=M.scope("hooks"),Hn="*",rr=new Set;function ks(e,t,n){let o={widgetId:e,event:t,listener:n};return rr.add(o),()=>{rr.delete(o)}}function c_(e,t,n){let o=[...rr];for(let i of o)if(d_(i.widgetId,e.widgetId)&&!(i.event!==Hn&&i.event!==t))try{i.listener(e,t,n)}catch(a){l_.warn("hook listener threw",{event:t,error:a})}}function Es(e,t){let n=[];for(let o of __)n.push(t.on(o,i=>{c_(e,o,i)}));return()=>{for(let o of n)o()}}function d_(e,t){return e===Hn||e===t}var __=["open","close","expand","fullscreen","popOut","resize","message","send","stop","clear","selectChat","suggestion","toggleHistory","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","soundToggle","sidebarToggle","calloutDismiss","error","sessionStarted","visitorRebound","sessionRebound"];var Le=new Map;function Cs(e){e.debug!==void 0&&an(e.debug);let t=M.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=e,o=bt(n),i=o.widgetId,a=Le.get(i);a&&(t.debug("destroy existing instance at slot",{widgetId:i}),a.destroy());let s=As(o),l=o.iframe?ws({position:ln(o.mode)},o.position,s,o.mode,e.target??null):cn({position:ln(o.mode),target:e.target??null}),c=St(o.widgetId,o.storage),u=()=>{let b=c.loadUserPrefs().themeMode;Pi(l.hostElement,b?{...o,themeMode:b}:o)};u(),dn(l.hostElement,s),l.hostElement.dataset.widgetId=i;let p=new Dn,d=b=>{p.emit("error",b),o.onError?.(b)},_=()=>{ao(Wt(On,{onError:d},Wt(ys,{bus:p,hostElement:l.hostElement,options:o})),l.appRoot)};_(),p.on("sessionStarted",b=>{b.config&&(n=Co(n,b.config),o=bt(n),yi(l.hostElement,ln(o.mode)),u(),_())});let f=l.hostElement,v=null,m=b=>{b.debug!==void 0&&an(b.debug),n={...n,...b},o=bt(n),u(),_()},y={widgetId:i,open:()=>xt(f,"open"),close:()=>xt(f,"close"),expand:()=>xt(f,"expand"),popOut:()=>xt(f,"popout"),on:(b,S)=>p.on(b,S),update:b=>{t.debug("update",{patch:b}),m(b)},setUserContext:b=>{t.debug("setUserContext",{keys:Object.keys(b)}),m({userContext:{...n.userContext,...b}})},clearUserContext:()=>{t.debug("clearUserContext"),m({userContext:void 0})},setPageContext:b=>{t.debug("setPageContext",{keys:Object.keys(b)}),m({pageContext:{...n.pageContext,...b}})},clearPageContext:()=>{t.debug("clearPageContext"),m({pageContext:void 0})},setDebug:b=>{an(b),t.info("debug level set",{level:bo()})},debugLevel:()=>bo(),onLog:b=>ei(b),destroy:()=>{t.info("destroy",{widgetId:i}),v?.(),p.clear(),ao(null,l.appRoot),l.destroy(),Le.get(i)===y&&Le.delete(i)}};return v=Es(y,p),Le.set(i,y),y}function u_(e){let t=e.widgetId??"default",n=Le.get(t);return n?(n.update(e),n):Cs(e)}function p_(e){if(e!==void 0){Le.get(e)?.destroy();return}let t=[...Le.values()];for(let n of t)n.destroy()}function f_(e="default"){return Le.get(e)??null}function g_(){return[...Le.values()]}function m_(e,t,n){return ks(e,t,n)}var h_="0.1.0",v_=h;function As(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=St(e.widgetId,e.storage),{panelOpen:n,panelSize:o}=yt(e,ot(),t.loadPanelOpen(),t.loadPanelSize());return _n(e.mode,o,n)}
|
|
40
40
|
//# sourceMappingURL=elements.cjs.js.map
|