@helpai/elements 0.36.1 → 0.37.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.esm.js CHANGED
@@ -1,14 +1,14 @@
1
- var sc=Object.defineProperty;var lc=(e,t,n)=>t in e?sc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var j=(e,t,n)=>lc(e,typeof t!="symbol"?t+"":t,n);var Tn,q,mi,qo,Qe,_i,gi,hi,Wo,yn,Kt,vi,jo,Go,Vo,cc,wn={},kn=[],dc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,En=Array.isArray;function Ve(e,t){for(var n in t)e[n]=t[n];return e}function Xo(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function In(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?Tn.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 Sn(e,s,o,i,null)}function Sn(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??++mi,__i:-1,__u:0};return i==null&&q.vnode!=null&&q.vnode(a),a}function ne(e){return e.children}function Ze(e,t){this.props=e,this.context=t}function mt(e,t){if(t==null)return e.__?mt(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"?mt(e):null}function _c(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],i=[],a=Ve({},t);a.__v=t.__v+1,q.vnode&&q.vnode(a),Jo(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??mt(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,yi(o,a,i),t.__e=t.__=null,a.__e!=n&&bi(a)}}function bi(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}),bi(e)}function ui(e){(!e.__d&&(e.__d=!0)&&Qe.push(e)&&!Cn.__r++||_i!=q.debounceRendering)&&((_i=q.debounceRendering)||gi)(Cn)}function Cn(){try{for(var e,t=1;Qe.length;)Qe.length>t&&Qe.sort(hi),e=Qe.shift(),t=Qe.length,_c(e)}finally{Qe.length=Cn.__r=0}}function xi(e,t,n,o,i,a,s,l,c,d,u){var _,g,p,m,h,v,E,S=o&&o.__k||kn,B=t.length;for(c=uc(n,t,S,c,B),_=0;_<B;_++)(p=n.__k[_])!=null&&(g=p.__i!=-1&&S[p.__i]||wn,p.__i=_,v=Jo(e,p,g,i,a,s,l,c,d,u),m=p.__e,p.ref&&g.ref!=p.ref&&(g.ref&&Yo(g.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),(E=!!(4&p.__u))||g.__k===p.__k?(c=Pi(p,c,e,E),E&&g.__e&&(g.__e=null)):typeof p.type=="function"&&v!==void 0?c=v:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function uc(e,t,n,o,i){var a,s,l,c,d,u=n.length,_=u,g=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]=Sn(null,s,null,null,null):En(s)?s=e.__k[a]=Sn(ne,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=Sn(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,c=a+g,s.__=e,s.__b=e.__b+1,l=null,(d=s.__i=pc(s,n,c,_))!=-1&&(_--,(l=n[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(i>u?g--:i<u&&g++),typeof s.type!="function"&&(s.__u|=4)):d!=c&&(d==c-1?g--:d==c+1?g++:(d>c?g--:g++,s.__u|=4))):e.__k[a]=null;if(_)for(a=0;a<u;a++)(l=n[a])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=mt(l)),wi(l,l));return o}function Pi(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=Pi(i[a],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=mt(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function pc(e,t,n,o){var i,a,s,l=e.key,c=e.type,d=t[n],u=d!=null&&(2&d.__u)==0;if(d===null&&l==null||u&&l==d.key&&c==d.type)return n;if(o>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((d=t[s=i>=0?i--:a++])!=null&&(2&d.__u)==0&&l==d.key&&c==d.type)return s}return-1}function pi(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||dc.test(t)?n:n+"px"}function Pn(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||pi(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||pi(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(vi,"$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[Kt]=o[Kt]:(n[Kt]=jo,e.addEventListener(t,a?Vo:Go,a)):e.removeEventListener(t,a?Vo:Go,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 fi(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[yn]==null)t[yn]=jo++;else if(t[yn]<n[Kt])return;return n(q.event?q.event(t):t)}}}function Jo(e,t,n,o,i,a,s,l,c,d){var u,_,g,p,m,h,v,E,S,B,A,W,K,D,ue,z=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[l=t.__e=n.__e]),(u=q.__b)&&u(t);e:if(typeof z=="function")try{if(E=t.props,S=z.prototype&&z.prototype.render,B=(u=z.contextType)&&o[u.__c],A=u?B?B.props.value:u.__:o,n.__c?v=(_=t.__c=n.__c).__=_.__E:(S?t.__c=_=new z(E,A):(t.__c=_=new Ze(E,A),_.constructor=z,_.render=mc),B&&B.sub(_),_.state||(_.state={}),_.__n=o,g=_.__d=!0,_.__h=[],_._sb=[]),S&&_.__s==null&&(_.__s=_.state),S&&z.getDerivedStateFromProps!=null&&(_.__s==_.state&&(_.__s=Ve({},_.__s)),Ve(_.__s,z.getDerivedStateFromProps(E,_.__s))),p=_.props,m=_.state,_.__v=t,g)S&&z.getDerivedStateFromProps==null&&_.componentWillMount!=null&&_.componentWillMount(),S&&_.componentDidMount!=null&&_.__h.push(_.componentDidMount);else{if(S&&z.getDerivedStateFromProps==null&&E!==p&&_.componentWillReceiveProps!=null&&_.componentWillReceiveProps(E,A),t.__v==n.__v||!_.__e&&_.shouldComponentUpdate!=null&&_.shouldComponentUpdate(E,_.__s,A)===!1){t.__v!=n.__v&&(_.props=E,_.state=_.__s,_.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(te){te&&(te.__=t)}),kn.push.apply(_.__h,_._sb),_._sb=[],_.__h.length&&s.push(_);break e}_.componentWillUpdate!=null&&_.componentWillUpdate(E,_.__s,A),S&&_.componentDidUpdate!=null&&_.__h.push(function(){_.componentDidUpdate(p,m,h)})}if(_.context=A,_.props=E,_.__P=e,_.__e=!1,W=q.__r,K=0,S)_.state=_.__s,_.__d=!1,W&&W(t),u=_.render(_.props,_.state,_.context),kn.push.apply(_.__h,_._sb),_._sb=[];else do _.__d=!1,W&&W(t),u=_.render(_.props,_.state,_.context),_.state=_.__s;while(_.__d&&++K<25);_.state=_.__s,_.getChildContext!=null&&(o=Ve(Ve({},o),_.getChildContext())),S&&!g&&_.getSnapshotBeforeUpdate!=null&&(h=_.getSnapshotBeforeUpdate(p,m)),D=u!=null&&u.type===ne&&u.key==null?Si(u.props.children):u,l=xi(e,En(D)?D:[D],t,n,o,i,a,s,l,c,d),_.base=t.__e,t.__u&=-161,_.__h.length&&s.push(_),v&&(_.__E=_.__=null)}catch(te){if(t.__v=null,c||a!=null)if(te.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(ue=a.length;ue--;)Xo(a[ue]);Ko(t)}else t.__e=n.__e,t.__k=n.__k,te.then||Ko(t);q.__e(te,t,n)}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=fc(n.__e,t,n,o,i,a,s,c,d);return(u=q.diffed)&&u(t),128&t.__u?void 0:l}function Ko(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ko))}function yi(e,t,n){for(var o=0;o<n.length;o++)Yo(n[o],n[++o],n[++o]);q.__c&&q.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){q.__e(a,i.__v)}})}function Si(e){return typeof e!="object"||e==null||e.__b>0?e:En(e)?e.map(Si):e.constructor!==void 0?null:Ve({},e)}function fc(e,t,n,o,i,a,s,l,c){var d,u,_,g,p,m,h,v=n.props||wn,E=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(d=0;d<a.length;d++)if((p=a[d])&&"setAttribute"in p==!!S&&(S?p.localName==S:p.nodeType==3)){e=p,a[d]=null;break}}if(e==null){if(S==null)return document.createTextNode(E);e=document.createElementNS(i,S,E.is&&E),l&&(q.__m&&q.__m(t,a),l=!1),a=null}if(S==null)v===E||l&&e.data==E||(e.data=E);else{if(a=S=="textarea"&&E.defaultValue!=null?null:a&&Tn.call(e.childNodes),!l&&a!=null)for(v={},d=0;d<e.attributes.length;d++)v[(p=e.attributes[d]).name]=p.value;for(d in v)p=v[d],d=="dangerouslySetInnerHTML"?_=p:d=="children"||d in E||d=="value"&&"defaultValue"in E||d=="checked"&&"defaultChecked"in E||Pn(e,d,null,p,i);for(d in E)p=E[d],d=="children"?g=p:d=="dangerouslySetInnerHTML"?u=p:d=="value"?m=p:d=="checked"?h=p:l&&typeof p!="function"||v[d]===p||Pn(e,d,p,v[d],i);if(u)l||_&&(u.__html==_.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(_&&(e.innerHTML=""),xi(t.type=="template"?e.content:e,En(g)?g:[g],t,n,o,S=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,s,a?a[0]:n.__k&&mt(n,0),l,c),a!=null)for(d=a.length;d--;)Xo(a[d]);l&&S!="textarea"||(d="value",S=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[d]||S=="progress"&&!m||S=="option"&&m!=v[d])&&Pn(e,d,m,v[d],i),d="checked",h!=null&&h!=e[d]&&Pn(e,d,h,v[d],i))}return e}function Yo(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){q.__e(i,n)}}function wi(e,t,n){var o,i;if(q.unmount&&q.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||Yo(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){q.__e(a,t)}o.base=o.__P=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&wi(o[i],t,n||typeof e.type!="function");n||Xo(e.__e),e.__c=e.__=e.__e=void 0}function mc(e,t,n){return this.constructor(e,n)}function An(e,t,n){var o,i,a,s;t==document&&(t=document.documentElement),q.__&&q.__(e,t),i=(o=typeof n=="function")?null:n&&n.__k||t.__k,a=[],s=[],Jo(t,e=(!o&&n||t).__k=In(ne,null,[e]),i||wn,wn,t.namespaceURI,!o&&n?[n]:i?null:t.firstChild?Tn.call(t.childNodes):null,a,!o&&n?n:i?i.__e:t.firstChild,o,s),yi(a,e,s)}Tn=kn.slice,q={__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}},mi=0,qo=function(e){return e!=null&&e.constructor===void 0},Ze.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ve({},this.state),typeof e=="function"&&(e=e(Ve({},n),this.props)),e&&Ve(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ui(this))},Ze.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ui(this))},Ze.prototype.render=ne,Qe=[],gi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,hi=function(e,t){return e.__v.__b-t.__v.__b},Cn.__r=0,Wo=Math.random().toString(8),yn="__d"+Wo,Kt="__a"+Wo,vi=/(PointerCapture)$|Capture$/i,jo=0,Go=fi(!1),Vo=fi(!0),cc=0;var x={id:"help-ai",name:"@helpai/elements",global:"HelpAI",tagName:"web-ai-chat",cssPrefix:"helpai",defaultBaseUrl:"https://help.ai",standaloneUrl:"https://help.ai/chat",displayName:"Help AI",domain:"help.ai",siteUrl:"https://help.ai"};var ki={attach:"Attach files",attachmentMimeRejected:"File type not supported",attachmentTooLarge:"File is too large",attachmentTooMany:"Attachment limit reached",conversationClosed:"This conversation is closed",conversationLoading:"Loading conversation\u2026",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 conversations\u2026",historyContinue:"Continue the conversation",historyTitle:"Conversation history",language:"Language",launcherOpen:"Open chat",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",scrollToBottom:"Scroll to latest",send:"Send",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new conversation",stop:"Stop",theme:"Theme",themeAuto:"Auto",themeDark:"Dark",themeLight:"Light",textSize:"Text size",textSizeSmall:"Small",textSizeNormal:"Normal",textSizeLarge:"Large",loading:"Loading\u2026",thinking:"Thinking\u2026",thoughts:"Thoughts",usedTool:"Used tool",tabHome:"Home",tabConversations:"Conversations",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",homeStatus:"Status",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}",formSubmit:"Submit",formSkip:"Maybe later",formSubmitted:"Completed",formSkipped:"Maybe later",formFillOut:"Fill out",formRequired:"This field is required",formInvalidEmail:"Enter a valid email address",formInvalidTel:"Enter a valid phone number",formInvalidUrl:"Enter a valid URL",formInvalidNumber:"Enter a valid number",formTooShort:"Too short (min {min} characters)",formTooLong:"Too long (max {max} characters)",formNumberTooSmall:"Must be at least {min}",formNumberTooLarge:"Must be at most {max}",formPatternMismatch:"Please match the requested format",formChooseAtLeast:"Choose at least {min}",formChooseAtMost:"Choose at most {max}",formOther:"Other",formOtherPlaceholder:"Type your answer\u2026",inputRequired:"I need a bit more info",inputSubmit:"Submit",inputSkip:"Skip",inputSubmitted:"Answer submitted",approvalRequired:"Approval required",approve:"Approve",reject:"Reject",approved:"Approved",rejected:"Rejected",approvalReason:"Add a reason (optional)",stepNoLongerActive:"This request is no longer active."},gc={attach:"Joindre des fichiers",attachmentMimeRejected:"Type de fichier non pris en charge",attachmentTooLarge:"Le fichier est trop volumineux",attachmentTooMany:"Limite de pi\xE8ces jointes atteinte",conversationClosed:"Cette conversation est ferm\xE9e",conversationLoading:"Chargement de la conversation\u2026",close:"Fermer",collapse:"R\xE9duire",collapseSidebar:"R\xE9duire la barre lat\xE9rale",composerPlaceholder:"\xC9crivez un message\u2026",dateLastWeek:"7 derniers jours",dateOlder:"Plus ancien",dateToday:"Aujourd'hui",dateYesterday:"Hier",dropZone:"D\xE9posez les fichiers \xE0 joindre",errorGeneric:"Une erreur s'est produite",errorRateLimited:"Trop de requ\xEAtes \u2014 veuillez r\xE9essayer dans un instant.",errorRetry:"R\xE9essayer",expand:"Agrandir",expandSidebar:"D\xE9velopper la barre lat\xE9rale",exitFullscreen:"Quitter le plein \xE9cran",fullscreen:"Plein \xE9cran",history:"Historique",historyBack:"Retour au chat",historyEmpty:"Aucune conversation pour le moment",historyContinue:"Poursuivre la conversation",historyLoading:"Chargement de vos conversations\u2026",historyTitle:"Historique des conversations",language:"Langue",launcherOpen:"Ouvrir le chat",micStart:"D\xE9marrer la saisie vocale",micStop:"Arr\xEAter la saisie vocale",micUnsupported:"La saisie vocale n'est pas prise en charge par ce navigateur",moreActions:"Plus d'actions",newConversation:"Nouvelle conversation",panelTitle:"Chat",popOut:"Ouvrir dans un nouvel onglet",resizeHandle:"Glisser pour redimensionner",scrollToBottom:"Aller au plus r\xE9cent",send:"Envoyer",soundOff:"Son d\xE9sactiv\xE9",soundOn:"Son activ\xE9",startNewConversation:"D\xE9marrer une nouvelle conversation",stop:"Arr\xEAter",theme:"Th\xE8me",themeAuto:"Auto",themeDark:"Sombre",themeLight:"Clair",textSize:"Taille du texte",textSizeSmall:"Petite",textSizeNormal:"Normale",textSizeLarge:"Grande",loading:"Chargement\u2026",thinking:"R\xE9flexion\u2026",thoughts:"R\xE9flexions",usedTool:"Outil utilis\xE9",tabHome:"Accueil",tabConversations:"Conversations",tabHelp:"Aide",tabNews:"Actualit\xE9s",modulesEmpty:"Rien pour le moment",moduleBack:"Retour",contentLoading:"Chargement\u2026",homeGreeting:"Comment pouvons-nous vous aider ?",homeGreetingNamed:"Bonjour {name} \u{1F44B}",homeGreetingLead:"Comment pouvons-nous vous aider ?",homeSearchPlaceholder:"Rechercher de l'aide",homeContentTitle:"Articles populaires",homeStatus:"Statut",helpTitle:"Aide",helpSearchPlaceholder:"Rechercher de l'aide",helpEmpty:"Aucun article d'aide pour le moment",helpLoading:"Chargement de l'aide\u2026",helpSearchEmpty:"Aucun r\xE9sultat trouv\xE9",newsTitle:"Actualit\xE9s",newsEmpty:"Aucune actualit\xE9 pour le moment",newsLoading:"Chargement des actualit\xE9s\u2026",newsBack:"Retour aux actualit\xE9s",newsPublishedAt:"Publi\xE9 le {date}",formSubmit:"Envoyer",formSkip:"Plus tard",formSubmitted:"Termin\xE9",formSkipped:"Plus tard",formFillOut:"Remplir",formRequired:"Ce champ est obligatoire",formInvalidEmail:"Saisissez une adresse e-mail valide",formInvalidTel:"Saisissez un num\xE9ro de t\xE9l\xE9phone valide",formInvalidUrl:"Saisissez une URL valide",formInvalidNumber:"Saisissez un nombre valide",formTooShort:"Trop court (min. {min} caract\xE8res)",formTooLong:"Trop long (max. {max} caract\xE8res)",formNumberTooSmall:"Doit \xEAtre au moins {min}",formNumberTooLarge:"Doit \xEAtre au plus {max}",formPatternMismatch:"Veuillez respecter le format demand\xE9",formChooseAtLeast:"Choisissez au moins {min}",formChooseAtMost:"Choisissez au plus {max}",formOther:"Autre",formOtherPlaceholder:"Saisissez votre r\xE9ponse\u2026",inputRequired:"J'ai besoin de quelques pr\xE9cisions",inputSubmit:"Envoyer",inputSkip:"Ignorer",inputSubmitted:"R\xE9ponse envoy\xE9e",approvalRequired:"Approbation requise",approve:"Approuver",reject:"Refuser",approved:"Approuv\xE9",rejected:"Refus\xE9",approvalReason:"Ajouter une raison (facultatif)",stepNoLongerActive:"Cette demande n'est plus active."},hc={en:ki,fr:gc};function Rn(e,t){let n=vc(e),o=Ln(t),i=n==="en"?{}:hc[n]??{},a=o?t[n]??{}:t??{},s=o?t.en??{}:{};return{...ki,...i,...s,...a}}function vc(e){return(e.split("-")[0]??"en").toLowerCase()}function $e(e,t){return e[t]??t}function Ln(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}function Ci(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function Ti(e,t){let{translations:n,defaultLocale:o,...i}=e,a=Ci(n,t);return a?{...i,title:a.title??i.title,description:a.description??i.description,content:a.content??i.content}:i}function Ei(e,t){let{translations:n,defaultLocale:o,...i}=e,a=Ci(n,t);if(!a)return i;let s=new Map((a.fields??[]).map(c=>[c.name,c])),l=i.fields.map(c=>{let d=s.get(c.name);if(!d)return c;let u=new Map((d.options??[]).map(_=>[_.value,_]));return{...c,label:d.label??c.label,placeholder:d.placeholder??c.placeholder,validationHint:d.validationHint??c.validationHint,options:c.options?.map(_=>{let g=u.get(_.value);return g?{..._,label:g.label??_.label,description:g.description??_.description}:_})}});return{...i,title:a.title??i.title,description:a.description??i.description,submitLabel:a.submitLabel??i.submitLabel,fields:l}}var Qo=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{}}},Mn=new Qo;var tr=["off","error","warn","info","debug","trace"],nr=x.cssPrefix,Ii=`${nr}.debug`,bc=`__${x.global}_DEBUG__`,xc=`${nr}-debug`,On=2,Zo=null;function Pc(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(xc);if(e!==null){let t=er(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(Ii);if(e){let t=er(e);if(t>=0)return t}}catch{}return window[bc]?4:2}function er(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=tr.indexOf(e);if(t>=0)return t}return-1}function Nn(e){let t=er(e);if(!(t<0)){On=t;try{window.localStorage?.setItem(Ii,tr[t])}catch{}}}function or(){return tr[On]}On=Pc();function Ai(e){let t=`[${nr}:${e}]`,n=(o,i,a)=>(s,l)=>{if(!(On<o)&&(l===void 0?console[i](t,s):console[i](t,s,l),Zo))try{Zo({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=>Ai(`${e}:${o}`)}}var U=Ai("core");function Ri(e){Zo=e}var nt=U.scope("context"),yc=new Set(["visitorId","conversationId","conversationId","jwt","token","authorization","password"]),Li=50,rr=1024,Sc=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function ir(e){return Mi(e,"userContext",!0)}function ar(e){return Mi(e,"pageContext",!1)}function Mi(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){nt.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(yc.has(a)){nt.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(s==null)continue;if(i>=Li){nt.warn(`${t} truncated at ${Li} keys \u2014 dropped "${a}"`);continue}let l=wc(t,a,s);l!==void 0&&(o[a]=l,i++)}return n&&typeof o.email=="string"&&!Sc.test(o.email)&&(nt.warn(`dropped malformed ${t}.email "${o.email}"`),delete o.email),Object.keys(o).length>0?o:void 0}function wc(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){nt.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let o=n.trim();return o===""?void 0:o.length>rr?(nt.warn(`truncated ${e}.${t} to ${rr} chars`),o.slice(0,rr)):o}nt.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}var Dn={maxBytes:10485760,maxCount:10,accept:"*/*"},$n={files:!0,voice:"local",humanInLoop:!0},Oi={list:[],byTrigger:{}},sr={enabled:!0,sampleRate:1},Hn={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},gt={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},Ni={floating:["theme","textSize","history","close","clear","expand","fullscreen","popOut","sound","language"],inline:["theme","textSize","history","close","clear","fullscreen","popOut","sound","language"],standalone:["theme","textSize","history","clear","sound","language"],page:["theme","textSize","history","clear","sound","language"],modal:["theme","textSize","history","close","clear","fullscreen","popOut","sound","language"],drawer:["theme","textSize","history","close","clear","fullscreen","popOut","sound","language"]},lr={enabled:!0,volume:.3,events:void 0},Di={enabled:!0,events:void 0},$i=[{label:"tabConversations",layout:"chat"}],Hi={showSearchBar:!0};function ht(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:d}=kc(t.theme),u=n.mode??"floating",_=Cc(i.defaultLocale),g=i.availableLocales??[i.locale??_],p=vt(i.locale??_,g,_),m=(t.baseUrl??x.defaultBaseUrl).replace(/\/$/,""),h=(t.agentApiBaseUrl??`${m}/api/agent`).replace(/\/$/,""),v=(t.dataApiBaseUrl??`${m}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:m,agentApiBaseUrl:h,dataApiBaseUrl:v,userContext:ir(t.userContext),pageContext:ar(t.pageContext),position:n.position??"bottom-right",themeMode:c,textSize:"normal",themeOverrides:d,mode:u,iframe:n.iframe??!1,responseMode:o.responseMode??"streaming",showReasoning:o.showReasoning??!1,showToolCalls:o.showToolCalls??!1,popOutUrl:o.popOutUrl??x.standaloneUrl,features:{files:t.features?.files??$n.files,voice:t.features?.voice??$n.voice,humanInLoop:t.features?.humanInLoop??$n.humanInLoop,tools:t.features?.tools},forms:qt(t.forms,p),endpoints:{upload:t.endpoints?.upload??Hn.upload,transcribe:t.endpoints?.transcribe??Hn.transcribe,submitForm:t.endpoints?.submitForm??Hn.submitForm},attachments:{accept:t.composer?.attachments?.accept??Dn.accept,maxBytes:t.composer?.attachments?.maxBytes??Dn.maxBytes,maxCount:t.composer?.attachments?.maxCount??Dn.maxCount},locale:p,defaultLocale:_,availableLocales:g,startMinimized:o.startMinimized??!0,actions:Tc(u,l.actions),size:n.size??{},launcher:Nc(t.launcher),sound:Ec(a.sound),haptics:Ic(a.haptics),strings:Rn(p,i.strings),stringsOverride:i.strings,composerDisclaimer:s.composerDisclaimer??"",poweredBy:Rc(s.poweredBy),composer:Lc(t.composer),modules:Mc(t.modules),tracking:Ac(t.tracking,v),storage:t.storage??Mn,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function kc(e){return typeof e=="string"?{themeMode:e,themeOverrides:{}}:e&&typeof e=="object"?{themeMode:"auto",themeOverrides:e}:{themeMode:"auto",themeOverrides:{}}}function Cc(e){return e&&e!=="auto"?e:typeof navigator<"u"&&navigator.language?navigator.language:"en"}function vt(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function Tc(e,t){return t??Ni[e]}function Ec(e){return{enabled:e?.enabled??lr.enabled,volume:e?.volume??lr.volume,events:e?.events}}function Ic(e){return{enabled:e?.enabled??Di.enabled,events:e?.events}}function Ac(e,t){let n=e?.sampleRate??sr.sampleRate;return{enabled:e?.enabled??sr.enabled,endpoint:e?.endpoint??`${t}/pai/elements-px.gif`,sampleRate:Math.min(1,Math.max(0,Number.isFinite(n)?n:1)),token:e?.token}}function Rc(e){let n={...{text:`Powered by ${x.displayName}`,href:x.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function Lc(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function Mc(e){let t=e===void 0?$i: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??Hi.showSearchBar,c.showRecentConversations=a.showRecentConversations??!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 qt(e,t){var a;if(!e?.length)return Oi;let n=[],o=new Set;for(let s of e){if(!s?.id||o.has(s.id))continue;let l=Ei(s,t),c=(l.fields??[]).filter(u=>!!(u&&u.name&&u.label&&u.type)),d=(Array.isArray(l.on)?l.on:[l.on]).map(Oc).filter(u=>u!==null);c.length===0||d.length===0||(o.add(l.id),n.push({id:l.id,triggers:d,when:l.when,fields:c,title:l.title,description:l.description,submitLabel:l.submitLabel,skippable:l.skippable??!1,frequency:l.frequency??"once",mirrorToContext:l.mirrorToContext??!0,reopenable:l.reopenable??!0,reviewable:l.reviewable??!0}))}let i={};for(let s of n)for(let l of s.triggers)(i[a=l.kind]??(i[a]=[])).push(s);return{list:n,byTrigger:i}}function Oc(e){if(typeof e!="string")return null;if(e==="pre-chat"||e==="conversation-closed"||e==="panel-close"||e==="manual")return{kind:e};let[t,n]=e.split(":",2);if(t==="after-messages"){let o=Number(n);return Number.isFinite(o)&&o>0?{kind:"after-messages",param:o}:null}if(t==="idle"){let o=Number(n);return Number.isFinite(o)&&o>0?{kind:"idle",param:o}:null}return t==="page-area"&&n?{kind:"page-area",param:n}:null}function Nc(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??gt.variant,size:e?.size??gt.size,label:e?.label??gt.label,icon:e?.icon??gt.icon,hidden:e?.hidden??gt.hidden,callout:t}}function cr(e,t,n,o){let i=vt(t,e.availableLocales,e.defaultLocale);if(i===e.locale&&n===e.themeMode&&o===e.textSize)return e;let a={...e};return i!==e.locale&&(a.locale=i,a.strings=Rn(i,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),o!==e.textSize&&(a.textSize=o),a}var Dc=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints"];function dr(e,t){if(!t)return e;let n={...e};for(let a of Dc){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]=Fi(s,l))}t.modules!==void 0&&e.modules===void 0&&(n.modules=t.modules),t.dataApiBaseUrl!==void 0&&e.dataApiBaseUrl===void 0&&(n.dataApiBaseUrl=t.dataApiBaseUrl);let o=e.i18n,i=t.i18n;if(o||i){let a=Fi(i??{},o);i?.availableLocales!==void 0&&(a.availableLocales=i.availableLocales),i?.defaultLocale!==void 0&&(a.defaultLocale=i.defaultLocale);let s=o?.strings,l=i?.strings;(s||l)&&(a.strings=$c(l,s)),n.i18n=a}return n}function Fi(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 $c(e,t){if(!e)return t;if(!t)return e;let n=Ln(e),o=Ln(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 Hc=["clear","expand","fullscreen","popOut","sound","history","language","theme","textSize","close"],bt=e=>e!=="false",Fc=e=>e.split(",").map(t=>t.trim()).filter(Boolean),Bc=[["public-key","publicKey"],["ai-agent-deployment-id","aiAgentDeploymentId"],["base-url","baseUrl"],["agent-api-base-url","agentApiBaseUrl"],["data-api-base-url","dataApiBaseUrl"],["theme","theme",e=>e]],zc=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",bt]],Uc=[["width","width"],["height","height"]],Wc=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",bt],["show-reasoning","showReasoning",bt],["show-tool-calls","showToolCalls",bt]],Gc=[["locale","locale"]],kp=new Set(Hc);var Vc=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",bt]],Kc=[["features-files","files",bt],["features-voice","voice",e=>e],["features-tools","tools",Fc]],qc=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],jc=[["user-id","id"],["user-email","email"],["user-name","name"]],Xc=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],Jc=["launcher-label","callout-text","callout-delay","actions-main","actions-overflow","user-context","page-context"],Yc=[Bc,zc,Uc,Wc,Gc,Vc,Kc,qc,jc,Xc],Qc=new Set(["iframe","start-minimized"]),Zc=[...Yc.flatMap(e=>e.map(([t])=>t).filter(t=>!Qc.has(t))),...Jc];function Bi(e){return`${x.cssPrefix}:${e}`}function xt(e,t,n){e.dispatchEvent(new CustomEvent(Bi(t),{detail:n}))}function zi(e,t){let o=Object.entries(t).map(([i,a])=>{let s=Bi(i),l=c=>a(c.detail);return e.addEventListener(s,l),[s,l]});return()=>{for(let[i,a]of o)e.removeEventListener(i,a)}}function He(){let e=Date.now(),t=new Uint8Array(16);t[0]=Math.floor(e/2**40)&255,t[1]=Math.floor(e/2**32)&255,t[2]=e>>>24&255,t[3]=e>>>16&255,t[4]=e>>>8&255,t[5]=e&255,ed(t.subarray(6)),t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=Array.from(t,o=>o.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function ed(e){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){crypto.getRandomValues(e);return}for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256)}var Pt=U.scope("persistence");function yt(e,t=Mn){let n=`${x.cssPrefix}.${e}`,o=`${n}.visitorId`,i=`${n}.conversationId`,a=`${n}.userPrefs`,s=`${n}.panelOpen`,l=`${n}.panelSize`,c=`${n}.calloutDismissed`,d=`${n}.sidebarCollapsed`,u=`${n}.activeModule`,_=`${n}.formsDone`,g={getVisitorId(){let p=t.get(o);if(p)return p;let m=He();return t.set(o,m),m},setVisitorId(p){Pt.debug("setVisitorId (rebind)",{id:p,widgetId:e}),t.set(o,p)},loadConversationId(){return t.get(i)??void 0},saveConversationId(p){Pt.trace("saveConversationId",{id:p,widgetId:e}),p?t.set(i,p):t.remove(i)},loadUserPrefs(){let p=t.get(a);if(!p)return{};try{let m=JSON.parse(p);return Ui(m)?m:{}}catch(m){return Pt.warn("loadUserPrefs parse failed",{error:m}),{}}},saveUserPrefs(p){try{t.set(a,JSON.stringify(p))}catch(m){Pt.warn("saveUserPrefs serialise failed",{error:m})}},patchUserPrefs(p){let m=g.loadUserPrefs();g.saveUserPrefs({...m,...p})},loadPanelOpen(){let p=t.get(s);return p==="1"?!0:p==="0"?!1:null},savePanelOpen(p){t.set(s,p?"1":"0")},loadPanelSize(){let p=t.get(l);return p==="normal"||p==="expanded"||p==="fullscreen"?p:null},savePanelSize(p){t.set(l,p)},loadCalloutDismissed(p){if(!p)return!1;let m=t.get(c);return!!m&&m===p},saveCalloutDismissed(p){p?t.set(c,p):t.remove(c)},loadSidebarCollapsed(){let p=t.get(d);return p==="1"?!0:p==="0"?!1:null},saveSidebarCollapsed(p){t.set(d,p?"1":"0")},loadActiveModule(){return t.get(u)||null},saveActiveModule(p){t.set(u,p)},loadFormsDone(){let p=t.get(_);if(!p)return{};try{let m=JSON.parse(p);return Ui(m)?m:{}}catch(m){return Pt.warn("loadFormsDone parse failed",{error:m}),{}}},saveFormDone(p){try{let m=g.loadFormsDone();m[p]=Date.now(),t.set(_,JSON.stringify(m))}catch(m){Pt.warn("saveFormDone serialise failed",{error:m})}},clearConversation(){t.remove(i)}};return g}function Ui(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Wi=`:host{--__P__-accent-user: __BRAND_ACCENT__;--__P__-accent: var(--__P__-accent-user);--__P__-accent-text-user: __BRAND_ACCENT_TEXT__;--__P__-accent-text: var(--__P__-accent-text-user);--__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-scale: 1;--__P__-text-xs: calc(12px * var(--__P__-text-scale));--__P__-text-sm: calc(13px * var(--__P__-text-scale));--__P__-text-base: calc(15px * var(--__P__-text-scale));--__P__-text-md: calc(16px * var(--__P__-text-scale));--__P__-text-lg: calc(18px * var(--__P__-text-scale));--__P__-text-xl: calc(22px * var(--__P__-text-scale));--__P__-text-2xl: calc(30px * var(--__P__-text-scale))}:host([data-text-size="small"]){--__P__-text-scale: .9}:host([data-text-size="large"]){--__P__-text-scale: 1.15}:host{--__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;--__P__-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;--__P__-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;--__P__-color-scheme: dark}}@supports (color: oklch(from red l c h)){:host{--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.3, l, .62) c h);--__P__-accent-text: oklch(from var(--__P__-accent) clamp(0, (l / .623 - 1) * -infinity, 1) 0 h)}:host([data-theme="dark"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h)}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h)}}}@media(prefers-reduced-motion:reduce){:host{--__P__-dur-quick: 1ms;--__P__-dur-base: 1ms;--__P__-dur-slow: 1ms}}
1
+ var sc=Object.defineProperty;var lc=(e,t,n)=>t in e?sc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var j=(e,t,n)=>lc(e,typeof t!="symbol"?t+"":t,n);var Tn,q,mi,qo,Qe,_i,gi,hi,Wo,yn,Kt,vi,jo,Go,Vo,cc,wn={},kn=[],dc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,En=Array.isArray;function Ve(e,t){for(var n in t)e[n]=t[n];return e}function Xo(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function In(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?Tn.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 Sn(e,s,o,i,null)}function Sn(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??++mi,__i:-1,__u:0};return i==null&&q.vnode!=null&&q.vnode(a),a}function ne(e){return e.children}function Ze(e,t){this.props=e,this.context=t}function mt(e,t){if(t==null)return e.__?mt(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"?mt(e):null}function _c(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],i=[],a=Ve({},t);a.__v=t.__v+1,q.vnode&&q.vnode(a),Jo(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??mt(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,yi(o,a,i),t.__e=t.__=null,a.__e!=n&&bi(a)}}function bi(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}),bi(e)}function ui(e){(!e.__d&&(e.__d=!0)&&Qe.push(e)&&!Cn.__r++||_i!=q.debounceRendering)&&((_i=q.debounceRendering)||gi)(Cn)}function Cn(){try{for(var e,t=1;Qe.length;)Qe.length>t&&Qe.sort(hi),e=Qe.shift(),t=Qe.length,_c(e)}finally{Qe.length=Cn.__r=0}}function xi(e,t,n,o,i,a,s,l,c,d,u){var _,m,h,g,p,v,E,S=o&&o.__k||kn,B=t.length;for(c=uc(n,t,S,c,B),_=0;_<B;_++)(h=n.__k[_])!=null&&(m=h.__i!=-1&&S[h.__i]||wn,h.__i=_,v=Jo(e,h,m,i,a,s,l,c,d,u),g=h.__e,h.ref&&m.ref!=h.ref&&(m.ref&&Yo(m.ref,null,h),u.push(h.ref,h.__c||g,h)),p==null&&g!=null&&(p=g),(E=!!(4&h.__u))||m.__k===h.__k?(c=Pi(h,c,e,E),E&&m.__e&&(m.__e=null)):typeof h.type=="function"&&v!==void 0?c=v:g&&(c=g.nextSibling),h.__u&=-7);return n.__e=p,c}function uc(e,t,n,o,i){var a,s,l,c,d,u=n.length,_=u,m=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]=Sn(null,s,null,null,null):En(s)?s=e.__k[a]=Sn(ne,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=Sn(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,c=a+m,s.__=e,s.__b=e.__b+1,l=null,(d=s.__i=pc(s,n,c,_))!=-1&&(_--,(l=n[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(i>u?m--:i<u&&m++),typeof s.type!="function"&&(s.__u|=4)):d!=c&&(d==c-1?m--:d==c+1?m++:(d>c?m--:m++,s.__u|=4))):e.__k[a]=null;if(_)for(a=0;a<u;a++)(l=n[a])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=mt(l)),wi(l,l));return o}function Pi(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=Pi(i[a],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=mt(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function pc(e,t,n,o){var i,a,s,l=e.key,c=e.type,d=t[n],u=d!=null&&(2&d.__u)==0;if(d===null&&l==null||u&&l==d.key&&c==d.type)return n;if(o>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((d=t[s=i>=0?i--:a++])!=null&&(2&d.__u)==0&&l==d.key&&c==d.type)return s}return-1}function pi(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||dc.test(t)?n:n+"px"}function Pn(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||pi(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||pi(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(vi,"$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[Kt]=o[Kt]:(n[Kt]=jo,e.addEventListener(t,a?Vo:Go,a)):e.removeEventListener(t,a?Vo:Go,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 fi(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[yn]==null)t[yn]=jo++;else if(t[yn]<n[Kt])return;return n(q.event?q.event(t):t)}}}function Jo(e,t,n,o,i,a,s,l,c,d){var u,_,m,h,g,p,v,E,S,B,A,W,K,D,ue,z=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[l=t.__e=n.__e]),(u=q.__b)&&u(t);e:if(typeof z=="function")try{if(E=t.props,S=z.prototype&&z.prototype.render,B=(u=z.contextType)&&o[u.__c],A=u?B?B.props.value:u.__:o,n.__c?v=(_=t.__c=n.__c).__=_.__E:(S?t.__c=_=new z(E,A):(t.__c=_=new Ze(E,A),_.constructor=z,_.render=mc),B&&B.sub(_),_.state||(_.state={}),_.__n=o,m=_.__d=!0,_.__h=[],_._sb=[]),S&&_.__s==null&&(_.__s=_.state),S&&z.getDerivedStateFromProps!=null&&(_.__s==_.state&&(_.__s=Ve({},_.__s)),Ve(_.__s,z.getDerivedStateFromProps(E,_.__s))),h=_.props,g=_.state,_.__v=t,m)S&&z.getDerivedStateFromProps==null&&_.componentWillMount!=null&&_.componentWillMount(),S&&_.componentDidMount!=null&&_.__h.push(_.componentDidMount);else{if(S&&z.getDerivedStateFromProps==null&&E!==h&&_.componentWillReceiveProps!=null&&_.componentWillReceiveProps(E,A),t.__v==n.__v||!_.__e&&_.shouldComponentUpdate!=null&&_.shouldComponentUpdate(E,_.__s,A)===!1){t.__v!=n.__v&&(_.props=E,_.state=_.__s,_.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(te){te&&(te.__=t)}),kn.push.apply(_.__h,_._sb),_._sb=[],_.__h.length&&s.push(_);break e}_.componentWillUpdate!=null&&_.componentWillUpdate(E,_.__s,A),S&&_.componentDidUpdate!=null&&_.__h.push(function(){_.componentDidUpdate(h,g,p)})}if(_.context=A,_.props=E,_.__P=e,_.__e=!1,W=q.__r,K=0,S)_.state=_.__s,_.__d=!1,W&&W(t),u=_.render(_.props,_.state,_.context),kn.push.apply(_.__h,_._sb),_._sb=[];else do _.__d=!1,W&&W(t),u=_.render(_.props,_.state,_.context),_.state=_.__s;while(_.__d&&++K<25);_.state=_.__s,_.getChildContext!=null&&(o=Ve(Ve({},o),_.getChildContext())),S&&!m&&_.getSnapshotBeforeUpdate!=null&&(p=_.getSnapshotBeforeUpdate(h,g)),D=u!=null&&u.type===ne&&u.key==null?Si(u.props.children):u,l=xi(e,En(D)?D:[D],t,n,o,i,a,s,l,c,d),_.base=t.__e,t.__u&=-161,_.__h.length&&s.push(_),v&&(_.__E=_.__=null)}catch(te){if(t.__v=null,c||a!=null)if(te.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(ue=a.length;ue--;)Xo(a[ue]);Ko(t)}else t.__e=n.__e,t.__k=n.__k,te.then||Ko(t);q.__e(te,t,n)}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=fc(n.__e,t,n,o,i,a,s,c,d);return(u=q.diffed)&&u(t),128&t.__u?void 0:l}function Ko(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ko))}function yi(e,t,n){for(var o=0;o<n.length;o++)Yo(n[o],n[++o],n[++o]);q.__c&&q.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){q.__e(a,i.__v)}})}function Si(e){return typeof e!="object"||e==null||e.__b>0?e:En(e)?e.map(Si):e.constructor!==void 0?null:Ve({},e)}function fc(e,t,n,o,i,a,s,l,c){var d,u,_,m,h,g,p,v=n.props||wn,E=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(d=0;d<a.length;d++)if((h=a[d])&&"setAttribute"in h==!!S&&(S?h.localName==S:h.nodeType==3)){e=h,a[d]=null;break}}if(e==null){if(S==null)return document.createTextNode(E);e=document.createElementNS(i,S,E.is&&E),l&&(q.__m&&q.__m(t,a),l=!1),a=null}if(S==null)v===E||l&&e.data==E||(e.data=E);else{if(a=S=="textarea"&&E.defaultValue!=null?null:a&&Tn.call(e.childNodes),!l&&a!=null)for(v={},d=0;d<e.attributes.length;d++)v[(h=e.attributes[d]).name]=h.value;for(d in v)h=v[d],d=="dangerouslySetInnerHTML"?_=h:d=="children"||d in E||d=="value"&&"defaultValue"in E||d=="checked"&&"defaultChecked"in E||Pn(e,d,null,h,i);for(d in E)h=E[d],d=="children"?m=h:d=="dangerouslySetInnerHTML"?u=h:d=="value"?g=h:d=="checked"?p=h:l&&typeof h!="function"||v[d]===h||Pn(e,d,h,v[d],i);if(u)l||_&&(u.__html==_.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(_&&(e.innerHTML=""),xi(t.type=="template"?e.content:e,En(m)?m:[m],t,n,o,S=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,s,a?a[0]:n.__k&&mt(n,0),l,c),a!=null)for(d=a.length;d--;)Xo(a[d]);l&&S!="textarea"||(d="value",S=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[d]||S=="progress"&&!g||S=="option"&&g!=v[d])&&Pn(e,d,g,v[d],i),d="checked",p!=null&&p!=e[d]&&Pn(e,d,p,v[d],i))}return e}function Yo(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){q.__e(i,n)}}function wi(e,t,n){var o,i;if(q.unmount&&q.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||Yo(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){q.__e(a,t)}o.base=o.__P=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&wi(o[i],t,n||typeof e.type!="function");n||Xo(e.__e),e.__c=e.__=e.__e=void 0}function mc(e,t,n){return this.constructor(e,n)}function An(e,t,n){var o,i,a,s;t==document&&(t=document.documentElement),q.__&&q.__(e,t),i=(o=typeof n=="function")?null:n&&n.__k||t.__k,a=[],s=[],Jo(t,e=(!o&&n||t).__k=In(ne,null,[e]),i||wn,wn,t.namespaceURI,!o&&n?[n]:i?null:t.firstChild?Tn.call(t.childNodes):null,a,!o&&n?n:i?i.__e:t.firstChild,o,s),yi(a,e,s)}Tn=kn.slice,q={__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}},mi=0,qo=function(e){return e!=null&&e.constructor===void 0},Ze.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ve({},this.state),typeof e=="function"&&(e=e(Ve({},n),this.props)),e&&Ve(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ui(this))},Ze.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ui(this))},Ze.prototype.render=ne,Qe=[],gi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,hi=function(e,t){return e.__v.__b-t.__v.__b},Cn.__r=0,Wo=Math.random().toString(8),yn="__d"+Wo,Kt="__a"+Wo,vi=/(PointerCapture)$|Capture$/i,jo=0,Go=fi(!1),Vo=fi(!0),cc=0;var x={id:"help-ai",name:"@helpai/elements",global:"HelpAI",tagName:"web-ai-chat",cssPrefix:"helpai",defaultBaseUrl:"https://help.ai",standaloneUrl:"https://help.ai/chat",displayName:"Help AI",domain:"help.ai",siteUrl:"https://help.ai"};var ki={attach:"Attach files",attachmentMimeRejected:"File type not supported",attachmentTooLarge:"File is too large",attachmentTooMany:"Attachment limit reached",conversationClosed:"This conversation is closed",conversationLoading:"Loading conversation\u2026",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 conversations\u2026",historyContinue:"Continue the conversation",historyTitle:"Conversation history",language:"Language",launcherOpen:"Open chat",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",scrollToBottom:"Scroll to latest",send:"Send",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new conversation",stop:"Stop",theme:"Theme",themeAuto:"Auto",themeDark:"Dark",themeLight:"Light",textSize:"Text size",textSizeSmall:"Small",textSizeNormal:"Normal",textSizeLarge:"Large",loading:"Loading\u2026",thinking:"Thinking\u2026",thoughts:"Thoughts",usedTool:"Used tool",tabHome:"Home",tabConversations:"Conversations",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",homeStatus:"Status",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}",formSubmit:"Submit",formSkip:"Maybe later",formSubmitted:"Completed",formSkipped:"Maybe later",formFillOut:"Fill out",formRequired:"This field is required",formInvalidEmail:"Enter a valid email address",formInvalidTel:"Enter a valid phone number",formInvalidUrl:"Enter a valid URL",formInvalidNumber:"Enter a valid number",formTooShort:"Too short (min {min} characters)",formTooLong:"Too long (max {max} characters)",formNumberTooSmall:"Must be at least {min}",formNumberTooLarge:"Must be at most {max}",formPatternMismatch:"Please match the requested format",formChooseAtLeast:"Choose at least {min}",formChooseAtMost:"Choose at most {max}",formOther:"Other",formOtherPlaceholder:"Type your answer\u2026",inputRequired:"I need a bit more info",inputSubmit:"Submit",inputSkip:"Skip",inputSubmitted:"Answer submitted",approvalRequired:"Approval required",approve:"Approve",reject:"Reject",approved:"Approved",rejected:"Rejected",approvalReason:"Add a reason (optional)",stepNoLongerActive:"This request is no longer active."},gc={attach:"Joindre des fichiers",attachmentMimeRejected:"Type de fichier non pris en charge",attachmentTooLarge:"Le fichier est trop volumineux",attachmentTooMany:"Limite de pi\xE8ces jointes atteinte",conversationClosed:"Cette conversation est ferm\xE9e",conversationLoading:"Chargement de la conversation\u2026",close:"Fermer",collapse:"R\xE9duire",collapseSidebar:"R\xE9duire la barre lat\xE9rale",composerPlaceholder:"\xC9crivez un message\u2026",dateLastWeek:"7 derniers jours",dateOlder:"Plus ancien",dateToday:"Aujourd'hui",dateYesterday:"Hier",dropZone:"D\xE9posez les fichiers \xE0 joindre",errorGeneric:"Une erreur s'est produite",errorRateLimited:"Trop de requ\xEAtes \u2014 veuillez r\xE9essayer dans un instant.",errorRetry:"R\xE9essayer",expand:"Agrandir",expandSidebar:"D\xE9velopper la barre lat\xE9rale",exitFullscreen:"Quitter le plein \xE9cran",fullscreen:"Plein \xE9cran",history:"Historique",historyBack:"Retour au chat",historyEmpty:"Aucune conversation pour le moment",historyContinue:"Poursuivre la conversation",historyLoading:"Chargement de vos conversations\u2026",historyTitle:"Historique des conversations",language:"Langue",launcherOpen:"Ouvrir le chat",micStart:"D\xE9marrer la saisie vocale",micStop:"Arr\xEAter la saisie vocale",micUnsupported:"La saisie vocale n'est pas prise en charge par ce navigateur",moreActions:"Plus d'actions",newConversation:"Nouvelle conversation",panelTitle:"Chat",popOut:"Ouvrir dans un nouvel onglet",resizeHandle:"Glisser pour redimensionner",scrollToBottom:"Aller au plus r\xE9cent",send:"Envoyer",soundOff:"Son d\xE9sactiv\xE9",soundOn:"Son activ\xE9",startNewConversation:"D\xE9marrer une nouvelle conversation",stop:"Arr\xEAter",theme:"Th\xE8me",themeAuto:"Auto",themeDark:"Sombre",themeLight:"Clair",textSize:"Taille du texte",textSizeSmall:"Petite",textSizeNormal:"Normale",textSizeLarge:"Grande",loading:"Chargement\u2026",thinking:"R\xE9flexion\u2026",thoughts:"R\xE9flexions",usedTool:"Outil utilis\xE9",tabHome:"Accueil",tabConversations:"Conversations",tabHelp:"Aide",tabNews:"Actualit\xE9s",modulesEmpty:"Rien pour le moment",moduleBack:"Retour",contentLoading:"Chargement\u2026",homeGreeting:"Comment pouvons-nous vous aider ?",homeGreetingNamed:"Bonjour {name} \u{1F44B}",homeGreetingLead:"Comment pouvons-nous vous aider ?",homeSearchPlaceholder:"Rechercher de l'aide",homeContentTitle:"Articles populaires",homeStatus:"Statut",helpTitle:"Aide",helpSearchPlaceholder:"Rechercher de l'aide",helpEmpty:"Aucun article d'aide pour le moment",helpLoading:"Chargement de l'aide\u2026",helpSearchEmpty:"Aucun r\xE9sultat trouv\xE9",newsTitle:"Actualit\xE9s",newsEmpty:"Aucune actualit\xE9 pour le moment",newsLoading:"Chargement des actualit\xE9s\u2026",newsBack:"Retour aux actualit\xE9s",newsPublishedAt:"Publi\xE9 le {date}",formSubmit:"Envoyer",formSkip:"Plus tard",formSubmitted:"Termin\xE9",formSkipped:"Plus tard",formFillOut:"Remplir",formRequired:"Ce champ est obligatoire",formInvalidEmail:"Saisissez une adresse e-mail valide",formInvalidTel:"Saisissez un num\xE9ro de t\xE9l\xE9phone valide",formInvalidUrl:"Saisissez une URL valide",formInvalidNumber:"Saisissez un nombre valide",formTooShort:"Trop court (min. {min} caract\xE8res)",formTooLong:"Trop long (max. {max} caract\xE8res)",formNumberTooSmall:"Doit \xEAtre au moins {min}",formNumberTooLarge:"Doit \xEAtre au plus {max}",formPatternMismatch:"Veuillez respecter le format demand\xE9",formChooseAtLeast:"Choisissez au moins {min}",formChooseAtMost:"Choisissez au plus {max}",formOther:"Autre",formOtherPlaceholder:"Saisissez votre r\xE9ponse\u2026",inputRequired:"J'ai besoin de quelques pr\xE9cisions",inputSubmit:"Envoyer",inputSkip:"Ignorer",inputSubmitted:"R\xE9ponse envoy\xE9e",approvalRequired:"Approbation requise",approve:"Approuver",reject:"Refuser",approved:"Approuv\xE9",rejected:"Refus\xE9",approvalReason:"Ajouter une raison (facultatif)",stepNoLongerActive:"Cette demande n'est plus active."},hc={en:ki,fr:gc};function Rn(e,t){let n=vc(e),o=Ln(t),i=n==="en"?{}:hc[n]??{},a=o?t[n]??{}:t??{},s=o?t.en??{}:{};return{...ki,...i,...s,...a}}function vc(e){return(e.split("-")[0]??"en").toLowerCase()}function $e(e,t){return e[t]??t}function Ln(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}function Ci(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function Ti(e,t){let{translations:n,defaultLocale:o,...i}=e,a=Ci(n,t);return a?{...i,title:a.title??i.title,description:a.description??i.description,content:a.content??i.content}:i}function Ei(e,t){let{translations:n,defaultLocale:o,...i}=e,a=Ci(n,t);if(!a)return i;let s=new Map((a.fields??[]).map(c=>[c.name,c])),l=i.fields.map(c=>{let d=s.get(c.name);if(!d)return c;let u=new Map((d.options??[]).map(_=>[_.value,_]));return{...c,label:d.label??c.label,placeholder:d.placeholder??c.placeholder,validationHint:d.validationHint??c.validationHint,options:c.options?.map(_=>{let m=u.get(_.value);return m?{..._,label:m.label??_.label,description:m.description??_.description}:_})}});return{...i,title:a.title??i.title,description:a.description??i.description,submitLabel:a.submitLabel??i.submitLabel,fields:l}}var Qo=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{}}},Mn=new Qo;var tr=["off","error","warn","info","debug","trace"],nr=x.cssPrefix,Ii=`${nr}.debug`,bc=`__${x.global}_DEBUG__`,xc=`${nr}-debug`,On=2,Zo=null;function Pc(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(xc);if(e!==null){let t=er(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(Ii);if(e){let t=er(e);if(t>=0)return t}}catch{}return window[bc]?4:2}function er(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=tr.indexOf(e);if(t>=0)return t}return-1}function Nn(e){let t=er(e);if(!(t<0)){On=t;try{window.localStorage?.setItem(Ii,tr[t])}catch{}}}function or(){return tr[On]}On=Pc();function Ai(e){let t=`[${nr}:${e}]`,n=(o,i,a)=>(s,l)=>{if(!(On<o)&&(l===void 0?console[i](t,s):console[i](t,s,l),Zo))try{Zo({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=>Ai(`${e}:${o}`)}}var U=Ai("core");function Ri(e){Zo=e}var nt=U.scope("context"),yc=new Set(["visitorId","conversationId","conversationId","jwt","token","authorization","password"]),Li=50,rr=1024,Sc=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function ir(e){return Mi(e,"userContext",!0)}function ar(e){return Mi(e,"pageContext",!1)}function Mi(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){nt.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(yc.has(a)){nt.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(s==null)continue;if(i>=Li){nt.warn(`${t} truncated at ${Li} keys \u2014 dropped "${a}"`);continue}let l=wc(t,a,s);l!==void 0&&(o[a]=l,i++)}return n&&typeof o.email=="string"&&!Sc.test(o.email)&&(nt.warn(`dropped malformed ${t}.email "${o.email}"`),delete o.email),Object.keys(o).length>0?o:void 0}function wc(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){nt.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let o=n.trim();return o===""?void 0:o.length>rr?(nt.warn(`truncated ${e}.${t} to ${rr} chars`),o.slice(0,rr)):o}nt.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}var Dn={maxBytes:10485760,maxCount:10,accept:"*/*"},$n={files:!0,voice:"local",humanInLoop:!0},Oi={list:[],byTrigger:{}},sr={enabled:!0,sampleRate:1},Hn={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},gt={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},Ni={floating:["theme","textSize","history","close","clear","expand","fullscreen","popOut","sound","language"],inline:["theme","textSize","history","close","clear","fullscreen","popOut","sound","language"],standalone:["theme","textSize","history","clear","sound","language"],page:["theme","textSize","history","clear","sound","language"],modal:["theme","textSize","history","close","clear","fullscreen","popOut","sound","language"],drawer:["theme","textSize","history","close","clear","fullscreen","popOut","sound","language"]},lr={enabled:!0,volume:.3,events:void 0},Di={enabled:!0,events:void 0},$i=[{label:"tabConversations",layout:"chat"}],Hi={showSearchBar:!0};function ht(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:d}=kc(t.theme),u=n.mode??"floating",_=Cc(i.defaultLocale),m=i.availableLocales??[i.locale??_],h=vt(i.locale??_,m,_),g=(t.baseUrl??x.defaultBaseUrl).replace(/\/$/,""),p=(t.agentApiBaseUrl??`${g}/api/agent`).replace(/\/$/,""),v=(t.dataApiBaseUrl??`${g}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:g,agentApiBaseUrl:p,dataApiBaseUrl:v,userContext:ir(t.userContext),pageContext:ar(t.pageContext),position:n.position??"bottom-right",themeMode:c,textSize:"normal",themeOverrides:d,mode:u,iframe:n.iframe??!1,responseMode:o.responseMode??"streaming",showReasoning:o.showReasoning??!1,showToolCalls:o.showToolCalls??!1,popOutUrl:o.popOutUrl??x.standaloneUrl,features:{files:t.features?.files??$n.files,voice:t.features?.voice??$n.voice,humanInLoop:t.features?.humanInLoop??$n.humanInLoop,tools:t.features?.tools},forms:qt(t.forms,h),endpoints:{upload:t.endpoints?.upload??Hn.upload,transcribe:t.endpoints?.transcribe??Hn.transcribe,submitForm:t.endpoints?.submitForm??Hn.submitForm},attachments:{accept:t.composer?.attachments?.accept??Dn.accept,maxBytes:t.composer?.attachments?.maxBytes??Dn.maxBytes,maxCount:t.composer?.attachments?.maxCount??Dn.maxCount},locale:h,defaultLocale:_,availableLocales:m,startMinimized:o.startMinimized??!0,actions:Tc(u,l.actions),size:n.size??{},launcher:Nc(t.launcher),sound:Ec(a.sound),haptics:Ic(a.haptics),strings:Rn(h,i.strings),stringsOverride:i.strings,composerDisclaimer:s.composerDisclaimer??"",poweredBy:Rc(s.poweredBy),composer:Lc(t.composer),modules:Mc(t.modules),tracking:Ac(t.tracking,v),storage:t.storage??Mn,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function kc(e){return typeof e=="string"?{themeMode:e,themeOverrides:{}}:e&&typeof e=="object"?{themeMode:"auto",themeOverrides:e}:{themeMode:"auto",themeOverrides:{}}}function Cc(e){return e&&e!=="auto"?e:typeof navigator<"u"&&navigator.language?navigator.language:"en"}function vt(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function Tc(e,t){return t??Ni[e]}function Ec(e){return{enabled:e?.enabled??lr.enabled,volume:e?.volume??lr.volume,events:e?.events}}function Ic(e){return{enabled:e?.enabled??Di.enabled,events:e?.events}}function Ac(e,t){let n=e?.sampleRate??sr.sampleRate;return{enabled:e?.enabled??sr.enabled,endpoint:e?.endpoint??`${t}/pai/elements-px.gif`,sampleRate:Math.min(1,Math.max(0,Number.isFinite(n)?n:1)),token:e?.token}}function Rc(e){let n={...{text:`Powered by ${x.displayName}`,href:x.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function Lc(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function Mc(e){let t=e===void 0?$i: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??Hi.showSearchBar,c.showRecentConversations=a.showRecentConversations??!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 qt(e,t){var a;if(!e?.length)return Oi;let n=[],o=new Set;for(let s of e){if(!s?.id||o.has(s.id))continue;let l=Ei(s,t),c=(l.fields??[]).filter(u=>!!(u&&u.name&&u.label&&u.type)),d=(Array.isArray(l.on)?l.on:[l.on]).map(Oc).filter(u=>u!==null);c.length===0||d.length===0||(o.add(l.id),n.push({id:l.id,triggers:d,when:l.when,fields:c,title:l.title,description:l.description,submitLabel:l.submitLabel,skippable:l.skippable??!1,frequency:l.frequency??"once",mirrorToContext:l.mirrorToContext??!0,reopenable:l.reopenable??!0,reviewable:l.reviewable??!0}))}let i={};for(let s of n)for(let l of s.triggers)(i[a=l.kind]??(i[a]=[])).push(s);return{list:n,byTrigger:i}}function Oc(e){if(typeof e!="string")return null;if(e==="pre-chat"||e==="conversation-closed"||e==="panel-close"||e==="manual")return{kind:e};let[t,n]=e.split(":",2);if(t==="after-messages"){let o=Number(n);return Number.isFinite(o)&&o>0?{kind:"after-messages",param:o}:null}if(t==="idle"){let o=Number(n);return Number.isFinite(o)&&o>0?{kind:"idle",param:o}:null}return t==="page-area"&&n?{kind:"page-area",param:n}:null}function Nc(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??gt.variant,size:e?.size??gt.size,label:e?.label??gt.label,icon:e?.icon??gt.icon,hidden:e?.hidden??gt.hidden,callout:t}}function cr(e,t,n,o){let i=vt(t,e.availableLocales,e.defaultLocale);if(i===e.locale&&n===e.themeMode&&o===e.textSize)return e;let a={...e};return i!==e.locale&&(a.locale=i,a.strings=Rn(i,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),o!==e.textSize&&(a.textSize=o),a}var Dc=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints"];function dr(e,t){if(!t)return e;let n={...e};for(let a of Dc){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]=Fi(s,l))}t.modules!==void 0&&e.modules===void 0&&(n.modules=t.modules),t.dataApiBaseUrl!==void 0&&e.dataApiBaseUrl===void 0&&(n.dataApiBaseUrl=t.dataApiBaseUrl);let o=e.i18n,i=t.i18n;if(o||i){let a=Fi(i??{},o);i?.availableLocales!==void 0&&(a.availableLocales=i.availableLocales),i?.defaultLocale!==void 0&&(a.defaultLocale=i.defaultLocale);let s=o?.strings,l=i?.strings;(s||l)&&(a.strings=$c(l,s)),n.i18n=a}return n}function Fi(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 $c(e,t){if(!e)return t;if(!t)return e;let n=Ln(e),o=Ln(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 Hc=["clear","expand","fullscreen","popOut","sound","history","language","theme","textSize","close"],bt=e=>e!=="false",Fc=e=>e.split(",").map(t=>t.trim()).filter(Boolean),Bc=[["public-key","publicKey"],["ai-agent-deployment-id","aiAgentDeploymentId"],["base-url","baseUrl"],["agent-api-base-url","agentApiBaseUrl"],["data-api-base-url","dataApiBaseUrl"],["theme","theme",e=>e]],zc=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",bt]],Uc=[["width","width"],["height","height"]],Wc=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",bt],["show-reasoning","showReasoning",bt],["show-tool-calls","showToolCalls",bt]],Gc=[["locale","locale"]],kp=new Set(Hc);var Vc=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",bt]],Kc=[["features-files","files",bt],["features-voice","voice",e=>e],["features-tools","tools",Fc]],qc=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],jc=[["user-id","id"],["user-email","email"],["user-name","name"]],Xc=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],Jc=["launcher-label","callout-text","callout-delay","actions-main","actions-overflow","user-context","page-context"],Yc=[Bc,zc,Uc,Wc,Gc,Vc,Kc,qc,jc,Xc],Qc=new Set(["iframe","start-minimized"]),Zc=[...Yc.flatMap(e=>e.map(([t])=>t).filter(t=>!Qc.has(t))),...Jc];function Bi(e){return`${x.cssPrefix}:${e}`}function xt(e,t,n){e.dispatchEvent(new CustomEvent(Bi(t),{detail:n}))}function zi(e,t){let o=Object.entries(t).map(([i,a])=>{let s=Bi(i),l=c=>a(c.detail);return e.addEventListener(s,l),[s,l]});return()=>{for(let[i,a]of o)e.removeEventListener(i,a)}}function He(){let e=Date.now(),t=new Uint8Array(16);t[0]=Math.floor(e/2**40)&255,t[1]=Math.floor(e/2**32)&255,t[2]=e>>>24&255,t[3]=e>>>16&255,t[4]=e>>>8&255,t[5]=e&255,ed(t.subarray(6)),t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=Array.from(t,o=>o.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function ed(e){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){crypto.getRandomValues(e);return}for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256)}var Pt=U.scope("persistence");function yt(e,t=Mn,n){let o=n?`${e}.${n}`:e,i=`${x.cssPrefix}.${o}`,a=`${x.cssPrefix}.visitorId`,s=`${i}.conversationId`,l=`${i}.userPrefs`,c=`${i}.panelOpen`,d=`${i}.panelSize`,u=`${i}.calloutDismissed`,_=`${i}.sidebarCollapsed`,m=`${i}.activeModule`,h=`${i}.formsDone`,g={getVisitorId(){let p=t.get(a);if(p)return p;let v=He();return t.set(a,v),v},setVisitorId(p){Pt.debug("setVisitorId (rebind)",{id:p,scope:o}),t.set(a,p)},loadConversationId(){return t.get(s)??void 0},saveConversationId(p){Pt.trace("saveConversationId",{id:p,scope:o}),p?t.set(s,p):t.remove(s)},loadUserPrefs(){let p=t.get(l);if(!p)return{};try{let v=JSON.parse(p);return Ui(v)?v:{}}catch(v){return Pt.warn("loadUserPrefs parse failed",{error:v}),{}}},saveUserPrefs(p){try{t.set(l,JSON.stringify(p))}catch(v){Pt.warn("saveUserPrefs serialise failed",{error:v})}},patchUserPrefs(p){let v=g.loadUserPrefs();g.saveUserPrefs({...v,...p})},loadPanelOpen(){let p=t.get(c);return p==="1"?!0:p==="0"?!1:null},savePanelOpen(p){t.set(c,p?"1":"0")},loadPanelSize(){let p=t.get(d);return p==="normal"||p==="expanded"||p==="fullscreen"?p:null},savePanelSize(p){t.set(d,p)},loadCalloutDismissed(p){if(!p)return!1;let v=t.get(u);return!!v&&v===p},saveCalloutDismissed(p){p?t.set(u,p):t.remove(u)},loadSidebarCollapsed(){let p=t.get(_);return p==="1"?!0:p==="0"?!1:null},saveSidebarCollapsed(p){t.set(_,p?"1":"0")},loadActiveModule(){return t.get(m)||null},saveActiveModule(p){t.set(m,p)},loadFormsDone(){let p=t.get(h);if(!p)return{};try{let v=JSON.parse(p);return Ui(v)?v:{}}catch(v){return Pt.warn("loadFormsDone parse failed",{error:v}),{}}},saveFormDone(p){try{let v=g.loadFormsDone();v[p]=Date.now(),t.set(h,JSON.stringify(v))}catch(v){Pt.warn("saveFormDone serialise failed",{error:v})}},clearConversation(){t.remove(s)}};return g}function Ui(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Wi=`:host{--__P__-accent-user: __BRAND_ACCENT__;--__P__-accent: var(--__P__-accent-user);--__P__-accent-text-user: __BRAND_ACCENT_TEXT__;--__P__-accent-text: var(--__P__-accent-text-user);--__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-scale: 1;--__P__-text-xs: calc(12px * var(--__P__-text-scale));--__P__-text-sm: calc(13px * var(--__P__-text-scale));--__P__-text-base: calc(15px * var(--__P__-text-scale));--__P__-text-md: calc(16px * var(--__P__-text-scale));--__P__-text-lg: calc(18px * var(--__P__-text-scale));--__P__-text-xl: calc(22px * var(--__P__-text-scale));--__P__-text-2xl: calc(30px * var(--__P__-text-scale))}:host([data-text-size="small"]){--__P__-text-scale: .9}:host([data-text-size="large"]){--__P__-text-scale: 1.15}:host{--__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;--__P__-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;--__P__-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;--__P__-color-scheme: dark}}@supports (color: oklch(from red l c h)){:host{--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.3, l, .62) c h);--__P__-accent-text: oklch(from var(--__P__-accent) clamp(0, (l / .623 - 1) * -infinity, 1) 0 h)}:host([data-theme="dark"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h)}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h)}}}@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 Vi=`.__P__-anchor{color-scheme:var(--__P__-color-scheme, light);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:calc(14px * var(--__P__-text-scale))}.__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:calc(14px * var(--__P__-text-scale));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:color-mix(in srgb,currentColor 15%,transparent)}.__P__-callout-close:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__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)}@media(prefers-reduced-motion:no-preference){.__P__-panel{transition:width var(--__P__-dur-base) var(--__P__-ease),height var(--__P__-dur-base) var(--__P__-ease),max-width var(--__P__-dur-base) var(--__P__-ease),max-height var(--__P__-dur-base) var(--__P__-ease)}.__P__-panel[data-resizing]{transition:none}}: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}@media(max-width:640px){:host([data-mode="open"]) .__P__-anchor,:host([data-mode="expanded"]) .__P__-anchor{inset:0;align-items:stretch;padding:0}:host([data-mode="open"]) .__P__-panel,:host([data-mode="expanded"]) .__P__-panel{width:100vw;height:100dvh;max-width:none;max-height:none;border-radius:0;border:0}}: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:10px 12px;border-bottom:1px solid var(--__P__-border);background:var(--__P__-bg)}.__P__-header h1{font-size:calc(14px * var(--__P__-text-scale));font-weight:600;flex:1;letter-spacing:-.01em}.__P__-header-actions{margin-left:auto;display:flex;align-items:center;gap:var(--__P__-space-1);flex-shrink:0}.__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:calc(14px * var(--__P__-text-scale));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,.__P__-history,.__P__-module-scroll,.__P__-home-scroll,.__P__-help-list,.__P__-tool-args,.__P__-sidebar-conversations{scrollbar-width:thin;scrollbar-color:var(--__P__-border-strong) transparent;overscroll-behavior:contain;scrollbar-gutter:stable}.__P__-list::-webkit-scrollbar,.__P__-history::-webkit-scrollbar,.__P__-module-scroll::-webkit-scrollbar,.__P__-home-scroll::-webkit-scrollbar,.__P__-help-list::-webkit-scrollbar,.__P__-tool-args::-webkit-scrollbar,.__P__-sidebar-conversations::-webkit-scrollbar{width:8px}.__P__-list::-webkit-scrollbar-thumb,.__P__-history::-webkit-scrollbar-thumb,.__P__-module-scroll::-webkit-scrollbar-thumb,.__P__-home-scroll::-webkit-scrollbar-thumb,.__P__-help-list::-webkit-scrollbar-thumb,.__P__-tool-args::-webkit-scrollbar-thumb,.__P__-sidebar-conversations::-webkit-scrollbar-thumb{background:var(--__P__-border-strong);border-radius:8px}.__P__-list-wrap{position:relative;flex:1;min-height:0;display:flex;flex-direction:column}.__P__-jump{position:absolute;right:14px;bottom:14px;z-index:2;display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:999px;border:1px solid var(--__P__-border);background:var(--__P__-bg-elevated);color:var(--__P__-fg);box-shadow:var(--__P__-shadow-panel);cursor:pointer;opacity:.85;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease);animation:__P__-bubble-in var(--__P__-dur-base) var(--__P__-ease)}.__P__-jump:hover{opacity:1}.__P__-jump:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;opacity:1}.__P__-jump:active{transform:translateY(1px)}.__P__-jump svg{width:18px;height:18px}.__P__-list{flex:1;min-height:0;overflow-y:auto;padding:var(--__P__-space-4);padding-bottom:var(--__P__-space-8);display:flex;flex-direction:column;gap:14px}.__P__-date-divider{position:sticky;top:var(--__P__-space-2);z-index:2;display:flex;justify-content:center;align-items:flex-start;height:0;margin:0;pointer-events:none}.__P__-date-pill{padding:3px 10px;border-radius:999px;font-size:calc(11px * var(--__P__-text-scale));font-weight:600;color:var(--__P__-fg-muted);background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);box-shadow:var(--__P__-shadow-card);opacity:0;pointer-events:none;transition:opacity var(--__P__-dur-base) var(--__P__-ease)}.__P__-list[data-scrolling=true] .__P__-date-pill{opacity:1;pointer-events:auto}@media(prefers-reduced-motion:reduce){.__P__-date-pill{transition:none}}.__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:100%;padding:var(--__P__-space-3) var(--__P__-space-4);border-radius:var(--__P__-radius);line-height:1.6;font-size:calc(14px * var(--__P__-text-scale));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)}.__P__-bubble-row[data-role=user] .__P__-bubble ::selection{background:#fff6;color:var(--__P__-bubble-user-text)}@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:5px}.__P__-bubble-row[data-role=assistant] .__P__-bubble{background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border-bottom-left-radius:5px}.__P__-bubble-col{display:flex;flex-direction:column;max-width:85%;min-width:0}.__P__-bubble-row[data-role=user] .__P__-bubble-col{align-items:flex-end}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col{align-items:flex-start}.__P__-bubble-time{margin-top:3px;padding:0 4px;font-size:calc(11px * var(--__P__-text-scale));line-height:1;color:var(--__P__-fg-muted);user-select:none}.__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:calc(12.5px * var(--__P__-text-scale));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:5px;height:5px;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:hover{color:var(--__P__-fg)}.__P__-reasoning-summary:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__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:calc(14px * var(--__P__-text-scale));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:max(16px,calc(16px * var(--__P__-text-scale)))}.__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:calc(14px * var(--__P__-text-scale));text-align:center}.__P__-history-group{display:flex;flex-direction:column;padding:0 var(--__P__-space-3)}.__P__-history-heading{font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);padding:14px 4px 8px;text-transform:uppercase;letter-spacing:.04em}.__P__-history-card{display:flex;flex-direction:column;background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-lg, 14px);overflow:hidden}.__P__-history-item{all:unset;display:flex;align-items:center;gap:var(--__P__-space-3);padding:12px var(--__P__-space-3);cursor:pointer;transition:background var(--__P__-dur-base) var(--__P__-ease)}.__P__-history-item+.__P__-history-item{border-top:1px solid var(--__P__-border)}.__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-avatar{flex:none;display:grid;place-items:center;width:36px;height:36px;border-radius:50%;background:color-mix(in oklab,var(--__P__-accent) 12%,transparent);color:var(--__P__-accent)}.__P__-history-avatar svg{width:18px;height:18px}.__P__-history-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.__P__-history-row{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-2)}.__P__-history-title{flex:1;min-width:0;font-size:calc(14px * var(--__P__-text-scale));font-weight:500;color:var(--__P__-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-history-time{flex:none;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-history-preview{flex:1;min-width:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-history-dot{flex:none;width:8px;height:8px;border-radius:50%;background:var(--__P__-accent)}.__P__-history-item[data-unread=true] .__P__-history-title{font-weight:600}.__P__-history-item[data-closed=true] .__P__-history-title{color:var(--__P__-fg-muted)}.__P__-history-skeleton-item{display:flex;align-items:center;gap:var(--__P__-space-3);padding:12px var(--__P__-space-3)}.__P__-history-skeleton-item+.__P__-history-skeleton-item{border-top:1px solid var(--__P__-border)}.__P__-history-skeleton-avatar{flex:none;width:36px;height:36px;border-radius:50%}.__P__-history-skeleton-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:7px}.__P__-history-skeleton-line{height:9px;border-radius:4px}.__P__-skeleton-title{width:45%}.__P__-skeleton-preview{width:78%}.__P__-history-skeleton-avatar,.__P__-history-skeleton-line{background:linear-gradient(90deg,var(--__P__-bg-elevated) 25%,color-mix(in oklab,var(--__P__-bg-elevated) 55%,var(--__P__-border)) 50%,var(--__P__-bg-elevated) 75%);background-size:200% 100%;animation:__P__-skeleton-shimmer 1.4s ease-in-out infinite}@keyframes __P__-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){.__P__-history-skeleton-avatar,.__P__-history-skeleton-line{animation:none}}.__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:calc(11px * var(--__P__-text-scale));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:calc(11px * var(--__P__-text-scale));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__-menu-item-segmented{cursor:default}.__P__-menu-item-segmented:hover{background:transparent}.__P__-segmented{display:inline-flex;gap:2px;padding:2px;background:var(--__P__-bg-elevated);border-radius:var(--__P__-radius-sm)}.__P__-segment{all:unset;min-width:26px;padding:3px 8px;font-size:var(--__P__-text-xs);font-weight:600;letter-spacing:.02em;text-align:center;color:var(--__P__-fg-muted);border-radius:calc(var(--__P__-radius-sm) - 2px);cursor:pointer;transition:color .12s ease,background .12s ease}.__P__-segment:hover{color:var(--__P__-fg)}.__P__-segment[data-on=true]{background:var(--__P__-bg);color:var(--__P__-accent);box-shadow:var(--__P__-shadow-card)}.__P__-segment:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__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}@keyframes __P__-view-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.__P__-module{display:flex;flex-direction:column;height:100%;min-height:0}@media(prefers-reduced-motion:no-preference){.__P__-module,.__P__-history{animation:__P__-view-in .18s var(--__P__-ease-out)}}.__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{container-type:inline-size;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__-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:calc(10px * var(--__P__-text-scale));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:clamp(calc(12px * var(--__P__-text-scale)),calc(3.2cqi * var(--__P__-text-scale)),calc(14px * var(--__P__-text-scale)));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-hero-actions .__P__-icon-btn{color:#fff}.__P__-home-hero-actions .__P__-icon-btn:hover{background:color-mix(in srgb,#fff 18%,transparent);color:#fff}.__P__-home-hero-actions .__P__-icon-btn:active{background:color-mix(in srgb,#fff 26%,transparent)}.__P__-home-greeting{margin:28px 0 0;font-family:var(--__P__-font-display);font-size:clamp(calc(19px * var(--__P__-text-scale)),calc(5.5cqi * var(--__P__-text-scale)),var(--__P__-text-2xl));font-weight:800;line-height:1.18;letter-spacing:-.01em;overflow-wrap:anywhere}.__P__-home-lead{margin:10px 0 0;font-family:var(--__P__-font-display);font-size:clamp(calc(15px * var(--__P__-text-scale)),calc(4.2cqi * var(--__P__-text-scale)),var(--__P__-text-xl));font-weight:600;line-height:1.25;letter-spacing:-.005em;color:color-mix(in srgb,var(--__P__-on-accent) 78%,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:calc(14px * var(--__P__-text-scale))}.__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:calc(14px * var(--__P__-text-scale))}.__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:calc(14px * var(--__P__-text-scale))}.__P__-home-search-input{flex:1;border:0;background:transparent;font-size:calc(14px * var(--__P__-text-scale));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__-hover)}.__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:calc(14px * var(--__P__-text-scale));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)}.__P__-form{display:flex;flex-direction:column;gap:var(--__P__-space-4)}.__P__-field{display:flex;flex-direction:column;gap:6px}.__P__-field-label{font-size:var(--__P__-text-sm);font-weight:600;color:var(--__P__-fg)}.__P__-field-req{color:var(--__P__-danger)}.__P__-field-input{width:100%;min-width:0;max-width:100%;box-sizing:border-box;padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);color:var(--__P__-fg);font:inherit;font-size:var(--__P__-text-sm);resize:vertical;transition:border-color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-field-input:focus-visible{outline:none;border-color:var(--__P__-accent)}.__P__-field[data-invalid=true] .__P__-field-input{border-color:var(--__P__-danger)}.__P__-field-input[type=date],.__P__-field-input[type=time]{appearance:none;-webkit-appearance:none}@media(pointer:coarse){.__P__-field-input{font-size:max(16px,calc(16px * var(--__P__-text-scale)))}}.__P__-field-hint{font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-field-error{font-size:var(--__P__-text-xs);color:var(--__P__-danger)}.__P__-field-choices{display:flex;flex-direction:column;gap:10px;padding-top:2px}.__P__-choice{display:flex;align-items:flex-start;gap:10px;font-size:var(--__P__-text-sm);color:var(--__P__-fg);cursor:pointer}.__P__-choice input{margin-top:2px;accent-color:var(--__P__-accent)}.__P__-form-actions{display:flex;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}.__P__-form-submit,.__P__-tool-approve{padding:var(--__P__-space-2) var(--__P__-space-4);border:none;border-radius:var(--__P__-radius-md);background:var(--__P__-accent);color:var(--__P__-accent-text, #fff);font:inherit;font-weight:600;font-size:var(--__P__-text-sm);cursor:pointer;transition:filter var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-submit:hover:not(:disabled),.__P__-tool-approve:hover:not(:disabled){filter:brightness(1.06)}.__P__-form-submit:disabled{opacity:.6;cursor:default}.__P__-form-skip,.__P__-tool-reject{padding:var(--__P__-space-2) var(--__P__-space-4);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:transparent;color:var(--__P__-fg-muted);font:inherit;font-size:var(--__P__-text-sm);cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-skip:hover:not(:disabled),.__P__-tool-reject:hover:not(:disabled){background:var(--__P__-bg-elevated)}.__P__-form-gate{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg-elevated)}.__P__-form-gate-title{margin:0;font-size:var(--__P__-text-base);font-weight:700;color:var(--__P__-fg)}.__P__-form-gate-desc{margin:0 0 var(--__P__-space-1);font-size:var(--__P__-text-sm);color:var(--__P__-fg-muted)}.__P__-form-done{display:flex;align-items:center;justify-content:center;gap:6px;padding:6px 12px;border:1px dashed var(--__P__-border);border-radius:999px;align-self:center;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted)}.__P__-form-done svg{width:14px;height:14px;color:var(--__P__-success, #22c55e)}.__P__-form-done[data-outcome=skipped] svg{color:var(--__P__-fg-muted)}.__P__-form-done-fill{border:0;background:none;padding:0 2px;cursor:pointer;font:inherit;font-weight:600;color:var(--__P__-accent)}.__P__-form-done-fill:hover{text-decoration:underline}details.__P__-form-done{display:block;padding:0;border-radius:var(--__P__-radius-md)}details[open].__P__-form-done{width:min(100%,420px);background:var(--__P__-surface)}.__P__-form-done-summary{display:flex;align-items:center;justify-content:center;gap:6px;padding:8px 12px;cursor:pointer;list-style:none}.__P__-form-done-summary::-webkit-details-marker{display:none}.__P__-form-done-summary>svg:last-child{color:var(--__P__-fg-muted);transition:transform .15s var(--__P__-ease)}details[open]>.__P__-form-done-summary>svg:last-child{transform:rotate(90deg)}.__P__-form-answers{margin:0;padding:var(--__P__-space-2) var(--__P__-space-3) var(--__P__-space-3);display:grid;gap:var(--__P__-space-3);text-align:left}.__P__-form-answer{display:grid;gap:6px}.__P__-form-answer dt{font-size:var(--__P__-text-sm);font-weight:600;color:var(--__P__-fg)}.__P__-form-answer dd{margin:0;padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);font-size:var(--__P__-text-sm);font-weight:400;color:var(--__P__-fg);overflow-wrap:anywhere}.__P__-tool-ask-input,.__P__-tool-approval{display:flex;flex-direction:column;gap:var(--__P__-space-2);margin-top:6px;padding:var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg-elevated)}.__P__-tool-head{display:flex;align-items:center;flex-wrap:wrap;gap:8px}.__P__-tool-badge{padding:2px 8px;border-radius:999px;background:var(--__P__-warning, #f59e0b);color:#1a1206;font-size:var(--__P__-text-xs);font-weight:600}.__P__-tool-title{font-size:var(--__P__-text-sm);color:var(--__P__-fg)}.__P__-tool-question{margin:0;font-size:var(--__P__-text-sm);font-weight:600;color:var(--__P__-fg)}.__P__-tool-desc{margin:0;font-size:var(--__P__-text-sm);color:var(--__P__-fg-muted)}.__P__-tool-args{margin:0;padding:var(--__P__-space-2);max-height:160px;overflow:auto;border-radius:var(--__P__-radius-sm);background:var(--__P__-bg);border:1px solid var(--__P__-border);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);white-space:pre-wrap;word-break:break-word}.__P__-tool-stale-note{margin:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-tool-decided{flex-direction:row;align-items:center;flex-wrap:wrap;gap:8px}.__P__-tool-decided-label{padding:2px 8px;border-radius:999px;background:var(--__P__-bg);border:1px solid var(--__P__-border);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);font-weight:600}.__P__-tool-decided-label[data-approved=true]{color:var(--__P__-success, #16a34a);border-color:var(--__P__-success, #16a34a)}.__P__-tool-decided-label[data-approved=false]{color:var(--__P__-danger);border-color:var(--__P__-danger)}.__P__-tool-decided-value{font-size:var(--__P__-text-sm);color:var(--__P__-fg)}
4
4
  `;var Ki=`.__P__-standalone-page{margin:0;height:100vh;background:var(--__P__-bg, #fff);display:grid;place-items:stretch}
5
5
  `;var qi=`:host([data-mode="page"]){min-height:0}:host([data-mode="page"]) .__P__-page-shell{display:grid;grid-template-columns:280px 1fr;width:100%;height:100%;min-height:0;background:var(--__P__-bg);color:var(--__P__-fg);transition:grid-template-columns var(--__P__-dur-base) var(--__P__-ease-in-out)}:host([data-mode="page"]) .__P__-page-shell[data-sidebar-collapsed=true]{grid-template-columns:48px 1fr}:host([data-mode="page"]) .__P__-page-chat{display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden}:host([data-mode="page"]) .__P__-anchor{position:static;inset:auto;padding:0;align-items:stretch;width:100%;height:100%;min-width:0;min-height:0;flex:1 1 0}:host([data-mode="page"]) .__P__-panel{width:100%;height:100%;min-width:0;min-height:0;max-width:none;max-height:none;border-radius:0;border:0;box-shadow:none;animation:none}:host([data-mode="page"]) .__P__-sidebar{border-right:1px solid var(--__P__-border);display:flex;flex-direction:column;overflow:hidden;background:var(--__P__-surface)}:host([data-mode="page"]) .__P__-sidebar-header{padding:var(--__P__-space-4) var(--__P__-space-5);border-bottom:1px solid var(--__P__-border);display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-2);min-height:56px;box-sizing:border-box}:host([data-mode="page"]) .__P__-sidebar[data-collapsed=true] .__P__-sidebar-header{padding:var(--__P__-space-4) var(--__P__-space-2);justify-content:center}:host([data-mode="page"]) .__P__-sidebar[data-collapsed=true] .__P__-sidebar-logo,:host([data-mode="page"]) .__P__-sidebar[data-collapsed=true] .__P__-sidebar-title{display:none}:host([data-mode="page"]) .__P__-sidebar-toggle{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:1px solid var(--__P__-border);border-radius:6px;background:transparent;color:var(--__P__-fg);cursor:pointer;transition:background .12s,border-color .12s}:host([data-mode="page"]) .__P__-sidebar-toggle:hover{background:var(--__P__-hover);border-color:var(--__P__-accent)}:host([data-mode="page"]) .__P__-sidebar-toggle:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}:host([data-mode="page"]) .__P__-sidebar-logo{height:32px;display:block}:host([data-mode="page"]) .__P__-sidebar-title{font-size:var(--__P__-text-md);font-weight:600}:host([data-mode="page"]) .__P__-sidebar-section{padding:var(--__P__-space-3) var(--__P__-space-4);border-bottom:1px solid var(--__P__-border)}:host([data-mode="page"]) .__P__-sidebar-nav{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}:host([data-mode="page"]) .__P__-sidebar-nav-item{display:flex;align-items:center;gap:10px;padding:var(--__P__-space-2) var(--__P__-space-3);border-radius:var(--__P__-radius-sm);color:var(--__P__-fg);text-decoration:none;font-size:calc(14px * var(--__P__-text-scale));transition:background var(--__P__-dur-quick) var(--__P__-ease-out)}:host([data-mode="page"]) .__P__-sidebar-nav-item:hover{background:var(--__P__-hover)}:host([data-mode="page"]) .__P__-sidebar-nav-item:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}:host([data-mode="page"]) .__P__-sidebar-cards{display:grid;grid-template-columns:1fr;gap:var(--__P__-space-2)}:host([data-mode="page"]) .__P__-sidebar-card{display:block;padding:10px 12px;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-sm);text-decoration:none;color:var(--__P__-fg);transition:border-color var(--__P__-dur-quick) var(--__P__-ease-out)}:host([data-mode="page"]) .__P__-sidebar-card:hover{border-color:var(--__P__-accent)}:host([data-mode="page"]) .__P__-sidebar-card:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}:host([data-mode="page"]) .__P__-sidebar-card-label{font-weight:600;font-size:calc(14px * var(--__P__-text-scale))}:host([data-mode="page"]) .__P__-sidebar-card-desc{font-size:var(--__P__-text-xs);color:var(--__P__-muted);margin-top:2px}:host([data-mode="page"]) .__P__-sidebar-conversations{flex:1 1 auto;overflow-y:auto;padding:var(--__P__-space-3) var(--__P__-space-4)}:host([data-mode="page"]) .__P__-page-chat{display:flex;flex-direction:column;overflow:hidden}@media(max-width:768px){:host([data-mode="page"]) .__P__-page-shell{grid-template-columns:1fr}:host([data-mode="page"]) .__P__-sidebar{display:none}}
6
6
  `;var ad="helpai",sd="#5B5BD6",ld="#FFFFFF",cd="12px",dd="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",_r=[Wi,Gi,Vi,Ki,qi].join(`
7
- `).replace(/__P__/g,ad).replaceAll("__BRAND_ACCENT_TEXT__",ld).replaceAll("__BRAND_ACCENT__",sd).replaceAll("__BRAND_RADIUS__",cd).replaceAll("__BRAND_FONT__",dd);var _d=U.scope("mount"),ji=new WeakMap,Xi={floating:"all: initial; position: fixed; z-index: 2147483600;",flow:"all: initial; display: block; position: relative; width: 100%; height: 100%; z-index: 1; contain: size;",viewport:"all: initial; display: block; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1;"};function Ji(e,t){e.style.cssText=Xi[t]}function jt(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Fn(e={}){let t=e.position??"flow";_d.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${x.cssPrefix}-chat-host`;typeof customElements<"u"&&!customElements.get(n)&&customElements.define(n,class extends HTMLElement{});let o;e.existingHost?o=e.existingHost:(o=document.createElement(n),(e.target??document.body).appendChild(o)),o.setAttribute("data-brand",x.id),o.style.cssText=Xi[t];let i=o.shadowRoot??o.attachShadow({mode:"open"}),a=o.ownerDocument;if(!ud(i,a)){let l=a.createElement("style");l.textContent=_r,i.appendChild(l)}let s=document.createElement("div");return s.className=`${x.cssPrefix}-app`,i.appendChild(s),{appRoot:s,destroy:()=>o.remove(),hostElement:o,shadowRoot:i}}function ud(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let o=ji.get(t);if(!o)try{o=new n.CSSStyleSheet,o.replaceSync(_r),ji.set(t,o)}catch{return!1}try{return e.adoptedStyleSheets=[o],!0}catch{return!1}}function pd(e,t){let n=x.cssPrefix;t.accent&&e.style.setProperty(`--${n}-accent-user`,t.accent),t.accentText&&e.style.setProperty(`--${n}-accent-text-user`,t.accentText),t.radius&&e.style.setProperty(`--${n}-radius`,t.radius),t.fontFamily&&e.style.setProperty(`--${n}-font`,t.fontFamily)}function fd(e,t){e.dataset.theme=t}function md(e,t){let n=x.cssPrefix;t.width!==void 0&&e.style.setProperty(`--${n}-panel-w`,t.width),t.height!==void 0&&e.style.setProperty(`--${n}-panel-h`,t.height),t.expanded?.width!==void 0&&e.style.setProperty(`--${n}-expanded-w`,t.expanded.width),t.expanded?.height!==void 0&&e.style.setProperty(`--${n}-expanded-h`,t.expanded.height),t.inset!==void 0&&e.style.setProperty(`--${n}-panel-inset`,t.inset)}function gd(e,t){e.dataset.position=t}function Bn(e,t){e.dataset.mode=t}function Yi(e,t){fd(e,t.themeMode),pd(e,t.themeOverrides),gd(e,t.position),md(e,t.size)}var hd=U.scope("iframe"),vd='<!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 ea(e,t,n="closed",o="floating",i=null){hd.debug("createIframeMount",{position:t,initialMode:n,layoutMode:o,hasTarget:!!i});let a=document.createElement("iframe");a.title=`${x.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),Zi(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(vd),l.close();let c=Fn({...e,target:l.body}),d=new MutationObserver(()=>{Zi(a,t,c.hostElement.dataset.mode??"closed",o)});return d.observe(c.hostElement,{attributes:!0,attributeFilter:["data-mode"]}),{...c,iframeElement:a,destroy(){d.disconnect(),c.destroy(),a.remove()}}}var zn="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",Qi={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 Zi(e,t,n,o){if(n==="fullscreen"||o==="standalone"){e.style.cssText=`${zn}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(o==="inline"){e.style.cssText=`${zn}position:static;display:block;width:100%;height:100%;`;return}if(typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches&&(n==="open"||n==="expanded")){e.style.cssText=`${zn}position:fixed;inset:0;width:100vw;height:100vh;`;return}let a=t.startsWith("top-")?"top":"bottom",s=t.endsWith("-left")?"left":"right",{w:l,h:c}=Qi[n]??Qi.open;e.style.cssText=`${zn}position:fixed;${a}:16px;${s}:16px;width:${l};height:${c};`}var Un=class{constructor(){j(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 St,se,ur,ta,Xt=0,ca=[],_e=q,na=_e.__b,oa=_e.__r,ra=_e.diffed,ia=_e.__c,aa=_e.unmount,sa=_e.__;function Gn(e,t){_e.__h&&_e.__h(se,e,Xt||t),Xt=0;var n=se.__H||(se.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function k(e){return Xt=1,bd(da,e)}function bd(e,t,n){var o=Gn(St++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):da(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],d=o.t(c,l);c!==d&&(o.__N=[d,o.__[1]],o.__c.setState({}))}],o.__c=se,!se.__f)){var i=function(l,c,d){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(g){return g.__c});if(u.every(function(g){return!g.__N}))return!a||a.call(this,l,c,d);var _=o.__c.props!==l;return u.some(function(g){if(g.__N){var p=g.__[0];g.__=g.__N,g.__N=void 0,p!==g.__[0]&&(_=!0)}}),a&&a.call(this,l,c,d)||_};se.__f=!0;var a=se.shouldComponentUpdate,s=se.componentWillUpdate;se.componentWillUpdate=function(l,c,d){if(this.__e){var u=a;a=void 0,i(l,c,d),a=u}s&&s.call(this,l,c,d)},se.shouldComponentUpdate=i}return o.__N||o.__}function w(e,t){var n=Gn(St++,3);!_e.__s&&mr(n.__H,t)&&(n.__=e,n.u=t,se.__H.__h.push(n))}function fr(e,t){var n=Gn(St++,4);!_e.__s&&mr(n.__H,t)&&(n.__=e,n.u=t,se.__h.push(n))}function M(e){return Xt=5,xe(function(){return{current:e}},[])}function xe(e,t){var n=Gn(St++,7);return mr(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function H(e,t){return Xt=8,xe(function(){return e},t)}function xd(){for(var e;e=ca.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Wn),t.__h.some(pr),t.__h=[]}catch(n){t.__h=[],_e.__e(n,e.__v)}}}_e.__b=function(e){se=null,na&&na(e)},_e.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),sa&&sa(e,t)},_e.__r=function(e){oa&&oa(e),St=0;var t=(se=e.__c).__H;t&&(ur===se?(t.__h=[],se.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Wn),t.__h.some(pr),t.__h=[],St=0)),ur=se},_e.diffed=function(e){ra&&ra(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ca.push(t)!==1&&ta===_e.requestAnimationFrame||((ta=_e.requestAnimationFrame)||Pd)(xd)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),ur=se=null},_e.__c=function(e,t){t.some(function(n){try{n.__h.some(Wn),n.__h=n.__h.filter(function(o){return!o.__||pr(o)})}catch(o){t.some(function(i){i.__h&&(i.__h=[])}),t=[],_e.__e(o,n.__v)}}),ia&&ia(e,t)},_e.unmount=function(e){aa&&aa(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{Wn(o)}catch(i){t=i}}),n.__H=void 0,t&&_e.__e(t,n.__v))};var la=typeof requestAnimationFrame=="function";function Pd(e){var t,n=function(){clearTimeout(o),la&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);la&&(t=requestAnimationFrame(n))}function Wn(e){var t=se,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),se=t}function pr(e){var t=se;e.__c=e.__(),se=t}function mr(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function da(e,t){return typeof t=="function"?t(e):t}var yd=Symbol.for("preact-signals");function jn(){if(Ke>1)Ke--;else{var e,t=!1;for((function(){var i=Kn;for(Kn=void 0;i!==void 0;)i.S.v===i.v&&(i.S.i=i.i),i=i.o})();Jt!==void 0;){var n=Jt;for(Jt=void 0,Vn++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&pa(n))try{n.c()}catch(i){t||(e=i,t=!0)}n=o}}if(Vn=0,Ke--,t)throw e}}function hr(e){if(Ke>0)return e();gr=++Sd,Ke++;try{return e()}finally{jn()}}var ee=void 0;function Xn(e){var t=ee;ee=void 0;try{return e()}finally{ee=t}}var _a,Jt=void 0,Ke=0,Vn=0,Sd=0,gr=0,Kn=void 0,qn=0;function ua(e){if(ee!==void 0){var t=e.n;if(t===void 0||t.t!==ee)return t={i:0,S:e,p:ee.s,n:void 0,t:ee,e:void 0,x:void 0,r:t},ee.s!==void 0&&(ee.s.n=t),ee.s=t,e.n=t,32&ee.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=ee.s,t.n=void 0,ee.s.n=t,ee.s=t),t}}function ge(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}ge.prototype.brand=yd;ge.prototype.h=function(){return!0};ge.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:Xn(function(){var o;(o=t.W)==null||o.call(t)}))};ge.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&&Xn(function(){var i;(i=t.Z)==null||i.call(t)}))}};ge.prototype.subscribe=function(e){var t=this;return qe(function(){var n=t.value,o=ee;ee=void 0;try{e(n)}finally{ee=o}},{name:"sub"})};ge.prototype.valueOf=function(){return this.value};ge.prototype.toString=function(){return this.value+""};ge.prototype.toJSON=function(){return this.value};ge.prototype.peek=function(){var e=this;return Xn(function(){return e.value})};Object.defineProperty(ge.prototype,"value",{get:function(){var e=ua(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Vn>100)throw new Error("Cycle detected");(function(n){Ke!==0&&Vn===0&&n.l!==gr&&(n.l=gr,Kn={S:n,v:n.v,i:n.i,o:Kn})})(this),this.v=e,this.i++,qn++,Ke++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{jn()}}}});function F(e,t){return new ge(e,t)}function pa(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 fa(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 ma(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 ot(e,t){ge.call(this,void 0),this.x=e,this.s=void 0,this.g=qn-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}ot.prototype=new ge;ot.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===qn))return!0;if(this.g=qn,this.f|=1,this.i>0&&!pa(this))return this.f&=-2,!0;var e=ee;try{fa(this),ee=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 ee=e,ma(this),this.f&=-2,!0};ot.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)}ge.prototype.S.call(this,e)};ot.prototype.U=function(e){if(this.t!==void 0&&(ge.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)}};ot.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(ot.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=ua(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Yt(e,t){return new ot(e,t)}function ga(e){var t=e.m;if(e.m=void 0,typeof t=="function"){Ke++;var n=ee;ee=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,vr(e),o}finally{ee=n,jn()}}}function vr(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ga(e)}function wd(e){if(ee!==this)throw new Error("Out-of-order effect");ma(this),ee=e,this.f&=-2,8&this.f&&vr(this),jn()}function wt(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,_a&&_a.push(this)}wt.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()}};wt.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ga(this),fa(this),Ke++;var e=ee;return ee=this,wd.bind(this,e)};wt.prototype.N=function(){2&this.f||(this.f|=2,this.u=Jt,Jt=this)};wt.prototype.d=function(){this.f|=8,1&this.f||vr(this)};wt.prototype.dispose=function(){this.d()};function qe(e,t){var n=new wt(e,t);try{n.c()}catch(i){throw n.d(),i}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var ha,Qn,Jn,kd=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var va=[];qe(function(){ha=this.N})();function kt(e,t){q[e]=t.bind(null,q[e]||function(){})}function Yn(e){if(Jn){var t=Jn;Jn=void 0,t()}Jn=e&&e.S()}function ba(e){var t=this,n=e.data,o=rt(n);o.value=n;var i=xe(function(){for(var l=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var d=Yt(function(){var p=o.value.value;return p===0?0:p===!0?"":p||""}),u=Yt(function(){return!Array.isArray(d.value)&&!qo(d.value)}),_=qe(function(){if(this.N=xa,u.value){var p=d.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=p)}}),g=t.__$u.d;return t.__$u.d=function(){_(),g.call(this)},[u,d]},[]),a=i[0],s=i[1];return a.value?s.peek():s.value}ba.displayName="ReactiveTextNode";Object.defineProperties(ge.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:ba},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});kt("__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 ge&&(n||(t.__np=n={}),n[i]=a,o[i]=a.peek())}}e(t)});kt("__r",function(e,t){if(e(t),t.type!==ne){Yn();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(i,a){var s;return qe(function(){s=this},{name:a}),s.c=i,s})(function(){var i;kd&&((i=n.y)==null||i.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),Qn=o,Yn(n)}});kt("__e",function(e,t,n,o){Yn(),Qn=void 0,e(t,n,o)});kt("diffed",function(e,t){Yn(),Qn=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 d=a[c],u=o[c];d===void 0?(d=Cd(n,c,u),a[c]=d):d.o(u,i)}}}e(t)});function Cd(e,t,n,o){var i=t in e&&e.ownerSVGElement===void 0,a=F(n),s=n.peek();return{o:function(l,c){a.value=l,s=l.peek()},d:qe(function(){this.N=xa;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})}}kt("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 d=t.__c;if(d){var u=d.__$u;u&&(d.__$u=void 0,u.d())}}e(t)});kt("__h",function(e,t,n,o){(o<3||o===9)&&(t.__$f|=2),e(t,n,o)});Ze.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 rt(e,t){return xe(function(){return F(e,t)},[])}function re(e,t){var n=M(e);return n.current=e,Qn.__$f|=4,xe(function(){return Yt(function(){return n.current()},t)},[])}var Td=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Ed(){hr(function(){for(var e;e=va.shift();)ha.call(e)})}function xa(){va.push(this)===1&&(q.requestAnimationFrame||Td)(Ed)}function Pa(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function ya(e){return Pa(e)}function Sa(e){return!(!Pa(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function Zn(e,t,n){return e==="page"?"page":e==="standalone"?"standalone":e==="inline"?t==="fullscreen"?"fullscreen":"inline":e==="modal"||e==="drawer"?n?t==="fullscreen"?"fullscreen":e:"closed":n?t==="fullscreen"?"fullscreen":t==="expanded"?"expanded":"open":"closed"}var Id=900;function br(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let o=t.initialSize;if(o==="expanded"||o==="fullscreen"||o==="normal")return o;if(o==="auto"){let i=t.autoSizeBreakpoint??Id;return n>=i?"expanded":"normal"}return"normal"}function Qt(e,t,n,o=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),l=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&o?o:br(e.mode,e.size,t);return{panelOpen:a,panelSize:l}}function Ct(){return typeof window>"u"?0:window.innerWidth}var Ad="x-public-key",Rd="x-ai-agent-deployment-id";function wa(e){return{headers(){let t={};return e.aiAgentDeploymentId&&(t[Rd]=e.aiAgentDeploymentId),e.publicKey&&(t[e.publicKeyHeader??Ad]=e.publicKey),t}}}var Le=class extends Error{constructor(n,o,i,a){super(n);j(this,"code",o);j(this,"status",i);j(this,"cause",a);this.name="StreamError"}};var ka=U.scope("parser");async function*xr(e,t){if(!e.ok){let i=await e.text().catch(()=>"");throw new Le(`server responded ${e.status}: ${i.slice(0,200)}`,"server",e.status)}if(!e.body)throw new Le("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),o="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:i,value:a}=await n.read();if(i){let l=o.trim();if(l){let c=Ca(l);c&&(yield c)}return}o+=a;let s;for(;(s=o.indexOf(`
7
+ `).replace(/__P__/g,ad).replaceAll("__BRAND_ACCENT_TEXT__",ld).replaceAll("__BRAND_ACCENT__",sd).replaceAll("__BRAND_RADIUS__",cd).replaceAll("__BRAND_FONT__",dd);var _d=U.scope("mount"),ji=new WeakMap,Xi={floating:"all: initial; position: fixed; z-index: 2147483600;",flow:"all: initial; display: block; position: relative; width: 100%; height: 100%; z-index: 1; contain: size;",viewport:"all: initial; display: block; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1;"};function Ji(e,t){e.style.cssText=Xi[t]}function jt(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Fn(e={}){let t=e.position??"flow";_d.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${x.cssPrefix}-chat-host`;typeof customElements<"u"&&!customElements.get(n)&&customElements.define(n,class extends HTMLElement{});let o;e.existingHost?o=e.existingHost:(o=document.createElement(n),(e.target??document.body).appendChild(o)),o.setAttribute("data-brand",x.id),o.style.cssText=Xi[t];let i=o.shadowRoot??o.attachShadow({mode:"open"}),a=o.ownerDocument;if(!ud(i,a)){let l=a.createElement("style");l.textContent=_r,i.appendChild(l)}let s=document.createElement("div");return s.className=`${x.cssPrefix}-app`,i.appendChild(s),{appRoot:s,destroy:()=>o.remove(),hostElement:o,shadowRoot:i}}function ud(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let o=ji.get(t);if(!o)try{o=new n.CSSStyleSheet,o.replaceSync(_r),ji.set(t,o)}catch{return!1}try{return e.adoptedStyleSheets=[o],!0}catch{return!1}}function pd(e,t){let n=x.cssPrefix;t.accent&&e.style.setProperty(`--${n}-accent-user`,t.accent),t.accentText&&e.style.setProperty(`--${n}-accent-text-user`,t.accentText),t.radius&&e.style.setProperty(`--${n}-radius`,t.radius),t.fontFamily&&e.style.setProperty(`--${n}-font`,t.fontFamily)}function fd(e,t){e.dataset.theme=t}function md(e,t){let n=x.cssPrefix;t.width!==void 0&&e.style.setProperty(`--${n}-panel-w`,t.width),t.height!==void 0&&e.style.setProperty(`--${n}-panel-h`,t.height),t.expanded?.width!==void 0&&e.style.setProperty(`--${n}-expanded-w`,t.expanded.width),t.expanded?.height!==void 0&&e.style.setProperty(`--${n}-expanded-h`,t.expanded.height),t.inset!==void 0&&e.style.setProperty(`--${n}-panel-inset`,t.inset)}function gd(e,t){e.dataset.position=t}function Bn(e,t){e.dataset.mode=t}function Yi(e,t){fd(e,t.themeMode),pd(e,t.themeOverrides),gd(e,t.position),md(e,t.size)}var hd=U.scope("iframe"),vd='<!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 ea(e,t,n="closed",o="floating",i=null){hd.debug("createIframeMount",{position:t,initialMode:n,layoutMode:o,hasTarget:!!i});let a=document.createElement("iframe");a.title=`${x.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),Zi(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(vd),l.close();let c=Fn({...e,target:l.body}),d=new MutationObserver(()=>{Zi(a,t,c.hostElement.dataset.mode??"closed",o)});return d.observe(c.hostElement,{attributes:!0,attributeFilter:["data-mode"]}),{...c,iframeElement:a,destroy(){d.disconnect(),c.destroy(),a.remove()}}}var zn="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",Qi={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 Zi(e,t,n,o){if(n==="fullscreen"||o==="standalone"){e.style.cssText=`${zn}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(o==="inline"){e.style.cssText=`${zn}position:static;display:block;width:100%;height:100%;`;return}if(typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches&&(n==="open"||n==="expanded")){e.style.cssText=`${zn}position:fixed;inset:0;width:100vw;height:100vh;`;return}let a=t.startsWith("top-")?"top":"bottom",s=t.endsWith("-left")?"left":"right",{w:l,h:c}=Qi[n]??Qi.open;e.style.cssText=`${zn}position:fixed;${a}:16px;${s}:16px;width:${l};height:${c};`}var Un=class{constructor(){j(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 St,se,ur,ta,Xt=0,ca=[],_e=q,na=_e.__b,oa=_e.__r,ra=_e.diffed,ia=_e.__c,aa=_e.unmount,sa=_e.__;function Gn(e,t){_e.__h&&_e.__h(se,e,Xt||t),Xt=0;var n=se.__H||(se.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function k(e){return Xt=1,bd(da,e)}function bd(e,t,n){var o=Gn(St++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):da(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],d=o.t(c,l);c!==d&&(o.__N=[d,o.__[1]],o.__c.setState({}))}],o.__c=se,!se.__f)){var i=function(l,c,d){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(m){return m.__c});if(u.every(function(m){return!m.__N}))return!a||a.call(this,l,c,d);var _=o.__c.props!==l;return u.some(function(m){if(m.__N){var h=m.__[0];m.__=m.__N,m.__N=void 0,h!==m.__[0]&&(_=!0)}}),a&&a.call(this,l,c,d)||_};se.__f=!0;var a=se.shouldComponentUpdate,s=se.componentWillUpdate;se.componentWillUpdate=function(l,c,d){if(this.__e){var u=a;a=void 0,i(l,c,d),a=u}s&&s.call(this,l,c,d)},se.shouldComponentUpdate=i}return o.__N||o.__}function w(e,t){var n=Gn(St++,3);!_e.__s&&mr(n.__H,t)&&(n.__=e,n.u=t,se.__H.__h.push(n))}function fr(e,t){var n=Gn(St++,4);!_e.__s&&mr(n.__H,t)&&(n.__=e,n.u=t,se.__h.push(n))}function M(e){return Xt=5,xe(function(){return{current:e}},[])}function xe(e,t){var n=Gn(St++,7);return mr(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function H(e,t){return Xt=8,xe(function(){return e},t)}function xd(){for(var e;e=ca.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Wn),t.__h.some(pr),t.__h=[]}catch(n){t.__h=[],_e.__e(n,e.__v)}}}_e.__b=function(e){se=null,na&&na(e)},_e.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),sa&&sa(e,t)},_e.__r=function(e){oa&&oa(e),St=0;var t=(se=e.__c).__H;t&&(ur===se?(t.__h=[],se.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Wn),t.__h.some(pr),t.__h=[],St=0)),ur=se},_e.diffed=function(e){ra&&ra(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ca.push(t)!==1&&ta===_e.requestAnimationFrame||((ta=_e.requestAnimationFrame)||Pd)(xd)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),ur=se=null},_e.__c=function(e,t){t.some(function(n){try{n.__h.some(Wn),n.__h=n.__h.filter(function(o){return!o.__||pr(o)})}catch(o){t.some(function(i){i.__h&&(i.__h=[])}),t=[],_e.__e(o,n.__v)}}),ia&&ia(e,t)},_e.unmount=function(e){aa&&aa(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{Wn(o)}catch(i){t=i}}),n.__H=void 0,t&&_e.__e(t,n.__v))};var la=typeof requestAnimationFrame=="function";function Pd(e){var t,n=function(){clearTimeout(o),la&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);la&&(t=requestAnimationFrame(n))}function Wn(e){var t=se,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),se=t}function pr(e){var t=se;e.__c=e.__(),se=t}function mr(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function da(e,t){return typeof t=="function"?t(e):t}var yd=Symbol.for("preact-signals");function jn(){if(Ke>1)Ke--;else{var e,t=!1;for((function(){var i=Kn;for(Kn=void 0;i!==void 0;)i.S.v===i.v&&(i.S.i=i.i),i=i.o})();Jt!==void 0;){var n=Jt;for(Jt=void 0,Vn++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&pa(n))try{n.c()}catch(i){t||(e=i,t=!0)}n=o}}if(Vn=0,Ke--,t)throw e}}function hr(e){if(Ke>0)return e();gr=++Sd,Ke++;try{return e()}finally{jn()}}var ee=void 0;function Xn(e){var t=ee;ee=void 0;try{return e()}finally{ee=t}}var _a,Jt=void 0,Ke=0,Vn=0,Sd=0,gr=0,Kn=void 0,qn=0;function ua(e){if(ee!==void 0){var t=e.n;if(t===void 0||t.t!==ee)return t={i:0,S:e,p:ee.s,n:void 0,t:ee,e:void 0,x:void 0,r:t},ee.s!==void 0&&(ee.s.n=t),ee.s=t,e.n=t,32&ee.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=ee.s,t.n=void 0,ee.s.n=t,ee.s=t),t}}function ge(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}ge.prototype.brand=yd;ge.prototype.h=function(){return!0};ge.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:Xn(function(){var o;(o=t.W)==null||o.call(t)}))};ge.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&&Xn(function(){var i;(i=t.Z)==null||i.call(t)}))}};ge.prototype.subscribe=function(e){var t=this;return qe(function(){var n=t.value,o=ee;ee=void 0;try{e(n)}finally{ee=o}},{name:"sub"})};ge.prototype.valueOf=function(){return this.value};ge.prototype.toString=function(){return this.value+""};ge.prototype.toJSON=function(){return this.value};ge.prototype.peek=function(){var e=this;return Xn(function(){return e.value})};Object.defineProperty(ge.prototype,"value",{get:function(){var e=ua(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Vn>100)throw new Error("Cycle detected");(function(n){Ke!==0&&Vn===0&&n.l!==gr&&(n.l=gr,Kn={S:n,v:n.v,i:n.i,o:Kn})})(this),this.v=e,this.i++,qn++,Ke++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{jn()}}}});function F(e,t){return new ge(e,t)}function pa(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 fa(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 ma(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 ot(e,t){ge.call(this,void 0),this.x=e,this.s=void 0,this.g=qn-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}ot.prototype=new ge;ot.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===qn))return!0;if(this.g=qn,this.f|=1,this.i>0&&!pa(this))return this.f&=-2,!0;var e=ee;try{fa(this),ee=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 ee=e,ma(this),this.f&=-2,!0};ot.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)}ge.prototype.S.call(this,e)};ot.prototype.U=function(e){if(this.t!==void 0&&(ge.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)}};ot.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(ot.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=ua(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Yt(e,t){return new ot(e,t)}function ga(e){var t=e.m;if(e.m=void 0,typeof t=="function"){Ke++;var n=ee;ee=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,vr(e),o}finally{ee=n,jn()}}}function vr(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ga(e)}function wd(e){if(ee!==this)throw new Error("Out-of-order effect");ma(this),ee=e,this.f&=-2,8&this.f&&vr(this),jn()}function wt(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,_a&&_a.push(this)}wt.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()}};wt.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ga(this),fa(this),Ke++;var e=ee;return ee=this,wd.bind(this,e)};wt.prototype.N=function(){2&this.f||(this.f|=2,this.u=Jt,Jt=this)};wt.prototype.d=function(){this.f|=8,1&this.f||vr(this)};wt.prototype.dispose=function(){this.d()};function qe(e,t){var n=new wt(e,t);try{n.c()}catch(i){throw n.d(),i}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var ha,Qn,Jn,kd=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var va=[];qe(function(){ha=this.N})();function kt(e,t){q[e]=t.bind(null,q[e]||function(){})}function Yn(e){if(Jn){var t=Jn;Jn=void 0,t()}Jn=e&&e.S()}function ba(e){var t=this,n=e.data,o=rt(n);o.value=n;var i=xe(function(){for(var l=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var d=Yt(function(){var h=o.value.value;return h===0?0:h===!0?"":h||""}),u=Yt(function(){return!Array.isArray(d.value)&&!qo(d.value)}),_=qe(function(){if(this.N=xa,u.value){var h=d.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=h)}}),m=t.__$u.d;return t.__$u.d=function(){_(),m.call(this)},[u,d]},[]),a=i[0],s=i[1];return a.value?s.peek():s.value}ba.displayName="ReactiveTextNode";Object.defineProperties(ge.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:ba},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});kt("__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 ge&&(n||(t.__np=n={}),n[i]=a,o[i]=a.peek())}}e(t)});kt("__r",function(e,t){if(e(t),t.type!==ne){Yn();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(i,a){var s;return qe(function(){s=this},{name:a}),s.c=i,s})(function(){var i;kd&&((i=n.y)==null||i.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),Qn=o,Yn(n)}});kt("__e",function(e,t,n,o){Yn(),Qn=void 0,e(t,n,o)});kt("diffed",function(e,t){Yn(),Qn=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 d=a[c],u=o[c];d===void 0?(d=Cd(n,c,u),a[c]=d):d.o(u,i)}}}e(t)});function Cd(e,t,n,o){var i=t in e&&e.ownerSVGElement===void 0,a=F(n),s=n.peek();return{o:function(l,c){a.value=l,s=l.peek()},d:qe(function(){this.N=xa;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})}}kt("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 d=t.__c;if(d){var u=d.__$u;u&&(d.__$u=void 0,u.d())}}e(t)});kt("__h",function(e,t,n,o){(o<3||o===9)&&(t.__$f|=2),e(t,n,o)});Ze.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 rt(e,t){return xe(function(){return F(e,t)},[])}function re(e,t){var n=M(e);return n.current=e,Qn.__$f|=4,xe(function(){return Yt(function(){return n.current()},t)},[])}var Td=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Ed(){hr(function(){for(var e;e=va.shift();)ha.call(e)})}function xa(){va.push(this)===1&&(q.requestAnimationFrame||Td)(Ed)}function Pa(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function ya(e){return Pa(e)}function Sa(e){return!(!Pa(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function Zn(e,t,n){return e==="page"?"page":e==="standalone"?"standalone":e==="inline"?t==="fullscreen"?"fullscreen":"inline":e==="modal"||e==="drawer"?n?t==="fullscreen"?"fullscreen":e:"closed":n?t==="fullscreen"?"fullscreen":t==="expanded"?"expanded":"open":"closed"}var Id=900;function br(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let o=t.initialSize;if(o==="expanded"||o==="fullscreen"||o==="normal")return o;if(o==="auto"){let i=t.autoSizeBreakpoint??Id;return n>=i?"expanded":"normal"}return"normal"}function Qt(e,t,n,o=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),l=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&o?o:br(e.mode,e.size,t);return{panelOpen:a,panelSize:l}}function Ct(){return typeof window>"u"?0:window.innerWidth}var Ad="x-public-key",Rd="x-ai-agent-deployment-id";function wa(e){return{headers(){let t={};return e.aiAgentDeploymentId&&(t[Rd]=e.aiAgentDeploymentId),e.publicKey&&(t[e.publicKeyHeader??Ad]=e.publicKey),t}}}var Le=class extends Error{constructor(n,o,i,a){super(n);j(this,"code",o);j(this,"status",i);j(this,"cause",a);this.name="StreamError"}};var ka=U.scope("parser");async function*xr(e,t){if(!e.ok){let i=await e.text().catch(()=>"");throw new Le(`server responded ${e.status}: ${i.slice(0,200)}`,"server",e.status)}if(!e.body)throw new Le("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),o="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:i,value:a}=await n.read();if(i){let l=o.trim();if(l){let c=Ca(l);c&&(yield c)}return}o+=a;let s;for(;(s=o.indexOf(`
8
8
 
9
9
  `))!==-1;){let l=o.slice(0,s);o=o.slice(s+2);let c=Ca(l);c&&(yield c)}}}finally{n.releaseLock()}}function Ca(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 ka.trace("chunk",{type:o.type,eventId:n}),{chunk:o,eventId:n}}catch(o){return ka.trace("frame parse failed",{err:o,payload:t.slice(0,200)}),null}}function Ld(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 Ta=e=>e&&Object.keys(e).length>0?e:void 0;function Ea(e,t){let n=Ta(e),o=Ta(t);if(!n&&!o)return;let i={};return n&&(i.user=n),o&&(i.page=o),Ld(JSON.stringify(i))}function eo(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}var Me={handshake:"/pai/handshake",streamMessage:"/pai/stream-message",streamResume:"/pai/stream-resume",cancelStream:"/pai/cancel-stream",listConversations:"/pai/list-conversations",listMessages:"/pai/list-messages",updateSettings:"/pai/update-settings",markRead:"/pai/mark-read",bootstrap:"/pai/bootstrap",content:"/pai/content",submitForm:"/pai/submit-form"},Ia="context";function Aa(e){let n={messages:e.messages.map(a=>({id:a.id,parts:Nd(a),role:a.role,createdAt:a.createdAt!==void 0?new Date(a.createdAt).toISOString():void 0})),conversationId:e.conversationId,trigger:e.trigger??"submit-message"};e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs);let o={},i=e.tools?.map(Od).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 Md(e){return e.state==="output"||e.state==="error"||e.approval?.approved!==void 0}function Od(e){return typeof e=="string"?e?{code:e}:null:e?.code?e:null}function Nd(e){let t=[];for(let n of e.parts)if(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}),n.kind==="tool"&&Md(n)){let o={type:"tool",toolCallId:n.toolCallId,toolName:n.toolName,state:n.state};n.input!==void 0&&(o.input=n.input),n.output!==void 0&&(o.output=n.output),n.error!==void 0&&(o.errorText=n.error),n.approval&&n.approval.approved!==void 0&&(o.approval=n.approval),t.push(o)}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 X=U.scope("transport"),Dd=3,Ma=400,$d=6e4,Hd=1e4,Ra=3,Fd=new Set([408,425,429,500,502,503,504]);function La(e){return Ma*2**e+Math.floor(Math.random()*250)}function Bd(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 Pr(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 to=class{constructor(t){j(this,"opts",t);j(this,"visitorId");j(this,"conversationId");j(this,"userContext");j(this,"pageContext");j(this,"locale");j(this,"conversationsCache",new Map);j(this,"contentCache",new Map)}setContext(t,n){this.userContext=t,this.pageContext=n}setLocale(t){this.locale=t}primeIdentity(t,n){t&&(this.visitorId=t),n&&(this.conversationId=n)}envelope(){let t={};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=Ea(this.userContext,this.pageContext);return n&&(t[Ia]=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 handshake(t){X.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale});let n=await this.postJson(Me.handshake,t,"handshake");return X.debug("handshake \u2190",{visitorId:n.visitorId,conversationId:n.conversationId,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),Ud(n)||X.warn("handshake response did not match expected shape; using raw response",{response:n}),this.visitorId=n.visitorId??t.visitorId,this.conversationId=n.conversationId,n}async uploadFile(t){X.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 X.debug("uploadFile \u2190",{id:o.id,url:o.url}),o}async transcribe(t,n="audio/webm"){X.debug("transcribe \u2192",{size:t.size,mimeType:n});let o=new FormData;o.append("audio",t,`voice.${zd(n)}`),o.append("mimeType",n);let i=await this.postForm(this.transcribePath,o,"transcribe");return X.debug("transcribe \u2190",{textLen:i.text.length}),i}listConversations(t={}){let n=JSON.stringify(t,Object.keys(t).toSorted()),o=this.conversationsCache.get(n);if(o&&Date.now()-o.at<Hd)return X.debug("listConversations \u2192 cache",t),o.result;let i=this.fetchConversations(t).catch(a=>{throw this.conversationsCache.delete(n),a});return this.conversationsCache.set(n,{at:Date.now(),result:i}),i}async fetchConversations(t){let n=new URL(this.url(Me.listConversations));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),X.debug("listConversations \u2192",{visitorId:t.visitorId??this.visitorId,limit:t.limit,cursor:t.cursor});let o=await this.getJson(n.toString(),"listConversations"),i=o.conversations??[];return X.debug("listConversations \u2190",{count:i.length,nextCursor:o.nextCursor}),{conversations:i.map(a=>({conversationId:a.conversationId,title:a.title,lastMessageAt:a.lastMessageAt,preview:a.preview,canContinue:a.canContinue,unreadCount:a.unreadCount})),nextCursor:o.nextCursor}}async loadConversation(t){let n=new URL(this.url(Me.listMessages));n.searchParams.set("conversationId",t),X.debug("loadConversation \u2192",{conversationId:t,visitorId:this.visitorId});let o=await this.getJson(n.toString(),"loadConversation"),i=o.messages??[];return X.debug("loadConversation \u2190",{conversationId:o.conversationId,canContinue:o.canContinue,messageCount:i.length,hasSuggestions:!!o.suggestions}),{conversationId:o.conversationId,canContinue:o.canContinue??!0,messages:i,agent:o.agent,suggestions:o.suggestions}}async markRead(t){if(!(!this.visitorId||!t)){this.conversationsCache.clear(),X.debug("markRead \u2192",{conversationId:t,visitorId:this.visitorId});try{await this.postJson(Me.markRead,{conversationId:t},"markRead")}catch(n){X.debug("markRead failed (non-fatal)",{err:n})}}}listContent(t={}){let n=`${this.locale??""}|${JSON.stringify(t,Object.keys(t).toSorted())}`,o=this.contentCache.get(n);if(o&&Date.now()-o.at<$d)return X.debug("listContent \u2192 cache",t),o.result;let i=this.fetchContent(t).catch(a=>{throw this.contentCache.delete(n),a});return this.contentCache.set(n,{at:Date.now(),result:i}),i}async fetchContent(t){let n=new URL(this.dataUrl(Me.content));for(let[a,s]of Object.entries(t))s!==void 0&&n.searchParams.set(a,Array.isArray(s)?s.join(","):String(s));X.debug("listContent \u2192",t);let o=await this.getJson(n.toString(),"listContent"),i=(o.items??[]).map(a=>Ti(a,this.locale));return X.debug("listContent \u2190",{count:i.length,total:o.pagination?.total}),{...o,items:i}}async bootstrap(t){let n=new URL(this.dataUrl(Me.bootstrap));t&&n.searchParams.set("conversationId",t),X.debug("bootstrap \u2192",{conversationId:t??this.conversationId});let o=await this.getJson(n.toString(),"bootstrap"),i=o.forms??[],a=o.formSubmissions??[];return X.debug("bootstrap \u2190",{forms:i.length,formSubmissions:a.length}),{forms:i,formSubmissions:a}}async saveUserPrefs(t){X.debug("saveUserPrefs \u2192",{visitorId:this.visitorId,conversationId:this.conversationId,settingsKeys:Object.keys(t)});let n=await this.postJson(Me.updateSettings,{userPrefs:t},"saveUserPrefs");return X.debug("saveUserPrefs \u2190",{ok:n.ok}),n}get uploadPath(){return this.opts.endpoints?.upload??"/pai/upload-file"}get transcribePath(){return this.opts.endpoints?.transcribe??"/pai/transcribe-audio"}get submitFormPath(){return this.opts.endpoints?.submitForm??Me.submitForm}async submitForm(t){X.debug("submitForm \u2192",{formId:t.formId,trigger:t.trigger,fields:Object.keys(t.values).length});try{await this.postJson(this.dataUrl(this.submitFormPath),t,"submitForm")}catch(n){X.debug("submitForm failed (non-fatal)",{err:n})}}sendMessage(t){this.conversationsCache.clear(),X.debug("message \u2192",{conversationId:t.conversationId,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.conversationId)}}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<=Dd&&!t.signal.aborted;i++){if((!o||i>1)&&(await Pr(Ma*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;X.debug("resume fetch failed \u2014 retrying",{attempt:i,err:l});continue}if(a.status===204||!a.ok){X.debug("resume \u2192 no in-flight stream",{status:a.status});return}let s=n.size;if(yield*this.drain(xr(a,t.signal),n,t))return;if(n.size===s){X.debug("resume \u2192 stream closed with no new events; nothing to resume");return}}if(!t.signal.aborted)throw new Le("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 Le&&i.status!==void 0)throw i;X.debug("stream segment dropped",{err:i})}return!1}cancelStream(t,n){t.signal.aborted||(X.debug("cancel stream",{conversationId:n,visitorId:this.visitorId}),t.abort(),!(!this.visitorId||!n)&&this.fetchImpl(this.url(Me.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope({})),keepalive:!0}).catch(o=>X.debug("cancel POST failed (non-fatal)",{err:o})))}async*openMessageStream(t,n){let o=await this.fetchImpl(this.url(Me.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*xr(o,n)}resumeUrl(t){let n=new URL(this.withEnvelopeQuery(Me.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>=Ra)throw new Le(`${n} failed: network error`,"network",void 0,c);X.debug("request network error \u2014 retrying",{label:n,attempt:o}),await Pr(La(o));continue}if(s.ok||!Fd.has(s.status)||o>=Ra)return s;let l=Bd(s.headers)??La(o);X.debug("request retryable status \u2014 retrying",{label:n,status:s.status,attempt:o,wait:l}),await Pr(l)}}async assertOk(t,n){if(!t.ok)throw new Le(`${n} failed: ${t.status}`,"server",t.status);return await t.json()}url(t){return/^https?:\/\//i.test(t)?t:`${this.opts.agentApiBaseUrl}${t}`}dataUrl(t){return/^https?:\/\//i.test(t)?t:`${this.opts.dataApiBaseUrl}${t}`}get fetchImpl(){return this.opts.fetchImpl??globalThis.fetch.bind(globalThis)}};function zd(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 Ud(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.visitorId=="string"&&typeof t.conversationId=="string"}function Oa(e,t){let n=e?[{kind:"text",id:"t0",textSig:F(e),doneSig:F(!0)}]:[];return{id:He(),role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:F(n)}}function no(){return{id:He(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:F([])}}function yr(e){return Wd({id:e.id,role:e.role,createdAt:Date.now(),status:"complete",parts:[{kind:"text",id:`${e.id}-t0`,text:e.text,done:!0}]})}function Wd(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,errorText:e.errorText,finishReason:e.finishReason,attachments:e.attachments,partsSig:F(e.parts.map(Gd))}}function Sr(e){let t=e.parts.map((n,o)=>n.type==="text"?{kind:"text",id:`${e.id}-t${o}`,textSig:F(n.text),doneSig:F(!0)}:n.type==="file"?{kind:"file",url:n.url,mediaType:n.mediaType}:n.type==="tool"?{kind:"tool",toolCallId:n.toolCallId,toolName:n.toolName,inputPartialSig:F(""),inputSig:F(n.input),outputSig:F(n.output),errorSig:F(n.errorText),stateSig:F(n.state),approvalSig:F(n.approval)}:null).filter(n=>n!==null);return{id:e.id,role:e.role,createdAt:eo(e.createdAt)??Date.now(),status:"complete",partsSig:F(t)}}function Na(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(Vd)}}function wr(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function Gd(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:F(e.text),doneSig:F(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,inputPartialSig:F(e.inputPartial),inputSig:F(e.input),outputSig:F(e.output),errorSig:F(e.error),stateSig:F(e.state),approvalSig:F(e.approval)}:e}function Vd(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,approval:e.approvalSig.value}:e}function oo(e){if(!e)return!1;let t=e.startsWith("tool:")?e.slice(5):e;return t==="ask-user-input"||t==="ask_user_input"||t==="request-user-input"||t==="request_user_input"}var ro={submitMessage:"submit-message",toolResult:"tool-result",toolApproval:"tool-approval"};var Da=U.scope("reducer"),io=class{constructor(t){j(this,"messagesSig",t);j(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":Da.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.status="complete",t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":Da.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"text-start":Tt(n,"text",t.id);return;case"text-delta":{let o=Tt(n,"text",t.id);o.textSig.value+=t.delta;return}case"text-end":Tt(n,"text",t.id).doneSig.value=!0;return;case"reasoning-start":Tt(n,"reasoning",t.id).doneSig.value=!1;return;case"reasoning-delta":{let o=Tt(n,"reasoning",t.id);o.textSig.value+=t.delta;return}case"reasoning-end":Tt(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":case"tool-approval-request":Kd(n,t);return;case"file":ao(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;ao(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 Tt(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:F(""),doneSig:F(!1)};return ao(e,i),i}function Et(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:F(""),inputSig:F(void 0),outputSig:F(void 0),errorSig:F(void 0),stateSig:F("input"),approvalSig:F(void 0)};return ao(e,i),i}function ao(e,t){e.partsSig.value=[...e.partsSig.value,t]}function Kd(e,t){switch(t.type){case"tool-input-start":Et(e,t.toolCallId,t.toolName);return;case"tool-input-delta":{let n=Et(e,t.toolCallId);n.inputPartialSig.value+=t.delta;return}case"tool-input-available":{let n=Et(e,t.toolCallId,t.toolName);n.inputSig.value=t.input,n.stateSig.value=oo(n.toolName)?"awaiting-input":"awaiting";return}case"tool-approval-request":{let n=Et(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="awaiting-approval";return}case"tool-output-available":{let n=Et(e,t.toolCallId);n.outputSig.value=t.output,n.stateSig.value="output";return}case"tool-output-error":{let n=Et(e,t.toolCallId);n.errorSig.value=t.errorText,n.stateSig.value="error";return}default:return}}var $a=U.scope("feedback:audio"),so=class{constructor(){j(this,"ctx",null);j(this,"master",null);j(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){$a.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 d=n.createGain(),u=i+l*a;d.gain.setValueAtTime(1e-4,u),d.gain.exponentialRampToValueAtTime(t.peakGain,u+.005),d.gain.exponentialRampToValueAtTime(1e-4,u+a),c.connect(d).connect(o),c.start(u),c.stop(u+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=>($a.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,i),i}};var Ha={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},Fa={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 et=null,lo=0;function qd(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function jd(){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=`__${x.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 Ba(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(qd())try{navigator.vibrate(e);return}catch{}if(et||(et=jd()),!!et)try{et.label.click()}catch{}}}function za(){lo++;let e=!1;return()=>{e||(e=!0,lo=Math.max(0,lo-1),lo===0&&et&&(et.input.remove(),et.label.remove(),et=null))}}var Xd=U.scope("feedback"),Jd=100,co=class{constructor(t,n){j(this,"mutedSig",F(!1));j(this,"audio",new so);j(this,"releaseHaptics");j(this,"sound");j(this,"haptics");j(this,"lastPlayed",new Map);j(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=za(),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<Jd}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(i=>Xd.warn("audio play failed",{err:i,url:n}));return}let o=Fa[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?Ha[t]:n;Ba(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 it(e,t){return e instanceof Le&&e.status===429?t.errorRateLimited:t.errorGeneric}var Yd=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 d={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Yd,__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 q.vnode&&q.vnode(d),d}var $={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},Qd=()=>r("svg",{...$,"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"})}),Be=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M18 6 6 18M6 6l12 12"})}),Ua=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M12 5v14M5 12h14"})}),Wa=()=>r("svg",{...$,"aria-hidden":"true",children:[r("path",{d:"m22 2-7 20-4-9-9-4Z"}),r("path",{d:"M22 2 11 13"})]}),Ga=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M12 19V5M5 12l7-7 7 7"})}),Va=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M3 20V4l18 8-18 8Z"})}),It=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"m9 18 6-6-6-6"})}),Ka=()=>r("svg",{...$,"aria-hidden":"true",children:r("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),qa=()=>r("svg",{...$,"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"})}),ja=()=>r("svg",{...$,"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"})]}),Xa=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})}),Ja=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})}),Ya=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})}),Qa=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})}),Za=()=>r("svg",{...$,"aria-hidden":"true",viewBox:"0 0 10 10",children:r("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})}),es=()=>r("svg",{...$,"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"})]}),ts=()=>r("svg",{...$,"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"})}),ns=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})}),os=()=>r("svg",{...$,"aria-hidden":"true",children:[r("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),r("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]}),rs=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})}),Zt=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M20 6 9 17l-5-5"})}),is=()=>r("svg",{...$,"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"})]}),as=()=>r("svg",{...$,"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"})]}),en=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),ss=()=>r("svg",{...$,"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"})}),ls=()=>r("svg",{...$,"aria-hidden":"true",children:[r("path",{d:"M12 20h9"}),r("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),cs=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"m6 9 6 6 6-6"})}),ds=()=>r("svg",{...$,"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"})]}),Zd=()=>r("svg",{...$,"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"})]}),kr=()=>r("svg",{...$,"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"})}),Cr=()=>r("svg",{...$,"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"})]}),e_=()=>r("svg",{...$,"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"})]}),t_=()=>r("svg",{...$,"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"})]}),n_=()=>r("svg",{...$,"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"})]}),o_=()=>r("svg",{...$,"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"})]}),Tr=()=>r("svg",{...$,"aria-hidden":"true",children:[r("circle",{cx:"11",cy:"11",r:"7"}),r("path",{d:"m21 21-4.3-4.3"})]}),_s=()=>r("svg",{...$,"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"})]}),us=()=>r("svg",{...$,"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"})]}),ps=()=>r("svg",{...$,"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"})]}),tn=()=>r("svg",{...$,"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"})]}),fs=()=>r("svg",{...$,"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"})]}),ms=()=>r("svg",{...$,"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"})}),gs=()=>r("svg",{...$,"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"})]}),r_=()=>r("svg",{...$,"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"})]}),i_=()=>r("svg",{...$,"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"})]}),a_=()=>r("svg",{...$,"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"})]}),s_=()=>r("svg",{...$,"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"})]}),hs={chat:Qd,message:kr,bubbles:tn,spark:Zd,wand:e_,bot:t_,help:Cr,lifebuoy:o_,headset:n_,search:r_,sparkles:i_,concierge:a_,wave:s_};var I=x.cssPrefix,y={launcher:`${I}-launcher`,callout:`${I}-callout`,calloutDismiss:`${I}-callout-dismiss`,panel:`${I}-panel`,panelHeader:`${I}-panel-header`,resizeGrip:`${I}-resize-grip`,scrollToBottom:`${I}-scroll-to-bottom`,actionHistory:`${I}-action-history`,actionClose:`${I}-action-close`,langSegment:`${I}-lang-segment`,composer:`${I}-composer`,composerInput:`${I}-composer-input`,composerSend:`${I}-composer-send`,composerStop:`${I}-composer-stop`,composerAttach:`${I}-composer-attach`,composerFileInput:`${I}-composer-file-input`,composerVoice:`${I}-composer-voice`,attachmentChip:`${I}-attachment-chip`,attachmentRemove:`${I}-attachment-remove`,suggestion:`${I}-suggestion`,messageBubble:`${I}-message`,messageRetry:`${I}-message-retry`,historyPane:`${I}-history-pane`,historyBack:`${I}-history-back`,historyItem:`${I}-history-item`,sidebar:`${I}-sidebar`,sidebarToggle:`${I}-sidebar-toggle`,sidebarNewConversation:`${I}-sidebar-new-conversation`,sidebarItem:`${I}-sidebar-item`,messengerHome:`${I}-messenger-home`,modulesEmpty:`${I}-modules-empty`,tab:`${I}-tab`,tabBadge:`${I}-tab-badge`,homeView:`${I}-home-view`,homeGreeting:`${I}-home-greeting`,homeBrand:`${I}-home-brand`,backHeader:`${I}-back-header`,contentView:`${I}-content-view`,contentScroll:`${I}-content-scroll`,homeSearch:`${I}-home-search`,helpSearch:`${I}-help-search`,homeRecent:`${I}-home-recent`,homeContentRow:`${I}-home-content-row`,helpArticle:`${I}-help-article`,newsItem:`${I}-news-item`,formGate:`${I}-form-gate`,formDone:`${I}-form-done`,formDoneToggle:`${I}-form-done-toggle`,formAnswers:`${I}-form-answers`,formFill:`${I}-form-fill`,formSubmit:`${I}-form-submit`,formSkip:`${I}-form-skip`,formField:`${I}-form-field`,toolAskInput:`${I}-tool-ask-input`,toolInputSubmit:`${I}-tool-input-submit`,toolInputSkip:`${I}-tool-input-skip`,toolApproval:`${I}-tool-approval`,toolApprove:`${I}-tool-approve`,toolReject:`${I}-tool-reject`,toolDecision:`${I}-tool-decision`};function he(e,t){return`${e}-${t}`}var _o=x.cssPrefix;function vs({onToggle:e,launcher:t,strings:n,leaving:o,edgeTab:i}){let a=t.variant!=="circle"&&!!t.label;return r("button",{type:"button",class:`${_o}-fab`,"data-variant":t.variant,"data-size":t.size,"data-edge-tab":i?"true":void 0,"data-leaving":o?"true":void 0,"data-testid":y.launcher,onClick:e,"aria-label":n.launcherOpen,children:[l_(t.icon),a?r("span",{class:`${_o}-fab-label`,children:t.label}):null]})}function l_(e){let t=hs[e];return t?r(t,{}):r(c_,{source:e})}function c_({source:e}){return r("span",{ref:t=>{t&&d_(t,e)},"aria-hidden":"true"})}function d_(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 bs({callout:e,launcherPosition:t,strings:n,closeLabel:o,onDismiss:i}){let[a,s]=k(!1);return w(()=>{let l=setTimeout(()=>s(!0),e.delayMs);return()=>clearTimeout(l)},[e.delayMs]),w(()=>{if(!a||e.autoDismissMs<=0)return;let l=setTimeout(i,e.autoDismissMs);return()=>clearTimeout(l)},[a,e.autoDismissMs,i]),a?r("div",{class:`${_o}-callout`,role:"status","data-shape":e.shape,"data-position":__(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":y.callout,children:[r("span",{children:$e(n,e.text)}),r("button",{type:"button",class:`${_o}-callout-close`,onClick:i,"aria-label":o,title:o,"data-testid":y.calloutDismiss,children:r(Be,{})})]}):null}function __(e,t){let n=t.endsWith("-right"),o=t.startsWith("bottom-");return e==="vertical"?o?"top":"bottom":n?"left":"right"}function uo({panelEl:e,resize:t,position:n,initialSize:o,onSizeChange:i,strings:a}){let s=x.cssPrefix,l=M(null);if(w(()=>{if(!e)return;let m=e.style;t.minWidth&&m.setProperty(`--${s}-resize-min-w`,t.minWidth),t.maxWidth&&m.setProperty(`--${s}-resize-max-w`,t.maxWidth),t.minHeight&&m.setProperty(`--${s}-resize-min-h`,t.minHeight),t.maxHeight&&m.setProperty(`--${s}-resize-max-h`,t.maxHeight),o&&(m.setProperty(`--${s}-widget-w`,`${o.width}px`),m.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-"),d=n.endsWith("-right"),u=`${s}-resize-grip ${s}-resize-grip--${c?"bottom":"top"}-${d?"left":"right"}`,_=m=>{if(!e)return;let h=m.currentTarget,v=e.getBoundingClientRect();l.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:v.width,startH:v.height,dirX:d?-1:1,dirY:c?1:-1},h.setPointerCapture(m.pointerId),e.setAttribute("data-resizing",""),m.preventDefault()},g=m=>{let h=l.current;if(!h||m.pointerId!==h.pointerId||!e)return;let v=(m.clientX-h.startX)*h.dirX,E=(m.clientY-h.startY)*h.dirY;e.style.setProperty(`--${s}-widget-w`,`${h.startW+v}px`),e.style.setProperty(`--${s}-widget-h`,`${h.startH+E}px`)},p=m=>{let h=l.current;if(!h||m.pointerId!==h.pointerId||!e)return;m.currentTarget.releasePointerCapture(m.pointerId),e.removeAttribute("data-resizing");let v=e.getBoundingClientRect();i({width:Math.round(v.width),height:Math.round(v.height)}),l.current=null};return r("div",{class:u,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:_,onPointerMove:g,onPointerUp:p,onPointerCancel:p,"data-testid":y.resizeGrip,children:r(Za,{})})}var at=x.cssPrefix,u_=`.${at}-header, .${at}-back-header, .${at}-home-hero`,p_='button, a, input, textarea, select, [role="tab"], [contenteditable]',xs=56;function po(e,t){w(()=>{if(!t||!e)return;let n=c=>Number.parseFloat(c)||0,o=(c,d)=>Math.min(d,Math.max(-d,c)),i=null,a=c=>{let d=c.target;if(!(d instanceof Element)||!d.closest(u_)||d.closest(p_))return;let u=e.getBoundingClientRect();i={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${at}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${at}-modal-dy`)),maxX:(window.innerWidth+u.width)/2-xs,maxY:(window.innerHeight+u.height)/2-xs},e.dataset.dragging="true",c.preventDefault()},s=c=>{if(!i||c.pointerId!==i.id)return;let d=o(i.dx+c.clientX-i.x,i.maxX),u=o(i.dy+c.clientY-i.y,i.maxY);e.style.setProperty(`--${at}-modal-dx`,`${d}px`),e.style.setProperty(`--${at}-modal-dy`,`${u}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 nn(e,t,n,o){switch(e){case"clear":case"sound":case"history":case"language":case"theme":case"textSize":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 fo(e,t,n){return nn("close",e,t)?n.includes("close"):!1}function Ps(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}var f_='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function mo(e){let t=n=>{if(n.key!=="Tab")return;let o=[...e.querySelectorAll(f_)].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 go(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var Er=x.cssPrefix;function ys({agent:e,strings:t}){let n=e.status??"online",o=$e(t,e.name),i=e.title?$e(t,e.title):null;return r("div",{class:`${Er}-agent`,children:[r("div",{class:`${Er}-agent-avatar`,"data-status":n,children:e.avatar?r("img",{src:e.avatar,alt:""}):r("span",{children:go(o)})}),r("div",{class:`${Er}-agent-meta`,children:[r("strong",{children:o}),i?r("span",{children:i}):null]})]})}var Ss=U.scope("attachments");function ho(e,t,n){let o=g_(e),i=[],a=[],s=b_(n.accept),l=t.reduce((d,u)=>d+u.size,0),c=t.length;for(let d of o){let u=m_(d,c,l,n,s);if(u){a.push({file:d,reason:u});continue}i.push(v_(d)),l+=d.size,c+=1}return(i.length||a.length)&&Ss.debug("ingest",{accepted:i.length,rejected:a.map(d=>({name:d.file.name,reason:d.reason}))}),{accepted:i,rejected:a}}function Ir(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){Ss.debug("revokeObjectURL failed",{error:t})}}function m_(e,t,n,o,i){return t>=o.maxCount?"count":n+e.size>o.maxBytes?"bytes":x_(e,i)?null:"mime"}function g_(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:h_(t)).filter(t=>t!==null):[]}function h_(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function v_(e){return{file:e,id:He(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function b_(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 x_(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 on=x.cssPrefix;function ws({attachment:e,onRemove:t}){let n=e.mediaType.startsWith("image/");return r("span",{class:`${on}-attachment-chip`,title:e.name,"data-testid":he(y.attachmentChip,e.id),children:[n?r("img",{class:`${on}-attachment-thumb`,src:e.previewUrl,alt:""}):r("span",{class:`${on}-attachment-thumb`,"aria-hidden":"true",children:r(ds,{})}),r("span",{class:`${on}-attachment-name`,children:e.name}),r("button",{type:"button",class:`${on}-attachment-remove`,onClick:t,"aria-label":`Remove ${e.name}`,"data-testid":he(y.attachmentRemove,e.id),children:r(Be,{})})]})}var Ar={isSupported:!1,start:()=>{},stop:()=>{}};function Rr(e,t,n){return e==="disabled"?Ar:e==="server"?w_(n):P_(t)}function P_(e){let t=y_();if(!t)return Ar;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="",d=!1;for(let u=l.resultIndex;u<l.results.length;u++){let _=l.results[u];_&&(c+=_[0].transcript,_.isFinal&&(d=!0))}o(c,d)});let a=()=>{n=null,i()};n.addEventListener("end",a),n.addEventListener("error",a),n.start()},stop(){n?.stop()}}}function y_(){let e=globalThis;return e.SpeechRecognition??e.webkitSpeechRecognition}var S_=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function w_(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Ar;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=k_();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 d=new Blob(o,{type:c});o=[];try{let{text:u}=await e(d,c);u&&a(u,!0)}catch{}finally{s()}}),t.start()}catch{i(),s()}},stop(){t?.stop()}}}function k_(){for(let e of S_)if(MediaRecorder.isTypeSupported(e))return e}var Te=x.cssPrefix,st=U.scope("composer");function At(e){return e.reduce((t,n)=>t+n.size,0)}var C_={arrowUp:Ga,paperPlane:Wa,send:Va,chevron:It};function ks({options:e,transport:t,feedback:n,bus:o,isStreaming:i,onSend:a,onStop:s,attachApiRef:l}){let c=e.strings,[d,u]=k(""),[_,g]=k([]),[p,m]=k(!1),h=M(null),v=M(null),E=e.features.files,S=e.features.voice,[B,A]=k(()=>Rr(S,e.locale,(T,O)=>t.transcribe(T,O)));w(()=>{p||S==="disabled"||A(Rr(S,e.locale,(T,O)=>t.transcribe(T,O)))},[e.locale,S,t,p]),w(()=>{let T=h.current;if(!T)return;let O=T.getRootNode(),Q="activeElement"in O?O.activeElement:null;Q&&T.closest(`.${Te}-panel`)?.contains(Q)||T.focus({preventScroll:!0})},[]),w(()=>{let T=h.current;if(T){if(d.length===0){T.style.height="";return}T.style.height="auto",T.style.height=`${Math.min(T.scrollHeight,160)}px`}},[d]);let W=M(_);W.current=_,w(()=>()=>W.current.forEach(Ir),[]),w(()=>{if(l)return l.current={attachFromDrop:T=>{let O=ho(T,W.current,e.attachments);O.accepted.length!==0&&(st.info("attach (drop)",{count:O.accepted.length,totalBytes:At(O.accepted)}),o.emit("attach",{count:O.accepted.length,totalBytes:At(O.accepted)}),g(Q=>[...Q,...O.accepted]))}},()=>{l.current&&(l.current=null)}},[l,e.attachments]),w(()=>{let T=h.current;if(!T)return;let O=T.closest(`.${Te}-panel`);if(!O)return;let Q=pe=>{let fe=pe.clipboardData;if(!fe)return;if(E){let N=ho(fe.items,W.current,e.attachments);if(N.accepted.length>0){pe.preventDefault(),st.info("attach (paste)",{count:N.accepted.length,totalBytes:At(N.accepted)}),o.emit("attach",{count:N.accepted.length,totalBytes:At(N.accepted)}),g(me=>[...me,...N.accepted]);return}}if(pe.target===T)return;let P=fe.getData("text/plain");P&&(pe.preventDefault(),u(N=>N+P),T.focus())};return O.addEventListener("paste",Q),()=>O.removeEventListener("paste",Q)},[E,e.attachments,Te]);let K=()=>{let T=d.trim();!T&&_.length===0||i||(a(T,_),u(""),g([]))},D=T=>{T.key!=="Enter"||T.shiftKey||T.isComposing||(T.preventDefault(),i?s():K())},ue=T=>{let O=T.target,Q=ho(O.files,_,e.attachments);Q.accepted.length>0&&(st.info("attach (file picker)",{count:Q.accepted.length,totalBytes:At(Q.accepted)}),o.emit("attach",{count:Q.accepted.length,totalBytes:At(Q.accepted)}),g(pe=>[...pe,...Q.accepted])),O.value=""},z=T=>{st.info("removeAttachment",{id:T}),o.emit("removeAttachment",{id:T}),g(O=>{let Q=O.find(pe=>pe.id===T);return Q&&Ir(Q),O.filter(pe=>pe.id!==T)})},te=M(null),ve=()=>{if(B.isSupported){if(p){let T=te.current?Date.now()-te.current:0;st.info("voiceStop",{durationMs:T}),o.emit("voiceStop",{durationMs:T}),B.stop(),m(!1),n.play("voiceStop"),te.current=null;return}te.current=Date.now(),st.info("voiceStart"),o.emit("voiceStart",void 0),m(!0),n.play("voiceStart"),B.start((T,O)=>u(Q=>O?`${Q}${T} `:Q),()=>{if(m(!1),te.current){let T=Date.now()-te.current;st.debug("voiceStop (auto)",{durationMs:T}),o.emit("voiceStop",{durationMs:T}),te.current=null}})}},we=C_[e.composer.sendButton.icon];return r("div",{class:`${Te}-composer`,"data-testid":y.composer,children:[_.length>0?r("div",{class:`${Te}-attachments`,children:_.map(T=>r(ws,{attachment:T,onRemove:()=>z(T.id)},T.id))}):null,r("div",{class:`${Te}-composer-row`,children:[r("div",{class:`${Te}-composer-actions`,children:[E?r("button",{type:"button",class:`${Te}-icon-btn`,onClick:()=>v.current?.click(),"aria-label":c.attach,"data-testid":y.composerAttach,children:r(qa,{})}):null,B.isSupported?r("button",{type:"button",class:`${Te}-icon-btn`,onClick:ve,"aria-label":p?c.micStop:c.micStart,"aria-pressed":p,"data-recording":p?"true":void 0,"data-testid":y.composerVoice,children:r(ja,{})}):null]}),r("textarea",{ref:h,class:`${Te}-textarea`,rows:1,value:d,placeholder:c.composerPlaceholder,onInput:T=>u(T.target.value),onKeyDown:D,"aria-label":c.composerPlaceholder,"data-testid":y.composerInput}),i?r("button",{type:"button",class:`${Te}-send`,onClick:s,"aria-label":c.stop,"data-testid":y.composerStop,children:r(Ka,{})}):r("button",{type:"button",class:`${Te}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:K,disabled:!d.trim()&&_.length===0,"aria-label":c.send,"data-testid":y.composerSend,children:r(we,{})})]}),r("input",{ref:v,type:"file",multiple:!0,accept:e.attachments.accept,onChange:ue,class:`${Te}-sr-only`,"data-testid":y.composerFileInput})]})}var T_=x.cssPrefix;function Cs({visible:e,strings:t}){return e?r("div",{class:`${T_}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}function vo({containerRef:e,onDrop:t}){let[n,o]=k(!1);return w(()=>{let i=e.current;if(!i)return;let a=0,s=u=>{a+=1,u.dataTransfer?.types.includes("Files")&&(u.preventDefault(),o(!0))},l=()=>{a-=1,!(a>0)&&(a=0,o(!1))},c=u=>{u.dataTransfer?.types.includes("Files")&&u.preventDefault()},d=u=>{a=0,o(!1),u.dataTransfer&&(u.preventDefault(),t(u.dataTransfer.items))};return i.addEventListener("dragenter",s),i.addEventListener("dragleave",l),i.addEventListener("dragover",c),i.addEventListener("drop",d),()=>{i.removeEventListener("dragenter",s),i.removeEventListener("dragleave",l),i.removeEventListener("dragover",c),i.removeEventListener("drop",d)}},[e,t]),{visible:n}}function Ts({itemCount:e,initialFocusIndex:t}){let[n,o]=k(!1),i=M(null),a=M(null),[s,l]=k(-1),c=H(()=>{o(!1),l(-1),i.current?.focus()},[]),d=H(()=>o(g=>!g),[]);w(()=>{if(!n)return;let g=p=>{let m=a.current,h=i.current;if(!m||!h)return;let v=p.composedPath();v.includes(m)||v.includes(h)||(o(!1),l(-1))};return document.addEventListener("click",g,!0),()=>document.removeEventListener("click",g,!0)},[n]),w(()=>{if(!n||e===0)return;let g=t?.()??0,p=g<0||g>=e?0:g;l(p)},[n,e,t]),w(()=>{if(!n||s<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[s]?.focus()},[n,s]);let u=H(g=>{(g.key==="ArrowDown"||g.key==="Enter"||g.key===" ")&&(g.preventDefault(),o(!0))},[]),_=H(g=>{if(e!==0)switch(g.key){case"Escape":g.preventDefault(),c();return;case"ArrowDown":g.preventDefault(),l(p=>(p+1)%e);return;case"ArrowUp":g.preventDefault(),l(p=>(p-1+e)%e);return;case"Home":g.preventDefault(),l(0);return;case"End":g.preventDefault(),l(e-1)}},[e,c]);return{open:n,focusIndex:s,triggerRef:i,menuRef:a,toggle:d,close:c,onTriggerKey:u,onMenuKey:_}}function Es({items:e,triggerLabel:t}){let n=x.cssPrefix,o=Ts({itemCount:e.length}),i=l=>{l.disabled||(l.onSelect?.(),l.keepOpen||o.close())},a=(l,c)=>l.onSelectValue?.(c),s=(l,c)=>{let d=c.segments;if(!d?.length)return;let u=Math.max(0,d.findIndex(g=>g.value===c.value)),_=-1;if(l.key==="ArrowRight"||l.key==="Enter"||l.key===" ")_=(u+1)%d.length;else if(l.key==="ArrowLeft")_=(u-1+d.length)%d.length;else return;l.preventDefault(),l.stopPropagation(),a(c,d[_].value)};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(es,{})}),o.open?r("div",{ref:o.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:o.onMenuKey,tabIndex:-1,children:e.map(l=>l.segments?r("div",{role:"menuitem",class:`${n}-menu-item ${n}-menu-item-segmented`,"aria-label":l.label,tabIndex:-1,onKeyDown:c=>s(c,l),children:[l.icon?r("span",{class:`${n}-menu-icon`,children:l.icon}):null,r("span",{class:`${n}-menu-label`,children:l.label}),r("span",{class:`${n}-segmented`,role:"group","aria-label":l.label,children:l.segments.map(c=>{let d=c.value===l.value;return r("button",{type:"button",role:"menuitemradio","aria-checked":d,class:`${n}-segment`,"data-on":d?"true":void 0,lang:c.lang,title:c.value,tabIndex:-1,"data-testid":`${y.langSegment}-${c.value}`,onClick:()=>a(l,c.value),children:c.label},c.value)})})]},l.id):r("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":l.type==="switch"?l.on:void 0,disabled:l.disabled,onClick:()=>i(l),children:[l.icon?r("span",{class:`${n}-menu-icon`,children:l.icon}):null,r("span",{class:`${n}-menu-label`,children:l.label}),l.type==="switch"&&l.on?r("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:r(Zt,{})}):null]},l.id))}):null]})}var Lr=x.cssPrefix;function E_(e){let t=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)").matches:!0;return e==="auto"?t?"light":"dark":t?e==="light"?"dark":"auto":e==="dark"?"light":"auto"}var I_={normal:"large",large:"small",small:"normal"};function A_(e){return e==="light"?r(fs,{}):e==="dark"?r(ms,{}):r(gs,{})}function R_(e){return(e.split("-")[0]||e).toUpperCase()}function ze({panelProps:e,variant:t}){let{options:n,panelSize:o,feedback:i,onClose:a,onClear:s,onExpand:l,onFullscreen:c,onPopOut:d,onSoundToggle:u}=e,{onToggleHistory:_,onLocaleChange:g,onThemeChange:p,onTextSizeChange:m}=e,h=n.strings,v=n.mode,E=t==="chat",S=re(()=>i.mutedSig.value).value,B=new Set(n.actions),A=O=>B.has(O),W=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches,K=O=>W&&(O==="expand"||O==="fullscreen")?!1:nn(O,v,o,{popOutUrl:n.popOutUrl}),D=n.themeMode,ue={auto:h.themeAuto,light:h.themeLight,dark:h.themeDark},z=n.textSize,te={small:h.textSizeSmall,normal:h.textSizeNormal,large:h.textSizeLarge},ve=[];if(E&&A("clear")&&ve.push({id:"clear",icon:r(ls,{}),label:h.newConversation,onSelect:s}),A("expand")&&K("expand")){let O=o==="expanded";ve.push({id:"expand",icon:O?r(Ja,{}):r(Xa,{}),label:O?h.collapse:h.expand,type:"switch",on:O,onSelect:l})}if(A("fullscreen")&&K("fullscreen")){let O=o==="fullscreen";ve.push({id:"fullscreen",icon:O?r(Qa,{}):r(Ya,{}),label:O?h.exitFullscreen:h.fullscreen,type:"switch",on:O,onSelect:c})}A("popOut")&&K("popOut")&&ve.push({id:"popOut",icon:r(ss,{}),label:h.popOut,onSelect:d}),E&&A("sound")&&ve.push({id:"sound",icon:S?r(ns,{}):r(ts,{}),label:S?h.soundOff:h.soundOn,type:"switch",on:!S,onSelect:u}),A("theme")&&ve.push({id:"theme",icon:A_(D),label:`${h.theme}: ${ue[D]}`,onSelect:()=>p(E_(D)),keepOpen:!0}),A("textSize")&&ve.push({id:"textSize",icon:r(os,{}),label:`${h.textSize}: ${te[z]}`,onSelect:()=>m(I_[z]),keepOpen:!0}),A("language")&&n.availableLocales.length>1&&ve.push({id:"language",icon:r(as,{}),label:h.language,segments:n.availableLocales.map(O=>({value:O,label:R_(O),lang:O})),value:n.locale,onSelectValue:g});let we=!!a&&fo(v,o,n.actions),T=E&&A("history");return r("div",{class:`${Lr}-header-actions`,children:[T?r("button",{type:"button",class:`${Lr}-icon-btn`,onClick:_,"aria-label":h.history,title:h.history,"data-testid":y.actionHistory,children:r(is,{})}):null,ve.length>0?r(Es,{items:ve,triggerLabel:h.moreActions}):null,we?r("button",{type:"button",class:`${Lr}-icon-btn`,onClick:a,"aria-label":h.close,title:h.close,"data-testid":y.actionClose,children:r(Be,{})}):null]})}var L_=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,M_=/^https?:\/\/[^\s.]+\.[^\s]+$/i,O_=/^[+]?[\d\s().-]{6,}$/;function Rt(e,t){return e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??`{${o}}`))}function N_(e){return Array.isArray(e)?e.length:e&&e.trim()?1:0}function D_(e,t,n){let o=e.required??!0,i=e.validation;if(e.type==="multiselect"){let s=N_(t);return o&&s===0?n.formRequired:s===0?void 0:i?.minSelections!=null&&s<i.minSelections?Rt(n.formChooseAtLeast,{min:i.minSelections}):i?.maxSelections!=null&&s>i.maxSelections?Rt(n.formChooseAtMost,{max:i.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return o?n.formRequired:void 0;switch(e.type){case"email":if(!L_.test(a))return n.formInvalidEmail;break;case"url":if(!M_.test(a))return n.formInvalidUrl;break;case"tel":if(!O_.test(a))return n.formInvalidTel;break;case"number":{let s=Number(a);if(!Number.isFinite(s))return n.formInvalidNumber;if(i?.min!=null&&s<i.min)return Rt(n.formNumberTooSmall,{min:i.min});if(i?.max!=null&&s>i.max)return Rt(n.formNumberTooLarge,{max:i.max});break}default:break}if(i?.minLength!=null&&a.length<i.minLength)return Rt(n.formTooShort,{min:i.minLength});if(i?.maxLength!=null&&a.length>i.maxLength)return Rt(n.formTooLong,{max:i.maxLength});if(i?.pattern)try{if(!new RegExp(i.pattern).test(a))return n.formPatternMismatch}catch{}}function Is(e,t,n){let o={};for(let i of e){let a=D_(i,t[i.name],n);a&&(o[i.name]=a)}return o}function As(e){let t={};for(let[n,o]of Object.entries(e)){let i=Array.isArray(o)?o.join(", "):o;i&&i.trim()&&(t[n]=i.trim())}return t}var le=x.cssPrefix,bo="__other__";function xo({fields:e,strings:t,submitLabel:n,onSubmit:o,skipLabel:i,onSkip:a,disabled:s,rootTestId:l,submitTestId:c,skipTestId:d}){let[u,_]=k(()=>B_(e)),[g,p]=k({}),[m,h]=k({}),v=A=>{m[A]&&h(W=>({...W,[A]:""}))},E=(A,W)=>{_(K=>({...K,[A]:W})),v(A)},S=(A,W)=>{p(K=>({...K,[A]:W})),v(A)},B=A=>{if(A.preventDefault(),s)return;let W=z_(e,u,g),K=Is(e,W,t);if(Object.keys(K).length>0){h(K);return}o(As(W))};return r("form",{class:`${le}-form`,onSubmit:B,"data-testid":l,noValidate:!0,children:[e.map(A=>r($_,{field:A,value:u[A.name],otherText:g[A.name]??"",error:m[A.name],disabled:s,strings:t,onChange:W=>E(A.name,W),onOtherChange:W=>S(A.name,W)},A.name)),r("div",{class:`${le}-form-actions`,children:[i&&a?r("button",{type:"button",class:`${le}-form-skip`,onClick:a,disabled:s,"data-testid":d,children:i}):null,r("button",{type:"submit",class:`${le}-form-submit`,disabled:s,"data-testid":c,children:n})]})]})}function $_({field:e,value:t,otherText:n,error:o,disabled:i,strings:a,onChange:s,onOtherChange:l}){let c=he(y.formField,e.name),d=H_({field:e,value:t,otherText:n,disabled:i,strings:a,onChange:s,onOtherChange:l,fieldTid:c});return r("label",{class:`${le}-field`,"data-field":e.name,"data-invalid":o?"true":void 0,children:[r("span",{class:`${le}-field-label`,children:[e.label,e.required??!0?r("span",{class:`${le}-field-req`,"aria-hidden":"true",children:" *"}):null]}),d,e.validationHint&&!o?r("span",{class:`${le}-field-hint`,children:e.validationHint}):null,o?r("span",{class:`${le}-field-error`,role:"alert",children:o}):null]})}function H_(e){let{field:t,value:n,otherText:o,disabled:i,strings:a,onChange:s,onOtherChange:l,fieldTid:c}=e,d=typeof n=="string"?n:"";switch(t.type){case"textarea":return r("textarea",{class:`${le}-field-input`,rows:3,value:d,placeholder:t.placeholder,disabled:i,onInput:u=>s(u.target.value),"data-testid":c});case"select":return r("select",{class:`${le}-field-input`,value:d,disabled:i,onChange:u=>s(u.target.value),"data-testid":c,children:[r("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(u=>r("option",{value:u.value,children:u.label??u.value},u.value))]});case"radio":{let u=t.allowOther&&d===bo;return r("div",{class:`${le}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(_=>r("label",{class:`${le}-choice`,children:[r("input",{type:"radio",name:`${le}-${t.name}`,checked:d===_.value,disabled:i,onChange:()=>s(_.value)}),r("span",{children:_.label??_.value})]},_.value)),t.allowOther?r("label",{class:`${le}-choice`,children:[r("input",{type:"radio",name:`${le}-${t.name}`,checked:d===bo,disabled:i,onChange:()=>s(bo)}),r("span",{children:a.formOther})]}):null,u?r("input",{class:`${le}-field-input`,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:i,onInput:_=>l(_.target.value)}):null]})}case"checkbox":return r("label",{class:`${le}-choice`,children:[r("input",{type:"checkbox",checked:d==="true",disabled:i,onChange:u=>s(u.target.checked?"true":""),"data-testid":c}),r("span",{children:t.placeholder??t.label})]});case"multiselect":{let u=Array.isArray(n)?n:[],_=(g,p)=>s(p?[...u,g]:u.filter(m=>m!==g));return r("div",{class:`${le}-field-choices`,"data-testid":c,children:[(t.options??[]).map(g=>r("label",{class:`${le}-choice`,children:[r("input",{type:"checkbox",checked:u.includes(g.value),disabled:i,onChange:p=>_(g.value,p.target.checked)}),r("span",{children:g.label??g.value})]},g.value)),t.allowOther||(t.options??[]).length===0?r("textarea",{class:`${le}-field-input`,rows:2,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:i,onInput:g=>l(g.target.value)}):null]})}default:return r("input",{class:`${le}-field-input`,type:F_(t.type),value:d,placeholder:t.placeholder,disabled:i,onInput:u=>s(u.target.value),"data-testid":c})}}function F_(e){switch(e){case"number":case"email":case"tel":case"url":case"date":case"time":return e;default:return"text"}}function B_(e){let t={};for(let n of e)n.defaultValue!=null&&(t[n.name]=n.type==="multiselect"?n.defaultValue.split(",").map(o=>o.trim()).filter(Boolean):n.defaultValue);return t}function z_(e,t,n){let o={...t};for(let i of e){let a=n[i.name]?.trim();if(i.type==="radio"&&i.allowOther&&t[i.name]===bo)o[i.name]=a??"";else if(i.type==="multiselect"&&a){let s=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),l=Array.isArray(t[i.name])?t[i.name]:[];o[i.name]=[...l,...s]}}return o}var Ue=x.cssPrefix;function Rs({form:e,strings:t,onSubmit:n,onSkip:o}){return r("div",{class:`${Ue}-form-gate`,"data-testid":y.formGate,children:[e.title?r("h3",{class:`${Ue}-form-gate-title`,children:e.title}):null,e.description?r("p",{class:`${Ue}-form-gate-desc`,children:e.description}):null,r(xo,{fields:e.fields,strings:t,submitLabel:e.submitLabel??t.formSubmit,onSubmit:n,skipLabel:e.skippable?t.formSkip:void 0,onSkip:e.skippable?o:void 0,submitTestId:y.formSubmit,skipTestId:y.formSkip})]})}function Ls({marker:e,strings:t,onFill:n}){let o=e.outcome==="skipped",i=o?t.formSkipped:t.formSubmitted,a=e.title?r(ne,{children:[r("span",{children:e.title}),r("span",{class:`${Ue}-sr-only`,children:i})]}):r("span",{children:i}),s=e.form?.reviewable??!1,l=!o&&s&&e.values&&Object.keys(e.values).length>0?e.values:null;if(l){let c=d=>e.form?.fields.find(u=>u.name===d)?.label??d;return r("details",{class:`${Ue}-form-done`,"data-outcome":e.outcome,"data-testid":y.formDone,children:[r("summary",{class:`${Ue}-form-done-summary`,"data-testid":y.formDoneToggle,children:[r(Zt,{}),a,r(It,{})]}),r("dl",{class:`${Ue}-form-answers`,"data-testid":y.formAnswers,children:Object.entries(l).map(([d,u])=>r("div",{class:`${Ue}-form-answer`,children:[r("dt",{children:c(d)}),r("dd",{children:u})]},d))})]})}return r("div",{class:`${Ue}-form-done`,"data-outcome":e.outcome,"data-testid":y.formDone,role:"status",children:[o?r(rs,{}):r(Zt,{}),a,o&&e.form?.reopenable&&n?r("button",{type:"button",class:`${Ue}-form-done-fill`,"data-testid":y.formFill,onClick:n,children:t.formFillOut}):null]})}var Nr=1,Os=2,Ns=4,Ds=8,$s=16;function U_(e){switch(e){case Nr:return"href";case Os:return"src";case Ns:return"class";case Ds:return"checked";case $s:return"start"}}var W_=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}},G_=W_;var Ms=24;function $r(e){let t=new Uint32Array(Ms);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(Ms),indent:"",indent_len:0,table_state:0}}function Hs(e){e.pending.length>0&&be(e,`
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 ka.trace("chunk",{type:o.type,eventId:n}),{chunk:o,eventId:n}}catch(o){return ka.trace("frame parse failed",{err:o,payload:t.slice(0,200)}),null}}function Ld(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 Ta=e=>e&&Object.keys(e).length>0?e:void 0;function Ea(e,t){let n=Ta(e),o=Ta(t);if(!n&&!o)return;let i={};return n&&(i.user=n),o&&(i.page=o),Ld(JSON.stringify(i))}function eo(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}var Me={handshake:"/pai/handshake",streamMessage:"/pai/stream-message",streamResume:"/pai/stream-resume",cancelStream:"/pai/cancel-stream",listConversations:"/pai/list-conversations",listMessages:"/pai/list-messages",updateSettings:"/pai/update-settings",markRead:"/pai/mark-read",bootstrap:"/pai/bootstrap",content:"/pai/content",submitForm:"/pai/submit-form"},Ia="context";function Aa(e){let n={messages:e.messages.map(a=>({id:a.id,parts:Nd(a),role:a.role,createdAt:a.createdAt!==void 0?new Date(a.createdAt).toISOString():void 0})),conversationId:e.conversationId,trigger:e.trigger??"submit-message"};e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs);let o={},i=e.tools?.map(Od).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 Md(e){return e.state==="output"||e.state==="error"||e.approval?.approved!==void 0}function Od(e){return typeof e=="string"?e?{code:e}:null:e?.code?e:null}function Nd(e){let t=[];for(let n of e.parts)if(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}),n.kind==="tool"&&Md(n)){let o={type:"tool",toolCallId:n.toolCallId,toolName:n.toolName,state:n.state};n.input!==void 0&&(o.input=n.input),n.output!==void 0&&(o.output=n.output),n.error!==void 0&&(o.errorText=n.error),n.approval&&n.approval.approved!==void 0&&(o.approval=n.approval),t.push(o)}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 X=U.scope("transport"),Dd=3,Ma=400,$d=6e4,Hd=1e4,Ra=3,Fd=new Set([408,425,429,500,502,503,504]);function La(e){return Ma*2**e+Math.floor(Math.random()*250)}function Bd(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 Pr(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 to=class{constructor(t){j(this,"opts",t);j(this,"visitorId");j(this,"conversationId");j(this,"userContext");j(this,"pageContext");j(this,"locale");j(this,"conversationsCache",new Map);j(this,"contentCache",new Map)}setContext(t,n){this.userContext=t,this.pageContext=n}setLocale(t){this.locale=t}primeIdentity(t,n){t&&(this.visitorId=t),n&&(this.conversationId=n)}envelope(){let t={};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=Ea(this.userContext,this.pageContext);return n&&(t[Ia]=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 handshake(t){X.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale});let n=await this.postJson(Me.handshake,t,"handshake");return X.debug("handshake \u2190",{visitorId:n.visitorId,conversationId:n.conversationId,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),Ud(n)||X.warn("handshake response did not match expected shape; using raw response",{response:n}),this.visitorId=n.visitorId??t.visitorId,this.conversationId=n.conversationId,n}async uploadFile(t){X.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 X.debug("uploadFile \u2190",{id:o.id,url:o.url}),o}async transcribe(t,n="audio/webm"){X.debug("transcribe \u2192",{size:t.size,mimeType:n});let o=new FormData;o.append("audio",t,`voice.${zd(n)}`),o.append("mimeType",n);let i=await this.postForm(this.transcribePath,o,"transcribe");return X.debug("transcribe \u2190",{textLen:i.text.length}),i}listConversations(t={}){let n=JSON.stringify(t,Object.keys(t).toSorted()),o=this.conversationsCache.get(n);if(o&&Date.now()-o.at<Hd)return X.debug("listConversations \u2192 cache",t),o.result;let i=this.fetchConversations(t).catch(a=>{throw this.conversationsCache.delete(n),a});return this.conversationsCache.set(n,{at:Date.now(),result:i}),i}async fetchConversations(t){let n=new URL(this.url(Me.listConversations));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),X.debug("listConversations \u2192",{visitorId:t.visitorId??this.visitorId,limit:t.limit,cursor:t.cursor});let o=await this.getJson(n.toString(),"listConversations"),i=o.conversations??[];return X.debug("listConversations \u2190",{count:i.length,nextCursor:o.nextCursor}),{conversations:i.map(a=>({conversationId:a.conversationId,title:a.title,lastMessageAt:a.lastMessageAt,preview:a.preview,canContinue:a.canContinue,unreadCount:a.unreadCount})),nextCursor:o.nextCursor}}async loadConversation(t){let n=new URL(this.url(Me.listMessages));n.searchParams.set("conversationId",t),X.debug("loadConversation \u2192",{conversationId:t,visitorId:this.visitorId});let o=await this.getJson(n.toString(),"loadConversation"),i=o.messages??[];return X.debug("loadConversation \u2190",{conversationId:o.conversationId,canContinue:o.canContinue,messageCount:i.length,hasSuggestions:!!o.suggestions}),{conversationId:o.conversationId,canContinue:o.canContinue??!0,messages:i,agent:o.agent,suggestions:o.suggestions}}async markRead(t){if(!(!this.visitorId||!t)){this.conversationsCache.clear(),X.debug("markRead \u2192",{conversationId:t,visitorId:this.visitorId});try{await this.postJson(Me.markRead,{conversationId:t},"markRead")}catch(n){X.debug("markRead failed (non-fatal)",{err:n})}}}listContent(t={}){let n=`${this.locale??""}|${JSON.stringify(t,Object.keys(t).toSorted())}`,o=this.contentCache.get(n);if(o&&Date.now()-o.at<$d)return X.debug("listContent \u2192 cache",t),o.result;let i=this.fetchContent(t).catch(a=>{throw this.contentCache.delete(n),a});return this.contentCache.set(n,{at:Date.now(),result:i}),i}async fetchContent(t){let n=new URL(this.dataUrl(Me.content));for(let[a,s]of Object.entries(t))s!==void 0&&n.searchParams.set(a,Array.isArray(s)?s.join(","):String(s));X.debug("listContent \u2192",t);let o=await this.getJson(n.toString(),"listContent"),i=(o.items??[]).map(a=>Ti(a,this.locale));return X.debug("listContent \u2190",{count:i.length,total:o.pagination?.total}),{...o,items:i}}async bootstrap(t){let n=new URL(this.dataUrl(Me.bootstrap));t&&n.searchParams.set("conversationId",t),X.debug("bootstrap \u2192",{conversationId:t??this.conversationId});let o=await this.getJson(n.toString(),"bootstrap"),i=o.forms??[],a=o.formSubmissions??[];return X.debug("bootstrap \u2190",{forms:i.length,formSubmissions:a.length}),{forms:i,formSubmissions:a}}async saveUserPrefs(t){X.debug("saveUserPrefs \u2192",{visitorId:this.visitorId,conversationId:this.conversationId,settingsKeys:Object.keys(t)});let n=await this.postJson(Me.updateSettings,{userPrefs:t},"saveUserPrefs");return X.debug("saveUserPrefs \u2190",{ok:n.ok}),n}get uploadPath(){return this.opts.endpoints?.upload??"/pai/upload-file"}get transcribePath(){return this.opts.endpoints?.transcribe??"/pai/transcribe-audio"}get submitFormPath(){return this.opts.endpoints?.submitForm??Me.submitForm}async submitForm(t){X.debug("submitForm \u2192",{formId:t.formId,trigger:t.trigger,fields:Object.keys(t.values).length});try{await this.postJson(this.dataUrl(this.submitFormPath),t,"submitForm")}catch(n){X.debug("submitForm failed (non-fatal)",{err:n})}}sendMessage(t){this.conversationsCache.clear(),X.debug("message \u2192",{conversationId:t.conversationId,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.conversationId)}}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<=Dd&&!t.signal.aborted;i++){if((!o||i>1)&&(await Pr(Ma*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;X.debug("resume fetch failed \u2014 retrying",{attempt:i,err:l});continue}if(a.status===204||!a.ok){X.debug("resume \u2192 no in-flight stream",{status:a.status});return}let s=n.size;if(yield*this.drain(xr(a,t.signal),n,t))return;if(n.size===s){X.debug("resume \u2192 stream closed with no new events; nothing to resume");return}}if(!t.signal.aborted)throw new Le("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 Le&&i.status!==void 0)throw i;X.debug("stream segment dropped",{err:i})}return!1}cancelStream(t,n){t.signal.aborted||(X.debug("cancel stream",{conversationId:n,visitorId:this.visitorId}),t.abort(),!(!this.visitorId||!n)&&this.fetchImpl(this.url(Me.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope({})),keepalive:!0}).catch(o=>X.debug("cancel POST failed (non-fatal)",{err:o})))}async*openMessageStream(t,n){let o=await this.fetchImpl(this.url(Me.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*xr(o,n)}resumeUrl(t){let n=new URL(this.withEnvelopeQuery(Me.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>=Ra)throw new Le(`${n} failed: network error`,"network",void 0,c);X.debug("request network error \u2014 retrying",{label:n,attempt:o}),await Pr(La(o));continue}if(s.ok||!Fd.has(s.status)||o>=Ra)return s;let l=Bd(s.headers)??La(o);X.debug("request retryable status \u2014 retrying",{label:n,status:s.status,attempt:o,wait:l}),await Pr(l)}}async assertOk(t,n){if(!t.ok)throw new Le(`${n} failed: ${t.status}`,"server",t.status);return await t.json()}url(t){return/^https?:\/\//i.test(t)?t:`${this.opts.agentApiBaseUrl}${t}`}dataUrl(t){return/^https?:\/\//i.test(t)?t:`${this.opts.dataApiBaseUrl}${t}`}get fetchImpl(){return this.opts.fetchImpl??globalThis.fetch.bind(globalThis)}};function zd(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 Ud(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.visitorId=="string"&&typeof t.conversationId=="string"}function Oa(e,t){let n=e?[{kind:"text",id:"t0",textSig:F(e),doneSig:F(!0)}]:[];return{id:He(),role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:F(n)}}function no(){return{id:He(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:F([])}}function yr(e){return Wd({id:e.id,role:e.role,createdAt:Date.now(),status:"complete",parts:[{kind:"text",id:`${e.id}-t0`,text:e.text,done:!0}]})}function Wd(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,errorText:e.errorText,finishReason:e.finishReason,attachments:e.attachments,partsSig:F(e.parts.map(Gd))}}function Sr(e){let t=e.parts.map((n,o)=>n.type==="text"?{kind:"text",id:`${e.id}-t${o}`,textSig:F(n.text),doneSig:F(!0)}:n.type==="file"?{kind:"file",url:n.url,mediaType:n.mediaType}:n.type==="tool"?{kind:"tool",toolCallId:n.toolCallId,toolName:n.toolName,inputPartialSig:F(""),inputSig:F(n.input),outputSig:F(n.output),errorSig:F(n.errorText),stateSig:F(n.state),approvalSig:F(n.approval)}:null).filter(n=>n!==null);return{id:e.id,role:e.role,createdAt:eo(e.createdAt)??Date.now(),status:"complete",partsSig:F(t)}}function Na(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(Vd)}}function wr(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function Gd(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:F(e.text),doneSig:F(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,inputPartialSig:F(e.inputPartial),inputSig:F(e.input),outputSig:F(e.output),errorSig:F(e.error),stateSig:F(e.state),approvalSig:F(e.approval)}:e}function Vd(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,approval:e.approvalSig.value}:e}function oo(e){if(!e)return!1;let t=e.startsWith("tool:")?e.slice(5):e;return t==="ask-user-input"||t==="ask_user_input"||t==="request-user-input"||t==="request_user_input"}var ro={submitMessage:"submit-message",toolResult:"tool-result",toolApproval:"tool-approval"};var Da=U.scope("reducer"),io=class{constructor(t){j(this,"messagesSig",t);j(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":Da.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.status="complete",t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":Da.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"text-start":Tt(n,"text",t.id);return;case"text-delta":{let o=Tt(n,"text",t.id);o.textSig.value+=t.delta;return}case"text-end":Tt(n,"text",t.id).doneSig.value=!0;return;case"reasoning-start":Tt(n,"reasoning",t.id).doneSig.value=!1;return;case"reasoning-delta":{let o=Tt(n,"reasoning",t.id);o.textSig.value+=t.delta;return}case"reasoning-end":Tt(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":case"tool-approval-request":Kd(n,t);return;case"file":ao(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;ao(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 Tt(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:F(""),doneSig:F(!1)};return ao(e,i),i}function Et(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:F(""),inputSig:F(void 0),outputSig:F(void 0),errorSig:F(void 0),stateSig:F("input"),approvalSig:F(void 0)};return ao(e,i),i}function ao(e,t){e.partsSig.value=[...e.partsSig.value,t]}function Kd(e,t){switch(t.type){case"tool-input-start":Et(e,t.toolCallId,t.toolName);return;case"tool-input-delta":{let n=Et(e,t.toolCallId);n.inputPartialSig.value+=t.delta;return}case"tool-input-available":{let n=Et(e,t.toolCallId,t.toolName);n.inputSig.value=t.input,n.stateSig.value=oo(n.toolName)?"awaiting-input":"awaiting";return}case"tool-approval-request":{let n=Et(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="awaiting-approval";return}case"tool-output-available":{let n=Et(e,t.toolCallId);n.outputSig.value=t.output,n.stateSig.value="output";return}case"tool-output-error":{let n=Et(e,t.toolCallId);n.errorSig.value=t.errorText,n.stateSig.value="error";return}default:return}}var $a=U.scope("feedback:audio"),so=class{constructor(){j(this,"ctx",null);j(this,"master",null);j(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){$a.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 d=n.createGain(),u=i+l*a;d.gain.setValueAtTime(1e-4,u),d.gain.exponentialRampToValueAtTime(t.peakGain,u+.005),d.gain.exponentialRampToValueAtTime(1e-4,u+a),c.connect(d).connect(o),c.start(u),c.stop(u+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=>($a.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,i),i}};var Ha={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},Fa={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 et=null,lo=0;function qd(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function jd(){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=`__${x.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 Ba(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(qd())try{navigator.vibrate(e);return}catch{}if(et||(et=jd()),!!et)try{et.label.click()}catch{}}}function za(){lo++;let e=!1;return()=>{e||(e=!0,lo=Math.max(0,lo-1),lo===0&&et&&(et.input.remove(),et.label.remove(),et=null))}}var Xd=U.scope("feedback"),Jd=100,co=class{constructor(t,n){j(this,"mutedSig",F(!1));j(this,"audio",new so);j(this,"releaseHaptics");j(this,"sound");j(this,"haptics");j(this,"lastPlayed",new Map);j(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=za(),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<Jd}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(i=>Xd.warn("audio play failed",{err:i,url:n}));return}let o=Fa[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?Ha[t]:n;Ba(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 it(e,t){return e instanceof Le&&e.status===429?t.errorRateLimited:t.errorGeneric}var Yd=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 d={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Yd,__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 q.vnode&&q.vnode(d),d}var $={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},Qd=()=>r("svg",{...$,"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"})}),Be=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M18 6 6 18M6 6l12 12"})}),Ua=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M12 5v14M5 12h14"})}),Wa=()=>r("svg",{...$,"aria-hidden":"true",children:[r("path",{d:"m22 2-7 20-4-9-9-4Z"}),r("path",{d:"M22 2 11 13"})]}),Ga=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M12 19V5M5 12l7-7 7 7"})}),Va=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M3 20V4l18 8-18 8Z"})}),It=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"m9 18 6-6-6-6"})}),Ka=()=>r("svg",{...$,"aria-hidden":"true",children:r("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),qa=()=>r("svg",{...$,"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"})}),ja=()=>r("svg",{...$,"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"})]}),Xa=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})}),Ja=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})}),Ya=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})}),Qa=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})}),Za=()=>r("svg",{...$,"aria-hidden":"true",viewBox:"0 0 10 10",children:r("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})}),es=()=>r("svg",{...$,"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"})]}),ts=()=>r("svg",{...$,"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"})}),ns=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})}),os=()=>r("svg",{...$,"aria-hidden":"true",children:[r("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),r("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]}),rs=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})}),Zt=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M20 6 9 17l-5-5"})}),is=()=>r("svg",{...$,"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"})]}),as=()=>r("svg",{...$,"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"})]}),en=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),ss=()=>r("svg",{...$,"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"})}),ls=()=>r("svg",{...$,"aria-hidden":"true",children:[r("path",{d:"M12 20h9"}),r("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),cs=()=>r("svg",{...$,"aria-hidden":"true",children:r("path",{d:"m6 9 6 6 6-6"})}),ds=()=>r("svg",{...$,"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"})]}),Zd=()=>r("svg",{...$,"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"})]}),kr=()=>r("svg",{...$,"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"})}),Cr=()=>r("svg",{...$,"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"})]}),e_=()=>r("svg",{...$,"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"})]}),t_=()=>r("svg",{...$,"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"})]}),n_=()=>r("svg",{...$,"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"})]}),o_=()=>r("svg",{...$,"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"})]}),Tr=()=>r("svg",{...$,"aria-hidden":"true",children:[r("circle",{cx:"11",cy:"11",r:"7"}),r("path",{d:"m21 21-4.3-4.3"})]}),_s=()=>r("svg",{...$,"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"})]}),us=()=>r("svg",{...$,"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"})]}),ps=()=>r("svg",{...$,"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"})]}),tn=()=>r("svg",{...$,"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"})]}),fs=()=>r("svg",{...$,"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"})]}),ms=()=>r("svg",{...$,"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"})}),gs=()=>r("svg",{...$,"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"})]}),r_=()=>r("svg",{...$,"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"})]}),i_=()=>r("svg",{...$,"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"})]}),a_=()=>r("svg",{...$,"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"})]}),s_=()=>r("svg",{...$,"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"})]}),hs={chat:Qd,message:kr,bubbles:tn,spark:Zd,wand:e_,bot:t_,help:Cr,lifebuoy:o_,headset:n_,search:r_,sparkles:i_,concierge:a_,wave:s_};var I=x.cssPrefix,y={launcher:`${I}-launcher`,callout:`${I}-callout`,calloutDismiss:`${I}-callout-dismiss`,panel:`${I}-panel`,panelHeader:`${I}-panel-header`,resizeGrip:`${I}-resize-grip`,scrollToBottom:`${I}-scroll-to-bottom`,actionHistory:`${I}-action-history`,actionClose:`${I}-action-close`,langSegment:`${I}-lang-segment`,composer:`${I}-composer`,composerInput:`${I}-composer-input`,composerSend:`${I}-composer-send`,composerStop:`${I}-composer-stop`,composerAttach:`${I}-composer-attach`,composerFileInput:`${I}-composer-file-input`,composerVoice:`${I}-composer-voice`,attachmentChip:`${I}-attachment-chip`,attachmentRemove:`${I}-attachment-remove`,suggestion:`${I}-suggestion`,messageBubble:`${I}-message`,messageRetry:`${I}-message-retry`,historyPane:`${I}-history-pane`,historyBack:`${I}-history-back`,historyItem:`${I}-history-item`,sidebar:`${I}-sidebar`,sidebarToggle:`${I}-sidebar-toggle`,sidebarNewConversation:`${I}-sidebar-new-conversation`,sidebarItem:`${I}-sidebar-item`,messengerHome:`${I}-messenger-home`,modulesEmpty:`${I}-modules-empty`,tab:`${I}-tab`,tabBadge:`${I}-tab-badge`,homeView:`${I}-home-view`,homeGreeting:`${I}-home-greeting`,homeBrand:`${I}-home-brand`,backHeader:`${I}-back-header`,contentView:`${I}-content-view`,contentScroll:`${I}-content-scroll`,homeSearch:`${I}-home-search`,helpSearch:`${I}-help-search`,homeRecent:`${I}-home-recent`,homeContentRow:`${I}-home-content-row`,helpArticle:`${I}-help-article`,newsItem:`${I}-news-item`,formGate:`${I}-form-gate`,formDone:`${I}-form-done`,formDoneToggle:`${I}-form-done-toggle`,formAnswers:`${I}-form-answers`,formFill:`${I}-form-fill`,formSubmit:`${I}-form-submit`,formSkip:`${I}-form-skip`,formField:`${I}-form-field`,toolAskInput:`${I}-tool-ask-input`,toolInputSubmit:`${I}-tool-input-submit`,toolInputSkip:`${I}-tool-input-skip`,toolApproval:`${I}-tool-approval`,toolApprove:`${I}-tool-approve`,toolReject:`${I}-tool-reject`,toolDecision:`${I}-tool-decision`};function he(e,t){return`${e}-${t}`}var _o=x.cssPrefix;function vs({onToggle:e,launcher:t,strings:n,leaving:o,edgeTab:i}){let a=t.variant!=="circle"&&!!t.label;return r("button",{type:"button",class:`${_o}-fab`,"data-variant":t.variant,"data-size":t.size,"data-edge-tab":i?"true":void 0,"data-leaving":o?"true":void 0,"data-testid":y.launcher,onClick:e,"aria-label":n.launcherOpen,children:[l_(t.icon),a?r("span",{class:`${_o}-fab-label`,children:t.label}):null]})}function l_(e){let t=hs[e];return t?r(t,{}):r(c_,{source:e})}function c_({source:e}){return r("span",{ref:t=>{t&&d_(t,e)},"aria-hidden":"true"})}function d_(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 bs({callout:e,launcherPosition:t,strings:n,closeLabel:o,onDismiss:i}){let[a,s]=k(!1);return w(()=>{let l=setTimeout(()=>s(!0),e.delayMs);return()=>clearTimeout(l)},[e.delayMs]),w(()=>{if(!a||e.autoDismissMs<=0)return;let l=setTimeout(i,e.autoDismissMs);return()=>clearTimeout(l)},[a,e.autoDismissMs,i]),a?r("div",{class:`${_o}-callout`,role:"status","data-shape":e.shape,"data-position":__(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":y.callout,children:[r("span",{children:$e(n,e.text)}),r("button",{type:"button",class:`${_o}-callout-close`,onClick:i,"aria-label":o,title:o,"data-testid":y.calloutDismiss,children:r(Be,{})})]}):null}function __(e,t){let n=t.endsWith("-right"),o=t.startsWith("bottom-");return e==="vertical"?o?"top":"bottom":n?"left":"right"}function uo({panelEl:e,resize:t,position:n,initialSize:o,onSizeChange:i,strings:a}){let s=x.cssPrefix,l=M(null);if(w(()=>{if(!e)return;let g=e.style;t.minWidth&&g.setProperty(`--${s}-resize-min-w`,t.minWidth),t.maxWidth&&g.setProperty(`--${s}-resize-max-w`,t.maxWidth),t.minHeight&&g.setProperty(`--${s}-resize-min-h`,t.minHeight),t.maxHeight&&g.setProperty(`--${s}-resize-max-h`,t.maxHeight),o&&(g.setProperty(`--${s}-widget-w`,`${o.width}px`),g.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-"),d=n.endsWith("-right"),u=`${s}-resize-grip ${s}-resize-grip--${c?"bottom":"top"}-${d?"left":"right"}`,_=g=>{if(!e)return;let p=g.currentTarget,v=e.getBoundingClientRect();l.current={pointerId:g.pointerId,startX:g.clientX,startY:g.clientY,startW:v.width,startH:v.height,dirX:d?-1:1,dirY:c?1:-1},p.setPointerCapture(g.pointerId),e.setAttribute("data-resizing",""),g.preventDefault()},m=g=>{let p=l.current;if(!p||g.pointerId!==p.pointerId||!e)return;let v=(g.clientX-p.startX)*p.dirX,E=(g.clientY-p.startY)*p.dirY;e.style.setProperty(`--${s}-widget-w`,`${p.startW+v}px`),e.style.setProperty(`--${s}-widget-h`,`${p.startH+E}px`)},h=g=>{let p=l.current;if(!p||g.pointerId!==p.pointerId||!e)return;g.currentTarget.releasePointerCapture(g.pointerId),e.removeAttribute("data-resizing");let v=e.getBoundingClientRect();i({width:Math.round(v.width),height:Math.round(v.height)}),l.current=null};return r("div",{class:u,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:_,onPointerMove:m,onPointerUp:h,onPointerCancel:h,"data-testid":y.resizeGrip,children:r(Za,{})})}var at=x.cssPrefix,u_=`.${at}-header, .${at}-back-header, .${at}-home-hero`,p_='button, a, input, textarea, select, [role="tab"], [contenteditable]',xs=56;function po(e,t){w(()=>{if(!t||!e)return;let n=c=>Number.parseFloat(c)||0,o=(c,d)=>Math.min(d,Math.max(-d,c)),i=null,a=c=>{let d=c.target;if(!(d instanceof Element)||!d.closest(u_)||d.closest(p_))return;let u=e.getBoundingClientRect();i={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${at}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${at}-modal-dy`)),maxX:(window.innerWidth+u.width)/2-xs,maxY:(window.innerHeight+u.height)/2-xs},e.dataset.dragging="true",c.preventDefault()},s=c=>{if(!i||c.pointerId!==i.id)return;let d=o(i.dx+c.clientX-i.x,i.maxX),u=o(i.dy+c.clientY-i.y,i.maxY);e.style.setProperty(`--${at}-modal-dx`,`${d}px`),e.style.setProperty(`--${at}-modal-dy`,`${u}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 nn(e,t,n,o){switch(e){case"clear":case"sound":case"history":case"language":case"theme":case"textSize":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 fo(e,t,n){return nn("close",e,t)?n.includes("close"):!1}function Ps(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}var f_='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function mo(e){let t=n=>{if(n.key!=="Tab")return;let o=[...e.querySelectorAll(f_)].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 go(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var Er=x.cssPrefix;function ys({agent:e,strings:t}){let n=e.status??"online",o=$e(t,e.name),i=e.title?$e(t,e.title):null;return r("div",{class:`${Er}-agent`,children:[r("div",{class:`${Er}-agent-avatar`,"data-status":n,children:e.avatar?r("img",{src:e.avatar,alt:""}):r("span",{children:go(o)})}),r("div",{class:`${Er}-agent-meta`,children:[r("strong",{children:o}),i?r("span",{children:i}):null]})]})}var Ss=U.scope("attachments");function ho(e,t,n){let o=g_(e),i=[],a=[],s=b_(n.accept),l=t.reduce((d,u)=>d+u.size,0),c=t.length;for(let d of o){let u=m_(d,c,l,n,s);if(u){a.push({file:d,reason:u});continue}i.push(v_(d)),l+=d.size,c+=1}return(i.length||a.length)&&Ss.debug("ingest",{accepted:i.length,rejected:a.map(d=>({name:d.file.name,reason:d.reason}))}),{accepted:i,rejected:a}}function Ir(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){Ss.debug("revokeObjectURL failed",{error:t})}}function m_(e,t,n,o,i){return t>=o.maxCount?"count":n+e.size>o.maxBytes?"bytes":x_(e,i)?null:"mime"}function g_(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:h_(t)).filter(t=>t!==null):[]}function h_(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function v_(e){return{file:e,id:He(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function b_(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 x_(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 on=x.cssPrefix;function ws({attachment:e,onRemove:t}){let n=e.mediaType.startsWith("image/");return r("span",{class:`${on}-attachment-chip`,title:e.name,"data-testid":he(y.attachmentChip,e.id),children:[n?r("img",{class:`${on}-attachment-thumb`,src:e.previewUrl,alt:""}):r("span",{class:`${on}-attachment-thumb`,"aria-hidden":"true",children:r(ds,{})}),r("span",{class:`${on}-attachment-name`,children:e.name}),r("button",{type:"button",class:`${on}-attachment-remove`,onClick:t,"aria-label":`Remove ${e.name}`,"data-testid":he(y.attachmentRemove,e.id),children:r(Be,{})})]})}var Ar={isSupported:!1,start:()=>{},stop:()=>{}};function Rr(e,t,n){return e==="disabled"?Ar:e==="server"?w_(n):P_(t)}function P_(e){let t=y_();if(!t)return Ar;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="",d=!1;for(let u=l.resultIndex;u<l.results.length;u++){let _=l.results[u];_&&(c+=_[0].transcript,_.isFinal&&(d=!0))}o(c,d)});let a=()=>{n=null,i()};n.addEventListener("end",a),n.addEventListener("error",a),n.start()},stop(){n?.stop()}}}function y_(){let e=globalThis;return e.SpeechRecognition??e.webkitSpeechRecognition}var S_=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function w_(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Ar;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=k_();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 d=new Blob(o,{type:c});o=[];try{let{text:u}=await e(d,c);u&&a(u,!0)}catch{}finally{s()}}),t.start()}catch{i(),s()}},stop(){t?.stop()}}}function k_(){for(let e of S_)if(MediaRecorder.isTypeSupported(e))return e}var Te=x.cssPrefix,st=U.scope("composer");function At(e){return e.reduce((t,n)=>t+n.size,0)}var C_={arrowUp:Ga,paperPlane:Wa,send:Va,chevron:It};function ks({options:e,transport:t,feedback:n,bus:o,isStreaming:i,onSend:a,onStop:s,attachApiRef:l}){let c=e.strings,[d,u]=k(""),[_,m]=k([]),[h,g]=k(!1),p=M(null),v=M(null),E=e.features.files,S=e.features.voice,[B,A]=k(()=>Rr(S,e.locale,(T,O)=>t.transcribe(T,O)));w(()=>{h||S==="disabled"||A(Rr(S,e.locale,(T,O)=>t.transcribe(T,O)))},[e.locale,S,t,h]),w(()=>{let T=p.current;if(!T)return;let O=T.getRootNode(),Q="activeElement"in O?O.activeElement:null;Q&&T.closest(`.${Te}-panel`)?.contains(Q)||T.focus({preventScroll:!0})},[]),w(()=>{let T=p.current;if(T){if(d.length===0){T.style.height="";return}T.style.height="auto",T.style.height=`${Math.min(T.scrollHeight,160)}px`}},[d]);let W=M(_);W.current=_,w(()=>()=>W.current.forEach(Ir),[]),w(()=>{if(l)return l.current={attachFromDrop:T=>{let O=ho(T,W.current,e.attachments);O.accepted.length!==0&&(st.info("attach (drop)",{count:O.accepted.length,totalBytes:At(O.accepted)}),o.emit("attach",{count:O.accepted.length,totalBytes:At(O.accepted)}),m(Q=>[...Q,...O.accepted]))}},()=>{l.current&&(l.current=null)}},[l,e.attachments]),w(()=>{let T=p.current;if(!T)return;let O=T.closest(`.${Te}-panel`);if(!O)return;let Q=pe=>{let fe=pe.clipboardData;if(!fe)return;if(E){let N=ho(fe.items,W.current,e.attachments);if(N.accepted.length>0){pe.preventDefault(),st.info("attach (paste)",{count:N.accepted.length,totalBytes:At(N.accepted)}),o.emit("attach",{count:N.accepted.length,totalBytes:At(N.accepted)}),m(me=>[...me,...N.accepted]);return}}if(pe.target===T)return;let P=fe.getData("text/plain");P&&(pe.preventDefault(),u(N=>N+P),T.focus())};return O.addEventListener("paste",Q),()=>O.removeEventListener("paste",Q)},[E,e.attachments,Te]);let K=()=>{let T=d.trim();!T&&_.length===0||i||(a(T,_),u(""),m([]))},D=T=>{T.key!=="Enter"||T.shiftKey||T.isComposing||(T.preventDefault(),i?s():K())},ue=T=>{let O=T.target,Q=ho(O.files,_,e.attachments);Q.accepted.length>0&&(st.info("attach (file picker)",{count:Q.accepted.length,totalBytes:At(Q.accepted)}),o.emit("attach",{count:Q.accepted.length,totalBytes:At(Q.accepted)}),m(pe=>[...pe,...Q.accepted])),O.value=""},z=T=>{st.info("removeAttachment",{id:T}),o.emit("removeAttachment",{id:T}),m(O=>{let Q=O.find(pe=>pe.id===T);return Q&&Ir(Q),O.filter(pe=>pe.id!==T)})},te=M(null),ve=()=>{if(B.isSupported){if(h){let T=te.current?Date.now()-te.current:0;st.info("voiceStop",{durationMs:T}),o.emit("voiceStop",{durationMs:T}),B.stop(),g(!1),n.play("voiceStop"),te.current=null;return}te.current=Date.now(),st.info("voiceStart"),o.emit("voiceStart",void 0),g(!0),n.play("voiceStart"),B.start((T,O)=>u(Q=>O?`${Q}${T} `:Q),()=>{if(g(!1),te.current){let T=Date.now()-te.current;st.debug("voiceStop (auto)",{durationMs:T}),o.emit("voiceStop",{durationMs:T}),te.current=null}})}},we=C_[e.composer.sendButton.icon];return r("div",{class:`${Te}-composer`,"data-testid":y.composer,children:[_.length>0?r("div",{class:`${Te}-attachments`,children:_.map(T=>r(ws,{attachment:T,onRemove:()=>z(T.id)},T.id))}):null,r("div",{class:`${Te}-composer-row`,children:[r("div",{class:`${Te}-composer-actions`,children:[E?r("button",{type:"button",class:`${Te}-icon-btn`,onClick:()=>v.current?.click(),"aria-label":c.attach,"data-testid":y.composerAttach,children:r(qa,{})}):null,B.isSupported?r("button",{type:"button",class:`${Te}-icon-btn`,onClick:ve,"aria-label":h?c.micStop:c.micStart,"aria-pressed":h,"data-recording":h?"true":void 0,"data-testid":y.composerVoice,children:r(ja,{})}):null]}),r("textarea",{ref:p,class:`${Te}-textarea`,rows:1,value:d,placeholder:c.composerPlaceholder,onInput:T=>u(T.target.value),onKeyDown:D,"aria-label":c.composerPlaceholder,"data-testid":y.composerInput}),i?r("button",{type:"button",class:`${Te}-send`,onClick:s,"aria-label":c.stop,"data-testid":y.composerStop,children:r(Ka,{})}):r("button",{type:"button",class:`${Te}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:K,disabled:!d.trim()&&_.length===0,"aria-label":c.send,"data-testid":y.composerSend,children:r(we,{})})]}),r("input",{ref:v,type:"file",multiple:!0,accept:e.attachments.accept,onChange:ue,class:`${Te}-sr-only`,"data-testid":y.composerFileInput})]})}var T_=x.cssPrefix;function Cs({visible:e,strings:t}){return e?r("div",{class:`${T_}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}function vo({containerRef:e,onDrop:t}){let[n,o]=k(!1);return w(()=>{let i=e.current;if(!i)return;let a=0,s=u=>{a+=1,u.dataTransfer?.types.includes("Files")&&(u.preventDefault(),o(!0))},l=()=>{a-=1,!(a>0)&&(a=0,o(!1))},c=u=>{u.dataTransfer?.types.includes("Files")&&u.preventDefault()},d=u=>{a=0,o(!1),u.dataTransfer&&(u.preventDefault(),t(u.dataTransfer.items))};return i.addEventListener("dragenter",s),i.addEventListener("dragleave",l),i.addEventListener("dragover",c),i.addEventListener("drop",d),()=>{i.removeEventListener("dragenter",s),i.removeEventListener("dragleave",l),i.removeEventListener("dragover",c),i.removeEventListener("drop",d)}},[e,t]),{visible:n}}function Ts({itemCount:e,initialFocusIndex:t}){let[n,o]=k(!1),i=M(null),a=M(null),[s,l]=k(-1),c=H(()=>{o(!1),l(-1),i.current?.focus()},[]),d=H(()=>o(m=>!m),[]);w(()=>{if(!n)return;let m=h=>{let g=a.current,p=i.current;if(!g||!p)return;let v=h.composedPath();v.includes(g)||v.includes(p)||(o(!1),l(-1))};return document.addEventListener("click",m,!0),()=>document.removeEventListener("click",m,!0)},[n]),w(()=>{if(!n||e===0)return;let m=t?.()??0,h=m<0||m>=e?0:m;l(h)},[n,e,t]),w(()=>{if(!n||s<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[s]?.focus()},[n,s]);let u=H(m=>{(m.key==="ArrowDown"||m.key==="Enter"||m.key===" ")&&(m.preventDefault(),o(!0))},[]),_=H(m=>{if(e!==0)switch(m.key){case"Escape":m.preventDefault(),c();return;case"ArrowDown":m.preventDefault(),l(h=>(h+1)%e);return;case"ArrowUp":m.preventDefault(),l(h=>(h-1+e)%e);return;case"Home":m.preventDefault(),l(0);return;case"End":m.preventDefault(),l(e-1)}},[e,c]);return{open:n,focusIndex:s,triggerRef:i,menuRef:a,toggle:d,close:c,onTriggerKey:u,onMenuKey:_}}function Es({items:e,triggerLabel:t}){let n=x.cssPrefix,o=Ts({itemCount:e.length}),i=l=>{l.disabled||(l.onSelect?.(),l.keepOpen||o.close())},a=(l,c)=>l.onSelectValue?.(c),s=(l,c)=>{let d=c.segments;if(!d?.length)return;let u=Math.max(0,d.findIndex(m=>m.value===c.value)),_=-1;if(l.key==="ArrowRight"||l.key==="Enter"||l.key===" ")_=(u+1)%d.length;else if(l.key==="ArrowLeft")_=(u-1+d.length)%d.length;else return;l.preventDefault(),l.stopPropagation(),a(c,d[_].value)};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(es,{})}),o.open?r("div",{ref:o.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:o.onMenuKey,tabIndex:-1,children:e.map(l=>l.segments?r("div",{role:"menuitem",class:`${n}-menu-item ${n}-menu-item-segmented`,"aria-label":l.label,tabIndex:-1,onKeyDown:c=>s(c,l),children:[l.icon?r("span",{class:`${n}-menu-icon`,children:l.icon}):null,r("span",{class:`${n}-menu-label`,children:l.label}),r("span",{class:`${n}-segmented`,role:"group","aria-label":l.label,children:l.segments.map(c=>{let d=c.value===l.value;return r("button",{type:"button",role:"menuitemradio","aria-checked":d,class:`${n}-segment`,"data-on":d?"true":void 0,lang:c.lang,title:c.value,tabIndex:-1,"data-testid":`${y.langSegment}-${c.value}`,onClick:()=>a(l,c.value),children:c.label},c.value)})})]},l.id):r("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":l.type==="switch"?l.on:void 0,disabled:l.disabled,onClick:()=>i(l),children:[l.icon?r("span",{class:`${n}-menu-icon`,children:l.icon}):null,r("span",{class:`${n}-menu-label`,children:l.label}),l.type==="switch"&&l.on?r("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:r(Zt,{})}):null]},l.id))}):null]})}var Lr=x.cssPrefix;function E_(e){let t=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)").matches:!0;return e==="auto"?t?"light":"dark":t?e==="light"?"dark":"auto":e==="dark"?"light":"auto"}var I_={normal:"large",large:"small",small:"normal"};function A_(e){return e==="light"?r(fs,{}):e==="dark"?r(ms,{}):r(gs,{})}function R_(e){return(e.split("-")[0]??e).toUpperCase()}function ze({panelProps:e,variant:t}){let{options:n,panelSize:o,feedback:i,onClose:a,onClear:s,onExpand:l,onFullscreen:c,onPopOut:d,onSoundToggle:u}=e,{onToggleHistory:_,onLocaleChange:m,onThemeChange:h,onTextSizeChange:g}=e,p=n.strings,v=n.mode,E=t==="chat",S=re(()=>i.mutedSig.value).value,B=new Set(n.actions),A=O=>B.has(O),W=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches,K=O=>W&&(O==="expand"||O==="fullscreen")?!1:nn(O,v,o,{popOutUrl:n.popOutUrl}),D=n.themeMode,ue={auto:p.themeAuto,light:p.themeLight,dark:p.themeDark},z=n.textSize,te={small:p.textSizeSmall,normal:p.textSizeNormal,large:p.textSizeLarge},ve=[];if(E&&A("clear")&&ve.push({id:"clear",icon:r(ls,{}),label:p.newConversation,onSelect:s}),A("expand")&&K("expand")){let O=o==="expanded";ve.push({id:"expand",icon:O?r(Ja,{}):r(Xa,{}),label:O?p.collapse:p.expand,type:"switch",on:O,onSelect:l})}if(A("fullscreen")&&K("fullscreen")){let O=o==="fullscreen";ve.push({id:"fullscreen",icon:O?r(Qa,{}):r(Ya,{}),label:O?p.exitFullscreen:p.fullscreen,type:"switch",on:O,onSelect:c})}A("popOut")&&K("popOut")&&ve.push({id:"popOut",icon:r(ss,{}),label:p.popOut,onSelect:d}),E&&A("sound")&&ve.push({id:"sound",icon:S?r(ns,{}):r(ts,{}),label:S?p.soundOff:p.soundOn,type:"switch",on:!S,onSelect:u}),A("theme")&&ve.push({id:"theme",icon:A_(D),label:`${p.theme}: ${ue[D]}`,onSelect:()=>h(E_(D)),keepOpen:!0}),A("textSize")&&ve.push({id:"textSize",icon:r(os,{}),label:`${p.textSize}: ${te[z]}`,onSelect:()=>g(I_[z]),keepOpen:!0}),A("language")&&n.availableLocales.length>1&&ve.push({id:"language",icon:r(as,{}),label:p.language,segments:n.availableLocales.map(O=>({value:O,label:R_(O),lang:O})),value:n.locale,onSelectValue:m});let we=!!a&&fo(v,o,n.actions),T=E&&A("history");return r("div",{class:`${Lr}-header-actions`,children:[T?r("button",{type:"button",class:`${Lr}-icon-btn`,onClick:_,"aria-label":p.history,title:p.history,"data-testid":y.actionHistory,children:r(is,{})}):null,ve.length>0?r(Es,{items:ve,triggerLabel:p.moreActions}):null,we?r("button",{type:"button",class:`${Lr}-icon-btn`,onClick:a,"aria-label":p.close,title:p.close,"data-testid":y.actionClose,children:r(Be,{})}):null]})}var L_=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,M_=/^https?:\/\/[^\s.]+\.[^\s]+$/i,O_=/^[+]?[\d\s().-]{6,}$/;function Rt(e,t){return e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??`{${o}}`))}function N_(e){return Array.isArray(e)?e.length:e&&e.trim()?1:0}function D_(e,t,n){let o=e.required??!0,i=e.validation;if(e.type==="multiselect"){let s=N_(t);return o&&s===0?n.formRequired:s===0?void 0:i?.minSelections!=null&&s<i.minSelections?Rt(n.formChooseAtLeast,{min:i.minSelections}):i?.maxSelections!=null&&s>i.maxSelections?Rt(n.formChooseAtMost,{max:i.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return o?n.formRequired:void 0;switch(e.type){case"email":if(!L_.test(a))return n.formInvalidEmail;break;case"url":if(!M_.test(a))return n.formInvalidUrl;break;case"tel":if(!O_.test(a))return n.formInvalidTel;break;case"number":{let s=Number(a);if(!Number.isFinite(s))return n.formInvalidNumber;if(i?.min!=null&&s<i.min)return Rt(n.formNumberTooSmall,{min:i.min});if(i?.max!=null&&s>i.max)return Rt(n.formNumberTooLarge,{max:i.max});break}default:break}if(i?.minLength!=null&&a.length<i.minLength)return Rt(n.formTooShort,{min:i.minLength});if(i?.maxLength!=null&&a.length>i.maxLength)return Rt(n.formTooLong,{max:i.maxLength});if(i?.pattern)try{if(!new RegExp(i.pattern).test(a))return n.formPatternMismatch}catch{}}function Is(e,t,n){let o={};for(let i of e){let a=D_(i,t[i.name],n);a&&(o[i.name]=a)}return o}function As(e){let t={};for(let[n,o]of Object.entries(e)){let i=Array.isArray(o)?o.join(", "):o;i&&i.trim()&&(t[n]=i.trim())}return t}var le=x.cssPrefix,bo="__other__";function xo({fields:e,strings:t,submitLabel:n,onSubmit:o,skipLabel:i,onSkip:a,disabled:s,rootTestId:l,submitTestId:c,skipTestId:d}){let[u,_]=k(()=>B_(e)),[m,h]=k({}),[g,p]=k({}),v=A=>{g[A]&&p(W=>({...W,[A]:""}))},E=(A,W)=>{_(K=>({...K,[A]:W})),v(A)},S=(A,W)=>{h(K=>({...K,[A]:W})),v(A)},B=A=>{if(A.preventDefault(),s)return;let W=z_(e,u,m),K=Is(e,W,t);if(Object.keys(K).length>0){p(K);return}o(As(W))};return r("form",{class:`${le}-form`,onSubmit:B,"data-testid":l,noValidate:!0,children:[e.map(A=>r($_,{field:A,value:u[A.name],otherText:m[A.name]??"",error:g[A.name],disabled:s,strings:t,onChange:W=>E(A.name,W),onOtherChange:W=>S(A.name,W)},A.name)),r("div",{class:`${le}-form-actions`,children:[i&&a?r("button",{type:"button",class:`${le}-form-skip`,onClick:a,disabled:s,"data-testid":d,children:i}):null,r("button",{type:"submit",class:`${le}-form-submit`,disabled:s,"data-testid":c,children:n})]})]})}function $_({field:e,value:t,otherText:n,error:o,disabled:i,strings:a,onChange:s,onOtherChange:l}){let c=he(y.formField,e.name),d=H_({field:e,value:t,otherText:n,disabled:i,strings:a,onChange:s,onOtherChange:l,fieldTid:c});return r("label",{class:`${le}-field`,"data-field":e.name,"data-invalid":o?"true":void 0,children:[r("span",{class:`${le}-field-label`,children:[e.label,e.required??!0?r("span",{class:`${le}-field-req`,"aria-hidden":"true",children:" *"}):null]}),d,e.validationHint&&!o?r("span",{class:`${le}-field-hint`,children:e.validationHint}):null,o?r("span",{class:`${le}-field-error`,role:"alert",children:o}):null]})}function H_(e){let{field:t,value:n,otherText:o,disabled:i,strings:a,onChange:s,onOtherChange:l,fieldTid:c}=e,d=typeof n=="string"?n:"";switch(t.type){case"textarea":return r("textarea",{class:`${le}-field-input`,rows:3,value:d,placeholder:t.placeholder,disabled:i,onInput:u=>s(u.target.value),"data-testid":c});case"select":return r("select",{class:`${le}-field-input`,value:d,disabled:i,onChange:u=>s(u.target.value),"data-testid":c,children:[r("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(u=>r("option",{value:u.value,children:u.label??u.value},u.value))]});case"radio":{let u=t.allowOther&&d===bo;return r("div",{class:`${le}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(_=>r("label",{class:`${le}-choice`,children:[r("input",{type:"radio",name:`${le}-${t.name}`,checked:d===_.value,disabled:i,onChange:()=>s(_.value)}),r("span",{children:_.label??_.value})]},_.value)),t.allowOther?r("label",{class:`${le}-choice`,children:[r("input",{type:"radio",name:`${le}-${t.name}`,checked:d===bo,disabled:i,onChange:()=>s(bo)}),r("span",{children:a.formOther})]}):null,u?r("input",{class:`${le}-field-input`,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:i,onInput:_=>l(_.target.value)}):null]})}case"checkbox":return r("label",{class:`${le}-choice`,children:[r("input",{type:"checkbox",checked:d==="true",disabled:i,onChange:u=>s(u.target.checked?"true":""),"data-testid":c}),r("span",{children:t.placeholder??t.label})]});case"multiselect":{let u=Array.isArray(n)?n:[],_=(m,h)=>s(h?[...u,m]:u.filter(g=>g!==m));return r("div",{class:`${le}-field-choices`,"data-testid":c,children:[(t.options??[]).map(m=>r("label",{class:`${le}-choice`,children:[r("input",{type:"checkbox",checked:u.includes(m.value),disabled:i,onChange:h=>_(m.value,h.target.checked)}),r("span",{children:m.label??m.value})]},m.value)),t.allowOther||(t.options??[]).length===0?r("textarea",{class:`${le}-field-input`,rows:2,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:i,onInput:m=>l(m.target.value)}):null]})}default:return r("input",{class:`${le}-field-input`,type:F_(t.type),value:d,placeholder:t.placeholder,disabled:i,onInput:u=>s(u.target.value),"data-testid":c})}}function F_(e){switch(e){case"number":case"email":case"tel":case"url":case"date":case"time":return e;default:return"text"}}function B_(e){let t={};for(let n of e)n.defaultValue!=null&&(t[n.name]=n.type==="multiselect"?n.defaultValue.split(",").map(o=>o.trim()).filter(Boolean):n.defaultValue);return t}function z_(e,t,n){let o={...t};for(let i of e){let a=n[i.name]?.trim();if(i.type==="radio"&&i.allowOther&&t[i.name]===bo)o[i.name]=a??"";else if(i.type==="multiselect"&&a){let s=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),l=Array.isArray(t[i.name])?t[i.name]:[];o[i.name]=[...l,...s]}}return o}var Ue=x.cssPrefix;function Rs({form:e,strings:t,onSubmit:n,onSkip:o}){return r("div",{class:`${Ue}-form-gate`,"data-testid":y.formGate,children:[e.title?r("h3",{class:`${Ue}-form-gate-title`,children:e.title}):null,e.description?r("p",{class:`${Ue}-form-gate-desc`,children:e.description}):null,r(xo,{fields:e.fields,strings:t,submitLabel:e.submitLabel??t.formSubmit,onSubmit:n,skipLabel:e.skippable?t.formSkip:void 0,onSkip:e.skippable?o:void 0,submitTestId:y.formSubmit,skipTestId:y.formSkip})]})}function Ls({marker:e,strings:t,onFill:n}){let o=e.outcome==="skipped",i=o?t.formSkipped:t.formSubmitted,a=e.title?r(ne,{children:[r("span",{children:e.title}),r("span",{class:`${Ue}-sr-only`,children:i})]}):r("span",{children:i}),s=e.form?.reviewable??!1,l=!o&&s&&e.values&&Object.keys(e.values).length>0?e.values:null;if(l){let c=d=>e.form?.fields.find(u=>u.name===d)?.label??d;return r("details",{class:`${Ue}-form-done`,"data-outcome":e.outcome,"data-testid":y.formDone,children:[r("summary",{class:`${Ue}-form-done-summary`,"data-testid":y.formDoneToggle,children:[r(Zt,{}),a,r(It,{})]}),r("dl",{class:`${Ue}-form-answers`,"data-testid":y.formAnswers,children:Object.entries(l).map(([d,u])=>r("div",{class:`${Ue}-form-answer`,children:[r("dt",{children:c(d)}),r("dd",{children:u})]},d))})]})}return r("div",{class:`${Ue}-form-done`,"data-outcome":e.outcome,"data-testid":y.formDone,role:"status",children:[o?r(rs,{}):r(Zt,{}),a,o&&e.form?.reopenable&&n?r("button",{type:"button",class:`${Ue}-form-done-fill`,"data-testid":y.formFill,onClick:n,children:t.formFillOut}):null]})}var Nr=1,Os=2,Ns=4,Ds=8,$s=16;function U_(e){switch(e){case Nr:return"href";case Os:return"src";case Ns:return"class";case Ds:return"checked";case $s:return"start"}}var W_=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}},G_=W_;var Ms=24;function $r(e){let t=new Uint32Array(Ms);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(Ms),indent:"",indent_len:0,table_state:0}}function Hs(e){e.pending.length>0&&be(e,`
12
12
  `)}function Y(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 ce(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 Z(e,t){(e.tokens[e.len]===24||e.tokens[e.len]===23)&&t!==25&&ce(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function V_(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function lt(e,t){for(e.fence_start=0;e.len>t;)ce(e)}function Po(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;)ce(e);return t}function Mr(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?(lt(e,e.blockquote_idx),Z(e,t),!0):(lt(e,n),!1):(lt(e,o),Z(e,t),!0)}function Or(e,t){Z(e,25),e.spaces[e.len]=e.indent_len+t,je(e),e.token=103}function je(e){e.indent="",e.indent_len=0,e.pending=""}function Dr(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 K_(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 q_(e){return Dr(e)||K_(e)}function be(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=Po(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],i>0&&be(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){ce(e),je(e),e.pending=n;continue}lt(e,e.blockquote_idx),je(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" ":Po(e,e.indent_len),Z(e,G_(e.pending.length)),je(e);continue}break;case">":{let a=V_(e,20,e.blockquote_idx+1);a===-1?(lt(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,Z(e,20)):e.blockquote_idx=a,je(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
14
  `:if(e.hr_chars<3)break;Po(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),je(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){Mr(e,23),Or(e,2),be(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):(Z(e,2),je(e),e.fence_start=0,be(e,o));continue;case`
@@ -36,5 +36,5 @@ ${i}`:i;continue}o.startsWith("id:")&&(n=o.slice(3).trim())}if(!t||t==="[DONE]")
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
  `){Y(e),Z(e,i),e.pending=n;continue}}else{if(s===n){Y(e),Z(e,a),Z(e,i),e.pending="";continue}if(n!==" "&&n!==`
38
38
  `){Y(e),Z(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
- `){Y(e),Z(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(q_(n.charCodeAt(0)))break;Y(e),Z(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){Y(e),Z(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){Y(e),Z(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}Y(e)}function Hr(e){return{add_token:j_,end_token:X_,add_text:J_,set_attr:Y_,data:{nodes:[e,,,,,],index:0}}}function j_(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 X_(e){e.index-=1}function J_(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function Y_(e,t,n){e.nodes[e.index].setAttribute(U_(t),n)}function yo({textSig:e,doneSig:t}){let n=M(null);return w(()=>{let o=n.current;if(!o)return;o.classList.add(`${x.cssPrefix}-md`);let i=Hr(o),a=$r(i),s=0,l=qe(()=>{let u=e.value,_=t.value;u.length<s&&(o.replaceChildren(),i=Hr(o),a=$r(i),s=0);let g=u.slice(s);g&&be(a,g),s=u.length,_&&Hs(a)}),c=new MutationObserver(u=>{for(let _ of u)for(let g of _.addedNodes){if(!(g instanceof HTMLElement))continue;let p=g.matches?.("a")?[g]:[...g.querySelectorAll?.("a")??[]];for(let m of p)Fs(m)}});c.observe(o,{childList:!0,subtree:!0});for(let u of o.querySelectorAll("a"))Fs(u);let d=u=>{let _=u.target?.closest?.("a");if(!_||!(_ instanceof HTMLAnchorElement))return;let g=_.getAttribute("href")??"";!g||g.startsWith("#")||(u.preventDefault(),window.open(g,"_blank","noopener,noreferrer"))};return o.addEventListener("click",d),()=>{l(),c.disconnect(),o.removeEventListener("click",d)}},[e,t]),r("div",{ref:n})}function Bs({text:e}){let t=xe(()=>F(e),[e]),n=xe(()=>F(!0),[]);return r(yo,{textSig:t,doneSig:n})}function Fs(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(" ")}var ye=x.cssPrefix;function zs(e){return(e.startsWith("tool:")?e.slice(5):e).replace(/[-_]+/g," ")}function Us({part:e,strings:t,active:n,onDecision:o}){let i=re(()=>e.approvalSig.value),a=re(()=>e.inputSig.value),s=rt("");if(i.value?.approved!==void 0){let d=i.value;return r("div",{class:`${ye}-tool-approval ${ye}-tool-decided`,"data-testid":y.toolDecision,children:[r("span",{class:`${ye}-tool-decided-label`,"data-approved":d?.approved?"true":"false",children:d?.approved?t.approved:t.rejected}),r("strong",{class:`${ye}-tool-title`,children:zs(e.toolName)}),d?.reason?r("span",{class:`${ye}-tool-decided-value`,children:d.reason}):null]})}let c=Z_(a.value);return r("div",{class:`${ye}-tool-approval`,"data-testid":y.toolApproval,children:[r("div",{class:`${ye}-tool-head`,children:[r("span",{class:`${ye}-tool-badge`,children:t.approvalRequired}),r("strong",{class:`${ye}-tool-title`,children:zs(e.toolName)})]}),c?r("pre",{class:`${ye}-tool-args`,children:c}):null,n?r(ne,{children:[r("input",{class:`${ye}-field-input`,value:s.value,placeholder:t.approvalReason,onInput:d=>{s.value=d.target.value}}),r("div",{class:`${ye}-form-actions`,children:[r("button",{type:"button",class:`${ye}-tool-reject`,onClick:()=>o(e.toolCallId,!1,s.value.trim()||void 0),"data-testid":y.toolReject,children:t.reject}),r("button",{type:"button",class:`${ye}-tool-approve`,onClick:()=>o(e.toolCallId,!0,s.value.trim()||void 0),"data-testid":y.toolApprove,children:t.approve})]})]}):r("p",{class:`${ye}-tool-stale-note`,children:t.stepNoLongerActive})]})}function Z_(e){if(e==null)return"";try{let t=typeof e=="string"?e:JSON.stringify(e,null,2);return t.length>600?`${t.slice(0,600)}\u2026`:t}catch{return""}}function Gs(e){let t=e&&typeof e=="object"?e:{},n=t.responseType;return{title:rn(t.title),question:rn(t.question)??"Please provide the missing information.",description:rn(t.description),placeholder:rn(t.placeholder),responseType:n==="single-choice"||n==="multi-choice"||n==="confirmation"||n==="free-text"?n:"free-text",choices:Array.isArray(t.choices)?t.choices:void 0,allowOther:typeof t.allowOther=="boolean"?t.allowOther:void 0,required:typeof t.required=="boolean"?t.required:!0,defaultValues:Array.isArray(t.defaultValues)?t.defaultValues.filter(o=>typeof o=="string"):void 0,minSelections:Ws(t.minSelections),maxSelections:Ws(t.maxSelections),validationHint:rn(t.validationHint)}}function Vs(e){if(e.responseType==="confirmation")return[];let t=(e.choices??[]).map(eu).filter(i=>i!==null),n="textarea";e.responseType==="single-choice"&&t.length>0?n="radio":e.responseType==="multi-choice"&&(n="multiselect");let o=n==="multiselect"?e.defaultValues?.join(", "):e.defaultValues?.[0];return[{name:"answer",label:e.question,type:n,placeholder:e.placeholder,required:e.required??!0,defaultValue:o,options:t.length>0?t:void 0,allowOther:e.allowOther,validationHint:e.validationHint,validation:n==="multiselect"?{minSelections:e.minSelections,maxSelections:e.maxSelections}:void 0}]}function eu(e){return typeof e=="string"?e?{value:e,label:e}:null:e&&typeof e.value=="string"&&e.value?{value:e.value,label:e.label??e.value,description:e.description}:null}function rn(e){return typeof e=="string"&&e.trim()?e.trim():void 0}function Ws(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}var Pe=x.cssPrefix;function qs({part:e,strings:t,active:n,onSubmit:o,onDecision:i}){let a=re(()=>e.stateSig.value),s=re(()=>e.approvalSig.value),l=re(()=>Gs(e.inputSig.value)),c=a.value==="output"||a.value==="error"||s.value?.approved!==void 0,d=s.value!==void 0,u=(p,m)=>{d?i(e.toolCallId,m,p):l.value.responseType==="confirmation"?o(e.toolCallId,{confirmed:m}):o(e.toolCallId,m?{answer:p}:{})};if(c)return r(tu,{part:e,strings:t});if(!n)return r("div",{class:`${Pe}-tool-ask-input ${Pe}-tool-stale`,"data-testid":y.toolAskInput,children:[r(Ks,{strings:t,title:l.value.title??l.value.question}),r("p",{class:`${Pe}-tool-stale-note`,children:t.stepNoLongerActive})]});let _=l.value,g=_.responseType==="confirmation";return r("div",{class:`${Pe}-tool-ask-input`,"data-testid":y.toolAskInput,children:[r(Ks,{strings:t,title:_.title}),_.description?r("p",{class:`${Pe}-tool-desc`,children:_.description}):null,g?r("p",{class:`${Pe}-tool-question`,children:_.question}):null,g?r("div",{class:`${Pe}-form-actions`,children:[r("button",{type:"button",class:`${Pe}-form-skip`,onClick:()=>u(void 0,!1),"data-testid":y.toolInputSkip,children:t.reject}),r("button",{type:"button",class:`${Pe}-form-submit`,onClick:()=>u(void 0,!0),"data-testid":y.toolInputSubmit,children:t.approve})]}):r(xo,{fields:Vs(_),strings:t,submitLabel:t.inputSubmit,onSubmit:p=>u(p.answer??Object.values(p).join(", "),!0),skipLabel:_.required===!1?t.inputSkip:void 0,onSkip:_.required===!1?()=>u(void 0,!1):void 0,submitTestId:y.toolInputSubmit,skipTestId:y.toolInputSkip})]})}function Ks({strings:e,title:t}){return r("div",{class:`${Pe}-tool-head`,children:[r("span",{class:`${Pe}-tool-badge`,children:e.inputRequired}),t?r("strong",{class:`${Pe}-tool-title`,children:t}):null]})}function tu({part:e,strings:t}){let n=re(()=>e.outputSig.value),o=re(()=>e.approvalSig.value),i=o.value?.approved!==void 0?o.value.reason??"":nu(n.value),a=o.value?.approved===!1;return r("div",{class:`${Pe}-tool-ask-input ${Pe}-tool-decided`,"data-testid":y.toolDecision,children:[r("span",{class:`${Pe}-tool-decided-label`,children:a?t.inputSkip:t.inputSubmitted}),r("span",{class:`${Pe}-tool-decided-value`,children:a?"":i||t.inputSubmitted})]})}function nu(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"){let t=e;return"confirmed"in t?t.confirmed?"Yes":"No":Object.values(t).filter(n=>typeof n=="string"||typeof n=="number").join(", ")}return String(e)}function js({part:e,strings:t}){let n=x.cssPrefix;return r("span",{class:`${n}-tool-chip`,role:"status",children:[r("span",{children:[t.usedTool,":"]}),r("strong",{children:e.toolName})]})}var Ee=x.cssPrefix;function Xs({message:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:i,interactive:a=!1,tool:s}){let c=re(()=>e.partsSig.value).value,d=re(()=>e.partsSig.value.some(v=>v.kind==="text"&&v.textSig.value.length>0)),u=re(()=>o&&e.partsSig.value.some(v=>v.kind==="reasoning")),_=e.role==="assistant"&&e.status==="streaming",g=n==="buffered"&&_,p=_&&!d.value,m=_&&!g&&!(u.value&&p),h=ou(e.createdAt);return r("div",{class:`${Ee}-bubble-row`,"data-role":e.role,"data-testid":he(y.messageBubble,e.id),children:r("div",{class:`${Ee}-bubble-col`,children:[r("div",{class:`${Ee}-bubble`,children:[g?r(cu,{label:t.loading}):c.map(v=>r(ru,{part:v,active:p,strings:t,showReasoning:o,showToolCalls:i,interactive:a,tool:s},su(v))),m&&r(lu,{}),e.status==="error"&&e.errorText?r("div",{class:`${Ee}-error`,role:"alert",children:r("span",{children:e.errorText})}):null]}),h?r("time",{class:`${Ee}-bubble-time`,dateTime:h.iso,title:h.full,children:h.short}):null]})})}function ou(e){if(typeof e!="number"||!Number.isFinite(e))return null;try{let t=new Date(e);return{short:t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),full:t.toLocaleString(void 0,{dateStyle:"full",timeStyle:"short"}),iso:t.toISOString()}}catch{return null}}function ru({part:e,active:t,strings:n,showReasoning:o,showToolCalls:i,interactive:a,tool:s}){switch(e.kind){case"text":return r(yo,{textSig:e.textSig,doneSig:e.doneSig});case"reasoning":return o?r(au,{part:e,active:t,strings:n}):null;case"tool":return r(iu,{part:e,strings:n,showToolCalls:i,interactive:a,tool:s});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 iu({part:e,strings:t,showToolCalls:n,interactive:o,tool:i}){let a=re(()=>e.stateSig.value),s=re(()=>e.approvalSig.value!==void 0);if(i?.humanInLoop){if(oo(e.toolName)||a.value==="awaiting-input")return r(qs,{part:e,strings:t,active:o,onSubmit:i.onResult,onDecision:i.onDecision});if(s.value||a.value==="awaiting-approval")return r(Us,{part:e,strings:t,active:o,onDecision:i.onDecision})}return n?r(js,{part:e,strings:t}):null}function au({part:e,active:t,strings:n}){return r("details",{class:`${Ee}-reasoning`,open:t,"data-active":t?"true":void 0,children:[r("summary",{class:`${Ee}-reasoning-summary`,children:r("span",{class:`${Ee}-reasoning-label`,children:t?n.thinking:n.thoughts})}),r("div",{class:`${Ee}-reasoning-body`,children:r(yo,{textSig:e.textSig,doneSig:e.doneSig})})]})}function su(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 lu(){return r("span",{class:`${Ee}-typing`,"aria-hidden":"true",children:[r("span",{}),r("span",{}),r("span",{})]})}function cu({label:e}){return r("span",{class:`${Ee}-loading`,role:"status",children:[r("span",{class:`${Ee}-loading-spinner`,"aria-hidden":"true"}),r("span",{class:`${Ee}-loading-label`,children:e})]})}var Lt=x.cssPrefix,Fr=120,du=350,_u=1200;function Js({messagesSig:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:i,loading:a,idle:s,tool:l,form:c,formMarkers:d,onFillForm:u}){let _=M(null),g=re(()=>e.value),[p,m]=k(!1),[h,v]=k(!1),E=M(!1),S=M(!1),B=M(!1),A=M(0),W=()=>B.current||performance.now()-A.current<du,K=M(0),D=P=>{K.current=performance.now(),P.scrollTop=P.scrollHeight},ue=g.value[0]?.id;fr(()=>{let P=_.current;if(!P||g.value.length===0||(E.current=!0,!g.value.some(Je=>Je.role==="user")))return;let N=()=>D(P);N();let me=new ResizeObserver(N);me.observe(P);let ke=new MutationObserver(N);ke.observe(P,{childList:!0,subtree:!0,characterData:!0});let Ce=setTimeout(()=>{me.disconnect(),ke.disconnect()},300);return()=>{me.disconnect(),ke.disconnect(),clearTimeout(Ce)}},[ue]);let z=M(0);w(()=>{let P=_.current,N=g.value,me=z.current;if(z.current=N.length,!P||!E.current)return;if(N.slice(me).some(Ce=>Ce.role==="user")){S.current=!1,D(P);return}if(S.current||W())return;P.scrollHeight-P.scrollTop-P.clientHeight<Fr&&D(P)},[g.value.length]),w(()=>{let P=_.current;if(!P)return;let N=g.value.at(-1);if(!N)return;let me=()=>{if(S.current||W())return;P.scrollHeight-P.scrollTop-P.clientHeight<Fr*2&&D(P)};if(N.status!=="streaming"){let Ce=requestAnimationFrame(me);return()=>cancelAnimationFrame(Ce)}me();let ke=new MutationObserver(me);return ke.observe(P,{childList:!0,subtree:!0,characterData:!0}),()=>ke.disconnect()},[g.value]);let te=c?.form.id;fr(()=>{let P=_.current;!P||!te||S.current||g.value.some(N=>N.role==="user")&&D(P)},[te]),w(()=>{let P=_.current;if(!P)return;let N=()=>m(P.scrollHeight-P.scrollTop-P.clientHeight>Fr*2),me,ke=()=>{N(),performance.now()-K.current>150&&(S.current=P.scrollHeight-P.scrollTop-P.clientHeight>8),v(!0),clearTimeout(me),me=setTimeout(()=>v(!1),_u)},Ce=()=>{S.current=!0},Je=Ye=>{Ye.deltaY<0&&Ce()},Ot=0,_t=Ye=>{Ot=Ye.touches[0]?.clientY??0,B.current=!0},Nt=Ye=>{(Ye.touches[0]?.clientY??0)>Ot+4&&Ce()},Ie=()=>{B.current=!1,A.current=performance.now()},Dt=()=>{B.current=!0};return P.addEventListener("scroll",ke,{passive:!0}),P.addEventListener("wheel",Je,{passive:!0}),P.addEventListener("touchstart",_t,{passive:!0}),P.addEventListener("touchmove",Nt,{passive:!0}),P.addEventListener("touchend",Ie,{passive:!0}),P.addEventListener("touchcancel",Ie,{passive:!0}),P.addEventListener("pointerdown",Dt,{passive:!0}),window.addEventListener("pointerup",Ie,{passive:!0}),window.addEventListener("pointercancel",Ie,{passive:!0}),N(),()=>{P.removeEventListener("scroll",ke),P.removeEventListener("wheel",Je),P.removeEventListener("touchstart",_t),P.removeEventListener("touchmove",Nt),P.removeEventListener("touchend",Ie),P.removeEventListener("touchcancel",Ie),P.removeEventListener("pointerdown",Dt),window.removeEventListener("pointerup",Ie),window.removeEventListener("pointercancel",Ie),clearTimeout(me)}},[]);let ve=()=>{let P=_.current;P&&(S.current=!1,D(P))},we=[],T="",O=g.value.at(-1)?.id,Q=[...d??[]].toSorted((P,N)=>(P.createdAt??1/0)-(N.createdAt??1/0)),pe=P=>r(Ls,{marker:P,strings:t,onFill:!c&&u?()=>u(P.formId):void 0},P.key),fe=P=>{for(let N=Q[0];N?.createdAt!==void 0&&!(P!==void 0&&N.createdAt>P);N=Q[0])Q.shift(),we.push(pe(N))};for(let P of g.value){fe(P.createdAt);let N=uu(P.createdAt);N&&N!==T&&(we.push(r("div",{class:`${Lt}-date-divider`,children:r("span",{class:`${Lt}-date-pill`,title:pu(P.createdAt),children:fu(P.createdAt,t)})},`day:${N}`)),T=N),we.push(r(Xs,{message:P,strings:t,responseMode:n,showReasoning:o,showToolCalls:i,interactive:!!s&&P.id===O,tool:l},P.id))}for(let P of Q)we.push(pe(P));return r("div",{class:`${Lt}-list-wrap`,children:[r("div",{ref:_,class:`${Lt}-list`,role:"log","aria-live":"polite","aria-relevant":"additions text","data-scrolling":h?"true":void 0,children:[a&&g.value.length===0?r("div",{class:`${Lt}-list-loading`,role:"status",children:t.conversationLoading}):null,we,c?r(Rs,{form:c.form,strings:t,onSubmit:c.onSubmit,onSkip:c.onSkip}):null]}),p?r("button",{type:"button",class:`${Lt}-jump`,onClick:ve,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":y.scrollToBottom,children:r(cs,{})}):null]})}function uu(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function pu(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function fu(e,t){let n=new Date(e),o=a=>new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),i=Math.round((o(new Date)-o(n))/864e5);return i<=0?t.dateToday:i===1?t.dateYesterday:i<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}var mu=["today","yesterday","lastWeek","older"];function gu(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let o=Math.floor((Ys(e)-Ys(n))/(1440*60*1e3));return o<=0?"today":o===1?"yesterday":o<7?"lastWeek":"older"}function Qs(e,t){let n=new Map;for(let o of t){let i=gu(e,o.lastMessageAt),a=n.get(i);a?a.push(o):n.set(i,[o])}return mu.filter(o=>n.has(o)).map(o=>({bucket:o,conversations:n.get(o)}))}function Ys(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var hu=U.scope("history"),vu={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function bu(e,t,n){let o=Date.parse(e);return Number.isFinite(o)?new Date(o).toDateString()===new Date(t).toDateString()?new Intl.DateTimeFormat(n,{hour:"numeric",minute:"2-digit"}).format(o):t-o<10080*60*1e3?new Intl.DateTimeFormat(n,{weekday:"short"}).format(o):new Intl.DateTimeFormat(n,{month:"short",day:"numeric"}).format(o):""}function So({transport:e,strings:t,visitorId:n,onSelect:o,onNewConversation:i}){let a=x.cssPrefix,[s,l]=k("loading"),[c,d]=k([]);w(()=>{let m=!1;return e.listConversations({visitorId:n}).then(h=>{m||(d(h.conversations??[]),l("loaded"))}).catch(h=>{m||(hu.warn("listConversations failed",{err:h}),l("error"))}),()=>{m=!0}},[e,n]);let u=i?r("div",{class:`${a}-history-footer`,children:r("button",{type:"button",class:`${a}-history-new`,onClick:i,"data-testid":y.sidebarNewConversation,children:[r(Ua,{}),t.newConversation]})}):null;if(s==="loading")return r(ne,{children:[r("div",{class:`${a}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:r("div",{class:`${a}-history-card`,children:[0,1,2,3].map(m=>r("div",{class:`${a}-history-skeleton-item`,"aria-hidden":"true",children:[r("span",{class:`${a}-history-skeleton-avatar`}),r("span",{class:`${a}-history-skeleton-body`,children:[r("span",{class:`${a}-history-skeleton-line ${a}-skeleton-title`}),r("span",{class:`${a}-history-skeleton-line ${a}-skeleton-preview`})]})]},m))})}),u]});if(s==="error"||c.length===0)return r(ne,{children:[r("div",{class:`${a}-history-empty`,children:t.historyEmpty}),u]});let _=Date.now(),g=typeof navigator<"u"?navigator.language:"en",p=Qs(_,c);return r(ne,{children:[r("div",{class:`${a}-history`,role:"list",children:p.map(m=>r("div",{class:`${a}-history-group`,children:[r("div",{class:`${a}-history-heading`,children:t[vu[m.bucket]]}),r("div",{class:`${a}-history-card`,children:m.conversations.map(h=>r("button",{type:"button",role:"listitem",class:`${a}-history-item`,onClick:()=>o(h),"data-closed":h.canContinue?void 0:"true","data-unread":(h.unreadCount??0)>0?"true":void 0,"data-testid":he(y.historyItem,h.conversationId),children:[r("span",{class:`${a}-history-avatar`,"aria-hidden":"true",children:r(kr,{})}),r("span",{class:`${a}-history-body`,children:[r("span",{class:`${a}-history-row`,children:[r("span",{class:`${a}-history-title`,children:h.title}),r("span",{class:`${a}-history-time`,children:bu(h.lastMessageAt,_,g)})]}),r("span",{class:`${a}-history-row`,children:[r("span",{class:`${a}-history-preview`,children:h.preview??(h.canContinue?t.historyContinue:t.conversationClosed)}),(h.unreadCount??0)>0?r("span",{class:`${a}-history-dot`}):null]})]})]},h.conversationId))})]},m.bucket))}),u]})}var Zs=x.cssPrefix;function el({suggestions:e,onPick:t}){return e.length===0?null:r("div",{class:`${Zs}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((n,o)=>r("button",{type:"button",class:`${Zs}-suggestion`,onClick:()=>t(n),"data-testid":he(y.suggestion,o),children:n.label},n.id))})}var Se=x.cssPrefix;function tl(e){let{options:t,onClose:n}=e,o=t.strings,i=M(null);w(()=>{let c=i.current;if(!c)return;let d=mo(c),u=_=>{_.key==="Escape"&&n?.()};return c.addEventListener("keydown",u),()=>{d(),c.removeEventListener("keydown",u)}},[n]);let a=M(null),s=H(c=>{a.current?.attachFromDrop(c)},[]),{visible:l}=vo({containerRef:i,onDrop:s});return po(i.current,t.mode==="modal"),r("div",{ref:i,class:`${Se}-panel`,role:"dialog","aria-modal":"false","aria-label":o.panelTitle,style:{position:"relative"},"data-testid":y.panel,children:[r(Br,{...e,containerEl:i.current,dragOver:l,composerAttachApiRef:a}),r(zr,{poweredBy:e.options.poweredBy})]})}function Br(e){let{options:t,transport:n,feedback:o,bus:i,panelSize:a,view:s,canSend:l,isStreaming:c,loadingMessages:d,messagesSig:u,agent:_,suggestions:g,initialWidgetSize:p,visitorId:m,onClose:h,onBack:v,onClear:E,onToggleHistory:S,onSelectHistoryConversation:B,onNewConversation:A,onWidgetSizeChange:W,onSend:K,onStop:D,onSuggestion:ue,activeForm:z,formMarkers:te,onFormSubmit:ve,onFormSkip:we,onFormFill:T,tool:O,containerEl:Q,dragOver:pe,composerAttachApiRef:fe}=e,P=t.strings,N;return z?N=null:l?N=r(ne,{children:[r(el,{suggestions:g,onPick:ue}),r(ks,{options:t,transport:n,feedback:o,bus:i,isStreaming:c,onSend:K,onStop:D,attachApiRef:fe})]}):N=r(Pu,{label:P.conversationClosed,ctaLabel:P.startNewConversation,onNewConversation:E}),r(ne,{children:[s==="history"?r(xu,{strings:P,onBack:S,onClose:h,showClose:fo(t.mode,a,t.actions)}):r("header",{class:`${Se}-header`,"data-testid":y.panelHeader,children:[v?r("button",{type:"button",class:`${Se}-icon-btn`,onClick:v,"aria-label":P.moduleBack,title:P.moduleBack,children:r(en,{})}):null,_?r(ys,{agent:_,strings:P}):r("h1",{children:P.panelTitle}),r(ze,{panelProps:e,variant:"chat"})]}),s==="history"?r(So,{transport:n,strings:P,visitorId:m,onSelect:me=>B(me.conversationId),onNewConversation:A}):r(ne,{children:[r(Cs,{visible:pe,strings:P}),r(Js,{messagesSig:u,strings:P,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,loading:d,idle:!c,tool:O,form:z?{form:z,onSubmit:ve,onSkip:we}:null,formMarkers:te,onFillForm:T}),N,r(yu,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?r(uo,{panelEl:Q,resize:t.size.resize,position:t.position,initialSize:p,onSizeChange:W,strings:P}):null]})}function xu({strings:e,onBack:t,onClose:n,showClose:o}){return r("header",{class:`${Se}-header`,children:[r("button",{type:"button",class:`${Se}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:r(en,{})}),r("h1",{children:e.historyTitle}),o?r("button",{type:"button",class:`${Se}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:r(Be,{})}):null]})}function Pu({label:e,ctaLabel:t,onNewConversation:n}){return r("div",{class:`${Se}-readonly-banner`,role:"note",children:[r("span",{class:`${Se}-readonly-label`,children:e}),r("button",{type:"button",class:`${Se}-readonly-cta`,onClick:n,children:t})]})}function yu({disclaimer:e}){return e?r("div",{class:`${Se}-composer-footer`,children:r("div",{class:`${Se}-disclaimer`,children:e})}):null}function zr({poweredBy:e}){return e?r("div",{class:`${Se}-poweredby-bar`,children:r(Su,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function Su({logoUrl:e,text:t,href:n}){let o=r(ne,{children:[e?r("img",{class:`${Se}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?r("span",{children:t}):null]});return n?r("a",{class:`${Se}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:o}):r("span",{class:`${Se}-poweredby`,children:o})}function nl(e){let t=M(e);t.current=e;let n=M(null);return n.current??(n.current=wu(t)),n.current}function wu(e){let t=F(null),n=new Set,o=c=>`${e.current.conversationId()??""}:${c}`,i=c=>c.frequency==="always"?!1:c.frequency==="conversation"?n.has(o(c.id)):c.id in e.current.persistence.loadFormsDone(),a=(c,d)=>{if(t.value)return;let u=e.current;if(c==="manual"){let _=u.forms.list.find(g=>g.id===d);_&&(t.value={form:_,trigger:"manual"});return}for(let _ of u.forms.byTrigger[c]??[]){let g=_.triggers.find(p=>p.kind===c);if(!(!g||!ku(g,u)||i(_)||!Cu(_,u))){t.value={form:_,trigger:c};return}}},s=(c,d)=>{let u=t.value;if(!u)return;t.value=null;let{form:_,trigger:g}=u;_.frequency==="conversation"?n.add(o(_.id)):_.frequency!=="always"&&e.current.persistence.saveFormDone(_.id),e.current.onComplete(_,g,c,d)};return{activeForm:t,fire:a,refresh:()=>{let c=t.value;if(!c)return;let d=e.current.forms.list.find(u=>u.id===c.form.id);d&&d!==c.form&&(t.value={form:d,trigger:c.trigger})},complete:c=>s(c,!1),skip:()=>s({},!0)}}function ku(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function Cu(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let i=t.userContext()??{};if(n.missingContext.some(a=>i[a]!==void 0&&i[a]!==""))return!1}if(n.pageArea&&!(Array.isArray(n.pageArea)?n.pageArea:[n.pageArea]).includes(t.pageArea()??""))return!1;let o=t.messageCount();return!(n.minMessages!=null&&o<n.minMessages||n.maxMessages!=null&&o>n.maxMessages)}function ol(e){let t=x.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":y.sidebar,children:[r("div",{class:`${t}-sidebar-header`,children:[r(Tu,{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":y.sidebarToggle,children:r(Eu,{collapsed:a})})]}),a?null:r(ne,{children:[s.length>0?r("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:r(Iu,{items:s})}):null,l.length>0?r("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:r(Au,{items:l})}):null,e.showConversations?r("div",{class:`${t}-sidebar-conversations`,children:r(So,{transport:e.transport,strings:e.strings,visitorId:e.visitorId,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function Tu({site:e}){let t=x.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??x.name})}function Eu({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 Iu({items:e}){let t=x.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 Au({items:e}){let t=x.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 rl=x.cssPrefix;function il(e){return r("main",{class:`${rl}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[r(ol,{site:e.site,blocks:e.blocks,transport:e.transport,strings:e.strings,visitorId:e.visitorId,showConversations:e.showConversations,onSelectConversation:e.onSelectConversation,onNewConversation:e.onNewConversation,collapsed:e.sidebarCollapsed,onToggleCollapsed:e.onToggleSidebarCollapsed}),r("section",{class:`${rl}-page-chat`,"aria-label":"Chat",children:e.children})]})}var al=e=>Object.fromEntries(e.map(t=>[t,[]]));function sl(e,t,n){let o=F({activeTab:e,stacks:al(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:al(t)}}}}var ll=e=>e.stacks[e.activeTab]??[],cl=e=>ll(e).at(-1),dl=e=>ll(e).length===0;var _l={Icon:tn};var tt=x.cssPrefix;function wo({title:e,actions:t}){return r("header",{class:`${tt}-back-header`,"data-variant":"title",children:[r("span",{class:`${tt}-back-spacer`,"aria-hidden":"true"}),r("h1",{class:`${tt}-back-title`,children:e}),t??r("span",{class:`${tt}-back-spacer`,"aria-hidden":"true"})]})}function ko({title:e,backLabel:t,onBack:n,actions:o,testid:i}){return r("header",{class:`${tt}-back-header`,"data-testid":i,children:[r("button",{type:"button",class:`${tt}-icon-btn`,onClick:n,"aria-label":t,title:t,children:r(en,{})}),r("h1",{class:`${tt}-back-title`,children:e}),o??r("span",{class:`${tt}-back-spacer`,"aria-hidden":"true"})]})}var Mt=x.cssPrefix;function ul({placeholder:e,onActivate:t}){return r("button",{type:"button",class:`${Mt}-home-search`,onClick:t,"data-testid":y.homeSearch,children:[r("span",{class:`${Mt}-home-search-text`,children:e}),r("span",{class:`${Mt}-home-search-icon`,"aria-hidden":"true",children:r(Tr,{})})]})}function pl({placeholder:e,value:t,onInput:n}){return r("div",{class:`${Mt}-home-search`,"data-input":"true",children:[r("input",{type:"search",class:`${Mt}-home-search-input`,placeholder:e,value:t,onInput:o=>n(o.currentTarget.value),"data-testid":y.helpSearch}),r("span",{class:`${Mt}-home-search-icon`,"aria-hidden":"true",children:r(Tr,{})})]})}var an=x.cssPrefix;function Co({title:e,subtitle:t,onClick:n,testid:o}){return r("button",{type:"button",class:`${an}-list-row`,onClick:n,"data-testid":o,children:[r("span",{class:`${an}-list-row-body`,children:[r("span",{class:`${an}-list-row-title`,children:e}),t?r("span",{class:`${an}-list-row-sub`,children:t}):null]}),r("span",{class:`${an}-list-row-chevron`,"aria-hidden":"true",children:r(It,{})})]})}var fl=x.cssPrefix;function Oe({tone:e="info",message:t,onRetry:n,strings:o}){return r("div",{class:`${fl}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[r("span",{children:t}),n?r("button",{type:"button",class:`${fl}-module-retry`,onClick:n,children:o.errorRetry}):null]})}var ct=x.cssPrefix,Ru=U.scope("help"),Lu=(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 Mu(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 ml(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 Ou(e,t){let n=t.toLowerCase().trim();return n?e.map(o=>({item:o,score:Math.max(ml(n,o.title)*2,ml(n,o.description??""))})).filter(o=>o.score>0).toSorted((o,i)=>i.score-o.score).map(o=>o.item):[]}function gl({article:e,nav:t}){return r(Co,{title:e.title,subtitle:e.description,onClick:()=>Lu(t,e),testid:he(y.helpArticle,e.id)})}function Nu({transport:e,strings:t,config:n,nav:o,panelProps:i}){let a=n.contentTags,[s,l]=k("loading"),[c,d]=k(t.errorGeneric),[u,_]=k([]),[g,p]=k(""),[m,h]=k(0);w(()=>{let S=!1;return l("loading"),e.listContent({tags:a,sortBy:"order",limit:100}).then(B=>{S||(_(B.items??[]),l("loaded"))}).catch(B=>{S||(Ru.warn("listContent (help) failed",{err:B}),d(it(B,t)),l("error"))}),()=>{S=!0}},[e,a,m]);let v=xe(()=>Ou(u,g),[u,g]);function E(){return g.trim().length>0?v.length===0?r(Oe,{message:t.helpSearchEmpty,strings:t}):r("div",{class:`${ct}-help-card`,children:v.map(S=>r(gl,{article:S,nav:o},S.id))}):s==="loading"?r(Oe,{message:t.helpLoading,strings:t}):s==="error"?r(Oe,{tone:"error",message:c,onRetry:()=>h(S=>S+1),strings:t}):u.length===0?r(Oe,{message:t.helpEmpty,strings:t}):Mu(u).map(([S,B])=>r("section",{class:`${ct}-help-group`,children:[S?r("h2",{class:`${ct}-help-section-title`,children:S}):null,r("div",{class:`${ct}-help-card`,children:B.map(A=>r(gl,{article:A,nav:o},A.id))})]},S))}return r("div",{class:`${ct}-module`,children:[r(wo,{title:t.helpTitle,actions:r(ze,{panelProps:i,variant:"plain"})}),r("div",{class:`${ct}-module-pad`,children:r(pl,{placeholder:t.helpSearchPlaceholder,value:g,onInput:p})}),r("div",{class:`${ct}-help-list`,children:E()})]})}var hl={Icon:Cr,Root:e=>r(Nu,{...e})};var vl=x.cssPrefix;function Ur({onClick:e,children:t,testid:n}){return e?r("button",{type:"button",class:`${vl}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):r("div",{class:`${vl}-home-card`,"data-testid":n,children:t})}var oe=x.cssPrefix,bl=U.scope("home");function Du(e){let t=e.options.userContext?.name,n=e.config.greetingText?$e(e.strings,e.config.greetingText):void 0;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 $u=(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 Hu(e){let{transport:t,strings:n,config:o,nav:i,panelProps:a}=e,[s,l]=k(null),[c,d]=k([]),u=o.contentTags?.join(",");w(()=>{if(!o.showRecentConversations)return;let v=!1;return t.listConversations({limit:1}).then(E=>!v&&l(E.conversations?.[0]??null)).catch(E=>!v&&bl.warn("listConversations (home) failed",{err:E})),()=>{v=!0}},[t,o.showRecentConversations]),w(()=>{if(!o.contentTags?.length)return;let v=!1;return t.listContent({tags:o.contentTags,limit:6}).then(E=>!v&&d(E.items??[])).catch(E=>!v&&bl.warn("listContent (home) failed",{err:E})),()=>{v=!0}},[t,u]);let _=Du(e),g=o.userAvatars??[],p=o.status,m=p?.text?$e(n,p.text):n.homeStatus,h=o.contentBlockTitle?$e(n,o.contentBlockTitle):n.homeContentTitle;return r("div",{class:`${oe}-module ${oe}-home`,"data-testid":y.homeView,children:r("div",{class:`${oe}-home-scroll`,children:[r("div",{class:`${oe}-home-hero`,children:[r("div",{class:`${oe}-home-hero-top`,children:[o.brandName?r("span",{class:`${oe}-home-brand`,"data-testid":y.homeBrand,children:o.brandName}):r("span",{class:`${oe}-home-brand-spacer`,"aria-hidden":"true"}),r("div",{class:`${oe}-home-hero-actions`,children:[g.length>0?r("div",{class:`${oe}-home-avatars`,children:g.map(v=>r("span",{class:`${oe}-home-avatar`,title:v.role?`${v.name} \xB7 ${v.role}`:v.name,children:v.avatar?r("img",{src:v.avatar,alt:"",loading:"lazy"}):r("span",{children:go(v.name)})},v.name))}):null,r(ze,{panelProps:a,variant:"plain"})]})]}),o.showGreeting!==!1?r(ne,{children:[r("h1",{class:`${oe}-home-greeting`,"data-testid":y.homeGreeting,children:_.title}),_.subtitle?r("p",{class:`${oe}-home-lead`,children:_.subtitle}):null]}):null]}),r("div",{class:`${oe}-home-cards`,children:[o.showSearchBar!==!1?r(ul,{placeholder:n.homeSearchPlaceholder,onActivate:()=>i.switchToLayout("help")}):null,s?r(Ur,{onClick:()=>i.selectConversation(s.conversationId),testid:y.homeRecent,children:r("div",{class:`${oe}-home-recent-row`,"data-unread":(s.unreadCount??0)>0?"true":void 0,children:[r("span",{class:`${oe}-home-recent-avatar`,"aria-hidden":"true",children:r(tn,{})}),r("span",{class:`${oe}-home-recent-body`,children:[r("span",{class:`${oe}-home-recent-title`,children:s.title}),s.preview?r("span",{class:`${oe}-home-recent-preview`,children:s.preview}):null]}),(s.unreadCount??0)>0?r("span",{class:`${oe}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,p?r(Ur,{onClick:p.url?()=>i.push({kind:"iframe",url:p.url,title:m}):void 0,children:r("div",{class:`${oe}-home-status`,"data-level":p.level??"operational",children:[r("span",{class:`${oe}-home-status-icon`,"aria-hidden":"true",children:r(_s,{})}),r("span",{class:`${oe}-home-status-text`,children:m})]})}):null,c.length>0?r("section",{class:`${oe}-home-content`,children:[r("div",{class:`${oe}-home-content-title`,children:h}),r("div",{class:`${oe}-home-content-list`,children:c.map(v=>r(Co,{title:v.title,subtitle:v.description,onClick:()=>$u(i,v),testid:he(y.homeContentRow,v.id)},v.id))})]}):null]})]})})}var xl={Icon:us,Root:e=>r(Hu,{...e})};var We=x.cssPrefix,Fu=U.scope("news");function Bu({transport:e,strings:t,config:n,nav:o,panelProps:i}){let a=n.contentTags,[s,l]=k("loading"),[c,d]=k(t.errorGeneric),[u,_]=k([]),[g,p]=k(0);w(()=>{let h=!1;return l("loading"),e.listContent({tags:a,sortBy:"publishedAt",sortOrder:"desc"}).then(v=>{h||(_(v.items??[]),l("loaded"))}).catch(v=>{h||(Fu.warn("listContent (news) failed",{err:v}),d(it(v,t)),l("error"))}),()=>{h=!0}},[e,a,g]);function m(){return s==="loading"?r(Oe,{message:t.newsLoading,strings:t}):s==="error"?r(Oe,{tone:"error",message:c,onRetry:()=>p(h=>h+1),strings:t}):u.length===0?r(Oe,{message:t.newsEmpty,strings:t}):r("div",{class:`${We}-news-list`,children:u.map(h=>r("button",{type:"button",class:`${We}-news-card`,onClick:()=>o.push({kind:"content",id:h.id,title:h.title}),"data-testid":he(y.newsItem,h.id),children:[h.image?r("img",{class:`${We}-news-hero`,src:h.image,alt:"",loading:"lazy"}):null,r("span",{class:`${We}-news-body`,children:[h.tags&&h.tags.length>0?r("span",{class:`${We}-news-tags`,children:h.tags.map(v=>r("span",{class:`${We}-news-tag`,children:v},v))}):null,r("span",{class:`${We}-news-title`,children:h.title}),h.description?r("span",{class:`${We}-news-summary`,children:h.description}):null]})]},h.id))})}return r("div",{class:`${We}-module`,children:[r(wo,{title:t.newsTitle,actions:r(ze,{panelProps:i,variant:"plain"})}),r("div",{class:`${We}-module-scroll`,children:m()})]})}var Pl={Icon:ps,Root:e=>r(Bu,{...e})};var To={chat:_l,home:xl,help:hl,news:Pl};var sn=x.cssPrefix;function yl({modules:e,activeTab:t,strings:n,unreadCount:o,onSelect:i}){return r("nav",{class:`${sn}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let s=To[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:`${sn}-tab`,onClick:()=>i(a.id),"data-testid":he(y.tab,a.id),children:[r("span",{class:`${sn}-tab-icon`,"aria-hidden":"true",children:[r(s,{}),c?r("span",{class:`${sn}-tab-badge`,"data-testid":y.tabBadge,children:c}):null]}),r("span",{class:`${sn}-tab-label`,children:$e(n,a.label)})]},a.id)})})}var Sl=x.cssPrefix,zu="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function wl({url:e,title:t,strings:n,onBack:o,actions:i}){return r("div",{class:`${Sl}-module`,children:[r(ko,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:o,actions:i}),r("iframe",{class:`${Sl}-content-frame`,src:e,title:t||"content",sandbox:zu,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var dt=x.cssPrefix,Uu=U.scope("content");function kl({id:e,title:t,transport:n,strings:o,onBack:i,actions:a}){let[s,l]=k(null),[c,d]=k(!1),[u,_]=k(0),g=H(()=>{d(!1),l(null),_(m=>m+1)},[]);w(()=>{let m=!1;return n.listContent({ids:[e],limit:1}).then(h=>{if(m)return;let v=h.items[0];v?l(v):d(!0)}).catch(h=>{m||(Uu.warn("listContent (reader) failed",{err:h}),d(!0))}),()=>{m=!0}},[n,e,u]);function p(){return c?r(Oe,{tone:"error",message:o.errorGeneric,onRetry:g,strings:o}):s===null?r(Oe,{message:o.contentLoading,strings:o}):r("article",{class:`${dt}-content`,"data-testid":y.contentView,children:[s.image?r("img",{class:`${dt}-content-hero`,src:s.image,alt:"",loading:"lazy"}):null,s.description?r("p",{class:`${dt}-content-subtitle`,children:s.description}):null,s.tags?.length?r("span",{class:`${dt}-news-tags`,children:s.tags.map(m=>r("span",{class:`${dt}-news-tag`,children:m},m))}):null,r(Bs,{text:s.content??""})]})}return r("div",{class:`${dt}-module`,children:[r(ko,{title:s?.title||t||o.moduleBack,backLabel:o.moduleBack,onBack:i,actions:a,testid:y.backHeader}),r("div",{class:`${dt}-module-scroll`,"data-testid":y.contentScroll,children:p()})]})}var Wr=x.cssPrefix;function Cl({panelProps:e,enabledModules:t,nav:n,unreadCount:o,onSelectConversation:i,onStartNewConversation:a,onSetPanelSize:s}){let l=e.options,c=l.strings,d=M(null);w(()=>{let D=d.current;if(!D)return;let ue=mo(D),z=te=>{te.key==="Escape"&&e.onClose?.()};return D.addEventListener("keydown",z),()=>{ue(),D.removeEventListener("keydown",z)}},[e.onClose]);let u=M(null),_=H(D=>{u.current?.attachFromDrop(D)},[]),{visible:g}=vo({containerRef:d,onDrop:_});po(d.current,l.mode==="modal");let p=re(()=>n.sig.value).value,m=cl(p),h=l.modules.byId[p.activeTab],v=m?.kind==="iframe"||m?.kind==="content",E=t.length>1&&(dl(p)||!v),S=M(null);w(()=>{if(v&&S.current===null)S.current=e.panelSize,e.panelSize==="normal"&&s("expanded");else if(!v&&S.current!==null){let D=S.current;S.current=null,s(D)}},[v]);let B={push:n.push,pop:n.pop,switchTab:n.switchTab,switchToLayout:D=>{let ue=t.find(z=>z.layout===D);ue&&n.switchTab(ue.id)},selectConversation:i,startNewConversation:a},A=D=>({options:l,transport:e.transport,strings:c,config:D,visitorId:e.visitorId,nav:B,panelProps:e}),W=r(ze,{panelProps:e,variant:"plain"}),K;if(m?.kind==="iframe")K=r(wl,{url:m.url,title:m.title,strings:c,onBack:n.pop,actions:W});else if(m?.kind==="content")K=r(kl,{id:m.id,title:m.title,transport:e.transport,strings:c,onBack:n.pop,actions:W});else if(h?.layout==="chat")K=r(Br,{...e,containerEl:d.current,dragOver:g,composerAttachApiRef:u});else if(h){let D=To[h.layout].Root;K=D?r(D,{...A(h)},h.id):null}else K=null;return r("div",{ref:d,class:`${Wr}-panel ${Wr}-messenger`,role:"dialog","aria-modal":"false","aria-label":c.panelTitle,style:{position:"relative"},"data-testid":y.messengerHome,children:[r("div",{class:`${Wr}-messenger-body`,children:K}),E?r(yl,{modules:t,activeTab:p.activeTab,strings:c,unreadCount:o,onSelect:n.switchTab}):null,r(zr,{poweredBy:l.poweredBy}),l.size.resize?.enabled&&!(h?.layout==="chat"&&!m)?r(uo,{panelEl:d.current,resize:l.size.resize,position:l.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:c}):null]})}var ln=x.cssPrefix;function Tl({strings:e,onClose:t}){return r("div",{class:`${ln}-panel ${ln}-modules-empty`,role:"dialog","aria-label":e.panelTitle,"data-testid":y.modulesEmpty,children:[t?r("button",{type:"button",class:`${ln}-icon-btn ${ln}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:r(Be,{})}):null,r("p",{class:`${ln}-modules-empty-text`,children:e.modulesEmpty})]})}function El({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=H(()=>{a(!0),o||t.saveCalloutDismissed(n)},[t,n,o]);return{dismissed:i,dismissCallout:s}}var V=U.scope("app"),Gr=x.cssPrefix;function Il({options:e,hostElement:t,bus:n}){let[o]=k(()=>yt(e.widgetId,e.storage)),[i,a]=k(()=>o.getVisitorId()),s=o.loadUserPrefs(),[l,c]=k(()=>s.locale??e.locale),[d,u]=k(()=>s.themeMode??e.themeMode),[_,g]=k(()=>s.textSize??e.textSize),p=rt(o.loadConversationId()),m=rt([]),h=rt(0),[v,E]=k(!1),[S,B]=k([]);function A(){let f=e.modules.list,b=new Set(f.map(R=>R.id)),L=o.loadActiveModule();return L&&b.has(L)?L:f[0]?.id??""}function W(){return e.modules.list.find(f=>f.layout==="chat")?.id}let K=M();if(!K.current){let f=e.modules.list.map(b=>b.id);K.current=sl(A(),f,b=>o.saveActiveModule(b))}let D=K.current,ue=M(void 0);ue.current=W();let[z,te]=k(!1),[ve,we]=k(null),[T,O]=k(!1),Q=e.mode==="standalone"||e.mode==="inline",pe=M(Qt(e,Ct(),o.loadPanelOpen(),o.loadPanelSize())),[fe,P]=k(pe.current.panelOpen),[N,me]=k(pe.current.panelOpen),ke=M(N);ke.current=N;let Ce=M(!1),Je=M(void 0);w(()=>{fe&&me(!0)},[fe]);let Ot=M(!1),[_t,Nt]=k(!1),{dismissed:Ie,dismissCallout:Dt}=El({callout:e.launcher.callout,persistence:o}),Ye=e.launcher.callout?.persistent??!0,cn=H(()=>{V.info("calloutDismiss"),n.emit("calloutDismiss",void 0),Dt()},[n,Dt]),[Ae,ut]=k(pe.current.panelSize),Xr=M(!1),[Nl,Io]=k("chat"),[$t,Ht]=k(!0),[Ge,dn]=k(!1),[Dl,Jr]=k(null),[Ao,_n]=k([]),[un,pn]=k(null),[$l,Hl]=k(void 0),[Fl,Bl]=k(void 0),[zl,Ul]=k(()=>o.loadSidebarCollapsed()??!1),[Ro,Wl]=k({}),[J]=k(()=>new to({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:wa({publicKey:e.publicKey,aiAgentDeploymentId:e.aiAgentDeploymentId,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints})),[Ne]=k(()=>new io(m)),[ie]=k(()=>new co(e.sound,e.haptics)),Fe=H(f=>{o.patchUserPrefs(f),J.saveUserPrefs(o.loadUserPrefs()).catch(b=>{V.warn("saveUserPrefs failed",{err:b})})},[o,J]);w(()=>{s.soundMuted!==void 0&&ie.setMuted(s.soundMuted)},[]),w(()=>{t.dataset.theme=d},[t,d,e]),w(()=>{t.dataset.textSize=_},[t,_,e]),w(()=>{ie.update(e.sound,e.haptics)},[ie,e.sound,e.haptics]),w(()=>()=>ie.destroy(),[ie]),w(()=>{let f=!0;return ie.mutedSig.subscribe(b=>{if(f){f=!1;return}Fe({soundMuted:b})})},[ie,Fe]),w(()=>{Xr.current||!e.size.initialSize||(Xr.current=!0,!o.loadPanelSize()&&ut(br(e.mode,e.size,Ct())))},[e.mode,e.size,o]),w(()=>{if(!z||Ot.current)return;Ot.current=!0;let f=Qt(e,Ct(),o.loadPanelOpen(),o.loadPanelSize());P(f.panelOpen),ut(f.panelSize)},[z,e,o]);let Yr=M(!1),Qr=M(!1),fn=M(null);w(()=>{if(!(!z||Yr.current)){if(Yr.current=!0,Qr.current){let f=ue.current;f&&D.switchTab(f);return}D.reset(A())}},[z]);let mn=H(f=>{!f||f.length===0||(m.value=f.map(yr))},[m]),Lo=M(null),gn=H(async f=>{try{let{formSubmissions:b}=await(f?J.bootstrap(f):Lo.current??J.bootstrap()),L=new Map;return b.forEach((R,G)=>L.set(R.formId,G)),b.filter((R,G)=>!R.skipped||L.get(R.formId)===G).map((R,G)=>({key:`wire:${R.formId}:${R.createdAt??G}`,formId:R.formId,outcome:R.skipped?"skipped":"submitted",createdAt:eo(R.createdAt),values:R.values}))}catch(b){return V.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:b}),[]}},[J]),Ft=M(0),Bt=H((f,b)=>{let L=[...f.map(de=>de.createdAt),...b.map(de=>de.createdAt)].filter(de=>de!==void 0),R=(L.length?Math.min(...L):Date.now())-1,G=new Set(f.map(de=>de.id));return[...(Je.current?.messages??[]).filter(de=>!G.has(de.id)).map(de=>{let Vt=yr(de);return Vt.createdAt=R,Vt}),...f]},[]),Mo=H(async f=>{let b=Ft.current,L=()=>b!==Ft.current;E(!0);try{let[R,G]=await Promise.all([J.loadConversation(f),gn()]);if(L())return;let C=(R.messages??[]).map(Sr);B(G);let de=fn.current?[fn.current]:[];C.length||de.length?(m.value=[...Bt(C,G),...de],Ht(R.canContinue??!0),_n(R.suggestions??[])):m.value=Bt([],G)}catch(R){if(L())return;V.warn("loadThread failed; resetting conversationId",{err:R,conversationId:f}),p.value=void 0,o.saveConversationId(void 0)}finally{L()||E(!1)}},[J,gn,m,p,o,Bt]),zt=H(async({newConversation:f})=>{let b=++Ft.current,L=()=>b!==Ft.current,R=p.value,G=f||!R?He():R;G!==R&&(p.value=G,o.saveConversationId(G));let C;try{C=await J.handshake({visitorId:i,conversationId:G,userPrefs:o.loadUserPrefs(),locale:l})}catch(Vt){if(L())return;n.emit("error",Vt),e.onError?.(Vt),f||te(!0);return}if(L())return;C.visitorId&&C.visitorId!==i&&(V.info("visitor rebound",{previous:i,current:C.visitorId,reason:C.rebind?.visitorId}),o.setVisitorId(C.visitorId),a(C.visitorId),n.emit("visitorRebound",{previous:i,current:C.visitorId,reason:C.rebind?.visitorId})),C.conversationId&&C.conversationId!==G&&(V.info("conversation rebound",{previous:G,current:C.conversationId,reason:C.rebind?.conversationId}),n.emit("conversationRebound",{previous:G,current:C.conversationId,reason:C.rebind?.conversationId})),C.agent&&Jr(C.agent),C.welcome?.suggestions&&_n(C.welcome.suggestions),e.mode==="page"&&(C.site&&ya(C.site)?Hl(C.site):C.site&&V.warn("invalid site config, using fallback",{site:C.site}),C.blocks&&Sa(C.blocks)?Bl(C.blocks):C.blocks&&V.warn("invalid blocks config, using fallback",{blocks:C.blocks})),C.userPrefs&&!f&&(o.saveUserPrefs(C.userPrefs),C.userPrefs.locale&&c(C.userPrefs.locale),C.userPrefs.soundMuted!==void 0&&ie.setMuted(C.userPrefs.soundMuted),C.userPrefs.themeMode&&u(C.userPrefs.themeMode),C.userPrefs.textSize&&g(C.userPrefs.textSize)),Je.current=C.welcome,!f&&R&&C.conversationId===R?ke.current?Mo(R):Ce.current=!0:(p.value=C.conversationId,o.saveConversationId(C.conversationId),mn(C.welcome?.messages)),f||(n.emit("handshake",C),te(!0))},[J,i,o,e,n,p,ie,mn,Mo,l]),Ut=JSON.stringify(e.userContext??null),Gl=JSON.stringify(e.pageContext??null),Vl=JSON.stringify(Ro);w(()=>{let f=Object.keys(Ro).length?{...Ro,...e.userContext}:e.userContext;J.setContext(f,Wu(e.pageContext))},[J,Ut,Gl,Vl]);let De=vt(l,e.availableLocales,e.defaultLocale);w(()=>{J.setLocale(De)},[J,De]),w(()=>{De!==l&&c(De)},[De,l]);let Kl=H(async f=>{let b=null;try{for await(let L of f.iter){if(!b){b=no(),fn.current=b,Ne.attach(b),m.value=[...m.value,b],dn(!0),pn(()=>f.cancel),Qr.current=!0;let R=ue.current;R&&D.switchTab(R),V.info("resumed in-flight reply on mount")}Ne.apply(L.chunk),L.chunk.type==="finish"&&L.chunk.canContinue===!1&&Ht(!1)}b&&(b.status="complete",ie.play("messageReceived"),Vr(n,e,"assistant",wr(b)))}catch(L){b&&(b.status="error",b.errorText=it(L,e.strings),ie.play("error")),V.debug("mount resume ended without completing",{err:L})}finally{fn.current=null,b&&(Ne.detach(),dn(!1),pn(null),m.value=[...m.value])}},[Ne,m,ie,n,e,D]),Zr=M(null);w(()=>{let f=p.value;return f&&J.primeIdentity(i,f),zt({newConversation:!1}),()=>{Ft.current++,Zr.current?.cancel()}},[]),w(()=>{if(N){if(Lo.current=J.bootstrap(),(async()=>{try{let f=await Lo.current;we(qt((f??{forms:[]}).forms,De))}catch(f){V.debug("bootstrap failed \u2014 treating as no forms",{err:f})}finally{O(!0)}})(),Ce.current){Ce.current=!1;let f=p.value;f&&Mo(f)}if(p.value){let f=J.resumeStream();Zr.current=f,Kl(f)}}},[N]);let hn=M(null);w(()=>{if(!N)return;if(hn.current===null){hn.current=De;return}if(hn.current===De)return;hn.current=De;let f=!1;return J.bootstrap().then(b=>{f||we(qt((b??{forms:[]}).forms,De))}).catch(b=>V.debug("forms re-localize failed \u2014 keeping current copy",{err:b})),()=>{f=!0}},[N,De,J]);let ei=M(Ut);w(()=>{!z||ei.current===Ut||(ei.current=Ut,zt({newConversation:!1}))},[Ut,z,zt]),w(()=>{Bn(t,Zn(e.mode,Ae,fe))},[t,fe,Ae,e.mode]),w(()=>{if(e.mode!=="modal"||!fe)return;let f=b=>{b.composedPath().some(G=>G instanceof HTMLElement&&G.classList.contains(`${x.cssPrefix}-panel`))||P(!1)};return t.addEventListener("click",f),()=>t.removeEventListener("click",f)},[t,fe,e.mode]),w(()=>{if(e.mode!=="drawer"||!fe)return;let f=b=>{b.key==="Escape"&&P(!1)};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[fe,e.mode]);let vn=H(async(f,b)=>{let L=p.value??He();p.value||(p.value=L,o.saveConversationId(L));let R=Aa({messages:m.value.slice(0,-1).map(Na),conversationId:L,tools:e.features.tools,responseMode:e.responseMode,trigger:b,visitorId:i,userPrefs:o.loadUserPrefs()});dn(!0);let G=J.sendMessage(R);pn(()=>G.cancel);try{for await(let C of G.iter)Ne.apply(C.chunk),C.chunk.type==="finish"&&C.chunk.canContinue===!1&&Ht(!1);f.status="complete",ie.play("messageReceived"),Vr(n,e,"assistant",wr(f))}catch(C){f.status="error",f.errorText=it(C,e.strings),ie.play("error"),n.emit("error",C),e.onError?.(C)}finally{Ne.detach(),dn(!1),pn(null),m.value=[...m.value]}},[J,Ne,m,p,e,n,ie,o,i]),bn=H((f,b,L)=>{if(Ge)return;let R=m.value.at(-1),G=R?.partsSig.value.find(de=>de.kind==="tool"&&de.toolCallId===f);if(!G){V.warn("resolveTool: tool part not found",{toolCallId:f});return}L(G),R&&(R.partsSig.value=[...R.partsSig.value]);let C=no();m.value=[...m.value,C],Ne.attach(C),vn(C,b)},[Ge,m,Ne,vn]),ti=H((f,b)=>{V.info("toolResult",{toolCallId:f}),n.emit("toolResult",{toolCallId:f}),bn(f,ro.toolResult,L=>{L.outputSig.value=b,L.stateSig.value="output"})},[n,bn]),ni=H((f,b,L)=>{V.info("toolDecision",{toolCallId:f,approved:b}),n.emit("toolDecision",{toolCallId:f,approved:b}),bn(f,ro.toolApproval,R=>{let G=R.approvalSig.value?.id??f;R.approvalSig.value={id:G,approved:b,reason:L},R.stateSig.value="output"})},[n,bn]),ql=xe(()=>({humanInLoop:e.features.humanInLoop,onResult:ti,onDecision:ni}),[e.features.humanInLoop,ti,ni]),jl=()=>m.value.reduce((f,b)=>f+(b.role==="user"?1:0),0),pt=e.forms.list.length>0?e.forms:ve??e.forms,ae=nl({forms:pt,persistence:o,userContext:()=>e.userContext,messageCount:jl,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>p.value,onComplete:(f,b,L,R)=>{V.info("formSubmit",{formId:f.id,trigger:b,skipped:R}),n.emit("formSubmit",{formId:f.id,values:L,skipped:R}),B(C=>[...C.filter(de=>!(de.formId===f.id&&de.outcome==="skipped")),{key:`local:${f.id}:${Date.now()}`,formId:f.id,outcome:R?"skipped":"submitted",createdAt:Date.now(),...R?{}:{values:L}}]);let G=p.value??He();p.value||(p.value=G,o.saveConversationId(G),J.primeIdentity(void 0,G)),!R&&f.mirrorToContext&&Wl(C=>({...C,...L})),J.submitForm({formId:f.id,conversationId:G,trigger:b,values:L,skipped:R})}}),Xl=re(()=>ae.activeForm.value);w(()=>{ae.refresh()},[pt,ae]);let oi=e.pageContext?.area?String(e.pageContext.area):void 0,Jl=re(()=>m.value.length);w(()=>{z&&T&&ae.fire("pre-chat")},[z,T,ae]),w(()=>{T&&!$t&&ae.fire("conversation-closed")},[T,$t,ae]),w(()=>{z&&T&&oi&&ae.fire("page-area")},[z,T,oi,ae]);let Oo=xe(()=>{let f=pt.list.flatMap(b=>b.triggers).filter(b=>b.kind==="idle").map(b=>Number(b.param));return f.length?Math.min(...f)*1e3:0},[pt]);w(()=>{if(!Oo||!fe)return;let f=setTimeout(()=>ae.fire("idle"),Oo);return()=>clearTimeout(f)},[Oo,fe,ae,Jl.value]);let ri=H(async(f,b)=>{if(V.info("send",{textLen:f.length,attachments:b.length,streaming:Ge}),Ge)return;n.emit("send",{text:f,attachmentCount:b.length}),Ao.length>0&&_n([]);let L=await Vu(J,b,C=>{V.warn("upload failed",{err:C}),n.emit("error",C),e.onError?.(C)});ie.unlock(),ie.play("messageSent");let R=Oa(f,L),G=no();m.value=[...m.value,R,G],Ne.attach(G),Vr(n,e,"user",f),await vn(G,ro.submitMessage),ae.fire("after-messages")},[Ge,J,n,e,Ao.length,m,Ne,vn,ae]),Yl=H(()=>{V.info("stop"),n.emit("stop",void 0),un?.()},[un,n]),Ql=H(()=>{ie.toggleMuted();let f=ie.mutedSig.value;V.info("soundToggle",{muted:f}),n.emit("soundToggle",{muted:f})},[ie,n]),Wt=H(()=>{if(Ps(e.mode,Ae)==="exit-fullscreen"){V.info("close \u2192 exit-fullscreen",{mode:e.mode}),ut("normal"),n.emit("fullscreen",!1);return}V.info("close \u2192 panel closed",{mode:e.mode}),ae.fire("panel-close"),P(!1),o.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,o,Ae,ae]),ft=H(()=>{e.modules.list.some(f=>f.layout==="chat")&&J.listConversations({limit:50}).then(f=>{h.value=f.conversations.reduce((b,L)=>b+(L.unreadCount??0),0)}).catch(f=>V.debug("refreshUnread failed (non-fatal)",{err:f}))},[J,e.modules,h]),ii=M(!1);w(()=>{!N||!z||ii.current||(ii.current=!0,ft())},[N,z,ft]);let No=H(()=>{V.info("open",{mode:e.mode}),ie.unlock(),Nt(!0),P(!0),o.savePanelOpen(!0),!Ie&&!Ye&&cn(),setTimeout(()=>Nt(!1),Gu),ft(),n.emit("open",void 0),e.onOpen?.()},[n,e,ie,o,Ie,Ye,cn,ft]),Do=H(()=>{if(!m.value.some(b=>b.role==="user")&&$t&&p.value){V.info("clear \u2192 reusing empty conversation",{conversationId:p.value}),m.value.length===0&&mn(Je.current?.messages);return}V.info("clear \u2192 new conversation",{wasStreaming:Ge}),n.emit("clear",void 0),Ge&&un?.(),m.value=[],p.value=void 0,o.clearConversation(),Ht(!0),B([]),zt({newConversation:!0})},[Ge,un,m,p,o,zt,n,$t,mn]),$o=H(()=>{Do(),Io("chat");let f=e.modules.list.find(b=>b.layout==="chat")?.id;f&&D.switchTab(f)},[Do,D,e]),Ho=H(()=>{let f=Ae==="expanded"?"normal":"expanded";V.info("expand",{from:Ae,expanded:f==="expanded"}),ut(f),o.savePanelSize(f),n.emit("expand",f==="expanded")},[n,Ae,o]),Fo=H(()=>{let f=Ae==="fullscreen"?"normal":"fullscreen";V.info("fullscreen",{from:Ae,fullscreen:f==="fullscreen"}),ut(f),o.savePanelSize(f),n.emit("fullscreen",f==="fullscreen")},[n,Ae,o]),Bo=H(()=>{if(!e.popOutUrl)return;let f=new URL(e.popOutUrl);p.value&&f.searchParams.set("conversation",p.value),e.widgetId!=="default"&&f.searchParams.set("widgetId",e.widgetId),V.info("popOut",{url:f.toString()}),window.open(f.toString(),"_blank","noopener,noreferrer"),n.emit("popOut",void 0)},[n,p,e.popOutUrl,e.widgetId]),Zl=H(()=>{Io(f=>{let b=f==="history"?"chat":"history";return V.info("toggleHistory",{view:b}),n.emit("toggleHistory",{view:b}),b})},[n]),ec=H(f=>{V.info("localeChange",{locale:f}),c(f),Fe({locale:f}),n.emit("localeChange",f)},[Fe,n]),tc=H(f=>{V.info("themeChange",{mode:f}),u(f),t.dataset.theme=f,Fe({themeMode:f}),n.emit("themeChange",f)},[t,Fe,n]),nc=H(f=>{V.info("textSizeChange",{size:f}),g(f),t.dataset.textSize=f,Fe({textSize:f}),n.emit("textSizeChange",f)},[t,Fe,n]),oc=H(()=>{Ul(f=>{let b=!f;return V.info("sidebarToggle",{collapsed:b}),o.saveSidebarCollapsed(b),n.emit("sidebarToggle",{collapsed:b}),b})},[o,n]),rc=H(f=>{V.info("resize",f),Fe({widgetSize:f}),n.emit("resize",f)},[Fe,n]),zo=H(async f=>{V.info("selectConversation",{conversationId:f}),n.emit("selectConversation",{conversationId:f});try{let[b,L]=await Promise.all([J.loadConversation(f),gn(f)]),R=b.messages.map(Sr);m.value=Bt(R,L),B(L),p.value=b.conversationId,o.saveConversationId(b.conversationId),b.agent&&Jr(b.agent),Ht(b.canContinue),_n(b.suggestions??[]),Io("chat"),await J.markRead(f),ft()}catch(b){n.emit("error",b),e.onError?.(b)}},[J,m,p,n,e,o,ft,gn,Bt]),xn=M(null),ai=H(f=>{typeof f=="string"&&(T?ae.fire("manual",f):xn.current=f)},[T,ae]);w(()=>{!T||!xn.current||(ae.fire("manual",xn.current),xn.current=null)},[T,ae]),w(()=>zi(t,{open:No,close:Wt,expand:Ho,fullscreen:Fo,popout:Bo,openForm:ai}),[t,No,Wt,Ho,Fo,Bo,ai]);let Re=xe(()=>cr(e,l,d,_),[e,l,d,_]),ic=xe(()=>S.map(f=>{let b=pt.list.find(L=>L.id===f.formId);return{...f,title:b?.title,form:b}}),[S,pt]),si={options:Re,transport:J,feedback:ie,bus:n,view:Nl,canSend:$t,isStreaming:Ge,loadingMessages:v,messagesSig:m,agent:Dl,suggestions:Ao,initialWidgetSize:s.widgetSize??null,visitorId:i,onClose:Wt,onClear:Do,onExpand:Ho,onFullscreen:Fo,onPopOut:Bo,onSoundToggle:Ql,onToggleHistory:Zl,onSelectHistoryConversation:zo,onNewConversation:$o,onLocaleChange:ec,onThemeChange:tc,onTextSizeChange:nc,onWidgetSizeChange:rc,onSend:ri,onStop:Yl,onSuggestion:f=>{let b=f.text??f.label;V.info("suggestion",{text:b}),n.emit("suggestion",{text:b}),ri(b,[])},activeForm:Xl.value?.form??null,formMarkers:ic,onFormSubmit:ae.complete,onFormSkip:ae.skip,onFormFill:f=>ae.fire("manual",f),tool:ql},ac=f=>{zo(f);let b=W();b&&D.switchTab(b)};if(!z)return null;let Gt=Re.modules.list,Uo=f=>{let b=nn("close",Re.mode,f);return Gt.length===0?r(Tl,{strings:Re.strings,onClose:b?Wt:void 0}):Gt.length===1&&Gt[0]?.layout==="chat"?r(tl,{...si,panelSize:f}):r(Cl,{panelProps:{...si,panelSize:f,onClose:b?Wt:void 0},enabledModules:Gt,nav:D,unreadCount:h.value,onSelectConversation:ac,onStartNewConversation:$o,onSetPanelSize:ut})};if(e.mode==="page"){let f=L=>{zo(L.conversationId)},b=Gt.some(L=>L.layout==="chat");return r("div",{class:`${Gr}-anchor`,children:r(il,{site:$l,blocks:Fl,transport:J,strings:Re.strings,visitorId:i,showConversations:b,onSelectConversation:f,onNewConversation:$o,sidebarCollapsed:zl,onToggleSidebarCollapsed:oc,children:Uo("fullscreen")})})}if(Q){let f=e.mode==="standalone"?"fullscreen":Ae;return r("div",{class:`${Gr}-anchor`,children:Uo(f)})}let li=e.mode==="drawer",ci=!(e.mode==="modal")&&!e.launcher.hidden&&(!fe||_t),di=ci&&!_t&&!Ie&&!li?Re.launcher.callout:null;return r("div",{class:`${Gr}-anchor`,"data-launcher-size":Re.launcher.size,children:[fe?Uo(Ae):null,ci?r(vs,{onToggle:No,launcher:Re.launcher,strings:Re.strings,leaving:_t,edgeTab:li}):null,di?r(bs,{callout:di,launcherPosition:Re.position,strings:Re.strings,closeLabel:Re.strings.close,onDismiss:cn}):null]})}function Wu(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var Gu=120;async function Vu(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 Vr(e,t,n,o){let i={role:n,text:o};e.emit("message",i),t.onMessage?.(i)}var Ku=U.scope("error-boundary"),Eo=class extends Ze{constructor(){super(...arguments);j(this,"state",{crashed:!1})}componentDidCatch(n,o){Ku.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 Al={open:()=>{},close:()=>{},expand:e=>({on:e}),fullscreen:e=>({on:e}),popOut:()=>{},send:e=>({attachments:e.attachmentCount}),message:e=>({role:e.role}),stop:()=>{},clear:()=>{},suggestion:()=>{},toggleHistory:e=>({view:e.view}),handshake:()=>{},formSubmit:e=>({formId:e.formId,skipped:e.skipped}),toolResult:()=>{},toolDecision:e=>({approved:e.approved}),attach:e=>({count:e.count,bytes:e.totalBytes}),voiceStart:()=>{},voiceStop:e=>({ms:e.durationMs}),voiceCancel:()=>{},localeChange:e=>({locale:e}),themeChange:e=>({theme:e}),textSizeChange:e=>({size:e}),soundToggle:e=>({muted:e.muted}),sidebarToggle:e=>({collapsed:e.collapsed}),calloutDismiss:()=>{},error:()=>{}};function qu(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function ju(){return location.origin+location.pathname}function Xu(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function Rl(e,t){let n=Math.random(),o=0,i=0,a=new Set,s=(c,d)=>{let{tracking:u,publicKey:_,aiAgentDeploymentId:g,mode:p,themeMode:m}=t.getOptions();if(!u.enabled||qu()||n>=u.sampleRate)return;let h=performance.now();if(h-o>6e4&&(o=h,i=0),++i>60)return;let v=new URLSearchParams;v.set("v","1"),v.set("e",c),u.token&&v.set("tk",u.token),_&&v.set("pk",_),g&&v.set("dep",g),v.set("vid",t.getVisitorId());let E=t.getConversationId();E&&v.set("cid",E),v.set("url",ju());let S=Xu();S&&v.set("ref",S),v.set("sw",String(screen.width)),v.set("sh",String(screen.height)),v.set("vw",String(innerWidth)),v.set("vh",String(innerHeight)),v.set("dpr",String(devicePixelRatio)),v.set("lang",navigator.language);try{v.set("tz",Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{}if(v.set("m",p),v.set("th",m),d)for(let[K,D]of Object.entries(d))D!==void 0&&v.set(K,String(D));v.set("ts",String(Date.now()));let B=`${u.endpoint}?${v}`;if(B.length>2e3)return;let A=new Image(1,1);a.add(A);let W=()=>a.delete(A);A.addEventListener("load",W,{once:!0}),A.addEventListener("error",W,{once:!0}),A.src=B},l=Object.keys(Al).map(c=>e.on(c,d=>s(c,Al[c]?.(d))));return()=>{for(let c of l)c();a.clear()}}function Ll(e){let{bus:t,host:n,appRoot:o,persistence:i,reportError:a}=e,s=e.initialRaw,l,c=ht(s),d=!0,u=()=>{c=ht(l?dr(s,l):s)},_=()=>{Ji(n,jt(c.mode));let m=i.loadUserPrefs().themeMode;Yi(n,m?{...c,themeMode:m}:c),d&&(Bn(n,Kr(c)),d=!1)},g=()=>{_(),An(In(Eo,{onError:a},In(Il,{bus:t,hostElement:n,options:c})),o)};t.on("handshake",m=>{m.config&&(l=m.config,u(),g())});let p=Rl(t,{getOptions:()=>c,getVisitorId:()=>i.getVisitorId(),getConversationId:()=>i.loadConversationId()});return{getOptions:()=>c,getUserOptions:()=>s,render:g,setUserOptions:m=>{s=m,u(),g()},patchUserOptions:m=>{s={...s,...m},u(),g()},destroy:()=>p()}}function Kr(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=yt(e.widgetId,e.storage),{panelOpen:n,panelSize:o}=Qt(e,Ct(),t.loadPanelOpen(),t.loadPanelSize());return Zn(e.mode,o,n)}var Ju=U.scope("hooks"),jr="*",qr=new Set;function Ml(e,t,n){let o={widgetId:e,event:t,listener:n};return qr.add(o),()=>{qr.delete(o)}}function Yu(e,t,n){let o=[...qr];for(let i of o)if(Qu(i.widgetId,e.widgetId)&&!(i.event!==jr&&i.event!==t))try{i.listener(e,t,n)}catch(a){Ju.warn("hook listener threw",{event:t,error:a})}}function Ol(e,t){let n=[];for(let o of Zu)n.push(t.on(o,i=>{Yu(e,o,i)}));return()=>{for(let o of n)o()}}function Qu(e,t){return e===jr||e===t}var Zu=["open","close","expand","fullscreen","popOut","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","visitorRebound","conversationRebound"];var Xe=new Map;function ep(e){e.debug!==void 0&&Nn(e.debug);let t=U.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=ht(e),o=n.widgetId,i=Xe.get(o);i&&(t.debug("destroy existing instance at slot",{widgetId:o}),i.destroy());let a=Kr(n),s=n.iframe?ea({position:jt(n.mode)},n.position,a,n.mode,e.target??null):Fn({position:jt(n.mode),target:e.target??null});s.hostElement.dataset.widgetId=o;let l=new Un,c=yt(o,n.storage),d=h=>{l.emit("error",h),u.getOptions().onError?.(h)},u=Ll({bus:l,host:s.hostElement,appRoot:s.appRoot,persistence:c,initialRaw:e,reportError:d});u.render();let _=s.hostElement,g=null,p=h=>{h.debug!==void 0&&Nn(h.debug),u.patchUserOptions(h)},m={widgetId:o,open:()=>xt(_,"open"),close:()=>xt(_,"close"),expand:()=>xt(_,"expand"),popOut:()=>xt(_,"popout"),openForm:h=>xt(_,"openForm",h),on:(h,v)=>l.on(h,v),update:h=>{t.debug("update",{patch:h}),p(h)},setUserContext:h=>{t.debug("setUserContext",{keys:Object.keys(h)}),p({userContext:{...u.getUserOptions().userContext,...h}})},clearUserContext:()=>{t.debug("clearUserContext"),p({userContext:void 0})},setPageContext:h=>{t.debug("setPageContext",{keys:Object.keys(h)}),p({pageContext:{...u.getUserOptions().pageContext,...h}})},clearPageContext:()=>{t.debug("clearPageContext"),p({pageContext:void 0})},setDebug:h=>{Nn(h),t.info("debug level set",{level:or()})},debugLevel:()=>or(),onLog:h=>Ri(h),destroy:()=>{t.info("destroy",{widgetId:o}),g?.(),u.destroy(),l.clear(),An(null,s.appRoot),s.destroy(),Xe.get(o)===m&&Xe.delete(o)}};return g=Ol(m,l),Xe.set(o,m),m}function SP(e){let t=e.widgetId??"default",n=Xe.get(t);return n?(n.update(e),n):ep(e)}function wP(e){if(e!==void 0){Xe.get(e)?.destroy();return}let t=[...Xe.values()];for(let n of t)n.destroy()}function kP(e="default"){return Xe.get(e)??null}function CP(){return[...Xe.values()]}function TP(e,t,n){return Ml(e,t,n)}var EP="0.1.0",IP=x;export{jr as HOOK_WILDCARD,IP as brand,wP as destroy,CP as getAllInstances,kP as getInstance,TP as hook,SP as init,ep as mount,Kr as resolveInitialHostMode,EP as version};
39
+ `){Y(e),Z(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(q_(n.charCodeAt(0)))break;Y(e),Z(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){Y(e),Z(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){Y(e),Z(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}Y(e)}function Hr(e){return{add_token:j_,end_token:X_,add_text:J_,set_attr:Y_,data:{nodes:[e,,,,,],index:0}}}function j_(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 X_(e){e.index-=1}function J_(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function Y_(e,t,n){e.nodes[e.index].setAttribute(U_(t),n)}function yo({textSig:e,doneSig:t}){let n=M(null);return w(()=>{let o=n.current;if(!o)return;o.classList.add(`${x.cssPrefix}-md`);let i=Hr(o),a=$r(i),s=0,l=qe(()=>{let u=e.value,_=t.value;u.length<s&&(o.replaceChildren(),i=Hr(o),a=$r(i),s=0);let m=u.slice(s);m&&be(a,m),s=u.length,_&&Hs(a)}),c=new MutationObserver(u=>{for(let _ of u)for(let m of _.addedNodes){if(!(m instanceof HTMLElement))continue;let h=m.matches?.("a")?[m]:[...m.querySelectorAll?.("a")??[]];for(let g of h)Fs(g)}});c.observe(o,{childList:!0,subtree:!0});for(let u of o.querySelectorAll("a"))Fs(u);let d=u=>{let _=u.target?.closest?.("a");if(!_||!(_ instanceof HTMLAnchorElement))return;let m=_.getAttribute("href")??"";!m||m.startsWith("#")||(u.preventDefault(),window.open(m,"_blank","noopener,noreferrer"))};return o.addEventListener("click",d),()=>{l(),c.disconnect(),o.removeEventListener("click",d)}},[e,t]),r("div",{ref:n})}function Bs({text:e}){let t=xe(()=>F(e),[e]),n=xe(()=>F(!0),[]);return r(yo,{textSig:t,doneSig:n})}function Fs(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(" ")}var ye=x.cssPrefix;function zs(e){return(e.startsWith("tool:")?e.slice(5):e).replace(/[-_]+/g," ")}function Us({part:e,strings:t,active:n,onDecision:o}){let i=re(()=>e.approvalSig.value),a=re(()=>e.inputSig.value),s=rt("");if(i.value?.approved!==void 0){let d=i.value;return r("div",{class:`${ye}-tool-approval ${ye}-tool-decided`,"data-testid":y.toolDecision,children:[r("span",{class:`${ye}-tool-decided-label`,"data-approved":d?.approved?"true":"false",children:d?.approved?t.approved:t.rejected}),r("strong",{class:`${ye}-tool-title`,children:zs(e.toolName)}),d?.reason?r("span",{class:`${ye}-tool-decided-value`,children:d.reason}):null]})}let c=Z_(a.value);return r("div",{class:`${ye}-tool-approval`,"data-testid":y.toolApproval,children:[r("div",{class:`${ye}-tool-head`,children:[r("span",{class:`${ye}-tool-badge`,children:t.approvalRequired}),r("strong",{class:`${ye}-tool-title`,children:zs(e.toolName)})]}),c?r("pre",{class:`${ye}-tool-args`,children:c}):null,n?r(ne,{children:[r("input",{class:`${ye}-field-input`,value:s.value,placeholder:t.approvalReason,onInput:d=>{s.value=d.target.value}}),r("div",{class:`${ye}-form-actions`,children:[r("button",{type:"button",class:`${ye}-tool-reject`,onClick:()=>o(e.toolCallId,!1,s.value.trim()||void 0),"data-testid":y.toolReject,children:t.reject}),r("button",{type:"button",class:`${ye}-tool-approve`,onClick:()=>o(e.toolCallId,!0,s.value.trim()||void 0),"data-testid":y.toolApprove,children:t.approve})]})]}):r("p",{class:`${ye}-tool-stale-note`,children:t.stepNoLongerActive})]})}function Z_(e){if(e==null)return"";try{let t=typeof e=="string"?e:JSON.stringify(e,null,2);return t.length>600?`${t.slice(0,600)}\u2026`:t}catch{return""}}function Gs(e){let t=e&&typeof e=="object"?e:{},n=t.responseType;return{title:rn(t.title),question:rn(t.question)??"Please provide the missing information.",description:rn(t.description),placeholder:rn(t.placeholder),responseType:n==="single-choice"||n==="multi-choice"||n==="confirmation"||n==="free-text"?n:"free-text",choices:Array.isArray(t.choices)?t.choices:void 0,allowOther:typeof t.allowOther=="boolean"?t.allowOther:void 0,required:typeof t.required=="boolean"?t.required:!0,defaultValues:Array.isArray(t.defaultValues)?t.defaultValues.filter(o=>typeof o=="string"):void 0,minSelections:Ws(t.minSelections),maxSelections:Ws(t.maxSelections),validationHint:rn(t.validationHint)}}function Vs(e){if(e.responseType==="confirmation")return[];let t=(e.choices??[]).map(eu).filter(i=>i!==null),n="textarea";e.responseType==="single-choice"&&t.length>0?n="radio":e.responseType==="multi-choice"&&(n="multiselect");let o=n==="multiselect"?e.defaultValues?.join(", "):e.defaultValues?.[0];return[{name:"answer",label:e.question,type:n,placeholder:e.placeholder,required:e.required??!0,defaultValue:o,options:t.length>0?t:void 0,allowOther:e.allowOther,validationHint:e.validationHint,validation:n==="multiselect"?{minSelections:e.minSelections,maxSelections:e.maxSelections}:void 0}]}function eu(e){return typeof e=="string"?e?{value:e,label:e}:null:e&&typeof e.value=="string"&&e.value?{value:e.value,label:e.label??e.value,description:e.description}:null}function rn(e){return typeof e=="string"&&e.trim()?e.trim():void 0}function Ws(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}var Pe=x.cssPrefix;function qs({part:e,strings:t,active:n,onSubmit:o,onDecision:i}){let a=re(()=>e.stateSig.value),s=re(()=>e.approvalSig.value),l=re(()=>Gs(e.inputSig.value)),c=a.value==="output"||a.value==="error"||s.value?.approved!==void 0,d=s.value!==void 0,u=(h,g)=>{d?i(e.toolCallId,g,h):l.value.responseType==="confirmation"?o(e.toolCallId,{confirmed:g}):o(e.toolCallId,g?{answer:h}:{})};if(c)return r(tu,{part:e,strings:t});if(!n)return r("div",{class:`${Pe}-tool-ask-input ${Pe}-tool-stale`,"data-testid":y.toolAskInput,children:[r(Ks,{strings:t,title:l.value.title??l.value.question}),r("p",{class:`${Pe}-tool-stale-note`,children:t.stepNoLongerActive})]});let _=l.value,m=_.responseType==="confirmation";return r("div",{class:`${Pe}-tool-ask-input`,"data-testid":y.toolAskInput,children:[r(Ks,{strings:t,title:_.title}),_.description?r("p",{class:`${Pe}-tool-desc`,children:_.description}):null,m?r("p",{class:`${Pe}-tool-question`,children:_.question}):null,m?r("div",{class:`${Pe}-form-actions`,children:[r("button",{type:"button",class:`${Pe}-form-skip`,onClick:()=>u(void 0,!1),"data-testid":y.toolInputSkip,children:t.reject}),r("button",{type:"button",class:`${Pe}-form-submit`,onClick:()=>u(void 0,!0),"data-testid":y.toolInputSubmit,children:t.approve})]}):r(xo,{fields:Vs(_),strings:t,submitLabel:t.inputSubmit,onSubmit:h=>u(h.answer??Object.values(h).join(", "),!0),skipLabel:_.required===!1?t.inputSkip:void 0,onSkip:_.required===!1?()=>u(void 0,!1):void 0,submitTestId:y.toolInputSubmit,skipTestId:y.toolInputSkip})]})}function Ks({strings:e,title:t}){return r("div",{class:`${Pe}-tool-head`,children:[r("span",{class:`${Pe}-tool-badge`,children:e.inputRequired}),t?r("strong",{class:`${Pe}-tool-title`,children:t}):null]})}function tu({part:e,strings:t}){let n=re(()=>e.outputSig.value),o=re(()=>e.approvalSig.value),i=o.value?.approved!==void 0?o.value.reason??"":nu(n.value),a=o.value?.approved===!1;return r("div",{class:`${Pe}-tool-ask-input ${Pe}-tool-decided`,"data-testid":y.toolDecision,children:[r("span",{class:`${Pe}-tool-decided-label`,children:a?t.inputSkip:t.inputSubmitted}),r("span",{class:`${Pe}-tool-decided-value`,children:a?"":i||t.inputSubmitted})]})}function nu(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"){let t=e;return"confirmed"in t?t.confirmed?"Yes":"No":Object.values(t).filter(n=>typeof n=="string"||typeof n=="number").join(", ")}return String(e)}function js({part:e,strings:t}){let n=x.cssPrefix;return r("span",{class:`${n}-tool-chip`,role:"status",children:[r("span",{children:[t.usedTool,":"]}),r("strong",{children:e.toolName})]})}var Ee=x.cssPrefix;function Xs({message:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:i,interactive:a=!1,tool:s}){let c=re(()=>e.partsSig.value).value,d=re(()=>e.partsSig.value.some(v=>v.kind==="text"&&v.textSig.value.length>0)),u=re(()=>o&&e.partsSig.value.some(v=>v.kind==="reasoning")),_=e.role==="assistant"&&e.status==="streaming",m=n==="buffered"&&_,h=_&&!d.value,g=_&&!m&&!(u.value&&h),p=ou(e.createdAt);return r("div",{class:`${Ee}-bubble-row`,"data-role":e.role,"data-testid":he(y.messageBubble,e.id),children:r("div",{class:`${Ee}-bubble-col`,children:[r("div",{class:`${Ee}-bubble`,children:[m?r(cu,{label:t.loading}):c.map(v=>r(ru,{part:v,active:h,strings:t,showReasoning:o,showToolCalls:i,interactive:a,tool:s},su(v))),g&&r(lu,{}),e.status==="error"&&e.errorText?r("div",{class:`${Ee}-error`,role:"alert",children:r("span",{children:e.errorText})}):null]}),p?r("time",{class:`${Ee}-bubble-time`,dateTime:p.iso,title:p.full,children:p.short}):null]})})}function ou(e){if(typeof e!="number"||!Number.isFinite(e))return null;try{let t=new Date(e);return{short:t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),full:t.toLocaleString(void 0,{dateStyle:"full",timeStyle:"short"}),iso:t.toISOString()}}catch{return null}}function ru({part:e,active:t,strings:n,showReasoning:o,showToolCalls:i,interactive:a,tool:s}){switch(e.kind){case"text":return r(yo,{textSig:e.textSig,doneSig:e.doneSig});case"reasoning":return o?r(au,{part:e,active:t,strings:n}):null;case"tool":return r(iu,{part:e,strings:n,showToolCalls:i,interactive:a,tool:s});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 iu({part:e,strings:t,showToolCalls:n,interactive:o,tool:i}){let a=re(()=>e.stateSig.value),s=re(()=>e.approvalSig.value!==void 0);if(i?.humanInLoop){if(oo(e.toolName)||a.value==="awaiting-input")return r(qs,{part:e,strings:t,active:o,onSubmit:i.onResult,onDecision:i.onDecision});if(s.value||a.value==="awaiting-approval")return r(Us,{part:e,strings:t,active:o,onDecision:i.onDecision})}return n?r(js,{part:e,strings:t}):null}function au({part:e,active:t,strings:n}){return r("details",{class:`${Ee}-reasoning`,open:t,"data-active":t?"true":void 0,children:[r("summary",{class:`${Ee}-reasoning-summary`,children:r("span",{class:`${Ee}-reasoning-label`,children:t?n.thinking:n.thoughts})}),r("div",{class:`${Ee}-reasoning-body`,children:r(yo,{textSig:e.textSig,doneSig:e.doneSig})})]})}function su(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 lu(){return r("span",{class:`${Ee}-typing`,"aria-hidden":"true",children:[r("span",{}),r("span",{}),r("span",{})]})}function cu({label:e}){return r("span",{class:`${Ee}-loading`,role:"status",children:[r("span",{class:`${Ee}-loading-spinner`,"aria-hidden":"true"}),r("span",{class:`${Ee}-loading-label`,children:e})]})}var Lt=x.cssPrefix,Fr=120,du=350,_u=1200;function Js({messagesSig:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:i,loading:a,idle:s,tool:l,form:c,formMarkers:d,onFillForm:u}){let _=M(null),m=re(()=>e.value),[h,g]=k(!1),[p,v]=k(!1),E=M(!1),S=M(!1),B=M(!1),A=M(0),W=()=>B.current||performance.now()-A.current<du,K=M(0),D=P=>{K.current=performance.now(),P.scrollTop=P.scrollHeight},ue=m.value[0]?.id;fr(()=>{let P=_.current;if(!P||m.value.length===0||(E.current=!0,!m.value.some(Je=>Je.role==="user")))return;let N=()=>D(P);N();let me=new ResizeObserver(N);me.observe(P);let ke=new MutationObserver(N);ke.observe(P,{childList:!0,subtree:!0,characterData:!0});let Ce=setTimeout(()=>{me.disconnect(),ke.disconnect()},300);return()=>{me.disconnect(),ke.disconnect(),clearTimeout(Ce)}},[ue]);let z=M(0);w(()=>{let P=_.current,N=m.value,me=z.current;if(z.current=N.length,!P||!E.current)return;if(N.slice(me).some(Ce=>Ce.role==="user")){S.current=!1,D(P);return}if(S.current||W())return;P.scrollHeight-P.scrollTop-P.clientHeight<Fr&&D(P)},[m.value.length]),w(()=>{let P=_.current;if(!P)return;let N=m.value.at(-1);if(!N)return;let me=()=>{if(S.current||W())return;P.scrollHeight-P.scrollTop-P.clientHeight<Fr*2&&D(P)};if(N.status!=="streaming"){let Ce=requestAnimationFrame(me);return()=>cancelAnimationFrame(Ce)}me();let ke=new MutationObserver(me);return ke.observe(P,{childList:!0,subtree:!0,characterData:!0}),()=>ke.disconnect()},[m.value]);let te=c?.form.id;fr(()=>{let P=_.current;!P||!te||S.current||m.value.some(N=>N.role==="user")&&D(P)},[te]),w(()=>{let P=_.current;if(!P)return;let N=()=>g(P.scrollHeight-P.scrollTop-P.clientHeight>Fr*2),me,ke=()=>{N(),performance.now()-K.current>150&&(S.current=P.scrollHeight-P.scrollTop-P.clientHeight>8),v(!0),clearTimeout(me),me=setTimeout(()=>v(!1),_u)},Ce=()=>{S.current=!0},Je=Ye=>{Ye.deltaY<0&&Ce()},Ot=0,_t=Ye=>{Ot=Ye.touches[0]?.clientY??0,B.current=!0},Nt=Ye=>{(Ye.touches[0]?.clientY??0)>Ot+4&&Ce()},Ie=()=>{B.current=!1,A.current=performance.now()},Dt=()=>{B.current=!0};return P.addEventListener("scroll",ke,{passive:!0}),P.addEventListener("wheel",Je,{passive:!0}),P.addEventListener("touchstart",_t,{passive:!0}),P.addEventListener("touchmove",Nt,{passive:!0}),P.addEventListener("touchend",Ie,{passive:!0}),P.addEventListener("touchcancel",Ie,{passive:!0}),P.addEventListener("pointerdown",Dt,{passive:!0}),window.addEventListener("pointerup",Ie,{passive:!0}),window.addEventListener("pointercancel",Ie,{passive:!0}),N(),()=>{P.removeEventListener("scroll",ke),P.removeEventListener("wheel",Je),P.removeEventListener("touchstart",_t),P.removeEventListener("touchmove",Nt),P.removeEventListener("touchend",Ie),P.removeEventListener("touchcancel",Ie),P.removeEventListener("pointerdown",Dt),window.removeEventListener("pointerup",Ie),window.removeEventListener("pointercancel",Ie),clearTimeout(me)}},[]);let ve=()=>{let P=_.current;P&&(S.current=!1,D(P))},we=[],T="",O=m.value.at(-1)?.id,Q=[...d??[]].toSorted((P,N)=>(P.createdAt??1/0)-(N.createdAt??1/0)),pe=P=>r(Ls,{marker:P,strings:t,onFill:!c&&u?()=>u(P.formId):void 0},P.key),fe=P=>{for(let N=Q[0];N?.createdAt!==void 0&&!(P!==void 0&&N.createdAt>P);N=Q[0])Q.shift(),we.push(pe(N))};for(let P of m.value){fe(P.createdAt);let N=uu(P.createdAt);N&&N!==T&&(we.push(r("div",{class:`${Lt}-date-divider`,children:r("span",{class:`${Lt}-date-pill`,title:pu(P.createdAt),children:fu(P.createdAt,t)})},`day:${N}`)),T=N),we.push(r(Xs,{message:P,strings:t,responseMode:n,showReasoning:o,showToolCalls:i,interactive:!!s&&P.id===O,tool:l},P.id))}for(let P of Q)we.push(pe(P));return r("div",{class:`${Lt}-list-wrap`,children:[r("div",{ref:_,class:`${Lt}-list`,role:"log","aria-live":"polite","aria-relevant":"additions text","data-scrolling":p?"true":void 0,children:[a&&m.value.length===0?r("div",{class:`${Lt}-list-loading`,role:"status",children:t.conversationLoading}):null,we,c?r(Rs,{form:c.form,strings:t,onSubmit:c.onSubmit,onSkip:c.onSkip}):null]}),h?r("button",{type:"button",class:`${Lt}-jump`,onClick:ve,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":y.scrollToBottom,children:r(cs,{})}):null]})}function uu(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function pu(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function fu(e,t){let n=new Date(e),o=a=>new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),i=Math.round((o(new Date)-o(n))/864e5);return i<=0?t.dateToday:i===1?t.dateYesterday:i<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}var mu=["today","yesterday","lastWeek","older"];function gu(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let o=Math.floor((Ys(e)-Ys(n))/(1440*60*1e3));return o<=0?"today":o===1?"yesterday":o<7?"lastWeek":"older"}function Qs(e,t){let n=new Map;for(let o of t){let i=gu(e,o.lastMessageAt),a=n.get(i);a?a.push(o):n.set(i,[o])}return mu.filter(o=>n.has(o)).map(o=>({bucket:o,conversations:n.get(o)}))}function Ys(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var hu=U.scope("history"),vu={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function bu(e,t,n){let o=Date.parse(e);return Number.isFinite(o)?new Date(o).toDateString()===new Date(t).toDateString()?new Intl.DateTimeFormat(n,{hour:"numeric",minute:"2-digit"}).format(o):t-o<10080*60*1e3?new Intl.DateTimeFormat(n,{weekday:"short"}).format(o):new Intl.DateTimeFormat(n,{month:"short",day:"numeric"}).format(o):""}function So({transport:e,strings:t,visitorId:n,onSelect:o,onNewConversation:i}){let a=x.cssPrefix,[s,l]=k("loading"),[c,d]=k([]);w(()=>{let g=!1;return e.listConversations({visitorId:n}).then(p=>{g||(d(p.conversations??[]),l("loaded"))}).catch(p=>{g||(hu.warn("listConversations failed",{err:p}),l("error"))}),()=>{g=!0}},[e,n]);let u=i?r("div",{class:`${a}-history-footer`,children:r("button",{type:"button",class:`${a}-history-new`,onClick:i,"data-testid":y.sidebarNewConversation,children:[r(Ua,{}),t.newConversation]})}):null;if(s==="loading")return r(ne,{children:[r("div",{class:`${a}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:r("div",{class:`${a}-history-card`,children:[0,1,2,3].map(g=>r("div",{class:`${a}-history-skeleton-item`,"aria-hidden":"true",children:[r("span",{class:`${a}-history-skeleton-avatar`}),r("span",{class:`${a}-history-skeleton-body`,children:[r("span",{class:`${a}-history-skeleton-line ${a}-skeleton-title`}),r("span",{class:`${a}-history-skeleton-line ${a}-skeleton-preview`})]})]},g))})}),u]});if(s==="error"||c.length===0)return r(ne,{children:[r("div",{class:`${a}-history-empty`,children:t.historyEmpty}),u]});let _=Date.now(),m=typeof navigator<"u"?navigator.language:"en",h=Qs(_,c);return r(ne,{children:[r("div",{class:`${a}-history`,role:"list",children:h.map(g=>r("div",{class:`${a}-history-group`,children:[r("div",{class:`${a}-history-heading`,children:t[vu[g.bucket]]}),r("div",{class:`${a}-history-card`,children:g.conversations.map(p=>r("button",{type:"button",role:"listitem",class:`${a}-history-item`,onClick:()=>o(p),"data-closed":p.canContinue?void 0:"true","data-unread":(p.unreadCount??0)>0?"true":void 0,"data-testid":he(y.historyItem,p.conversationId),children:[r("span",{class:`${a}-history-avatar`,"aria-hidden":"true",children:r(kr,{})}),r("span",{class:`${a}-history-body`,children:[r("span",{class:`${a}-history-row`,children:[r("span",{class:`${a}-history-title`,children:p.title}),r("span",{class:`${a}-history-time`,children:bu(p.lastMessageAt,_,m)})]}),r("span",{class:`${a}-history-row`,children:[r("span",{class:`${a}-history-preview`,children:p.preview??(p.canContinue?t.historyContinue:t.conversationClosed)}),(p.unreadCount??0)>0?r("span",{class:`${a}-history-dot`}):null]})]})]},p.conversationId))})]},g.bucket))}),u]})}var Zs=x.cssPrefix;function el({suggestions:e,onPick:t}){return e.length===0?null:r("div",{class:`${Zs}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((n,o)=>r("button",{type:"button",class:`${Zs}-suggestion`,onClick:()=>t(n),"data-testid":he(y.suggestion,o),children:n.label},n.id))})}var Se=x.cssPrefix;function tl(e){let{options:t,onClose:n}=e,o=t.strings,i=M(null);w(()=>{let c=i.current;if(!c)return;let d=mo(c),u=_=>{_.key==="Escape"&&n?.()};return c.addEventListener("keydown",u),()=>{d(),c.removeEventListener("keydown",u)}},[n]);let a=M(null),s=H(c=>{a.current?.attachFromDrop(c)},[]),{visible:l}=vo({containerRef:i,onDrop:s});return po(i.current,t.mode==="modal"),r("div",{ref:i,class:`${Se}-panel`,role:"dialog","aria-modal":"false","aria-label":o.panelTitle,style:{position:"relative"},"data-testid":y.panel,children:[r(Br,{...e,containerEl:i.current,dragOver:l,composerAttachApiRef:a}),r(zr,{poweredBy:e.options.poweredBy})]})}function Br(e){let{options:t,transport:n,feedback:o,bus:i,panelSize:a,view:s,canSend:l,isStreaming:c,loadingMessages:d,messagesSig:u,agent:_,suggestions:m,initialWidgetSize:h,visitorId:g,onClose:p,onBack:v,onClear:E,onToggleHistory:S,onSelectHistoryConversation:B,onNewConversation:A,onWidgetSizeChange:W,onSend:K,onStop:D,onSuggestion:ue,activeForm:z,formMarkers:te,onFormSubmit:ve,onFormSkip:we,onFormFill:T,tool:O,containerEl:Q,dragOver:pe,composerAttachApiRef:fe}=e,P=t.strings,N;return z?N=null:l?N=r(ne,{children:[r(el,{suggestions:m,onPick:ue}),r(ks,{options:t,transport:n,feedback:o,bus:i,isStreaming:c,onSend:K,onStop:D,attachApiRef:fe})]}):N=r(Pu,{label:P.conversationClosed,ctaLabel:P.startNewConversation,onNewConversation:E}),r(ne,{children:[s==="history"?r(xu,{strings:P,onBack:S,onClose:p,showClose:fo(t.mode,a,t.actions)}):r("header",{class:`${Se}-header`,"data-testid":y.panelHeader,children:[v?r("button",{type:"button",class:`${Se}-icon-btn`,onClick:v,"aria-label":P.moduleBack,title:P.moduleBack,children:r(en,{})}):null,_?r(ys,{agent:_,strings:P}):r("h1",{children:P.panelTitle}),r(ze,{panelProps:e,variant:"chat"})]}),s==="history"?r(So,{transport:n,strings:P,visitorId:g,onSelect:me=>B(me.conversationId),onNewConversation:A}):r(ne,{children:[r(Cs,{visible:pe,strings:P}),r(Js,{messagesSig:u,strings:P,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,loading:d,idle:!c,tool:O,form:z?{form:z,onSubmit:ve,onSkip:we}:null,formMarkers:te,onFillForm:T}),N,r(yu,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?r(uo,{panelEl:Q,resize:t.size.resize,position:t.position,initialSize:h,onSizeChange:W,strings:P}):null]})}function xu({strings:e,onBack:t,onClose:n,showClose:o}){return r("header",{class:`${Se}-header`,children:[r("button",{type:"button",class:`${Se}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:r(en,{})}),r("h1",{children:e.historyTitle}),o?r("button",{type:"button",class:`${Se}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:r(Be,{})}):null]})}function Pu({label:e,ctaLabel:t,onNewConversation:n}){return r("div",{class:`${Se}-readonly-banner`,role:"note",children:[r("span",{class:`${Se}-readonly-label`,children:e}),r("button",{type:"button",class:`${Se}-readonly-cta`,onClick:n,children:t})]})}function yu({disclaimer:e}){return e?r("div",{class:`${Se}-composer-footer`,children:r("div",{class:`${Se}-disclaimer`,children:e})}):null}function zr({poweredBy:e}){return e?r("div",{class:`${Se}-poweredby-bar`,children:r(Su,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function Su({logoUrl:e,text:t,href:n}){let o=r(ne,{children:[e?r("img",{class:`${Se}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?r("span",{children:t}):null]});return n?r("a",{class:`${Se}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:o}):r("span",{class:`${Se}-poweredby`,children:o})}function nl(e){let t=M(e);t.current=e;let n=M(null);return n.current??(n.current=wu(t)),n.current}function wu(e){let t=F(null),n=new Set,o=c=>`${e.current.conversationId()??""}:${c}`,i=c=>c.frequency==="always"?!1:c.frequency==="conversation"?n.has(o(c.id)):c.id in e.current.persistence.loadFormsDone(),a=(c,d)=>{if(t.value)return;let u=e.current;if(c==="manual"){let _=u.forms.list.find(m=>m.id===d);_&&(t.value={form:_,trigger:"manual"});return}for(let _ of u.forms.byTrigger[c]??[]){let m=_.triggers.find(h=>h.kind===c);if(!(!m||!ku(m,u)||i(_)||!Cu(_,u))){t.value={form:_,trigger:c};return}}},s=(c,d)=>{let u=t.value;if(!u)return;t.value=null;let{form:_,trigger:m}=u;_.frequency==="conversation"?n.add(o(_.id)):_.frequency!=="always"&&e.current.persistence.saveFormDone(_.id),e.current.onComplete(_,m,c,d)};return{activeForm:t,fire:a,refresh:()=>{let c=t.value;if(!c)return;let d=e.current.forms.list.find(u=>u.id===c.form.id);d&&d!==c.form&&(t.value={form:d,trigger:c.trigger})},complete:c=>s(c,!1),skip:()=>s({},!0)}}function ku(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function Cu(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let i=t.userContext()??{};if(n.missingContext.some(a=>i[a]!==void 0&&i[a]!==""))return!1}if(n.pageArea&&!(Array.isArray(n.pageArea)?n.pageArea:[n.pageArea]).includes(t.pageArea()??""))return!1;let o=t.messageCount();return!(n.minMessages!=null&&o<n.minMessages||n.maxMessages!=null&&o>n.maxMessages)}function ol(e){let t=x.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":y.sidebar,children:[r("div",{class:`${t}-sidebar-header`,children:[r(Tu,{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":y.sidebarToggle,children:r(Eu,{collapsed:a})})]}),a?null:r(ne,{children:[s.length>0?r("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:r(Iu,{items:s})}):null,l.length>0?r("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:r(Au,{items:l})}):null,e.showConversations?r("div",{class:`${t}-sidebar-conversations`,children:r(So,{transport:e.transport,strings:e.strings,visitorId:e.visitorId,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function Tu({site:e}){let t=x.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??x.name})}function Eu({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 Iu({items:e}){let t=x.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 Au({items:e}){let t=x.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 rl=x.cssPrefix;function il(e){return r("main",{class:`${rl}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[r(ol,{site:e.site,blocks:e.blocks,transport:e.transport,strings:e.strings,visitorId:e.visitorId,showConversations:e.showConversations,onSelectConversation:e.onSelectConversation,onNewConversation:e.onNewConversation,collapsed:e.sidebarCollapsed,onToggleCollapsed:e.onToggleSidebarCollapsed}),r("section",{class:`${rl}-page-chat`,"aria-label":"Chat",children:e.children})]})}var al=e=>Object.fromEntries(e.map(t=>[t,[]]));function sl(e,t,n){let o=F({activeTab:e,stacks:al(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:al(t)}}}}var ll=e=>e.stacks[e.activeTab]??[],cl=e=>ll(e).at(-1),dl=e=>ll(e).length===0;var _l={Icon:tn};var tt=x.cssPrefix;function wo({title:e,actions:t}){return r("header",{class:`${tt}-back-header`,"data-variant":"title",children:[r("span",{class:`${tt}-back-spacer`,"aria-hidden":"true"}),r("h1",{class:`${tt}-back-title`,children:e}),t??r("span",{class:`${tt}-back-spacer`,"aria-hidden":"true"})]})}function ko({title:e,backLabel:t,onBack:n,actions:o,testid:i}){return r("header",{class:`${tt}-back-header`,"data-testid":i,children:[r("button",{type:"button",class:`${tt}-icon-btn`,onClick:n,"aria-label":t,title:t,children:r(en,{})}),r("h1",{class:`${tt}-back-title`,children:e}),o??r("span",{class:`${tt}-back-spacer`,"aria-hidden":"true"})]})}var Mt=x.cssPrefix;function ul({placeholder:e,onActivate:t}){return r("button",{type:"button",class:`${Mt}-home-search`,onClick:t,"data-testid":y.homeSearch,children:[r("span",{class:`${Mt}-home-search-text`,children:e}),r("span",{class:`${Mt}-home-search-icon`,"aria-hidden":"true",children:r(Tr,{})})]})}function pl({placeholder:e,value:t,onInput:n}){return r("div",{class:`${Mt}-home-search`,"data-input":"true",children:[r("input",{type:"search",class:`${Mt}-home-search-input`,placeholder:e,value:t,onInput:o=>n(o.currentTarget.value),"data-testid":y.helpSearch}),r("span",{class:`${Mt}-home-search-icon`,"aria-hidden":"true",children:r(Tr,{})})]})}var an=x.cssPrefix;function Co({title:e,subtitle:t,onClick:n,testid:o}){return r("button",{type:"button",class:`${an}-list-row`,onClick:n,"data-testid":o,children:[r("span",{class:`${an}-list-row-body`,children:[r("span",{class:`${an}-list-row-title`,children:e}),t?r("span",{class:`${an}-list-row-sub`,children:t}):null]}),r("span",{class:`${an}-list-row-chevron`,"aria-hidden":"true",children:r(It,{})})]})}var fl=x.cssPrefix;function Oe({tone:e="info",message:t,onRetry:n,strings:o}){return r("div",{class:`${fl}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[r("span",{children:t}),n?r("button",{type:"button",class:`${fl}-module-retry`,onClick:n,children:o.errorRetry}):null]})}var ct=x.cssPrefix,Ru=U.scope("help"),Lu=(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 Mu(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 ml(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 Ou(e,t){let n=t.toLowerCase().trim();return n?e.map(o=>({item:o,score:Math.max(ml(n,o.title)*2,ml(n,o.description??""))})).filter(o=>o.score>0).toSorted((o,i)=>i.score-o.score).map(o=>o.item):[]}function gl({article:e,nav:t}){return r(Co,{title:e.title,subtitle:e.description,onClick:()=>Lu(t,e),testid:he(y.helpArticle,e.id)})}function Nu({transport:e,strings:t,config:n,nav:o,panelProps:i}){let a=n.contentTags,[s,l]=k("loading"),[c,d]=k(t.errorGeneric),[u,_]=k([]),[m,h]=k(""),[g,p]=k(0);w(()=>{let S=!1;return l("loading"),e.listContent({tags:a,sortBy:"order",limit:100}).then(B=>{S||(_(B.items??[]),l("loaded"))}).catch(B=>{S||(Ru.warn("listContent (help) failed",{err:B}),d(it(B,t)),l("error"))}),()=>{S=!0}},[e,a,g]);let v=xe(()=>Ou(u,m),[u,m]);function E(){return m.trim().length>0?v.length===0?r(Oe,{message:t.helpSearchEmpty,strings:t}):r("div",{class:`${ct}-help-card`,children:v.map(S=>r(gl,{article:S,nav:o},S.id))}):s==="loading"?r(Oe,{message:t.helpLoading,strings:t}):s==="error"?r(Oe,{tone:"error",message:c,onRetry:()=>p(S=>S+1),strings:t}):u.length===0?r(Oe,{message:t.helpEmpty,strings:t}):Mu(u).map(([S,B])=>r("section",{class:`${ct}-help-group`,children:[S?r("h2",{class:`${ct}-help-section-title`,children:S}):null,r("div",{class:`${ct}-help-card`,children:B.map(A=>r(gl,{article:A,nav:o},A.id))})]},S))}return r("div",{class:`${ct}-module`,children:[r(wo,{title:t.helpTitle,actions:r(ze,{panelProps:i,variant:"plain"})}),r("div",{class:`${ct}-module-pad`,children:r(pl,{placeholder:t.helpSearchPlaceholder,value:m,onInput:h})}),r("div",{class:`${ct}-help-list`,children:E()})]})}var hl={Icon:Cr,Root:e=>r(Nu,{...e})};var vl=x.cssPrefix;function Ur({onClick:e,children:t,testid:n}){return e?r("button",{type:"button",class:`${vl}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):r("div",{class:`${vl}-home-card`,"data-testid":n,children:t})}var oe=x.cssPrefix,bl=U.scope("home");function Du(e){let t=e.options.userContext?.name,n=e.config.greetingText?$e(e.strings,e.config.greetingText):void 0;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 $u=(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 Hu(e){let{transport:t,strings:n,config:o,nav:i,panelProps:a}=e,[s,l]=k(null),[c,d]=k([]),u=o.contentTags?.join(",");w(()=>{if(!o.showRecentConversations)return;let v=!1;return t.listConversations({limit:1}).then(E=>!v&&l(E.conversations?.[0]??null)).catch(E=>!v&&bl.warn("listConversations (home) failed",{err:E})),()=>{v=!0}},[t,o.showRecentConversations]),w(()=>{if(!o.contentTags?.length)return;let v=!1;return t.listContent({tags:o.contentTags,limit:6}).then(E=>!v&&d(E.items??[])).catch(E=>!v&&bl.warn("listContent (home) failed",{err:E})),()=>{v=!0}},[t,u]);let _=Du(e),m=o.userAvatars??[],h=o.status,g=h?.text?$e(n,h.text):n.homeStatus,p=o.contentBlockTitle?$e(n,o.contentBlockTitle):n.homeContentTitle;return r("div",{class:`${oe}-module ${oe}-home`,"data-testid":y.homeView,children:r("div",{class:`${oe}-home-scroll`,children:[r("div",{class:`${oe}-home-hero`,children:[r("div",{class:`${oe}-home-hero-top`,children:[o.brandName?r("span",{class:`${oe}-home-brand`,"data-testid":y.homeBrand,children:o.brandName}):r("span",{class:`${oe}-home-brand-spacer`,"aria-hidden":"true"}),r("div",{class:`${oe}-home-hero-actions`,children:[m.length>0?r("div",{class:`${oe}-home-avatars`,children:m.map(v=>r("span",{class:`${oe}-home-avatar`,title:v.role?`${v.name} \xB7 ${v.role}`:v.name,children:v.avatar?r("img",{src:v.avatar,alt:"",loading:"lazy"}):r("span",{children:go(v.name)})},v.name))}):null,r(ze,{panelProps:a,variant:"plain"})]})]}),o.showGreeting!==!1?r(ne,{children:[r("h1",{class:`${oe}-home-greeting`,"data-testid":y.homeGreeting,children:_.title}),_.subtitle?r("p",{class:`${oe}-home-lead`,children:_.subtitle}):null]}):null]}),r("div",{class:`${oe}-home-cards`,children:[o.showSearchBar!==!1?r(ul,{placeholder:n.homeSearchPlaceholder,onActivate:()=>i.switchToLayout("help")}):null,s?r(Ur,{onClick:()=>i.selectConversation(s.conversationId),testid:y.homeRecent,children:r("div",{class:`${oe}-home-recent-row`,"data-unread":(s.unreadCount??0)>0?"true":void 0,children:[r("span",{class:`${oe}-home-recent-avatar`,"aria-hidden":"true",children:r(tn,{})}),r("span",{class:`${oe}-home-recent-body`,children:[r("span",{class:`${oe}-home-recent-title`,children:s.title}),s.preview?r("span",{class:`${oe}-home-recent-preview`,children:s.preview}):null]}),(s.unreadCount??0)>0?r("span",{class:`${oe}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,h?r(Ur,{onClick:h.url?()=>i.push({kind:"iframe",url:h.url,title:g}):void 0,children:r("div",{class:`${oe}-home-status`,"data-level":h.level??"operational",children:[r("span",{class:`${oe}-home-status-icon`,"aria-hidden":"true",children:r(_s,{})}),r("span",{class:`${oe}-home-status-text`,children:g})]})}):null,c.length>0?r("section",{class:`${oe}-home-content`,children:[r("div",{class:`${oe}-home-content-title`,children:p}),r("div",{class:`${oe}-home-content-list`,children:c.map(v=>r(Co,{title:v.title,subtitle:v.description,onClick:()=>$u(i,v),testid:he(y.homeContentRow,v.id)},v.id))})]}):null]})]})})}var xl={Icon:us,Root:e=>r(Hu,{...e})};var We=x.cssPrefix,Fu=U.scope("news");function Bu({transport:e,strings:t,config:n,nav:o,panelProps:i}){let a=n.contentTags,[s,l]=k("loading"),[c,d]=k(t.errorGeneric),[u,_]=k([]),[m,h]=k(0);w(()=>{let p=!1;return l("loading"),e.listContent({tags:a,sortBy:"publishedAt",sortOrder:"desc"}).then(v=>{p||(_(v.items??[]),l("loaded"))}).catch(v=>{p||(Fu.warn("listContent (news) failed",{err:v}),d(it(v,t)),l("error"))}),()=>{p=!0}},[e,a,m]);function g(){return s==="loading"?r(Oe,{message:t.newsLoading,strings:t}):s==="error"?r(Oe,{tone:"error",message:c,onRetry:()=>h(p=>p+1),strings:t}):u.length===0?r(Oe,{message:t.newsEmpty,strings:t}):r("div",{class:`${We}-news-list`,children:u.map(p=>r("button",{type:"button",class:`${We}-news-card`,onClick:()=>o.push({kind:"content",id:p.id,title:p.title}),"data-testid":he(y.newsItem,p.id),children:[p.image?r("img",{class:`${We}-news-hero`,src:p.image,alt:"",loading:"lazy"}):null,r("span",{class:`${We}-news-body`,children:[p.tags&&p.tags.length>0?r("span",{class:`${We}-news-tags`,children:p.tags.map(v=>r("span",{class:`${We}-news-tag`,children:v},v))}):null,r("span",{class:`${We}-news-title`,children:p.title}),p.description?r("span",{class:`${We}-news-summary`,children:p.description}):null]})]},p.id))})}return r("div",{class:`${We}-module`,children:[r(wo,{title:t.newsTitle,actions:r(ze,{panelProps:i,variant:"plain"})}),r("div",{class:`${We}-module-scroll`,children:g()})]})}var Pl={Icon:ps,Root:e=>r(Bu,{...e})};var To={chat:_l,home:xl,help:hl,news:Pl};var sn=x.cssPrefix;function yl({modules:e,activeTab:t,strings:n,unreadCount:o,onSelect:i}){return r("nav",{class:`${sn}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let s=To[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:`${sn}-tab`,onClick:()=>i(a.id),"data-testid":he(y.tab,a.id),children:[r("span",{class:`${sn}-tab-icon`,"aria-hidden":"true",children:[r(s,{}),c?r("span",{class:`${sn}-tab-badge`,"data-testid":y.tabBadge,children:c}):null]}),r("span",{class:`${sn}-tab-label`,children:$e(n,a.label)})]},a.id)})})}var Sl=x.cssPrefix,zu="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function wl({url:e,title:t,strings:n,onBack:o,actions:i}){return r("div",{class:`${Sl}-module`,children:[r(ko,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:o,actions:i}),r("iframe",{class:`${Sl}-content-frame`,src:e,title:t||"content",sandbox:zu,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var dt=x.cssPrefix,Uu=U.scope("content");function kl({id:e,title:t,transport:n,strings:o,onBack:i,actions:a}){let[s,l]=k(null),[c,d]=k(!1),[u,_]=k(0),m=H(()=>{d(!1),l(null),_(g=>g+1)},[]);w(()=>{let g=!1;return n.listContent({ids:[e],limit:1}).then(p=>{if(g)return;let v=p.items[0];v?l(v):d(!0)}).catch(p=>{g||(Uu.warn("listContent (reader) failed",{err:p}),d(!0))}),()=>{g=!0}},[n,e,u]);function h(){return c?r(Oe,{tone:"error",message:o.errorGeneric,onRetry:m,strings:o}):s===null?r(Oe,{message:o.contentLoading,strings:o}):r("article",{class:`${dt}-content`,"data-testid":y.contentView,children:[s.image?r("img",{class:`${dt}-content-hero`,src:s.image,alt:"",loading:"lazy"}):null,s.description?r("p",{class:`${dt}-content-subtitle`,children:s.description}):null,s.tags?.length?r("span",{class:`${dt}-news-tags`,children:s.tags.map(g=>r("span",{class:`${dt}-news-tag`,children:g},g))}):null,r(Bs,{text:s.content??""})]})}return r("div",{class:`${dt}-module`,children:[r(ko,{title:s?.title||t||o.moduleBack,backLabel:o.moduleBack,onBack:i,actions:a,testid:y.backHeader}),r("div",{class:`${dt}-module-scroll`,"data-testid":y.contentScroll,children:h()})]})}var Wr=x.cssPrefix;function Cl({panelProps:e,enabledModules:t,nav:n,unreadCount:o,onSelectConversation:i,onStartNewConversation:a,onSetPanelSize:s}){let l=e.options,c=l.strings,d=M(null);w(()=>{let D=d.current;if(!D)return;let ue=mo(D),z=te=>{te.key==="Escape"&&e.onClose?.()};return D.addEventListener("keydown",z),()=>{ue(),D.removeEventListener("keydown",z)}},[e.onClose]);let u=M(null),_=H(D=>{u.current?.attachFromDrop(D)},[]),{visible:m}=vo({containerRef:d,onDrop:_});po(d.current,l.mode==="modal");let h=re(()=>n.sig.value).value,g=cl(h),p=l.modules.byId[h.activeTab],v=g?.kind==="iframe"||g?.kind==="content",E=t.length>1&&(dl(h)||!v),S=M(null);w(()=>{if(v&&S.current===null)S.current=e.panelSize,e.panelSize==="normal"&&s("expanded");else if(!v&&S.current!==null){let D=S.current;S.current=null,s(D)}},[v]);let B={push:n.push,pop:n.pop,switchTab:n.switchTab,switchToLayout:D=>{let ue=t.find(z=>z.layout===D);ue&&n.switchTab(ue.id)},selectConversation:i,startNewConversation:a},A=D=>({options:l,transport:e.transport,strings:c,config:D,visitorId:e.visitorId,nav:B,panelProps:e}),W=r(ze,{panelProps:e,variant:"plain"}),K;if(g?.kind==="iframe")K=r(wl,{url:g.url,title:g.title,strings:c,onBack:n.pop,actions:W});else if(g?.kind==="content")K=r(kl,{id:g.id,title:g.title,transport:e.transport,strings:c,onBack:n.pop,actions:W});else if(p?.layout==="chat")K=r(Br,{...e,containerEl:d.current,dragOver:m,composerAttachApiRef:u});else if(p){let D=To[p.layout].Root;K=D?r(D,{...A(p)},p.id):null}else K=null;return r("div",{ref:d,class:`${Wr}-panel ${Wr}-messenger`,role:"dialog","aria-modal":"false","aria-label":c.panelTitle,style:{position:"relative"},"data-testid":y.messengerHome,children:[r("div",{class:`${Wr}-messenger-body`,children:K}),E?r(yl,{modules:t,activeTab:h.activeTab,strings:c,unreadCount:o,onSelect:n.switchTab}):null,r(zr,{poweredBy:l.poweredBy}),l.size.resize?.enabled&&!(p?.layout==="chat"&&!g)?r(uo,{panelEl:d.current,resize:l.size.resize,position:l.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:c}):null]})}var ln=x.cssPrefix;function Tl({strings:e,onClose:t}){return r("div",{class:`${ln}-panel ${ln}-modules-empty`,role:"dialog","aria-label":e.panelTitle,"data-testid":y.modulesEmpty,children:[t?r("button",{type:"button",class:`${ln}-icon-btn ${ln}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:r(Be,{})}):null,r("p",{class:`${ln}-modules-empty-text`,children:e.modulesEmpty})]})}function El({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=H(()=>{a(!0),o||t.saveCalloutDismissed(n)},[t,n,o]);return{dismissed:i,dismissCallout:s}}var V=U.scope("app"),Gr=x.cssPrefix;function Il({options:e,hostElement:t,bus:n}){let[o]=k(()=>yt(e.widgetId,e.storage,e.aiAgentDeploymentId)),[i,a]=k(()=>o.getVisitorId()),s=o.loadUserPrefs(),[l,c]=k(()=>s.locale??e.locale),[d,u]=k(()=>s.themeMode??e.themeMode),[_,m]=k(()=>s.textSize??e.textSize),h=rt(o.loadConversationId()),g=rt([]),p=rt(0),[v,E]=k(!1),[S,B]=k([]);function A(){let f=e.modules.list,b=new Set(f.map(R=>R.id)),L=o.loadActiveModule();return L&&b.has(L)?L:f[0]?.id??""}function W(){return e.modules.list.find(f=>f.layout==="chat")?.id}let K=M();if(!K.current){let f=e.modules.list.map(b=>b.id);K.current=sl(A(),f,b=>o.saveActiveModule(b))}let D=K.current,ue=M(void 0);ue.current=W();let[z,te]=k(!1),[ve,we]=k(null),[T,O]=k(!1),Q=e.mode==="standalone"||e.mode==="inline",pe=M(Qt(e,Ct(),o.loadPanelOpen(),o.loadPanelSize())),[fe,P]=k(pe.current.panelOpen),[N,me]=k(pe.current.panelOpen),ke=M(N);ke.current=N;let Ce=M(!1),Je=M(void 0);w(()=>{fe&&me(!0)},[fe]);let Ot=M(!1),[_t,Nt]=k(!1),{dismissed:Ie,dismissCallout:Dt}=El({callout:e.launcher.callout,persistence:o}),Ye=e.launcher.callout?.persistent??!0,cn=H(()=>{V.info("calloutDismiss"),n.emit("calloutDismiss",void 0),Dt()},[n,Dt]),[Ae,ut]=k(pe.current.panelSize),Xr=M(!1),[Nl,Io]=k("chat"),[$t,Ht]=k(!0),[Ge,dn]=k(!1),[Dl,Jr]=k(null),[Ao,_n]=k([]),[un,pn]=k(null),[$l,Hl]=k(void 0),[Fl,Bl]=k(void 0),[zl,Ul]=k(()=>o.loadSidebarCollapsed()??!1),[Ro,Wl]=k({}),[J]=k(()=>new to({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:wa({publicKey:e.publicKey,aiAgentDeploymentId:e.aiAgentDeploymentId,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints})),[Ne]=k(()=>new io(g)),[ie]=k(()=>new co(e.sound,e.haptics)),Fe=H(f=>{o.patchUserPrefs(f),J.saveUserPrefs(o.loadUserPrefs()).catch(b=>{V.warn("saveUserPrefs failed",{err:b})})},[o,J]);w(()=>{s.soundMuted!==void 0&&ie.setMuted(s.soundMuted)},[]),w(()=>{t.dataset.theme=d},[t,d,e]),w(()=>{t.dataset.textSize=_},[t,_,e]),w(()=>{ie.update(e.sound,e.haptics)},[ie,e.sound,e.haptics]),w(()=>()=>ie.destroy(),[ie]),w(()=>{let f=!0;return ie.mutedSig.subscribe(b=>{if(f){f=!1;return}Fe({soundMuted:b})})},[ie,Fe]),w(()=>{Xr.current||!e.size.initialSize||(Xr.current=!0,!o.loadPanelSize()&&ut(br(e.mode,e.size,Ct())))},[e.mode,e.size,o]),w(()=>{if(!z||Ot.current)return;Ot.current=!0;let f=Qt(e,Ct(),o.loadPanelOpen(),o.loadPanelSize());P(f.panelOpen),ut(f.panelSize)},[z,e,o]);let Yr=M(!1),Qr=M(!1),fn=M(null);w(()=>{if(!(!z||Yr.current)){if(Yr.current=!0,Qr.current){let f=ue.current;f&&D.switchTab(f);return}D.reset(A())}},[z]);let mn=H(f=>{!f||f.length===0||(g.value=f.map(yr))},[g]),Lo=M(null),gn=H(async f=>{try{let{formSubmissions:b}=await(f?J.bootstrap(f):Lo.current??J.bootstrap()),L=new Map;return b.forEach((R,G)=>L.set(R.formId,G)),b.filter((R,G)=>!R.skipped||L.get(R.formId)===G).map((R,G)=>({key:`wire:${R.formId}:${R.createdAt??G}`,formId:R.formId,outcome:R.skipped?"skipped":"submitted",createdAt:eo(R.createdAt),values:R.values}))}catch(b){return V.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:b}),[]}},[J]),Ft=M(0),Bt=H((f,b)=>{let L=[...f.map(de=>de.createdAt),...b.map(de=>de.createdAt)].filter(de=>de!==void 0),R=(L.length?Math.min(...L):Date.now())-1,G=new Set(f.map(de=>de.id));return[...(Je.current?.messages??[]).filter(de=>!G.has(de.id)).map(de=>{let Vt=yr(de);return Vt.createdAt=R,Vt}),...f]},[]),Mo=H(async f=>{let b=Ft.current,L=()=>b!==Ft.current;E(!0);try{let[R,G]=await Promise.all([J.loadConversation(f),gn()]);if(L())return;let C=(R.messages??[]).map(Sr);B(G);let de=fn.current?[fn.current]:[];C.length||de.length?(g.value=[...Bt(C,G),...de],Ht(R.canContinue??!0),_n(R.suggestions??[])):g.value=Bt([],G)}catch(R){if(L())return;V.warn("loadThread failed; resetting conversationId",{err:R,conversationId:f}),h.value=void 0,o.saveConversationId(void 0)}finally{L()||E(!1)}},[J,gn,g,h,o,Bt]),zt=H(async({newConversation:f})=>{let b=++Ft.current,L=()=>b!==Ft.current,R=h.value,G=f||!R?He():R;G!==R&&(h.value=G,o.saveConversationId(G));let C;try{C=await J.handshake({visitorId:i,conversationId:G,userPrefs:o.loadUserPrefs(),locale:l})}catch(Vt){if(L())return;n.emit("error",Vt),e.onError?.(Vt),f||te(!0);return}if(L())return;C.visitorId&&C.visitorId!==i&&(V.info("visitor rebound",{previous:i,current:C.visitorId,reason:C.rebind?.visitorId}),o.setVisitorId(C.visitorId),a(C.visitorId),n.emit("visitorRebound",{previous:i,current:C.visitorId,reason:C.rebind?.visitorId})),C.conversationId&&C.conversationId!==G&&(V.info("conversation rebound",{previous:G,current:C.conversationId,reason:C.rebind?.conversationId}),n.emit("conversationRebound",{previous:G,current:C.conversationId,reason:C.rebind?.conversationId})),C.agent&&Jr(C.agent),C.welcome?.suggestions&&_n(C.welcome.suggestions),e.mode==="page"&&(C.site&&ya(C.site)?Hl(C.site):C.site&&V.warn("invalid site config, using fallback",{site:C.site}),C.blocks&&Sa(C.blocks)?Bl(C.blocks):C.blocks&&V.warn("invalid blocks config, using fallback",{blocks:C.blocks})),C.userPrefs&&!f&&(o.saveUserPrefs(C.userPrefs),C.userPrefs.locale&&c(C.userPrefs.locale),C.userPrefs.soundMuted!==void 0&&ie.setMuted(C.userPrefs.soundMuted),C.userPrefs.themeMode&&u(C.userPrefs.themeMode),C.userPrefs.textSize&&m(C.userPrefs.textSize)),Je.current=C.welcome,!f&&R&&C.conversationId===R?ke.current?Mo(R):Ce.current=!0:(h.value=C.conversationId,o.saveConversationId(C.conversationId),mn(C.welcome?.messages)),f||(n.emit("handshake",C),te(!0))},[J,i,o,e,n,h,ie,mn,Mo,l]),Ut=JSON.stringify(e.userContext??null),Gl=JSON.stringify(e.pageContext??null),Vl=JSON.stringify(Ro);w(()=>{let f=Object.keys(Ro).length?{...Ro,...e.userContext}:e.userContext;J.setContext(f,Wu(e.pageContext))},[J,Ut,Gl,Vl]);let De=vt(l,e.availableLocales,e.defaultLocale);w(()=>{J.setLocale(De)},[J,De]),w(()=>{De!==l&&c(De)},[De,l]);let Kl=H(async f=>{let b=null;try{for await(let L of f.iter){if(!b){b=no(),fn.current=b,Ne.attach(b),g.value=[...g.value,b],dn(!0),pn(()=>f.cancel),Qr.current=!0;let R=ue.current;R&&D.switchTab(R),V.info("resumed in-flight reply on mount")}Ne.apply(L.chunk),L.chunk.type==="finish"&&L.chunk.canContinue===!1&&Ht(!1)}b&&(b.status="complete",ie.play("messageReceived"),Vr(n,e,"assistant",wr(b)))}catch(L){b&&(b.status="error",b.errorText=it(L,e.strings),ie.play("error")),V.debug("mount resume ended without completing",{err:L})}finally{fn.current=null,b&&(Ne.detach(),dn(!1),pn(null),g.value=[...g.value])}},[Ne,g,ie,n,e,D]),Zr=M(null);w(()=>{let f=h.value;return f&&J.primeIdentity(i,f),zt({newConversation:!1}),()=>{Ft.current++,Zr.current?.cancel()}},[]),w(()=>{if(N){if(Lo.current=J.bootstrap(),(async()=>{try{let f=await Lo.current;we(qt((f??{forms:[]}).forms,De))}catch(f){V.debug("bootstrap failed \u2014 treating as no forms",{err:f})}finally{O(!0)}})(),Ce.current){Ce.current=!1;let f=h.value;f&&Mo(f)}if(h.value){let f=J.resumeStream();Zr.current=f,Kl(f)}}},[N]);let hn=M(null);w(()=>{if(!N)return;if(hn.current===null){hn.current=De;return}if(hn.current===De)return;hn.current=De;let f=!1;return J.bootstrap().then(b=>{f||we(qt((b??{forms:[]}).forms,De))}).catch(b=>V.debug("forms re-localize failed \u2014 keeping current copy",{err:b})),()=>{f=!0}},[N,De,J]);let ei=M(Ut);w(()=>{!z||ei.current===Ut||(ei.current=Ut,zt({newConversation:!1}))},[Ut,z,zt]),w(()=>{Bn(t,Zn(e.mode,Ae,fe))},[t,fe,Ae,e.mode]),w(()=>{if(e.mode!=="modal"||!fe)return;let f=b=>{b.composedPath().some(G=>G instanceof HTMLElement&&G.classList.contains(`${x.cssPrefix}-panel`))||P(!1)};return t.addEventListener("click",f),()=>t.removeEventListener("click",f)},[t,fe,e.mode]),w(()=>{if(e.mode!=="drawer"||!fe)return;let f=b=>{b.key==="Escape"&&P(!1)};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[fe,e.mode]);let vn=H(async(f,b)=>{let L=h.value??He();h.value||(h.value=L,o.saveConversationId(L));let R=Aa({messages:g.value.slice(0,-1).map(Na),conversationId:L,tools:e.features.tools,responseMode:e.responseMode,trigger:b,visitorId:i,userPrefs:o.loadUserPrefs()});dn(!0);let G=J.sendMessage(R);pn(()=>G.cancel);try{for await(let C of G.iter)Ne.apply(C.chunk),C.chunk.type==="finish"&&C.chunk.canContinue===!1&&Ht(!1);f.status="complete",ie.play("messageReceived"),Vr(n,e,"assistant",wr(f))}catch(C){f.status="error",f.errorText=it(C,e.strings),ie.play("error"),n.emit("error",C),e.onError?.(C)}finally{Ne.detach(),dn(!1),pn(null),g.value=[...g.value]}},[J,Ne,g,h,e,n,ie,o,i]),bn=H((f,b,L)=>{if(Ge)return;let R=g.value.at(-1),G=R?.partsSig.value.find(de=>de.kind==="tool"&&de.toolCallId===f);if(!G){V.warn("resolveTool: tool part not found",{toolCallId:f});return}L(G),R&&(R.partsSig.value=[...R.partsSig.value]);let C=no();g.value=[...g.value,C],Ne.attach(C),vn(C,b)},[Ge,g,Ne,vn]),ti=H((f,b)=>{V.info("toolResult",{toolCallId:f}),n.emit("toolResult",{toolCallId:f}),bn(f,ro.toolResult,L=>{L.outputSig.value=b,L.stateSig.value="output"})},[n,bn]),ni=H((f,b,L)=>{V.info("toolDecision",{toolCallId:f,approved:b}),n.emit("toolDecision",{toolCallId:f,approved:b}),bn(f,ro.toolApproval,R=>{let G=R.approvalSig.value?.id??f;R.approvalSig.value={id:G,approved:b,reason:L},R.stateSig.value="output"})},[n,bn]),ql=xe(()=>({humanInLoop:e.features.humanInLoop,onResult:ti,onDecision:ni}),[e.features.humanInLoop,ti,ni]),jl=()=>g.value.reduce((f,b)=>f+(b.role==="user"?1:0),0),pt=e.forms.list.length>0?e.forms:ve??e.forms,ae=nl({forms:pt,persistence:o,userContext:()=>e.userContext,messageCount:jl,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>h.value,onComplete:(f,b,L,R)=>{V.info("formSubmit",{formId:f.id,trigger:b,skipped:R}),n.emit("formSubmit",{formId:f.id,values:L,skipped:R}),B(C=>[...C.filter(de=>!(de.formId===f.id&&de.outcome==="skipped")),{key:`local:${f.id}:${Date.now()}`,formId:f.id,outcome:R?"skipped":"submitted",createdAt:Date.now(),...R?{}:{values:L}}]);let G=h.value??He();h.value||(h.value=G,o.saveConversationId(G),J.primeIdentity(void 0,G)),!R&&f.mirrorToContext&&Wl(C=>({...C,...L})),J.submitForm({formId:f.id,conversationId:G,trigger:b,values:L,skipped:R})}}),Xl=re(()=>ae.activeForm.value);w(()=>{ae.refresh()},[pt,ae]);let oi=e.pageContext?.area?String(e.pageContext.area):void 0,Jl=re(()=>g.value.length);w(()=>{z&&T&&ae.fire("pre-chat")},[z,T,ae]),w(()=>{T&&!$t&&ae.fire("conversation-closed")},[T,$t,ae]),w(()=>{z&&T&&oi&&ae.fire("page-area")},[z,T,oi,ae]);let Oo=xe(()=>{let f=pt.list.flatMap(b=>b.triggers).filter(b=>b.kind==="idle").map(b=>Number(b.param));return f.length?Math.min(...f)*1e3:0},[pt]);w(()=>{if(!Oo||!fe)return;let f=setTimeout(()=>ae.fire("idle"),Oo);return()=>clearTimeout(f)},[Oo,fe,ae,Jl.value]);let ri=H(async(f,b)=>{if(V.info("send",{textLen:f.length,attachments:b.length,streaming:Ge}),Ge)return;n.emit("send",{text:f,attachmentCount:b.length}),Ao.length>0&&_n([]);let L=await Vu(J,b,C=>{V.warn("upload failed",{err:C}),n.emit("error",C),e.onError?.(C)});ie.unlock(),ie.play("messageSent");let R=Oa(f,L),G=no();g.value=[...g.value,R,G],Ne.attach(G),Vr(n,e,"user",f),await vn(G,ro.submitMessage),ae.fire("after-messages")},[Ge,J,n,e,Ao.length,g,Ne,vn,ae]),Yl=H(()=>{V.info("stop"),n.emit("stop",void 0),un?.()},[un,n]),Ql=H(()=>{ie.toggleMuted();let f=ie.mutedSig.value;V.info("soundToggle",{muted:f}),n.emit("soundToggle",{muted:f})},[ie,n]),Wt=H(()=>{if(Ps(e.mode,Ae)==="exit-fullscreen"){V.info("close \u2192 exit-fullscreen",{mode:e.mode}),ut("normal"),n.emit("fullscreen",!1);return}V.info("close \u2192 panel closed",{mode:e.mode}),ae.fire("panel-close"),P(!1),o.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,o,Ae,ae]),ft=H(()=>{e.modules.list.some(f=>f.layout==="chat")&&J.listConversations({limit:50}).then(f=>{p.value=f.conversations.reduce((b,L)=>b+(L.unreadCount??0),0)}).catch(f=>V.debug("refreshUnread failed (non-fatal)",{err:f}))},[J,e.modules,p]),ii=M(!1);w(()=>{!N||!z||ii.current||(ii.current=!0,ft())},[N,z,ft]);let No=H(()=>{V.info("open",{mode:e.mode}),ie.unlock(),Nt(!0),P(!0),o.savePanelOpen(!0),!Ie&&!Ye&&cn(),setTimeout(()=>Nt(!1),Gu),ft(),n.emit("open",void 0),e.onOpen?.()},[n,e,ie,o,Ie,Ye,cn,ft]),Do=H(()=>{if(!g.value.some(b=>b.role==="user")&&$t&&h.value){V.info("clear \u2192 reusing empty conversation",{conversationId:h.value}),g.value.length===0&&mn(Je.current?.messages);return}V.info("clear \u2192 new conversation",{wasStreaming:Ge}),n.emit("clear",void 0),Ge&&un?.(),g.value=[],h.value=void 0,o.clearConversation(),Ht(!0),B([]),zt({newConversation:!0})},[Ge,un,g,h,o,zt,n,$t,mn]),$o=H(()=>{Do(),Io("chat");let f=e.modules.list.find(b=>b.layout==="chat")?.id;f&&D.switchTab(f)},[Do,D,e]),Ho=H(()=>{let f=Ae==="expanded"?"normal":"expanded";V.info("expand",{from:Ae,expanded:f==="expanded"}),ut(f),o.savePanelSize(f),n.emit("expand",f==="expanded")},[n,Ae,o]),Fo=H(()=>{let f=Ae==="fullscreen"?"normal":"fullscreen";V.info("fullscreen",{from:Ae,fullscreen:f==="fullscreen"}),ut(f),o.savePanelSize(f),n.emit("fullscreen",f==="fullscreen")},[n,Ae,o]),Bo=H(()=>{if(!e.popOutUrl)return;let f=new URL(e.popOutUrl);h.value&&f.searchParams.set("conversation",h.value),e.widgetId!=="default"&&f.searchParams.set("widgetId",e.widgetId),V.info("popOut",{url:f.toString()}),window.open(f.toString(),"_blank","noopener,noreferrer"),n.emit("popOut",void 0)},[n,h,e.popOutUrl,e.widgetId]),Zl=H(()=>{Io(f=>{let b=f==="history"?"chat":"history";return V.info("toggleHistory",{view:b}),n.emit("toggleHistory",{view:b}),b})},[n]),ec=H(f=>{V.info("localeChange",{locale:f}),c(f),Fe({locale:f}),n.emit("localeChange",f)},[Fe,n]),tc=H(f=>{V.info("themeChange",{mode:f}),u(f),t.dataset.theme=f,Fe({themeMode:f}),n.emit("themeChange",f)},[t,Fe,n]),nc=H(f=>{V.info("textSizeChange",{size:f}),m(f),t.dataset.textSize=f,Fe({textSize:f}),n.emit("textSizeChange",f)},[t,Fe,n]),oc=H(()=>{Ul(f=>{let b=!f;return V.info("sidebarToggle",{collapsed:b}),o.saveSidebarCollapsed(b),n.emit("sidebarToggle",{collapsed:b}),b})},[o,n]),rc=H(f=>{V.info("resize",f),Fe({widgetSize:f}),n.emit("resize",f)},[Fe,n]),zo=H(async f=>{V.info("selectConversation",{conversationId:f}),n.emit("selectConversation",{conversationId:f});try{let[b,L]=await Promise.all([J.loadConversation(f),gn(f)]),R=b.messages.map(Sr);g.value=Bt(R,L),B(L),h.value=b.conversationId,o.saveConversationId(b.conversationId),b.agent&&Jr(b.agent),Ht(b.canContinue),_n(b.suggestions??[]),Io("chat"),await J.markRead(f),ft()}catch(b){n.emit("error",b),e.onError?.(b)}},[J,g,h,n,e,o,ft,gn,Bt]),xn=M(null),ai=H(f=>{typeof f=="string"&&(T?ae.fire("manual",f):xn.current=f)},[T,ae]);w(()=>{!T||!xn.current||(ae.fire("manual",xn.current),xn.current=null)},[T,ae]),w(()=>zi(t,{open:No,close:Wt,expand:Ho,fullscreen:Fo,popout:Bo,openForm:ai}),[t,No,Wt,Ho,Fo,Bo,ai]);let Re=xe(()=>cr(e,l,d,_),[e,l,d,_]),ic=xe(()=>S.map(f=>{let b=pt.list.find(L=>L.id===f.formId);return{...f,title:b?.title,form:b}}),[S,pt]),si={options:Re,transport:J,feedback:ie,bus:n,view:Nl,canSend:$t,isStreaming:Ge,loadingMessages:v,messagesSig:g,agent:Dl,suggestions:Ao,initialWidgetSize:s.widgetSize??null,visitorId:i,onClose:Wt,onClear:Do,onExpand:Ho,onFullscreen:Fo,onPopOut:Bo,onSoundToggle:Ql,onToggleHistory:Zl,onSelectHistoryConversation:zo,onNewConversation:$o,onLocaleChange:ec,onThemeChange:tc,onTextSizeChange:nc,onWidgetSizeChange:rc,onSend:ri,onStop:Yl,onSuggestion:f=>{let b=f.text??f.label;V.info("suggestion",{text:b}),n.emit("suggestion",{text:b}),ri(b,[])},activeForm:Xl.value?.form??null,formMarkers:ic,onFormSubmit:ae.complete,onFormSkip:ae.skip,onFormFill:f=>ae.fire("manual",f),tool:ql},ac=f=>{zo(f);let b=W();b&&D.switchTab(b)};if(!z)return null;let Gt=Re.modules.list,Uo=f=>{let b=nn("close",Re.mode,f);return Gt.length===0?r(Tl,{strings:Re.strings,onClose:b?Wt:void 0}):Gt.length===1&&Gt[0]?.layout==="chat"?r(tl,{...si,panelSize:f}):r(Cl,{panelProps:{...si,panelSize:f,onClose:b?Wt:void 0},enabledModules:Gt,nav:D,unreadCount:p.value,onSelectConversation:ac,onStartNewConversation:$o,onSetPanelSize:ut})};if(e.mode==="page"){let f=L=>{zo(L.conversationId)},b=Gt.some(L=>L.layout==="chat");return r("div",{class:`${Gr}-anchor`,children:r(il,{site:$l,blocks:Fl,transport:J,strings:Re.strings,visitorId:i,showConversations:b,onSelectConversation:f,onNewConversation:$o,sidebarCollapsed:zl,onToggleSidebarCollapsed:oc,children:Uo("fullscreen")})})}if(Q){let f=e.mode==="standalone"?"fullscreen":Ae;return r("div",{class:`${Gr}-anchor`,children:Uo(f)})}let li=e.mode==="drawer",ci=!(e.mode==="modal")&&!e.launcher.hidden&&(!fe||_t),di=ci&&!_t&&!Ie&&!li?Re.launcher.callout:null;return r("div",{class:`${Gr}-anchor`,"data-launcher-size":Re.launcher.size,children:[fe?Uo(Ae):null,ci?r(vs,{onToggle:No,launcher:Re.launcher,strings:Re.strings,leaving:_t,edgeTab:li}):null,di?r(bs,{callout:di,launcherPosition:Re.position,strings:Re.strings,closeLabel:Re.strings.close,onDismiss:cn}):null]})}function Wu(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var Gu=120;async function Vu(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 Vr(e,t,n,o){let i={role:n,text:o};e.emit("message",i),t.onMessage?.(i)}var Ku=U.scope("error-boundary"),Eo=class extends Ze{constructor(){super(...arguments);j(this,"state",{crashed:!1})}componentDidCatch(n,o){Ku.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 Al={open:()=>{},close:()=>{},expand:e=>({on:e}),fullscreen:e=>({on:e}),popOut:()=>{},send:e=>({attachments:e.attachmentCount}),message:e=>({role:e.role}),stop:()=>{},clear:()=>{},suggestion:()=>{},toggleHistory:e=>({view:e.view}),handshake:()=>{},formSubmit:e=>({formId:e.formId,skipped:e.skipped}),toolResult:()=>{},toolDecision:e=>({approved:e.approved}),attach:e=>({count:e.count,bytes:e.totalBytes}),voiceStart:()=>{},voiceStop:e=>({ms:e.durationMs}),voiceCancel:()=>{},localeChange:e=>({locale:e}),themeChange:e=>({theme:e}),textSizeChange:e=>({size:e}),soundToggle:e=>({muted:e.muted}),sidebarToggle:e=>({collapsed:e.collapsed}),calloutDismiss:()=>{},error:()=>{}};function qu(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function ju(){return location.origin+location.pathname}function Xu(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function Rl(e,t){let n=Math.random(),o=0,i=0,a=new Set,s=(c,d)=>{let{tracking:u,publicKey:_,aiAgentDeploymentId:m,mode:h,themeMode:g}=t.getOptions();if(!u.enabled||qu()||n>=u.sampleRate)return;let p=performance.now();if(p-o>6e4&&(o=p,i=0),++i>60)return;let v=new URLSearchParams;v.set("v","1"),v.set("e",c),u.token&&v.set("tk",u.token),_&&v.set("pk",_),m&&v.set("dep",m),v.set("vid",t.getVisitorId());let E=t.getConversationId();E&&v.set("cid",E),v.set("url",ju());let S=Xu();S&&v.set("ref",S),v.set("sw",String(screen.width)),v.set("sh",String(screen.height)),v.set("vw",String(innerWidth)),v.set("vh",String(innerHeight)),v.set("dpr",String(devicePixelRatio)),v.set("lang",navigator.language);try{v.set("tz",Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{}if(v.set("m",h),v.set("th",g),d)for(let[K,D]of Object.entries(d))D!==void 0&&v.set(K,String(D));v.set("ts",String(Date.now()));let B=`${u.endpoint}?${v}`;if(B.length>2e3)return;let A=new Image(1,1);a.add(A);let W=()=>a.delete(A);A.addEventListener("load",W,{once:!0}),A.addEventListener("error",W,{once:!0}),A.src=B},l=Object.keys(Al).map(c=>e.on(c,d=>s(c,Al[c]?.(d))));return()=>{for(let c of l)c();a.clear()}}function Ll(e){let{bus:t,host:n,appRoot:o,persistence:i,reportError:a}=e,s=e.initialRaw,l,c=ht(s),d=!0,u=()=>{c=ht(l?dr(s,l):s)},_=()=>{Ji(n,jt(c.mode));let g=i.loadUserPrefs().themeMode;Yi(n,g?{...c,themeMode:g}:c),d&&(Bn(n,Kr(c)),d=!1)},m=()=>{_(),An(In(Eo,{onError:a},In(Il,{bus:t,hostElement:n,options:c})),o)};t.on("handshake",g=>{g.config&&(l=g.config,u(),m())});let h=Rl(t,{getOptions:()=>c,getVisitorId:()=>i.getVisitorId(),getConversationId:()=>i.loadConversationId()});return{getOptions:()=>c,getUserOptions:()=>s,render:m,setUserOptions:g=>{s=g,u(),m()},patchUserOptions:g=>{s={...s,...g},u(),m()},destroy:()=>h()}}function Kr(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=yt(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:o}=Qt(e,Ct(),t.loadPanelOpen(),t.loadPanelSize());return Zn(e.mode,o,n)}var Ju=U.scope("hooks"),jr="*",qr=new Set;function Ml(e,t,n){let o={widgetId:e,event:t,listener:n};return qr.add(o),()=>{qr.delete(o)}}function Yu(e,t,n){let o=[...qr];for(let i of o)if(Qu(i.widgetId,e.widgetId)&&!(i.event!==jr&&i.event!==t))try{i.listener(e,t,n)}catch(a){Ju.warn("hook listener threw",{event:t,error:a})}}function Ol(e,t){let n=[];for(let o of Zu)n.push(t.on(o,i=>{Yu(e,o,i)}));return()=>{for(let o of n)o()}}function Qu(e,t){return e===jr||e===t}var Zu=["open","close","expand","fullscreen","popOut","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","visitorRebound","conversationRebound"];var Xe=new Map;function ep(e){e.debug!==void 0&&Nn(e.debug);let t=U.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=ht(e),o=n.widgetId,i=Xe.get(o);i&&(t.debug("destroy existing instance at slot",{widgetId:o}),i.destroy());let a=Kr(n),s=n.iframe?ea({position:jt(n.mode)},n.position,a,n.mode,e.target??null):Fn({position:jt(n.mode),target:e.target??null});s.hostElement.dataset.widgetId=o;let l=new Un,c=yt(o,n.storage,n.aiAgentDeploymentId),d=p=>{l.emit("error",p),u.getOptions().onError?.(p)},u=Ll({bus:l,host:s.hostElement,appRoot:s.appRoot,persistence:c,initialRaw:e,reportError:d});u.render();let _=s.hostElement,m=null,h=p=>{p.debug!==void 0&&Nn(p.debug),u.patchUserOptions(p)},g={widgetId:o,open:()=>xt(_,"open"),close:()=>xt(_,"close"),expand:()=>xt(_,"expand"),popOut:()=>xt(_,"popout"),openForm:p=>xt(_,"openForm",p),on:(p,v)=>l.on(p,v),update:p=>{t.debug("update",{patch:p}),h(p)},setUserContext:p=>{t.debug("setUserContext",{keys:Object.keys(p)}),h({userContext:{...u.getUserOptions().userContext,...p}})},clearUserContext:()=>{t.debug("clearUserContext"),h({userContext:void 0})},setPageContext:p=>{t.debug("setPageContext",{keys:Object.keys(p)}),h({pageContext:{...u.getUserOptions().pageContext,...p}})},clearPageContext:()=>{t.debug("clearPageContext"),h({pageContext:void 0})},setDebug:p=>{Nn(p),t.info("debug level set",{level:or()})},debugLevel:()=>or(),onLog:p=>Ri(p),destroy:()=>{t.info("destroy",{widgetId:o}),m?.(),u.destroy(),l.clear(),An(null,s.appRoot),s.destroy(),Xe.get(o)===g&&Xe.delete(o)}};return m=Ol(g,l),Xe.set(o,g),g}function SP(e){let t=e.widgetId??"default",n=Xe.get(t);return n?(n.update(e),n):ep(e)}function wP(e){if(e!==void 0){Xe.get(e)?.destroy();return}let t=[...Xe.values()];for(let n of t)n.destroy()}function kP(e="default"){return Xe.get(e)??null}function CP(){return[...Xe.values()]}function TP(e,t,n){return Ml(e,t,n)}var EP="0.1.0",IP=x;export{jr as HOOK_WILDCARD,IP as brand,wP as destroy,CP as getAllInstances,kP as getInstance,TP as hook,SP as init,ep as mount,Kr as resolveInitialHostMode,EP as version};
40
40
  //# sourceMappingURL=elements.esm.js.map